summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2009-11-16 20:45:05 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2009-11-16 20:45:05 (GMT)
commitd2b87ec47ebdb096c331c7b62a195b9cea2f33ae (patch)
treea066f01361afaf5df457cef612bb0bb9fd80fe18
parentee5a1e07350f0dcf3ef07d9443aa2f4c073392f4 (diff)
downloadhdf5-d2b87ec47ebdb096c331c7b62a195b9cea2f33ae.zip
hdf5-d2b87ec47ebdb096c331c7b62a195b9cea2f33ae.tar.gz
hdf5-d2b87ec47ebdb096c331c7b62a195b9cea2f33ae.tar.bz2
[svn-r17896] Description:
Bring r17546:17895 from trunk to revise_chunks branch. Changes to fixed and extensible array dataset chunk indexing code to accommodate changes to private APIs in those interfaces. Also, other adjustments to source code and expected output in response to changes on the trunk. 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 (smirom) w/Intel compilers, w/default API=1.6.x, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, in production mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in debug mode Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode Mac OS X/32 10.6.2 (amazon) in debug mode Mac OS X/32 10.6.2 (amazon) w/C++ & FORTRAN, w/threadsafe, in production mode
-rw-r--r--MANIFEST29
-rw-r--r--Makefile.in21
-rw-r--r--README.txt2
-rwxr-xr-xbin/chkmanifest4
-rwxr-xr-xbin/make_vers35
-rwxr-xr-xbin/release6
-rwxr-xr-xbin/trace5
-rw-r--r--c++/Makefile.in21
-rw-r--r--c++/examples/Makefile.in21
-rw-r--r--c++/src/H5CommonFG.cpp106
-rw-r--r--c++/src/H5CommonFG.h11
-rw-r--r--c++/src/H5DataSet.cpp2
-rw-r--r--c++/src/H5FcreatProp.cpp2
-rw-r--r--c++/src/H5FcreatProp.h2
-rw-r--r--c++/src/H5Object.cpp5
-rw-r--r--c++/src/H5PredType.cpp1
-rw-r--r--c++/src/Makefile.am4
-rw-r--r--c++/src/Makefile.in31
-rwxr-xr-xc++/src/h5c++.in8
-rw-r--r--c++/test/Makefile.am4
-rw-r--r--c++/test/Makefile.in34
-rw-r--r--c++/test/h5cpputil.h36
-rw-r--r--c++/test/testhdf5.cpp1
-rw-r--r--c++/test/tlinks.cpp722
-rw-r--r--config/BlankForm18
-rw-r--r--config/apple70
-rw-r--r--config/commence.am16
-rw-r--r--config/craynv34
-rw-r--r--config/dec-flags8
-rw-r--r--config/dec-osf4.x37
-rw-r--r--config/dec-osf5.x40
-rw-r--r--config/freebsd2
-rw-r--r--config/hpux11.00101
-rw-r--r--config/hpux11.2314
-rw-r--r--config/i686-pc-cygwin4
-rw-r--r--config/ia64-linux-gnu16
-rw-r--r--config/intel-fflags2
-rw-r--r--config/intel-osf1180
-rw-r--r--config/irix5.x94
-rw-r--r--config/irix6.x16
-rw-r--r--config/linux-gnulibc18
-rw-r--r--config/lt_vers.am2
-rw-r--r--config/mpich18
-rw-r--r--config/nec-superux14.132
-rw-r--r--config/pgi-flags2
-rw-r--r--config/powerpc-ibm-aix4.x120
-rw-r--r--config/powerpc-ibm-aix5.x22
-rw-r--r--config/rs6000-ibm-aix4.x43
-rw-r--r--config/solaris2.x11
-rw-r--r--config/sv1-cray28
-rw-r--r--config/unicos165
-rw-r--r--config/unicos10.0.X201
-rw-r--r--config/unicosmk168
-rw-r--r--config/unicosmk2.0.5.X170
-rw-r--r--config/unicosmk2.0.6.X203
-rw-r--r--config/unicosmk2.0.X170
-rw-r--r--config/x86_64-redstorm-linux-gnu4
-rwxr-xr-xconfigure481
-rw-r--r--configure.in427
-rw-r--r--examples/Makefile.in21
-rwxr-xr-xexamples/testh5cc.sh.in91
-rw-r--r--fortran/Makefile.in21
-rw-r--r--fortran/examples/Makefile.in21
-rw-r--r--fortran/src/H5Pf.c14
-rw-r--r--fortran/src/Makefile.am6
-rw-r--r--fortran/src/Makefile.in37
-rwxr-xr-xfortran/src/h5fc.in6
-rw-r--r--fortran/test/Makefile.am4
-rw-r--r--fortran/test/Makefile.in37
-rw-r--r--fortran/testpar/Makefile.am4
-rw-r--r--fortran/testpar/Makefile.in42
-rwxr-xr-xhl/Makefile.in21
-rw-r--r--hl/c++/Makefile.in21
-rw-r--r--hl/c++/examples/Makefile.in21
-rw-r--r--hl/c++/src/Makefile.am4
-rw-r--r--hl/c++/src/Makefile.in31
-rw-r--r--hl/c++/test/Makefile.am2
-rw-r--r--hl/c++/test/Makefile.in27
-rw-r--r--hl/examples/Makefile.in21
-rw-r--r--hl/fortran/Makefile.in21
-rw-r--r--hl/fortran/examples/Makefile.in21
-rw-r--r--hl/fortran/src/Makefile.am6
-rw-r--r--hl/fortran/src/Makefile.in37
-rw-r--r--hl/fortran/test/Makefile.am6
-rw-r--r--hl/fortran/test/Makefile.in37
-rw-r--r--hl/src/H5DS.c28
-rw-r--r--hl/src/Makefile.am4
-rw-r--r--hl/src/Makefile.in30
-rw-r--r--hl/test/Makefile.am15
-rw-r--r--hl/test/Makefile.in89
-rw-r--r--hl/test/gen_test_ds.c595
-rw-r--r--hl/test/test_ds.c2474
-rw-r--r--hl/test/test_ds_be.h5bin0 -> 11024 bytes
-rw-r--r--hl/test/test_ds_le.h5bin0 -> 14304 bytes
-rw-r--r--hl/test/test_lite.c1
-rw-r--r--hl/tools/Makefile.in21
-rw-r--r--hl/tools/gif2h5/Makefile.am4
-rw-r--r--hl/tools/gif2h5/Makefile.in25
-rw-r--r--perform/Makefile.am4
-rw-r--r--perform/Makefile.in25
-rw-r--r--perform/pio_engine.c9
-rw-r--r--perform/sio_engine.c4
-rw-r--r--release_docs/INSTALL_Windows.txt75
-rwxr-xr-xrelease_docs/INSTALL_Windows_From_Command_Line.txt14
-rwxr-xr-xrelease_docs/INSTALL_Windows_Short_NET.TXT171
-rw-r--r--release_docs/RELEASE.txt156
-rw-r--r--src/H5.c16
-rw-r--r--src/H5Abtree2.c9
-rw-r--r--src/H5Adense.c187
-rw-r--r--src/H5Aint.c22
-rw-r--r--src/H5B.c2
-rw-r--r--src/H5B2.c919
-rw-r--r--src/H5B2cache.c398
-rw-r--r--src/H5B2dbg.c162
-rw-r--r--src/H5B2hdr.c597
-rw-r--r--src/H5B2int.c1385
-rw-r--r--src/H5B2pkg.h202
-rw-r--r--src/H5B2private.h69
-rw-r--r--src/H5B2stat.c83
-rw-r--r--src/H5B2test.c103
-rw-r--r--src/H5Dbtree.c12
-rw-r--r--src/H5Dchunk.c2
-rw-r--r--src/H5Dcompact.c12
-rw-r--r--src/H5Dcontig.c2
-rw-r--r--src/H5Dearray.c11
-rw-r--r--src/H5Defl.c38
-rw-r--r--src/H5Dfarray.c11
-rw-r--r--src/H5Dint.c6
-rw-r--r--src/H5Dio.c6
-rw-r--r--src/H5Dlayout.c2
-rw-r--r--src/H5Doh.c36
-rw-r--r--src/H5Dpkg.h5
-rw-r--r--src/H5Dprivate.h7
-rw-r--r--src/H5EA.c70
-rw-r--r--src/H5EAcache.c14
-rw-r--r--src/H5EAhdr.c28
-rw-r--r--src/H5EApkg.h8
-rw-r--r--src/H5EAprivate.h6
-rw-r--r--src/H5Eprivate.h25
-rw-r--r--src/H5F.c93
-rw-r--r--src/H5FA.c64
-rw-r--r--src/H5FAcache.c21
-rw-r--r--src/H5FAhdr.c64
-rw-r--r--src/H5FApkg.h8
-rw-r--r--src/H5FAprivate.h8
-rw-r--r--src/H5FDsec2.c12
-rw-r--r--src/H5FS.c180
-rw-r--r--src/H5FScache.c17
-rw-r--r--src/H5FSdbg.c6
-rw-r--r--src/H5FSprivate.h5
-rw-r--r--src/H5FSsection.c65
-rw-r--r--src/H5FStest.c4
-rw-r--r--src/H5Faccum.c70
-rw-r--r--src/H5Fdeprec.c173
-rw-r--r--src/H5Fpkg.h11
-rw-r--r--src/H5Fprivate.h11
-rw-r--r--src/H5Fpublic.h65
-rw-r--r--src/H5Fquery.c4
-rw-r--r--src/H5Fsuper.c95
-rw-r--r--src/H5Fsuper_cache.c47
-rw-r--r--src/H5G.c33
-rw-r--r--src/H5Gbtree2.c4
-rw-r--r--src/H5Gdense.c192
-rw-r--r--src/H5Gdeprec.c4
-rw-r--r--src/H5Glink.c2
-rw-r--r--src/H5Gobj.c116
-rw-r--r--src/H5Goh.c129
-rw-r--r--src/H5Gpkg.h10
-rw-r--r--src/H5Gprivate.h5
-rw-r--r--src/H5Groot.c20
-rw-r--r--src/H5Gtest.c20
-rw-r--r--src/H5Gtraverse.c21
-rw-r--r--src/H5HF.c20
-rw-r--r--src/H5HFbtree2.c10
-rw-r--r--src/H5HFcache.c30
-rw-r--r--src/H5HFhdr.c88
-rw-r--r--src/H5HFhuge.c176
-rw-r--r--src/H5HFman.c22
-rw-r--r--src/H5HFpkg.h17
-rw-r--r--src/H5HFprivate.h2
-rw-r--r--src/H5HFstat.c41
-rw-r--r--src/H5HFtest.c24
-rw-r--r--src/H5HG.c12
-rw-r--r--src/H5HGcache.c26
-rw-r--r--src/H5HGdbg.c5
-rw-r--r--src/H5L.c6
-rw-r--r--src/H5Lexternal.c11
-rw-r--r--src/H5MF.c314
-rw-r--r--src/H5MFaggr.c8
-rw-r--r--src/H5MFdbg.c62
-rw-r--r--src/H5MFprivate.h4
-rw-r--r--src/H5O.c249
-rw-r--r--src/H5Oattribute.c45
-rw-r--r--src/H5Odtype.c29
-rw-r--r--src/H5Ofsinfo.c309
-rw-r--r--src/H5Olayout.c2
-rw-r--r--src/H5Olinfo.c6
-rw-r--r--src/H5Opkg.h17
-rw-r--r--src/H5Opline.c31
-rw-r--r--src/H5Oprivate.h38
-rw-r--r--src/H5Opublic.h35
-rw-r--r--src/H5Ostorage.c2
-rw-r--r--src/H5Otest.c47
-rw-r--r--src/H5Pdcpl.c1020
-rw-r--r--src/H5Pdeprec.c54
-rw-r--r--src/H5Pdxpl.c2
-rw-r--r--src/H5Pfcpl.c246
-rw-r--r--src/H5Pint.c67
-rwxr-xr-xsrc/H5Pocpl.c1151
-rw-r--r--src/H5Ppkg.h3
-rw-r--r--src/H5Pprivate.h11
-rw-r--r--src/H5Ppublic.h51
-rwxr-xr-xsrc/H5SM.c366
-rwxr-xr-xsrc/H5SMbtree2.c3
-rw-r--r--src/H5SMcache.c10
-rwxr-xr-xsrc/H5SMpkg.h30
-rwxr-xr-xsrc/H5SMprivate.h2
-rw-r--r--src/H5SMtest.c4
-rw-r--r--src/H5T.c14
-rw-r--r--src/H5Tcommit.c4
-rw-r--r--src/H5Tcompound.c203
-rw-r--r--src/H5Tconv.c85
-rw-r--r--src/H5Toh.c3
-rw-r--r--src/H5Tpkg.h2
-rw-r--r--src/H5WB.c2
-rw-r--r--src/H5Z.c263
-rw-r--r--src/H5Zpkg.h14
-rw-r--r--src/H5Zprivate.h3
-rw-r--r--src/H5detect.c2
-rw-r--r--src/H5private.h142
-rw-r--r--src/H5public.h4
-rw-r--r--src/H5trace.c77
-rw-r--r--src/H5vers.txt1
-rw-r--r--src/H5version.h130
-rwxr-xr-xsrc/Makefile.am13
-rw-r--r--src/Makefile.in104
-rw-r--r--src/libhdf5.settings.in22
-rw-r--r--test/Makefile.am51
-rw-r--r--test/Makefile.in70
-rw-r--r--test/app_ref.c4
-rw-r--r--test/btree2.c4674
-rw-r--r--test/cmpd_dset.c434
-rw-r--r--test/dsets.c31
-rw-r--r--test/dtypes.c54
-rw-r--r--test/earray.c31
-rw-r--r--test/farray.c62
-rw-r--r--test/fheap.c4
-rw-r--r--test/filespace_1_6.h5bin0 -> 2448 bytes
-rw-r--r--test/filespace_1_8.h5bin0 -> 2448 bytes
-rw-r--r--test/gen_filespace.c81
-rw-r--r--test/gen_specmetaread.c96
-rw-r--r--test/gheap.c131
-rw-r--r--test/h5test.c60
-rw-r--r--test/h5test.h1
-rw-r--r--test/links.c446
-rw-r--r--test/mf.c1365
-rwxr-xr-xtest/objcopy.c521
-rw-r--r--test/ohdr.c20
-rw-r--r--test/specmetaread.h5bin0 -> 1752 bytes
-rw-r--r--test/stab.c78
-rw-r--r--test/tcheck_version.c28
-rw-r--r--test/tconfig.c30
-rw-r--r--test/testcheck_version.sh.in35
-rw-r--r--test/tfile.c705
-rw-r--r--test/tgenprop.c147
-rw-r--r--test/tmisc.c107
-rw-r--r--test/tunicode.c5
-rw-r--r--test/vfd.c34
-rw-r--r--testpar/Makefile.am5
-rw-r--r--testpar/Makefile.in26
-rw-r--r--testpar/t_mpi.c8
-rw-r--r--tools/Makefile.in21
-rw-r--r--tools/h5copy/Makefile.am2
-rw-r--r--tools/h5copy/Makefile.in23
-rw-r--r--tools/h5copy/h5copy.c2
-rw-r--r--tools/h5copy/testh5copy.sh12
-rw-r--r--tools/h5diff/Makefile.am2
-rw-r--r--tools/h5diff/Makefile.in23
-rwxr-xr-xtools/h5diff/testh5diff.sh14
-rw-r--r--tools/h5dump/Makefile.am2
-rw-r--r--tools/h5dump/Makefile.in23
-rw-r--r--tools/h5dump/h5dump.c35
-rw-r--r--tools/h5dump/h5dumpgentest.c193
-rw-r--r--tools/h5dump/testh5dump.sh.in17
-rw-r--r--tools/h5import/Makefile.am2
-rwxr-xr-xtools/h5import/Makefile.in23
-rwxr-xr-xtools/h5import/h5import.c192
-rwxr-xr-xtools/h5import/h5importtest.c2
-rw-r--r--tools/h5jam/Makefile.am4
-rw-r--r--tools/h5jam/Makefile.in25
-rw-r--r--tools/h5ls/Makefile.am2
-rw-r--r--tools/h5ls/Makefile.in23
-rw-r--r--tools/h5ls/h5ls.c41
-rw-r--r--tools/h5repack/Makefile.am2
-rw-r--r--tools/h5repack/Makefile.in23
-rw-r--r--tools/h5repack/h5repack.c11
-rw-r--r--tools/h5repack/h5repack.h18
-rwxr-xr-xtools/h5repack/h5repack.sh.in57
-rw-r--r--tools/h5repack/h5repack_copy.c46
-rw-r--r--tools/h5repack/h5repack_main.c142
-rw-r--r--tools/h5repack/h5repack_opttable.c2
-rw-r--r--tools/h5repack/h5repack_parse.c46
-rw-r--r--tools/h5repack/h5repack_verify.c113
-rw-r--r--tools/h5repack/h5repacktst.c240
-rw-r--r--tools/h5stat/Makefile.am2
-rw-r--r--tools/h5stat/Makefile.in23
-rw-r--r--tools/h5stat/h5stat.c743
-rw-r--r--tools/h5stat/h5stat_gentest.c24
-rw-r--r--tools/h5stat/testfiles/h5stat_filters-F.ddl19
-rw-r--r--tools/h5stat/testfiles/h5stat_filters-d.ddl3
-rw-r--r--tools/h5stat/testfiles/h5stat_filters-dT.ddl3
-rw-r--r--tools/h5stat/testfiles/h5stat_filters-file.ddl2
-rw-r--r--tools/h5stat/testfiles/h5stat_filters.ddl37
-rw-r--r--tools/h5stat/testfiles/h5stat_help1.ddl15
-rw-r--r--tools/h5stat/testfiles/h5stat_help2.ddl15
-rw-r--r--tools/h5stat/testfiles/h5stat_idx.ddl34
-rw-r--r--tools/h5stat/testfiles/h5stat_newgrat.ddl38
-rw-r--r--tools/h5stat/testfiles/h5stat_newgrat.h5bin6363081 -> 6367669 bytes
-rw-r--r--tools/h5stat/testfiles/h5stat_tsohm.ddl34
-rw-r--r--tools/lib/Makefile.in21
-rw-r--r--tools/lib/h5diff_array.c4
-rw-r--r--tools/lib/h5tools.c6
-rw-r--r--tools/misc/Makefile.am6
-rw-r--r--tools/misc/Makefile.in27
-rwxr-xr-xtools/misc/h5cc.in8
-rw-r--r--tools/testfiles/file_space.ddl23
-rw-r--r--tools/testfiles/file_space.h5bin0 -> 792 bytes
-rw-r--r--tools/testfiles/tboot1.ddl2
-rw-r--r--tools/testfiles/tboot2.ddl2
-rw-r--r--vms/src/h5pubconf.h6
-rw-r--r--windows/c++/test/checkcpptests.bat20
-rw-r--r--windows/c++/test/testhdf5_cpp/testhdf5_cpp.vcproj4
-rw-r--r--windows/c++/test/testhdf5_cppdll/testhdf5_cppdll.vcproj4
-rw-r--r--windows/examples/allexamples/allexamples.vcproj8
-rwxr-xr-xwindows/examples/testExamples.bat112
-rwxr-xr-xwindows/examples/testExamples_exp_output.txt6
-rw-r--r--windows/fortran/test/checkfortrantests.bat21
-rwxr-xr-xwindows/hdf5bt.BAT44
-rwxr-xr-xwindows/hdf5build.BAT102
-rw-r--r--windows/hdf5build_examples.BAT10
-rwxr-xr-xwindows/hdf5check.BAT41
-rw-r--r--windows/hl/c++/test/checkhlcpptests.bat21
-rw-r--r--windows/hl/examples/test_hl_cexamples.BAT12
-rw-r--r--windows/hl/fortran/test/checkhlfortrantests.bat21
-rw-r--r--windows/hl/test/checkhltests.bat20
-rwxr-xr-xwindows/install_dll.BAT11
-rw-r--r--windows/perform/checkperformtests.bat21
-rwxr-xr-xwindows/proj/all/all.sln28
-rw-r--r--windows/proj/all_fortran/all_fortran.sln28
-rw-r--r--windows/proj/hdf5/hdf5.vcproj12
-rw-r--r--windows/proj/hdf5dll/hdf5dll.vcproj12
-rwxr-xr-xwindows/src/H5pubconf.h6
-rw-r--r--windows/test/checktests.bat26
-rw-r--r--windows/test/tcheckversion/tcheckversion.vcproj399
-rw-r--r--windows/test/tcheckversiondll/tcheckversiondll.vcproj395
-rw-r--r--windows/test/testerror.bat10
-rw-r--r--windows/tools/checktools.bat21
357 files changed, 21638 insertions, 11795 deletions
diff --git a/MANIFEST b/MANIFEST
index 854ef57..919ffad 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -80,21 +80,16 @@
./config/conclude.am
./config/craynv
./config/dec-flags
-./config/dec-osf4.x
-./config/dec-osf5.x
./config/examples.am
./config/freebsd
./config/gnu-fflags
./config/gnu-flags
-./config/hpux11.00
./config/hpux11.23
./config/i386-pc-cygwin32
./config/i686-pc-cygwin
./config/ia64-linux-gnu
./config/intel-fflags
./config/intel-flags
-./config/intel-osf1
-./config/irix5.x
./config/irix6.x
./config/linux-gnu
./config/linux-gnuaout
@@ -106,17 +101,9 @@
./config/Makefile.am.blank
./config/pgi-fflags
./config/pgi-flags
-./config/powerpc-ibm-aix4.x
./config/powerpc-ibm-aix5.x
-./config/rs6000-ibm-aix4.x
./config/solaris2.x
./config/sv1-cray
-./config/unicos
-./config/unicos10.0.X
-./config/unicosmk
-./config/unicosmk2.0.X
-./config/unicosmk2.0.5.X
-./config/unicosmk2.0.6.X
./config/x86_64-redstorm-linux-gnu
./config/site-specific/BlankForm
@@ -363,6 +350,7 @@
./c++/test/tfilter.cpp
./c++/test/th5s.cpp
./c++/test/th5s.h5
+./c++/test/tlinks.cpp
./c++/test/ttypes.cpp
./c++/test/trefer.cpp
./c++/test/tvlstr.cpp
@@ -459,6 +447,7 @@
./src/H5B2.c
./src/H5B2cache.c
./src/H5B2dbg.c
+./src/H5B2hdr.c
./src/H5B2int.c
./src/H5B2pkg.h
./src/H5B2private.h
@@ -520,6 +509,7 @@
./src/H5F.c
./src/H5Faccum.c
./src/H5Fdbg.c
+./src/H5Fdeprec.c
./src/H5Ffake.c
./src/H5Fio.c
./src/H5Fmount.c
@@ -674,6 +664,7 @@
./src/H5Odtype.c
./src/H5Oefl.c
./src/H5Ofill.c
+./src/H5Ofsinfo.c
./src/H5Oginfo.c
./src/H5Olayout.c
./src/H5Olinfo.c
@@ -832,6 +823,8 @@
./test/family_v16_00003.h5
./test/farray.c
./test/fheap.c
+./test/filespace_1_8.h5
+./test/filespace_1_6.h5
./test/freespace.c
./test/fill_old.h5
./test/fillval.c
@@ -841,6 +834,7 @@
./test/gen_bogus.c _DO_NOT_DISTRIBUTE_
./test/gen_cross.c _DO_NOT_DISTRIBUTE_
./test/gen_deflate.c _DO_NOT_DISTRIBUTE_
+./test/gen_filespace.c _DO_NOT_DISTRIBUTE_
./test/gen_idx.c _DO_NOT_DISTRIBUTE_
./test/gen_mergemsg.c _DO_NOT_DISTRIBUTE_
./test/gen_new_array.c _DO_NOT_DISTRIBUTE_
@@ -854,6 +848,7 @@
./test/gen_old_group.c _DO_NOT_DISTRIBUTE_
./test/gen_old_layout.c _DO_NOT_DISTRIBUTE_
./test/gen_old_mtime.c _DO_NOT_DISTRIBUTE_
+./test/gen_specmetaread.c _DO_NOT_DISTRIBUTE_
./test/gen_udlinks.c _DO_NOT_DISTRIBUTE_
./test/getname.c
./test/gheap.c
@@ -879,6 +874,7 @@
./test/pool.c
./test/set_extent.c
./test/space_overflow.c _DO_NOT_DISTRIBUTE_
+./test/specmetaread.h5
./test/stab.c
./test/swmr_common.c
./test/swmr_common.h
@@ -1144,6 +1140,8 @@
./tools/testfiles/family_file00015.h5
./tools/testfiles/family_file00016.h5
./tools/testfiles/family_file00017.h5
+./tools/testfiles/file_space.h5
+./tools/testfiles/file_space.ddl
./tools/testfiles/tall-1.ddl
./tools/testfiles/tall-2.ddl
./tools/testfiles/tall-3.ddl
@@ -1681,11 +1679,14 @@
./hl/test/image24plane.txt
./hl/test/pal_rgb.h
./hl/test/sepia.pal
+./hl/test/gen_test_ds.c
./hl/test/test_ds.c
./hl/test/test_image.c
./hl/test/test_lite.c
./hl/test/test_packet.c
./hl/test/test_table.c
+./hl/test/test_ds_le.h5
+./hl/test/test_ds_be.h5
./hl/test/test_table_le.hdf5
./hl/test/test_table_be.hdf5
./hl/test/test_table_cray.hdf5
@@ -2134,6 +2135,8 @@
./windows/test/set_extentdll/set_extentdll.vcproj
./windows/test/stab/stab.vcproj
./windows/test/stabdll/stabdll.vcproj
+./windows/test/tcheckversion/tcheckversion.vcproj
+./windows/test/tcheckversiondll/tcheckversiondll.vcproj
./windows/test/tellub/tellub.vcproj
./windows/test/testhdf5/testhdf5.vcproj
./windows/test/testhdf5dll/testhdf5dll.vcproj
diff --git a/Makefile.in b/Makefile.in
index b7cf113..e0403bf 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -137,6 +137,16 @@ distcleancheck_listfiles = find . -type f -print
ACLOCAL = /home1/packages/automake/automake-1.9.6/bin/aclocal-1.9 -I /afs/ncsa/projects/hdf/packages/libtool_1.5.14/Linux_2.4/share/aclocal
ADD_PARALLEL_FILES = @ADD_PARALLEL_FILES@
AMTAR = @AMTAR@
+
+# H5_CFLAGS holds flags that should be used when building hdf5,
+# but which should not be exported to h5cc for building other programs.
+# AM_CFLAGS is an automake construct which should be used by Makefiles
+# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
+AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
+AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@
+AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
+AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@
+AM_LDFLAGS = @AM_LDFLAGS@
AM_MAKEFLAGS = @AM_MAKEFLAGS@
AR = @AR@
@@ -150,21 +160,18 @@ BYTESEX = @BYTESEX@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CC_VERSION = @CC_VERSION@
-
-# H5_CFLAGS holds flags that should be used as CFLAGS when building hdf5,
-# but which shouldn't be exported to h5cc for building other programs.
-CFLAGS = @CFLAGS@ @H5_CFLAGS@
+CFLAGS = @CFLAGS@
CLEARFILEBUF = @CLEARFILEBUF@
CODESTACK = @CODESTACK@
CONFIG_DATE = @CONFIG_DATE@
CONFIG_MODE = @CONFIG_MODE@
CONFIG_USER = @CONFIG_USER@
CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@ @H5_CPPFLAGS@
+CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@ @H5_CXXFLAGS@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_PKG = @DEBUG_PKG@
DEFAULT_API_VERSION = @DEFAULT_API_VERSION@
@@ -187,7 +194,7 @@ F9XMODEXT = @F9XMODEXT@
F9XMODFLAG = @F9XMODFLAG@
F9XSUFFIXFLAG = @F9XSUFFIXFLAG@
FC = @FC@
-FCFLAGS = @FCFLAGS@ @H5_FCFLAGS@
+FCFLAGS = @FCFLAGS@
FCFLAGS_f90 = @FCFLAGS_f90@
FCLIBS = @FCLIBS@
FGREP = @FGREP@
diff --git a/README.txt b/README.txt
index 12702ff..99f457d 100644
--- a/README.txt
+++ b/README.txt
@@ -1,4 +1,4 @@
-HDF5 version 1.9.47-FA_a4 currently under development
+HDF5 version 1.9.51-FA_a4 currently under development
Please refer to the release_docs/INSTALL file for installation instructions.
------------------------------------------------------------------------------
diff --git a/bin/chkmanifest b/bin/chkmanifest
index f239995..70c38a9 100755
--- a/bin/chkmanifest
+++ b/bin/chkmanifest
@@ -171,8 +171,8 @@ EOF
exit 1
fi
-if [ $errcode > '0' >/dev/null ]; then
- exit $errcode
+if [ $errcode -ne 0 ]; then
+ exit 1
fi
test "$verbose" && echo " The MANIFEST is up to date." 1>&2
diff --git a/bin/make_vers b/bin/make_vers
index 2cfad4c..8541501 100755
--- a/bin/make_vers
+++ b/bin/make_vers
@@ -4,7 +4,7 @@ require 5.003;
# Global settings
# Max. library "index" (0 = v1.0, 1 = 1.2, etc)
-$max_idx = 4;
+$max_idx = 5;
# Min. supported previous library version "index" (0 = v1.0, 1 = 1.2, etc)
$min_sup_idx = 3;
@@ -86,9 +86,9 @@ sub print_checkoptions ($) {
# Print the option checking
print $fh "\n/* Issue error if contradicting macros have been defined. */\n";
- print $fh "#if defined(H5_USE_16_API) && defined(H5_NO_DEPRECATED_SYMBOLS)\n";
+ print $fh "#if (defined(H5_USE_16_API) || defined(H5_USE_18_API)) && defined(H5_NO_DEPRECATED_SYMBOLS)\n";
print $fh "#error \"Can't choose old API versions when deprecated APIs are disabled\"\n";
- print $fh "#endif /* defined(H5_USE_16_API) && defined(H5_NO_DEPRECATED_SYMBOLS) */\n";
+ print $fh "#endif /* (defined(H5_USE_16_API) || defined(H5_USE_18_API)) && defined(H5_NO_DEPRECATED_SYMBOLS) */\n";
}
##############################################################################
@@ -118,7 +118,7 @@ sub print_globalapivers ($) {
# Loop over supported older library APIs and define the appropriate macros
for $curr_idx ($min_sup_idx .. ($max_idx - 1)) {
# Print API version ifdef
- print $fh "#ifdef H5_USE_1", ($curr_idx * 2), "_API\n";
+ print $fh "\n#ifdef H5_USE_1", ($curr_idx * 2), "_API\n";
# Print the version macro info for each function that is defined for
# this API version
@@ -271,6 +271,7 @@ sub parse_line ($) {
my $params; # Typedefs for function parameters
my $vers; # The version info for the function
my @vers_list; # Version info, as a list
+ my @vers_nums; # Version info, as a numeric list
my $num_versions; # Number of versions for function
my %sym_versions; # Versions for a symbol
my $last_idx; # The previous version index seen for a function
@@ -308,15 +309,12 @@ sub parse_line ($) {
@vers_list = split(/\s*,\s*/, $vers);
#print "parse_line: vers_list=(@vers_list)\n";
- # Check for invalid version info given
- $last_idx = -1;
- $last_vers = 1;
- foreach(sort(@vers_list)) {
+ # Parse the version list into numbers, checking for invalid input
+ foreach(@vers_list) {
my $vers_idx; # Index of version in array
-#print "parse_line: _=$_ last_idx='$last_idx'\n";
# Do some validation on the input
- if(!($_ =~ /v1[02468]/)) {
+ if(!( $_ =~ /v1[02468]/ || $_ =~ /v11[02468]/ )) {
die "bad version information: $name";
}
if(exists($sym_versions{$_})) {
@@ -326,18 +324,29 @@ sub parse_line ($) {
# Store the versions for the function in a local hash table, indexed by the version
$sym_versions{$_}=$_;
+#print "parse_line: _=$_\n";
# Get the index of the version
- ($vers_idx) = ($_ =~ /v1(\d)/);
+ ($vers_idx) = ($_ =~ /v1(\d+)/);
$vers_idx /= 2;
#print "parse_line: vers_idx='$vers_idx'\n";
+ push(@vers_nums, $vers_idx);
+ }
+#print "parse_line: vers_nums=(@vers_nums)\n";
+ # Check for invalid version info given
+ $last_idx = -1;
+ $last_vers = 1;
+ foreach(sort(@vers_nums)) {
+#print "parse_line: _=$_ last_idx='$last_idx'\n";
# Update intermediate versions of the library that included the API routine
if($last_idx >= 0) {
+#print "parse_line: name='$name'\n";
+#print "parse_line: last_vers='$last_vers'\n";
#print "parse_line: last_idx='$last_idx'\n";
# Add the function to the list of API routines available in
# different versions of the library
- while($last_idx < $vers_idx) {
+ while($last_idx <= $_) {
if($line_type == 1) {
$func_vers[$last_idx]{$name} = $last_vers;
} elsif($line_type == 2) {
@@ -353,7 +362,7 @@ sub parse_line ($) {
}
# Keep track of last version index seen
- $last_idx = $vers_idx;
+ $last_idx = $_;
}
# Finish updating versions of the library that included the API routine
diff --git a/bin/release b/bin/release
index b41c5d4..c335028 100755
--- a/bin/release
+++ b/bin/release
@@ -196,7 +196,8 @@ grep '^\.' MANIFEST | grep -v _DO_NOT_DISTRIBUTE_ >$MANIFEST
# Prepare the source tree for a release.
ln -s `pwd` $tmpdir/$HDF5_VERS || exit 1
-mv Makefile $tmpdir/Makefile.x 2>/dev/null #might fail
+# Save a backup copy of Makefile if exists.
+test -f Makefile && mv Makefile $tmpdir/Makefile.x
cp -p Makefile.dist Makefile
# Update README.txt and release_docs/RELEASE.txt with release information in
@@ -259,7 +260,8 @@ done
# Copy the RELEASE.txt to the release area.
cp release_docs/RELEASE.txt $DEST/$HDF5_VERS-RELEASE.txt
-# Restore previous Makefile if existed.
+# Remove distributed Makefile and restore previous Makefile if existed.
+rm -f Makefile
test -f $tmpdir/Makefile.x && mv $tmpdir/Makefile.x Makefile
# Restore OLD version information, then no need for trap.
diff --git a/bin/trace b/bin/trace
index 951d349..e0a4dd0 100755
--- a/bin/trace
+++ b/bin/trace
@@ -44,6 +44,8 @@ $Source = "";
"H5E_error_t" => "Ee",
"H5E_type_t" => "Et",
"H5F_close_degree_t" => "Fd",
+ "H5F_file_space_type_t" => "Ff",
+ "H5F_mem_t" => "Fm",
"H5F_scope_t" => "Fs",
"H5F_libver_t" => "Fv",
"H5G_obj_t" => "Go",
@@ -98,7 +100,8 @@ $Source = "";
"H5E_walk_t" => "x",
"H5E_walk1_t" => "x",
"H5E_walk2_t" => "x",
- "H5F_info_t" => "x",
+ "H5F_info1_t" => "x",
+ "H5F_info2_t" => "x",
"H5FD_t" => "x",
"H5FD_class_t" => "x",
"H5FD_stream_fapl_t" => "x",
diff --git a/c++/Makefile.in b/c++/Makefile.in
index 0c4531e..599ac02 100644
--- a/c++/Makefile.in
+++ b/c++/Makefile.in
@@ -110,6 +110,16 @@ am__relativize = \
ACLOCAL = /home1/packages/automake/automake-1.9.6/bin/aclocal-1.9 -I /afs/ncsa/projects/hdf/packages/libtool_1.5.14/Linux_2.4/share/aclocal
ADD_PARALLEL_FILES = @ADD_PARALLEL_FILES@
AMTAR = @AMTAR@
+
+# H5_CFLAGS holds flags that should be used when building hdf5,
+# but which should not be exported to h5cc for building other programs.
+# AM_CFLAGS is an automake construct which should be used by Makefiles
+# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
+AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
+AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@
+AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
+AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@
+AM_LDFLAGS = @AM_LDFLAGS@
AM_MAKEFLAGS = @AM_MAKEFLAGS@
AR = @AR@
@@ -123,21 +133,18 @@ BYTESEX = @BYTESEX@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CC_VERSION = @CC_VERSION@
-
-# H5_CFLAGS holds flags that should be used as CFLAGS when building hdf5,
-# but which shouldn't be exported to h5cc for building other programs.
-CFLAGS = @CFLAGS@ @H5_CFLAGS@
+CFLAGS = @CFLAGS@
CLEARFILEBUF = @CLEARFILEBUF@
CODESTACK = @CODESTACK@
CONFIG_DATE = @CONFIG_DATE@
CONFIG_MODE = @CONFIG_MODE@
CONFIG_USER = @CONFIG_USER@
CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@ @H5_CPPFLAGS@
+CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@ @H5_CXXFLAGS@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_PKG = @DEBUG_PKG@
DEFAULT_API_VERSION = @DEFAULT_API_VERSION@
@@ -160,7 +167,7 @@ F9XMODEXT = @F9XMODEXT@
F9XMODFLAG = @F9XMODFLAG@
F9XSUFFIXFLAG = @F9XSUFFIXFLAG@
FC = @FC@
-FCFLAGS = @FCFLAGS@ @H5_FCFLAGS@
+FCFLAGS = @FCFLAGS@
FCFLAGS_f90 = @FCFLAGS_f90@
FCLIBS = @FCLIBS@
FGREP = @FGREP@
diff --git a/c++/examples/Makefile.in b/c++/examples/Makefile.in
index 00dc185..43296c6 100644
--- a/c++/examples/Makefile.in
+++ b/c++/examples/Makefile.in
@@ -76,6 +76,16 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = /home1/packages/automake/automake-1.9.6/bin/aclocal-1.9 -I /afs/ncsa/projects/hdf/packages/libtool_1.5.14/Linux_2.4/share/aclocal
ADD_PARALLEL_FILES = @ADD_PARALLEL_FILES@
AMTAR = @AMTAR@
+
+# H5_CFLAGS holds flags that should be used when building hdf5,
+# but which should not be exported to h5cc for building other programs.
+# AM_CFLAGS is an automake construct which should be used by Makefiles
+# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
+AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
+AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@
+AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
+AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@
+AM_LDFLAGS = @AM_LDFLAGS@
AM_MAKEFLAGS = @AM_MAKEFLAGS@
AR = @AR@
@@ -89,21 +99,18 @@ BYTESEX = @BYTESEX@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CC_VERSION = @CC_VERSION@
-
-# H5_CFLAGS holds flags that should be used as CFLAGS when building hdf5,
-# but which shouldn't be exported to h5cc for building other programs.
-CFLAGS = @CFLAGS@ @H5_CFLAGS@
+CFLAGS = @CFLAGS@
CLEARFILEBUF = @CLEARFILEBUF@
CODESTACK = @CODESTACK@
CONFIG_DATE = @CONFIG_DATE@
CONFIG_MODE = @CONFIG_MODE@
CONFIG_USER = @CONFIG_USER@
CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@ @H5_CPPFLAGS@
+CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@ @H5_CXXFLAGS@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_PKG = @DEBUG_PKG@
DEFAULT_API_VERSION = @DEFAULT_API_VERSION@
@@ -126,7 +133,7 @@ F9XMODEXT = @F9XMODEXT@
F9XMODFLAG = @F9XMODFLAG@
F9XSUFFIXFLAG = @F9XSUFFIXFLAG@
FC = @FC@
-FCFLAGS = @FCFLAGS@ @H5_FCFLAGS@
+FCFLAGS = @FCFLAGS@
FCFLAGS_f90 = @FCFLAGS_f90@
FCLIBS = @FCLIBS@
FGREP = @FGREP@
diff --git a/c++/src/H5CommonFG.cpp b/c++/src/H5CommonFG.cpp
index 80efc5d..f9311c6 100644
--- a/c++/src/H5CommonFG.cpp
+++ b/c++/src/H5CommonFG.cpp
@@ -15,11 +15,6 @@
#include <string>
-// remove when done
-#include <iostream>
- using std::cerr;
- using std::endl;
-
#include "H5Include.h"
#include "H5Exception.h"
#include "H5IdComponent.h"
@@ -430,16 +425,37 @@ void CommonFG::getObjinfo( const H5std_string& name, H5G_stat_t& statbuf ) const
//--------------------------------------------------------------------------
H5std_string CommonFG::getLinkval( const char* name, size_t size ) const
{
- char* value_C = new char[size+1]; // temporary C-string for C API
+ H5L_info_t linkinfo;
+ char *value_C; // value in C string
+ size_t val_size = size;
+ H5std_string value = "";
+ herr_t ret_value;
- herr_t ret_value = H5Lget_val( getLocId(), name, value_C, size, H5P_DEFAULT );
- if( ret_value < 0 )
- {
- throwException("getLinkval", "H5Lget_val failed");
- }
- H5std_string value = H5std_string( value_C );
- delete []value_C;
- return( value );
+ // if user doesn't provide buffer size, determine it
+ if (size == 0)
+ {
+ ret_value = H5Lget_info(getLocId(), name, &linkinfo, H5P_DEFAULT);
+ if( ret_value < 0 )
+ {
+ throwException("getLinkval", "H5Lget_info to find buffer size failed");
+ }
+ val_size = linkinfo.u.val_size;
+ }
+
+ // if link has value, retrieve the value, otherwise, return null string
+ if (val_size > 0)
+ {
+ value_C = new char[val_size+1]; // temporary C-string for C API
+
+ ret_value = H5Lget_val(getLocId(), name, value_C, val_size, H5P_DEFAULT);
+ if( ret_value < 0 )
+ {
+ throwException("getLinkval", "H5Lget_val failed");
+ }
+ value = H5std_string(value_C);
+ delete []value_C;
+ }
+ return(value);
}
//--------------------------------------------------------------------------
@@ -529,33 +545,38 @@ void CommonFG::removeComment(const H5std_string& name) const
//--------------------------------------------------------------------------
// Function: CommonFG::getComment
-///\brief Retrieves comment for the specified object.
+///\brief Retrieves comment for the specified object and its comment's
+/// length.
///\param name - IN: Name of the object
+///\param bufsize - IN: Length of the comment to retrieve
///\return Comment string
///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - May 2005
+// Programmer Binh-Minh Ribler - 2000
// 2007: QAK modified to use H5O APIs; however the first parameter is
// no longer just file or group, this function should be moved
// to another class to accommodate attribute, dataset, and named
// datatype. - BMR
//--------------------------------------------------------------------------
-H5std_string CommonFG::getComment (const H5std_string& name) const
+H5std_string CommonFG::getComment( const char* name, size_t bufsize ) const
{
- size_t bufsize = 256; // anticipating the comment's length
+ // bufsize is default to 256
+ // temporary variable
hid_t loc_id = getLocId(); // temporary variable
- // temporary C-string for the object's comment
- char* comment_C = new char[bufsize+1];
- ssize_t ret_value = H5Oget_comment_by_name(loc_id, name.c_str(), comment_C, bufsize, H5P_DEFAULT);
+ // temporary C-string for the object's comment; bufsize already including
+ // null character
+ char* comment_C = new char[bufsize];
+ ssize_t ret_value = H5Oget_comment_by_name(loc_id, name, comment_C, bufsize, H5P_DEFAULT);
- // if the actual length of the comment is longer than the anticipated
- // value, then call H5Oget_comment_by_name again with the correct value
- if ((size_t)ret_value > bufsize)
+ // if the actual length of the comment is longer than bufsize and bufsize
+ // was the default value, i.e., not given by the user, then call
+ // H5Oget_comment_by_name again with the correct value
+ if ((size_t)ret_value > bufsize && bufsize == 256)
{
- bufsize = ret_value;
+ size_t new_size = ret_value;
delete []comment_C;
- comment_C = new char[bufsize+1];
- ret_value = H5Oget_comment_by_name(loc_id, name.c_str(), comment_C, bufsize, H5P_DEFAULT);
+ comment_C = new char[new_size]; // new_size including null terminator
+ ret_value = H5Oget_comment_by_name(loc_id, name, comment_C, new_size, H5P_DEFAULT);
}
// if H5Oget_comment_by_name returns SUCCEED, return the string comment,
@@ -571,37 +592,6 @@ H5std_string CommonFG::getComment (const H5std_string& name) const
//--------------------------------------------------------------------------
// Function: CommonFG::getComment
-///\brief Retrieves comment for the specified object and its comment's
-/// length.
-///\param name - IN: Name of the object
-///\param bufsize - IN: Length of the comment to retrieve
-///\return Comment string
-///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - 2000
-// 2007: QAK modified to use H5O APIs; however the first parameter is
-// no longer just file or group, this function should be moved
-// to another class to accommodate attribute, dataset, and named
-// datatype. - BMR
-//--------------------------------------------------------------------------
-H5std_string CommonFG::getComment( const char* name, size_t bufsize ) const
-{
- // temporary C-string for the object's comment
- char* comment_C = new char[bufsize+1];
-
- herr_t ret_value = H5Oget_comment_by_name( getLocId(), name, comment_C, bufsize, H5P_DEFAULT );
-
- // if H5Oget_comment_by_name returns SUCCEED, return the string comment
- if( ret_value < 0 )
- {
- throwException("getComment", "H5Oget_comment_by_name failed");
- }
- H5std_string comment = H5std_string(comment_C);
- delete []comment_C;
- return( comment );
-}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::getComment
///\brief This is an overloaded member function, provided for convenience.
/// It differs from the above function in that it takes an
/// \c std::string for \a name.
diff --git a/c++/src/H5CommonFG.h b/c++/src/H5CommonFG.h
index 87c0615..d472d42 100644
--- a/c++/src/H5CommonFG.h
+++ b/c++/src/H5CommonFG.h
@@ -50,9 +50,8 @@ class H5_DLLCPP CommonFG {
DataSet openDataSet(const H5std_string& name) const;
// Retrieves comment for the HDF5 object specified by its name.
- H5std_string getComment(const H5std_string& name) const;
- H5std_string getComment(const char* name, size_t bufsize) const;
- H5std_string getComment(const H5std_string& name, size_t bufsize) const;
+ H5std_string getComment(const char* name, size_t bufsize=256) const;
+ H5std_string getComment(const H5std_string& name, size_t bufsize=256) const;
// Removes the comment for the HDF5 object specified by its name.
void removeComment(const char* name) const;
@@ -62,9 +61,9 @@ class H5_DLLCPP CommonFG {
void setComment(const char* name, const char* comment) const;
void setComment(const H5std_string& name, const H5std_string& comment) const;
- // Returns the name of the HDF5 object that the symbolic link points to.
- H5std_string getLinkval(const char* name, size_t size) const;
- H5std_string getLinkval(const H5std_string& name, size_t size) const;
+ // Returns the value of a symbolic link.
+ H5std_string getLinkval(const char* link_name, size_t size=0) const;
+ H5std_string getLinkval(const H5std_string& link_name, size_t size=0) const;
// Returns the number of objects in this group.
hsize_t getNumObjs() const;
diff --git a/c++/src/H5DataSet.cpp b/c++/src/H5DataSet.cpp
index cddb5d4..5812890 100644
--- a/c++/src/H5DataSet.cpp
+++ b/c++/src/H5DataSet.cpp
@@ -229,7 +229,7 @@ hsize_t DataSet::getStorageSize() const
//--------------------------------------------------------------------------
size_t DataSet::getInMemDataSize() const
{
- char *func = "DataSet::getInMemDataSize";
+ const char *func = "DataSet::getInMemDataSize";
// Get the data type of this dataset
hid_t mem_type_id = H5Dget_type(id);
diff --git a/c++/src/H5FcreatProp.cpp b/c++/src/H5FcreatProp.cpp
index cdf976a..53d18f6 100644
--- a/c++/src/H5FcreatProp.cpp
+++ b/c++/src/H5FcreatProp.cpp
@@ -55,6 +55,7 @@ FileCreatPropList::FileCreatPropList( const FileCreatPropList& original ) : Prop
//--------------------------------------------------------------------------
FileCreatPropList::FileCreatPropList(const hid_t plist_id) : PropList(plist_id) {}
+#ifndef H5_NO_DEPRECATED_SYMBOLS
//--------------------------------------------------------------------------
// Function: FileCreatPropList::getVersion
///\brief Retrieves version information for various parts of a file.
@@ -76,6 +77,7 @@ void FileCreatPropList::getVersion(unsigned& super, unsigned& freelist, unsigned
"H5Pget_version failed");
}
}
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
//--------------------------------------------------------------------------
// Function: FileCreatPropList::setUserblock
diff --git a/c++/src/H5FcreatProp.h b/c++/src/H5FcreatProp.h
index ae9c1b0..1aa102f 100644
--- a/c++/src/H5FcreatProp.h
+++ b/c++/src/H5FcreatProp.h
@@ -30,8 +30,10 @@ class H5_DLLCPP FileCreatPropList : public PropList {
// Creates a file create property list.
FileCreatPropList();
+#ifndef H5_NO_DEPRECATED_SYMBOLS
// Retrieves version information for various parts of a file.
void getVersion( unsigned& super, unsigned& freelist, unsigned& stab, unsigned& shhdr ) const;
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
// Sets the userblock size field of a file creation property list.
void setUserblock( hsize_t size ) const;
diff --git a/c++/src/H5Object.cpp b/c++/src/H5Object.cpp
index 2d32014..2643e41 100644
--- a/c++/src/H5Object.cpp
+++ b/c++/src/H5Object.cpp
@@ -214,7 +214,7 @@ int H5Object::iterateAttrs( attr_operator_t user_op, unsigned *_idx, void *op_da
userData->object = this;
// call the C library routine H5Aiterate2 to iterate the attributes
- hsize_t idx = (hsize_t)*_idx;
+ hsize_t idx = _idx ? (hsize_t)*_idx : 0;
int ret_value = H5Aiterate2(getId(), H5_INDEX_NAME, H5_ITER_INC, &idx,
userAttrOpWrpr, (void *) userData);
@@ -223,7 +223,8 @@ int H5Object::iterateAttrs( attr_operator_t user_op, unsigned *_idx, void *op_da
if( ret_value >= 0 ) {
/* Pass back update index value to calling code */
- *_idx = (unsigned)idx;
+ if (_idx)
+ *_idx = (unsigned)idx;
return( ret_value );
}
diff --git a/c++/src/H5PredType.cpp b/c++/src/H5PredType.cpp
index 2ec3ba5..347f02f 100644
--- a/c++/src/H5PredType.cpp
+++ b/c++/src/H5PredType.cpp
@@ -289,7 +289,6 @@ void PredType::commit( H5Object& loc, const H5std_string& name )
bool PredType::committed()
{
throw DataTypeIException("PredType::committed", "Error: Attempting to check for commit status on a predefined datatype." );
- return (0);
}
#endif // DOXYGEN_SHOULD_SKIP_THIS
diff --git a/c++/src/Makefile.am b/c++/src/Makefile.am
index c18b990..5cde27b 100644
--- a/c++/src/Makefile.am
+++ b/c++/src/Makefile.am
@@ -28,12 +28,12 @@ INCLUDES=-I$(top_srcdir)/src
lib_LTLIBRARIES=libhdf5_cpp.la
# Add libtool numbers to the HDF5 C++ library (from config/lt_vers.am)
-libhdf5_cpp_la_LDFLAGS= -version-info $(LT_VERS_INTERFACE):$(LT_VERS_REVISION):$(LT_VERS_AGE)
+libhdf5_cpp_la_LDFLAGS= -version-info $(LT_VERS_INTERFACE):$(LT_VERS_REVISION):$(LT_VERS_AGE) $(AM_LDFLAGS)
# Shared C++ libraries aren't universally supported.
if CXX_SHARED_CONDITIONAL
else
- AM_LDFLAGS=-static
+ AM_LDFLAGS+=-static
endif
bin_SCRIPTS=h5c++
diff --git a/c++/src/Makefile.in b/c++/src/Makefile.in
index 9301d08..39dee40 100644
--- a/c++/src/Makefile.in
+++ b/c++/src/Makefile.in
@@ -58,6 +58,9 @@ DIST_COMMON = $(include_HEADERS) $(srcdir)/Makefile.am \
$(top_srcdir)/config/commence.am \
$(top_srcdir)/config/conclude.am \
$(top_srcdir)/config/lt_vers.am
+
+# Shared C++ libraries aren't universally supported.
+@CXX_SHARED_CONDITIONAL_FALSE@am__append_1 = -static
TESTS =
subdir = c++/src
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -129,6 +132,16 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = /home1/packages/automake/automake-1.9.6/bin/aclocal-1.9 -I /afs/ncsa/projects/hdf/packages/libtool_1.5.14/Linux_2.4/share/aclocal
ADD_PARALLEL_FILES = @ADD_PARALLEL_FILES@
AMTAR = @AMTAR@
+
+# H5_CFLAGS holds flags that should be used when building hdf5,
+# but which should not be exported to h5cc for building other programs.
+# AM_CFLAGS is an automake construct which should be used by Makefiles
+# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
+AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
+AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@
+AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
+AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@
+AM_LDFLAGS = @AM_LDFLAGS@ $(am__append_1)
AM_MAKEFLAGS = @AM_MAKEFLAGS@
AR = @AR@
@@ -142,21 +155,18 @@ BYTESEX = @BYTESEX@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CC_VERSION = @CC_VERSION@
-
-# H5_CFLAGS holds flags that should be used as CFLAGS when building hdf5,
-# but which shouldn't be exported to h5cc for building other programs.
-CFLAGS = @CFLAGS@ @H5_CFLAGS@
+CFLAGS = @CFLAGS@
CLEARFILEBUF = @CLEARFILEBUF@
CODESTACK = @CODESTACK@
CONFIG_DATE = @CONFIG_DATE@
CONFIG_MODE = @CONFIG_MODE@
CONFIG_USER = @CONFIG_USER@
CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@ @H5_CPPFLAGS@
+CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@ @H5_CXXFLAGS@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_PKG = @DEBUG_PKG@
DEFAULT_API_VERSION = @DEFAULT_API_VERSION@
@@ -179,7 +189,7 @@ F9XMODEXT = @F9XMODEXT@
F9XMODFLAG = @F9XMODFLAG@
F9XSUFFIXFLAG = @F9XSUFFIXFLAG@
FC = @FC@
-FCFLAGS = @FCFLAGS@ @H5_FCFLAGS@
+FCFLAGS = @FCFLAGS@
FCFLAGS_f90 = @FCFLAGS_f90@
FCLIBS = @FCLIBS@
FGREP = @FGREP@
@@ -380,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 = 37
+LT_VERS_REVISION = 41
LT_VERS_AGE = 0
# Include src directory
@@ -390,10 +400,7 @@ INCLUDES = -I$(top_srcdir)/src
lib_LTLIBRARIES = libhdf5_cpp.la
# Add libtool numbers to the HDF5 C++ library (from config/lt_vers.am)
-libhdf5_cpp_la_LDFLAGS = -version-info $(LT_VERS_INTERFACE):$(LT_VERS_REVISION):$(LT_VERS_AGE)
-
-# Shared C++ libraries aren't universally supported.
-@CXX_SHARED_CONDITIONAL_FALSE@AM_LDFLAGS = -static
+libhdf5_cpp_la_LDFLAGS = -version-info $(LT_VERS_INTERFACE):$(LT_VERS_REVISION):$(LT_VERS_AGE) $(AM_LDFLAGS)
bin_SCRIPTS = h5c++
# Source files for the library
diff --git a/c++/src/h5c++.in b/c++/src/h5c++.in
index 5aa08cc..aac8f40 100755
--- a/c++/src/h5c++.in
+++ b/c++/src/h5c++.in
@@ -56,9 +56,9 @@ get_output_file="no"
SHOW="eval"
CXXBASE="@CXX@"
CXXLINKERBASE="@CXX@"
-CXXFLAGS="@CXXFLAGS@"
-CPPFLAGS="@CPPFLAGS@"
-LDFLAGS="@LDFLAGS@"
+CXXFLAGS="@AM_CXXFLAGS@ @CXXFLAGS@"
+CPPFLAGS="@AM_CPPFLAGS@ @CPPFLAGS@"
+LDFLAGS="@AM_LDFLAGS@ @LDFLAGS@"
LIBS="@LIBS@"
CXX="${HDF5_CXX:-$CXXBASE}"
@@ -317,7 +317,7 @@ if test "x$do_link" = "xyes"; then
# module. It's okay if they're included twice in the compile line.
link_args="$link_args $LIBS"
- $SHOW $CXXLINKER $CPPFLAGS $CXXFLAGS $LDFLAGS $clibpath $link_objs $link_args $shared_link
+ $SHOW $CXXLINKER $CPPFLAGS $CXXFLAGS $clibpath $link_objs $link_args $shared_link $LDFLAGS
status=$?
fi
diff --git a/c++/test/Makefile.am b/c++/test/Makefile.am
index 058f925..fdfdd61 100644
--- a/c++/test/Makefile.am
+++ b/c++/test/Makefile.am
@@ -26,7 +26,7 @@ INCLUDES=-I$(top_srcdir)/src -I$(top_srcdir)/test -I$(top_srcdir)/c++/src
# Shared C++ libraries aren't universally supported.
if CXX_SHARED_CONDITIONAL
else
- AM_LDFLAGS=-static
+ AM_LDFLAGS+=-static
endif
# These are our main targets. They should be listed in the order to be
@@ -39,7 +39,7 @@ LDADD=$(LIBH5TEST) $(LIBH5CPP) $(LIBHDF5)
dsets_SOURCES=dsets.cpp h5cpputil.cpp
testhdf5_SOURCES=testhdf5.cpp tattr.cpp tcompound.cpp tfile.cpp tfilter.cpp \
- th5s.cpp trefer.cpp ttypes.cpp tvlstr.cpp h5cpputil.cpp
+ th5s.cpp tlinks.cpp trefer.cpp ttypes.cpp tvlstr.cpp h5cpputil.cpp
# Tell conclude.am that these are C++ tests.
CXX_API=yes
diff --git a/c++/test/Makefile.in b/c++/test/Makefile.in
index 3dff900..6384eec 100644
--- a/c++/test/Makefile.in
+++ b/c++/test/Makefile.in
@@ -53,6 +53,9 @@ host_triplet = @host@
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(top_srcdir)/config/commence.am \
$(top_srcdir)/config/conclude.am
+
+# Shared C++ libraries aren't universally supported.
+@CXX_SHARED_CONDITIONAL_FALSE@am__append_1 = -static
check_PROGRAMS = $(am__EXEEXT_1)
TESTS = $(check_PROGRAMS)
subdir = c++/test
@@ -71,8 +74,8 @@ dsets_LDADD = $(LDADD)
dsets_DEPENDENCIES = $(LIBH5TEST) $(LIBH5CPP) $(LIBHDF5)
am_testhdf5_OBJECTS = testhdf5.$(OBJEXT) tattr.$(OBJEXT) \
tcompound.$(OBJEXT) tfile.$(OBJEXT) tfilter.$(OBJEXT) \
- th5s.$(OBJEXT) trefer.$(OBJEXT) ttypes.$(OBJEXT) \
- tvlstr.$(OBJEXT) h5cpputil.$(OBJEXT)
+ th5s.$(OBJEXT) tlinks.$(OBJEXT) trefer.$(OBJEXT) \
+ ttypes.$(OBJEXT) tvlstr.$(OBJEXT) h5cpputil.$(OBJEXT)
testhdf5_OBJECTS = $(am_testhdf5_OBJECTS)
testhdf5_LDADD = $(LDADD)
testhdf5_DEPENDENCIES = $(LIBH5TEST) $(LIBH5CPP) $(LIBHDF5)
@@ -99,6 +102,16 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = /home1/packages/automake/automake-1.9.6/bin/aclocal-1.9 -I /afs/ncsa/projects/hdf/packages/libtool_1.5.14/Linux_2.4/share/aclocal
ADD_PARALLEL_FILES = @ADD_PARALLEL_FILES@
AMTAR = @AMTAR@
+
+# H5_CFLAGS holds flags that should be used when building hdf5,
+# but which should not be exported to h5cc for building other programs.
+# AM_CFLAGS is an automake construct which should be used by Makefiles
+# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
+AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
+AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@
+AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
+AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@
+AM_LDFLAGS = @AM_LDFLAGS@ $(am__append_1)
AM_MAKEFLAGS = @AM_MAKEFLAGS@
AR = @AR@
@@ -112,21 +125,18 @@ BYTESEX = @BYTESEX@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CC_VERSION = @CC_VERSION@
-
-# H5_CFLAGS holds flags that should be used as CFLAGS when building hdf5,
-# but which shouldn't be exported to h5cc for building other programs.
-CFLAGS = @CFLAGS@ @H5_CFLAGS@
+CFLAGS = @CFLAGS@
CLEARFILEBUF = @CLEARFILEBUF@
CODESTACK = @CODESTACK@
CONFIG_DATE = @CONFIG_DATE@
CONFIG_MODE = @CONFIG_MODE@
CONFIG_USER = @CONFIG_USER@
CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@ @H5_CPPFLAGS@
+CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@ @H5_CXXFLAGS@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_PKG = @DEBUG_PKG@
DEFAULT_API_VERSION = @DEFAULT_API_VERSION@
@@ -149,7 +159,7 @@ F9XMODEXT = @F9XMODEXT@
F9XMODFLAG = @F9XMODFLAG@
F9XSUFFIXFLAG = @F9XSUFFIXFLAG@
FC = @FC@
-FCFLAGS = @FCFLAGS@ @H5_FCFLAGS@
+FCFLAGS = @FCFLAGS@
FCFLAGS_f90 = @FCFLAGS_f90@
FCLIBS = @FCLIBS@
FGREP = @FGREP@
@@ -350,9 +360,6 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog
# Include src, test, and c++/src directories
INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/test -I$(top_srcdir)/c++/src
-# Shared C++ libraries aren't universally supported.
-@CXX_SHARED_CONDITIONAL_FALSE@AM_LDFLAGS = -static
-
# These are our main targets. They should be listed in the order to be
# executed, generally most specific tests to least specific tests.
TEST_PROG = dsets testhdf5
@@ -361,7 +368,7 @@ TEST_PROG = dsets testhdf5
LDADD = $(LIBH5TEST) $(LIBH5CPP) $(LIBHDF5)
dsets_SOURCES = dsets.cpp h5cpputil.cpp
testhdf5_SOURCES = testhdf5.cpp tattr.cpp tcompound.cpp tfile.cpp tfilter.cpp \
- th5s.cpp trefer.cpp ttypes.cpp tvlstr.cpp h5cpputil.cpp
+ th5s.cpp tlinks.cpp trefer.cpp ttypes.cpp tvlstr.cpp h5cpputil.cpp
# Tell conclude.am that these are C++ tests.
@@ -446,6 +453,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tfile.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tfilter.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/th5s.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tlinks.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/trefer.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ttypes.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tvlstr.Po@am__quote@
diff --git a/c++/test/h5cpputil.h b/c++/test/h5cpputil.h
index d22a4d3..c547070 100644
--- a/c++/test/h5cpputil.h
+++ b/c++/test/h5cpputil.h
@@ -113,25 +113,27 @@ template <class Type1, class Type2>
#ifdef __cplusplus
extern "C" {
#endif
-void test_attr(void);
-void test_compound(void);
-void test_file(void);
-void test_filters(void);
-void test_h5s(void);
-void test_reference(void);
-void test_types(void);
-void test_vlstrings(void);
+void test_attr();
+void test_compound();
+void test_file();
+void test_filters();
+void test_links();
+void test_h5s();
+void test_reference();
+void test_types();
+void test_vlstrings();
/* Prototypes for the cleanup routines */
-void cleanup_attr(void);
-void cleanup_compound(void);
-void cleanup_dsets(void);
-void cleanup_file(void);
-void cleanup_filters(void);
-void cleanup_h5s(void);
-void cleanup_reference(void);
-void cleanup_types(void);
-void cleanup_vlstrings(void);
+void cleanup_attr();
+void cleanup_compound();
+void cleanup_dsets();
+void cleanup_file();
+void cleanup_filters();
+void cleanup_links();
+void cleanup_h5s();
+void cleanup_reference();
+void cleanup_types();
+void cleanup_vlstrings();
#ifdef __cplusplus
}
diff --git a/c++/test/testhdf5.cpp b/c++/test/testhdf5.cpp
index 02b427e..d61babf 100644
--- a/c++/test/testhdf5.cpp
+++ b/c++/test/testhdf5.cpp
@@ -85,6 +85,7 @@ main(int argc, char *argv[])
AddTest("types", test_types, cleanup_types, "Generic Data Types", NULL);
AddTest("compound", test_compound, cleanup_compound, "Compound Data Types", NULL);
AddTest("filter", test_filters, cleanup_filters, "Various Filters", NULL);
+ AddTest("links", test_links, cleanup_links, "Various Links", NULL);
/* Comment out tests that are not done yet. - BMR, Feb 2001
AddTest("select", test_select, cleanup_select, "Selections", NULL);
AddTest("time", test_time, cleanup_time, "Time Datatypes", NULL);
diff --git a/c++/test/tlinks.cpp b/c++/test/tlinks.cpp
new file mode 100644
index 0000000..83e33e1
--- /dev/null
+++ b/c++/test/tlinks.cpp
@@ -0,0 +1,722 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the files COPYING and Copyright.html. COPYING can be found at the root *
+ * of the source code distribution tree; Copyright.html can be found at the *
+ * root level of an installed copy of the electronic 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*****************************************************************************
+ FILE
+ tlinks.cpp - HDF5 C++ testing functionalities associated with the
+ C attribute interface (H5L)
+
+ ***************************************************************************/
+
+#ifdef OLD_HEADER_FILENAME
+#include <iostream.h>
+#else
+#include <iostream>
+#endif
+#include <string>
+
+#ifndef H5_NO_NAMESPACE
+#ifndef H5_NO_STD
+ using std::cerr;
+ using std::endl;
+#endif // H5_NO_STD
+#endif
+
+#include "testhdf5.h" // C test header file
+#include "H5Cpp.h" // C++ API header file
+
+#ifndef H5_NO_NAMESPACE
+ using namespace H5;
+#endif
+
+#include "h5cpputil.h" // C++ test utilility header file
+
+// A lot of the definition inherited from C test links.c is left here until
+// the H5L API is implemented and tests are completed - BMR 10/19/2009
+/*
+ * This file needs to access private information from the H5G package.
+ * This file also needs to access the group testing code.
+ */
+//#define H5G_PACKAGE
+//#define H5G_TESTING
+
+//#include "h5test.h"
+//#include "H5Gpkg.h" /* Groups */
+//#include "H5Iprivate.h" /* IDs */
+//#include "H5Lprivate.h" /* Links */
+
+/* File for external link test. Created with gen_udlinks.c */
+#define LINKED_FILE "be_extlink2.h5"
+
+#ifdef H5_VMS
+#if 0
+const char *FILENAME[] = {
+ "links0",
+ "links1",
+ "links2",
+ "links3",
+ "links4a", /* 4 */
+ "links4b", /* 5 */
+ "links4c", /* 6 */
+ "links4d", /* 7 */
+ "links5", /* 8 */
+ "links6", /* 9 */
+ "links7", /* 10 */
+ "links8", /* 11 */
+ "extlinks0", /* 12: main files */
+ "[.tmp]extlinks0", /* 13: */
+ "extlinks1", /* 14: target files */
+ "[.tmp]extlinks1", /* 15: */
+ "extlinks2", /* 16: */
+ "[.tmp]extlinks2", /* 17: */
+ "extlinks3", /* 18: */
+ "[.tmp]extlinks3", /* 19: */
+ "extlinks4", /* 20: */
+ "[.tmp]extlinks4", /* 21: */
+ "extlinks5", /* 22: */
+ "[.tmp]extlinks6", /* 23: */
+ "extlinks7", /* 24: */
+ "[.tmp]extlinks7", /* 25: */
+ "[.tmp]extlinks8", /* 26: */
+ "extlinks9", /* 27: */
+ "[.tmp]extlinks9", /* 28: */
+ "extlinks10", /* 29: */ /* TESTS for windows */
+ "[.tmp]extlinks10", /* 30: */
+ "[.tmp]extlinks11", /* 31: */
+ "[.tmp]extlinks12", /* 32: */
+ "extlinks13", /* 33: */
+ "[.tmp]extlinks13", /* 34: */
+ "[.tmp]extlinks14", /* 35: */
+ "[.tmp]extlinks15", /* 36: */
+ "extlinks16A", /* 37: */ /* TESTS for H5P_set_elink_fapl */
+ "extlinks16B", /* 38: */
+ "extlinks17", /* 39: */
+ "extlinks18A", /* 40: */
+ "extlinks18B", /* 41: */
+ "extlinks19A", /* 42: */
+ "extlinks19B", /* 43: */
+ "extlinks20", /* 44: */
+ NULL
+};
+#endif // 0
+
+#define TMPDIR "[.tmp]"
+#else
+#if 0
+const char *FILENAME[] = {
+ "links0",
+ "links1",
+ "links2",
+ "links3",
+ "links4a", /* 4 */
+ "links4b", /* 5 */
+ "links4c", /* 6 */
+ "links4d", /* 7 */
+ "links5", /* 8 */
+ "links6", /* 9 */
+ "links7", /* 10 */
+ "links8", /* 11 */
+ "extlinks0", /* 12: main files */
+ "tmp/extlinks0", /* 13: */
+ "extlinks1", /* 14: target files */
+ "tmp/extlinks1", /* 15: */
+ "extlinks2", /* 16: */
+ "tmp/extlinks2", /* 17: */
+ "extlinks3", /* 18: */
+ "tmp/extlinks3", /* 19: */
+ "extlinks4", /* 20: */
+ "tmp/extlinks4", /* 21: */
+ "extlinks5", /* 22: */
+ "tmp/extlinks6", /* 23: */
+ "extlinks7", /* 24: */
+ "tmp/extlinks7", /* 25: */
+ "tmp/extlinks8", /* 26: */
+ "extlinks9", /* 27: */
+ "tmp/extlinks9", /* 28: */
+ "extlinks10", /* 29: */ /* TESTS for windows */
+ "tmp/extlinks10", /* 30: */
+ "tmp/extlinks11", /* 31: */
+ "tmp/extlinks12", /* 32: */
+ "extlinks13", /* 33: */
+ "tmp/extlinks13", /* 34: */
+ "tmp/extlinks14", /* 35: */
+ "tmp/extlinks15", /* 36: */
+ "extlinks16A", /* 37: */ /* TESTS for H5P_set_elink_fapl */
+ "extlinks16B", /* 38: */
+ "extlinks17", /* 39: */
+ "extlinks18A", /* 40: */
+ "extlinks18B", /* 41: */
+ "extlinks19A", /* 42: */
+ "extlinks19B", /* 43: */
+ "extlinks20", /* 44: */
+ NULL
+};
+
+#endif // 0
+
+#define TMPDIR "tmp"
+#endif
+
+#define FAMILY_SIZE 1024
+#define CORE_INCREMENT 1024
+#define NUM400 400
+
+/* do not do check_all_closed() for "ext*" files and "tmp/ext*" */
+#define EXTSTOP 12
+
+#define LINK_BUF_SIZE 1024
+#define NAME_BUF_SIZE 1024
+#define MAX_NAME_LEN ((64*1024)+1024)
+
+/* Link type IDs */
+#define UD_HARD_TYPE 201
+#define UD_CB_TYPE H5L_TYPE_MAX
+#define UD_PLIST_TYPE 128
+#define UD_CBFAIL_TYPE UD_PLIST_TYPE
+#define UD_ERROR_TYPE 189
+#define UD_BAD_TYPE1 H5L_TYPE_HARD
+#define UD_BAD_TYPE2 (H5L_TYPE_UD_MIN - 5)
+#define UD_BAD_VERS (H5L_LINK_CLASS_T_VERS + 1)
+
+#define DEST_PROP_NAME "destination_group"
+#define REREG_TARGET_NAME "rereg_target"
+
+#define UD_CB_LINK_NAME "ud_callback_link"
+#define NEW_UD_CB_LINK_NAME "ud_callback_link2"
+#define UD_CB_TARGET "ud_target"
+#define UD_CB_TARGET_LEN 10
+
+#define LE_FILENAME "le_extlink1.h5"
+#define BE_FILENAME "be_extlink1.h5"
+
+#define ELINK_CB_FAM_SIZE (hsize_t) 100
+
+#define H5L_DIM1 100
+#define H5L_DIM2 100
+
+/* Creation order macros */
+#define CORDER_GROUP_NAME "corder_group"
+#define CORDER_SOFT_GROUP_NAME "corder_soft_group"
+#define CORDER_NLINKS 18
+#define CORDER_ITER_STOP 3
+#define CORDER_EST_ENTRY_LEN 9
+
+/* Timestamp macros */
+#define TIMESTAMP_GROUP_1 "timestamp1"
+#define TIMESTAMP_GROUP_2 "timestamp2"
+
+/* Link iteration struct */
+typedef struct {
+ H5_iter_order_t order; /* Direction of iteration */
+ unsigned ncalled; /* # of times callback is entered */
+ unsigned nskipped; /* # of links skipped */
+ int stop; /* # of iterations to stop after */
+ int64_t curr; /* Current creation order value */
+ size_t max_visit; /* Size of "visited link" flag array */
+ hbool_t *visited; /* Pointer to array of "visited link" flags */
+} link_iter_info_t;
+
+/* Link visit structs */
+typedef struct {
+ const char *path; /* Path to link */
+ H5L_type_t type; /* Type of link */
+} link_visit_t;
+static const link_visit_t lvisit0[] = {
+ {"Dataset_zero", H5L_TYPE_HARD},
+ {"Group1", H5L_TYPE_HARD},
+ {"Group1/Dataset_one", H5L_TYPE_HARD},
+ {"Group1/Group2", H5L_TYPE_HARD},
+ {"Group1/Group2/Dataset_two", H5L_TYPE_HARD},
+ {"Group1/Group2/Type_two", H5L_TYPE_HARD},
+ {"Group1/Group2/hard_zero", H5L_TYPE_HARD},
+ {"Group1/Type_one", H5L_TYPE_HARD},
+ {"Group1/hard_one", H5L_TYPE_HARD},
+ {"Type_zero", H5L_TYPE_HARD},
+ {"ext_dangle", H5L_TYPE_EXTERNAL},
+ {"ext_one", H5L_TYPE_EXTERNAL},
+ {"hard_one", H5L_TYPE_HARD},
+ {"hard_two", H5L_TYPE_HARD},
+ {"hard_zero", H5L_TYPE_HARD},
+ {"soft_dangle", H5L_TYPE_SOFT},
+ {"soft_one", H5L_TYPE_SOFT},
+ {"soft_two", H5L_TYPE_SOFT}
+};
+static const link_visit_t lvisit1[] = {
+ {"Dataset_one", H5L_TYPE_HARD},
+ {"Group2", H5L_TYPE_HARD},
+ {"Group2/Dataset_two", H5L_TYPE_HARD},
+ {"Group2/Type_two", H5L_TYPE_HARD},
+ {"Group2/hard_zero", H5L_TYPE_HARD},
+ {"Group2/hard_zero/Dataset_zero", H5L_TYPE_HARD},
+ {"Group2/hard_zero/Group1", H5L_TYPE_HARD},
+ {"Group2/hard_zero/Type_zero", H5L_TYPE_HARD},
+ {"Group2/hard_zero/ext_dangle", H5L_TYPE_EXTERNAL},
+ {"Group2/hard_zero/ext_one", H5L_TYPE_EXTERNAL},
+ {"Group2/hard_zero/hard_one", H5L_TYPE_HARD},
+ {"Group2/hard_zero/hard_two", H5L_TYPE_HARD},
+ {"Group2/hard_zero/hard_zero", H5L_TYPE_HARD},
+ {"Group2/hard_zero/soft_dangle", H5L_TYPE_SOFT},
+ {"Group2/hard_zero/soft_one", H5L_TYPE_SOFT},
+ {"Group2/hard_zero/soft_two", H5L_TYPE_SOFT},
+ {"Type_one", H5L_TYPE_HARD},
+ {"hard_one", H5L_TYPE_HARD}
+};
+static const link_visit_t lvisit2[] = {
+ {"Dataset_two", H5L_TYPE_HARD},
+ {"Type_two", H5L_TYPE_HARD},
+ {"hard_zero", H5L_TYPE_HARD},
+ {"hard_zero/Dataset_zero", H5L_TYPE_HARD},
+ {"hard_zero/Group1", H5L_TYPE_HARD},
+ {"hard_zero/Group1/Dataset_one", H5L_TYPE_HARD},
+ {"hard_zero/Group1/Group2", H5L_TYPE_HARD},
+ {"hard_zero/Group1/Type_one", H5L_TYPE_HARD},
+ {"hard_zero/Group1/hard_one", H5L_TYPE_HARD},
+ {"hard_zero/Type_zero", H5L_TYPE_HARD},
+ {"hard_zero/ext_dangle", H5L_TYPE_EXTERNAL},
+ {"hard_zero/ext_one", H5L_TYPE_EXTERNAL},
+ {"hard_zero/hard_one", H5L_TYPE_HARD},
+ {"hard_zero/hard_two", H5L_TYPE_HARD},
+ {"hard_zero/hard_zero", H5L_TYPE_HARD},
+ {"hard_zero/soft_dangle", H5L_TYPE_SOFT},
+ {"hard_zero/soft_one", H5L_TYPE_SOFT},
+ {"hard_zero/soft_two", H5L_TYPE_SOFT}
+};
+
+typedef struct {
+ unsigned idx; /* Index in link visit structure */
+ const link_visit_t *info; /* Pointer to the link visit structure to use */
+} lvisit_ud_t;
+
+
+/* Object visit structs */
+typedef struct {
+ const char *path; /* Path to object */
+ H5O_type_t type; /* Type of object */
+} obj_visit_t;
+static const obj_visit_t ovisit0_old[] = {
+ {".", H5O_TYPE_GROUP},
+ {"Dataset_zero", H5O_TYPE_DATASET},
+ {"Group1", H5O_TYPE_GROUP},
+ {"Group1/Dataset_one", H5O_TYPE_DATASET},
+ {"Group1/Group2", H5O_TYPE_GROUP},
+ {"Group1/Group2/Dataset_two", H5O_TYPE_DATASET},
+ {"Group1/Group2/Type_two", H5O_TYPE_NAMED_DATATYPE},
+ {"Group1/Type_one", H5O_TYPE_NAMED_DATATYPE},
+ {"Type_zero", H5O_TYPE_NAMED_DATATYPE}
+};
+static const obj_visit_t ovisit0_new[] = {
+ {".", H5O_TYPE_GROUP},
+ {"Dataset_zero", H5O_TYPE_DATASET},
+ {"Group1", H5O_TYPE_GROUP},
+ {"Group1/Dataset_one", H5O_TYPE_DATASET},
+ {"Group1/Group2", H5O_TYPE_GROUP},
+ {"Group1/Group2/Dataset_two", H5O_TYPE_DATASET},
+ {"Group1/Group2/Type_two", H5O_TYPE_NAMED_DATATYPE},
+ {"Group1/Type_one", H5O_TYPE_NAMED_DATATYPE},
+ {"Type_zero", H5O_TYPE_NAMED_DATATYPE}
+};
+static const obj_visit_t ovisit1_old[] = {
+ {".", H5O_TYPE_GROUP},
+ {"Dataset_one", H5O_TYPE_DATASET},
+ {"Group2", H5O_TYPE_GROUP},
+ {"Group2/Dataset_two", H5O_TYPE_DATASET},
+ {"Group2/Type_two", H5O_TYPE_NAMED_DATATYPE},
+ {"Group2/hard_zero", H5O_TYPE_GROUP},
+ {"Group2/hard_zero/Dataset_zero", H5O_TYPE_DATASET},
+ {"Group2/hard_zero/Type_zero", H5O_TYPE_NAMED_DATATYPE},
+ {"Type_one", H5O_TYPE_NAMED_DATATYPE}
+};
+static const obj_visit_t ovisit1_new[] = {
+ {".", H5O_TYPE_GROUP},
+ {"Dataset_one", H5O_TYPE_DATASET},
+ {"Group2", H5O_TYPE_GROUP},
+ {"Group2/Dataset_two", H5O_TYPE_DATASET},
+ {"Group2/Type_two", H5O_TYPE_NAMED_DATATYPE},
+ {"Group2/hard_zero", H5O_TYPE_GROUP},
+ {"Group2/hard_zero/Dataset_zero", H5O_TYPE_DATASET},
+ {"Group2/hard_zero/Type_zero", H5O_TYPE_NAMED_DATATYPE},
+ {"Type_one", H5O_TYPE_NAMED_DATATYPE}
+};
+static const obj_visit_t ovisit2_old[] = {
+ {".", H5O_TYPE_GROUP},
+ {"Dataset_two", H5O_TYPE_DATASET},
+ {"Type_two", H5O_TYPE_NAMED_DATATYPE},
+ {"hard_zero", H5O_TYPE_GROUP},
+ {"hard_zero/Dataset_zero", H5O_TYPE_DATASET},
+ {"hard_zero/Group1", H5O_TYPE_GROUP},
+ {"hard_zero/Group1/Dataset_one", H5O_TYPE_DATASET},
+ {"hard_zero/Group1/Type_one", H5O_TYPE_NAMED_DATATYPE},
+ {"hard_zero/Type_zero", H5O_TYPE_NAMED_DATATYPE}
+};
+static const obj_visit_t ovisit2_new[] = {
+ {".", H5O_TYPE_GROUP},
+ {"Dataset_two", H5O_TYPE_DATASET},
+ {"Type_two", H5O_TYPE_NAMED_DATATYPE},
+ {"hard_zero", H5O_TYPE_GROUP},
+ {"hard_zero/Dataset_zero", H5O_TYPE_DATASET},
+ {"hard_zero/Group1", H5O_TYPE_GROUP},
+ {"hard_zero/Group1/Dataset_one", H5O_TYPE_DATASET},
+ {"hard_zero/Group1/Type_one", H5O_TYPE_NAMED_DATATYPE},
+ {"hard_zero/Type_zero", H5O_TYPE_NAMED_DATATYPE}
+};
+
+typedef struct {
+ unsigned idx; /* Index in object visit structure */
+ const obj_visit_t *info; /* Pointer to the object visit structure to use */
+} ovisit_ud_t;
+
+static const char *FILENAME[] = {
+ "link0",
+ "link1.h5",
+ "link2.h5",
+ NULL
+};
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_basic_links
+ *
+ * Purpose: Test building a file with assorted links.
+ *
+ * Return: Success: 0
+ *
+ * Failure: -1
+ *
+ * Programmer: Binh-Minh Ribler
+ * October 16, 2009
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static void test_basic_links(hid_t fapl_id, hbool_t new_format)
+{
+ hsize_t size[1] = {1};
+ char filename[NAME_BUF_SIZE];
+ char* tconv_buf = new char [1000];
+
+ // Use the file access template id to create a file access prop. list.
+ FileAccPropList fapl(fapl_id);
+
+ try
+ {
+ if(new_format)
+ SUBTEST("Link creation (w/new group format)")
+ else
+ SUBTEST("Link creation")
+
+ h5_fixname(FILENAME[0], fapl_id, filename, sizeof filename);
+ H5File file(filename, H5F_ACC_TRUNC, FileCreatPropList::DEFAULT, fapl);
+
+ // Create simple dataspace
+ DataSpace scalar (1, size, size);
+
+ // Create a group then close it by letting the object go out of scope
+ {
+ Group group(file.createGroup("grp1", 0));
+ }
+
+ // Create a dataset then close it by letting the object go out of scope
+ {
+ DataSet dset1(file.createDataSet("dset1", PredType::NATIVE_INT, scalar));
+ }
+
+ hid_t file_id = file.getId();
+
+ // Because these are not implemented in the C++ API yet, they are
+ // used so CommonFG::getLinkval can be tested.
+ // Create a hard link
+ if(H5Lcreate_hard(
+ file_id, "dset1", H5L_SAME_LOC, "grp1/hard1",
+ H5P_DEFAULT, H5P_DEFAULT) < 0)
+ throw Exception("test_basic_links", "H5Lcreate_hard failed");
+
+ // Create a symbolic link
+ if(H5Lcreate_soft(
+ "/dset1", file_id, "grp1/soft", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ throw Exception("test_basic_links", "H5Lcreate_soft failed");
+
+ // Create a symbolic link to something that doesn't exist
+ if(H5Lcreate_soft(
+ "foobar", file_id, "grp1/dangle", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ throw Exception("test_basic_links", "H5Lcreate_soft failed");
+
+ // Create a recursive symbolic link
+ if(H5Lcreate_soft(
+ "/grp1/recursive", file_id, "/grp1/recursive",
+ H5P_DEFAULT, H5P_DEFAULT) < 0)
+ throw Exception("test_basic_links", "H5Lcreate_soft failed");
+
+ // Verify link values before closing the file
+
+ H5std_string softlink_val = file.getLinkval("grp1/soft");
+ verify_val(softlink_val, "/dset1", "H5File::getLinkval grp1/soft", __LINE__, __FILE__);
+
+ H5std_string dngllink_val = file.getLinkval("grp1/dangle");
+ verify_val(dngllink_val, "foobar", "H5File::getLinkval grp1/dangle", __LINE__, __FILE__);
+
+ H5std_string reclink_val = file.getLinkval("grp1/recursive");
+ verify_val(reclink_val, "/grp1/recursive", "H5File::getLinkval grp1/recursive", __LINE__, __FILE__);
+
+ } // end of try block
+ catch (Exception E)
+ {
+ issue_fail_msg("test_basic_links()", __LINE__, __FILE__, E.getCDetailMsg());
+ }
+
+ // Open the file and check on the links in it
+ try
+ {
+ // Open the file above
+ H5File file(filename, H5F_ACC_RDWR, FileCreatPropList::DEFAULT, fapl);
+
+ // Verify link existence
+ if(H5Lexists(file.getId(), "dset1", H5P_DEFAULT) != TRUE)
+ throw InvalidActionException("H5Lexists", "dset1 doesn't exist");
+ if(H5Lexists(file.getId(), "grp1/soft", H5P_DEFAULT) != TRUE)
+ throw InvalidActionException("H5Lexists", "grp1/soft doesn't exist");
+
+ // Verify link values
+ H5std_string softlink_val = file.getLinkval("grp1/soft");
+ verify_val(softlink_val, "/dset1", "H5File::getLinkval grp1/soft", __LINE__, __FILE__);
+
+ H5std_string reclink_val = file.getLinkval("grp1/recursive");
+ verify_val(reclink_val, "/grp1/recursive", "H5File::getLinkval grp1/recursive", __LINE__, __FILE__);
+
+ PASSED();
+ } // end of try block
+ catch (Exception E)
+ {
+ issue_fail_msg("test_basic_links()", __LINE__, __FILE__, E.getCDetailMsg());
+ }
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_links
+ *
+ * Purpose: Test links
+ *
+ * Return: None
+ *
+ * Programmer: Binh-Minh Ribler
+ * October 16, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifdef __cplusplus
+extern "C"
+#endif
+void test_links()
+{
+ hid_t fapl_id, fapl2_id; /* File access property lists */
+ hbool_t new_format; /* Whether to use the new format or not */
+ const char *envval;
+
+ envval = HDgetenv("HDF5_DRIVER");
+ if(envval == NULL)
+ envval = "nomatch";
+
+ fapl_id = h5_fileaccess();
+
+ // Output message about test being performed
+ MESSAGE(5, ("Testing Various Links\n"));
+ try
+ {
+ /* Copy the file access property list */
+ if((fapl2_id = H5Pcopy(fapl_id)) < 0)
+ throw Exception("test_links", "H5Pcopy failed");
+
+ /* Set the "use the latest version of the format" bounds for creating objects in the file */
+ if(H5Pset_libver_bounds(fapl2_id, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ throw Exception("test_links", "H5Pset_libver_bounds failed");
+
+ /* Loop over using new group format */
+ for(new_format = FALSE; new_format <= TRUE; new_format++)
+ {
+ hid_t my_fapl_id;
+
+ /* Check for FAPL to use */
+ if(new_format)
+ my_fapl_id = fapl2_id;
+ else
+ my_fapl_id = fapl_id;
+
+ /* General tests... (on both old & new format groups */
+ // FileAccPropList may be passed in instead of fapl id
+ test_basic_links(my_fapl_id, new_format);
+#if 0
+// these tests are from the C test links.c and left here for future
+// implementation of H5L API
+ nerrors += test_basic_links(fapl_id, new_format) < 0 ? 1 : 0;
+ nerrors += cklinks(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += new_links(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += ck_new_links(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += long_links(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += toomany(my_fapl, new_format) < 0 ? 1 : 0;
+
+ /* Test new H5L link creation routine */
+ nerrors += test_lcpl(my_fapl, new_format);
+ nerrors += test_move(my_fapl, new_format);
+ nerrors += test_copy(my_fapl, new_format);
+ nerrors += test_move_preserves(my_fapl, new_format);
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+ nerrors += test_deprec(my_fapl, new_format);
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+#ifndef H5_CANNOT_OPEN_TWICE
+ nerrors += external_link_root(my_fapl, new_format) < 0 ? 1 : 0;
+#endif /* H5_CANNOT_OPEN_TWICE */
+ nerrors += external_link_path(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_mult(my_fapl, new_format) < 0 ? 1 : 0;
+#ifndef H5_CANNOT_OPEN_TWICE
+ nerrors += external_link_self(envval, my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_pingpong(envval, my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_toomany(my_fapl, new_format) < 0 ? 1 : 0;
+#endif /* H5_CANNOT_OPEN_TWICE */
+ nerrors += external_link_dangling(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_recursive(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_query(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_unlink_compact(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_unlink_dense(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_move(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_ride(my_fapl, new_format) < 0 ? 1 : 0;
+#ifndef H5_CANNOT_OPEN_TWICE
+ nerrors += external_link_closing(envval, my_fapl, new_format) < 0 ? 1 : 0;
+#endif /* H5_CANNOT_OPEN_TWICE */
+ nerrors += external_link_endian(new_format) < 0 ? 1 : 0;
+ nerrors += external_link_strong(my_fapl, new_format) < 0 ? 1 : 0;
+
+ /* tests for external link */
+ nerrors += external_link_env(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_prefix(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_abs_mainpath(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_rel_mainpath(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_cwd(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_abstar(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_abstar_cur(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_reltar(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_chdir(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_set_elink_fapl1(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_set_elink_fapl2(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_set_elink_fapl3(new_format) < 0 ? 1 : 0;
+ nerrors += external_set_elink_acc_flags(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_set_elink_cb(my_fapl, new_format) < 0 ? 1 : 0;
+
+#ifdef H5_HAVE_WINDOW_PATH
+ nerrors += external_link_win1(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_win2(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_win3(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_win4(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_win5(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_win6(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_win7(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_win8(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_win9(my_fapl, new_format) < 0 ? 1 : 0;
+#endif
+ /* These tests assume that external links are a form of UD links,
+ * so assume that everything that passed for external links
+ * above has already been tested for UD links.
+ */
+ if(new_format == TRUE) {
+ nerrors += ud_hard_links(fapl2) < 0 ? 1 : 0; /* requires new format groups */
+ nerrors += ud_link_reregister(fapl2) < 0 ? 1 : 0; /* requires new format groups */
+ } /* end if */
+
+ nerrors += ud_callbacks(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += ud_link_errors(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += lapl_udata(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += lapl_nlinks(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += linkinfo(my_fapl, new_format) < 0 ? 1 : 0;
+
+ /* Misc. extra tests, useful for both new & old format files */
+ nerrors += link_visit(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += link_visit_by_name(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += obj_visit(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += obj_visit_by_name(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += obj_visit_stop(my_fapl, new_format) < 0 ? 1 : 0;
+
+ /* Keep this test last, it's testing files that are used above */
+ /* do not do this for files used by external link tests */
+ nerrors += check_all_closed(my_fapl, new_format, EXTSTOP) < 0 ? 1 : 0;
+#endif // 0
+ } /* end for */
+
+#if 0
+ /* New group revision feature tests */
+ nerrors += corder_create_empty(fapl2) < 0 ? 1 : 0;
+/* XXX: when creation order indexing is fully working, go back and add checks
+* to these tests to make certain that the creation order values are
+* correct.
+*/
+ nerrors += corder_create_compact(fapl2) < 0 ? 1 : 0;
+ nerrors += corder_create_dense(fapl2) < 0 ? 1 : 0;
+ nerrors += corder_transition(fapl2) < 0 ? 1 : 0;
+ nerrors += corder_delete(fapl2) < 0 ? 1 : 0;
+ nerrors += link_info_by_idx(fapl2) < 0 ? 1 : 0;
+ nerrors += delete_by_idx(fapl2) < 0 ? 1 : 0;
+ nerrors += link_iterate(fapl2) < 0 ? 1 : 0;
+ nerrors += open_by_idx(fapl2) < 0 ? 1 : 0;
+ nerrors += object_info(fapl2) < 0 ? 1 : 0;
+ nerrors += group_info(fapl2) < 0 ? 1 : 0;
+ nerrors += timestamps(fapl2) < 0 ? 1 : 0;
+
+ /* Test new API calls on old-style groups */
+ nerrors += link_info_by_idx_old(fapl) < 0 ? 1 : 0;
+ nerrors += delete_by_idx_old(fapl) < 0 ? 1 : 0;
+ nerrors += link_iterate_old(fapl) < 0 ? 1 : 0;
+ nerrors += open_by_idx_old(fapl) < 0 ? 1 : 0;
+ nerrors += object_info_old(fapl) < 0 ? 1 : 0;
+ nerrors += group_info_old(fapl) < 0 ? 1 : 0;
+
+#endif
+ /* Close 2nd FAPL */
+ H5Pclose(fapl2_id);
+
+ h5_cleanup(FILENAME, fapl_id);
+
+ /* Test that external links can be used after a library reset. MUST be
+ * called last so the reset doesn't interfere with the property lists. This
+ * routine will delete its own file. */
+ /* nerrors += external_reset_register() < 0 ? 1 : 0;
+ */
+ }
+ catch (Exception E)
+ {
+ issue_fail_msg("test_links()", __LINE__, __FILE__, E.getCDetailMsg());
+ }
+
+}
+
+/*-------------------------------------------------------------------------
+ * Function: cleanup_links
+ *
+ * Purpose: Cleanup temporary test files
+ *
+ * Return: none
+ *
+ * Programmer: Binh-Minh Ribler
+ * October 16, 2009
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifdef __cplusplus
+extern "C"
+#endif
+void cleanup_links()
+{
+ HDremove(FILENAME[0]);
+}
+
diff --git a/config/BlankForm b/config/BlankForm
index a70762c..31116bf 100644
--- a/config/BlankForm
+++ b/config/BlankForm
@@ -72,7 +72,7 @@ fi
# `-pg'). This may or may not include debugging
# or production flags.
#
-# CFLAGS Flags can be added to this variable which
+# H5_CFLAGS Flags can be added to this variable which
# might already be partially initialized. These
# flags will always be passed to the compiler
# and should include switches to turn on full
@@ -81,16 +81,14 @@ fi
# practices resulting in few if any
# warnings.
#
-# Warning flags do not have to be added to CFLAGS
+# Warning flags do not have to be added to H5_CFLAGS
# variable if the compiler is the GNU gcc
# compiler or a descendent of gcc such as EGCS or PGCC.
#
-# The CFLAGS should contains *something* or else
-# configure will probably add `-g'. For most
-# systems this isn't a problem but some systems
-# will disable optimizations in favor of the
-# `-g'.
-#
+# AM_CFLAGS Flags added directly into this variable will
+# be propogated to the compiler wrapper scripts (h5cc,
+# h5c++, et cetera) in addition to being used to compile
+# the library.
#
# These flags should be set according to the compiler being used.
# There are two ways to check the compiler. You can try using `-v' or
@@ -101,7 +99,7 @@ fi
case $CC_BASENAME in
gcc)
- CFLAGS="$CFLAGS -Wsign-compare" #Only works for some versions
+ H5_CFLAGS="$H5_CFLAGS -Wsign-compare" #Only works for some versions
DEBUG_CFLAGS="-g -fverbose-asm"
DEBUG_CPPFLAGS=
PROD_CFLAGS="-O3 -fomit-frame-pointer"
@@ -111,7 +109,7 @@ case $CC_BASENAME in
;;
*)
- CFLAGS="$CFLAGS -ansi"
+ H5_CFLAGS="$H5_CFLAGS -ansi"
DEBUG_CFLAGS="-g"
DEBUG_CPPFLAGS=
PROD_CFLAGS="-O"
diff --git a/config/apple b/config/apple
index 14504bb..8c4cc8e 100644
--- a/config/apple
+++ b/config/apple
@@ -28,54 +28,30 @@ fi
# Figure out compiler flags
. $srcdir/config/gnu-flags
-
-# The default Fortran 90 compiler
+
+. $srcdir/config/intel-flags
if test "X-" = "X-$FC"; then
- # Assume Absoft compiler
- FC=xlf
- FC_BASENAME=xlf
- else
-
- # Neither xlf nor f95 have a working "version" command.
- # If FC is set, try to guess which one is being used by examining
- # the last element in the path to the compiler.
-
- TEMP_BASENAME=`basename $FC`
- if test "xlf" = "${TEMP_BASENAME}"; then
- FC_BASENAME=xlf
- else
- FC_BASENAME=f95
- fi
+ case $CC_BASENAME in
+ gcc*)
+ FC=gfortran
+ FC_BASENAME=gfortran
+ ;;
+ icc*)
+ FC=ifort
+ FC_BASENAME=ifort
+ ;;
+ esac
fi
-
-case $FC_BASENAME in
- xlf)
- F9XSUFFIXFLAG="-qsuffix=f=f90 -qfree=f90"
- FCFLAGS="$FCFLAGS ${F9XSUFFIXFLAG}"
- H5_FCFLAGS="$H5_FCFLAGS -qmoddir=./ "
- FSEARCH_DIRS="-I./ -I../src"
- DEBUG_FCFLAGS="-g"
- PROD_FCFLAGS="-O"
- PROFILE_FCFLAGS="-g"
- f9x_flags_set=yes
- ;;
-
- f95)
-
- F9XSUFFIXFLAG=""
-# We force compiler to use upper case for external names
-# (just in case since this should be a default EIP)
- H5_FCFLAGS="$H5_FCFLAGS"
- FSEARCH_DIRS=""
- DEBUG_FCFLAGS="-g"
- PROD_FCFLAGS="-O"
- PROFILE_FCFLAGS="-g -pg"
- f9x_flags_set=yes
-
-# f95 doesn't support shared libraries
- echo ' warning: shared libraries are not supported for f95!'
- echo ' disabling shared libraries'
+# Figure out compiler flags
+. $srcdir/config/gnu-fflags
+
+. $srcdir/config/intel-fflags
+
+# Fortran doesn't work with shared libraries
+#
+if test "X-" != "X-$enable_fortran"; then
+ echo ' Warning: shared libraries are not supported with Fortran'
+ echo ' Disabling shared libraries'
enable_shared="no"
- ;;
+fi
-esac
diff --git a/config/commence.am b/config/commence.am
index e5e4de9..667dbb2 100644
--- a/config/commence.am
+++ b/config/commence.am
@@ -55,13 +55,15 @@ H5FC_PP=$(bindir)/h5pfc
H5CPP=$(bindir)/h5c++
-# H5_CFLAGS holds flags that should be used as CFLAGS when building hdf5,
-# but which shouldn't be exported to h5cc for building other programs.
-
-CFLAGS=@CFLAGS@ @H5_CFLAGS@
-CPPFLAGS=@CPPFLAGS@ @H5_CPPFLAGS@
-FCFLAGS=@FCFLAGS@ @H5_FCFLAGS@
-CXXFLAGS=@CXXFLAGS@ @H5_CXXFLAGS@
+# H5_CFLAGS holds flags that should be used when building hdf5,
+# but which should not be exported to h5cc for building other programs.
+# AM_CFLAGS is an automake construct which should be used by Makefiles
+# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
+
+AM_CFLAGS=@AM_CFLAGS@ @H5_CFLAGS@
+AM_FCFLAGS=@AM_FCFLAGS@ @H5_FCFLAGS@
+AM_CXXFLAGS=@AM_CXXFLAGS@ @H5_CXXFLAGS@
+AM_CPPFLAGS=@AM_CPPFLAGS@ @H5_CPPFLAGS@
# The trace script; this is used on source files from the C library to
# insert tracing macros.
diff --git a/config/craynv b/config/craynv
index 9371ac3..479d5c8 100644
--- a/config/craynv
+++ b/config/craynv
@@ -68,25 +68,23 @@ RANLIB=:
# `-pg'). This may or may not include debugging
# or production flags.
#
-# CFLAGS Flags can be added to this variable which
-# might already be partially initialized. These
-# flags will always be passed to the compiler
-# and should include switches to turn on full
-# warnings. HDF5 attempts to be ANSI and Posix
-# compliant and employ good programming
-# practices resulting in few if any
-# warnings.
+# H5_CFLAGS Flags can be added to this variable which
+# might already be partially initialized. These
+# flags will always be passed to the compiler
+# and should include switches to turn on full
+# warnings. HDF5 attempts to be ANSI and Posix
+# compliant and employ good programming
+# practices resulting in few if any
+# warnings.
#
-# Warning flags do not have to be added to CFLAGS
-# variable if the compiler is the GNU gcc
-# compiler or a descendent of gcc such as EGCS or PGCC.
+# Warning flags do not have to be added to H5_CFLAGS
+# variable if the compiler is the GNU gcc
+# compiler or a descendent of gcc such as EGCS or PGCC.
#
-# The CFLAGS should contains *something* or else
-# configure will probably add `-g'. For most
-# systems this isn't a problem but some systems
-# will disable optimizations in favor of the
-# `-g'.
-#
+# AM_CFLAGS Flags added directly into this variable will
+# be propogated to the compiler wrapper scripts (h5cc,
+# h5c++, et cetera) in addition to being used to compile
+# the library.
#
# These flags should be set according to the compiler being used.
# There are two ways to check the compiler. You can try using `-v' or
@@ -162,7 +160,7 @@ if test "X-" = "X-$f9x_flags_set"; then
# The -em flag enables .mod files, which is what HDF5 builds.
F9XSUFFIXFLAG=""
FSEARCH_DIRS=""
- FCFLAGS="$FCFLAGS -em"
+ H5_FCFLAGS="$H5_FCFLAGS -em"
DEBUG_FCFLAGS="-g"
PROD_FCFLAGS=""
PROFILE_FCFLAGS=""
diff --git a/config/dec-flags b/config/dec-flags
index fe9ee87..8f3fa1a 100644
--- a/config/dec-flags
+++ b/config/dec-flags
@@ -26,7 +26,7 @@
#
if test X = "X$cc_flags_set"; then
cc_vendor=DEC
- cc_version="`$CC $CFLAGS -V 2>&1 |head -1`"
+ cc_version="`$CC $CFLAGS $H5_CFLAGS -V 2>&1 |head -1`"
case "$cc_version" in
DEC*)
cc_version="`echo $cc_version |\
@@ -111,7 +111,7 @@ fi
if test "X-" = "X-$f9x_flags_set"; then
F9XSUFFIXFLAG=""
FSEARCH_DIRS=""
- FCFLAGS="$FCFLAGS -Olimit 2048 -std1"
+ H5_FCFLAGS="$H5_FCFLAGS -Olimit 2048 -std1"
DEBUG_FCFLAGS="-Olimit 2048 -std1"
PROD_FCFLAGS="-Olimit 2048 -std1"
PROFILE_FCFLAGS="-Olimit 2048 -std1"
@@ -128,7 +128,7 @@ fi
case $CXX_BASENAME in
g++)
- CXXFLAGS="$CXXFLAGS -Wsign-compare" #Only works for some versions
+ H5_CXXFLAGS="$H5_CXXFLAGS -Wsign-compare" #Only works for some versions
DEBUG_CXXFLAGS="-g -fverbose-asm"
DEBUG_CPPFLAGS=
PROD_CXXFLAGS="-O3 -fomit-frame-pointer"
@@ -138,7 +138,7 @@ case $CXX_BASENAME in
;;
*)
- CXXFLAGS="$CXXFLAGS -tlocal -D__USE_STD_IOSTREAM"
+ H5_CXXFLAGS="$H5_CXXFLAGS -tlocal -D__USE_STD_IOSTREAM"
DEBUG_CXXFLAGS="-g"
DEBUG_CPPFLAGS=
PROD_CXXFLAGS="-O"
diff --git a/config/dec-osf4.x b/config/dec-osf4.x
deleted file mode 100644
index 3b93ed9..0000000
--- a/config/dec-osf4.x
+++ /dev/null
@@ -1,37 +0,0 @@
-# -*- 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.
-
-
-# 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.
-#
-# See BlankForm in this directory for detailed information.
-
-# The default compiler is `cc'
-if test "X-" = "X-$CC"; then
- CC=cc
- CC_BASENAME=cc
-fi
-
-# Try GNU compiler flags.
-. $srcdir/config/gnu-flags
-
-# Try native DEC compiler
-ARCH=${ARCH:='-arch host -tune host'}
-. $srcdir/config/dec-flags
-# DEC MPI-IO implementation has a bug,
-#it cannot generate correct MPI derived datatype.
-hdf5_mpi_complex_derived_datatype_works=${hdf5_mpi_complex_derived_datatype_works='no'}
diff --git a/config/dec-osf5.x b/config/dec-osf5.x
deleted file mode 100644
index 2d875ff..0000000
--- a/config/dec-osf5.x
+++ /dev/null
@@ -1,40 +0,0 @@
-# -*- 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.
-
-
-# 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.
-#
-# See BlankForm in this directory for detailed information.
-
-# The default compiler is `cc'
-if test "X-" = "X-$CC"; then
- CC=cc
- CC_BASENAME=cc
-fi
-
-# Try GNU compiler flags.
-. $srcdir/config/gnu-flags
-
-# Try native DEC compiler
-ARCH=${ARCH:='-arch host -tune host'}
-. $srcdir/config/dec-flags
-
-# DEC MPI-IO implementation has a bug, it cannot generate correct MPI
-# derived datatype.
-hdf5_mpi_complex_derived_datatype_works=${hdf5_mpi_complex_derived_datatype_works='no'}
-# It does not do all collective IO correctly.
-hdf5_mpi_special_collective_io_works=${hdf5_mpi_special_collective_io_works='no'}
diff --git a/config/freebsd b/config/freebsd
index 8f2e5e4..7452ff0 100644
--- a/config/freebsd
+++ b/config/freebsd
@@ -68,7 +68,7 @@ fi
if test "X-" != "X-$enable_threadsafe"; then
H5_CFLAGS="$H5_CFLAGS -D_THREAD_SAFE"
H5_CXXFLAGS="$H5_CXXFLAGS -D_THREAD_SAFE"
- LDFLAGS="$LDFLAGS -pthread"
+ AM_LDFLAGS="$AM_LDFLAGS -pthread"
fi
# Temporarily hard set this variable. The problem of loss of the last 2 bytes of mantissa
diff --git a/config/hpux11.00 b/config/hpux11.00
deleted file mode 100644
index 1a80091..0000000
--- a/config/hpux11.00
+++ /dev/null
@@ -1,101 +0,0 @@
-# -*- 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.
-
-
-# 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.
-#
-# See BlankForm in this directory for details.
-
-# Shared libraries don't work for all compilers under HPUX11.00. This is a
-# known bug in libtool (as of June 2006).
-# Disable shared libraries until we can be sure they work.
-enable_shared="${enable_shared:-no}"
-
-# Default compiler is `cc'
-if test "X-" = "X-$CC"; then
- CC=cc
- CC_BASENAME=cc
-fi
-
-# Flags
-case "X-$CC" in
- X-gcc)
- CFLAGS="$CFLAGS -Wsign-compare" #Only works for some versions
- DEBUG_CFLAGS="-g -fverbose-asm"
- DEBUG_CPPFLAGS=
- PROD_CFLAGS="-O3"
- PROD_CPPFLAGS=
- PROFILE_CFLAGS="-pg"
- PROFILE_CPPFLAGS=
- ;;
-
- *)
- CFLAGS="$CFLAGS -Ae -Wp,-H65536" #increase the size of macro definition table. For test/dtypes.c
- DEBUG_CFLAGS=-g
- DEBUG_CPPFLAGS="-Ae"
- PROD_CFLAGS=-O
- PROD_CPPFLAGS="-Ae"
- PROFILE_CFLAGS=
- PROFILE_CPPFLAGS="-Ae"
- ;;
-esac
-
-# The default Fortran 90 compiler
-
-if test "X$FC" = "X"; then
- FC=f90
-fi
-
-if test "X$f9x_flags_set" = "X"; then
- F9XSUFFIXFLAG=""
- FSEARCH_DIRS=""
- FCFLAGS="$FCFLAGS -O"
- DEBUG_FCFLAGS="-O"
- PROD_FCFLAGS="-O"
- PROFILE_FCFLAGS="-O"
- f9x_flags_set=yes
-fi
-
-# The default C++ compiler
-
-if test -z "$CXX"; then
- CXX=aCC
- CXX_BASENAME=aCC
-fi
-
-case "X-$CXX" in
- X-aCC)
- # +Z for PIC, +A for using archived libraries
- CXXFLAGS="$CXXFLAGS +Z +A -D_INCLUDE_LONGLONG"
- CFLAGS="$CFLAGS -g +O2"
- DEBUG_CXXFLAGS=-g
- DEBUG_CPPFLAGS=
- PROD_CXXFLAGS="-O -s"
- PROD_CPPFLAGS=
- PROFILE_CPPFLAGS=
- ;;
-
- *)
- CXXFLAGS="$CXXFLAGS -D_INCLUDE_LONGLONG"
- CFLAGS="$CFLAGS"
- DEBUG_CXXFLAGS=
- DEBUG_CPPFLAGS=
- PROD_CXXFLAGS=
- PROD_CPPFLAGS=
- PROFILE_CPPFLAGS=
- ;;
-esac
diff --git a/config/hpux11.23 b/config/hpux11.23
index 0e3bc2a..339cc84 100644
--- a/config/hpux11.23
+++ b/config/hpux11.23
@@ -29,7 +29,7 @@ fi
# Flags
case "X-$CC" in
X-gcc)
- CFLAGS="$CFLAGS -Wsign-compare" #Only works for some versions
+ H5_CFLAGS="$H5_CFLAGS -Wsign-compare" #Only works for some versions
DEBUG_CFLAGS="-g -fverbose-asm"
DEBUG_CPPFLAGS=
PROD_CFLAGS="-O3"
@@ -39,7 +39,7 @@ case "X-$CC" in
;;
*)
- CFLAGS="$CFLAGS -Ae -Wp,-H65536" #increase the size of macro definition table. For test/dtypes.c
+ H5_CFLAGS="$H5_CFLAGS -Ae -Wp,-H65536" #increase the size of macro definition table. For test/dtypes.c
DEBUG_CFLAGS=-g
DEBUG_CPPFLAGS="-Ae"
PROD_CFLAGS=-O
@@ -58,7 +58,7 @@ fi
if test "X$f9x_flags_set" = "X"; then
F9XSUFFIXFLAG=""
FSEARCH_DIRS=""
- FCFLAGS="$FCFLAGS -O"
+ H5_FCFLAGS="$H5_FCFLAGS -O"
DEBUG_FCFLAGS="-O"
PROD_FCFLAGS="-O"
PROFILE_FCFLAGS="-O"
@@ -75,8 +75,8 @@ fi
case "X-$CXX" in
X-aCC)
# +Z for PIC
- CXXFLAGS="$CXXFLAGS +Z -D_INCLUDE_LONGLONG"
- CFLAGS="$CFLAGS -g +O2"
+ H5_CXXFLAGS="$H5_CXXFLAGS +Z -D_INCLUDE_LONGLONG"
+ H5_CFLAGS="$H5_CFLAGS -g +O2"
DEBUG_CXXFLAGS=-g
DEBUG_CPPFLAGS=
PROD_CXXFLAGS="-O -s"
@@ -85,8 +85,8 @@ case "X-$CXX" in
;;
*)
- CXXFLAGS="$CXXFLAGS -D_INCLUDE_LONGLONG"
- CFLAGS="$CFLAGS"
+ H5_CXXFLAGS="$H5_CXXFLAGS -D_INCLUDE_LONGLONG"
+ H5_CFLAGS="$H5_CFLAGS"
DEBUG_CXXFLAGS=
DEBUG_CPPFLAGS=
PROD_CXXFLAGS=
diff --git a/config/i686-pc-cygwin b/config/i686-pc-cygwin
index 555d9cd..a51adc3 100644
--- a/config/i686-pc-cygwin
+++ b/config/i686-pc-cygwin
@@ -94,12 +94,12 @@ case $FC_BASENAME in
#
f95)
# Set required flag for compiling C stubs
- CFLAGS="$CFLAGS -DH5_ABSOFT"
+ H5_CFLAGS="$H5_CFLAGS -DH5_ABSOFT"
F9XSUFFIXFLAG=""
# We force compiler to use upper case for external names
# (just in case since this should be a default EIP)
- FCFLAGS="$FCFLAGS -YEXT_NAMES=UCS"
+ H5_FCFLAGS="$H5_FCFLAGS -YEXT_NAMES=UCS"
FSEARCH_DIRS=""
DEBUG_FCFLAGS="-g"
PROD_FCFLAGS="-O"
diff --git a/config/ia64-linux-gnu b/config/ia64-linux-gnu
index 9bebd37..1961119 100644
--- a/config/ia64-linux-gnu
+++ b/config/ia64-linux-gnu
@@ -50,7 +50,7 @@ case $CC_BASENAME in
;;
*)
- CFLAGS="$CFLAGS -ansi"
+ H5_CFLAGS="$H5_CFLAGS -ansi"
DEBUG_CFLAGS="-g"
DEBUG_CPPFLAGS=
PROD_CFLAGS="-O"
@@ -76,7 +76,7 @@ case $FC in
# this is for efc v7. Older efc do not work with these.
# -Vaxlib is for non-standard fortran calls like exit().
MORE_FCFLAGS='-fpp -DDEC$=DEC_ -DMS$=MS_ -Vaxlib'
- FCFLAGS="$FCFLAGS $MORE_FCFLAGS"
+ H5_FCFLAGS="$H5_FCFLAGS $MORE_FCFLAGS"
f9x_flags_set=yes
;;
@@ -89,7 +89,7 @@ esac
if test "X$f9x_flags_set" = "X"; then
F9XSUFFIXFLAG=""
FSEARCH_DIRS=""
- FCFLAGS="$FCFLAGS"
+ H5_FCFLAGS="$H5_FCFLAGS"
DEBUG_FCFLAGS=""
PROD_FCFLAGS=""
PROFILE_FCFLAGS=""
@@ -113,7 +113,7 @@ fi
case $CXX_BASENAME in
ecc|icc) # Intel compilers
# Default to C99 standard.
- CXXFLAGS="${CXXFLAGS:--std=c99}"
+ H5_CXXFLAGS="${H5_CXXFLAGS:--std=c99}"
DEBUG_CXXFLAGS="-g -w2 -Wall"
DEBUG_CPPFLAGS=
PROD_CXXFLAGS="" #Default optimization O2 is used
@@ -122,7 +122,7 @@ case $CXX_BASENAME in
PROFILE_CPPFLAGS=
;;
g++)
- CXXFLAGS="$CXXFLAGS -Wsign-compare" #Only works for some versions
+ H5_CXXFLAGS="$H5_CXXFLAGS -Wsign-compare" #Only works for some versions
DEBUG_CXXFLAGS="-g -fverbose-asm"
DEBUG_CPPFLAGS=
PROD_CXXFLAGS="-O3 -fomit-frame-pointer"
@@ -133,7 +133,7 @@ case $CXX_BASENAME in
*)
# Default to C99 standard.
- CXXFLAGS="${CXXFLAGS:--std=c99}"
+ H5_CXXFLAGS="${H5_CXXFLAGS:--std=c99}"
DEBUG_CXXFLAGS="-g"
DEBUG_CPPFLAGS=
PROD_CXXFLAGS="-O"
@@ -146,8 +146,8 @@ esac
# Check MPICH settings
. $srcdir/config/mpich
#Uncomment the next line if your system doesn't support MPI complex derived datatype.
-#hdf5_mpi_complex_derived_datatype_works=${hdf5_mpi_complex_derived_datatype_works='no'}
+#hdf5_cv_mpi_complex_derived_datatype_works=${hdf5_cv_mpi_complex_derived_datatype_works='no'}
#Comment out the following line if your system supports collective IO when some processes
#don't have any contributions to IOs.
-hdf5_mpi_special_collective_io_works=${hdf5_mpi_special_collective_io_works='no'}
+hdf5_cv_mpi_special_collective_io_works=${hdf5_cv_mpi_special_collective_io_works='no'}
diff --git a/config/intel-fflags b/config/intel-fflags
index 998e569..3e33fc9 100644
--- a/config/intel-fflags
+++ b/config/intel-fflags
@@ -70,7 +70,7 @@ if test "X-ifort" = "X-$f9x_vendor"; then
FC_BASENAME=ifort
F9XSUFFIXFLAG=""
FSEARCH_DIRS=""
- FCFLAGS="$FCFLAGS"
+ H5_FCFLAGS="$H5_FCFLAGS"
# Production
PROD_FCFLAGS="-O3"
diff --git a/config/intel-osf1 b/config/intel-osf1
deleted file mode 100644
index 27d89cf..0000000
--- a/config/intel-osf1
+++ /dev/null
@@ -1,180 +0,0 @@
-# -*- 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.
-
-
-# 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.
-#
-# See BlankForm in this directory for details.
-
-# This is for the ASCI RED TFLOPS machine
-
-# The default compiler is `cicc'
-if test "X-" = "X-$CC"; then
- CC=cicc
- CC_BASENAME=cicc
-fi
-
-# The default archiver is `xar'
-AR=${AR:-xar}
-
-# There is no ranlib
-RANLIB=:
-
-# Additional libraries
-LIBS="$LIBS -lnoop_stubs"
-
-# How to run serial and parallel test programs
-# Default parallel tests can fit within 1 processor in -proc 3 mode.
-# You may want to use -proc 3 to use fewer physical nodes.
-RUNSERIAL=${RUNSERIAL:-"yod -sz 1"}
-RUNPARALLEL=${RUNPARALLEL:-"yod -sz 8"}
-
-# CFLAGS must be set else configure set it to -g
-CFLAGS="$CFLAGS"
-
-# What must *always* be present for things to compile correctly?
-# -DH5_TFLOPS: for the Sandia Tflops machine. Had used the builtin
-# __PUMAGON__ but H5_TFLOPS is more meaningful.
-CPPFLAGS="$CPPFLAGS -DH5_TFLOPS"
-
-# What compiler flags should be used for code development?
-DEBUG_CFLAGS=-g
-DEBUG_CPPFLAGS=
-
-# What compiler flags should be used for building a production
-# library?
-PROD_CFLAGS=-O
-PROD_CPPFLAGS=
-
-# What compiler flags enable code profiling?
-PROFILE_CFLAGS=-pg
-PROFILE_CPPFLAGS=
-
-# Turn off shared lib option. It does not work for TFLOPS yet.
-enable_shared="${enable_shared:-no}"
-
-# Disable stream-vfd option. It does not work for TFLOPS.
-enable_stream_vfd="${enable_stream_vfd:-no}"
-
-# Set this to the width required by printf() to print type `long
-# long'. For instance, if the format would be `%lld' then set it to
-# `ll' or if the format would be `%qd' set it to `q'.
-hdf5_cv_printf_ll=${hdf5_cv_printf_ll='ll'}
-
-# Cache the sizeof of the following types to save configure time.
-# These are verified in test/tconfig in case they change.
-ac_cv_type_char=${ac_cv_type_char=yes}
-ac_cv_sizeof_char=${ac_cv_sizeof_char='1'}
-ac_cv_type_short=${ac_cv_type_short=yes}
-ac_cv_sizeof_short=${ac_cv_sizeof_short='2'}
-ac_cv_type_int=${ac_cv_type_int=yes}
-ac_cv_sizeof_int=${ac_cv_sizeof_int='4'}
-ac_cv_type_long=${ac_cv_type_long=yes}
-ac_cv_sizeof_long=${ac_cv_sizeof_long='4'}
-ac_cv_type_float=${ac_cv_type_float=yes}
-ac_cv_sizeof_float=${ac_cv_sizeof_float='4'}
-ac_cv_type_double=${ac_cv_type_double=yes}
-ac_cv_sizeof_double=${ac_cv_sizeof_double='8'}
-ac_cv_type_long_double=${ac_cv_type_long_double=yes}
-ac_cv_sizeof_long_double=${ac_cv_sizeof_long_double='8'}
-ac_cv_type_long_long=${ac_cv_type_long_long=yes}
-ac_cv_sizeof_long_long=${ac_cv_sizeof_long_long='8'}
-ac_cv_type_size_t=${ac_cv_type_size_t=yes}
-ac_cv_sizeof_size_t=${ac_cv_sizeof_size_t='4'}
-ac_cv_type_ssize_t=${ac_cv_type_ssize_t=yes}
-ac_cv_sizeof_ssize_t=${ac_cv_sizeof_ssize_t='4'}
-ac_cv_type_off_t=${ac_cv_type_off_t=yes}
-ac_cv_sizeof_off_t=${ac_cv_sizeof_off_t='4'}
-
-# Hard set sizeof of the following types to 0 because they are not supported.
-ac_cv_type___int64=${ac_cv_type___int64=no}
-ac_cv_sizeof___int64=${ac_cv_sizeof___int64='0'}
-
-# Hard set malloc of zero bytes to no because it does not work.
-hdf5_cv_malloc_works=${hdf5_cv_malloc_works='no'}
-
-# Hard set sizeof_intN_t to 0 because they are not supported.
-ac_cv_type_int8_t=${ac_cv_type_int8_t=no}
-ac_cv_type_int16_t=${ac_cv_type_int16_t=no}
-ac_cv_type_int32_t=${ac_cv_type_int32_t=no}
-ac_cv_type_int64_t=${ac_cv_type_int64_t=no}
-ac_cv_type_uint8_t=${ac_cv_type_uint8_t=no}
-ac_cv_type_uint16_t=${ac_cv_type_uint16_t=no}
-ac_cv_type_uint32_t=${ac_cv_type_uint32_t=no}
-ac_cv_type_uint64_t=${ac_cv_type_uint64_t=no}
-ac_cv_sizeof_int8_t=${ac_cv_sizeof_int8_t='0'}
-ac_cv_sizeof_int16_t=${ac_cv_sizeof_int16_t='0'}
-ac_cv_sizeof_int32_t=${ac_cv_sizeof_int32_t='0'}
-ac_cv_sizeof_int64_t=${ac_cv_sizeof_int64_t='0'}
-ac_cv_sizeof_uint8_t=${ac_cv_sizeof_uint8_t='0'}
-ac_cv_sizeof_uint16_t=${ac_cv_sizeof_uint16_t='0'}
-ac_cv_sizeof_uint32_t=${ac_cv_sizeof_uint32_t='0'}
-ac_cv_sizeof_uint64_t=${ac_cv_sizeof_uint64_t='0'}
-
-# Hard set sizeof_int_leastN_t to 0 because they are not supported.
-ac_cv_type_int_least8_t=${ac_cv_type_int_least8_t=no}
-ac_cv_type_int_least16_t=${ac_cv_type_int_least16_t=no}
-ac_cv_type_int_least32_t=${ac_cv_type_int_least32_t=no}
-ac_cv_type_int_least64_t=${ac_cv_type_int_least64_t=no}
-ac_cv_type_uint_least8_t=${ac_cv_type_uint_least8_t=no}
-ac_cv_type_uint_least16_t=${ac_cv_type_uint_least16_t=no}
-ac_cv_type_uint_least32_t=${ac_cv_type_uint_least32_t=no}
-ac_cv_type_uint_least64_t=${ac_cv_type_uint_least64_t=no}
-ac_cv_sizeof_int_least8_t=${ac_cv_sizeof_int_least8_t='0'}
-ac_cv_sizeof_int_least16_t=${ac_cv_sizeof_int_least16_t='0'}
-ac_cv_sizeof_int_least32_t=${ac_cv_sizeof_int_least32_t='0'}
-ac_cv_sizeof_int_least64_t=${ac_cv_sizeof_int_least64_t='0'}
-ac_cv_sizeof_uint_least8_t=${ac_cv_sizeof_uint_least8_t='0'}
-ac_cv_sizeof_uint_least16_t=${ac_cv_sizeof_uint_least16_t='0'}
-ac_cv_sizeof_uint_least32_t=${ac_cv_sizeof_uint_least32_t='0'}
-ac_cv_sizeof_uint_least64_t=${ac_cv_sizeof_uint_least64_t='0'}
-
-# Hard set sizeof_int_fastN_t to 0 because they are not supported.
-ac_cv_type_int_fast8_t=${ac_cv_type_int_fast8_t=no}
-ac_cv_type_int_fast16_t=${ac_cv_type_int_fast16_t=no}
-ac_cv_type_int_fast32_t=${ac_cv_type_int_fast32_t=no}
-ac_cv_type_int_fast64_t=${ac_cv_type_int_fast64_t=no}
-ac_cv_type_uint_fast8_t=${ac_cv_type_uint_fast8_t=no}
-ac_cv_type_uint_fast16_t=${ac_cv_type_uint_fast16_t=no}
-ac_cv_type_uint_fast32_t=${ac_cv_type_uint_fast32_t=no}
-ac_cv_type_uint_fast64_t=${ac_cv_type_uint_fast64_t=no}
-ac_cv_sizeof_int_fast8_t=${ac_cv_sizeof_int_fast8_t='0'}
-ac_cv_sizeof_int_fast16_t=${ac_cv_sizeof_int_fast16_t='0'}
-ac_cv_sizeof_int_fast32_t=${ac_cv_sizeof_int_fast32_t='0'}
-ac_cv_sizeof_int_fast64_t=${ac_cv_sizeof_int_fast64_t='0'}
-ac_cv_sizeof_uint_fast8_t=${ac_cv_sizeof_uint_fast8_t='0'}
-ac_cv_sizeof_uint_fast16_t=${ac_cv_sizeof_uint_fast16_t='0'}
-ac_cv_sizeof_uint_fast32_t=${ac_cv_sizeof_uint_fast32_t='0'}
-ac_cv_sizeof_uint_fast64_t=${ac_cv_sizeof_uint_fast64_t='0'}
-
-hdf5_cv_system_scope_threads=${hdf5_cv_system_scope_threads="no"}
-
-# Hard set MPI_File_set_size() working for files over 2GB to no
-hdf5_cv_mpi_file_set_size_big=${hdf5_cv_mpi_file_set_size_big='no'}
-
-# Hard set variables for v1.7 and higher.
-# Set gettimeofday_tz to yes.
-hdf5_cv_gettimeofday_tz=${hdf5_cv_gettimeofday_tz='yes'}
-hdf5_cv_convert_denormal_float=${hdf5_cv_convert_denormal_float='no'}
-hdf5_cv_fp_to_ullong_bottom_bit_works=${hdf5_cv_fp_to_ullong_bottom_bit_works='no'}
-hdf5_cv_fp_to_ullong_right_maximum=${hdf5_cv_fp_to_ullong_right_maximum='yes'}
-hdf5_cv_ldouble_to_uint_works=${hdf5_cv_ldouble_to_uint_works='yes'}
-hdf5_cv_sw_ldouble_to_integer_works=${hdf5_cv_sw_ldouble_to_integer_works='yes'}
-hdf5_cv_sw_ulong_to_fp_bottom_bit_works=${hdf5_cv_sw_ulong_to_fp_bottom_bit_works='no'}
-hdf5_cv_ullong_to_fp_cast_works=${hdf5_cv_ullong_to_fp_cast_works='yes'}
-hdf5_cv_ullong_to_ldouble_precision_works=${hdf5_cv_ullong_to_ldouble_precision_works='yes'}
-hdf5_cv_fp_to_integer_overflow_works=${hdf5_cv_fp_to_integer_overflow_works='yes'}
diff --git a/config/irix5.x b/config/irix5.x
deleted file mode 100644
index bd8a3be..0000000
--- a/config/irix5.x
+++ /dev/null
@@ -1,94 +0,0 @@
-# -*- 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.
-
-
-# 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.
-#
-# See BlankForm in this directory for details
-
-# Disable dependency tracking on IRIX unless the user specifically asks for
-# it.
-# IRIX's pmake confuses automake (as of version 1.9) if dependency tracking
-# is enabled and it is not an in-place build. Simply disabling dependency
-# tracking on IRIX is simpler to implement than detecting pmake, detecting
-# when a build is not in-place, and then disabling dependency tracking.
-if test -z "${enable_dependency_tracking}"; then
- enable_dependency_tracking="no"
-fi
-
-# The default compiler is `cc' and there is no ranlib.
-if test "X-" = "X-$CC"; then
- CC=cc
- CC_BASENAME=cc
-fi
-RANLIB=:
-
-case "X-$CC_BASENAME" in
- X-gcc)
- H5_CFLAGS="$H5_CFLAGS -Wsign-compare" #Only works for some versions
- DEBUG_CFLAGS="-g -fverbose-asm"
- DEBUG_CPPFLAGS=
- PROD_CFLAGS="-O3"
- PROD_CPPFLAGS=
- PROFILE_CFLAGS="-pg"
- PROFILE_CPPFLAGS=
- ;;
-
- *)
- # Do *not* use -ansi because it prevents hdf5 from being able
- # to read modification dates from the file. On some systems it
- # can also result in compile errors in system header files
- # since hdf5 includes a couple non-ANSI header files.
- #CFLAGS="$CFLAGS -ansi"
-
- # Always turn off these compiler warnings:
- H5_CFLAGS="$H5_CFLAGS -woff 799"
-
- # Extra debugging flags
- DEBUG_CFLAGS=-g
- DEBUG_CPPFLAGS=
-
- # Extra production flags
- # Note: higher optimizations relax alignment requirements needed.
- PROD_CFLAGS="-O -s"
- PROD_CPPFLAGS=
-
- # Extra profiling flags
- PROFILE_CFLAGS=-pg
- PROFILE_CPPFLAGS=
- ;;
-esac
-
-# Hard set flag to indicate that the 'unsigned long long' to floating-point
-# value conversion are broken by the compilers (as of 4/27/04 - QAK)
-hdf5_cv_ulong_to_fp_bottom_bit_accurate=${hdf5_cv_ulong_to_fp_bottom_bit_accurate='no'}
-
-# Set flags to avoid conversion between 'long double' and integers because of
-# SGI's compiler problems. For both IRIX64 6.5 and IRIX 6.5, the compilers
-# have the following problems,
-# long double -> signed char : incorrect rounding
-# long double -> unsigned char : incorrect rounding
-# long double -> short : incorrect rounding
-# long double -> unsigned short : incorrect rounding
-# long double -> long or long long: incorrect value
-# long double -> unsigned long or long long : incorrect value
-#
-# long or long long -> long double : correct value but incorrect bit pattern
-# unsigned long or long long -> long double : correct value but incorrect bit pattern
-# (1/5/05 - SLU)
-hdf5_cv_ldouble_to_integer_accurate=${hdf5_cv_ldouble_to_integer_accurate='no'}
-hdf5_cv_integer_to_ldouble_accurate=${hdf5_cv_integer_to_ldouble_accurate='no'}
diff --git a/config/irix6.x b/config/irix6.x
index 05b308c..9bd9c4c 100644
--- a/config/irix6.x
+++ b/config/irix6.x
@@ -73,14 +73,14 @@ case "X-$CC_BASENAME" in
# 1429: the `long long' type is not standard
# 1685: turn off warnings about turning off invalid warnings
# 3201: remark - parameter not referenced
- #CFLAGS="$CFLAGS -woff 1174,1429,1209,1196,1685,3201"
+ #H5_CFLAGS="$H5_CFLAGS -woff 1174,1429,1209,1196,1685,3201"
H5_CFLAGS="$H5_CFLAGS -woff 1209,3201"
# Always turn off these compiler warnings for the old compiler:
# 799: the `long long' type is not standard
# 803: turn off warnings about turning off invalid warnings
# 835: __vfork() (this is an SGI config problem)
- #CFLAGS="$CFLAGS -woff 799,803,835"
+ #H5_CFLAGS="$H5_CFLAGS -woff 799,803,835"
# Always turn off these loader warnings:
# (notice the peculiar syntax)
@@ -133,7 +133,7 @@ fi
if test -z "$cxx_flags_set"; then
# -LANG:std required for std use; -ptused causes templates used to be
# instantiated
- CPPFLAGS="$CPPFLAGS -LANG:std"
+ AM_CPPFLAGS="$AM_CPPFLAGS -LANG:std"
H5_CPPFLAGS="$H5_CPPFLAGS -ptused"
# libCio is a default library, since libtool before 1.5 doesn't fully
@@ -176,18 +176,18 @@ hdf5_cv_integer_to_ldouble_accurate=${hdf5_cv_integer_to_ldouble_accurate='no'}
# Versions 7.4.2m or newer work.
# Up to version 7.4.4m, it cannot handle collective IO with non-contribution
# of some processes.
-# Fix $hdf5_mpi_complex_derived_datatype_works if it is not set and is using cc.
-if [ -z "$hdf5_mpi_complex_derived_datatype_works" -a $CC_BASENAME = cc ]; then
+# Fix $hdf5_cv_mpi_complex_derived_datatype_works if it is not set and is using cc.
+if [ -z "$hdf5_cv_mpi_complex_derived_datatype_works" -a $CC_BASENAME = cc ]; then
ccversion=`$CC -version 2>&1 | sed -e 's/.*Version //p'`
ccversion1=`echo $ccversion | cut -f1 -d.`
ccversion2=`echo $ccversion | cut -f2 -d.`
# Assume all versions 7.4.* or newer are okay
# and assume ccversion2 is never larger than 99.
ccversionval=`expr $ccversion1 \* 100 + $ccversion2`
- hdf5_mpi_special_collective_io_works='no'
+ hdf5_cv_mpi_special_collective_io_works='no'
if [ $ccversionval -lt 704 ]; then
- hdf5_mpi_complex_derived_datatype_works='no'
-# hdf5_mpi_special_collective_io_works='no'
+ hdf5_cv_mpi_complex_derived_datatype_works='no'
+# hdf5_cv_mpi_special_collective_io_works='no'
fi
fi
diff --git a/config/linux-gnulibc1 b/config/linux-gnulibc1
index 8c64734..667f04e 100644
--- a/config/linux-gnulibc1
+++ b/config/linux-gnulibc1
@@ -122,12 +122,12 @@ fi
# 1. collective I/O when some processes don't have any contributions;
# 2. complex derived MPI data type.
if test $CC_BASENAME = cmpicc; then
- hdf5_mpi_special_collective_io_works=${hdf5_mpi_special_collective_io_works='no'}
- hdf5_mpi_complex_derived_datatype_works=${hdf5_mpi_complex_derived_datatype_works='no'}
+ hdf5_cv_mpi_special_collective_io_works=${hdf5_cv_mpi_special_collective_io_works='no'}
+ hdf5_cv_mpi_complex_derived_datatype_works=${hdf5_cv_mpi_complex_derived_datatype_works='no'}
fi
#Comment out the following line if your system supports collective IO when some processes
#don't have any contributions to IOs.
-hdf5_mpi_special_collective_io_works=${hdf5_mpi_special_collective_io_works='no'}
-hdf5_mpi_complex_derived_datatype_works=${hdf5_mpi_complex_derived_datatype_works='no'}
+hdf5_cv_mpi_special_collective_io_works=${hdf5_cv_mpi_special_collective_io_works='no'}
+hdf5_cv_mpi_complex_derived_datatype_works=${hdf5_cv_mpi_complex_derived_datatype_works='no'}
diff --git a/config/lt_vers.am b/config/lt_vers.am
index 79406bb..f784c48 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 = 37
+LT_VERS_REVISION = 41
LT_VERS_AGE = 0
## If the API changes *at all*, increment LT_VERS_INTERFACE and
diff --git a/config/mpich b/config/mpich
index 1ba62ff..575859e 100644
--- a/config/mpich
+++ b/config/mpich
@@ -21,14 +21,14 @@
# We know that mpich 1.2.4 and 1.2.5 do not support it correctly. We assume
# older versions do not work either. We don't know of a way of testing its
# correctness without the risk of hanging the configure process. So, we
-# set the configure variable hdf5_mpi_complex_derived_datatype_works to no.
+# set the configure variable hdf5_cv_mpi_complex_derived_datatype_works to no.
# Notice that this code works only if the mpicc compiler shows its $MPIVERSION
# properly. It is confirmed mpicc does that as far back as v1.2.3.
# mpich2 do not support it correctly. But mpich2 reports small version number
# indistiguishable from mpich. Some mpich2 reports blank, some reports 1.0.2.
-if [ -z "$hdf5_mpi_complex_derived_datatype_works" ]; then
+if [ -z "$hdf5_cv_mpi_complex_derived_datatype_works" ]; then
ccversion=`$CC -v 2>/dev/null`
# mpich compiler will give "mpicc for 1.2.x ..."
if echo "$ccversion" | grep '^mpicc for' > /dev/null ; then
@@ -36,16 +36,16 @@ if [ -z "$hdf5_mpi_complex_derived_datatype_works" ]; then
ccversion=`echo $ccversion | cut -f3 -d' '`
case "$ccversion" in
1.2.[0-5]*)
- hdf5_mpi_complex_derived_datatype_works='no'
+ hdf5_cv_mpi_complex_derived_datatype_works='no'
;;
1.0.2)
# mpich2 is recycling the version number, some report
# 1.0.2, some report blank.
- hdf5_mpi_complex_derived_datatype_works='no'
+ hdf5_cv_mpi_complex_derived_datatype_works='no'
;;
"")
# got blank ccversion. Assume it is bad a mpich2.
- hdf5_mpi_complex_derived_datatype_works='no'
+ hdf5_cv_mpi_complex_derived_datatype_works='no'
;;
*)
# assume okay
@@ -54,7 +54,7 @@ if [ -z "$hdf5_mpi_complex_derived_datatype_works" ]; then
fi
fi
-if [ -z "$hdf5_mpi_special_collective_io_works" ]; then
+if [ -z "$hdf5_cv_mpi_special_collective_io_works" ]; then
ccversion=`$CC -v 2>/dev/null`
# mpich compiler will give "mpicc for 1.2.x ..."
if echo "$ccversion" | grep '^mpicc for' > /dev/null ; then
@@ -62,16 +62,16 @@ if [ -z "$hdf5_mpi_special_collective_io_works" ]; then
ccversion=`echo $ccversion | cut -f3 -d' '`
case "$ccversion" in
1.2.[0-6]*)
- hdf5_mpi_special_collective_io_works='no'
+ hdf5_cv_mpi_special_collective_io_works='no'
;;
1.0.2)
# mpich2 is recycling the version number, some report
# 1.0.2, some report blank.
- hdf5_mpi_special_collective_io_works='no'
+ hdf5_cv_mpi_special_collective_io_works='no'
;;
"")
# got blank ccversion. Assume it is bad a mpich2.
- hdf5_mpi_special_collective_io_works='no'
+ hdf5_cv_mpi_special_collective_io_works='no'
;;
*)
# assume okay
diff --git a/config/nec-superux14.1 b/config/nec-superux14.1
index 7e2c09f..dc1a15d 100644
--- a/config/nec-superux14.1
+++ b/config/nec-superux14.1
@@ -85,8 +85,8 @@ fi
# PROFILE_CPPFLAGS library suitable for performance testing (like
# `-pg'). This may or may not include debugging
# or production flags.
-#
-# CFLAGS Flags can be added to this variable which
+#
+# H5_CFLAGS Flags can be added to this variable which
# might already be partially initialized. These
# flags will always be passed to the compiler
# and should include switches to turn on full
@@ -95,16 +95,14 @@ fi
# practices resulting in few if any
# warnings.
#
-# Warning flags do not have to be added to CFLAGS
+# Warning flags do not have to be added to H5_CFLAGS
# variable if the compiler is the GNU gcc
# compiler or a descendent of gcc such as EGCS or PGCC.
#
-# The CFLAGS should contains *something* or else
-# configure will probably add `-g'. For most
-# systems this isn't a problem but some systems
-# will disable optimizations in favor of the
-# `-g'.
-#
+# AM_CFLAGS Flags added directly into this variable will
+# be propogated to the compiler wrapper scripts (h5cc,
+# h5c++, et cetera) in addition to being used to compile
+# the library.
#
# These flags should be set according to the compiler being used.
# There are two ways to check the compiler. You can try using `-v' or
@@ -115,7 +113,7 @@ fi
case $CC_BASENAME in
cc)
- CFLAGS="$CFLAGS"
+ H5_CFLAGS="$H5_CFLAGS"
DEBUG_CFLAGS="-Cdebug -g -wall"
DEBUG_CPPFLAGS=
PROD_CFLAGS="-Cnoopt"
@@ -125,7 +123,7 @@ case $CC_BASENAME in
;;
*)
- CFLAGS="$CFLAGS"
+ H5_CFLAGS="$H5_CFLAGS"
DEBUG_CFLAGS="-g"
DEBUG_CPPFLAGS=
PROD_CFLAGS=""
@@ -137,21 +135,21 @@ esac
case $CXX_BASENAME in
c++)
- CXXFLAGS="$CXXFLAGS -Tlocal"
+ H5_CXXFLAGS="$H5_CXXFLAGS -Tlocal"
;;
*)
- CXXFLAGS="$CXXFLAGS"
+ H5_CXXFLAGS="$H5_CXXFLAGS"
;;
esac
case $FC_BASENAME in
f90)
- FCFLAGS="$F9XFLAGS"
+ H5_FCFLAGS="$F9XFLAGS"
;;
*)
- FCFLAGS="$F9XFLAGS"
+ H5_FCFLAGS="$F9XFLAGS"
;;
esac
@@ -174,8 +172,8 @@ hdf5_cv_ldouble_to_uint_work=no
hdf5_cv_ullong_to_fp_cast_works=yes
hdf5_cv_ullong_to_ldouble_precision_works=no
hdf5_cv_fp_to_integer_overflow_works=yes
-hdf5_fp_to_ullong_accurate=no
-hdf5_fp_to_ullong_right_maximum=no
+hdf5_cv_fp_to_ullong_accurate=no
+hdf5_cv_fp_to_ullong_right_maximum=no
CONFIGURE_LIBS=/usr/lib/libi90sxe.a
diff --git a/config/pgi-flags b/config/pgi-flags
index 2611a87..2b03f3d 100644
--- a/config/pgi-flags
+++ b/config/pgi-flags
@@ -68,7 +68,7 @@ if test "X-pgcc" = "X-$cc_vendor"; then
#esac
# General
- CFLAGS="$CFLAGS $arch -Minform,warn"
+ H5_CFLAGS="$H5_CFLAGS $arch -Minform,warn"
# Production
# Check for MPI wrapper being used and tweak down compiler options
diff --git a/config/powerpc-ibm-aix4.x b/config/powerpc-ibm-aix4.x
deleted file mode 100644
index b94f3b5..0000000
--- a/config/powerpc-ibm-aix4.x
+++ /dev/null
@@ -1,120 +0,0 @@
-# -*- 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.
-
-
-# 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.
-
-
-#----------------------------------------------------------------------------
-# 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.
-
-# What must *always* be present for things to compile correctly?
-#CFLAGS="$CFLAGS -ansi"
-#CPPFLAGS="$CPPFLAGS -I."
-
-# CFLAGS must be set else configure set it to -g
-CFLAGS="$CFLAGS"
-
-# What compiler flags should be used for code development?
-DEBUG_CFLAGS=
-DEBUG_CPPFLAGS=
-
-# What compiler flags should be used for building a production
-# library?
-PROD_CFLAGS=
-PROD_CPPFLAGS=
-
-# What compiler flags enable code profiling?
-PROFILE_CFLAGS=
-PROFILE_CPPFLAGS=
-
-
-#----------------------------------------------------------------------------
-# 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}
-RUNPARALLEL=${RUNPARALLEL="MP_PROCS=3 MP_TASKS_PER_NODE=3 poe"}
-
-# 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=${ac_cv_sizeof_long=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}
-ac_cv_sizeof_int_fast8_t=${ac_cv_sizeof_int_fast8_t=1}
-ac_cv_sizeof_uint_fast8_t=${ac_cv_sizeof_uint_fast8_t=4}
-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}
-ac_cv_sizeof_int_fast16_t=${ac_cv_sizeof_int_fast16_t=4}
-ac_cv_sizeof_uint_fast16_t=${ac_cv_sizeof_uint_fast16_t=4}
-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 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
- FC=xlf
-fi
-
-if test "X-" = "X-$f9x_flags_set"; then
- F9XSUFFIXFLAG="-qsuffix=f=f90"
- FCFLAGS="$FCFLAGS -static -O ${F9XSUFFIXFLAG} -qmoddir=./ -k"
- FSEARCH_DIRS="-I./ -I../src"
- DEBUG_FCFLAGS="-O"
- PROD_FCFLAGS="-O"
- PROFILE_FCFLAGS="-O"
- f9x_flags_set=yes
-fi
-
-# The default C++ compiler
-
-# Use AIX supplied C++ compiler by default.
-CXX=${CXX=xlC}
-hdf5_mpi_complex_derived_datatype_works=${hdf5_mpi_complex_derived_datatype_works='no'}
diff --git a/config/powerpc-ibm-aix5.x b/config/powerpc-ibm-aix5.x
index 80925f0..ac70bac 100644
--- a/config/powerpc-ibm-aix5.x
+++ b/config/powerpc-ibm-aix5.x
@@ -48,7 +48,8 @@ case $CC_BASENAME in
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++.
- CFLAGS="-qlanglvl=stdc99 -D_LARGE_FILES $CFLAGS"
+ 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.
@@ -63,7 +64,7 @@ case $CC_BASENAME in
;;
*)
- CFLAGS="$CFLAGS -ansi"
+ H5_CFLAGS="$H5_CFLAGS -ansi"
DEBUG_CFLAGS="-g"
DEBUG_CPPFLAGS=
PROD_CFLAGS="-O"
@@ -128,15 +129,21 @@ ac_cv_sizeof_uint_fast64_t=${ac_cv_sizeof_uint_fast64_t=8}
if test "X-" = "X-$FC"; then
if test "X-$enable_parallel" = "X-yes"; then
- FC=mpxlf_r
+ FC=mpxlf90_r
else
- FC=xlf
+ 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 -static -O ${F9XSUFFIXFLAG} -qmoddir=./ -k"
+ FCFLAGS="$FCFLAGS -O ${F9XSUFFIXFLAG}"
+ H5_FCFLAGS="$H5_FCFLAGS -O ${F9XSUFFIXFLAG}"
FSEARCH_DIRS="-I./ -I../src"
DEBUG_FCFLAGS="-O"
PROD_FCFLAGS="-O"
@@ -147,7 +154,7 @@ 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_mpi_complex_derived_datatype_works=${hdf5_mpi_complex_derived_datatype_works='no'}
+#hdf5_cv_mpi_complex_derived_datatype_works=${hdf5_cv_mpi_complex_derived_datatype_works='no'}
# The default C++ compiler
@@ -157,6 +164,7 @@ 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.
-CXXFLAGS="$CXXFLAGS -qweaksymbol -D_LARGE_FILES"
+H5_CXXFLAGS="$H5_CXXFLAGS -qweaksymbol"
+AM_CXXFLAGS="$AM_CXXFLAGS -D_LARGE_FILES"
diff --git a/config/rs6000-ibm-aix4.x b/config/rs6000-ibm-aix4.x
deleted file mode 100644
index 14885d1..0000000
--- a/config/rs6000-ibm-aix4.x
+++ /dev/null
@@ -1,43 +0,0 @@
-# -*- 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.
-
-
-# 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.
-#
-# See BlankForm in this directory for details.
-
-# Cross compiling defaults
-ac_cv_c_bigendian=${ac_cv_c_bigendian='yes'}
-hdf5_cv_printf_ll=${hdf5_cv_printf_ll='ll'}
-
-# The default Fortran 90 compiler
-
-if test "X-" = "X-$FC"; then
- FC=xlf
-fi
-
-if test "X-" = "X-$f9x_flags_set"; then
- F9XSUFFIXFLAG="-qsuffix=f=f90"
- FCFLAGS="$FCFLAGS -static -O ${F9XSUFFIXFLAG} -qmoddir=./ -k"
- FSEARCH_DIRS="-I./ -I../src"
- DEBUG_FCFLAGS="-O"
- PROD_FCFLAGS="-O"
- PROFILE_FCFLAGS="-O"
- f9x_flags_set=yes
-fi
-# IBM MPI-IO doesn't handle complicated derived data type correctly.
-hdf5_mpi_complex_derived_datatype_works=${hdf5_mpi_complex_derived_datatype_works='no'}
diff --git a/config/solaris2.x b/config/solaris2.x
index c81fd61..5ef6415 100644
--- a/config/solaris2.x
+++ b/config/solaris2.x
@@ -45,7 +45,7 @@ if test "X-" = "X-$cc_flags_set"; then
5.9*)
# Need the xopenmp flag to build the Fortran library
if test X-$enable_fortran = X-yes; then
- LDFLAGS="$LDFLAGS -xopenmp=stubs"
+ AM_LDFLAGS="$AM_LDFLAGS -xopenmp=stubs"
fi
;;
esac
@@ -56,8 +56,7 @@ if test "X-" = "X-$cc_flags_set"; then
&& PROD_CFLAGS="`echo $PROD_CFLAGS | sed -e 's/-O//'`"
fi
-# Add socket lib for the Stream Virtual File Driver
-LIBS="$LIBS -lsocket"
+LIBS="$LIBS"
# The default Fortran 90 compiler
@@ -68,9 +67,9 @@ fi
if test "X-" = "X-$f9x_flags_set"; then
F9XSUFFIXFLAG=""
FSEARCH_DIRS=""
- FCFLAGS="$FCFLAGS"
- DEBUG_FCFLAGS=""
- PROD_FCFLAGS=""
+ H5_FCFLAGS="$H5_FCFLAGS"
+ DEBUG_FCFLAGS="-g"
+ PROD_FCFLAGS="-O2"
PROFILE_FCFLAGS=""
f9x_flags_set=yes
fi
diff --git a/config/sv1-cray b/config/sv1-cray
index 4e3153f..1bae48d 100644
--- a/config/sv1-cray
+++ b/config/sv1-cray
@@ -73,8 +73,8 @@ RANLIB=:
# PROFILE_CPPFLAGS library suitable for performance testing (like
# `-pg'). This may or may not include debugging
# or production flags.
-#
-# CFLAGS Flags can be added to this variable which
+#
+# H5_CFLAGS Flags can be added to this variable which
# might already be partially initialized. These
# flags will always be passed to the compiler
# and should include switches to turn on full
@@ -83,16 +83,14 @@ RANLIB=:
# practices resulting in few if any
# warnings.
#
-# Warning flags do not have to be added to CFLAGS
+# Warning flags do not have to be added to H5_CFLAGS
# variable if the compiler is the GNU gcc
# compiler or a descendent of gcc such as EGCS or PGCC.
#
-# The CFLAGS should contains *something* or else
-# configure will probably add `-g'. For most
-# systems this isn't a problem but some systems
-# will disable optimizations in favor of the
-# `-g'.
-#
+# AM_CFLAGS Flags added directly into this variable will
+# be propogated to the compiler wrapper scripts (h5cc,
+# h5c++, et cetera) in addition to being used to compile
+# the library.
#
# These flags should be set according to the compiler being used.
# There are two ways to check the compiler. You can try using `-v' or
@@ -103,7 +101,7 @@ RANLIB=:
case $CC_BASENAME in
gcc)
- CFLAGS="$CFLAGS -Wsign-compare" #Only works for some versions
+ H5_CFLAGS="$H5_CFLAGS -Wsign-compare" #Only works for some versions
DEBUG_CFLAGS="-g -fverbose-asm"
DEBUG_CPPFLAGS=
PROD_CFLAGS="-O3 -fomit-frame-pointer"
@@ -113,7 +111,7 @@ case $CC_BASENAME in
;;
cc)
- CFLAGS="$CFLAGS"
+ H5_CFLAGS="$H5_CFLAGS"
DEBUG_CFLAGS="-g -h zero"
DEBUG_CPPFLAGS=
PROD_CFLAGS="-O2 -h scalar0 -h vector0 -h task1"
@@ -123,7 +121,7 @@ case $CC_BASENAME in
;;
*)
- CFLAGS="$CFLAGS -ansi"
+ H5_CFLAGS="$H5_CFLAGS -ansi"
DEBUG_CFLAGS="-g"
DEBUG_CPPFLAGS=
PROD_CFLAGS="-O"
@@ -163,7 +161,7 @@ fi
if test "X-" = "X-$f9x_flags_set"; then
F9XSUFFIXFLAG=""
FSEARCH_DIRS=""
- FCFLAGS="$FCFLAGS -dp"
+ H5_FCFLAGS="$H5_FCFLAGS -dp"
DEBUG_FCFLAGS="-dp"
PROD_FCFLAGS="-dp"
PROFILE_FCFLAGS="-dp"
@@ -180,7 +178,7 @@ fi
case $CXX_BASENAME in
g++)
- CXXFLAGS="$CXXFLAGS -Wsign-compare" #Only works for some versions
+ H5_CXXFLAGS="$H5_CXXFLAGS -Wsign-compare" #Only works for some versions
DEBUG_CXXFLAGS="-g -fverbose-asm"
DEBUG_CPPFLAGS=
PROD_CXXFLAGS="-O3 -fomit-frame-pointer"
@@ -190,7 +188,7 @@ case $CXX_BASENAME in
;;
*)
- CXXFLAGS="$CXXFLAGS -h instantiate=used"
+ H5_CXXFLAGS="$H5_CXXFLAGS -h instantiate=used"
DEBUG_CXXFLAGS="-g"
DEBUG_CPPFLAGS=
PROD_CXXFLAGS="-O"
diff --git a/config/unicos b/config/unicos
deleted file mode 100644
index 4c99bcd..0000000
--- a/config/unicos
+++ /dev/null
@@ -1,165 +0,0 @@
-# -*- 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.
-
-
-# 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.
-
-
-#----------------------------------------------------------------------------
-# 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.
-#----------------------------------------------------------------------------
-
-
-# Choosing a C Compiler
-# ---------------------
-#
-# The user should be able to specify the compiler by setting the CC
-# environment variable to the name of the compiler and any switches it
-# requires for proper operation. If CC is unset then this script may
-# set it. If CC is unset by time this script completes then configure
-# will try `gcc' and `cc' in that order (perhaps some others too).
-#
-# Note: Code later in this file may depend on the value of $CC_BASENAME
-# in order to distinguish between different compilers when
-# deciding which compiler command-line switches to use. This
-# variable is set based on the incoming value of $CC and is only
-# used within this file.
-
-if test "X-" = "X-$CC"; then
- CC=cc
- CC_BASENAME=cc
-fi
-# no need to use RANLIB
-RANLIB=:
-
-# C Compiler and Preprocessor Flags
-# ---------------------------------
-#
-# Flags that end with `_CFLAGS' are always passed to the compiler.
-# Flags that end with `_CPPFLAGS' are passed to the compiler when
-# compiling but not when linking.
-#
-# DEBUG_CFLAGS Flags to pass to the compiler to create a
-# DEBUG_CPPFLAGS library suitable for use with debugging
-# tools. Usually this list will exclude
-# optimization switches (like `-O') and include
-# switches that turn on symbolic debugging
-# support (like `-g').
-#
-# PROD_CFLAGS Flags to pass to the compiler to create a
-# PROD_CPPFLAGS production version of the library. These
-# usualy exclude symbolic debugging switches
-# (like `-g') and include optimization switches
-# (like `-O').
-#
-# PROFILE_CFLAGS Flags to pass to the compiler to create a
-# PROFILE_CPPFLAGS library suitable for performance testing (like
-# `-pg'). This may or may not include debugging
-# or production flags.
-#
-# CFLAGS Flags can be added to this variable which
-# might already be partially initialized. These
-# flags will always be passed to the compiler
-# and should include switches to turn on full
-# warnings. HDF5 attempts to be ANSI and Posix
-# compliant and employ good programming
-# practices resulting in few if any
-# warnings.
-#
-# Warning flags do not have to be added to CFLAGS
-# variable if the compiler is the GNU gcc
-# compiler or a descendent of gcc such as EGCS or PGCC.
-#
-# The CFLAGS should contains *something* or else
-# configure will probably add `-g'. For most
-# systems this isn't a problem but some systems
-# will disable optimizations in favor of the
-# `-g'.
-#
-#
-# These flags should be set according to the compiler being used.
-# There are two ways to check the compiler. You can try using `-v' or
-# `--version' to see if the compiler will print a version string. You
-# can use the value of $CC_BASENAME which is the base name of the
-# first word in $CC (note that the value of CC may have changed
-# above).
-
-case $CC_BASENAME in
- gcc)
- CFLAGS="$CFLAGS -Wsign-compare" #Only works for some versions
- DEBUG_CFLAGS="-g -fverbose-asm"
- DEBUG_CPPFLAGS=
- PROD_CFLAGS="-O3 -fomit-frame-pointer"
- PROD_CPPFLAGS=
- PROFILE_CFLAGS="-pg"
- PROFILE_CPPFLAGS=
- ;;
-
- cc)
- CFLAGS="$CFLAGS"
- DEBUG_CFLAGS="-g -h zero -h scalar0"
- DEBUG_CPPFLAGS=
- PROD_CFLAGS="-O2 -h scalar0"
- PROD_CPPFLAGS=
- PROFILE_CFLAGS="-pg"
- PROFILE_CPPFLAGS=
- ;;
-
- *)
- CFLAGS="$CFLAGS -ansi"
- DEBUG_CFLAGS="-g"
- DEBUG_CPPFLAGS=
- PROD_CFLAGS="-O"
- PROD_CPPFLAGS=
- PROFILE_CFLAGS="-pg"
- PROFILE_CPPFLAGS=
- ;;
-esac
-
-# Overriding Configure Tests
-# --------------------------
-#
-# 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.
-ac_cv_c_bigendian=${ac_cv_c_bigendian='yes'}
-
-# Set this to the width required by printf() to print type `long
-# long'. For instance, if the format would be `%lld' then set it to
-# `ll' or if the format would be `%qd' set it to `q'.
-#hdf5_cv_printf_ll=${hdf5_cv_printf_ll='ll'}
-
-# The default Fortran 90 compiler
-
-if test "X-" = "X-$FC"; then
- FC=f90
-fi
-
-if test "X-" = "X-$f9x_flags_set"; then
- F9XSUFFIXFLAG=""
- FSEARCH_DIRS=""
- FCFLAGS="$FCFLAGS -dp"
- DEBUG_FCFLAGS="-dp"
- PROD_FCFLAGS="-dp"
- PROFILE_FCFLAGS="-dp"
- f9x_flags_set=yes
-fi
diff --git a/config/unicos10.0.X b/config/unicos10.0.X
deleted file mode 100644
index 09f5871..0000000
--- a/config/unicos10.0.X
+++ /dev/null
@@ -1,201 +0,0 @@
-# -*- 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.
-
-
-# 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.
-
-
-#----------------------------------------------------------------------------
-# 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.
-#----------------------------------------------------------------------------
-
-
-# Choosing a C Compiler
-# ---------------------
-#
-# The user should be able to specify the compiler by setting the CC
-# environment variable to the name of the compiler and any switches it
-# requires for proper operation. If CC is unset then this script may
-# set it. If CC is unset by time this script completes then configure
-# will try `gcc' and `cc' in that order (perhaps some others too).
-#
-# Note: Code later in this file may depend on the value of $CC_BASENAME
-# in order to distinguish between different compilers when
-# deciding which compiler command-line switches to use. This
-# variable is set based on the incoming value of $CC and is only
-# used within this file.
-
-if test "X-" = "X-$CC"; then
- CC=cc
- CC_BASENAME=cc
-fi
-# no need to use RANLIB
-RANLIB=:
-
-
-# C Compiler and Preprocessor Flags
-# ---------------------------------
-#
-# Flags that end with `_CFLAGS' are always passed to the compiler.
-# Flags that end with `_CPPFLAGS' are passed to the compiler when
-# compiling but not when linking.
-#
-# DEBUG_CFLAGS Flags to pass to the compiler to create a
-# DEBUG_CPPFLAGS library suitable for use with debugging
-# tools. Usually this list will exclude
-# optimization switches (like `-O') and include
-# switches that turn on symbolic debugging
-# support (like `-g').
-#
-# PROD_CFLAGS Flags to pass to the compiler to create a
-# PROD_CPPFLAGS production version of the library. These
-# usualy exclude symbolic debugging switches
-# (like `-g') and include optimization switches
-# (like `-O').
-#
-# PROFILE_CFLAGS Flags to pass to the compiler to create a
-# PROFILE_CPPFLAGS library suitable for performance testing (like
-# `-pg'). This may or may not include debugging
-# or production flags.
-#
-# CFLAGS Flags can be added to this variable which
-# might already be partially initialized. These
-# flags will always be passed to the compiler
-# and should include switches to turn on full
-# warnings. HDF5 attempts to be ANSI and Posix
-# compliant and employ good programming
-# practices resulting in few if any
-# warnings.
-#
-# Warning flags do not have to be added to CFLAGS
-# variable if the compiler is the GNU gcc
-# compiler or a descendent of gcc such as EGCS or PGCC.
-#
-# The CFLAGS should contains *something* or else
-# configure will probably add `-g'. For most
-# systems this isn't a problem but some systems
-# will disable optimizations in favor of the
-# `-g'.
-#
-#
-# These flags should be set according to the compiler being used.
-# There are two ways to check the compiler. You can try using `-v' or
-# `--version' to see if the compiler will print a version string. You
-# can use the value of $CC_BASENAME which is the base name of the
-# first word in $CC (note that the value of CC may have changed
-# above).
-
-case $CC_BASENAME in
- gcc)
- CFLAGS="$CFLAGS -Wsign-compare" #Only works for some versions
- DEBUG_CFLAGS="-g -fverbose-asm"
- DEBUG_CPPFLAGS=
- PROD_CFLAGS="-O3 -fomit-frame-pointer"
- PROD_CPPFLAGS=
- PROFILE_CFLAGS="-pg"
- PROFILE_CPPFLAGS=
- ;;
-
- cc)
- CFLAGS="$CFLAGS"
- DEBUG_CFLAGS="-g -h zero -h scalar0"
- DEBUG_CPPFLAGS=
- PROD_CFLAGS="-O2 -h scalar0"
- PROD_CPPFLAGS=
- PROFILE_CFLAGS="-pg"
- PROFILE_CPPFLAGS=
- ;;
-
- *)
- CFLAGS="$CFLAGS -ansi"
- DEBUG_CFLAGS="-g"
- DEBUG_CPPFLAGS=
- PROD_CFLAGS="-O"
- PROD_CPPFLAGS=
- PROFILE_CFLAGS="-pg"
- PROFILE_CPPFLAGS=
- ;;
-esac
-
-
-
-# Overriding Configure Tests
-# --------------------------
-#
-# 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.
-ac_cv_c_bigendian=${ac_cv_c_bigendian='yes'}
-
-# Set this to the width required by printf() to print type `long
-# long'. For instance, if the format would be `%lld' then set it to
-# `ll' or if the format would be `%qd' set it to `q'.
-#hdf5_cv_printf_ll=${hdf5_cv_printf_ll='ll'}
-
-# Hard set the flag to indicate that converting denormalized floating-point
-# values doesn't work.
-hdf5_cv_convert_denormal_float=${hdf5_cv_convert_denormal_float='no'}
-
-# The default Fortran 90 compiler
-
-if test "X-" = "X-$FC"; then
- FC=f90
-fi
-
-if test "X-" = "X-$f9x_flags_set"; then
- F9XSUFFIXFLAG=""
- FSEARCH_DIRS=""
- FCFLAGS="$FCFLAGS -dp"
- DEBUG_FCFLAGS="-dp"
- PROD_FCFLAGS="-dp"
- PROFILE_FCFLAGS="-dp"
- f9x_flags_set=yes
-fi
-
-# The default C++ compiler
-
-if test -z "$CXX"; then
- CXX="CC"
- CXX_BASENAME=CC
-fi
-
-case $CXX_BASENAME in
- g++)
- CXXFLAGS="$CXXFLAGS -Wsign-compare" #Only works for some versions
- DEBUG_CXXFLAGS="-g -fverbose-asm"
- DEBUG_CPPFLAGS=
- PROD_CXXFLAGS="-O3 -fomit-frame-pointer"
- PROD_CPPFLAGS=
- PROFILE_CXXFLAGS="-pg"
- PROFILE_CPPFLAGS=
- ;;
-
- *)
- CXXFLAGS="$CXXFLAGS -h instantiate=used"
- DEBUG_CXXFLAGS="-g"
- DEBUG_CPPFLAGS=
- PROD_CXXFLAGS="-O"
- PROD_CPPFLAGS=
- PROFILE_CXXFLAGS="-pg"
- PROFILE_CPPFLAGS=
- ;;
-esac
diff --git a/config/unicosmk b/config/unicosmk
deleted file mode 100644
index 7c279a7..0000000
--- a/config/unicosmk
+++ /dev/null
@@ -1,168 +0,0 @@
-# -*- 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.
-
-
-# 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.
-
-
-#----------------------------------------------------------------------------
-# 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.
-#----------------------------------------------------------------------------
-
-
-# Choosing a C Compiler
-# ---------------------
-#
-# The user should be able to specify the compiler by setting the CC
-# environment variable to the name of the compiler and any switches it
-# requires for proper operation. If CC is unset then this script may
-# set it. If CC is unset by time this script completes then configure
-# will try `gcc' and `cc' in that order (perhaps some others too).
-#
-# Note: Code later in this file may depend on the value of $CC_BASENAME
-# in order to distinguish between different compilers when
-# deciding which compiler command-line switches to use. This
-# variable is set based on the incoming value of $CC and is only
-# used within this file.
-
-if test "X-" = "X-$CC"; then
- CC=cc
- CC_BASENAME=cc
-fi
-# no need to use RANLIB
-RANLIB=:
-
-
-# C Compiler and Preprocessor Flags
-# ---------------------------------
-#
-# Flags that end with `_CFLAGS' are always passed to the compiler.
-# Flags that end with `_CPPFLAGS' are passed to the compiler when
-# compiling but not when linking.
-#
-# DEBUG_CFLAGS Flags to pass to the compiler to create a
-# DEBUG_CPPFLAGS library suitable for use with debugging
-# tools. Usually this list will exclude
-# optimization switches (like `-O') and include
-# switches that turn on symbolic debugging
-# support (like `-g').
-#
-# PROD_CFLAGS Flags to pass to the compiler to create a
-# PROD_CPPFLAGS production version of the library. These
-# usualy exclude symbolic debugging switches
-# (like `-g') and include optimization switches
-# (like `-O').
-#
-# PROFILE_CFLAGS Flags to pass to the compiler to create a
-# PROFILE_CPPFLAGS library suitable for performance testing (like
-# `-pg'). This may or may not include debugging
-# or production flags.
-#
-# CFLAGS Flags can be added to this variable which
-# might already be partially initialized. These
-# flags will always be passed to the compiler
-# and should include switches to turn on full
-# warnings. HDF5 attempts to be ANSI and Posix
-# compliant and employ good programming
-# practices resulting in few if any
-# warnings.
-#
-# Warning flags do not have to be added to CFLAGS
-# variable if the compiler is the GNU gcc
-# compiler or a descendent of gcc such as EGCS or PGCC.
-#
-# The CFLAGS should contains *something* or else
-# configure will probably add `-g'. For most
-# systems this isn't a problem but some systems
-# will disable optimizations in favor of the
-# `-g'.
-#
-#
-# These flags should be set according to the compiler being used.
-# There are two ways to check the compiler. You can try using `-v' or
-# `--version' to see if the compiler will print a version string. You
-# can use the value of $CC_BASENAME which is the base name of the
-# first word in $CC (note that the value of CC may have changed
-# above).
-
-case $CC_BASENAME in
- gcc)
- CFLAGS="$CFLAGS -Wsign-compare" #Only works for some versions
- DEBUG_CFLAGS="-g -fverbose-asm"
- DEBUG_CPPFLAGS=
- PROD_CFLAGS="-O3 -fomit-frame-pointer"
- PROD_CPPFLAGS=
- PROFILE_CFLAGS="-pg"
- PROFILE_CPPFLAGS=
- ;;
-
- cc)
- CFLAGS="$CFLAGS"
- DEBUG_CFLAGS="-g -h zero"
- DEBUG_CPPFLAGS=
- PROD_CFLAGS="-O2 -h scalar0"
- PROD_CPPFLAGS=
- PROFILE_CFLAGS="-pg"
- PROFILE_CPPFLAGS=
- ;;
-
- *)
- CFLAGS="$CFLAGS -ansi"
- DEBUG_CFLAGS="-g"
- DEBUG_CPPFLAGS=
- PROD_CFLAGS="-O"
- PROD_CPPFLAGS=
- PROFILE_CFLAGS="-pg"
- PROFILE_CPPFLAGS=
- ;;
-esac
-
-
-
-# Overriding Configure Tests
-# --------------------------
-#
-# 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.
-#ac_cv_c_bigendian=${ac_cv_c_bigendian='yes'}
-
-# Set this to the width required by printf() to print type `long
-# long'. For instance, if the format would be `%lld' then set it to
-# `ll' or if the format would be `%qd' set it to `q'.
-#hdf5_cv_printf_ll=${hdf5_cv_printf_ll='ll'}
-
-# The default Fortran 90 compiler
-
-if test "X-" = "X-$FC"; then
- FC=f90
-fi
-
-if test "X-" = "X-$f9x_flags_set"; then
- F9XSUFFIXFLAG=""
- FSEARCH_DIRS=""
- FCFLAGS="$FCFLAGS -dp"
- DEBUG_FCFLAGS="-dp"
- PROD_FCFLAGS="-dp"
- PROFILE_FCFLAGS="-dp"
- f9x_flags_set=yes
-fi
diff --git a/config/unicosmk2.0.5.X b/config/unicosmk2.0.5.X
deleted file mode 100644
index c76cd42..0000000
--- a/config/unicosmk2.0.5.X
+++ /dev/null
@@ -1,170 +0,0 @@
-# -*- 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.
-
-
-# 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.
-
-
-#----------------------------------------------------------------------------
-# 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.
-#----------------------------------------------------------------------------
-
-
-# Choosing a C Compiler
-# ---------------------
-#
-# The user should be able to specify the compiler by setting the CC
-# environment variable to the name of the compiler and any switches it
-# requires for proper operation. If CC is unset then this script may
-# set it. If CC is unset by time this script completes then configure
-# will try `gcc' and `cc' in that order (perhaps some others too).
-#
-# Note: Code later in this file may depend on the value of $CC_BASENAME
-# in order to distinguish between different compilers when
-# deciding which compiler command-line switches to use. This
-# variable is set based on the incoming value of $CC and is only
-# used within this file.
-
-if test "X-" = "X-$CC"; then
- CC=cc
- CC_BASENAME=cc
-fi
-# no need to use RANLIB
-RANLIB=:
-
-
-# C Compiler and Preprocessor Flags
-# ---------------------------------
-#
-# Flags that end with `_CFLAGS' are always passed to the compiler.
-# Flags that end with `_CPPFLAGS' are passed to the compiler when
-# compiling but not when linking.
-#
-# DEBUG_CFLAGS Flags to pass to the compiler to create a
-# DEBUG_CPPFLAGS library suitable for use with debugging
-# tools. Usually this list will exclude
-# optimization switches (like `-O') and include
-# switches that turn on symbolic debugging
-# support (like `-g').
-#
-# PROD_CFLAGS Flags to pass to the compiler to create a
-# PROD_CPPFLAGS production version of the library. These
-# usualy exclude symbolic debugging switches
-# (like `-g') and include optimization switches
-# (like `-O').
-#
-# PROFILE_CFLAGS Flags to pass to the compiler to create a
-# PROFILE_CPPFLAGS library suitable for performance testing (like
-# `-pg'). This may or may not include debugging
-# or production flags.
-#
-# CFLAGS Flags can be added to this variable which
-# might already be partially initialized. These
-# flags will always be passed to the compiler
-# and should include switches to turn on full
-# warnings. HDF5 attempts to be ANSI and Posix
-# compliant and employ good programming
-# practices resulting in few if any
-# warnings.
-#
-# Warning flags do not have to be added to CFLAGS
-# variable if the compiler is the GNU gcc
-# compiler or a descendent of gcc such as EGCS or PGCC.
-#
-# The CFLAGS should contains *something* or else
-# configure will probably add `-g'. For most
-# systems this isn't a problem but some systems
-# will disable optimizations in favor of the
-# `-g'.
-#
-#
-# These flags should be set according to the compiler being used.
-# There are two ways to check the compiler. You can try using `-v' or
-# `--version' to see if the compiler will print a version string. You
-# can use the value of $CC_BASENAME which is the base name of the
-# first word in $CC (note that the value of CC may have changed
-# above).
-
-case $CC_BASENAME in
- gcc)
- CFLAGS="$CFLAGS -Wsign-compare" #Only works for some versions
- DEBUG_CFLAGS="-g -fverbose-asm"
- DEBUG_CPPFLAGS=
- PROD_CFLAGS="-O3 -fomit-frame-pointer"
- PROD_CPPFLAGS=
- PROFILE_CFLAGS="-pg"
- PROFILE_CPPFLAGS=
- ;;
-
- cc)
- CFLAGS="$CFLAGS"
- DEBUG_CFLAGS="-g -h zero"
- DEBUG_CPPFLAGS=
- PROD_CFLAGS="-O2 -h scalar0"
- PROD_CPPFLAGS=
- PROFILE_CFLAGS="-pg"
- PROFILE_CPPFLAGS=
- ;;
-
- *)
- CFLAGS="$CFLAGS -ansi"
- DEBUG_CFLAGS="-g"
- DEBUG_CPPFLAGS=
- PROD_CFLAGS="-O"
- PROD_CPPFLAGS=
- PROFILE_CFLAGS="-pg"
- PROFILE_CPPFLAGS=
- ;;
-esac
-
-
-
-# Overriding Configure Tests
-# --------------------------
-#
-# 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.
-#ac_cv_c_bigendian=${ac_cv_c_bigendian='yes'}
-
-# Set this to the width required by printf() to print type `long
-# long'. For instance, if the format would be `%lld' then set it to
-# `ll' or if the format would be `%qd' set it to `q'.
-#hdf5_cv_printf_ll=${hdf5_cv_printf_ll='ll'}
-
-# The default Fortran 90 compiler
-
-if test "X-" = "X-$FC"; then
- FC=f90
-fi
-
-if test "X-" = "X-$f9x_flags_set"; then
- # -Wl passes flags to the linker and -M# will ignore warnings with
- # number #. Warning 405 was stopping the executable from being built.
- F9XSUFFIXFLAG=""
- FSEARCH_DIRS=""
- FCFLAGS="$FCFLAGS -dp -Wl-M405"
- DEBUG_FCFLAGS=""
- PROD_FCFLAGS=""
- PROFILE_FCFLAGS=""
- f9x_flags_set=yes
-fi
diff --git a/config/unicosmk2.0.6.X b/config/unicosmk2.0.6.X
deleted file mode 100644
index 861b205..0000000
--- a/config/unicosmk2.0.6.X
+++ /dev/null
@@ -1,203 +0,0 @@
-# -*- 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.
-
-
-# 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.
-
-
-#----------------------------------------------------------------------------
-# 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.
-#----------------------------------------------------------------------------
-
-
-# Choosing a C Compiler
-# ---------------------
-#
-# The user should be able to specify the compiler by setting the CC
-# environment variable to the name of the compiler and any switches it
-# requires for proper operation. If CC is unset then this script may
-# set it. If CC is unset by time this script completes then configure
-# will try `gcc' and `cc' in that order (perhaps some others too).
-#
-# Note: Code later in this file may depend on the value of $CC_BASENAME
-# in order to distinguish between different compilers when
-# deciding which compiler command-line switches to use. This
-# variable is set based on the incoming value of $CC and is only
-# used within this file.
-
-if test "X-" = "X-$CC"; then
- CC=cc
- CC_BASENAME=cc
-fi
-# no need to use RANLIB
-RANLIB=:
-
-
-# C Compiler and Preprocessor Flags
-# ---------------------------------
-#
-# Flags that end with `_CFLAGS' are always passed to the compiler.
-# Flags that end with `_CPPFLAGS' are passed to the compiler when
-# compiling but not when linking.
-#
-# DEBUG_CFLAGS Flags to pass to the compiler to create a
-# DEBUG_CPPFLAGS library suitable for use with debugging
-# tools. Usually this list will exclude
-# optimization switches (like `-O') and include
-# switches that turn on symbolic debugging
-# support (like `-g').
-#
-# PROD_CFLAGS Flags to pass to the compiler to create a
-# PROD_CPPFLAGS production version of the library. These
-# usualy exclude symbolic debugging switches
-# (like `-g') and include optimization switches
-# (like `-O').
-#
-# PROFILE_CFLAGS Flags to pass to the compiler to create a
-# PROFILE_CPPFLAGS library suitable for performance testing (like
-# `-pg'). This may or may not include debugging
-# or production flags.
-#
-# CFLAGS Flags can be added to this variable which
-# might already be partially initialized. These
-# flags will always be passed to the compiler
-# and should include switches to turn on full
-# warnings. HDF5 attempts to be ANSI and Posix
-# compliant and employ good programming
-# practices resulting in few if any
-# warnings.
-#
-# Warning flags do not have to be added to CFLAGS
-# variable if the compiler is the GNU gcc
-# compiler or a descendent of gcc such as EGCS or PGCC.
-#
-# The CFLAGS should contains *something* or else
-# configure will probably add `-g'. For most
-# systems this isn't a problem but some systems
-# will disable optimizations in favor of the
-# `-g'.
-#
-#
-# These flags should be set according to the compiler being used.
-# There are two ways to check the compiler. You can try using `-v' or
-# `--version' to see if the compiler will print a version string. You
-# can use the value of $CC_BASENAME which is the base name of the
-# first word in $CC (note that the value of CC may have changed
-# above).
-
-case $CC_BASENAME in
- gcc)
- CFLAGS="$CFLAGS -Wsign-compare" #Only works for some versions
- DEBUG_CFLAGS="-g -fverbose-asm"
- DEBUG_CPPFLAGS=
- PROD_CFLAGS="-O3 -fomit-frame-pointer"
- PROD_CPPFLAGS=
- PROFILE_CFLAGS="-pg"
- PROFILE_CPPFLAGS=
- ;;
-
- cc)
- CFLAGS="$CFLAGS"
- DEBUG_CFLAGS="-g -h zero"
- DEBUG_CPPFLAGS=
- PROD_CFLAGS="-O2 -h scalar0"
- PROD_CPPFLAGS=
- PROFILE_CFLAGS="-pg"
- PROFILE_CPPFLAGS=
- ;;
-
- *)
- CFLAGS="$CFLAGS -ansi"
- DEBUG_CFLAGS="-g"
- DEBUG_CPPFLAGS=
- PROD_CFLAGS="-O"
- PROD_CPPFLAGS=
- PROFILE_CFLAGS="-pg"
- PROFILE_CPPFLAGS=
- ;;
-esac
-
-
-
-# Overriding Configure Tests
-# --------------------------
-#
-# 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.
-#ac_cv_c_bigendian=${ac_cv_c_bigendian='yes'}
-
-# Set this to the width required by printf() to print type `long
-# long'. For instance, if the format would be `%lld' then set it to
-# `ll' or if the format would be `%qd' set it to `q'.
-#hdf5_cv_printf_ll=${hdf5_cv_printf_ll='ll'}
-
-# Hard set the flag to indicate that converting denormalized floating-point
-# values doesn't work.
-hdf5_cv_convert_denormal_float=${hdf5_cv_convert_denormal_float='no'}
-
-# The default Fortran 90 compiler
-
-if test "X-" = "X-$FC"; then
- FC=f90
-fi
-
-if test "X-" = "X-$f9x_flags_set"; then
- # -Wl passes flags to the linker and -M# will ignore warnings with
- # number #. Warning 405 and 412 were stopping the executable from being built.
- F9XSUFFIXFLAG=""
- FSEARCH_DIRS=""
- FCFLAGS="$FCFLAGS -dp -Wl-M405,412"
- DEBUG_FCFLAGS=""
- PROD_FCFLAGS=""
- PROFILE_FCFLAGS=""
- f9x_flags_set=yes
-fi
-
-# The default C++ compiler
-
-if test -z "$CXX"; then
- CXX="CC"
- CXX_BASENAME=CC
-fi
-
-case $CXX_BASENAME in
- g++)
- CXXFLAGS="$CXXFLAGS -Wsign-compare" #Only works for some versions
- DEBUG_CXXFLAGS="-g -fverbose-asm"
- DEBUG_CPPFLAGS=
- PROD_CXXFLAGS="-O3 -fomit-frame-pointer"
- PROD_CPPFLAGS=
- PROFILE_CXXFLAGS="-pg"
- PROFILE_CPPFLAGS=
- ;;
-
- *)
- CXXFLAGS="$CXXFLAGS -h instantiate=used"
- DEBUG_CXXFLAGS="-g"
- DEBUG_CPPFLAGS=
- PROD_CXXFLAGS="-O"
- PROD_CPPFLAGS=
- PROFILE_CXXFLAGS="-pg"
- PROFILE_CPPFLAGS=
- ;;
-esac
diff --git a/config/unicosmk2.0.X b/config/unicosmk2.0.X
deleted file mode 100644
index f400a10..0000000
--- a/config/unicosmk2.0.X
+++ /dev/null
@@ -1,170 +0,0 @@
-# -*- 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.
-
-
-# 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.
-
-
-#----------------------------------------------------------------------------
-# 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.
-#----------------------------------------------------------------------------
-
-
-# Choosing a C Compiler
-# ---------------------
-#
-# The user should be able to specify the compiler by setting the CC
-# environment variable to the name of the compiler and any switches it
-# requires for proper operation. If CC is unset then this script may
-# set it. If CC is unset by time this script completes then configure
-# will try `gcc' and `cc' in that order (perhaps some others too).
-#
-# Note: Code later in this file may depend on the value of $CC_BASENAME
-# in order to distinguish between different compilers when
-# deciding which compiler command-line switches to use. This
-# variable is set based on the incoming value of $CC and is only
-# used within this file.
-
-if test "X-" = "X-$CC"; then
- CC=cc
- CC_BASENAME=cc
-fi
-# no need to use RANLIB
-RANLIB=:
-
-
-# C Compiler and Preprocessor Flags
-# ---------------------------------
-#
-# Flags that end with `_CFLAGS' are always passed to the compiler.
-# Flags that end with `_CPPFLAGS' are passed to the compiler when
-# compiling but not when linking.
-#
-# DEBUG_CFLAGS Flags to pass to the compiler to create a
-# DEBUG_CPPFLAGS library suitable for use with debugging
-# tools. Usually this list will exclude
-# optimization switches (like `-O') and include
-# switches that turn on symbolic debugging
-# support (like `-g').
-#
-# PROD_CFLAGS Flags to pass to the compiler to create a
-# PROD_CPPFLAGS production version of the library. These
-# usualy exclude symbolic debugging switches
-# (like `-g') and include optimization switches
-# (like `-O').
-#
-# PROFILE_CFLAGS Flags to pass to the compiler to create a
-# PROFILE_CPPFLAGS library suitable for performance testing (like
-# `-pg'). This may or may not include debugging
-# or production flags.
-#
-# CFLAGS Flags can be added to this variable which
-# might already be partially initialized. These
-# flags will always be passed to the compiler
-# and should include switches to turn on full
-# warnings. HDF5 attempts to be ANSI and Posix
-# compliant and employ good programming
-# practices resulting in few if any
-# warnings.
-#
-# Warning flags do not have to be added to CFLAGS
-# variable if the compiler is the GNU gcc
-# compiler or a descendent of gcc such as EGCS or PGCC.
-#
-# The CFLAGS should contains *something* or else
-# configure will probably add `-g'. For most
-# systems this isn't a problem but some systems
-# will disable optimizations in favor of the
-# `-g'.
-#
-#
-# These flags should be set according to the compiler being used.
-# There are two ways to check the compiler. You can try using `-v' or
-# `--version' to see if the compiler will print a version string. You
-# can use the value of $CC_BASENAME which is the base name of the
-# first word in $CC (note that the value of CC may have changed
-# above).
-
-case $CC_BASENAME in
- gcc)
- CFLAGS="$CFLAGS -Wsign-compare" #Only works for some versions
- DEBUG_CFLAGS="-g -fverbose-asm"
- DEBUG_CPPFLAGS=
- PROD_CFLAGS="-O3 -fomit-frame-pointer"
- PROD_CPPFLAGS=
- PROFILE_CFLAGS="-pg"
- PROFILE_CPPFLAGS=
- ;;
-
- cc)
- CFLAGS="$CFLAGS"
- DEBUG_CFLAGS="-g -h zero"
- DEBUG_CPPFLAGS=
- PROD_CFLAGS="-O2 -h scalar0"
- PROD_CPPFLAGS=
- PROFILE_CFLAGS="-pg"
- PROFILE_CPPFLAGS=
- ;;
-
- *)
- CFLAGS="$CFLAGS -ansi"
- DEBUG_CFLAGS="-g"
- DEBUG_CPPFLAGS=
- PROD_CFLAGS="-O"
- PROD_CPPFLAGS=
- PROFILE_CFLAGS="-pg"
- PROFILE_CPPFLAGS=
- ;;
-esac
-
-
-
-# Overriding Configure Tests
-# --------------------------
-#
-# 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.
-#ac_cv_c_bigendian=${ac_cv_c_bigendian='yes'}
-
-# Set this to the width required by printf() to print type `long
-# long'. For instance, if the format would be `%lld' then set it to
-# `ll' or if the format would be `%qd' set it to `q'.
-#hdf5_cv_printf_ll=${hdf5_cv_printf_ll='ll'}
-
-# The default Fortran 90 compiler
-
-if test "X-" = "X-$FC"; then
- FC=f90
-fi
-
-if test "X-" = "X-$f9x_flags_set"; then
- # -Wl passes flags to the linker and -M# will ignore warnings with
- # number #. Warning 405 was stopping the executable from being built.
- F9XSUFFIXFLAG=""
- FSEARCH_DIRS=""
- FCFLAGS="$FCFLAGS -dp -Wl-M405"
- DEBUG_FCFLAGS=""
- PROD_FCFLAGS=""
- PROFILE_FCFLAGS=""
- f9x_flags_set=yes
-fi
diff --git a/config/x86_64-redstorm-linux-gnu b/config/x86_64-redstorm-linux-gnu
index eb8f520..0cd2d73 100644
--- a/config/x86_64-redstorm-linux-gnu
+++ b/config/x86_64-redstorm-linux-gnu
@@ -33,7 +33,7 @@ if test "X-$enable_parallel" = "X-yes" -o X-$CC_BASENAME = X-mpicc; then
enable_shared="${enable_shared:-no}"
fi
-CFLAGS="$CFLAGS -DRED_STORM"
+H5_CFLAGS="$H5_CFLAGS -DRED_STORM"
# What compiler flags should be used for code development?
DEBUG_CFLAGS=-g
@@ -163,4 +163,4 @@ hdf5_cv_ullong_to_ldouble_precision_works=${hdf5_cv_ullong_to_ldouble_precision_
hdf5_cv_vsnprintf_works=${hdf5_cv_vsnprintf_works='yes'}
hdf5_cv_fp_to_integer_overflow_works=${hdf5_cv_fp_to_integer_overflow_works='yes'}
# mpich2 used has derived datatype errors.
-hdf5_mpi_complex_derived_datatype_works=${hdf5_mpi_complex_derived_datatype_works='no'}
+hdf5_cv_mpi_complex_derived_datatype_works=${hdf5_cv_mpi_complex_derived_datatype_works='no'}
diff --git a/configure b/configure
index 7d380f6..2a82389 100755
--- a/configure
+++ b/configure
@@ -1,7 +1,7 @@
#! /bin/sh
-# From configure.in Id: configure.in 17515 2009-09-24 11:25:37Z koziol .
+# From configure.in Id: configure.in 17547 2009-09-29 15:21:35Z koziol .
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.64 for HDF5 1.9.47-FA_a4.
+# Generated by GNU Autoconf 2.64 for HDF5 1.9.51-FA_a4.
#
# Report bugs to <help@hdfgroup.org>.
#
@@ -699,8 +699,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='HDF5'
PACKAGE_TARNAME='hdf5'
-PACKAGE_VERSION='1.9.47-FA_a4'
-PACKAGE_STRING='HDF5 1.9.47-FA_a4'
+PACKAGE_VERSION='1.9.51-FA_a4'
+PACKAGE_STRING='HDF5 1.9.51-FA_a4'
PACKAGE_BUGREPORT='help@hdfgroup.org'
PACKAGE_URL=''
@@ -887,6 +887,11 @@ HDF_FORTRAN
STATIC_EXEC
MPE
EXTERNAL_FILTERS
+AM_LDFLAGS
+AM_CPPFLAGS
+AM_CXXFLAGS
+AM_FCFLAGS
+AM_CFLAGS
H5_CXXFLAGS
H5_FCFLAGS
H5_CPPFLAGS
@@ -1566,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.47-FA_a4 to adapt to many kinds of systems.
+\`configure' configures HDF5 1.9.51-FA_a4 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1636,7 +1641,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of HDF5 1.9.47-FA_a4:";;
+ short | recursive ) echo "Configuration of HDF5 1.9.51-FA_a4:";;
esac
cat <<\_ACEOF
@@ -1738,9 +1743,9 @@ Optional Packages:
--with-mpe=DIR Use MPE instrumentation [default=no]
--with-default-vfd=driver
Specify default file driver [default=sec2]
- --with-default-api-version=(v16|v18)
+ --with-default-api-version=(v16|v18|v110)
Specify default release version of public symbols
- [default=v18]
+ [default=v110]
Some influential environment variables:
CC C compiler command
@@ -1823,7 +1828,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-HDF5 configure 1.9.47-FA_a4
+HDF5 configure 1.9.51-FA_a4
generated by GNU Autoconf 2.64
Copyright (C) 2009 Free Software Foundation, Inc.
@@ -2907,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.47-FA_a4, which was
+It was created by HDF5 $as_me 1.9.51-FA_a4, which was
generated by GNU Autoconf 2.64. Invocation command line was
$ $0 $@
@@ -3720,7 +3725,7 @@ fi
# Define the identity of the package.
PACKAGE='hdf5'
- VERSION='1.9.47-FA_a4'
+ VERSION='1.9.51-FA_a4'
cat >>confdefs.h <<_ACEOF
@@ -3872,10 +3877,28 @@ case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
+
+
+
+
+
+
+AM_CFLAGS="${AM_CFLAGS}"
+AM_CXXFLAGS="${AM_CXXFLAGS}"
+AM_FCFLAGS="${AM_FCFLAGS}"
+AM_CPPFLAGS="${AM_CPPFLAGS}"
+AM_LDFLAGS="${AM_LDFLAGS}"
CFLAGS="${CFLAGS}"
-CPPFLAGS="${CPPFLAGS}"
CXXFLAGS="${CXXFLAGS}"
FCFLAGS="${FCFLAGS}"
+CPPFLAGS="${CPPFLAGS}"
+LDFLAGS="${LDFLAGS}"
+
+saved_user_CFLAGS="$CFLAGS"
+saved_user_CXXFLAGS="$CXXFLAGS"
+saved_user_FCFLAGS="$FCFLAGS"
+saved_user_LDFLAGS="$LDFLAGS"
+saved_user_CPPFLAGS="$CPPFLAGS"
DEFAULT_LIBS=""
@@ -4027,6 +4050,12 @@ $as_echo "no" >&6; }
test "$hname_tmp" = "$hname" && break
done
+CFLAGS="${AM_CFLAGS} ${CFLAGS}"
+FCFLAGS="${AM_FCFLAGS} ${FCFLAGS}"
+CXXFLAGS="${AM_CXXFLAGS} ${CXXFLAGS}"
+CPPFLAGS="${AM_CPPFLAGS} ${CPPFLAGS}"
+LDFLAGS="${AM_LDFLAGS} ${LDFLAGS}"
+
if test -z "${enable_dependency_tracking}"; then
enable_dependency_tracking="yes"
fi
@@ -5016,7 +5045,8 @@ if test "X$HDF_FORTRAN" = "Xyes"; then
- FCFLAGS="${FCFLAGS} ${FFLAGS}"
+ AM_FCFLAGS="${AM_FCFLAGS} ${FFLAGS}"
+ FCFLAGS="${FCFLAGS} ${FFLAGS}"
ac_ext=${ac_fc_srcext-f}
ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5'
@@ -6314,6 +6344,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
else
echo "no"
+ FC="no"
fi
if test "X$HAVE_SIZEOF" = "Xyes"; then
@@ -6927,6 +6958,7 @@ else
echo yes
CXXFLAGS="${CXXFLAGS} -DOLD_HEADER_FILENAME"
+ AM_CXXFLAGS="${AM_CXXFLAGS} -DOLD_HEADER_FILENAME"
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
@@ -6964,6 +6996,7 @@ else
echo no
CXXFLAGS="${CXXFLAGS} -DH5_NO_NAMESPACE"
+ AM_CXXFLAGS="${AM_CXXFLAGS} -DH5_NO_NAMESPACE"
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
@@ -7000,6 +7033,7 @@ else
echo no
CXXFLAGS="${CXXFLAGS} -DH5_NO_STD"
+ AM_CXXFLAGS="${AM_CXXFLAGS} -DH5_NO_STD"
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
@@ -7032,6 +7066,7 @@ else
echo no
CXXFLAGS="${CXXFLAGS} -DBOOL_NOTDEFINED"
+ AM_CXXFLAGS="${AM_CXXFLAGS} -DBOOL_NOTDEFINED"
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
@@ -7114,6 +7149,7 @@ else
echo no
CXXFLAGS="${CXXFLAGS} -DNO_STATIC_CAST"
+ AM_CXXFLAGS="${AM_CXXFLAGS} -DNO_STATIC_CAST"
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
@@ -7122,6 +7158,7 @@ fi
else
echo "no"
+ CXX="no"
fi
ac_ext=c
@@ -7489,13 +7526,6 @@ elif test "X${enable_shared}" = "Xyes" -a "X${PARALLEL}" != "X"; then
echo ' shared libraries explicitly enabled by user'
fi
-if test "X${enable_shared}" != "Xno" && \
- (${CC-cc} -V 2>&1 | grep '^pgcc') > /dev/null; then
- echo ' warning: shared libraries are not supported for pgcc!'
- echo ' disabling shared libraries'
- enable_shared="no"
-fi
-
if test "X${HDF_FORTRAN}" = "Xyes"; then
H5_FORTRAN_SHARED="yes"
@@ -7508,6 +7538,7 @@ if test "X${HDF_FORTRAN}" = "Xyes"; then
H5_FORTRAN_SHARED="no"
else
FCFLAGS="${FCFLAGS} -fPIC"
+ AM_FCFLAGS="${AM_FCFLAGS} -fPIC"
fi
fi
if (${FC} +version 2>&1 | grep '^HP F90') > /dev/null; then
@@ -7541,12 +7572,6 @@ H5_CXX_SHARED="no"
if test "X${HDF_CXX}" = "Xyes" && test "X${enable_shared}" != "Xno"; then
H5_CXX_SHARED="yes"
- if (echo dummy ${CXX} ${CXXLD} ${CFLAGS} ${CXXFLAGS} ${LDFLAGS} | grep 'xarch') > /dev/null; then
- echo " warning: -xarch flag detected"
- echo " disabling shared C++ libraries"
- H5_CXX_SHARED="no"
- fi
-
if (echo dummy ${CXX} ${CXXLD} ${CFLAGS} ${CXXFLAGS} ${LDFLAGS} | grep 'DD64') > /dev/null; then
echo " warning: +DD64 flag detected"
@@ -8196,13 +8221,13 @@ if test "${lt_cv_nm_interface+set}" = set; then :
else
lt_cv_nm_interface="BSD nm"
echo "int some_variable = 0;" > conftest.$ac_ext
- (eval echo "\"\$as_me:8199: $ac_compile\"" >&5)
+ (eval echo "\"\$as_me:8224: $ac_compile\"" >&5)
(eval "$ac_compile" 2>conftest.err)
cat conftest.err >&5
- (eval echo "\"\$as_me:8202: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+ (eval echo "\"\$as_me:8227: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
(eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
cat conftest.err >&5
- (eval echo "\"\$as_me:8205: output\"" >&5)
+ (eval echo "\"\$as_me:8230: output\"" >&5)
cat conftest.out >&5
if $GREP 'External.*some_variable' conftest.out > /dev/null; then
lt_cv_nm_interface="MS dumpbin"
@@ -9407,7 +9432,7 @@ ia64-*-hpux*)
;;
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 9410 "configure"' > conftest.$ac_ext
+ echo '#line 9435 "configure"' > conftest.$ac_ext
if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -11726,11 +11751,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:11729: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:11754: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:11733: \$? = $ac_status" >&5
+ echo "$as_me:11758: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -12065,11 +12090,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:12068: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:12093: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:12072: \$? = $ac_status" >&5
+ echo "$as_me:12097: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -12170,11 +12195,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:12173: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:12198: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:12177: \$? = $ac_status" >&5
+ echo "$as_me:12202: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -12225,11 +12250,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:12228: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:12253: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:12232: \$? = $ac_status" >&5
+ echo "$as_me:12257: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -14656,7 +14681,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 14659 "configure"
+#line 14684 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -14752,7 +14777,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 14755 "configure"
+#line 14780 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -16724,11 +16749,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:16727: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:16752: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:16731: \$? = $ac_status" >&5
+ echo "$as_me:16756: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -16823,11 +16848,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:16826: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:16851: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:16830: \$? = $ac_status" >&5
+ echo "$as_me:16855: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -16875,11 +16900,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:16878: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:16903: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:16882: \$? = $ac_status" >&5
+ echo "$as_me:16907: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -18392,11 +18417,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:18395: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:18420: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:18399: \$? = $ac_status" >&5
+ echo "$as_me:18424: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -18491,11 +18516,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:18494: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:18519: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:18498: \$? = $ac_status" >&5
+ echo "$as_me:18523: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -18543,11 +18568,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:18546: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:18571: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:18550: \$? = $ac_status" >&5
+ echo "$as_me:18575: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -21156,18 +21181,20 @@ $as_echo_n "checking for large file support mode on Linux... " >&6; }
if test "X$LINUX_LFS" = "Xyes"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: enabled" >&5
$as_echo "enabled" >&6; }
- CPPFLAGS="-D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE $CPPFLAGS"
+ AM_CPPFLAGS="-D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE $AM_CPPFLAGS"
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: disabled" >&5
$as_echo "disabled" >&6; }
fi
- CPPFLAGS="-D_POSIX_SOURCE $CPPFLAGS"
+ H5_CPPFLAGS="-D_POSIX_SOURCE $H5_CPPFLAGS"
- CPPFLAGS="-D_BSD_SOURCE $CPPFLAGS"
+ AM_CPPFLAGS="-D_BSD_SOURCE $AM_CPPFLAGS"
;;
esac
+CPPFLAGS="$AM_CPPFLAGS $CPPFLAGS"
+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <sys/types.h>
@@ -23186,10 +23213,13 @@ $as_echo "suppressed" >&6; }
fi
saved_CPPFLAGS="$CPPFLAGS"
+ saved_AM_CPPFLAGS="$AM_CPPFLAGS"
saved_LDFLAGS="$LDFLAGS"
+ saved_AM_LDFLAGS="$AM_LDFLAGS"
if test -n "$dmalloc_inc"; then
CPPFLAGS="$CPPFLAGS -I$dmalloc_inc"
+ AM_CPPFLAGS="$AM_CPPFLAGS -I$dmalloc_inc"
fi
for ac_header in dmalloc.h
@@ -23201,7 +23231,7 @@ if test "x$ac_cv_header_dmalloc_h" = x""yes; then :
_ACEOF
else
- CPPFLAGS="$saved_CPPFLAGS"
+ CPPFLAGS="$saved_CPPFLAGS"; AM_CPPFLAGS="$saved_AM_CPPFLAGS"
fi
done
@@ -23209,6 +23239,7 @@ done
if test -n "$dmalloc_lib"; then
LDFLAGS="$LDFLAGS -L$dmalloc_lib"
+ AM_LDFLAGS="$AM_LDFLAGS -L$dmalloc_lib"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dmalloc_shutdown in -ldmalloc" >&5
@@ -23263,7 +23294,7 @@ _ACEOF
LIBS="-ldmalloc $LIBS"
else
- LDFLAGS="$saved_LDFLAGS"; unset HAVE_DMALLOC
+ LDFLAGS="$saved_LDFLAGS"; AM_LDFLAGS="$saved_AM_LDFLAGS"; unset HAVE_DMALLOC
fi
@@ -23393,10 +23424,13 @@ $as_echo "suppressed" >&6; }
fi
saved_CPPFLAGS="$CPPFLAGS"
+ saved_AM_CPPFLAGS="$AM_CPPFLAGS"
saved_LDFLAGS="$LDFLAGS"
+ saved_AM_LDFLAGS="$AM_LDFLAGS"
if test -n "$zlib_inc"; then
CPPFLAGS="$CPPFLAGS -I$zlib_inc"
+ AM_CPPFLAGS="$AM_CPPFLAGS -I$zlib_inc"
fi
for ac_header in zlib.h
@@ -23408,7 +23442,7 @@ if test "x$ac_cv_header_zlib_h" = x""yes; then :
_ACEOF
HAVE_ZLIB_H="yes"
else
- CPPFLAGS="$saved_CPPFLAGS"
+ CPPFLAGS="$saved_CPPFLAGS"; AM_CPPFLAGS="$saved_AM_CPPFLAGS"
fi
done
@@ -23416,6 +23450,7 @@ done
if test -n "$zlib_lib"; then
LDFLAGS="$LDFLAGS -L$zlib_lib"
+ AM_LDFLAGS="$AM_LDFLAGS -L$zlib_lib"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for compress2 in -lz" >&5
@@ -23470,7 +23505,7 @@ _ACEOF
LIBS="-lz $LIBS"
else
- LDFLAGS="$saved_LDFLAGS"; unset HAVE_ZLIB
+ LDFLAGS="$saved_LDFLAGS"; AM_LDFLAGS="$saved_AM_LDFLAGS"; unset HAVE_ZLIB
fi
ac_fn_c_check_func "$LINENO" "compress2" "ac_cv_func_compress2"
@@ -23613,10 +23648,13 @@ $as_echo "suppressed" >&6; }
fi
saved_CPPFLAGS="$CPPFLAGS"
+ saved_AM_CPPFLAGS="$AM_CPPFLAGS"
saved_LDFLAGS="$LDFLAGS"
+ saved_AM_LDFLAGS="$AM_LDFLAGS"
if test -n "$szlib_inc"; then
CPPFLAGS="$CPPFLAGS -I$szlib_inc"
+ AM_CPPFLAGS="$AM_CPPFLAGS -I$szlib_inc"
fi
for ac_header in szlib.h
@@ -23628,7 +23666,7 @@ if test "x$ac_cv_header_szlib_h" = x""yes; then :
_ACEOF
HAVE_SZLIB_H="yes"
else
- CPPFLAGS="$saved_CPPFLAGS"
+ CPPFLAGS="$saved_CPPFLAGS"; AM_CPPFLAGS="$saved_AM_CPPFLAGS"
fi
done
@@ -23636,6 +23674,7 @@ done
if test -n "$szlib_lib"; then
LDFLAGS="$LDFLAGS -L$szlib_lib"
+ AM_LDFLAGS="$AM_LDFLAGS -L$szlib_lib"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SZ_BufftoBuffCompress in -lsz" >&5
@@ -23690,7 +23729,7 @@ _ACEOF
LIBS="-lsz $LIBS"
else
- LDFLAGS="$saved_LDFLAGS"; unset HAVE_SZLIB
+ LDFLAGS="$saved_LDFLAGS"; AM_LDFLAGS="$saved_AM_LDFLAGS"; unset HAVE_SZLIB
fi
@@ -23971,7 +24010,9 @@ $as_echo "suppressed" >&6; }
if test -n "$pthread_inc"; then
saved_CPPFLAGS="$CPPFLAGS"
+ saved_AM_CPPFLAGS="$AM_CPPFLAGS"
CPPFLAGS="$CPPFLAGS -I$pthread_inc"
+ AM_CPPFLAGS="$AM_CPPFLAGS -I$pthread_inc"
for ac_header in pthread.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default"
@@ -23981,7 +24022,7 @@ if test "x$ac_cv_header_pthread_h" = x""yes; then :
_ACEOF
else
- CPPFLAGS="$saved_CPPFLAGS"; unset PTHREAD
+ CPPFLAGS="$saved_CPPFLAGS"; AM_CPPFLAGS="$saved_AM_CPPFLAGS"; unset PTHREAD
fi
done
@@ -24005,7 +24046,9 @@ done
if test -n "$pthread_lib"; then
saved_LDFLAGS="$LDFLAGS"
+ saved_AM_LDFLAGS="$AM_LDFLAGS"
LDFLAGS="$LDFLAGS -L$pthread_lib"
+ AM_LDFLAGS="$AM_LDFLAGS -L$pthread_lib"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5
$as_echo_n "checking for pthread_create in -lpthread... " >&6; }
if test "${ac_cv_lib_pthread_pthread_create+set}" = set; then :
@@ -24058,9 +24101,10 @@ _ACEOF
LIBS="-lpthread $LIBS"
else
- LDFLAGS="$saved_LDFLAGS"; unset PTHREAD
+ LDFLAGS="$saved_LDFLAGS"; AM_LDFLAGS="$saved_AM_LDFLAGS"; unset PTHREAD
fi
+
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5
$as_echo_n "checking for pthread_create in -lpthread... " >&6; }
@@ -25133,7 +25177,7 @@ $as_echo_n "checking how to print long long... " >&6; }
if test "${hdf5_cv_printf_ll+set}" = set; then :
$as_echo_n "(cached) " >&6
else
- LD_LIBRARY_PATH="$LD_LIBRARY_PATH`echo $LDFLAGS | sed -e 's/-L/:/g' -e 's/ //g'`"
+ LD_LIBRARY_PATH="$LD_LIBRARY_PATH`echo $AM_LDFLAGS $LDFLAGS | sed -e 's/-L/:/g' -e 's/ //g'`"
export LD_LIBRARY_PATH
for hdf5_cv_printf_ll in l ll L q unknown; do
@@ -26289,7 +26333,9 @@ fi
if test -n "$mpe_inc"; then
saved_CPPFLAGS="$CPPFLAGS"
+ saved_AM_CPPFLAGS="$AM_CPPFLAGS"
CPPFLAGS="$CPPFLAGS -I$mpe_inc"
+ AM_CPPFLAGS="$AM_CPPFLAGS -I$mpe_inc"
for ac_header in mpe.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "mpe.h" "ac_cv_header_mpe_h" "$ac_includes_default"
@@ -26299,7 +26345,7 @@ if test "x$ac_cv_header_mpe_h" = x""yes; then :
_ACEOF
else
- CPPFLAGS="$saved_CPPFLAGS"; unset MPE
+ CPPFLAGS="$saved_CPPFLAGS"; AM_CPPFLAGS="$saved_AM_CPPFLAGS"; unset MPE
fi
done
@@ -26323,7 +26369,9 @@ done
if test -n "$mpe_lib"; then
saved_LDFLAGS="$LDFLAGS"
+ saved_AM_LDFLAGS="$AM_LDFLAGS"
LDFLAGS="$LDFLAGS -L$mpe_lib"
+ AM_LDFLAGS="$AM_LDFLAGS -L$mpe_lib"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for MPE_Init_log in -lmpe" >&5
$as_echo_n "checking for MPE_Init_log in -lmpe... " >&6; }
if test "${ac_cv_lib_mpe_MPE_Init_log+set}" = set; then :
@@ -26376,7 +26424,7 @@ _ACEOF
LIBS="-lmpe $LIBS"
else
- LDFLAGS="$saved_LDFLAGS"; unset MPE
+ LDFLAGS="$saved_LDFLAGS"; AM_LDFLAGS="$saved_AM_LDFLAGS"; unset MPE
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for CLOG_Init in -llmpe" >&5
@@ -26431,9 +26479,10 @@ _ACEOF
LIBS="-llmpe $LIBS"
else
- LDFLAGS="$saved_LDFLAGS"; unset MPE
+ LDFLAGS="$saved_LDFLAGS"; AM_LDFLAGS="$saved_AM_LDFLAGS"; unset MPE
fi
+
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for MPE_Init_log in -lmpe" >&5
$as_echo_n "checking for MPE_Init_log in -lmpe... " >&6; }
@@ -26607,11 +26656,11 @@ $as_echo_n "checking if irregular hyperslab optimization code works inside MPI-I
if test "${hdf5_cv_mpi_complex_derived_datatype_works+set}" = set; then :
$as_echo_n "(cached) " >&6
else
- hdf5_mpi_complex_derived_datatype_works=yes
+ hdf5_cv_mpi_complex_derived_datatype_works=yes
fi
-if test ${hdf5_mpi_complex_derived_datatype_works} = "yes"; then
+if test ${hdf5_cv_mpi_complex_derived_datatype_works} = "yes"; then
$as_echo "#define MPI_COMPLEX_DERIVED_DATATYPE_WORKS 1" >>confdefs.h
@@ -26629,11 +26678,11 @@ $as_echo_n "checking if MPI-IO can do collective IO when one or more processes d
if test "${hdf5_cv_mpi_special_collective_io_works+set}" = set; then :
$as_echo_n "(cached) " >&6
else
- hdf5_mpi_special_collective_io_works=yes
+ hdf5_cv_mpi_special_collective_io_works=yes
fi
-if test ${hdf5_mpi_special_collective_io_works} = "yes"; then
+if test ${hdf5_cv_mpi_special_collective_io_works} = "yes"; then
$as_echo "#define MPI_SPECIAL_COLLECTIVE_IO_WORKS 1" >>confdefs.h
@@ -26806,14 +26855,14 @@ posix_memalign()
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
- hdf5_direct_io=yes
+ hdf5_cv_direct_io=yes
else
- hdf5_direct_io=no
+ hdf5_cv_direct_io=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
else
- hdf5_direct_io=no
+ hdf5_cv_direct_io=no
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
@@ -26822,7 +26871,7 @@ fi
fi
- if test ${hdf5_direct_io} = "yes"; then
+ if test ${hdf5_cv_direct_io} = "yes"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
@@ -26950,7 +26999,7 @@ esac
$as_echo_n "checking if converting from long double to integers is accurate... " >&6; }
if test ${ac_cv_sizeof_long_double} = 0; then
- hdf5_ldouble_to_integer_accurate=${hdf5_ldouble_to_integer_accurate=no}
+ hdf5_cv_ldouble_to_integer_accurate=${hdf5_cv_ldouble_to_integer_accurate=no}
else
if test "${hdf5_cv_ldouble_to_integer_accurate+set}" = set; then :
$as_echo_n "(cached) " >&6
@@ -26976,7 +27025,7 @@ fi
$as_echo_n "checking if converting from long double to integers works... " >&6; }
if test ${ac_cv_sizeof_long_double} = 0; then
- hdf5_ldouble_to_integer_works=${hdf5_ldouble_to_integer_works=no}
+ hdf5_cv_ldouble_to_integer_works=${hdf5_cv_ldouble_to_integer_works=no}
else
if test "${hdf5_cv_ldouble_to_integer_works+set}" = set; then :
$as_echo_n "(cached) " >&6
@@ -27014,9 +27063,9 @@ else
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
- hdf5_ldouble_to_integer_works=yes
+ hdf5_cv_ldouble_to_integer_works=yes
else
- hdf5_ldouble_to_integer_works=no
+ hdf5_cv_ldouble_to_integer_works=no
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
@@ -27026,7 +27075,7 @@ fi
fi
-if test ${hdf5_ldouble_to_integer_works} = "yes"; then
+if test ${hdf5_cv_ldouble_to_integer_works} = "yes"; then
$as_echo "#define LDOUBLE_TO_INTEGER_WORKS 1" >>confdefs.h
@@ -27107,9 +27156,9 @@ done:
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
- hdf5_ulong_to_float_accurate=yes
+ hdf5_cv_ulong_to_float_accurate=yes
else
- hdf5_ulong_to_float_accurate=no
+ hdf5_cv_ulong_to_float_accurate=no
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
@@ -27118,7 +27167,7 @@ fi
fi
-if test ${hdf5_ulong_to_float_accurate} = "yes"; then
+if test ${hdf5_cv_ulong_to_float_accurate} = "yes"; then
$as_echo "#define ULONG_TO_FLOAT_ACCURATE 1" >>confdefs.h
@@ -27271,9 +27320,9 @@ done:
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
- hdf5_fp_to_ullong_accurate=yes
+ hdf5_cv_fp_to_ullong_accurate=yes
else
- hdf5_fp_to_ullong_accurate=no
+ hdf5_cv_fp_to_ullong_accurate=no
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
@@ -27282,7 +27331,7 @@ fi
fi
-if test ${hdf5_fp_to_ullong_accurate} = "yes"; then
+if test ${hdf5_cv_fp_to_ullong_accurate} = "yes"; then
$as_echo "#define FP_TO_ULLONG_ACCURATE 1" >>confdefs.h
@@ -27334,9 +27383,9 @@ done:
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
- hdf5_fp_to_ullong_right_maximum=yes
+ hdf5_cv_fp_to_ullong_right_maximum=yes
else
- hdf5_fp_to_ullong_right_maximum=no
+ hdf5_cv_fp_to_ullong_right_maximum=no
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
@@ -27345,7 +27394,7 @@ fi
fi
-if test ${hdf5_fp_to_ullong_right_maximum} = "yes"; then
+if test ${hdf5_cv_fp_to_ullong_right_maximum} = "yes"; then
$as_echo "#define FP_TO_ULLONG_RIGHT_MAXIMUM 1" >>confdefs.h
@@ -27360,7 +27409,7 @@ fi
$as_echo_n "checking if correctly converting long double to unsigned int values... " >&6; }
if test ${ac_cv_sizeof_long_double} = 0; then
- hdf5_ldouble_to_uint_accurate=${hdf5_ldouble_to_uint_accurate=no}
+ hdf5_cv_ldouble_to_uint_accurate=${hdf5_cv_ldouble_to_uint_accurate=no}
else
if test "${hdf5_cv_ldouble_to_uint_accurate+set}" = set; then :
$as_echo_n "(cached) " >&6
@@ -27390,9 +27439,9 @@ else
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
- hdf5_ldouble_to_uint_accurate=yes
+ hdf5_cv_ldouble_to_uint_accurate=yes
else
- hdf5_ldouble_to_uint_accurate=no
+ hdf5_cv_ldouble_to_uint_accurate=no
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
@@ -27402,7 +27451,7 @@ fi
fi
-if test ${hdf5_ldouble_to_uint_accurate} = "yes"; then
+if test ${hdf5_cv_ldouble_to_uint_accurate} = "yes"; then
$as_echo "#define LDOUBLE_TO_UINT_ACCURATE 1" >>confdefs.h
@@ -27621,7 +27670,7 @@ fi
$as_echo_n "checking if correctly converting long double to (unsigned) long long values... " >&6; }
if test ${ac_cv_sizeof_long_double} = 0; then
- hdf5_ldouble_to_llong_accurate=${hdf5_ldouble_to_llong_accurate=no}
+ hdf5_cv_ldouble_to_llong_accurate=${hdf5_cv_ldouble_to_llong_accurate=no}
else
if test "${hdf5_cv_ldouble_to_llong_accurate+set}" = set; then :
$as_echo_n "(cached) " >&6
@@ -27674,9 +27723,9 @@ else
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
- hdf5_ldouble_to_llong_accurate=yes
+ hdf5_cv_ldouble_to_llong_accurate=yes
else
- hdf5_ldouble_to_llong_accurate=no
+ hdf5_cv_ldouble_to_llong_accurate=no
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
@@ -27686,7 +27735,7 @@ fi
fi
-if test ${hdf5_ldouble_to_llong_accurate} = "yes"; then
+if test ${hdf5_cv_ldouble_to_llong_accurate} = "yes"; then
$as_echo "#define LDOUBLE_TO_LLONG_ACCURATE 1" >>confdefs.h
@@ -27701,7 +27750,7 @@ fi
$as_echo_n "checking if correctly converting (unsigned) long long to long double values... " >&6; }
if test ${ac_cv_sizeof_long_double} = 0; then
- hdf5_llong_to_ldouble_correct=${hdf5_llong_to_ldouble_correct=no}
+ hdf5_cv_llong_to_ldouble_correct=${hdf5_cv_llong_to_ldouble_correct=no}
else
if test "${hdf5_cv_llong_to_ldouble_correct+set}" = set; then :
$as_echo_n "(cached) " >&6
@@ -27758,9 +27807,9 @@ else
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
- hdf5_llong_to_ldouble_correct=yes
+ hdf5_cv_llong_to_ldouble_correct=yes
else
- hdf5_llong_to_ldouble_correct=no
+ hdf5_cv_llong_to_ldouble_correct=no
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
@@ -27770,7 +27819,7 @@ fi
fi
-if test ${hdf5_llong_to_ldouble_correct} = "yes"; then
+if test ${hdf5_cv_llong_to_ldouble_correct} = "yes"; then
$as_echo "#define LLONG_TO_LDOUBLE_CORRECT 1" >>confdefs.h
@@ -27860,8 +27909,8 @@ LIBS="$DEFAULT_LIBS $LIBS"
DYNAMIC_DIRS=""
-if test -n "$LDFLAGS"; then
- for d in $LDFLAGS ; do
+if test -n "$AM_LDFLAGS $LDFLAGS"; then
+ for d in $AM_LDFLAGS $LDFLAGS ; do
case "$d" in
-L*)
d="`echo $d | sed -e 's/-L//g'`"
@@ -27876,9 +27925,9 @@ if test -n "$LDFLAGS"; then
done
fi
-if test -n "$CPPFLAGS"; then
+if test -n "$AM_CPPFLAGS"; then
TEMP_CPPFLAGS=""
- for d in $CPPFLAGS ; do
+ for d in $AM_CPPFLAGS ; do
case "$d" in
-I.*)
d="`echo $d | sed -e 's/-I//g'`"
@@ -27887,7 +27936,7 @@ if test -n "$CPPFLAGS"; then
esac
TEMP_CPPFLAGS="$d $TEMP_CPPFLAGS"
done
- CPPFLAGS=$TEMP_CPPFLAGS
+ AM_CPPFLAGS=$TEMP_CPPFLAGS
fi
@@ -27974,7 +28023,7 @@ $as_echo_n "checking which version of public symbols to use by default... " >&6;
if test "${with_default_api_version+set}" = set; then :
withval=$with_default_api_version;
else
- withval=v18
+ withval=v110
fi
@@ -27989,11 +28038,15 @@ elif test "X$withval" = "Xv18"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: v18" >&5
$as_echo "v18" >&6; }
DEFAULT_API_VERSION=v18
+elif test "X$withval" = "Xv110"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: v110" >&5
+$as_echo "v110" >&6; }
+ DEFAULT_API_VERSION=v110
else
as_fn_error "invalid version of public symbols given" "$LINENO" 5
fi
-if test "X${DEFAULT_API_VERSION}" != "Xv18" -a "X${DEPRECATED_SYMBOLS}" = "Xno" ; then
+if test "X${DEFAULT_API_VERSION}" != "Xv110" -a "X${DEPRECATED_SYMBOLS}" = "Xno" ; then
as_fn_error "Removing old public API symbols not allowed when using them as default public API symbols" "$LINENO" 5
fi
@@ -28135,6 +28188,14 @@ fi
+CFLAGS="$saved_user_CFLAGS"
+FCFLAGS="$saved_user_FCFLAGS"
+CXXFLAGS="$saved_user_CXXFLAGS"
+CPPFLAGS="$saved_user_CPPFLAGS"
+LDFLAGS="$saved_user_LDFLAGS"
+
+
+
if test "X$HDF_CXX" = "Xyes"; then
BUILD_CXX_CONDITIONAL_TRUE=
BUILD_CXX_CONDITIONAL_FALSE='#'
@@ -28181,7 +28242,7 @@ else
SETX="set -x"
fi
-rm -f conftest conftest.o conftest.c dummy.o
+rm -f conftest conftest.o conftest.c dummy.o *.mod
# First the stamp1 file for H5config.h.in
@@ -28784,7 +28845,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.47-FA_a4, which was
+This file was extended by HDF5 $as_me 1.9.51-FA_a4, which was
generated by GNU Autoconf 2.64. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -28848,7 +28909,7 @@ Report bugs to <help@hdfgroup.org>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_version="\\
-HDF5 config.status 1.9.47-FA_a4
+HDF5 config.status 1.9.51-FA_a4
configured by $0, generated by GNU Autoconf 2.64,
with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
@@ -31204,201 +31265,3 @@ cat >> src/H5config.h <<EOF
EOF
cat src/libhdf5.settings
-
-if false; then
-if test -z "$ECHO_N" -o -z "$ECHO_C"; then
- if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
- if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
- ECHO_N=''
- ECHO_C='
-'
- else
- ECHO_N=-n
- ECHO_C=''
- fi
- else
- ECHO_N=''
- ECHO_C='\c'
- fi
-fi
-
-PRINT_PLAIN() {
- echo $ECHO_N "$1$ECHO_C"
- echo $ECHO_N "$1$ECHO_C" 1>>src/libhdf5.settings
-}
-
-PRINT_N() {
- echo $ECHO_N "$1: $ECHO_C"
- echo $ECHO_N "$1: $ECHO_C" 1>>src/libhdf5.settings
-}
-
-PRINT() {
- echo "$1"
- echo "$1" 1>>src/libhdf5.settings
-}
-
-IF_YES_NO() {
- if test $# -lt 1; then
- PRINT "No"
- return
- else
- while test $# -gt 0; do
- if test "$1" != "yes"; then
- PRINT "No"
- return
- fi
- shift
- done
- fi
- PRINT "Yes"
-}
-
-IF_ENABLED_DISABLED() {
- if test "$1" = "yes"; then
- PRINT "Enabled"
- else
- PRINT "Disabled"
- fi
-}
-
-PRINT ""
-PRINT " Configure Summary"
-PRINT " ================="
-PRINT ""
-PRINT "Compiling Options:"
-PRINT "------------------"
-
-PRINT_N " Compilation Mode"
-case "X-$enable_production" in
- X-yes) PRINT "Production" ;;
- X-no) PRINT "Development" ;;
- X-profile) PRINT "Profile" ;;
- *) PRINT "$enable_production" ;;
-esac
-
-PRINT_N " C Compiler"
-PRINT "$CC"
-
-PRINT_N " CFLAGS / H5_CFLAGS"
-PRINT "$CFLAGS"
-PRINT " $H5_CFLAGS"
-
-PRINT_N " CPPFLAGS / H5_CPPFLAGS"
-PRINT "$CPPFLAGS"
-PRINT " $H5_CPPFLAGS"
-
-PRINT_N " LDFLAGS"
-PRINT "$LDFLAGS"
-
-PRINT_N " Debug Mode"
-
-if test "X$DEBUG_PKG" = "X$all_packages"; then
- PRINT "All"
-elif test "X$DEBUG_PKG" = "X"; then
- PRINT "None"
-else
- PRINT $DEBUG_PKG
-fi
-
-PRINT_N " Shared Libraries"
-IF_YES_NO "$enable_shared"
-
-PRINT_N " Static Libraries"
-IF_YES_NO "$enable_static"
-
-PRINT_N " Statically Linked Executables"
-IF_YES_NO "$STATIC_EXEC"
-
-PRINT_N "Default Version of Public Symbols"
-PRINT $DEFAULT_API_VERSION
-
-PRINT_N " With Deprecated Public Symbols"
-IF_YES_NO "$DEPRECATED_SYMBOLS"
-
-PRINT_N " Tracing"
-IF_YES_NO "$TRACE_API"
-
-PRINT_N "Clear file buffers before write"
-IF_YES_NO "$CLEARFILEBUF"
-
-PRINT_N " Using memory checker"
-IF_YES_NO "$USINGMEMCHECKER"
-
-PRINT_N " Optimization Instrumentation"
-IF_YES_NO "$INSTRUMENT"
-
-PRINT ""
-PRINT "Languages:"
-PRINT "----------"
-
-PRINT_N " C++"
-IF_YES_NO "$HDF_CXX"
-if test X$HDF_CXX = Xyes; then
- PRINT_N " C++ Compiler"
- PRINT "$CXX"
-
- PRINT_N " CXXFLAGS / H5_CXXFLAGS"
- PRINT "$CXXFLAGS"
- PRINT " $H5_CXXFLAGS"
-fi
-
-PRINT_N " Fortran"
-IF_YES_NO "$HDF_FORTRAN"
-if test X$HDF_FORTRAN = Xyes; then
- PRINT_N " Fortran Compiler"
- PRINT "$FC"
-
- PRINT_N " FCFLAGS / H5_FCFLAGS"
- PRINT "$FCFLAGS"
- PRINT " $H5_FCFLAGS"
-fi
-
-PRINT ""
-PRINT "Features:"
-PRINT "---------"
-
-PRINT_N " dmalloc"
-IF_YES_NO "$HAVE_DMALLOC"
-
-PRINT_N " Function Stack Tracing"
-IF_ENABLED_DISABLED "$CODESTACK"
-
-PRINT_N " GPFS"
-IF_YES_NO "$GPFS"
-
-PRINT_N " Strict File Format Checks"
-IF_ENABLED_DISABLED "$STRICT_FORMAT_CHECKS"
-
-PRINT_N " Default API Mapping"
-PRINT "$DEFAULT_API_VERSION"
-
-PRINT_N " I/O filters (external)"
-PRINT "$EXTERNAL_FILTERS"
-
-PRINT_N " I/O filters (internal)"
-PRINT "$FILTERS"
-
-PRINT_N " Linux Large File Support (LFS)"
-IF_ENABLED_DISABLED "$LINUX_LFS"
-
-PRINT_N " MPE"
-IF_YES_NO "$MPE"
-
-
-PRINT_N " Parallel HDF5"
-if test "$PARALLEL" != "no"; then
- PRINT "Yes"
-else
- PRINT "No"
-fi
-
-
-PRINT_N " Direct VFD"
-IF_ENABLED_DISABLED "$DIRECT_VFD"
-
-PRINT_N " Threadsafety"
-IF_ENABLED_DISABLED "$THREADSAFE"
-
-PRINT_N " High Level library"
-IF_ENABLED_DISABLED "$HDF5_HL"
-fi
diff --git a/configure.in b/configure.in
index 48bb854..09483fc 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.47-FA_a4], [help@hdfgroup.org])
+AC_INIT([HDF5], [1.9.51-FA_a4], [help@hdfgroup.org])
AC_CONFIG_SRCDIR([src/H5.c])
AM_CONFIG_HEADER([src/H5config.h])
@@ -94,11 +94,34 @@ AC_SUBST([H5_CPPFLAGS])
AC_SUBST([H5_FCFLAGS])
AC_SUBST([H5_CXXFLAGS])
+dnl AM_CFLAGS (and company) are for CFLAGS that should be used on HDF5,
+dnl and WILL be exported to h5cc (or h5fc, etc) if set by configure.
+AC_SUBST([AM_CFLAGS])
+AC_SUBST([AM_FCFLAGS])
+AC_SUBST([AM_CXXFLAGS])
+AC_SUBST([AM_CPPFLAGS])
+AC_SUBST([AM_LDFLAGS])
+
dnl Make sure flags are set to something (otherwise macros may set them later).
+AM_CFLAGS="${AM_CFLAGS}"
+AM_CXXFLAGS="${AM_CXXFLAGS}"
+AM_FCFLAGS="${AM_FCFLAGS}"
+AM_CPPFLAGS="${AM_CPPFLAGS}"
+AM_LDFLAGS="${AM_LDFLAGS}"
CFLAGS="${CFLAGS}"
-CPPFLAGS="${CPPFLAGS}"
CXXFLAGS="${CXXFLAGS}"
FCFLAGS="${FCFLAGS}"
+CPPFLAGS="${CPPFLAGS}"
+LDFLAGS="${LDFLAGS}"
+
+dnl Configure may need to alter any of the *FLAGS variables in order for
+dnl various checks to work correctly. Save the user's value here so it
+dnl can be restored once all configure checks are complete.
+saved_user_CFLAGS="$CFLAGS"
+saved_user_CXXFLAGS="$CXXFLAGS"
+saved_user_FCFLAGS="$FCFLAGS"
+saved_user_LDFLAGS="$LDFLAGS"
+saved_user_CPPFLAGS="$CPPFLAGS"
dnl Different compilers may need default libraries. They are specified in
dnl the config/* files, so we put this statement here so that it'll be
@@ -294,6 +317,16 @@ while test -n "$hname"; do
done
dnl ----------------------------------------------------------------------
+dnl Some built-in configure checks can only see CFLAGS (not AM_CFLAGS), so
+dnl we need to add this in so configure works as intended. We will need to
+dnl reset this value at the end of configure, to preserve the user's settings.
+CFLAGS="${AM_CFLAGS} ${CFLAGS}"
+FCFLAGS="${AM_FCFLAGS} ${FCFLAGS}"
+CXXFLAGS="${AM_CXXFLAGS} ${CXXFLAGS}"
+CPPFLAGS="${AM_CPPFLAGS} ${CPPFLAGS}"
+LDFLAGS="${AM_LDFLAGS} ${LDFLAGS}"
+
+dnl ----------------------------------------------------------------------
dnl Enable dependency tracking unless the configure options or a
dnl site-specific file told us not to. This prevents configure from
dnl silently disabling dependencies for some compilers.
@@ -342,6 +375,7 @@ if test "X$HDF_FORTRAN" = "Xyes"; then
dnl --------------------------------------------------------------------
dnl General Fortran flags
dnl
+ AM_FCFLAGS="${AM_FCFLAGS} ${FFLAGS}"
FCFLAGS="${FCFLAGS} ${FFLAGS}"
dnl --------------------------------------------------------------------
@@ -374,8 +408,8 @@ if test "X$HDF_FORTRAN" = "Xyes"; then
dnl --------------------------------------------------------------------
dnl See if the compiler will support the "-I." option
dnl
-dnl FCFLAGS_saved=$FCFLAGS
-dnl FCFLAGS="${FCFLAGS} -I."
+dnl AM_FCFLAGS_saved=$AM_FCFLAGS
+dnl AM_FCFLAGS="${AM_FCFLAGS} -I."
dnl AC_MSG_CHECKING(if compiler supports -I. option)
dnl AC_TRY_FCOMPILE([
@@ -383,7 +417,7 @@ dnl program conftest
dnl end
dnl ], AC_MSG_RESULT(yes),
dnl AC_MSG_RESULT(no)
-dnl FCFLAGS="$FCFLAGS_saved")
+dnl AM_FCFLAGS="$AM_FCFLAGS_saved")
dnl --------------------------------------------------------------------
dnl See if the fortran compiler supports the intrinsic function "SIZEOF"
@@ -433,6 +467,7 @@ dnl compile the DOUBLE PRECISION interfaces.
AC_LANG_POP(Fortran)
else
echo "no"
+ FC="no"
fi
AM_CONDITIONAL([FORTRAN_HAVE_SIZEOF], [test "X$HAVE_SIZEOF" = "Xyes"])
@@ -471,6 +506,7 @@ int main(void) { return 0; }
], [
echo yes
CXXFLAGS="${CXXFLAGS} -DOLD_HEADER_FILENAME"
+ AM_CXXFLAGS="${AM_CXXFLAGS} -DOLD_HEADER_FILENAME"
])
AC_MSG_CHECKING([if $CXX can handle namespaces])
@@ -489,6 +525,7 @@ int main(void) {
], [
echo no
CXXFLAGS="${CXXFLAGS} -DH5_NO_NAMESPACE"
+ AM_CXXFLAGS="${AM_CXXFLAGS} -DH5_NO_NAMESPACE"
])
AC_MSG_CHECKING([if $CXX supports std])
@@ -506,6 +543,7 @@ int main(void) {
], [
echo no
CXXFLAGS="${CXXFLAGS} -DH5_NO_STD"
+ AM_CXXFLAGS="${AM_CXXFLAGS} -DH5_NO_STD"
])
AC_MSG_CHECKING([if $CXX supports bool types])
@@ -519,6 +557,7 @@ int main(void) {
], [
echo no
CXXFLAGS="${CXXFLAGS} -DBOOL_NOTDEFINED"
+ AM_CXXFLAGS="${AM_CXXFLAGS} -DBOOL_NOTDEFINED"
])
AC_MSG_CHECKING([if $CXX has offsetof extension])
@@ -556,9 +595,11 @@ int main(void) {
], [
echo no
CXXFLAGS="${CXXFLAGS} -DNO_STATIC_CAST"
+ AM_CXXFLAGS="${AM_CXXFLAGS} -DNO_STATIC_CAST"
])
else
echo "no"
+ CXX="no"
fi
dnl Change back to the C language
@@ -839,18 +880,6 @@ elif test "X${enable_shared}" = "Xyes" -a "X${PARALLEL}" != "X"; then
fi
dnl ----------------------------------------------------------------------
-dnl As of Libtool 1.5.14, libtool officially doesn't know how to create
-dnl shared libraries with pgcc. In fact, it is able to do so on some
-dnl platforms, but not all (e.g., pgcc 5.2-4 on mir).
-dnl Disable shared libraries when using pgcc. -JL 09/2005
-if test "X${enable_shared}" != "Xno" && \
- (${CC-cc} -V 2>&1 | grep '^pgcc') > /dev/null; then
- echo ' warning: shared libraries are not supported for pgcc!'
- echo ' disabling shared libraries'
- enable_shared="no"
-fi
-
-dnl ----------------------------------------------------------------------
dnl Many Fortran compilers don't support shared libraries. Some of these
dnl compilers include:
dnl pgf90 version 6.0-4
@@ -873,6 +902,7 @@ if test "X${HDF_FORTRAN}" = "Xyes"; then
else
dnl echo 'adding fortran compiler flag needed for building shared libraries'
FCFLAGS="${FCFLAGS} -fPIC"
+ AM_FCFLAGS="${AM_FCFLAGS} -fPIC"
fi
fi
if (${FC} +version 2>&1 | grep '^HP F90') > /dev/null; then
@@ -894,24 +924,13 @@ fi
AM_CONDITIONAL([FORTRAN_SHARED_CONDITIONAL], [test "X$H5_FORTRAN_SHARED" = "Xyes"])
-dnl ----------------------------------------------------------------------
-dnl Shared C++ libraries seem not to work on some platforms (modi4, shanti)
-dnl when the -xarch=v9 flag is used to enable 64-bit mode.
-dnl Try to detect the -xarch=v9 flag and disable C++ shared libraries if it's
-dnl being used.
-dnl Also disable C++ shared libraries if shared libraries are disabled.
-dnl this prevents Automake from trying to link against shared libraries,
+dnl Disable C++ shared libraries if shared libraries are disabled.
+dnl This prevents Automake from trying to link against shared libraries,
dnl which caused problems on tg-login
H5_CXX_SHARED="no"
if test "X${HDF_CXX}" = "Xyes" && test "X${enable_shared}" != "Xno"; then
H5_CXX_SHARED="yes"
- if (echo dummy ${CXX} ${CXXLD} ${CFLAGS} ${CXXFLAGS} ${LDFLAGS} | grep 'xarch') > /dev/null; then
- echo " warning: -xarch flag detected"
- echo " disabling shared C++ libraries"
- H5_CXX_SHARED="no"
- fi
-
dnl Try to detect the +DD64 flag for HPUX aCC compiler and disable C++ shared libraries if it's
dnl being used.
@@ -1274,7 +1293,7 @@ case "$host_cpu-$host_vendor-$host_os" in
AC_MSG_CHECKING([for large file support mode on Linux])
if test "X$LINUX_LFS" = "Xyes"; then
AC_MSG_RESULT([enabled])
- CPPFLAGS="-D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE $CPPFLAGS"
+ AM_CPPFLAGS="-D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE $AM_CPPFLAGS"
else
AC_MSG_RESULT([disabled])
fi
@@ -1282,16 +1301,20 @@ case "$host_cpu-$host_vendor-$host_os" in
dnl Add POSIX support on Linux systems, so <features.h> defines
dnl __USE_POSIX, which is required to get the prototype for fdopen
dnl defined correctly in <stdio.h>
- CPPFLAGS="-D_POSIX_SOURCE $CPPFLAGS"
+ H5_CPPFLAGS="-D_POSIX_SOURCE $H5_CPPFLAGS"
dnl Also add BSD support on Linux systems, so <features.h> defines
dnl __USE_BSD, which is required to get the prototype for strdup
dnl defined correctly in <string.h> and snprintf & vsnprintf defined
dnl correctly in <stdio.h>
- CPPFLAGS="-D_BSD_SOURCE $CPPFLAGS"
+ AM_CPPFLAGS="-D_BSD_SOURCE $AM_CPPFLAGS"
;;
esac
+dnl Need to add AM_CPPFLAGS into CPPFLAGS to make them visible for configure checks.
+dnl Note: CPPFLAGS will be restored by the end of configure.
+CPPFLAGS="$AM_CPPFLAGS $CPPFLAGS"
+
AC_TRY_COMPILE([#include <sys/types.h>],
[off64_t n = 0;],
[AC_CHECK_FUNCS([lseek64 fseek64 ftruncate64])],
@@ -1459,19 +1482,23 @@ case $withval in
fi
saved_CPPFLAGS="$CPPFLAGS"
+ saved_AM_CPPFLAGS="$AM_CPPFLAGS"
saved_LDFLAGS="$LDFLAGS"
+ saved_AM_LDFLAGS="$AM_LDFLAGS"
if test -n "$dmalloc_inc"; then
CPPFLAGS="$CPPFLAGS -I$dmalloc_inc"
+ AM_CPPFLAGS="$AM_CPPFLAGS -I$dmalloc_inc"
fi
- AC_CHECK_HEADERS(dmalloc.h,, CPPFLAGS="$saved_CPPFLAGS")
+ AC_CHECK_HEADERS(dmalloc.h,,CPPFLAGS="$saved_CPPFLAGS"; AM_CPPFLAGS="$saved_AM_CPPFLAGS")
if test -n "$dmalloc_lib"; then
LDFLAGS="$LDFLAGS -L$dmalloc_lib"
+ AM_LDFLAGS="$AM_LDFLAGS -L$dmalloc_lib"
fi
- AC_CHECK_LIB(dmalloc, dmalloc_shutdown,, LDFLAGS="$saved_LDFLAGS"; unset HAVE_DMALLOC)
+ AC_CHECK_LIB(dmalloc, dmalloc_shutdown,, LDFLAGS="$saved_LDFLAGS"; AM_LDFLAGS="$saved_AM_LDFLAGS"; unset HAVE_DMALLOC)
if test -z "$HAVE_DMALLOC" -a -n "$HDF5_CONFIG_ABORT"; then
AC_MSG_ERROR(couldn't find dmalloc library)
@@ -1533,22 +1560,26 @@ case $withval in
fi
saved_CPPFLAGS="$CPPFLAGS"
+ saved_AM_CPPFLAGS="$AM_CPPFLAGS"
saved_LDFLAGS="$LDFLAGS"
+ saved_AM_LDFLAGS="$AM_LDFLAGS"
if test -n "$zlib_inc"; then
CPPFLAGS="$CPPFLAGS -I$zlib_inc"
+ AM_CPPFLAGS="$AM_CPPFLAGS -I$zlib_inc"
fi
AC_CHECK_HEADERS([zlib.h],
[HAVE_ZLIB_H="yes"],
- [CPPFLAGS="$saved_CPPFLAGS"])
+ [CPPFLAGS="$saved_CPPFLAGS"; AM_CPPFLAGS="$saved_AM_CPPFLAGS"])
if test -n "$zlib_lib"; then
LDFLAGS="$LDFLAGS -L$zlib_lib"
+ AM_LDFLAGS="$AM_LDFLAGS -L$zlib_lib"
fi
AC_CHECK_LIB([z], [compress2],,
- [LDFLAGS="$saved_LDFLAGS"; unset HAVE_ZLIB])
+ [LDFLAGS="$saved_LDFLAGS"; AM_LDFLAGS="$saved_AM_LDFLAGS"; unset HAVE_ZLIB])
AC_CHECK_FUNC([compress2], [HAVE_COMPRESS2="yes"])
if test -z "$HAVE_ZLIB" -a -n "$HDF5_CONFIG_ABORT"; then
@@ -1622,23 +1653,27 @@ case $withval in
fi
saved_CPPFLAGS="$CPPFLAGS"
+ saved_AM_CPPFLAGS="$AM_CPPFLAGS"
saved_LDFLAGS="$LDFLAGS"
+ saved_AM_LDFLAGS="$AM_LDFLAGS"
if test -n "$szlib_inc"; then
CPPFLAGS="$CPPFLAGS -I$szlib_inc"
+ AM_CPPFLAGS="$AM_CPPFLAGS -I$szlib_inc"
fi
AC_CHECK_HEADERS([szlib.h],
[HAVE_SZLIB_H="yes"],
- [CPPFLAGS="$saved_CPPFLAGS"])
-
+ [CPPFLAGS="$saved_CPPFLAGS"; AM_CPPFLAGS="$saved_AM_CPPFLAGS"])
+
if test -n "$szlib_lib"; then
LDFLAGS="$LDFLAGS -L$szlib_lib"
+ AM_LDFLAGS="$AM_LDFLAGS -L$szlib_lib"
fi
AC_CHECK_LIB([sz], [SZ_BufftoBuffCompress],,
- [LDFLAGS="$saved_LDFLAGS"; unset HAVE_SZLIB])
-
+ [LDFLAGS="$saved_LDFLAGS"; AM_LDFLAGS="$saved_AM_LDFLAGS"; unset HAVE_SZLIB])
+
if test -z "$HAVE_SZLIB" -a -n "$HDF5_CONFIG_ABORT"; then
AC_MSG_ERROR([couldn't find szlib library])
fi
@@ -1754,17 +1789,22 @@ case "$withval" in
if test -n "$pthread_inc"; then
saved_CPPFLAGS="$CPPFLAGS"
+ saved_AM_CPPFLAGS="$AM_CPPFLAGS"
CPPFLAGS="$CPPFLAGS -I$pthread_inc"
- AC_CHECK_HEADERS([pthread.h],, [CPPFLAGS="$saved_CPPFLAGS"; unset PTHREAD])
+ AM_CPPFLAGS="$AM_CPPFLAGS -I$pthread_inc"
+ AC_CHECK_HEADERS([pthread.h],, [CPPFLAGS="$saved_CPPFLAGS"; AM_CPPFLAGS="$saved_AM_CPPFLAGS"; unset PTHREAD])
else
AC_CHECK_HEADERS([pthread.h],, [unset PTHREAD])
fi
if test -n "$pthread_lib"; then
saved_LDFLAGS="$LDFLAGS"
+ saved_AM_LDFLAGS="$AM_LDFLAGS"
LDFLAGS="$LDFLAGS -L$pthread_lib"
+ AM_LDFLAGS="$AM_LDFLAGS -L$pthread_lib"
AC_CHECK_LIB([pthread], [pthread_create],,
- [LDFLAGS="$saved_LDFLAGS"; unset PTHREAD])
+ [LDFLAGS="$saved_LDFLAGS"; AM_LDFLAGS="$saved_AM_LDFLAGS"; unset PTHREAD])
+
else
AC_CHECK_LIB([pthread], [pthread_create],, [unset PTHREAD])
fi
@@ -2070,7 +2110,7 @@ dnl LD_LIBRARY_PATH along with LDFLAGS or do it with the AC_TRY_RUN macro.
dnl
AC_MSG_CHECKING([how to print long long])
AC_CACHE_VAL([hdf5_cv_printf_ll],
-LD_LIBRARY_PATH="$LD_LIBRARY_PATH`echo $LDFLAGS | sed -e 's/-L/:/g' -e 's/ //g'`"
+LD_LIBRARY_PATH="$LD_LIBRARY_PATH`echo $AM_LDFLAGS $LDFLAGS | sed -e 's/-L/:/g' -e 's/ //g'`"
export LD_LIBRARY_PATH
for hdf5_cv_printf_ll in l ll L q unknown; do
@@ -2610,19 +2650,24 @@ if test -n "$PARALLEL"; then
if test -n "$mpe_inc"; then
saved_CPPFLAGS="$CPPFLAGS"
+ saved_AM_CPPFLAGS="$AM_CPPFLAGS"
CPPFLAGS="$CPPFLAGS -I$mpe_inc"
- AC_CHECK_HEADERS([mpe.h],, [CPPFLAGS="$saved_CPPFLAGS"; unset MPE])
+ AM_CPPFLAGS="$AM_CPPFLAGS -I$mpe_inc"
+ AC_CHECK_HEADERS([mpe.h],, [CPPFLAGS="$saved_CPPFLAGS"; AM_CPPFLAGS="$saved_AM_CPPFLAGS"; unset MPE])
else
AC_CHECK_HEADERS([mpe.h],, [unset MPE])
fi
if test -n "$mpe_lib"; then
saved_LDFLAGS="$LDFLAGS"
+ saved_AM_LDFLAGS="$AM_LDFLAGS"
LDFLAGS="$LDFLAGS -L$mpe_lib"
+ AM_LDFLAGS="$AM_LDFLAGS -L$mpe_lib"
AC_CHECK_LIB([mpe], [MPE_Init_log],,
- [LDFLAGS="$saved_LDFLAGS"; unset MPE])
+ [LDFLAGS="$saved_LDFLAGS"; AM_LDFLAGS="$saved_AM_LDFLAGS"; unset MPE])
AC_CHECK_LIB([lmpe], [CLOG_Init],,
- [LDFLAGS="$saved_LDFLAGS"; unset MPE])
+ [LDFLAGS="$saved_LDFLAGS"; AM_LDFLAGS="$saved_AM_LDFLAGS"; unset MPE])
+
else
AC_CHECK_LIB([mpe], [MPE_Init_log],, [unset MPE])
AC_CHECK_LIB([lmpe], [CLOG_Init],, [unset MPE])
@@ -2693,9 +2738,9 @@ dnl bug also occurs at SGI IRIX 6.5 C with compiler version lower than or equal
dnl In case people still use the old compiler, we keep this flag.
AC_MSG_CHECKING([if irregular hyperslab optimization code works inside MPI-IO])
-AC_CACHE_VAL([hdf5_cv_mpi_complex_derived_datatype_works],[hdf5_mpi_complex_derived_datatype_works=yes])
+AC_CACHE_VAL([hdf5_cv_mpi_complex_derived_datatype_works],[hdf5_cv_mpi_complex_derived_datatype_works=yes])
-if test ${hdf5_mpi_complex_derived_datatype_works} = "yes"; then
+if test ${hdf5_cv_mpi_complex_derived_datatype_works} = "yes"; then
AC_DEFINE([MPI_COMPLEX_DERIVED_DATATYPE_WORKS], [1],
[Define if your system can handle complicated MPI derived datatype correctly.])
AC_MSG_RESULT([yes])
@@ -2712,9 +2757,9 @@ dnl and SGI altix. For those systems, we have to turn off this feature and use i
dnl
AC_MSG_CHECKING([if MPI-IO can do collective IO when one or more processes don't do IOs])
-AC_CACHE_VAL([hdf5_cv_mpi_special_collective_io_works],[hdf5_mpi_special_collective_io_works=yes])
+AC_CACHE_VAL([hdf5_cv_mpi_special_collective_io_works],[hdf5_cv_mpi_special_collective_io_works=yes])
-if test ${hdf5_mpi_special_collective_io_works} = "yes"; then
+if test ${hdf5_cv_mpi_special_collective_io_works} = "yes"; then
AC_DEFINE([MPI_SPECIAL_COLLECTIVE_IO_WORKS], [1],
[Define if your system can handle special collective IO properly.])
AC_MSG_RESULT([yes])
@@ -2854,9 +2899,9 @@ if test "$DIRECT_VFD" = "yes"; then
close(fid);
remove("tst_file");
exit (0);
- }], AC_TRY_LINK(, [posix_memalign()], [hdf5_direct_io=yes], [hdf5_direct_io=no]), [hdf5_direct_io=no],)])
+ }], AC_TRY_LINK(, [posix_memalign()], [hdf5_cv_direct_io=yes], [hdf5_cv_direct_io=no]), [hdf5_cv_direct_io=no],)])
- if test ${hdf5_direct_io} = "yes"; then
+ if test ${hdf5_cv_direct_io} = "yes"; then
AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_DIRECT], [1],
[Define if the direct I/O virtual file driver should be compiled])
@@ -2975,7 +3020,7 @@ dnl
AC_MSG_CHECKING([if converting from long double to integers is accurate])
if test ${ac_cv_sizeof_long_double} = 0; then
- hdf5_ldouble_to_integer_accurate=${hdf5_ldouble_to_integer_accurate=no}
+ hdf5_cv_ldouble_to_integer_accurate=${hdf5_cv_ldouble_to_integer_accurate=no}
else
AC_CACHE_VAL([hdf5_cv_ldouble_to_integer_accurate], [hdf5_cv_ldouble_to_integer_accurate=yes])
fi
@@ -2999,7 +3044,7 @@ dnl yet. (1/8/05 - SLU)
AC_MSG_CHECKING([if converting from long double to integers works])
if test ${ac_cv_sizeof_long_double} = 0; then
- hdf5_ldouble_to_integer_works=${hdf5_ldouble_to_integer_works=no}
+ hdf5_cv_ldouble_to_integer_works=${hdf5_cv_ldouble_to_integer_works=no}
else
AC_CACHE_VAL([hdf5_cv_ldouble_to_integer_works],
[AC_TRY_RUN([
@@ -3024,10 +3069,10 @@ else
done:
exit(ret);
}
- ], [hdf5_ldouble_to_integer_works=yes], [hdf5_ldouble_to_integer_works=no],)])
+ ], [hdf5_cv_ldouble_to_integer_works=yes], [hdf5_cv_ldouble_to_integer_works=no],)])
fi
-if test ${hdf5_ldouble_to_integer_works} = "yes"; then
+if test ${hdf5_cv_ldouble_to_integer_works} = "yes"; then
AC_DEFINE([LDOUBLE_TO_INTEGER_WORKS], [1],
[Define if your system can convert from long double to integer values.])
AC_MSG_RESULT([yes])
@@ -3097,9 +3142,9 @@ AC_CACHE_VAL([hdf5_cv_ulong_to_float_accurate],
done:
exit(ret);
}
- ], [hdf5_ulong_to_float_accurate=yes], [hdf5_ulong_to_float_accurate=no],)])
+ ], [hdf5_cv_ulong_to_float_accurate=yes], [hdf5_cv_ulong_to_float_accurate=no],)])
-if test ${hdf5_ulong_to_float_accurate} = "yes"; then
+if test ${hdf5_cv_ulong_to_float_accurate} = "yes"; then
AC_DEFINE([ULONG_TO_FLOAT_ACCURATE], [1],
[Define if your system accurately converting unsigned long to float values.])
AC_MSG_RESULT([yes])
@@ -3219,9 +3264,9 @@ AC_CACHE_VAL([hdf5_cv_fp_to_ullong_accurate],
done:
exit(ret);
}
- ], [hdf5_fp_to_ullong_accurate=yes], [hdf5_fp_to_ullong_accurate=no],)])
+ ], [hdf5_cv_fp_to_ullong_accurate=yes], [hdf5_cv_fp_to_ullong_accurate=no],)])
-if test ${hdf5_fp_to_ullong_accurate} = "yes"; then
+if test ${hdf5_cv_fp_to_ullong_accurate} = "yes"; then
AC_DEFINE([FP_TO_ULLONG_ACCURATE], [1],
[Define if your system roundup accurately converting floating-point to unsigned long long values.])
AC_MSG_RESULT([yes])
@@ -3263,9 +3308,9 @@ AC_CACHE_VAL([hdf5_cv_fp_to_ullong_right_maximum],
done:
exit(ret);
}
- ], [hdf5_fp_to_ullong_right_maximum=yes], [hdf5_fp_to_ullong_right_maximum=no],)])
+ ], [hdf5_cv_fp_to_ullong_right_maximum=yes], [hdf5_cv_fp_to_ullong_right_maximum=no],)])
-if test ${hdf5_fp_to_ullong_right_maximum} = "yes"; then
+if test ${hdf5_cv_fp_to_ullong_right_maximum} = "yes"; then
AC_DEFINE([FP_TO_ULLONG_RIGHT_MAXIMUM], [1],
[Define if your system has right maximum convert floating-point to unsigned long long values.])
AC_MSG_RESULT([yes])
@@ -3281,7 +3326,7 @@ dnl
AC_MSG_CHECKING([if correctly converting long double to unsigned int values])
if test ${ac_cv_sizeof_long_double} = 0; then
- hdf5_ldouble_to_uint_accurate=${hdf5_ldouble_to_uint_accurate=no}
+ hdf5_cv_ldouble_to_uint_accurate=${hdf5_cv_ldouble_to_uint_accurate=no}
else
AC_CACHE_VAL([hdf5_cv_ldouble_to_uint_accurate],
[AC_TRY_RUN([
@@ -3298,10 +3343,10 @@ else
done:
exit(ret);
}
- ], [hdf5_ldouble_to_uint_accurate=yes], [hdf5_ldouble_to_uint_accurate=no],)])
+ ], [hdf5_cv_ldouble_to_uint_accurate=yes], [hdf5_cv_ldouble_to_uint_accurate=no],)])
fi
-if test ${hdf5_ldouble_to_uint_accurate} = "yes"; then
+if test ${hdf5_cv_ldouble_to_uint_accurate} = "yes"; then
AC_DEFINE([LDOUBLE_TO_UINT_ACCURATE], [1],
[Define if your system can convert long double to unsigned int values correctly.])
AC_MSG_RESULT([yes])
@@ -3483,7 +3528,7 @@ dnl
AC_MSG_CHECKING([if correctly converting long double to (unsigned) long long values])
if test ${ac_cv_sizeof_long_double} = 0; then
- hdf5_ldouble_to_llong_accurate=${hdf5_ldouble_to_llong_accurate=no}
+ hdf5_cv_ldouble_to_llong_accurate=${hdf5_cv_ldouble_to_llong_accurate=no}
else
AC_CACHE_VAL([hdf5_cv_ldouble_to_llong_accurate],
[AC_TRY_RUN([
@@ -3523,10 +3568,10 @@ else
done:
exit(ret);
}
- ], [hdf5_ldouble_to_llong_accurate=yes], [hdf5_ldouble_to_llong_accurate=no],)])
+ ], [hdf5_cv_ldouble_to_llong_accurate=yes], [hdf5_cv_ldouble_to_llong_accurate=no],)])
fi
-if test ${hdf5_ldouble_to_llong_accurate} = "yes"; then
+if test ${hdf5_cv_ldouble_to_llong_accurate} = "yes"; then
AC_DEFINE([LDOUBLE_TO_LLONG_ACCURATE], [1],
[Define if your system can convert long double to (unsigned) long long values correctly.])
AC_MSG_RESULT([yes])
@@ -3544,7 +3589,7 @@ dnl
AC_MSG_CHECKING([if correctly converting (unsigned) long long to long double values])
if test ${ac_cv_sizeof_long_double} = 0; then
- hdf5_llong_to_ldouble_correct=${hdf5_llong_to_ldouble_correct=no}
+ hdf5_cv_llong_to_ldouble_correct=${hdf5_cv_llong_to_ldouble_correct=no}
else
AC_CACHE_VAL([hdf5_cv_llong_to_ldouble_correct],
[AC_TRY_RUN([
@@ -3588,10 +3633,10 @@ else
done:
exit(ret);
}
- ], [hdf5_llong_to_ldouble_correct=yes], [hdf5_llong_to_ldouble_correct=no],)])
+ ], [hdf5_cv_llong_to_ldouble_correct=yes], [hdf5_cv_llong_to_ldouble_correct=no],)])
fi
-if test ${hdf5_llong_to_ldouble_correct} = "yes"; then
+if test ${hdf5_cv_llong_to_ldouble_correct} = "yes"; then
AC_DEFINE([LLONG_TO_LDOUBLE_CORRECT], [1],
[Define if your system can convert (unsigned) long long to long double values correctly.])
AC_MSG_RESULT([yes])
@@ -3702,8 +3747,8 @@ dnl libraries.
dnl
AC_SUBST([DYNAMIC_DIRS]) DYNAMIC_DIRS=""
-if test -n "$LDFLAGS"; then
- for d in $LDFLAGS ; do
+if test -n "$AM_LDFLAGS $LDFLAGS"; then
+ for d in $AM_LDFLAGS $LDFLAGS ; do
case "$d" in
-L*)
d="`echo $d | sed -e 's/-L//g'`"
@@ -3720,9 +3765,9 @@ if test -n "$LDFLAGS"; then
done
fi
-if test -n "$CPPFLAGS"; then
+if test -n "$AM_CPPFLAGS"; then
TEMP_CPPFLAGS=""
- for d in $CPPFLAGS ; do
+ for d in $AM_CPPFLAGS ; do
case "$d" in
-I.*)
dnl If the path isn't absolute, make it so by prepending
@@ -3733,7 +3778,7 @@ if test -n "$CPPFLAGS"; then
esac
TEMP_CPPFLAGS="$d $TEMP_CPPFLAGS"
done
- CPPFLAGS=$TEMP_CPPFLAGS
+ AM_CPPFLAGS=$TEMP_CPPFLAGS
fi
dnl ----------------------------------------------------------------------
@@ -3809,10 +3854,10 @@ dnl
AC_SUBST([DEFAULT_API_VERSION])
AC_MSG_CHECKING([which version of public symbols to use by default])
AC_ARG_WITH([default-api-version],
- [AC_HELP_STRING([--with-default-api-version=(v16|v18)],
+ [AC_HELP_STRING([--with-default-api-version=(v16|v18|v110)],
[Specify default release version of public symbols
- [default=v18]])],,
- withval=v18)
+ [default=v110]])],,
+ withval=v110)
if test "X$withval" = "Xv16"; then
AC_MSG_RESULT([v16])
@@ -3822,13 +3867,16 @@ if test "X$withval" = "Xv16"; then
elif test "X$withval" = "Xv18"; then
AC_MSG_RESULT([v18])
DEFAULT_API_VERSION=v18
+elif test "X$withval" = "Xv110"; then
+ AC_MSG_RESULT([v110])
+ DEFAULT_API_VERSION=v110
else
AC_MSG_ERROR([invalid version of public symbols given])
fi
dnl It's an error to try to disable deprecated public API symbols while
dnl choosing an older version of the public API as the default.
-if test "X${DEFAULT_API_VERSION}" != "Xv18" -a "X${DEPRECATED_SYMBOLS}" = "Xno" ; then
+if test "X${DEFAULT_API_VERSION}" != "Xv110" -a "X${DEPRECATED_SYMBOLS}" = "Xno" ; then
AC_MSG_ERROR([Removing old public API symbols not allowed when using them as default public API symbols])
fi
@@ -3933,6 +3981,16 @@ AC_RUN_IFELSE([
AC_MSG_RESULT([unknown, assuming yes])
])
+
+dnl ----------------------------------------------------------------------
+dnl Restore user's CFLAGS.
+CFLAGS="$saved_user_CFLAGS"
+FCFLAGS="$saved_user_FCFLAGS"
+CXXFLAGS="$saved_user_CXXFLAGS"
+CPPFLAGS="$saved_user_CPPFLAGS"
+LDFLAGS="$saved_user_LDFLAGS"
+
+
dnl ----------------------------------------------------------------------
dnl Create automake conditionals to tell automake makefiles which directories
dnl need to be compiled
@@ -3962,7 +4020,7 @@ else
fi
dnl Some cleanup stuff
-rm -f conftest conftest.o conftest.c dummy.o
+rm -f conftest conftest.o conftest.c dummy.o *.mod
dnl Build config.status, touch the stamp files, and build all the Makefiles.
dnl The order is such that the first `make' does not need to update any
@@ -4106,208 +4164,3 @@ EOF
dnl show the configure settings
cat src/libhdf5.settings
-
-if false; then
-dnl ============ old code to be removed ================
-dnl ----------------------------------------------------------------------
-dnl Print out a summary of what we are going to build.
-dnl
-if test -z "$ECHO_N" -o -z "$ECHO_C"; then
- if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
- if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
- ECHO_N=''
- ECHO_C='
-'
- else
- ECHO_N=-n
- ECHO_C=''
- fi
- else
- ECHO_N=''
- ECHO_C='\c'
- fi
-fi
-
-PRINT_PLAIN() {
- echo $ECHO_N "$1$ECHO_C"
- echo $ECHO_N "$1$ECHO_C" 1>>src/libhdf5.settings
-}
-
-PRINT_N() {
- echo $ECHO_N "$1: $ECHO_C"
- echo $ECHO_N "$1: $ECHO_C" 1>>src/libhdf5.settings
-}
-
-PRINT() {
- echo "$1"
- echo "$1" 1>>src/libhdf5.settings
-}
-
-dnl ----------------------------------------------------------------------
-dnl Print "Yes" if all arguments are "yes", otherwise "No"
-dnl
-IF_YES_NO() {
- if test $# -lt 1; then
- PRINT "No"
- return
- else
- while test $# -gt 0; do
- if test "$1" != "yes"; then
- PRINT "No"
- return
- fi
- shift
- done
- fi
- PRINT "Yes"
-}
-
-IF_ENABLED_DISABLED() {
- if test "$1" = "yes"; then
- PRINT "Enabled"
- else
- PRINT "Disabled"
- fi
-}
-
-PRINT ""
-PRINT " Configure Summary"
-PRINT " ================="
-PRINT ""
-PRINT "Compiling Options:"
-PRINT "------------------"
-
-PRINT_N " Compilation Mode"
-case "X-$enable_production" in
- X-yes) PRINT "Production" ;;
- X-no) PRINT "Development" ;;
- X-profile) PRINT "Profile" ;;
- *) PRINT "$enable_production" ;;
-esac
-
-PRINT_N " C Compiler"
-PRINT "$CC"
-
-PRINT_N " CFLAGS / H5_CFLAGS"
-PRINT "$CFLAGS"
-PRINT " $H5_CFLAGS"
-
-PRINT_N " CPPFLAGS / H5_CPPFLAGS"
-PRINT "$CPPFLAGS"
-PRINT " $H5_CPPFLAGS"
-
-PRINT_N " LDFLAGS"
-PRINT "$LDFLAGS"
-
-PRINT_N " Debug Mode"
-
-if test "X$DEBUG_PKG" = "X$all_packages"; then
- PRINT "All"
-elif test "X$DEBUG_PKG" = "X"; then
- PRINT "None"
-else
- PRINT $DEBUG_PKG
-fi
-
-PRINT_N " Shared Libraries"
-IF_YES_NO "$enable_shared"
-
-PRINT_N " Static Libraries"
-IF_YES_NO "$enable_static"
-
-PRINT_N " Statically Linked Executables"
-IF_YES_NO "$STATIC_EXEC"
-
-PRINT_N "Default Version of Public Symbols"
-PRINT $DEFAULT_API_VERSION
-
-PRINT_N " With Deprecated Public Symbols"
-IF_YES_NO "$DEPRECATED_SYMBOLS"
-
-PRINT_N " Tracing"
-IF_YES_NO "$TRACE_API"
-
-PRINT_N "Clear file buffers before write"
-IF_YES_NO "$CLEARFILEBUF"
-
-PRINT_N " Using memory checker"
-IF_YES_NO "$USINGMEMCHECKER"
-
-PRINT_N " Optimization Instrumentation"
-IF_YES_NO "$INSTRUMENT"
-
-PRINT ""
-PRINT "Languages:"
-PRINT "----------"
-
-PRINT_N " C++"
-IF_YES_NO "$HDF_CXX"
-if test X$HDF_CXX = Xyes; then
- PRINT_N " C++ Compiler"
- PRINT "$CXX"
-
- PRINT_N " CXXFLAGS / H5_CXXFLAGS"
- PRINT "$CXXFLAGS"
- PRINT " $H5_CXXFLAGS"
-fi
-
-PRINT_N " Fortran"
-IF_YES_NO "$HDF_FORTRAN"
-if test X$HDF_FORTRAN = Xyes; then
- PRINT_N " Fortran Compiler"
- PRINT "$FC"
-
- PRINT_N " FCFLAGS / H5_FCFLAGS"
- PRINT "$FCFLAGS"
- PRINT " $H5_FCFLAGS"
-fi
-
-PRINT ""
-PRINT "Features:"
-PRINT "---------"
-
-PRINT_N " dmalloc"
-IF_YES_NO "$HAVE_DMALLOC"
-
-PRINT_N " Function Stack Tracing"
-IF_ENABLED_DISABLED "$CODESTACK"
-
-PRINT_N " GPFS"
-IF_YES_NO "$GPFS"
-
-PRINT_N " Strict File Format Checks"
-IF_ENABLED_DISABLED "$STRICT_FORMAT_CHECKS"
-
-PRINT_N " Default API Mapping"
-PRINT "$DEFAULT_API_VERSION"
-
-PRINT_N " I/O filters (external)"
-PRINT "$EXTERNAL_FILTERS"
-
-PRINT_N " I/O filters (internal)"
-PRINT "$FILTERS"
-
-PRINT_N " Linux Large File Support (LFS)"
-IF_ENABLED_DISABLED "$LINUX_LFS"
-
-PRINT_N " MPE"
-IF_YES_NO "$MPE"
-
-
-PRINT_N " Parallel HDF5"
-if test "$PARALLEL" != "no"; then
- PRINT "Yes"
-else
- PRINT "No"
-fi
-
-
-PRINT_N " Direct VFD"
-IF_ENABLED_DISABLED "$DIRECT_VFD"
-
-PRINT_N " Threadsafety"
-IF_ENABLED_DISABLED "$THREADSAFE"
-
-PRINT_N " High Level library"
-IF_ENABLED_DISABLED "$HDF5_HL"
-fi
diff --git a/examples/Makefile.in b/examples/Makefile.in
index 0f72ed9..9a6dcec 100644
--- a/examples/Makefile.in
+++ b/examples/Makefile.in
@@ -76,6 +76,16 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = /home1/packages/automake/automake-1.9.6/bin/aclocal-1.9 -I /afs/ncsa/projects/hdf/packages/libtool_1.5.14/Linux_2.4/share/aclocal
ADD_PARALLEL_FILES = @ADD_PARALLEL_FILES@
AMTAR = @AMTAR@
+
+# H5_CFLAGS holds flags that should be used when building hdf5,
+# but which should not be exported to h5cc for building other programs.
+# AM_CFLAGS is an automake construct which should be used by Makefiles
+# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
+AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
+AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@
+AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
+AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@
+AM_LDFLAGS = @AM_LDFLAGS@
AM_MAKEFLAGS = @AM_MAKEFLAGS@
AR = @AR@
@@ -89,21 +99,18 @@ BYTESEX = @BYTESEX@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CC_VERSION = @CC_VERSION@
-
-# H5_CFLAGS holds flags that should be used as CFLAGS when building hdf5,
-# but which shouldn't be exported to h5cc for building other programs.
-CFLAGS = @CFLAGS@ @H5_CFLAGS@
+CFLAGS = @CFLAGS@
CLEARFILEBUF = @CLEARFILEBUF@
CODESTACK = @CODESTACK@
CONFIG_DATE = @CONFIG_DATE@
CONFIG_MODE = @CONFIG_MODE@
CONFIG_USER = @CONFIG_USER@
CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@ @H5_CPPFLAGS@
+CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@ @H5_CXXFLAGS@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_PKG = @DEBUG_PKG@
DEFAULT_API_VERSION = @DEFAULT_API_VERSION@
@@ -126,7 +133,7 @@ F9XMODEXT = @F9XMODEXT@
F9XMODFLAG = @F9XMODFLAG@
F9XSUFFIXFLAG = @F9XSUFFIXFLAG@
FC = @FC@
-FCFLAGS = @FCFLAGS@ @H5_FCFLAGS@
+FCFLAGS = @FCFLAGS@
FCFLAGS_f90 = @FCFLAGS_f90@
FCLIBS = @FCLIBS@
FGREP = @FGREP@
diff --git a/examples/testh5cc.sh.in b/examples/testh5cc.sh.in
index 07c84ef..818375b 100755
--- a/examples/testh5cc.sh.in
+++ b/examples/testh5cc.sh.in
@@ -19,6 +19,8 @@
# Modification:
# Albert Cheng, 2008/9/27
# Added -shlib tests and verbose control.
+# Albert Cheng, 2009/10/28
+# Added version compatibility tests.
#
# Initializations
@@ -40,6 +42,8 @@ DIFF='diff -c'
nerrors=0
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`
+H5_USE_16_API_DEFAULT=`grep '#define H5_USE_16_API_DEFAULT ' ../src/H5pubconf.h`
# setup my machine information.
myos=`uname -s`
@@ -54,6 +58,10 @@ fi
suffix=c # source file suffix
hdf5main=${H5TOOL}_hdf5main.$suffix
hdf5main_o=${H5TOOL}_hdf5main.o
+v16main=${H5TOOL}_v16main.$suffix
+v16main_o=${H5TOOL}_v16main.o
+v18main=${H5TOOL}_v18main.$suffix
+v18main_o=${H5TOOL}_v18main.o
appmain=${H5TOOL}_appmain.$suffix
appmain_o=${H5TOOL}_appmain.o
prog1=${H5TOOL}_prog1.$suffix
@@ -67,7 +75,7 @@ applib=libapp${H5TOOL}.a
# Don't use the wildcard form of *.h5 as it will wipe out even *.h5 generated
# by otehr test programs. This will cause a racing condition error when
# parallel make (e.g., gmake -j 4) is used.
-temp_SRC="$hdf5main $appmain $prog1 $prog2"
+temp_SRC="$hdf5main $v16main $v18main $appmain $prog1 $prog2"
temp_OBJ=`echo $temp_SRC | sed -e "s/\.${suffix}/.o/g"`
temp_FILES="a.out $applib"
@@ -118,7 +126,6 @@ EOF
# An HDF5 sample program that calls hdf5 functions.
cat > $hdf5main <<EOF
#include "hdf5.h"
-#define H5_USE_16_API
#define H5FILE_NAME "tmp.h5"
int
main (void)
@@ -140,6 +147,56 @@ main (void)
}
EOF
+# Generate HDF5 v1.6 Main Program:
+# This makes unique V1.6 API calls.
+cat > $v16main <<EOF
+/* This is a V1.6 API calls example Program. */
+#include "hdf5.h"
+#define H5FILE_NAME "tmp.h5"
+int
+main (void)
+{
+ hid_t file, group, group1; /* file and group handles */
+
+ file = H5Fcreate(H5FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ group = H5Gcreate(file, "/Group", 0);
+ group1 = H5Gcreate1(file, "/Group1.6", 0);
+ H5Gclose(group1);
+ H5Gclose(group);
+ H5Fclose(file);
+
+ printf("HDF5 C program created with V1.6 API ran successfully. "
+ "File %s generated.\n", H5FILE_NAME);
+ remove(H5FILE_NAME);
+ return 0;
+}
+EOF
+
+# Generate HDF5 v1.8 Main Program:
+# This makes unique V1.8 API calls.
+cat > $v18main <<EOF
+/* This is a V1.8 API calls example Program. */
+#include "hdf5.h"
+#define H5FILE_NAME "tmp.h5"
+int
+main (void)
+{
+ hid_t file, group, group2; /* file and group handles */
+
+ file = H5Fcreate(H5FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ group = H5Gcreate(file, "/Group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ group2 = H5Gcreate2(file, "/Group1.8", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group2);
+ H5Gclose(group);
+ H5Fclose(file);
+
+ printf("HDF5 C program created with V1.8 API ran successfully. "
+ "File %s generated.\n", H5FILE_NAME);
+ remove(H5FILE_NAME);
+ return 0;
+}
+EOF
+
# Parse option
# None
@@ -246,6 +303,36 @@ echo "***"Just preprocess, no compile, no link.
TOOLTEST -E $hdf5main
TOOLTEST -E $appmain $prog1 $prog2
+# Group5: Version compatibility tests.
+echo "***"Version compatibility tests.
+# Test these two cases now. More later.
+# If H5_NO_DEPRECATED_SYMBOLS;
+# then only v18main works.
+# else if H5_USE_16_API_DEFAULT;
+# then v16main works and -DH5_NO_DEPRECATED_SYMBOLS v18main also works.
+# else v18main works and -DH5_USE_16_API_DEFAULT v16main also works.
+#
+if [ -n "$H5_USE_16_API_DEFAULT" ]; then
+ echo "H5_USE_16_API_DEFAULT is defined."
+else
+ echo "H5_USE_16_API_DEFAULT is not defined."
+fi
+if [ -n "$H5_NO_DEPRECATED_SYMBOLS" ]; then
+ echo "H5_NO_DEPRECATED_SYMBOLS is defined."
+else
+ echo "H5_NO_DEPRECATED_SYMBOLS is not defined."
+fi
+if [ -n "$H5_NO_DEPRECATED_SYMBOLS" ]; then
+ echo "Skipping $v16main test"
+ TOOLTEST $v18main
+elif [ -n "$H5_USE_16_API_DEFAULT" ]; then
+ TOOLTEST $v16main
+ TOOLTEST -DH5_NO_DEPRECATED_SYMBOLS $v18main
+else
+ TOOLTEST -DH5_USE_16_API_DEFAULT $v16main
+ TOOLTEST $v18main
+fi
+
##############################################################################
# END
##############################################################################
diff --git a/fortran/Makefile.in b/fortran/Makefile.in
index 3cbf4ab..65d8c2f 100644
--- a/fortran/Makefile.in
+++ b/fortran/Makefile.in
@@ -114,6 +114,16 @@ am__relativize = \
ACLOCAL = /home1/packages/automake/automake-1.9.6/bin/aclocal-1.9 -I /afs/ncsa/projects/hdf/packages/libtool_1.5.14/Linux_2.4/share/aclocal
ADD_PARALLEL_FILES = @ADD_PARALLEL_FILES@
AMTAR = @AMTAR@
+
+# H5_CFLAGS holds flags that should be used when building hdf5,
+# but which should not be exported to h5cc for building other programs.
+# AM_CFLAGS is an automake construct which should be used by Makefiles
+# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
+AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
+AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@
+AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
+AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@
+AM_LDFLAGS = @AM_LDFLAGS@
AM_MAKEFLAGS = @AM_MAKEFLAGS@
AR = @AR@
@@ -127,21 +137,18 @@ BYTESEX = @BYTESEX@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CC_VERSION = @CC_VERSION@
-
-# H5_CFLAGS holds flags that should be used as CFLAGS when building hdf5,
-# but which shouldn't be exported to h5cc for building other programs.
-CFLAGS = @CFLAGS@ @H5_CFLAGS@
+CFLAGS = @CFLAGS@
CLEARFILEBUF = @CLEARFILEBUF@
CODESTACK = @CODESTACK@
CONFIG_DATE = @CONFIG_DATE@
CONFIG_MODE = @CONFIG_MODE@
CONFIG_USER = @CONFIG_USER@
CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@ @H5_CPPFLAGS@
+CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@ @H5_CXXFLAGS@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_PKG = @DEBUG_PKG@
DEFAULT_API_VERSION = @DEFAULT_API_VERSION@
@@ -164,7 +171,7 @@ F9XMODEXT = @F9XMODEXT@
F9XMODFLAG = @F9XMODFLAG@
F9XSUFFIXFLAG = @F9XSUFFIXFLAG@
FC = @FC@
-FCFLAGS = @FCFLAGS@ @H5_FCFLAGS@
+FCFLAGS = @FCFLAGS@
FCFLAGS_f90 = @FCFLAGS_f90@
FCLIBS = @FCLIBS@
FGREP = @FGREP@
diff --git a/fortran/examples/Makefile.in b/fortran/examples/Makefile.in
index ed51143..684fd92 100644
--- a/fortran/examples/Makefile.in
+++ b/fortran/examples/Makefile.in
@@ -76,6 +76,16 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = /home1/packages/automake/automake-1.9.6/bin/aclocal-1.9 -I /afs/ncsa/projects/hdf/packages/libtool_1.5.14/Linux_2.4/share/aclocal
ADD_PARALLEL_FILES = @ADD_PARALLEL_FILES@
AMTAR = @AMTAR@
+
+# H5_CFLAGS holds flags that should be used when building hdf5,
+# but which should not be exported to h5cc for building other programs.
+# AM_CFLAGS is an automake construct which should be used by Makefiles
+# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
+AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
+AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@
+AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
+AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@
+AM_LDFLAGS = @AM_LDFLAGS@
AM_MAKEFLAGS = @AM_MAKEFLAGS@
AR = @AR@
@@ -89,21 +99,18 @@ BYTESEX = @BYTESEX@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CC_VERSION = @CC_VERSION@
-
-# H5_CFLAGS holds flags that should be used as CFLAGS when building hdf5,
-# but which shouldn't be exported to h5cc for building other programs.
-CFLAGS = @CFLAGS@ @H5_CFLAGS@
+CFLAGS = @CFLAGS@
CLEARFILEBUF = @CLEARFILEBUF@
CODESTACK = @CODESTACK@
CONFIG_DATE = @CONFIG_DATE@
CONFIG_MODE = @CONFIG_MODE@
CONFIG_USER = @CONFIG_USER@
CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@ @H5_CPPFLAGS@
+CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@ @H5_CXXFLAGS@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_PKG = @DEBUG_PKG@
DEFAULT_API_VERSION = @DEFAULT_API_VERSION@
@@ -126,7 +133,7 @@ F9XMODEXT = @F9XMODEXT@
F9XMODFLAG = @F9XMODFLAG@
F9XSUFFIXFLAG = @F9XSUFFIXFLAG@
FC = @FC@
-FCFLAGS = @FCFLAGS@ @H5_FCFLAGS@
+FCFLAGS = @FCFLAGS@
FCFLAGS_f90 = @FCFLAGS_f90@
FCLIBS = @FCLIBS@
FGREP = @FGREP@
diff --git a/fortran/src/H5Pf.c b/fortran/src/H5Pf.c
index 95616db..0929d7a 100644
--- a/fortran/src/H5Pf.c
+++ b/fortran/src/H5Pf.c
@@ -509,7 +509,7 @@ int_f
nh5pget_version_c (hid_t_f *prp_id, int_f * boot,int_f * freelist, int_f * stab, int_f *shhdr)
{
int ret_value = -1;
- hid_t c_prp_id;
+#ifndef H5_NO_DEPRECATED_SYMBOLS
herr_t ret;
unsigned c_boot;
unsigned c_freelist;
@@ -519,14 +519,22 @@ nh5pget_version_c (hid_t_f *prp_id, int_f * boot,int_f * freelist, int_f * stab,
/*
* Call H5Pget_version function.
*/
- c_prp_id = *prp_id;
- ret = H5Pget_version(c_prp_id, &c_boot, &c_freelist, &c_stab, &c_shhdr);
+ ret = H5Pget_version((hid_t)*prp_id, &c_boot, &c_freelist, &c_stab, &c_shhdr);
if (ret < 0) return ret_value;
*boot = (int_f)c_boot;
*freelist = (int_f)c_freelist;
*stab = (int_f)c_stab;
*shhdr = (int_f)c_shhdr;
+#else /* H5_NO_DEPRECATED_SYMBOLS */
+ /*
+ * Fill in fake values [since we need a file ID to call H5Fget_info :-( -QAK ]
+ */
+ *boot = (int_f)0;
+ *freelist = (int_f)0;
+ *stab = (int_f)0;
+ *shhdr = (int_f)0;
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
ret_value = 0;
return ret_value;
diff --git a/fortran/src/Makefile.am b/fortran/src/Makefile.am
index 3a9c3f2..d2644a1 100644
--- a/fortran/src/Makefile.am
+++ b/fortran/src/Makefile.am
@@ -24,7 +24,7 @@ include $(top_srcdir)/config/lt_vers.am
# Include src directory in both Fortran and C flags (C compiler is used
# for linking).
INCLUDES=-I$(top_srcdir)/src
-AM_FCFLAGS=-I$(top_srcdir)/src -I$(top_srcdir)/fortran/src
+AM_FCFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/fortran/src
AM_FCLIBS=$(LIBHDF5)
@@ -32,14 +32,14 @@ AM_FCLIBS=$(LIBHDF5)
lib_LTLIBRARIES=libhdf5_fortran.la
# Add libtool numbers to the HDF5 Fortran library (from config/lt_vers.am)
-libhdf5_fortran_la_LDFLAGS= -version-info $(LT_VERS_INTERFACE):$(LT_VERS_REVISION):$(LT_VERS_AGE)
+libhdf5_fortran_la_LDFLAGS= -version-info $(LT_VERS_INTERFACE):$(LT_VERS_REVISION):$(LT_VERS_AGE) $(AM_LDFLAGS)
# Some Fortran compilers can't build shared libraries, so sometimes we
# want to build a shared C library and a static Fortran library. If so,
# pass the -static flag to the library linker.
if FORTRAN_SHARED_CONDITIONAL
else
- AM_LDFLAGS=-static
+ AM_LDFLAGS+=-static
endif
# Include HDF5.f90 if parallel is disabled, HDF5mpiof* if parallel is enabled
diff --git a/fortran/src/Makefile.in b/fortran/src/Makefile.in
index 23a2f6d..a25b09e 100644
--- a/fortran/src/Makefile.in
+++ b/fortran/src/Makefile.in
@@ -56,6 +56,11 @@ DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/h5fc.in $(top_srcdir)/config/commence.am \
$(top_srcdir)/config/conclude.am \
$(top_srcdir)/config/lt_vers.am
+
+# Some Fortran compilers can't build shared libraries, so sometimes we
+# want to build a shared C library and a static Fortran library. If so,
+# pass the -static flag to the library linker.
+@FORTRAN_SHARED_CONDITIONAL_FALSE@am__append_1 = -static
noinst_PROGRAMS = H5match_types$(EXEEXT) H5fortran_detect$(EXEEXT) \
H5test_kind$(EXEEXT)
TESTS =
@@ -160,6 +165,17 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = /home1/packages/automake/automake-1.9.6/bin/aclocal-1.9 -I /afs/ncsa/projects/hdf/packages/libtool_1.5.14/Linux_2.4/share/aclocal
ADD_PARALLEL_FILES = @ADD_PARALLEL_FILES@
AMTAR = @AMTAR@
+
+# H5_CFLAGS holds flags that should be used when building hdf5,
+# but which should not be exported to h5cc for building other programs.
+# AM_CFLAGS is an automake construct which should be used by Makefiles
+# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
+AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
+AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@
+AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
+AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@ -I$(top_srcdir)/src \
+ -I$(top_srcdir)/fortran/src
+AM_LDFLAGS = @AM_LDFLAGS@ $(am__append_1)
AM_MAKEFLAGS = @AM_MAKEFLAGS@
AR = @AR@
@@ -173,21 +189,18 @@ BYTESEX = @BYTESEX@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CC_VERSION = @CC_VERSION@
-
-# H5_CFLAGS holds flags that should be used as CFLAGS when building hdf5,
-# but which shouldn't be exported to h5cc for building other programs.
-CFLAGS = @CFLAGS@ @H5_CFLAGS@
+CFLAGS = @CFLAGS@
CLEARFILEBUF = @CLEARFILEBUF@
CODESTACK = @CODESTACK@
CONFIG_DATE = @CONFIG_DATE@
CONFIG_MODE = @CONFIG_MODE@
CONFIG_USER = @CONFIG_USER@
CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@ @H5_CPPFLAGS@
+CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@ @H5_CXXFLAGS@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_PKG = @DEBUG_PKG@
DEFAULT_API_VERSION = @DEFAULT_API_VERSION@
@@ -210,7 +223,7 @@ F9XMODEXT = @F9XMODEXT@
F9XMODFLAG = @F9XMODFLAG@
F9XSUFFIXFLAG = @F9XSUFFIXFLAG@
FC = @FC@
-FCFLAGS = @FCFLAGS@ @H5_FCFLAGS@
+FCFLAGS = @FCFLAGS@
FCFLAGS_f90 = @FCFLAGS_f90@
FCLIBS = @FCLIBS@
FGREP = @FGREP@
@@ -411,25 +424,19 @@ 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 = 37
+LT_VERS_REVISION = 41
LT_VERS_AGE = 0
# Include src directory in both Fortran and C flags (C compiler is used
# for linking).
INCLUDES = -I$(top_srcdir)/src
-AM_FCFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/fortran/src
AM_FCLIBS = $(LIBHDF5)
# This is our main target, the fortran library
lib_LTLIBRARIES = libhdf5_fortran.la
# Add libtool numbers to the HDF5 Fortran library (from config/lt_vers.am)
-libhdf5_fortran_la_LDFLAGS = -version-info $(LT_VERS_INTERFACE):$(LT_VERS_REVISION):$(LT_VERS_AGE)
-
-# Some Fortran compilers can't build shared libraries, so sometimes we
-# want to build a shared C library and a static Fortran library. If so,
-# pass the -static flag to the library linker.
-@FORTRAN_SHARED_CONDITIONAL_FALSE@AM_LDFLAGS = -static
+libhdf5_fortran_la_LDFLAGS = -version-info $(LT_VERS_INTERFACE):$(LT_VERS_REVISION):$(LT_VERS_AGE) $(AM_LDFLAGS)
@BUILD_PARALLEL_CONDITIONAL_FALSE@PARALLEL_COND_SRC = HDF5.f90
# Include HDF5.f90 if parallel is disabled, HDF5mpiof* if parallel is enabled
diff --git a/fortran/src/h5fc.in b/fortran/src/h5fc.in
index 8c3e62b..df52971 100755
--- a/fortran/src/h5fc.in
+++ b/fortran/src/h5fc.in
@@ -54,10 +54,10 @@ get_output_file="no"
SHOW="eval"
FCBASE="@FC@"
FLINKERBASE="@FC@"
-FFLAGS="@FCFLAGS@"
+FFLAGS="@AM_FCFLAGS@ @FCFLAGS@"
F9XMODFLAG="@F9XMODFLAG@"
F9XSUFFIXFLAG="@F9XSUFFIXFLAG@"
-LDFLAGS="@LDFLAGS@"
+LDFLAGS="@AM_LDFLAGS@ @LDFLAGS@"
LIBS="@LIBS@"
FC="${HDF5_FC:-$FCBASE}"
@@ -295,7 +295,7 @@ if test "x$do_link" = "xyes"; then
# module. It's okay if they're included twice in the compile line.
link_args="$link_args $LIBS"
- $SHOW $FLINKER $FFLAGS $F9XSUFFIXFLAG $fmodules $LDFLAGS $link_objs $link_args $shared_link
+ $SHOW $FLINKER $FFLAGS $F9XSUFFIXFLAG $fmodules $link_objs $link_args $shared_link $LDFLAGS
status=$?
fi
diff --git a/fortran/test/Makefile.am b/fortran/test/Makefile.am
index ca0a1b4..fb4d6ca 100644
--- a/fortran/test/Makefile.am
+++ b/fortran/test/Makefile.am
@@ -21,7 +21,7 @@
include $(top_srcdir)/config/commence.am
# Include files
-AM_FCFLAGS=-I$(top_builddir)/fortran/src $(F9XMODFLAG)$(top_builddir)/fortran/src
+AM_FCFLAGS+=-I$(top_builddir)/fortran/src $(F9XMODFLAG)$(top_builddir)/fortran/src
INCLUDES=-I$(top_srcdir)/src -I$(top_builddir)/fortran/src
# The Fortran test library
@@ -32,7 +32,7 @@ noinst_LTLIBRARIES=libh5test_fortran.la
# pass the -static flag to the library linker.
if FORTRAN_SHARED_CONDITIONAL
else
- AM_LDFLAGS=-static
+ AM_LDFLAGS+=-static
endif
# Our main targets, the tests themselves
diff --git a/fortran/test/Makefile.in b/fortran/test/Makefile.in
index d503383..7d5009a 100644
--- a/fortran/test/Makefile.in
+++ b/fortran/test/Makefile.in
@@ -54,6 +54,11 @@ host_triplet = @host@
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(top_srcdir)/config/commence.am \
$(top_srcdir)/config/conclude.am
+
+# Some Fortran compilers can't build shared libraries, so sometimes we
+# want to build a shared C library and a static Fortran library. If so,
+# pass the -static flag to the library linker.
+@FORTRAN_SHARED_CONDITIONAL_FALSE@am__append_1 = -static
check_PROGRAMS = $(am__EXEEXT_1)
TESTS = $(check_PROGRAMS)
subdir = fortran/test
@@ -139,6 +144,19 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = /home1/packages/automake/automake-1.9.6/bin/aclocal-1.9 -I /afs/ncsa/projects/hdf/packages/libtool_1.5.14/Linux_2.4/share/aclocal
ADD_PARALLEL_FILES = @ADD_PARALLEL_FILES@
AMTAR = @AMTAR@
+
+# H5_CFLAGS holds flags that should be used when building hdf5,
+# but which should not be exported to h5cc for building other programs.
+# AM_CFLAGS is an automake construct which should be used by Makefiles
+# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
+AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
+AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@
+AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
+
+# Include files
+AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@ -I$(top_builddir)/fortran/src \
+ $(F9XMODFLAG)$(top_builddir)/fortran/src
+AM_LDFLAGS = @AM_LDFLAGS@ $(am__append_1)
AM_MAKEFLAGS = @AM_MAKEFLAGS@
AR = @AR@
@@ -152,21 +170,18 @@ BYTESEX = @BYTESEX@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CC_VERSION = @CC_VERSION@
-
-# H5_CFLAGS holds flags that should be used as CFLAGS when building hdf5,
-# but which shouldn't be exported to h5cc for building other programs.
-CFLAGS = @CFLAGS@ @H5_CFLAGS@
+CFLAGS = @CFLAGS@
CLEARFILEBUF = @CLEARFILEBUF@
CODESTACK = @CODESTACK@
CONFIG_DATE = @CONFIG_DATE@
CONFIG_MODE = @CONFIG_MODE@
CONFIG_USER = @CONFIG_USER@
CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@ @H5_CPPFLAGS@
+CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@ @H5_CXXFLAGS@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_PKG = @DEBUG_PKG@
DEFAULT_API_VERSION = @DEFAULT_API_VERSION@
@@ -189,7 +204,7 @@ F9XMODEXT = @F9XMODEXT@
F9XMODFLAG = @F9XMODFLAG@
F9XSUFFIXFLAG = @F9XSUFFIXFLAG@
FC = @FC@
-FCFLAGS = @FCFLAGS@ @H5_FCFLAGS@
+FCFLAGS = @FCFLAGS@
FCFLAGS_f90 = @FCFLAGS_f90@
FCLIBS = @FCLIBS@
FGREP = @FGREP@
@@ -388,19 +403,11 @@ TRACE = perl $(top_srcdir)/bin/trace
# Temporary files
CHECK_CLEANFILES = *.chkexe *.chklog *.clog *.h5
-
-# Include files
-AM_FCFLAGS = -I$(top_builddir)/fortran/src $(F9XMODFLAG)$(top_builddir)/fortran/src
INCLUDES = -I$(top_srcdir)/src -I$(top_builddir)/fortran/src
# The Fortran test library
noinst_LTLIBRARIES = libh5test_fortran.la
-# Some Fortran compilers can't build shared libraries, so sometimes we
-# want to build a shared C library and a static Fortran library. If so,
-# pass the -static flag to the library linker.
-@FORTRAN_SHARED_CONDITIONAL_FALSE@AM_LDFLAGS = -static
-
# Our main targets, the tests themselves
TEST_PROG = fortranlib_test fflush1 fflush2 fortranlib_test_1_8
libh5test_fortran_la_SOURCES = tf.f90 t.c
diff --git a/fortran/testpar/Makefile.am b/fortran/testpar/Makefile.am
index 9f9fc43..2e85f3b 100644
--- a/fortran/testpar/Makefile.am
+++ b/fortran/testpar/Makefile.am
@@ -21,7 +21,7 @@
include $(top_srcdir)/config/commence.am
# Include files
-AM_FCFLAGS=-I$(top_srcdir)/fortran/src -I$(top_srcdir)/fortran/test $(F9XMODFLAG)$(top_builddir)/fortran/src
+AM_FCFLAGS+=-I$(top_srcdir)/fortran/src -I$(top_srcdir)/fortran/test $(F9XMODFLAG)$(top_builddir)/fortran/src
# Some Fortran compilers can't build shared libraries, so sometimes we
# want to build a shared C library and a static Fortran library. If so,
@@ -30,7 +30,7 @@ AM_FCFLAGS=-I$(top_srcdir)/fortran/src -I$(top_srcdir)/fortran/test $(F9XMODFLAG
# parallel code. But you're welcome to try...)
if FORTRAN_SHARED_CONDITIONAL
else
- AM_LDFLAGS=-static
+ AM_LDFLAGS+=-static
endif
# These are our main targets
diff --git a/fortran/testpar/Makefile.in b/fortran/testpar/Makefile.in
index d0db926..edb9a66 100644
--- a/fortran/testpar/Makefile.in
+++ b/fortran/testpar/Makefile.in
@@ -53,6 +53,13 @@ host_triplet = @host@
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(top_srcdir)/config/commence.am \
$(top_srcdir)/config/conclude.am
+
+# Some Fortran compilers can't build shared libraries, so sometimes we
+# want to build a shared C library and a static Fortran library. If so,
+# pass the -static flag to the library linker.
+# (Actually, we historically have bad luck combining shared libraries with
+# parallel code. But you're welcome to try...)
+@FORTRAN_SHARED_CONDITIONAL_FALSE@am__append_1 = -static
check_PROGRAMS = $(am__EXEEXT_1)
TESTS = $(check_PROGRAMS)
subdir = fortran/testpar
@@ -89,6 +96,20 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = /home1/packages/automake/automake-1.9.6/bin/aclocal-1.9 -I /afs/ncsa/projects/hdf/packages/libtool_1.5.14/Linux_2.4/share/aclocal
ADD_PARALLEL_FILES = @ADD_PARALLEL_FILES@
AMTAR = @AMTAR@
+
+# H5_CFLAGS holds flags that should be used when building hdf5,
+# but which should not be exported to h5cc for building other programs.
+# AM_CFLAGS is an automake construct which should be used by Makefiles
+# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
+AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
+AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@
+AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
+
+# Include files
+AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@ -I$(top_srcdir)/fortran/src \
+ -I$(top_srcdir)/fortran/test \
+ $(F9XMODFLAG)$(top_builddir)/fortran/src
+AM_LDFLAGS = @AM_LDFLAGS@ $(am__append_1)
AM_MAKEFLAGS = @AM_MAKEFLAGS@
AR = @AR@
@@ -102,21 +123,18 @@ BYTESEX = @BYTESEX@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CC_VERSION = @CC_VERSION@
-
-# H5_CFLAGS holds flags that should be used as CFLAGS when building hdf5,
-# but which shouldn't be exported to h5cc for building other programs.
-CFLAGS = @CFLAGS@ @H5_CFLAGS@
+CFLAGS = @CFLAGS@
CLEARFILEBUF = @CLEARFILEBUF@
CODESTACK = @CODESTACK@
CONFIG_DATE = @CONFIG_DATE@
CONFIG_MODE = @CONFIG_MODE@
CONFIG_USER = @CONFIG_USER@
CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@ @H5_CPPFLAGS@
+CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@ @H5_CXXFLAGS@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_PKG = @DEBUG_PKG@
DEFAULT_API_VERSION = @DEFAULT_API_VERSION@
@@ -139,7 +157,7 @@ F9XMODEXT = @F9XMODEXT@
F9XMODFLAG = @F9XMODFLAG@
F9XSUFFIXFLAG = @F9XSUFFIXFLAG@
FC = @FC@
-FCFLAGS = @FCFLAGS@ @H5_FCFLAGS@
+FCFLAGS = @FCFLAGS@
FCFLAGS_f90 = @FCFLAGS_f90@
FCLIBS = @FCLIBS@
FGREP = @FGREP@
@@ -339,16 +357,6 @@ TRACE = perl $(top_srcdir)/bin/trace
# Temporary files
CHECK_CLEANFILES = *.chkexe *.chklog *.clog parf[12].h5
-# Include files
-AM_FCFLAGS = -I$(top_srcdir)/fortran/src -I$(top_srcdir)/fortran/test $(F9XMODFLAG)$(top_builddir)/fortran/src
-
-# Some Fortran compilers can't build shared libraries, so sometimes we
-# want to build a shared C library and a static Fortran library. If so,
-# pass the -static flag to the library linker.
-# (Actually, we historically have bad luck combining shared libraries with
-# parallel code. But you're welcome to try...)
-@FORTRAN_SHARED_CONDITIONAL_FALSE@AM_LDFLAGS = -static
-
# These are our main targets
TEST_PROG_PARA = parallel_test
diff --git a/hl/Makefile.in b/hl/Makefile.in
index 07dbefc..addfd5a 100755
--- a/hl/Makefile.in
+++ b/hl/Makefile.in
@@ -114,6 +114,16 @@ am__relativize = \
ACLOCAL = /home1/packages/automake/automake-1.9.6/bin/aclocal-1.9 -I /afs/ncsa/projects/hdf/packages/libtool_1.5.14/Linux_2.4/share/aclocal
ADD_PARALLEL_FILES = @ADD_PARALLEL_FILES@
AMTAR = @AMTAR@
+
+# H5_CFLAGS holds flags that should be used when building hdf5,
+# but which should not be exported to h5cc for building other programs.
+# AM_CFLAGS is an automake construct which should be used by Makefiles
+# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
+AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
+AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@
+AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
+AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@
+AM_LDFLAGS = @AM_LDFLAGS@
AM_MAKEFLAGS = @AM_MAKEFLAGS@
AR = @AR@
@@ -127,21 +137,18 @@ BYTESEX = @BYTESEX@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CC_VERSION = @CC_VERSION@
-
-# H5_CFLAGS holds flags that should be used as CFLAGS when building hdf5,
-# but which shouldn't be exported to h5cc for building other programs.
-CFLAGS = @CFLAGS@ @H5_CFLAGS@
+CFLAGS = @CFLAGS@
CLEARFILEBUF = @CLEARFILEBUF@
CODESTACK = @CODESTACK@
CONFIG_DATE = @CONFIG_DATE@
CONFIG_MODE = @CONFIG_MODE@
CONFIG_USER = @CONFIG_USER@
CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@ @H5_CPPFLAGS@
+CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@ @H5_CXXFLAGS@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_PKG = @DEBUG_PKG@
DEFAULT_API_VERSION = @DEFAULT_API_VERSION@
@@ -164,7 +171,7 @@ F9XMODEXT = @F9XMODEXT@
F9XMODFLAG = @F9XMODFLAG@
F9XSUFFIXFLAG = @F9XSUFFIXFLAG@
FC = @FC@
-FCFLAGS = @FCFLAGS@ @H5_FCFLAGS@
+FCFLAGS = @FCFLAGS@
FCFLAGS_f90 = @FCFLAGS_f90@
FCLIBS = @FCLIBS@
FGREP = @FGREP@
diff --git a/hl/c++/Makefile.in b/hl/c++/Makefile.in
index a2535cd..87a582c 100644
--- a/hl/c++/Makefile.in
+++ b/hl/c++/Makefile.in
@@ -110,6 +110,16 @@ am__relativize = \
ACLOCAL = /home1/packages/automake/automake-1.9.6/bin/aclocal-1.9 -I /afs/ncsa/projects/hdf/packages/libtool_1.5.14/Linux_2.4/share/aclocal
ADD_PARALLEL_FILES = @ADD_PARALLEL_FILES@
AMTAR = @AMTAR@
+
+# H5_CFLAGS holds flags that should be used when building hdf5,
+# but which should not be exported to h5cc for building other programs.
+# AM_CFLAGS is an automake construct which should be used by Makefiles
+# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
+AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
+AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@
+AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
+AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@
+AM_LDFLAGS = @AM_LDFLAGS@
AM_MAKEFLAGS = @AM_MAKEFLAGS@
AR = @AR@
@@ -123,21 +133,18 @@ BYTESEX = @BYTESEX@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CC_VERSION = @CC_VERSION@
-
-# H5_CFLAGS holds flags that should be used as CFLAGS when building hdf5,
-# but which shouldn't be exported to h5cc for building other programs.
-CFLAGS = @CFLAGS@ @H5_CFLAGS@
+CFLAGS = @CFLAGS@
CLEARFILEBUF = @CLEARFILEBUF@
CODESTACK = @CODESTACK@
CONFIG_DATE = @CONFIG_DATE@
CONFIG_MODE = @CONFIG_MODE@
CONFIG_USER = @CONFIG_USER@
CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@ @H5_CPPFLAGS@
+CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@ @H5_CXXFLAGS@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_PKG = @DEBUG_PKG@
DEFAULT_API_VERSION = @DEFAULT_API_VERSION@
@@ -160,7 +167,7 @@ F9XMODEXT = @F9XMODEXT@
F9XMODFLAG = @F9XMODFLAG@
F9XSUFFIXFLAG = @F9XSUFFIXFLAG@
FC = @FC@
-FCFLAGS = @FCFLAGS@ @H5_FCFLAGS@
+FCFLAGS = @FCFLAGS@
FCFLAGS_f90 = @FCFLAGS_f90@
FCLIBS = @FCLIBS@
FGREP = @FGREP@
diff --git a/hl/c++/examples/Makefile.in b/hl/c++/examples/Makefile.in
index 27e1585..4b11346 100644
--- a/hl/c++/examples/Makefile.in
+++ b/hl/c++/examples/Makefile.in
@@ -76,6 +76,16 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = /home1/packages/automake/automake-1.9.6/bin/aclocal-1.9 -I /afs/ncsa/projects/hdf/packages/libtool_1.5.14/Linux_2.4/share/aclocal
ADD_PARALLEL_FILES = @ADD_PARALLEL_FILES@
AMTAR = @AMTAR@
+
+# H5_CFLAGS holds flags that should be used when building hdf5,
+# but which should not be exported to h5cc for building other programs.
+# AM_CFLAGS is an automake construct which should be used by Makefiles
+# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
+AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
+AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@
+AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
+AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@
+AM_LDFLAGS = @AM_LDFLAGS@
AM_MAKEFLAGS = @AM_MAKEFLAGS@
AR = @AR@
@@ -89,21 +99,18 @@ BYTESEX = @BYTESEX@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CC_VERSION = @CC_VERSION@
-
-# H5_CFLAGS holds flags that should be used as CFLAGS when building hdf5,
-# but which shouldn't be exported to h5cc for building other programs.
-CFLAGS = @CFLAGS@ @H5_CFLAGS@
+CFLAGS = @CFLAGS@
CLEARFILEBUF = @CLEARFILEBUF@
CODESTACK = @CODESTACK@
CONFIG_DATE = @CONFIG_DATE@
CONFIG_MODE = @CONFIG_MODE@
CONFIG_USER = @CONFIG_USER@
CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@ @H5_CPPFLAGS@
+CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@ @H5_CXXFLAGS@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_PKG = @DEBUG_PKG@
DEFAULT_API_VERSION = @DEFAULT_API_VERSION@
@@ -126,7 +133,7 @@ F9XMODEXT = @F9XMODEXT@
F9XMODFLAG = @F9XMODFLAG@
F9XSUFFIXFLAG = @F9XSUFFIXFLAG@
FC = @FC@
-FCFLAGS = @FCFLAGS@ @H5_FCFLAGS@
+FCFLAGS = @FCFLAGS@
FCFLAGS_f90 = @FCFLAGS_f90@
FCLIBS = @FCLIBS@
FGREP = @FGREP@
diff --git a/hl/c++/src/Makefile.am b/hl/c++/src/Makefile.am
index 1ff24be..15986d6 100644
--- a/hl/c++/src/Makefile.am
+++ b/hl/c++/src/Makefile.am
@@ -28,12 +28,12 @@ INCLUDES=-I$(top_srcdir)/src -I$(top_srcdir)/hl/src
lib_LTLIBRARIES=libhdf5_hl_cpp.la
# Add libtool numbers to the HDF5 HL C++ library (from config/lt_vers.am)
-libhdf5_hl_cpp_la_LDFLAGS= -version-info $(LT_VERS_INTERFACE):$(LT_VERS_REVISION):$(LT_VERS_AGE)
+libhdf5_hl_cpp_la_LDFLAGS= -version-info $(LT_VERS_INTERFACE):$(LT_VERS_REVISION):$(LT_VERS_AGE) $(AM_LDFLAGS)
# Shared C++ libraries aren't universally supported.
if CXX_SHARED_CONDITIONAL
else
- AM_LDFLAGS=-static
+ AM_LDFLAGS+=-static
endif
# Source files for the library
diff --git a/hl/c++/src/Makefile.in b/hl/c++/src/Makefile.in
index cd81ccf..ad49fe4 100644
--- a/hl/c++/src/Makefile.in
+++ b/hl/c++/src/Makefile.in
@@ -56,6 +56,9 @@ DIST_COMMON = $(include_HEADERS) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(top_srcdir)/config/commence.am \
$(top_srcdir)/config/conclude.am \
$(top_srcdir)/config/lt_vers.am
+
+# Shared C++ libraries aren't universally supported.
+@CXX_SHARED_CONDITIONAL_FALSE@am__append_1 = -static
TESTS =
subdir = hl/c++/src
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -119,6 +122,16 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = /home1/packages/automake/automake-1.9.6/bin/aclocal-1.9 -I /afs/ncsa/projects/hdf/packages/libtool_1.5.14/Linux_2.4/share/aclocal
ADD_PARALLEL_FILES = @ADD_PARALLEL_FILES@
AMTAR = @AMTAR@
+
+# H5_CFLAGS holds flags that should be used when building hdf5,
+# but which should not be exported to h5cc for building other programs.
+# AM_CFLAGS is an automake construct which should be used by Makefiles
+# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
+AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
+AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@
+AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
+AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@
+AM_LDFLAGS = @AM_LDFLAGS@ $(am__append_1)
AM_MAKEFLAGS = @AM_MAKEFLAGS@
AR = @AR@
@@ -132,21 +145,18 @@ BYTESEX = @BYTESEX@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CC_VERSION = @CC_VERSION@
-
-# H5_CFLAGS holds flags that should be used as CFLAGS when building hdf5,
-# but which shouldn't be exported to h5cc for building other programs.
-CFLAGS = @CFLAGS@ @H5_CFLAGS@
+CFLAGS = @CFLAGS@
CLEARFILEBUF = @CLEARFILEBUF@
CODESTACK = @CODESTACK@
CONFIG_DATE = @CONFIG_DATE@
CONFIG_MODE = @CONFIG_MODE@
CONFIG_USER = @CONFIG_USER@
CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@ @H5_CPPFLAGS@
+CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@ @H5_CXXFLAGS@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_PKG = @DEBUG_PKG@
DEFAULT_API_VERSION = @DEFAULT_API_VERSION@
@@ -169,7 +179,7 @@ F9XMODEXT = @F9XMODEXT@
F9XMODFLAG = @F9XMODFLAG@
F9XSUFFIXFLAG = @F9XSUFFIXFLAG@
FC = @FC@
-FCFLAGS = @FCFLAGS@ @H5_FCFLAGS@
+FCFLAGS = @FCFLAGS@
FCFLAGS_f90 = @FCFLAGS_f90@
FCLIBS = @FCLIBS@
FGREP = @FGREP@
@@ -370,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 = 37
+LT_VERS_REVISION = 41
LT_VERS_AGE = 0
# Include src directory
@@ -380,10 +390,7 @@ INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/hl/src
lib_LTLIBRARIES = libhdf5_hl_cpp.la
# Add libtool numbers to the HDF5 HL C++ library (from config/lt_vers.am)
-libhdf5_hl_cpp_la_LDFLAGS = -version-info $(LT_VERS_INTERFACE):$(LT_VERS_REVISION):$(LT_VERS_AGE)
-
-# Shared C++ libraries aren't universally supported.
-@CXX_SHARED_CONDITIONAL_FALSE@AM_LDFLAGS = -static
+libhdf5_hl_cpp_la_LDFLAGS = -version-info $(LT_VERS_INTERFACE):$(LT_VERS_REVISION):$(LT_VERS_AGE) $(AM_LDFLAGS)
# Source files for the library
# At the moment, only the H5PT Packet Table has a C++ API.
diff --git a/hl/c++/test/Makefile.am b/hl/c++/test/Makefile.am
index beebc33..6dcea1c 100644
--- a/hl/c++/test/Makefile.am
+++ b/hl/c++/test/Makefile.am
@@ -26,7 +26,7 @@ INCLUDES=-I$(top_srcdir)/src -I$(top_srcdir)/c++/src -I$(top_srcdir)/hl/src -I$(
# Shared C++ libraries aren't universally supported.
if CXX_SHARED_CONDITIONAL
else
- AM_LDFLAGS=-static
+ AM_LDFLAGS+=-static
endif
# These are our main targets. They should be listed in the order to be
diff --git a/hl/c++/test/Makefile.in b/hl/c++/test/Makefile.in
index c2de2e7..6bb1a99 100644
--- a/hl/c++/test/Makefile.in
+++ b/hl/c++/test/Makefile.in
@@ -53,6 +53,9 @@ host_triplet = @host@
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(top_srcdir)/config/commence.am \
$(top_srcdir)/config/conclude.am
+
+# Shared C++ libraries aren't universally supported.
+@CXX_SHARED_CONDITIONAL_FALSE@am__append_1 = -static
check_PROGRAMS = $(am__EXEEXT_1)
TESTS = $(check_PROGRAMS)
subdir = hl/c++/test
@@ -93,6 +96,16 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = /home1/packages/automake/automake-1.9.6/bin/aclocal-1.9 -I /afs/ncsa/projects/hdf/packages/libtool_1.5.14/Linux_2.4/share/aclocal
ADD_PARALLEL_FILES = @ADD_PARALLEL_FILES@
AMTAR = @AMTAR@
+
+# H5_CFLAGS holds flags that should be used when building hdf5,
+# but which should not be exported to h5cc for building other programs.
+# AM_CFLAGS is an automake construct which should be used by Makefiles
+# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
+AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
+AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@
+AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
+AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@
+AM_LDFLAGS = @AM_LDFLAGS@ $(am__append_1)
AM_MAKEFLAGS = @AM_MAKEFLAGS@
AR = @AR@
@@ -106,21 +119,18 @@ BYTESEX = @BYTESEX@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CC_VERSION = @CC_VERSION@
-
-# H5_CFLAGS holds flags that should be used as CFLAGS when building hdf5,
-# but which shouldn't be exported to h5cc for building other programs.
-CFLAGS = @CFLAGS@ @H5_CFLAGS@
+CFLAGS = @CFLAGS@
CLEARFILEBUF = @CLEARFILEBUF@
CODESTACK = @CODESTACK@
CONFIG_DATE = @CONFIG_DATE@
CONFIG_MODE = @CONFIG_MODE@
CONFIG_USER = @CONFIG_USER@
CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@ @H5_CPPFLAGS@
+CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@ @H5_CXXFLAGS@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_PKG = @DEBUG_PKG@
DEFAULT_API_VERSION = @DEFAULT_API_VERSION@
@@ -143,7 +153,7 @@ F9XMODEXT = @F9XMODEXT@
F9XMODFLAG = @F9XMODFLAG@
F9XSUFFIXFLAG = @F9XSUFFIXFLAG@
FC = @FC@
-FCFLAGS = @FCFLAGS@ @H5_FCFLAGS@
+FCFLAGS = @FCFLAGS@
FCFLAGS_f90 = @FCFLAGS_f90@
FCLIBS = @FCLIBS@
FGREP = @FGREP@
@@ -344,9 +354,6 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog
# Include directories
INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/c++/src -I$(top_srcdir)/hl/src -I$(top_srcdir)/hl/c++/src -I$(top_srcdir)/test -I$(top_builddir)/hl/test -I$(top_srcdir)/hl/test
-# Shared C++ libraries aren't universally supported.
-@CXX_SHARED_CONDITIONAL_FALSE@AM_LDFLAGS = -static
-
# These are our main targets. They should be listed in the order to be
# executed, generally most specific tests to least specific tests.
TEST_PROG = ptableTest
diff --git a/hl/examples/Makefile.in b/hl/examples/Makefile.in
index 0a2ec12..0380eaf 100644
--- a/hl/examples/Makefile.in
+++ b/hl/examples/Makefile.in
@@ -76,6 +76,16 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = /home1/packages/automake/automake-1.9.6/bin/aclocal-1.9 -I /afs/ncsa/projects/hdf/packages/libtool_1.5.14/Linux_2.4/share/aclocal
ADD_PARALLEL_FILES = @ADD_PARALLEL_FILES@
AMTAR = @AMTAR@
+
+# H5_CFLAGS holds flags that should be used when building hdf5,
+# but which should not be exported to h5cc for building other programs.
+# AM_CFLAGS is an automake construct which should be used by Makefiles
+# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
+AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
+AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@
+AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
+AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@
+AM_LDFLAGS = @AM_LDFLAGS@
AM_MAKEFLAGS = @AM_MAKEFLAGS@
AR = @AR@
@@ -89,21 +99,18 @@ BYTESEX = @BYTESEX@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CC_VERSION = @CC_VERSION@
-
-# H5_CFLAGS holds flags that should be used as CFLAGS when building hdf5,
-# but which shouldn't be exported to h5cc for building other programs.
-CFLAGS = @CFLAGS@ @H5_CFLAGS@
+CFLAGS = @CFLAGS@
CLEARFILEBUF = @CLEARFILEBUF@
CODESTACK = @CODESTACK@
CONFIG_DATE = @CONFIG_DATE@
CONFIG_MODE = @CONFIG_MODE@
CONFIG_USER = @CONFIG_USER@
CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@ @H5_CPPFLAGS@
+CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@ @H5_CXXFLAGS@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_PKG = @DEBUG_PKG@
DEFAULT_API_VERSION = @DEFAULT_API_VERSION@
@@ -126,7 +133,7 @@ F9XMODEXT = @F9XMODEXT@
F9XMODFLAG = @F9XMODFLAG@
F9XSUFFIXFLAG = @F9XSUFFIXFLAG@
FC = @FC@
-FCFLAGS = @FCFLAGS@ @H5_FCFLAGS@
+FCFLAGS = @FCFLAGS@
FCFLAGS_f90 = @FCFLAGS_f90@
FCLIBS = @FCLIBS@
FGREP = @FGREP@
diff --git a/hl/fortran/Makefile.in b/hl/fortran/Makefile.in
index 9daf03a..79e0ce5 100644
--- a/hl/fortran/Makefile.in
+++ b/hl/fortran/Makefile.in
@@ -114,6 +114,16 @@ am__relativize = \
ACLOCAL = /home1/packages/automake/automake-1.9.6/bin/aclocal-1.9 -I /afs/ncsa/projects/hdf/packages/libtool_1.5.14/Linux_2.4/share/aclocal
ADD_PARALLEL_FILES = @ADD_PARALLEL_FILES@
AMTAR = @AMTAR@
+
+# H5_CFLAGS holds flags that should be used when building hdf5,
+# but which should not be exported to h5cc for building other programs.
+# AM_CFLAGS is an automake construct which should be used by Makefiles
+# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
+AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
+AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@
+AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
+AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@
+AM_LDFLAGS = @AM_LDFLAGS@
AM_MAKEFLAGS = @AM_MAKEFLAGS@
AR = @AR@
@@ -127,21 +137,18 @@ BYTESEX = @BYTESEX@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CC_VERSION = @CC_VERSION@
-
-# H5_CFLAGS holds flags that should be used as CFLAGS when building hdf5,
-# but which shouldn't be exported to h5cc for building other programs.
-CFLAGS = @CFLAGS@ @H5_CFLAGS@
+CFLAGS = @CFLAGS@
CLEARFILEBUF = @CLEARFILEBUF@
CODESTACK = @CODESTACK@
CONFIG_DATE = @CONFIG_DATE@
CONFIG_MODE = @CONFIG_MODE@
CONFIG_USER = @CONFIG_USER@
CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@ @H5_CPPFLAGS@
+CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@ @H5_CXXFLAGS@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_PKG = @DEBUG_PKG@
DEFAULT_API_VERSION = @DEFAULT_API_VERSION@
@@ -164,7 +171,7 @@ F9XMODEXT = @F9XMODEXT@
F9XMODFLAG = @F9XMODFLAG@
F9XSUFFIXFLAG = @F9XSUFFIXFLAG@
FC = @FC@
-FCFLAGS = @FCFLAGS@ @H5_FCFLAGS@
+FCFLAGS = @FCFLAGS@
FCFLAGS_f90 = @FCFLAGS_f90@
FCLIBS = @FCLIBS@
FGREP = @FGREP@
diff --git a/hl/fortran/examples/Makefile.in b/hl/fortran/examples/Makefile.in
index 0e59a7d..698ffbf 100644
--- a/hl/fortran/examples/Makefile.in
+++ b/hl/fortran/examples/Makefile.in
@@ -76,6 +76,16 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = /home1/packages/automake/automake-1.9.6/bin/aclocal-1.9 -I /afs/ncsa/projects/hdf/packages/libtool_1.5.14/Linux_2.4/share/aclocal
ADD_PARALLEL_FILES = @ADD_PARALLEL_FILES@
AMTAR = @AMTAR@
+
+# H5_CFLAGS holds flags that should be used when building hdf5,
+# but which should not be exported to h5cc for building other programs.
+# AM_CFLAGS is an automake construct which should be used by Makefiles
+# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
+AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
+AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@
+AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
+AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@
+AM_LDFLAGS = @AM_LDFLAGS@
AM_MAKEFLAGS = @AM_MAKEFLAGS@
AR = @AR@
@@ -89,21 +99,18 @@ BYTESEX = @BYTESEX@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CC_VERSION = @CC_VERSION@
-
-# H5_CFLAGS holds flags that should be used as CFLAGS when building hdf5,
-# but which shouldn't be exported to h5cc for building other programs.
-CFLAGS = @CFLAGS@ @H5_CFLAGS@
+CFLAGS = @CFLAGS@
CLEARFILEBUF = @CLEARFILEBUF@
CODESTACK = @CODESTACK@
CONFIG_DATE = @CONFIG_DATE@
CONFIG_MODE = @CONFIG_MODE@
CONFIG_USER = @CONFIG_USER@
CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@ @H5_CPPFLAGS@
+CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@ @H5_CXXFLAGS@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_PKG = @DEBUG_PKG@
DEFAULT_API_VERSION = @DEFAULT_API_VERSION@
@@ -126,7 +133,7 @@ F9XMODEXT = @F9XMODEXT@
F9XMODFLAG = @F9XMODFLAG@
F9XSUFFIXFLAG = @F9XSUFFIXFLAG@
FC = @FC@
-FCFLAGS = @FCFLAGS@ @H5_FCFLAGS@
+FCFLAGS = @FCFLAGS@
FCFLAGS_f90 = @FCFLAGS_f90@
FCLIBS = @FCLIBS@
FGREP = @FGREP@
diff --git a/hl/fortran/src/Makefile.am b/hl/fortran/src/Makefile.am
index fbc3908..d4fec65 100644
--- a/hl/fortran/src/Makefile.am
+++ b/hl/fortran/src/Makefile.am
@@ -24,20 +24,20 @@ include $(top_srcdir)/config/lt_vers.am
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
-AM_FCFLAGS=-I$(top_builddir)/fortran/src $(F9XMODFLAG)$(top_builddir)/fortran/src
+AM_FCFLAGS+=-I$(top_builddir)/fortran/src $(F9XMODFLAG)$(top_builddir)/fortran/src
# Our main target, the high-level fortran library
lib_LTLIBRARIES=libhdf5hl_fortran.la
# Add libtool numbers to the HDF5 HL Fortran library (from config/lt_vers.am)
-libhdf5hl_fortran_la_LDFLAGS= -version-info $(LT_VERS_INTERFACE):$(LT_VERS_REVISION):$(LT_VERS_AGE)
+libhdf5hl_fortran_la_LDFLAGS= -version-info $(LT_VERS_INTERFACE):$(LT_VERS_REVISION):$(LT_VERS_AGE) $(AM_LDFLAGS)
# Some Fortran compilers can't build shared libraries, so sometimes we
# want to build a shared C library and a static Fortran library. If so,
# pass the -static flag to the library linker.
if FORTRAN_SHARED_CONDITIONAL
else
- AM_LDFLAGS=-static
+ AM_LDFLAGS+=-static
endif
# Source files for the library
diff --git a/hl/fortran/src/Makefile.in b/hl/fortran/src/Makefile.in
index 35c4349..def1880 100644
--- a/hl/fortran/src/Makefile.in
+++ b/hl/fortran/src/Makefile.in
@@ -55,6 +55,11 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(top_srcdir)/config/commence.am \
$(top_srcdir)/config/conclude.am \
$(top_srcdir)/config/lt_vers.am
+
+# Some Fortran compilers can't build shared libraries, so sometimes we
+# want to build a shared C library and a static Fortran library. If so,
+# pass the -static flag to the library linker.
+@FORTRAN_SHARED_CONDITIONAL_FALSE@am__append_1 = -static
TESTS =
subdir = hl/fortran/src
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -125,6 +130,17 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = /home1/packages/automake/automake-1.9.6/bin/aclocal-1.9 -I /afs/ncsa/projects/hdf/packages/libtool_1.5.14/Linux_2.4/share/aclocal
ADD_PARALLEL_FILES = @ADD_PARALLEL_FILES@
AMTAR = @AMTAR@
+
+# H5_CFLAGS holds flags that should be used when building hdf5,
+# but which should not be exported to h5cc for building other programs.
+# AM_CFLAGS is an automake construct which should be used by Makefiles
+# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
+AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
+AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@
+AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
+AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@ -I$(top_builddir)/fortran/src \
+ $(F9XMODFLAG)$(top_builddir)/fortran/src
+AM_LDFLAGS = @AM_LDFLAGS@ $(am__append_1)
AM_MAKEFLAGS = @AM_MAKEFLAGS@
AR = @AR@
@@ -138,21 +154,18 @@ BYTESEX = @BYTESEX@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CC_VERSION = @CC_VERSION@
-
-# H5_CFLAGS holds flags that should be used as CFLAGS when building hdf5,
-# but which shouldn't be exported to h5cc for building other programs.
-CFLAGS = @CFLAGS@ @H5_CFLAGS@
+CFLAGS = @CFLAGS@
CLEARFILEBUF = @CLEARFILEBUF@
CODESTACK = @CODESTACK@
CONFIG_DATE = @CONFIG_DATE@
CONFIG_MODE = @CONFIG_MODE@
CONFIG_USER = @CONFIG_USER@
CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@ @H5_CPPFLAGS@
+CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@ @H5_CXXFLAGS@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_PKG = @DEBUG_PKG@
DEFAULT_API_VERSION = @DEFAULT_API_VERSION@
@@ -175,7 +188,7 @@ F9XMODEXT = @F9XMODEXT@
F9XMODFLAG = @F9XMODFLAG@
F9XSUFFIXFLAG = @F9XSUFFIXFLAG@
FC = @FC@
-FCFLAGS = @FCFLAGS@ @H5_FCFLAGS@
+FCFLAGS = @FCFLAGS@
FCFLAGS_f90 = @FCFLAGS_f90@
FCLIBS = @FCLIBS@
FGREP = @FGREP@
@@ -376,23 +389,17 @@ 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 = 37
+LT_VERS_REVISION = 41
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
-AM_FCFLAGS = -I$(top_builddir)/fortran/src $(F9XMODFLAG)$(top_builddir)/fortran/src
# Our main target, the high-level fortran library
lib_LTLIBRARIES = libhdf5hl_fortran.la
# Add libtool numbers to the HDF5 HL Fortran library (from config/lt_vers.am)
-libhdf5hl_fortran_la_LDFLAGS = -version-info $(LT_VERS_INTERFACE):$(LT_VERS_REVISION):$(LT_VERS_AGE)
-
-# Some Fortran compilers can't build shared libraries, so sometimes we
-# want to build a shared C library and a static Fortran library. If so,
-# pass the -static flag to the library linker.
-@FORTRAN_SHARED_CONDITIONAL_FALSE@AM_LDFLAGS = -static
+libhdf5hl_fortran_la_LDFLAGS = -version-info $(LT_VERS_INTERFACE):$(LT_VERS_REVISION):$(LT_VERS_AGE) $(AM_LDFLAGS)
# Source files for the library
#if BUILD_PARALLEL_CONDITIONAL
diff --git a/hl/fortran/test/Makefile.am b/hl/fortran/test/Makefile.am
index 9c94bed..7f149c8 100644
--- a/hl/fortran/test/Makefile.am
+++ b/hl/fortran/test/Makefile.am
@@ -21,15 +21,15 @@
include $(top_srcdir)/config/commence.am
-AM_CPPFLAGS=-I$(top_srcdir)/src -I$(top_builddir)/src -I$(top_srcdir)/hl/src
-AM_FCFLAGS=-I$(top_builddir)/fortran/src -I$(top_builddir)/hl/fortran/src $(F9XMODFLAG)$(top_builddir)/fortran/src $(F9XMODFLAG)$(top_builddir)/hl/fortran/src
+AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_builddir)/src -I$(top_srcdir)/hl/src
+AM_FCFLAGS+=-I$(top_builddir)/fortran/src -I$(top_builddir)/hl/fortran/src $(F9XMODFLAG)$(top_builddir)/fortran/src $(F9XMODFLAG)$(top_builddir)/hl/fortran/src
# Some Fortran compilers can't build shared libraries, so sometimes we
# need to make sure the Fortran programs link against the static version
# of the HDF5 library. We do this by passing the -static flag to the linker.
if FORTRAN_SHARED_CONDITIONAL
else
- AM_LDFLAGS=-static
+ AM_LDFLAGS+=-static
endif
# Our main target, the test programs
diff --git a/hl/fortran/test/Makefile.in b/hl/fortran/test/Makefile.in
index 8d9a94e..f395240 100644
--- a/hl/fortran/test/Makefile.in
+++ b/hl/fortran/test/Makefile.in
@@ -53,6 +53,11 @@ host_triplet = @host@
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(top_srcdir)/config/commence.am \
$(top_srcdir)/config/conclude.am
+
+# Some Fortran compilers can't build shared libraries, so sometimes we
+# need to make sure the Fortran programs link against the static version
+# of the HDF5 library. We do this by passing the -static flag to the linker.
+@FORTRAN_SHARED_CONDITIONAL_FALSE@am__append_1 = -static
check_PROGRAMS = $(am__EXEEXT_1)
TESTS = $(check_PROGRAMS)
subdir = hl/fortran/test
@@ -96,6 +101,20 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = /home1/packages/automake/automake-1.9.6/bin/aclocal-1.9 -I /afs/ncsa/projects/hdf/packages/libtool_1.5.14/Linux_2.4/share/aclocal
ADD_PARALLEL_FILES = @ADD_PARALLEL_FILES@
AMTAR = @AMTAR@
+
+# H5_CFLAGS holds flags that should be used when building hdf5,
+# but which should not be exported to h5cc for building other programs.
+# AM_CFLAGS is an automake construct which should be used by Makefiles
+# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
+AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
+AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@ -I$(top_srcdir)/src \
+ -I$(top_builddir)/src -I$(top_srcdir)/hl/src
+AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
+AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@ -I$(top_builddir)/fortran/src \
+ -I$(top_builddir)/hl/fortran/src \
+ $(F9XMODFLAG)$(top_builddir)/fortran/src \
+ $(F9XMODFLAG)$(top_builddir)/hl/fortran/src
+AM_LDFLAGS = @AM_LDFLAGS@ $(am__append_1)
AM_MAKEFLAGS = @AM_MAKEFLAGS@
AR = @AR@
@@ -109,21 +128,18 @@ BYTESEX = @BYTESEX@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CC_VERSION = @CC_VERSION@
-
-# H5_CFLAGS holds flags that should be used as CFLAGS when building hdf5,
-# but which shouldn't be exported to h5cc for building other programs.
-CFLAGS = @CFLAGS@ @H5_CFLAGS@
+CFLAGS = @CFLAGS@
CLEARFILEBUF = @CLEARFILEBUF@
CODESTACK = @CODESTACK@
CONFIG_DATE = @CONFIG_DATE@
CONFIG_MODE = @CONFIG_MODE@
CONFIG_USER = @CONFIG_USER@
CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@ @H5_CPPFLAGS@
+CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@ @H5_CXXFLAGS@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_PKG = @DEBUG_PKG@
DEFAULT_API_VERSION = @DEFAULT_API_VERSION@
@@ -146,7 +162,7 @@ F9XMODEXT = @F9XMODEXT@
F9XMODFLAG = @F9XMODFLAG@
F9XSUFFIXFLAG = @F9XSUFFIXFLAG@
FC = @FC@
-FCFLAGS = @FCFLAGS@ @H5_FCFLAGS@
+FCFLAGS = @FCFLAGS@
FCFLAGS_f90 = @FCFLAGS_f90@
FCLIBS = @FCLIBS@
FGREP = @FGREP@
@@ -346,13 +362,6 @@ TRACE = perl $(top_srcdir)/bin/trace
# Temporary files.
CHECK_CLEANFILES = *.chkexe *.chklog *.clog dsetf[1-4].h5 f1img.h5 \
f1tab.h5
-AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_builddir)/src -I$(top_srcdir)/hl/src
-AM_FCFLAGS = -I$(top_builddir)/fortran/src -I$(top_builddir)/hl/fortran/src $(F9XMODFLAG)$(top_builddir)/fortran/src $(F9XMODFLAG)$(top_builddir)/hl/fortran/src
-
-# Some Fortran compilers can't build shared libraries, so sometimes we
-# need to make sure the Fortran programs link against the static version
-# of the HDF5 library. We do this by passing the -static flag to the linker.
-@FORTRAN_SHARED_CONDITIONAL_FALSE@AM_LDFLAGS = -static
# Our main target, the test programs
TEST_PROG = tstlite tstimage tsttable
diff --git a/hl/src/H5DS.c b/hl/src/H5DS.c
index 8e697f1..e15c132 100644
--- a/hl/src/H5DS.c
+++ b/hl/src/H5DS.c
@@ -129,6 +129,7 @@ herr_t H5DSattach_scale(hid_t did,
hssize_t nelmts;
hid_t sid; /* space ID */
hid_t tid = -1; /* attribute type ID */
+ hid_t ntid = -1; /* attribute native type ID */
hid_t aid = -1; /* attribute ID */
int rank; /* rank of dataset */
hsize_t *dims=NULL; /* dimension of the "REFERENCE_LIST" array */
@@ -472,6 +473,9 @@ herr_t H5DSattach_scale(hid_t did,
if((tid = H5Aget_type(aid)) < 0)
goto out;
+
+ if((ntid = H5Tget_native_type(tid, H5T_DIR_DEFAULT)) < 0)
+ goto out;
/* get and save the old reference(s) */
if((sid = H5Aget_space(aid)) < 0)
@@ -487,7 +491,7 @@ herr_t H5DSattach_scale(hid_t did,
if (dsbuf == NULL)
goto out;
- if (H5Aread(aid,tid,dsbuf) < 0)
+ if (H5Aread(aid,ntid,dsbuf) < 0)
goto out;
/* close */
@@ -495,6 +499,8 @@ herr_t H5DSattach_scale(hid_t did,
goto out;
if (H5Aclose(aid) < 0)
goto out;
+ if (H5Tclose(ntid) < 0)
+ goto out;
/*-------------------------------------------------------------------------
* create a new attribute
@@ -586,6 +592,7 @@ out:
H5E_BEGIN_TRY {
H5Sclose(sid);
H5Aclose(aid);
+ H5Tclose(ntid);
H5Tclose(tid);
} H5E_END_TRY;
return FAIL;
@@ -631,6 +638,7 @@ herr_t H5DSdetach_scale(hid_t did,
hid_t did_i; /* dataset ID in REFERENCE_LIST */
hid_t sid; /* space ID */
hid_t tid = -1; /* attribute type ID */
+ hid_t ntid = -1; /* attribute native type ID */
hid_t aid = -1; /* attribute ID */
int rank; /* rank of dataset */
ds_list_t *dsbuf = NULL; /* array of attribute data in the DS pointing to the dataset */
@@ -823,6 +831,9 @@ herr_t H5DSdetach_scale(hid_t did,
if((tid = H5Aget_type(aid)) < 0)
goto out;
+
+ if((ntid = H5Tget_native_type(tid, H5T_DIR_DEFAULT)) < 0)
+ goto out;
/* get and save the old reference(s) */
if((sid = H5Aget_space(aid)) < 0)
@@ -835,7 +846,7 @@ herr_t H5DSdetach_scale(hid_t did,
if(dsbuf == NULL)
goto out;
- if (H5Aread(aid,tid,dsbuf) < 0)
+ if (H5Aread(aid,ntid,dsbuf) < 0)
goto out;
for(i=0; i<nelmts; i++)
@@ -879,6 +890,8 @@ herr_t H5DSdetach_scale(hid_t did,
goto out;
if (H5Aclose(aid) < 0)
goto out;
+ if (H5Tclose(ntid) < 0)
+ goto out;
/*-------------------------------------------------------------------------
* check if we found the pointed dataset
@@ -961,6 +974,7 @@ out:
H5E_BEGIN_TRY {
H5Sclose(sid);
H5Aclose(aid);
+ H5Tclose(ntid);
H5Tclose(tid);
if (dsbuf)
@@ -1024,6 +1038,7 @@ htri_t H5DSis_attached(hid_t did,
hssize_t nelmts;
hid_t sid; /* space ID */
hid_t tid = -1; /* attribute type ID */
+ hid_t ntid = -1; /* attribute native type ID */
hid_t aid = -1; /* attribute ID */
int rank; /* rank of dataset */
ds_list_t *dsbuf; /* array of attribute data in the DS pointing to the dataset */
@@ -1187,7 +1202,10 @@ htri_t H5DSis_attached(hid_t did,
if((tid = H5Aget_type(aid)) < 0)
goto out;
-
+
+ if((ntid = H5Tget_native_type(tid, H5T_DIR_DEFAULT)) < 0)
+ goto out;
+
/* get and save the old reference(s) */
if((sid = H5Aget_space(aid)) < 0)
goto out;
@@ -1200,7 +1218,7 @@ htri_t H5DSis_attached(hid_t did,
if (dsbuf == NULL)
goto out;
- if (H5Aread(aid,tid,dsbuf) < 0)
+ if (H5Aread(aid,ntid,dsbuf) < 0)
goto out;
/*-------------------------------------------------------------------------
@@ -1242,6 +1260,8 @@ htri_t H5DSis_attached(hid_t did,
/* close */
if (H5Sclose(sid) < 0)
goto out;
+ if (H5Tclose(ntid) < 0)
+ goto out;
if (H5Tclose(tid) < 0)
goto out;
if (H5Aclose(aid) < 0)
diff --git a/hl/src/Makefile.am b/hl/src/Makefile.am
index 3ee186e..0eecbbb 100644
--- a/hl/src/Makefile.am
+++ b/hl/src/Makefile.am
@@ -22,13 +22,13 @@ include $(top_srcdir)/config/commence.am
include $(top_srcdir)/config/lt_vers.am
# Add include directories to the C preprocessor flags
-AM_CPPFLAGS=-I$(top_srcdir)/src
+AM_CPPFLAGS+=-I$(top_srcdir)/src
# This library is our main target.
lib_LTLIBRARIES=libhdf5_hl.la
# Add libtool numbers to the HDF5 hl library (from config/lt_vers.am)
-libhdf5_hl_la_LDFLAGS= -version-info $(LT_VERS_INTERFACE):$(LT_VERS_REVISION):$(LT_VERS_AGE)
+libhdf5_hl_la_LDFLAGS= -version-info $(LT_VERS_INTERFACE):$(LT_VERS_REVISION):$(LT_VERS_AGE) $(AM_LDFLAGS)
libhdf5_hl_la_SOURCES=H5DS.c H5IM.c H5LT.c H5LTanalyze.c H5LTparse.c H5PT.c H5TB.c
diff --git a/hl/src/Makefile.in b/hl/src/Makefile.in
index 9df4093..35282d2 100644
--- a/hl/src/Makefile.in
+++ b/hl/src/Makefile.in
@@ -120,6 +120,18 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = /home1/packages/automake/automake-1.9.6/bin/aclocal-1.9 -I /afs/ncsa/projects/hdf/packages/libtool_1.5.14/Linux_2.4/share/aclocal
ADD_PARALLEL_FILES = @ADD_PARALLEL_FILES@
AMTAR = @AMTAR@
+
+# H5_CFLAGS holds flags that should be used when building hdf5,
+# but which should not be exported to h5cc for building other programs.
+# AM_CFLAGS is an automake construct which should be used by Makefiles
+# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
+AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
+
+# Add include directories to the C preprocessor flags
+AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@ -I$(top_srcdir)/src
+AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
+AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@
+AM_LDFLAGS = @AM_LDFLAGS@
AM_MAKEFLAGS = @AM_MAKEFLAGS@
AR = @AR@
@@ -133,21 +145,18 @@ BYTESEX = @BYTESEX@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CC_VERSION = @CC_VERSION@
-
-# H5_CFLAGS holds flags that should be used as CFLAGS when building hdf5,
-# but which shouldn't be exported to h5cc for building other programs.
-CFLAGS = @CFLAGS@ @H5_CFLAGS@
+CFLAGS = @CFLAGS@
CLEARFILEBUF = @CLEARFILEBUF@
CODESTACK = @CODESTACK@
CONFIG_DATE = @CONFIG_DATE@
CONFIG_MODE = @CONFIG_MODE@
CONFIG_USER = @CONFIG_USER@
CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@ @H5_CPPFLAGS@
+CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@ @H5_CXXFLAGS@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_PKG = @DEBUG_PKG@
DEFAULT_API_VERSION = @DEFAULT_API_VERSION@
@@ -170,7 +179,7 @@ F9XMODEXT = @F9XMODEXT@
F9XMODFLAG = @F9XMODFLAG@
F9XSUFFIXFLAG = @F9XSUFFIXFLAG@
FC = @FC@
-FCFLAGS = @FCFLAGS@ @H5_FCFLAGS@
+FCFLAGS = @FCFLAGS@
FCFLAGS_f90 = @FCFLAGS_f90@
FCLIBS = @FCLIBS@
FGREP = @FGREP@
@@ -371,17 +380,14 @@ 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 = 37
+LT_VERS_REVISION = 41
LT_VERS_AGE = 0
-# Add include directories to the C preprocessor flags
-AM_CPPFLAGS = -I$(top_srcdir)/src
-
# This library is our main target.
lib_LTLIBRARIES = libhdf5_hl.la
# Add libtool numbers to the HDF5 hl library (from config/lt_vers.am)
-libhdf5_hl_la_LDFLAGS = -version-info $(LT_VERS_INTERFACE):$(LT_VERS_REVISION):$(LT_VERS_AGE)
+libhdf5_hl_la_LDFLAGS = -version-info $(LT_VERS_INTERFACE):$(LT_VERS_REVISION):$(LT_VERS_AGE) $(AM_LDFLAGS)
libhdf5_hl_la_SOURCES = H5DS.c H5IM.c H5LT.c H5LTanalyze.c H5LTparse.c H5PT.c H5TB.c
# Public header files (to be installed)
diff --git a/hl/test/Makefile.am b/hl/test/Makefile.am
index 1e8a380..fc6e969 100644
--- a/hl/test/Makefile.am
+++ b/hl/test/Makefile.am
@@ -22,7 +22,7 @@
include $(top_srcdir)/config/commence.am
# Add include directories to C preprocessor flags
-AM_CPPFLAGS=-I. -I$(srcdir) -I$(top_builddir)/src -I$(top_srcdir)/src -I$(top_builddir)/test -I$(top_srcdir)/test -I$(top_srcdir)/hl/src
+AM_CPPFLAGS+=-I. -I$(srcdir) -I$(top_builddir)/src -I$(top_srcdir)/src -I$(top_builddir)/test -I$(top_srcdir)/test -I$(top_srcdir)/hl/src
# The tests depend on the hdf5, hdf5 test, and hdf5_hl libraries
LDADD=$(LIBH5_HL) $(LIBH5TEST) $(LIBHDF5)
@@ -32,8 +32,19 @@ LDADD=$(LIBH5_HL) $(LIBH5TEST) $(LIBHDF5)
TEST_PROG=test_lite test_image test_table test_ds test_packet
check_PROGRAMS=$(TEST_PROG)
+# These programs generate test files for the tests. They don't need to be
+# compiled every time we want to test the library. However, putting
+# them in a conditional causes automake to generate rules so that they
+# can be built by hand. They can also be built by specifying
+# --enable-build-all at configure time.
+BUILD_ALL_PROGS=gen_test_ds
+
+if BUILD_ALL_CONDITIONAL
+ noinst_PROGRAMS=$(BUILD_ALL_PROGS)
+endif
+
# Temporary files. These files are the ones created by running `make test'.
-CHECK_CLEANFILES+=combine_tables[1-2].h5 test_ds[1-7].h5 test_image[1-3].h5 \
+CHECK_CLEANFILES+=combine_tables[1-2].h5 test_ds[1-9].h5 test_image[1-3].h5 \
test_lite[1-2].h5 test_table.h5 test_packet_table.h5 \
test_packet_compress.h5
diff --git a/hl/test/Makefile.in b/hl/test/Makefile.in
index 8913eef..4a5aa5b 100644
--- a/hl/test/Makefile.in
+++ b/hl/test/Makefile.in
@@ -33,6 +33,7 @@
#
# HDF5 High-Level Test Makefile(.in)
#
+
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
@@ -56,6 +57,7 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(top_srcdir)/config/commence.am \
$(top_srcdir)/config/conclude.am COPYING
check_PROGRAMS = $(am__EXEEXT_1)
+@BUILD_ALL_CONDITIONAL_TRUE@noinst_PROGRAMS = $(am__EXEEXT_2)
TESTS = $(check_PROGRAMS)
subdir = hl/test
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -68,6 +70,12 @@ CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
am__EXEEXT_1 = test_lite$(EXEEXT) test_image$(EXEEXT) \
test_table$(EXEEXT) test_ds$(EXEEXT) test_packet$(EXEEXT)
+am__EXEEXT_2 = gen_test_ds$(EXEEXT)
+PROGRAMS = $(noinst_PROGRAMS)
+gen_test_ds_SOURCES = gen_test_ds.c
+gen_test_ds_OBJECTS = gen_test_ds.$(OBJEXT)
+gen_test_ds_LDADD = $(LDADD)
+gen_test_ds_DEPENDENCIES = $(LIBH5_HL) $(LIBH5TEST) $(LIBHDF5)
test_ds_SOURCES = test_ds.c
test_ds_OBJECTS = test_ds.$(OBJEXT)
test_ds_LDADD = $(LDADD)
@@ -101,10 +109,10 @@ CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
-SOURCES = test_ds.c test_image.c test_lite.c test_packet.c \
- test_table.c
-DIST_SOURCES = test_ds.c test_image.c test_lite.c test_packet.c \
- test_table.c
+SOURCES = gen_test_ds.c test_ds.c test_image.c test_lite.c \
+ test_packet.c test_table.c
+DIST_SOURCES = gen_test_ds.c test_ds.c test_image.c test_lite.c \
+ test_packet.c test_table.c
ETAGS = etags
CTAGS = ctags
am__tty_colors = \
@@ -113,6 +121,21 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = /home1/packages/automake/automake-1.9.6/bin/aclocal-1.9 -I /afs/ncsa/projects/hdf/packages/libtool_1.5.14/Linux_2.4/share/aclocal
ADD_PARALLEL_FILES = @ADD_PARALLEL_FILES@
AMTAR = @AMTAR@
+
+# H5_CFLAGS holds flags that should be used when building hdf5,
+# but which should not be exported to h5cc for building other programs.
+# AM_CFLAGS is an automake construct which should be used by Makefiles
+# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
+AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
+
+# Add include directories to C preprocessor flags
+AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@ -I. -I$(srcdir) \
+ -I$(top_builddir)/src -I$(top_srcdir)/src \
+ -I$(top_builddir)/test -I$(top_srcdir)/test \
+ -I$(top_srcdir)/hl/src
+AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
+AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@
+AM_LDFLAGS = @AM_LDFLAGS@
AM_MAKEFLAGS = @AM_MAKEFLAGS@
AR = @AR@
@@ -126,21 +149,18 @@ BYTESEX = @BYTESEX@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CC_VERSION = @CC_VERSION@
-
-# H5_CFLAGS holds flags that should be used as CFLAGS when building hdf5,
-# but which shouldn't be exported to h5cc for building other programs.
-CFLAGS = @CFLAGS@ @H5_CFLAGS@
+CFLAGS = @CFLAGS@
CLEARFILEBUF = @CLEARFILEBUF@
CODESTACK = @CODESTACK@
CONFIG_DATE = @CONFIG_DATE@
CONFIG_MODE = @CONFIG_MODE@
CONFIG_USER = @CONFIG_USER@
CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@ @H5_CPPFLAGS@
+CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@ @H5_CXXFLAGS@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_PKG = @DEBUG_PKG@
DEFAULT_API_VERSION = @DEFAULT_API_VERSION@
@@ -163,7 +183,7 @@ F9XMODEXT = @F9XMODEXT@
F9XMODFLAG = @F9XMODFLAG@
F9XSUFFIXFLAG = @F9XSUFFIXFLAG@
FC = @FC@
-FCFLAGS = @FCFLAGS@ @H5_FCFLAGS@
+FCFLAGS = @FCFLAGS@
FCFLAGS_f90 = @FCFLAGS_f90@
FCLIBS = @FCLIBS@
FGREP = @FGREP@
@@ -362,12 +382,9 @@ TRACE = perl $(top_srcdir)/bin/trace
# Temporary files. These files are the ones created by running `make test'.
CHECK_CLEANFILES = *.chkexe *.chklog *.clog combine_tables[1-2].h5 \
- test_ds[1-7].h5 test_image[1-3].h5 test_lite[1-2].h5 \
+ test_ds[1-9].h5 test_image[1-3].h5 test_lite[1-2].h5 \
test_table.h5 test_packet_table.h5 test_packet_compress.h5
-# Add include directories to C preprocessor flags
-AM_CPPFLAGS = -I. -I$(srcdir) -I$(top_builddir)/src -I$(top_srcdir)/src -I$(top_builddir)/test -I$(top_srcdir)/test -I$(top_srcdir)/hl/src
-
# The tests depend on the hdf5, hdf5 test, and hdf5_hl libraries
LDADD = $(LIBH5_HL) $(LIBH5TEST) $(LIBHDF5)
@@ -375,6 +392,13 @@ LDADD = $(LIBH5_HL) $(LIBH5TEST) $(LIBHDF5)
# order to be executed, generally most specific tests to least specific tests.
TEST_PROG = test_lite test_image test_table test_ds test_packet
+# These programs generate test files for the tests. They don't need to be
+# compiled every time we want to test the library. However, putting
+# them in a conditional causes automake to generate rules so that they
+# can be built by hand. They can also be built by specifying
+# --enable-build-all at configure time.
+BUILD_ALL_PROGS = gen_test_ds
+
# Automake needs to be taught how to build lib, progs, and tests targets.
# These will be filled in automatically for the most part (e.g.,
# lib_LIBRARIES are built for lib target), but EXTRA_LIB, EXTRA_PROG, and
@@ -433,6 +457,18 @@ clean-checkPROGRAMS:
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
echo " rm -f" $$list; \
rm -f $$list
+
+clean-noinstPROGRAMS:
+ @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \
+ echo " rm -f" $$list; \
+ rm -f $$list || exit $$?; \
+ test -n "$(EXEEXT)" || exit 0; \
+ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f" $$list; \
+ rm -f $$list
+gen_test_ds$(EXEEXT): $(gen_test_ds_OBJECTS) $(gen_test_ds_DEPENDENCIES)
+ @rm -f gen_test_ds$(EXEEXT)
+ $(LINK) $(gen_test_ds_OBJECTS) $(gen_test_ds_LDADD) $(LIBS)
test_ds$(EXEEXT): $(test_ds_OBJECTS) $(test_ds_DEPENDENCIES)
@rm -f test_ds$(EXEEXT)
$(LINK) $(test_ds_OBJECTS) $(test_ds_LDADD) $(LIBS)
@@ -455,6 +491,7 @@ mostlyclean-compile:
distclean-compile:
-rm -f *.tab.c
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gen_test_ds.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_ds.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_image.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_lite.Po@am__quote@
@@ -574,7 +611,7 @@ check-am: all-am
$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
$(MAKE) $(AM_MAKEFLAGS) check-TESTS
check: check-am
-all-am: Makefile all-local
+all-am: Makefile $(PROGRAMS) all-local
installdirs:
install: install-am
install-exec: install-exec-am
@@ -604,7 +641,7 @@ maintainer-clean-generic:
clean: clean-am
clean-am: clean-checkPROGRAMS clean-generic clean-libtool \
- mostlyclean-am
+ clean-noinstPROGRAMS mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
@@ -675,15 +712,15 @@ uninstall-am:
.MAKE: check-am install-am install-strip
.PHONY: CTAGS GTAGS all all-am all-local check check-TESTS check-am \
- clean clean-checkPROGRAMS clean-generic clean-libtool ctags \
- distclean distclean-compile distclean-generic \
- distclean-libtool distclean-tags distdir dvi dvi-am html \
- html-am info info-am install install-am install-data \
- install-data-am install-dvi install-dvi-am install-exec \
- install-exec-am install-html install-html-am install-info \
- install-info-am install-man install-pdf install-pdf-am \
- install-ps install-ps-am install-strip installcheck \
- installcheck-am installdirs maintainer-clean \
+ clean clean-checkPROGRAMS clean-generic clean-libtool \
+ clean-noinstPROGRAMS ctags distclean distclean-compile \
+ distclean-generic distclean-libtool distclean-tags distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool mostlyclean-local pdf \
pdf-am ps ps-am tags uninstall uninstall-am
diff --git a/hl/test/gen_test_ds.c b/hl/test/gen_test_ds.c
new file mode 100644
index 0000000..573fe20
--- /dev/null
+++ b/hl/test/gen_test_ds.c
@@ -0,0 +1,595 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Purpose: This program is run to generate an HDF5 data file with datasets
+ * that use dimension scales.
+ *
+ * Compile and run this program to generate the "test_ds_xx.h5"
+ * file, where xx is "le" on a little-endian machine and "be"
+ * on a big-endian machine.
+ * Move it to the test directory in the current branch.
+ * The test: test_foreign_scaleattached(const char *fileforeign)
+ * in test_ds.c will read them.
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include "h5hltest.h"
+#include "H5DSpublic.h"
+#include "H5LTpublic.h"
+
+/* prototypes */
+static hid_t open_test_file(const char *fileext);
+herr_t create_long_dataset(hid_t fid, const char *dsname, const char *dsidx);
+herr_t test_attach_scale(hid_t fid, hid_t did, const char *name, unsigned int idx);
+herr_t test_detach_scale(hid_t fid, hid_t did, const char *name, unsigned int idx);
+herr_t test_set_scalename(hid_t fid, hid_t did, const char *name, const char *scalename, unsigned int idx);
+herr_t test_cmp_scalename(hid_t fid, hid_t did, const char *name, const char *scalename, unsigned int idx);
+
+static int test_long_attachscales(const char *filename);
+static int test_duplicatelong_attachscales(const char *filename);
+static int test_long_scalenames(const char *filename);
+static int test_samelong_scalenames(const char *filename);
+static int test_foreign_scaleattached(const char *filename);
+
+
+#define DIM_DATA 12
+#define DIM1_SIZE 3
+#define DIM2_SIZE 4
+#define DIM3_SIZE 12
+#define DIM4_SIZE 2
+#define DIM0 0
+#define DIM1 1
+#define DIM2 2
+#define DIM3 3
+
+#define DATASET_NAME "dset_"
+#define DS_1_NAME "ds_1_"
+#define DS_2_NAME "ds_2_"
+#define DS_3_NAME "ds_3_"
+#define DS_4_NAME "ds_4_"
+
+#define SCALE_1_NAME "scalename_1_"
+#define SCALE_2_NAME "scalename_2_"
+#define SCALE_3_NAME "scalename_3_"
+#define SCALE_4_NAME "scalename_4_"
+
+#define FILENAME "test_ds_"
+#define FILEEXT ".h5"
+
+/*-------------------------------------------------------------------------
+ * the main program
+ *-------------------------------------------------------------------------
+ */
+int main(int argc , char **argv)
+{
+ int nerrors=0;
+ char filename[65];
+
+
+ if (argc < 2) {
+ printf("Usage: gen_test [le | be]\n");
+ return 1;
+ }
+
+ if ( argv[1] && (strcmp("le",argv[1])!=0) && (strcmp("be",argv[1])!=0) ) {
+ printf("Usage: gen_test [le | be]\n");
+ return 1;
+ }
+
+ /* create file to be used in following tests */
+ strcpy(filename, FILENAME);
+ strcat(filename, argv[1]);
+ strcat(filename, FILEEXT);
+ if(H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT) < 0) {
+ nerrors = 1;
+ goto error;
+ }
+ nerrors += test_long_attachscales(filename) < 0 ? 1 : 0;
+ nerrors += test_duplicatelong_attachscales(filename) < 0 ? 1 : 0;
+ nerrors += test_samelong_scalenames(filename) < 0 ? 1 : 0;
+ nerrors += test_foreign_scaleattached(filename) < 0 ? 1 : 0;
+
+
+ if(nerrors) goto error;
+ printf("Dimension scales file generation passed.\n");
+ return 0;
+
+error:
+ printf("***** %d DIMENSION SCALES FILE GENERATION FAILED! *****\n",nerrors);
+ return 1;
+}
+
+static hid_t open_test_file(const char *fileext)
+{
+ char filename[65];
+
+ strcpy(filename, FILENAME);
+ strcat(filename, fileext);
+ strcat(filename, FILEEXT);
+
+ return H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT);
+}
+
+/*-------------------------------------------------------------------------
+ * create "data" dataset
+ *-------------------------------------------------------------------------
+ */
+
+herr_t create_long_dataset(hid_t fid, const char *name, const char *dsidx)
+{
+ int rank = 4;
+ int rankds = 1;
+ hsize_t dims[4] = {DIM1_SIZE,DIM2_SIZE,DIM3_SIZE,DIM4_SIZE};
+ long buf[DIM_DATA*3*2] = {1,2,3,4,5,6,7,8,9,10,11,12,
+ 1,2,3,4,5,6,7,8,9,10,11,12,1,2,3,4,5,6,7,8,9,10,11,12,
+ 1,2,3,4,5,6,7,8,9,10,11,12,1,2,3,4,5,6,7,8,9,10,11,12,
+ 1,2,3,4,5,6,7,8,9,10,11,12};
+ hsize_t s1_dim[1] = {DIM1_SIZE};
+ hsize_t s2_dim[1] = {DIM2_SIZE};
+ hsize_t s3_dim[1] = {DIM3_SIZE};
+ hsize_t s4_dim[1] = {DIM4_SIZE};
+ long s1_wbuf[DIM1_SIZE] = {10,20,30};
+ long s2_wbuf[DIM2_SIZE] = {100,200,300,400};
+ long s3_wbuf[DIM3_SIZE] = {10,10,10,20,20,20,30,30,30,40,40,40};
+ long s4_wbuf[DIM4_SIZE] = {18,18};
+
+ /* make a dataset */
+ if(H5LTmake_dataset_long(fid, name, rank, dims, buf) >= 0) {
+ /* make a DS dataset for the first dimension */
+ char dsname[32];
+
+ strcpy(dsname, DS_1_NAME);
+ strcat(dsname, dsidx);
+ /* make a DS dataset for the first dimension */
+ if(H5LTmake_dataset_long(fid, dsname, rankds, s1_dim, s1_wbuf) < 0)
+ return FAIL;
+
+ strcpy(dsname, DS_2_NAME);
+ strcat(dsname, dsidx);
+ /* make a DS dataset for the first dimension */
+ if(H5LTmake_dataset_long(fid, dsname, rankds, s2_dim, s2_wbuf) < 0)
+ return FAIL;
+
+ strcpy(dsname, DS_3_NAME);
+ strcat(dsname, dsidx);
+ /* make a DS dataset for the first dimension */
+ if(H5LTmake_dataset_long(fid, dsname, rankds, s3_dim, s3_wbuf) < 0)
+ return FAIL;
+
+ strcpy(dsname, DS_4_NAME);
+ strcat(dsname, dsidx);
+ /* make a DS dataset for the first dimension */
+ if(H5LTmake_dataset_long(fid, dsname, rankds, s4_dim, s4_wbuf) < 0)
+ return FAIL;
+ }
+ else
+ return FAIL;
+ return SUCCEED;
+}
+
+herr_t test_attach_scale(hid_t fid, hid_t did, const char *name, unsigned int idx)
+{
+ herr_t ret_value = FAIL;
+ hid_t dsid = -1;
+
+ if((dsid = H5Dopen2(fid, name, H5P_DEFAULT)) >= 0) {
+ if(H5DSis_attached(did, dsid, idx) == 0) {
+ if(H5DSattach_scale(did, dsid, idx) >= 0) {
+ if(H5DSis_attached(did, dsid, idx) > 0) {
+ /* printf(" scale attached "); */
+ ret_value = SUCCEED;
+ }
+ else if(H5DSis_attached(did, dsid, idx) == 0) {
+ printf(" scale not attached ");
+ }
+ }
+ }
+ if(H5Dclose(dsid) < 0)
+ ret_value = FAIL;
+ }
+
+ return ret_value;
+}
+
+herr_t test_detach_scale(hid_t fid, hid_t did, const char *name, unsigned int idx)
+{
+ herr_t ret_value = FAIL;
+ hid_t dsid = -1;
+
+ if((dsid = H5Dopen2(fid, name, H5P_DEFAULT)) >= 0) {
+ if(H5DSis_attached(did, dsid, idx) == 1) {
+ if(H5DSdetach_scale(did, dsid, idx) >= 0) {
+ if(H5DSis_attached(did, dsid, idx) == 0) {
+ ret_value = SUCCEED;
+ }
+ }
+ }
+ if(H5Dclose(dsid) < 0)
+ ret_value = FAIL;
+ }
+
+ return ret_value;
+}
+
+herr_t test_set_scalename(hid_t fid, hid_t did, const char *name, const char *scalename, unsigned int idx)
+{
+ herr_t ret_value = FAIL;
+ hid_t dsid = -1;
+
+ if((dsid = H5Dopen2(fid, name, H5P_DEFAULT)) >= 0) {
+ if(H5DSis_attached(did, dsid, idx) == 1) {
+ if(H5DSset_scale(dsid, scalename) >= 0) {
+ if(H5DSis_attached(did, dsid, idx) == 1) {
+ ret_value = SUCCEED;
+ }
+ }
+ }
+ if(H5Dclose(dsid) < 0)
+ ret_value = FAIL;
+ }
+
+ return ret_value;
+}
+
+herr_t test_cmp_scalename(hid_t fid, hid_t did, const char *name, const char *scalename, unsigned int idx)
+{
+ herr_t ret_value = FAIL;
+ hid_t dsid = -1;
+ ssize_t name_len;
+ char *name_out=NULL;
+
+ if((dsid = H5Dopen2(fid, name, H5P_DEFAULT)) >= 0) {
+ if(H5DSis_attached(did, dsid, idx) == 1) {
+ if((name_len=H5DSget_scale_name(dsid,NULL,(size_t)0)) > 0) {
+ name_out = (char*)malloc((size_t)name_len * sizeof (char));
+ if(name_out != NULL) {
+ if(H5DSget_scale_name(dsid, name_out, (size_t)name_len) >= 0) {
+ if(strcmp(scalename,name_out)==0) {
+ ret_value = SUCCEED;
+ }
+ free(name_out);
+ name_out=NULL;
+ }
+ }
+ }
+ }
+ if(H5Dclose(dsid) < 0)
+ ret_value = FAIL;
+ }
+
+ return ret_value;
+}
+
+static int test_long_attachscales(const char *filename)
+{
+ hid_t fid = -1;
+ hid_t did = -1;
+ char dsname[32];
+ char scalename[32];
+ strcpy(dsname, DATASET_NAME);
+ strcat(dsname, "al");
+
+ TESTING2("test_long_attachscales");
+
+ if((fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ goto out;
+
+ /* make a dataset */
+ if(create_long_dataset(fid, dsname, "al") < 0)
+ goto out;
+
+ if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
+ strcpy(scalename, DS_1_NAME);
+ strcat(scalename, "al");
+ if(test_attach_scale(fid, did, scalename, DIM0) < 0)
+ goto out;
+
+ strcpy(scalename, DS_2_NAME);
+ strcat(scalename, "al");
+ if(test_attach_scale(fid, did, scalename, DIM1) < 0)
+ goto out;
+
+ strcpy(scalename, DS_3_NAME);
+ strcat(scalename, "al");
+ if(test_attach_scale(fid, did, scalename, DIM2) < 0)
+ goto out;
+
+ strcpy(scalename, DS_4_NAME);
+ strcat(scalename, "al");
+ if(test_attach_scale(fid, did, scalename, DIM3) < 0)
+ goto out;
+
+ if(H5Dclose(did) < 0)
+ goto out;
+ }
+ else
+ goto out;
+
+ PASSED();
+
+ H5Fclose(fid);
+ return SUCCEED;
+
+out:
+ H5E_BEGIN_TRY {
+ H5Dclose(did);
+ H5Fclose(fid);
+ } H5E_END_TRY;
+
+ H5_FAILED();
+
+ return FAIL;
+}
+
+static int test_duplicatelong_attachscales(const char *filename)
+{
+ hid_t fid = -1;
+ hid_t did = -1;
+ char dsname[32];
+ char scalename[32];
+ strcpy(dsname, DATASET_NAME);
+ strcat(dsname, "al2");
+
+ TESTING2("test_duplicatelong_attachscales");
+
+ if((fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ goto out;
+
+ /* make a dataset 2 */
+ if(create_long_dataset(fid, dsname, "al2") < 0)
+ goto out;
+
+ if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
+ strcpy(scalename, DS_1_NAME);
+ strcat(scalename, "al");
+ if(test_attach_scale(fid, did, scalename, DIM0) < 0)
+ goto out;
+
+ strcpy(scalename, DS_2_NAME);
+ strcat(scalename, "al");
+ if(test_attach_scale(fid, did, scalename, DIM1) < 0)
+ goto out;
+
+ strcpy(scalename, DS_3_NAME);
+ strcat(scalename, "al");
+ if(test_attach_scale(fid, did, scalename, DIM2) < 0)
+ goto out;
+
+ strcpy(scalename, DS_4_NAME);
+ strcat(scalename, "al");
+ if(test_attach_scale(fid, did, scalename, DIM3) < 0)
+ goto out;
+
+ if(H5Dclose(did) < 0)
+ goto out;
+ }
+ else
+ goto out;
+
+ PASSED();
+
+ H5Fclose(fid);
+ return SUCCEED;
+
+out:
+ H5E_BEGIN_TRY {
+ H5Dclose(did);
+ H5Fclose(fid);
+ } H5E_END_TRY;
+
+ H5_FAILED();
+
+ return FAIL;
+}
+
+static int test_long_scalenames(const char *filename) {
+ hid_t fid = -1;
+ hid_t did = -1;
+ char dsname[32];
+ char scalename[32];
+ char name[32];
+ strcpy(dsname, DATASET_NAME);
+ strcat(dsname, "al");
+
+ if((fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ goto out;
+
+ TESTING2("set long scale/cmp scale name");
+ if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
+ strcpy(scalename, DS_1_NAME);
+ strcat(scalename, "al");
+ strcpy(name, SCALE_1_NAME);
+ strcat(name, "al");
+ if(test_set_scalename(fid, did, scalename, name, DIM0) < 0)
+ goto out;
+
+ if(test_cmp_scalename(fid, did, scalename, name, DIM0) < 0)
+ goto out;
+
+ strcpy(scalename, DS_2_NAME);
+ strcat(scalename, "al");
+ strcpy(name, SCALE_2_NAME);
+ strcat(name, "al");
+ if(test_set_scalename(fid, did, scalename, name, DIM1) < 0)
+ goto out;
+
+ if(test_cmp_scalename(fid, did, scalename, name, DIM1) < 0)
+ goto out;
+
+ strcpy(scalename, DS_3_NAME);
+ strcat(scalename, "al");
+ strcpy(name, SCALE_3_NAME);
+ strcat(name, "al");
+ if(test_set_scalename(fid, did, scalename, name, DIM2) < 0)
+ goto out;
+
+ if(test_cmp_scalename(fid, did, scalename, name, DIM2) < 0)
+ goto out;
+
+ strcpy(scalename, DS_4_NAME);
+ strcat(scalename, "al");
+ strcpy(name, SCALE_4_NAME);
+ strcat(name, "al");
+ if(test_set_scalename(fid, did, scalename, name, DIM3) < 0)
+ goto out;
+
+ if(test_cmp_scalename(fid, did, scalename, name, DIM3) < 0)
+ goto out;
+
+ if(H5Dclose(did) < 0)
+ goto out;
+ }
+ else
+ goto out;
+
+ PASSED();
+
+ H5Fclose(fid);
+ return SUCCEED;
+
+out:
+ H5E_BEGIN_TRY {
+ H5Dclose(did);
+ H5Fclose(fid);
+ } H5E_END_TRY;
+
+ H5_FAILED();
+
+ return FAIL;
+}
+
+static int test_samelong_scalenames(const char *filename) {
+ hid_t fid = -1;
+ hid_t did = -1;
+ char dsname[32];
+ char scalename[32];
+ char name[32];
+
+ strcpy(dsname, DATASET_NAME);
+ strcat(dsname, "al2");
+
+ if((fid = open_test_file(filename)) < 0)
+ goto out;
+
+ TESTING2("set same long scale/cmp scale name");
+ if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
+ strcpy(scalename, DS_1_NAME);
+ strcat(scalename, "al");
+ strcpy(name, DS_1_NAME);
+ strcat(name, "al");
+ if(test_set_scalename(fid, did, scalename, name, DIM0) < 0)
+ goto out;
+
+ if(test_cmp_scalename(fid, did, scalename, name, DIM0) < 0)
+ goto out;
+
+ strcpy(scalename, DS_2_NAME);
+ strcat(scalename, "al");
+ strcpy(name, DS_2_NAME);
+ strcat(name, "al");
+ if(test_set_scalename(fid, did, scalename, name, DIM1) < 0)
+ goto out;
+
+ if(test_cmp_scalename(fid, did, scalename, name, DIM1) < 0)
+ goto out;
+
+ strcpy(scalename, DS_3_NAME);
+ strcat(scalename, "al");
+ strcpy(name, DS_3_NAME);
+ strcat(name, "al");
+ if(test_set_scalename(fid, did, scalename, name, DIM2) < 0)
+ goto out;
+
+ if(test_cmp_scalename(fid, did, scalename, name, DIM2) < 0)
+ goto out;
+
+ strcpy(scalename, DS_4_NAME);
+ strcat(scalename, "al");
+ strcpy(name, DS_4_NAME);
+ strcat(name, "al");
+ if(test_set_scalename(fid, did, scalename, name, DIM3) < 0)
+ goto out;
+
+ if(test_cmp_scalename(fid, did, scalename, name, DIM3) < 0)
+ goto out;
+
+ if(H5Dclose(did) < 0)
+ goto out;
+ }
+ else
+ goto out;
+
+ PASSED();
+
+ H5Fclose(fid);
+ return SUCCEED;
+
+out:
+ H5E_BEGIN_TRY {
+ H5Dclose(did);
+ H5Fclose(fid);
+ } H5E_END_TRY;
+
+ H5_FAILED();
+
+ return FAIL;
+}
+
+static int test_foreign_scaleattached(const char *filename)
+{
+ herr_t ret_value = FAIL;
+ hid_t fid = -1;
+ hid_t did = -1;
+ hid_t dsid = -1;
+
+ TESTING2("test_foreign_scaleattached");
+
+ if((fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ goto out;
+
+ if((did = H5Dopen2(fid, "/dset_al", H5P_DEFAULT)) >= 0) {
+ if((dsid = H5Dopen2(fid, "/ds_4_al", H5P_DEFAULT)) >= 0) {
+ if(H5DSis_attached(did, dsid, 3) == 1) {
+ ret_value = SUCCEED;
+ }
+ if(H5Dclose(dsid) < 0)
+ goto out;
+ }
+ if(H5Dclose(did) < 0)
+ goto out;
+ }
+ else
+ goto out;
+
+ if(ret_value == FAIL)
+ goto out;
+
+ PASSED();
+
+ H5Fclose(fid);
+ return 0;
+
+out:
+ H5E_BEGIN_TRY {
+ H5Dclose(did);
+ H5Fclose(fid);
+ } H5E_END_TRY;
+
+ H5_FAILED();
+
+ return FAIL;
+}
diff --git a/hl/test/test_ds.c b/hl/test/test_ds.c
index 6951619..7e0f20e 100644
--- a/hl/test/test_ds.c
+++ b/hl/test/test_ds.c
@@ -28,6 +28,49 @@ static herr_t op_continue(hid_t did, unsigned dim, hid_t dsid, void *visitor_dat
static herr_t op_stop(hid_t did, unsigned dim, hid_t dsid, void *visitor_data);
/* prototypes */
+static int create_test_file(const char *fileext);
+static int open_test_file(const char *fileext);
+herr_t create_char_dataset(hid_t fid, const char *dsidx, int fulldims);
+herr_t create_short_dataset(hid_t fid, const char *dsidx, int fulldims);
+herr_t create_int_dataset(hid_t fid, const char *dsidx, int fulldims);
+herr_t create_long_dataset(hid_t fid, const char *dsname, const char *dsidx, int fulldims);
+herr_t create_float_dataset(hid_t fid, const char *dsidx, int fulldims);
+herr_t create_DS1_char_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, char *s_wbuf, char *s1_wbuf);
+herr_t create_DS2_char_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, char *s_wbuf, char *s1_wbuf, char *s2_wbuf);
+herr_t create_DS3_char_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, char *s_wbuf, char *s1_wbuf, char *s2_wbuf, char *s3_wbuf);
+herr_t create_DS1_short_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, short *s_wbuf, short *s1_wbuf);
+herr_t create_DS2_short_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, short *s_wbuf, short *s1_wbuf, short *s2_wbuf);
+herr_t create_DS3_short_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, short *s_wbuf, short *s1_wbuf, short *s2_wbuf, short *s3_wbuf);
+herr_t create_DS1_int_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, int *s_wbuf, int *s1_wbuf);
+herr_t create_DS2_int_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, int *s_wbuf, int *s1_wbuf, int *s2_wbuf);
+herr_t create_DS3_int_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, int *s_wbuf, int *s1_wbuf, int *s2_wbuf, int *s3_wbuf);
+herr_t create_DS1_long_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, long *s_wbuf, long *s1_wbuf);
+herr_t create_DS2_long_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, long *s_wbuf, long *s1_wbuf, long *s2_wbuf);
+herr_t create_DS3_long_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, long *s_wbuf, long *s1_wbuf, long *s2_wbuf, long *s3_wbuf);
+herr_t create_DS4_long_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, long *s_wbuf, long *s1_wbuf, long *s2_wbuf, long *s3_wbuf, long *s4_wbuf);
+herr_t create_DS1_float_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, float *s_wbuf, float *s1_wbuf);
+herr_t create_DS2_float_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, float *s_wbuf, float *s1_wbuf, float *s2_wbuf);
+herr_t create_DS3_float_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, float *s_wbuf, float *s1_wbuf, float *s2_wbuf, float *s3_wbuf);
+herr_t test_attach_scale(hid_t fid, hid_t did, const char *name, unsigned int idx);
+herr_t test_detach_scale(hid_t fid, hid_t did, const char *name, unsigned int idx);
+herr_t test_set_scalename(hid_t fid, hid_t did, const char *name, const char *scalename, unsigned int idx);
+herr_t test_cmp_scalename(hid_t fid, hid_t did, const char *name, const char *scalename, unsigned int idx);
+
+static int test_char_attachscales(const char *fileext);
+static int test_short_attachscales(const char *fileext);
+static int test_int_attachscales(const char *fileext);
+static int test_long_attachscales(const char *fileext);
+static int test_duplicatelong_attachscales(const char *fileext);
+static int test_float_attachscales(const char *fileext);
+static int test_numberofscales(const char *fileext);
+static int test_char_scalenames(const char *fileext);
+static int test_short_scalenames(const char *fileext);
+static int test_int_scalenames(const char *fileext);
+static int test_long_scalenames(const char *fileext);
+static int test_samelong_scalenames(const char *fileext);
+static int test_float_scalenames(const char *fileext);
+static int test_foreign_scaleattached(const char *fileforeign);
+
static int test_simple(void);
static int test_errors(void);
static int test_errors2(void);
@@ -42,32 +85,55 @@ static int read_data( const char* fname, int ndims, hsize_t *dims, float **buf )
#define DIM_DATA 12
#define DIM1_SIZE 3
#define DIM2_SIZE 4
-#define DIM3_SIZE 2
+#define DIM3_SIZE 12
+#define DIM4_SIZE 2
#define DIM0 0
#define DIM1 1
-
-#define DS_1_NAME "ds_a_1"
-#define DS_11_NAME "ds_a_11"
-#define DS_2_NAME "ds_a_2"
-#define DS_21_NAME "ds_a_21"
-#define DS_22_NAME "ds_a_22"
-
-#define SCALE_1_NAME "Latitude set 0"
-#define SCALE_11_NAME "Latitude set 1"
-#define SCALE_2_NAME "Longitude set 0"
-#define SCALE_21_NAME "Longitude set 1"
-#define SCALE_22_NAME "Longitude set 2"
+#define DIM2 2
+#define DIM3 3
+
+#define DATASET_NAME "dset_"
+#define DS_1_NAME "ds_1_"
+#define DS_11_NAME "ds_11_"
+#define DS_2_NAME "ds_2_"
+#define DS_21_NAME "ds_21_"
+#define DS_22_NAME "ds_22_"
+#define DS_3_NAME "ds_3_"
+#define DS_31_NAME "ds_31_"
+#define DS_32_NAME "ds_32_"
+#define DS_33_NAME "ds_33_"
+#define DS_4_NAME "ds_4_"
+#define DS_41_NAME "ds_41_"
+#define DS_42_NAME "ds_42_"
+#define DS_43_NAME "ds_43_"
+#define DS_44_NAME "ds_44_"
+
+#define SCALE_1_NAME "scalename_1_"
+#define SCALE_11_NAME "scalename_11_"
+#define SCALE_2_NAME "scalename_2_"
+#define SCALE_21_NAME "scalename_21_"
+#define SCALE_22_NAME "scalename_22_"
+#define SCALE_3_NAME "scalename_3_"
+#define SCALE_31_NAME "scalename_31_"
+#define SCALE_32_NAME "scalename_32_"
+#define SCALE_33_NAME "scalename_33_"
+#define SCALE_4_NAME "scalename_4_"
#define DIM0_LABEL "Latitude"
#define DIM1_LABEL "Longitude"
-#define FILE1 "test_ds1.h5"
-#define FILE2 "test_ds2.h5"
-#define FILE3 "test_ds3.h5"
-#define FILE4 "test_ds4.h5"
-#define FILE5 "test_ds5.h5"
-#define FILE6 "test_ds6.h5"
-#define FILE7 "test_ds7.h5"
+#define FOREIGN_FILE1 "test_ds_le.h5"
+#define FOREIGN_FILE2 "test_ds_be.h5"
+#define FILENAME "test_ds"
+#define FILEEXT ".h5"
+
+#define FILE1 "test_ds3.h5"
+#define FILE2 "test_ds4.h5"
+#define FILE3 "test_ds5.h5"
+#define FILE4 "test_ds6.h5"
+#define FILE5 "test_ds7.h5"
+#define FILE6 "test_ds8.h5"
+#define FILE7 "test_ds9.h5"
/*-------------------------------------------------------------------------
* the main program
@@ -77,6 +143,33 @@ int main(void)
{
int nerrors=0;
+ /* create file to be used in following tests */
+ if(create_test_file("1") < 0) {
+ nerrors = 1;
+ goto error;
+ }
+ nerrors += test_char_attachscales("1") < 0 ? 1 : 0;
+ nerrors += test_short_attachscales("1") < 0 ? 1 : 0;
+ nerrors += test_int_attachscales("1") < 0 ? 1 : 0;
+ nerrors += test_long_attachscales("1") < 0 ? 1 : 0;
+ nerrors += test_float_attachscales("1") < 0 ? 1 : 0;
+ nerrors += test_char_scalenames("1") < 0 ? 1 : 0;
+ nerrors += test_short_scalenames("1") < 0 ? 1 : 0;
+ nerrors += test_int_scalenames("1") < 0 ? 1 : 0;
+ nerrors += test_long_scalenames("1") < 0 ? 1 : 0;
+ nerrors += test_float_scalenames("1") < 0 ? 1 : 0;
+ nerrors += test_numberofscales("1") < 0 ? 1 : 0;
+ if(create_test_file("2") < 0) {
+ nerrors = 1;
+ goto error;
+ }
+ nerrors += test_long_attachscales("2") < 0 ? 1 : 0;
+ nerrors += test_duplicatelong_attachscales("2") < 0 ? 1 : 0;
+ nerrors += test_samelong_scalenames("2") < 0 ? 1 : 0;
+ nerrors += test_foreign_scaleattached(FOREIGN_FILE1) < 0 ? 1 : 0;
+ nerrors += test_foreign_scaleattached(FOREIGN_FILE2) < 0 ? 1 : 0;
+
+/* the following tests have not been rewritten to match those above */
nerrors += test_simple() < 0 ?1:0;
nerrors += test_errors() < 0 ?1:0;
nerrors += test_errors2() < 0 ?1:0;
@@ -114,44 +207,2026 @@ error:
*-------------------------------------------------------------------------
*/
+static hid_t create_test_file(const char *fileext)
+{
+ char filename[65];
+
+ strcpy(filename, FILENAME);
+ strcat(filename, fileext);
+ strcat(filename, FILEEXT);
+ return H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+}
-static int test_simple(void)
+static hid_t open_test_file(const char *fileext)
{
- hid_t fid = -1; /* file ID */
- hid_t did = -1; /* dataset ID */
- hid_t dsid = -1; /* DS dataset ID */
- hid_t sid = -1; /* space ID */
- hid_t gid = -1; /* group ID */
- int rank = RANK; /* rank of data dataset */
- int rankds = 1; /* rank of DS dataset */
- hsize_t dims[RANK] = {DIM1_SIZE,DIM2_SIZE}; /* size of data dataset */
- int buf[DIM_DATA] = {1,2,3,4,5,6,7,8,9,10,11,12}; /* data of data dataset */
- hsize_t s1_dim[1] = {DIM1_SIZE}; /* size of DS 1 dataset */
- hsize_t s2_dim[1] = {DIM2_SIZE}; /* size of DS 2 dataset */
- char sname[30]; /* scale name buffer */
- char dname[30]; /* dataset name */
- int s1_wbuf[DIM1_SIZE] = {10,20,30}; /* data of DS 1 dataset */
- int s11_wbuf[DIM1_SIZE] = {10,100,300}; /* data of DS 1 dataset */
- int s2_wbuf[DIM2_SIZE] = {100,200,300,400}; /* data of DS 2 dataset */
- int s21_wbuf[DIM2_SIZE] = {10,20,30,40}; /* data of DS 2 dataset */
- int s22_wbuf[DIM2_SIZE] = {5,10,50,300}; /* data of DS 2 dataset */
- char dim0_label[16]; /* read label for DIM 0 */
- char dim1_label[16]; /* read label for DIM 1 */
- char *dim0_labeld; /* read label for DIM 0 */
- char *dim1_labeld; /* read label for DIM 1 */
- char dim0_labels[3]; /* read label for DIM 0 */
- char dim1_labels[3]; /* read label for DIM 1 */
- ssize_t dim0_label_size; /* lenght of label buffer */
- ssize_t dim1_label_size; /* lenght of label buffer */
- unsigned int dim; /* dataset dimension index */
- int scale_idx; /* scale index */
+ char filename[65];
+
+ strcpy(filename, FILENAME);
+ strcat(filename, fileext);
+ strcat(filename, FILEEXT);
+
+ return H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT);
+}
+
+/*-------------------------------------------------------------------------
+ * create "data" dataset
+ *-------------------------------------------------------------------------
+ */
+herr_t create_char_dataset(hid_t fid, const char *dsidx, int fulldims)
+{
+ int rank = 3;
+ int rankds = 1;
+ hsize_t dims[3] = {DIM1_SIZE,DIM2_SIZE,DIM3_SIZE};
+ char buf[DIM_DATA*3] = {1,2,3,4,5,6,7,8,9,10,11,12,
+ 1,2,3,4,5,6,7,8,9,10,11,12,1,2,3,4,5,6,7,8,9,10,11,12};
+ hsize_t s1_dim[1] = {DIM1_SIZE};
+ hsize_t s2_dim[1] = {DIM2_SIZE};
+ hsize_t s3_dim[1] = {DIM3_SIZE};
+ char s1_wbuf[DIM1_SIZE] = {1,2,3};
+ char s11_wbuf[DIM1_SIZE] = {10,20,30};
+ char s2_wbuf[DIM2_SIZE] = {10,20,30,40};
+ char s21_wbuf[DIM2_SIZE] = {1,2,3,4};
+ char s22_wbuf[DIM2_SIZE] = {5,10,50,100};
+ char s3_wbuf[DIM3_SIZE] = {10,10,10,20,20,20,30,30,30,40,40,40};
+ char s31_wbuf[DIM3_SIZE] = {1,1,1,2,2,2,3,3,3,4,4,4};
+ char s32_wbuf[DIM3_SIZE] = {5,5,5,10,10,10,50,50,50,100,100,100};
+ char s33_wbuf[DIM3_SIZE] = {6,6,6,12,12,12,53,53,53,120,120,120};
+ char name[32];
+
+ strcpy(name, DATASET_NAME);
+ strcat(name, dsidx);
+ /* make a dataset */
+ if(H5LTmake_dataset_char(fid, name, rank, dims, buf) >= 0) {
+ if(fulldims==0) {
+ /* make a DS dataset for the first dimension */
+ if(create_DS1_char_datasets(fid, dsidx, rankds, s1_dim, s1_wbuf, NULL) < 0)
+ return FAIL;
+
+ /* make a DS dataset for the second dimension */
+ if(create_DS2_char_datasets(fid, dsidx, rankds, s2_dim, s2_wbuf, NULL, NULL) < 0)
+ return FAIL;
+
+ /* make a DS dataset for the third dimension */
+ if(create_DS3_char_datasets(fid, dsidx, rankds, s3_dim, s3_wbuf, NULL, NULL, NULL) < 0)
+ return FAIL;
+ }
+ else {
+ if(create_DS1_char_datasets(fid, dsidx, rankds, s1_dim, s1_wbuf, s11_wbuf) < 0)
+ return FAIL;
+
+ if(create_DS2_char_datasets(fid, dsidx, rankds, s2_dim, s2_wbuf, s21_wbuf, s22_wbuf) < 0)
+ return FAIL;
+
+ if(create_DS3_char_datasets(fid, dsidx, rankds, s3_dim, s3_wbuf, s31_wbuf, s32_wbuf, s33_wbuf) < 0)
+ return FAIL;
+ }
+ }
+ else
+ return FAIL;
+ return SUCCEED;
+}
+
+herr_t create_short_dataset(hid_t fid, const char *dsidx, int fulldims)
+{
+ int rank = 3;
+ int rankds = 1;
+ hsize_t dims[3] = {DIM1_SIZE,DIM2_SIZE,DIM3_SIZE};
+ short buf[DIM_DATA*3] = {1,2,3,4,5,6,7,8,9,10,11,12,
+ 1,2,3,4,5,6,7,8,9,10,11,12,1,2,3,4,5,6,7,8,9,10,11,12};
+ hsize_t s1_dim[1] = {DIM1_SIZE};
+ hsize_t s2_dim[1] = {DIM2_SIZE};
+ hsize_t s3_dim[1] = {DIM3_SIZE};
+ short s1_wbuf[DIM1_SIZE] = {10,20,30};
+ short s11_wbuf[DIM1_SIZE] = {10,100,300};
+ short s2_wbuf[DIM2_SIZE] = {100,200,300,400};
+ short s21_wbuf[DIM2_SIZE] = {10,20,30,40};
+ short s22_wbuf[DIM2_SIZE] = {5,10,50,300};
+ short s3_wbuf[DIM3_SIZE] = {10,10,10,20,20,20,30,30,30,40,40,40};
+ short s31_wbuf[DIM3_SIZE] = {1,1,1,2,2,2,3,3,3,4,4,4};
+ short s32_wbuf[DIM3_SIZE] = {5,5,5,10,10,10,50,50,50,100,100,100};
+ short s33_wbuf[DIM3_SIZE] = {6,6,6,12,12,12,53,53,53,140,140,140};
+ char name[32];
+
+ strcpy(name, DATASET_NAME);
+ strcat(name, dsidx);
+
+ /* make a dataset */
+ if(H5LTmake_dataset_short(fid, name, rank, dims, buf) >= 0) {
+ if(fulldims==0) {
+ /* make a DS dataset for the first dimension */
+ if(create_DS1_short_datasets(fid, dsidx, rankds, s1_dim, s1_wbuf, NULL) < 0)
+ return FAIL;
+
+ /* make a DS dataset for the second dimension */
+ if(create_DS2_short_datasets(fid, dsidx, rankds, s2_dim, s2_wbuf, NULL, NULL) < 0)
+ return FAIL;
+
+ /* make a DS dataset for the third dimension */
+ if(create_DS3_short_datasets(fid, dsidx, rankds, s3_dim, s3_wbuf, NULL, NULL, NULL) < 0)
+ return FAIL;
+ }
+ else {
+ if(create_DS1_short_datasets(fid, dsidx, rankds, s1_dim, s1_wbuf, s11_wbuf) < 0)
+ return FAIL;
+
+ if(create_DS2_short_datasets(fid, dsidx, rankds, s2_dim, s2_wbuf, s21_wbuf, s22_wbuf) < 0)
+ return FAIL;
+
+ if(create_DS3_short_datasets(fid, dsidx, rankds, s3_dim, s3_wbuf, s31_wbuf, s32_wbuf, s33_wbuf) < 0)
+ return FAIL;
+ }
+ }
+ else
+ return FAIL;
+ return SUCCEED;
+}
+
+herr_t create_int_dataset(hid_t fid, const char *dsidx, int fulldims)
+{
+ int rank = RANK;
+ int rankds = 1;
+ hsize_t dims[RANK] = {DIM1_SIZE,DIM2_SIZE};
+ int buf[DIM_DATA] = {1,2,3,4,5,6,7,8,9,10,11,12};
+ hsize_t s1_dim[1] = {DIM1_SIZE};
+ hsize_t s2_dim[1] = {DIM2_SIZE};
+ int s1_wbuf[DIM1_SIZE] = {10,20,30};
+ int s11_wbuf[DIM1_SIZE] = {10,100,300};
+ int s2_wbuf[DIM2_SIZE] = {100,200,300,400};
+ int s21_wbuf[DIM2_SIZE] = {10,20,30,40};
+ int s22_wbuf[DIM2_SIZE] = {5,10,50,300};
+ char name[32];
+
+ strcpy(name, DATASET_NAME);
+ strcat(name, dsidx);
+
+ /* make a dataset */
+ if(H5LTmake_dataset_int(fid, name, rank, dims, buf) >= 0) {
+ if(fulldims==0) {
+ /* make a DS dataset for the first dimension */
+ if(create_DS1_int_datasets(fid, dsidx, rankds, s1_dim, s1_wbuf, NULL) < 0)
+ return FAIL;
+
+ /* make a DS dataset for the second dimension */
+ if(create_DS2_int_datasets(fid, dsidx, rankds, s2_dim, s2_wbuf, NULL, NULL) < 0)
+ return FAIL;
+ }
+ else {
+ if(create_DS1_int_datasets(fid, dsidx, rankds, s1_dim, s1_wbuf, s11_wbuf) < 0)
+ return FAIL;
+
+ if(create_DS2_int_datasets(fid, dsidx, rankds, s2_dim, s2_wbuf, s21_wbuf, s22_wbuf) < 0)
+ return FAIL;
+ }
+ }
+ else
+ return FAIL;
+ return SUCCEED;
+}
+
+herr_t create_long_dataset(hid_t fid, const char *dsname, const char *dsidx, int fulldims)
+{
+ int rank = 4;
+ int rankds = 1;
+ hsize_t dims[4] = {DIM1_SIZE,DIM2_SIZE,DIM3_SIZE,DIM4_SIZE};
+ long buf[DIM_DATA*3*2] = {1,2,3,4,5,6,7,8,9,10,11,12,
+ 1,2,3,4,5,6,7,8,9,10,11,12,1,2,3,4,5,6,7,8,9,10,11,12,
+ 1,2,3,4,5,6,7,8,9,10,11,12,1,2,3,4,5,6,7,8,9,10,11,12,
+ 1,2,3,4,5,6,7,8,9,10,11,12};
+ hsize_t s1_dim[1] = {DIM1_SIZE};
+ hsize_t s2_dim[1] = {DIM2_SIZE};
+ hsize_t s3_dim[1] = {DIM3_SIZE};
+ hsize_t s4_dim[1] = {DIM4_SIZE};
+ long s1_wbuf[DIM1_SIZE] = {10,20,30};
+ long s11_wbuf[DIM1_SIZE] = {10,100,300};
+ long s2_wbuf[DIM2_SIZE] = {100,200,300,400};
+ long s21_wbuf[DIM2_SIZE] = {10,20,30,40};
+ long s22_wbuf[DIM2_SIZE] = {5,10,50,300};
+ long s3_wbuf[DIM3_SIZE] = {10,10,10,20,20,20,30,30,30,40,40,40};
+ long s31_wbuf[DIM3_SIZE] = {1,1,1,2,2,2,3,3,3,4,4,4};
+ long s32_wbuf[DIM3_SIZE] = {5,5,5,10,10,10,50,50,50,100,100,100};
+ long s33_wbuf[DIM3_SIZE] = {6,6,6,12,12,12,53,53,53,140,140,140};
+ long s4_wbuf[DIM4_SIZE] = {18,18};
+ long s41_wbuf[DIM4_SIZE] = {8,8};
+ long s42_wbuf[DIM4_SIZE] = {80,80};
+ long s43_wbuf[DIM4_SIZE] = {180,180};
+ long s44_wbuf[DIM4_SIZE] = {280,280};
+ char name[32];
+
+ strcpy(name, dsname);
+
+ /* make a dataset */
+ if(H5LTmake_dataset_long(fid, name, rank, dims, buf) >= 0) {
+ if(fulldims==0) {
+ /* make a DS dataset for the first dimension */
+ if(create_DS1_long_datasets(fid, dsidx, rankds, s1_dim, s1_wbuf, NULL) < 0)
+ return FAIL;
+
+ /* make a DS dataset for the second dimension */
+ if(create_DS2_long_datasets(fid, dsidx, rankds, s2_dim, s2_wbuf, NULL, NULL) < 0)
+ return FAIL;
+
+ /* make a DS dataset for the third dimension */
+ if(create_DS3_long_datasets(fid, dsidx, rankds, s3_dim, s3_wbuf, NULL, NULL, NULL) < 0)
+ return FAIL;
+
+ /* make a DS dataset for the fourth dimension */
+ if(create_DS4_long_datasets(fid, dsidx, rankds, s4_dim, s4_wbuf, NULL, NULL, NULL, NULL) < 0)
+ return FAIL;
+ }
+ else {
+ if(create_DS1_long_datasets(fid, dsidx, rankds, s1_dim, s1_wbuf, s11_wbuf) < 0)
+ return FAIL;
+
+ if(create_DS2_long_datasets(fid, dsidx, rankds, s2_dim, s2_wbuf, s21_wbuf, s22_wbuf) < 0)
+ return FAIL;
+
+ if(create_DS3_long_datasets(fid, dsidx, rankds, s3_dim, s3_wbuf, s31_wbuf, s32_wbuf, s33_wbuf) < 0)
+ return FAIL;
+
+ if(create_DS4_long_datasets(fid, dsidx, rankds, s4_dim, s4_wbuf, s41_wbuf, s42_wbuf, s43_wbuf, s44_wbuf) < 0)
+ return FAIL;
+ }
+ }
+ else
+ return FAIL;
+ return SUCCEED;
+}
+
+herr_t create_float_dataset(hid_t fid, const char *dsidx, int fulldims)
+{
+ int rank = RANK;
+ int rankds = 1;
+ hsize_t dims[RANK] = {DIM1_SIZE,DIM2_SIZE};
+ float buf[DIM_DATA] = {1,2,3,4,5,6,7,8,9,10,11,12};
+ hsize_t s1_dim[1] = {DIM1_SIZE};
+ hsize_t s2_dim[1] = {DIM2_SIZE};
+ float s1_wbuf[DIM1_SIZE] = {10,20,30};
+ float s11_wbuf[DIM1_SIZE] = {10,100,300};
+ float s2_wbuf[DIM2_SIZE] = {100,200,300,400};
+ float s21_wbuf[DIM2_SIZE] = {10,20,30,40};
+ float s22_wbuf[DIM2_SIZE] = {5,10,50,300};
+ char name[32];
+
+ strcpy(name, DATASET_NAME);
+ strcat(name, dsidx);
+
+ /* make a dataset */
+ if(H5LTmake_dataset_float(fid, name, rank, dims, buf) >= 0) {
+ if(fulldims==0) {
+ /* make a DS dataset for the first dimension */
+ if(create_DS1_float_datasets(fid, dsidx, rankds, s1_dim, s1_wbuf, NULL) < 0)
+ return FAIL;
+
+ /* make a DS dataset for the second dimension */
+ if(create_DS2_float_datasets(fid, dsidx, rankds, s2_dim, s2_wbuf, NULL, NULL) < 0)
+ return FAIL;
+ }
+ else {
+ if(create_DS1_float_datasets(fid, dsidx, rankds, s1_dim, s1_wbuf, s11_wbuf) < 0)
+ return FAIL;
+
+ if(create_DS2_float_datasets(fid, dsidx, rankds, s2_dim, s2_wbuf, s21_wbuf, s22_wbuf) < 0)
+ return FAIL;
+ }
+ }
+ else
+ return FAIL;
+ return SUCCEED;
+}
+
+/*-------------------------------------------------------------------------
+ * create 2 dimension scales datasets for first dimension
+ *-------------------------------------------------------------------------
+ */
+herr_t create_DS1_char_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, char *s_wbuf, char *s1_wbuf)
+{
+ char name[32];
+
+ strcpy(name, DS_1_NAME);
+ strcat(name, dsidx);
+ /* make a DS dataset for the first dimension */
+ if(H5LTmake_dataset_char(fid, name, rankds, s_dim, s_wbuf) < 0)
+ return FAIL;
+
+ if(s1_wbuf!=NULL) {
+ strcpy(name, DS_11_NAME);
+ strcat(name, dsidx);
+ /* make a DS dataset with an alternate scale for the first dimension */
+ if(H5LTmake_dataset_char(fid, name, rankds, s_dim, s1_wbuf) < 0)
+ return FAIL;
+ }
+
+ return SUCCEED;
+}
+
+/*-------------------------------------------------------------------------
+ * create 3 dimension scales datasets for second dimension
+ *-------------------------------------------------------------------------
+ */
+herr_t create_DS2_char_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, char *s_wbuf, char *s1_wbuf, char *s2_wbuf)
+{
+ char name[32];
+
+ strcpy(name, DS_2_NAME);
+ strcat(name, dsidx);
+ /* make a DS dataset for the second dimension */
+ if(H5LTmake_dataset_char(fid, name, rankds, s_dim, s_wbuf) < 0)
+ return FAIL;
+
+ if(s1_wbuf!=NULL) {
+ strcpy(name, DS_21_NAME);
+ strcat(name, dsidx);
+ /* make a DS dataset with an alternate scale for the second dimension */
+ if(H5LTmake_dataset_char(fid, name, rankds, s_dim, s1_wbuf) < 0)
+ return FAIL;
+ }
+
+ if(s2_wbuf!=NULL) {
+ strcpy(name, DS_22_NAME);
+ strcat(name, dsidx);
+ /* make a DS dataset with an alternate scale for the second dimension */
+ if(H5LTmake_dataset_char(fid, name, rankds, s_dim, s2_wbuf) < 0)
+ return FAIL;
+ }
+
+ return SUCCEED;
+}
+
+/*-------------------------------------------------------------------------
+ * create 1 dimension scales datasets for third dimension of dataset
+ *-------------------------------------------------------------------------
+ */
+herr_t create_DS3_char_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, char *s_wbuf, char *s1_wbuf, char *s2_wbuf, char *s3_wbuf)
+{
+ char name[32];
+
+ strcpy(name, DS_3_NAME);
+ strcat(name, dsidx);
+ /* make a DS dataset for the first dimension */
+ if(H5LTmake_dataset_char(fid, name, rankds, s_dim, s_wbuf) < 0)
+ return FAIL;
+
+ if(s1_wbuf!=NULL) {
+ strcpy(name, DS_31_NAME);
+ strcat(name, dsidx);
+ /* make a DS dataset with an alternate scale for the second dimension */
+ if(H5LTmake_dataset_char(fid, name, rankds, s_dim, s1_wbuf) < 0)
+ return FAIL;
+ }
+
+ if(s2_wbuf!=NULL) {
+ strcpy(name, DS_32_NAME);
+ strcat(name, dsidx);
+ /* make a DS dataset with an alternate scale for the second dimension */
+ if(H5LTmake_dataset_char(fid, name, rankds, s_dim, s2_wbuf) < 0)
+ return FAIL;
+ }
+
+ if(s3_wbuf!=NULL) {
+ strcpy(name, DS_33_NAME);
+ strcat(name, dsidx);
+ /* make a DS dataset with an alternate scale for the second dimension */
+ if(H5LTmake_dataset_char(fid, name, rankds, s_dim, s3_wbuf) < 0)
+ return FAIL;
+ }
+
+ return SUCCEED;
+}
+
+/*-------------------------------------------------------------------------
+ * create 2 dimension scales datasets for first dimension
+ *-------------------------------------------------------------------------
+ */
+herr_t create_DS1_short_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, short *s_wbuf, short *s1_wbuf)
+{
+ char name[32];
+
+ strcpy(name, DS_1_NAME);
+ strcat(name, dsidx);
+ /* make a DS dataset for the first dimension */
+ if(H5LTmake_dataset_short(fid, name, rankds, s_dim, s_wbuf) < 0)
+ return FAIL;
+
+ if(s1_wbuf!=NULL) {
+ strcpy(name, DS_11_NAME);
+ strcat(name, dsidx);
+ /* make a DS dataset with an alternate scale for the first dimension */
+ if(H5LTmake_dataset_short(fid, name, rankds, s_dim, s1_wbuf) < 0)
+ return FAIL;
+ }
+
+ return SUCCEED;
+}
+
+/*-------------------------------------------------------------------------
+ * create 3 dimension scales datasets for second dimension
+ *-------------------------------------------------------------------------
+ */
+herr_t create_DS2_short_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, short *s_wbuf, short *s1_wbuf, short *s2_wbuf)
+{
+ char name[32];
+
+ strcpy(name, DS_2_NAME);
+ strcat(name, dsidx);
+
+ /* make a DS dataset for the second dimension */
+ if(H5LTmake_dataset_short(fid, name, rankds, s_dim, s_wbuf) < 0)
+ return FAIL;
+
+ if(s1_wbuf!=NULL) {
+ strcpy(name, DS_21_NAME);
+ strcat(name, dsidx);
+ /* make a DS dataset with an alternate scale for the second dimension */
+ if(H5LTmake_dataset_short(fid, name, rankds, s_dim, s1_wbuf) < 0)
+ return FAIL;
+ }
+
+ if(s2_wbuf!=NULL) {
+ strcpy(name, DS_22_NAME);
+ strcat(name, dsidx);
+ /* make a DS dataset with an alternate scale for the second dimension */
+ if(H5LTmake_dataset_short(fid, name, rankds, s_dim, s2_wbuf) < 0)
+ return FAIL;
+ }
+
+ return SUCCEED;
+}
+
+/*-------------------------------------------------------------------------
+ * create 1 dimension scales datasets for third dimension of dataset
+ *-------------------------------------------------------------------------
+ */
+herr_t create_DS3_short_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, short *s_wbuf, short *s1_wbuf, short *s2_wbuf, short *s3_wbuf)
+{
+ char name[32];
+
+ strcpy(name, DS_3_NAME);
+ strcat(name, dsidx);
+
+ /* make a DS dataset for the first dimension */
+ if(H5LTmake_dataset_short(fid, name, rankds, s_dim, s_wbuf) < 0)
+ return FAIL;
+
+ if(s1_wbuf!=NULL) {
+ strcpy(name, DS_31_NAME);
+ strcat(name, dsidx);
+ /* make a DS dataset for the first dimension */
+ if(H5LTmake_dataset_short(fid, name, rankds, s_dim, s1_wbuf) < 0)
+ return FAIL;
+ }
+
+ if(s2_wbuf!=NULL) {
+ strcpy(name, DS_32_NAME);
+ strcat(name, dsidx);
+ /* make a DS dataset for the first dimension */
+ if(H5LTmake_dataset_short(fid, name, rankds, s_dim, s2_wbuf) < 0)
+ return FAIL;
+ }
+
+ if(s3_wbuf!=NULL) {
+ strcpy(name, DS_33_NAME);
+ strcat(name, dsidx);
+ /* make a DS dataset for the first dimension */
+ if(H5LTmake_dataset_short(fid, name, rankds, s_dim, s3_wbuf) < 0)
+ return FAIL;
+ }
+
+ return SUCCEED;
+}
+
+/*-------------------------------------------------------------------------
+ * create 2 dimension scales datasets for first dimension
+ *-------------------------------------------------------------------------
+ */
+herr_t create_DS1_int_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, int *s_wbuf, int *s1_wbuf)
+{
+ char name[32];
+
+ strcpy(name, DS_1_NAME);
+ strcat(name, dsidx);
+
+ /* make a DS dataset for the first dimension */
+ if(H5LTmake_dataset_int(fid, name, rankds, s_dim, s_wbuf) < 0)
+ return FAIL;
+
+ if(s1_wbuf!=NULL) {
+ strcpy(name, DS_11_NAME);
+ strcat(name, dsidx);
+ /* make a DS dataset with an alternate scale for the first dimension */
+ if(H5LTmake_dataset_int(fid, name, rankds, s_dim, s1_wbuf) < 0)
+ return FAIL;
+ }
+
+ return SUCCEED;
+}
+
+/*-------------------------------------------------------------------------
+ * create 3 dimension scales datasets for second dimension
+ *-------------------------------------------------------------------------
+ */
+herr_t create_DS2_int_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, int *s_wbuf, int *s1_wbuf, int *s2_wbuf)
+{
+ char name[32];
+
+ strcpy(name, DS_2_NAME);
+ strcat(name, dsidx);
+
+ /* make a DS dataset for the second dimension */
+ if(H5LTmake_dataset_int(fid, name, rankds, s_dim, s_wbuf) < 0)
+ return FAIL;
+
+ if(s1_wbuf!=NULL) {
+ strcpy(name, DS_21_NAME);
+ strcat(name, dsidx);
+ /* make a DS dataset with an alternate scale for the second dimension */
+ if(H5LTmake_dataset_int(fid, name, rankds, s_dim, s1_wbuf) < 0)
+ return FAIL;
+ }
+
+ if(s2_wbuf!=NULL) {
+ strcpy(name, DS_22_NAME);
+ strcat(name, dsidx);
+ /* make a DS dataset with an alternate scale for the second dimension */
+ if(H5LTmake_dataset_int(fid, name, rankds, s_dim, s2_wbuf) < 0)
+ return FAIL;
+ }
+
+ return SUCCEED;
+}
+
+/*-------------------------------------------------------------------------
+ * create 1 dimension scales datasets for third dimension of dataset
+ *-------------------------------------------------------------------------
+ */
+herr_t create_DS3_int_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, int *s_wbuf, int *s1_wbuf, int *s2_wbuf, int *s3_wbuf)
+{
+ char name[32];
+
+ strcpy(name, DS_3_NAME);
+ strcat(name, dsidx);
+
+ /* make a DS dataset for the first dimension */
+ if(H5LTmake_dataset_int(fid, name, rankds, s_dim, s_wbuf) < 0)
+ return FAIL;
+
+ if(s1_wbuf!=NULL) {
+ strcpy(name, DS_31_NAME);
+ strcat(name, dsidx);
+ /* make a DS dataset with an alternate scale for the first dimension */
+ if(H5LTmake_dataset_int(fid, name, rankds, s_dim, s1_wbuf) < 0)
+ return FAIL;
+ }
+
+ if(s2_wbuf!=NULL) {
+ strcpy(name, DS_32_NAME);
+ strcat(name, dsidx);
+ /* make a DS dataset with an alternate scale for the first dimension */
+ if(H5LTmake_dataset_int(fid, name, rankds, s_dim, s2_wbuf) < 0)
+ return FAIL;
+ }
+
+ if(s3_wbuf!=NULL) {
+ strcpy(name, DS_33_NAME);
+ strcat(name, dsidx);
+ /* make a DS dataset with an alternate scale for the first dimension */
+ if(H5LTmake_dataset_int(fid, name, rankds, s_dim, s3_wbuf) < 0)
+ return FAIL;
+ }
+
+ return SUCCEED;
+}
+
+/*-------------------------------------------------------------------------
+ * create 2 dimension scales datasets for first dimension
+ *-------------------------------------------------------------------------
+ */
+herr_t create_DS1_long_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, long *s_wbuf, long *s1_wbuf)
+{
+ char name[32];
+
+ strcpy(name, DS_1_NAME);
+ strcat(name, dsidx);
+
+ /* make a DS dataset for the first dimension */
+ if(H5LTmake_dataset_long(fid, name, rankds, s_dim, s_wbuf) < 0)
+ return FAIL;
+
+ if(s1_wbuf!=NULL) {
+ strcpy(name, DS_11_NAME);
+ strcat(name, dsidx);
+ /* make a DS dataset with an alternate scale for the first dimension */
+ if(H5LTmake_dataset_long(fid, name, rankds, s_dim, s1_wbuf) < 0)
+ return FAIL;
+ }
+
+ return SUCCEED;
+}
+
+/*-------------------------------------------------------------------------
+ * create 3 dimension scales datasets for second dimension
+ *-------------------------------------------------------------------------
+ */
+herr_t create_DS2_long_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, long *s_wbuf, long *s1_wbuf, long *s2_wbuf)
+{
+ char name[32];
+
+ strcpy(name, DS_2_NAME);
+ strcat(name, dsidx);
+
+ /* make a DS dataset for the second dimension */
+ if(H5LTmake_dataset_long(fid, name, rankds, s_dim, s_wbuf) < 0)
+ return FAIL;
+
+ if(s1_wbuf!=NULL) {
+ strcpy(name, DS_21_NAME);
+ strcat(name, dsidx);
+ /* make a DS dataset with an alternate scale for the second dimension */
+ if(H5LTmake_dataset_long(fid, name, rankds, s_dim, s1_wbuf) < 0)
+ return FAIL;
+ }
+
+ if(s2_wbuf!=NULL) {
+ strcpy(name, DS_22_NAME);
+ strcat(name, dsidx);
+ /* make a DS dataset with an alternate scale for the second dimension */
+ if(H5LTmake_dataset_long(fid, name, rankds, s_dim, s2_wbuf) < 0)
+ return FAIL;
+ }
+
+ return SUCCEED;
+}
+
+/*-------------------------------------------------------------------------
+ * create 3 dimension scales datasets for third dimension of dataset
+ *-------------------------------------------------------------------------
+ */
+herr_t create_DS3_long_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, long *s_wbuf, long *s1_wbuf, long *s2_wbuf, long *s3_wbuf)
+{
+ char name[32];
+
+ strcpy(name, DS_3_NAME);
+ strcat(name, dsidx);
+
+ /* make a DS dataset for the first dimension */
+ if(H5LTmake_dataset_long(fid, name, rankds, s_dim, s_wbuf) < 0)
+ return FAIL;
+
+ if(s1_wbuf!=NULL) {
+ strcpy(name, DS_31_NAME);
+ strcat(name, dsidx);
+ /* make a DS dataset with an alternate scale for the second dimension */
+ if(H5LTmake_dataset_long(fid, name, rankds, s_dim, s1_wbuf) < 0)
+ return FAIL;
+ }
+
+ if(s2_wbuf!=NULL) {
+ strcpy(name, DS_32_NAME);
+ strcat(name, dsidx);
+ /* make a DS dataset with an alternate scale for the second dimension */
+ if(H5LTmake_dataset_long(fid, name, rankds, s_dim, s2_wbuf) < 0)
+ return FAIL;
+ }
+
+ if(s3_wbuf!=NULL) {
+ strcpy(name, DS_33_NAME);
+ strcat(name, dsidx);
+ /* make a DS dataset with an alternate scale for the second dimension */
+ if(H5LTmake_dataset_long(fid, name, rankds, s_dim, s3_wbuf) < 0)
+ return FAIL;
+ }
+
+ return SUCCEED;
+}
+
+/*-------------------------------------------------------------------------
+ * create 4 dimension scales datasets for third dimension of dataset
+ *-------------------------------------------------------------------------
+ */
+herr_t create_DS4_long_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, long *s_wbuf, long *s1_wbuf, long *s2_wbuf, long *s3_wbuf, long *s4_wbuf)
+{
+ char name[32];
+
+ strcpy(name, DS_4_NAME);
+ strcat(name, dsidx);
+
+ /* make a DS dataset for the first dimension */
+ if(H5LTmake_dataset_long(fid, name, rankds, s_dim, s_wbuf) < 0)
+ return FAIL;
+
+ if(s1_wbuf!=NULL) {
+ strcpy(name, DS_41_NAME);
+ strcat(name, dsidx);
+ /* make a DS dataset with an alternate scale for the second dimension */
+ if(H5LTmake_dataset_long(fid, name, rankds, s_dim, s1_wbuf) < 0)
+ return FAIL;
+ }
+
+ if(s2_wbuf!=NULL) {
+ strcpy(name, DS_42_NAME);
+ strcat(name, dsidx);
+ /* make a DS dataset with an alternate scale for the second dimension */
+ if(H5LTmake_dataset_long(fid, name, rankds, s_dim, s2_wbuf) < 0)
+ return FAIL;
+ }
+
+ if(s3_wbuf!=NULL) {
+ strcpy(name, DS_43_NAME);
+ strcat(name, dsidx);
+ /* make a DS dataset with an alternate scale for the second dimension */
+ if(H5LTmake_dataset_long(fid, name, rankds, s_dim, s3_wbuf) < 0)
+ return FAIL;
+ }
+
+ if(s4_wbuf!=NULL) {
+ strcpy(name, DS_44_NAME);
+ strcat(name, dsidx);
+ /* make a DS dataset with an alternate scale for the second dimension */
+ if(H5LTmake_dataset_long(fid, name, rankds, s_dim, s4_wbuf) < 0)
+ return FAIL;
+ }
+
+ return SUCCEED;
+}
+
+/*-------------------------------------------------------------------------
+ * create 2 dimension scales datasets for first dimension
+ *-------------------------------------------------------------------------
+ */
+herr_t create_DS1_float_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, float *s_wbuf, float *s1_wbuf)
+{
+ char name[32];
+
+ strcpy(name, DS_1_NAME);
+ strcat(name, dsidx);
+
+ /* make a DS dataset for the first dimension */
+ if(H5LTmake_dataset_float(fid, name, rankds, s_dim, s_wbuf) < 0)
+ return FAIL;
+
+ if(s1_wbuf!=NULL) {
+ strcpy(name, DS_11_NAME);
+ strcat(name, dsidx);
+ /* make a DS dataset with an alternate scale for the first dimension */
+ if(H5LTmake_dataset_float(fid, name, rankds, s_dim, s1_wbuf) < 0)
+ return FAIL;
+ }
+
+ return SUCCEED;
+}
+
+/*-------------------------------------------------------------------------
+ * create 3 dimension scales datasets for second dimension
+ *-------------------------------------------------------------------------
+ */
+herr_t create_DS2_float_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, float *s_wbuf, float *s1_wbuf, float *s2_wbuf)
+{
+ char name[32];
+
+ strcpy(name, DS_2_NAME);
+ strcat(name, dsidx);
+
+ /* make a DS dataset for the second dimension */
+ if(H5LTmake_dataset_float(fid, name, rankds, s_dim, s_wbuf) < 0)
+ return FAIL;
+
+ if(s1_wbuf!=NULL) {
+ strcpy(name, DS_21_NAME);
+ strcat(name, dsidx);
+ /* make a DS dataset with an alternate scale for the second dimension */
+ if(H5LTmake_dataset_float(fid, name, rankds, s_dim, s1_wbuf) < 0)
+ return FAIL;
+ }
+
+ if(s2_wbuf!=NULL) {
+ strcpy(name, DS_22_NAME);
+ strcat(name, dsidx);
+ /* make a DS dataset with an alternate scale for the second dimension */
+ if(H5LTmake_dataset_float(fid, name, rankds, s_dim, s2_wbuf) < 0)
+ return FAIL;
+ }
+
+ return SUCCEED;
+}
+
+/*-------------------------------------------------------------------------
+ * create 3 dimension scales datasets for third dimension of dataset
+ *-------------------------------------------------------------------------
+ */
+herr_t create_DS3_float_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, float *s_wbuf, float *s1_wbuf, float *s2_wbuf, float *s3_wbuf)
+{
+ char name[32];
+
+ strcpy(name, DS_3_NAME);
+ strcat(name, dsidx);
+
+ /* make a DS dataset for the first dimension */
+ if(H5LTmake_dataset_float(fid, name, rankds, s_dim, s_wbuf) < 0)
+ return FAIL;
+
+ if(s1_wbuf!=NULL) {
+ strcpy(name, DS_31_NAME);
+ strcat(name, dsidx);
+ /* make a DS dataset with an alternate scale for the second dimension */
+ if(H5LTmake_dataset_float(fid, name, rankds, s_dim, s1_wbuf) < 0)
+ return FAIL;
+ }
+
+ if(s2_wbuf!=NULL) {
+ strcpy(name, DS_32_NAME);
+ strcat(name, dsidx);
+ /* make a DS dataset with an alternate scale for the second dimension */
+ if(H5LTmake_dataset_float(fid, name, rankds, s_dim, s2_wbuf) < 0)
+ return FAIL;
+ }
+
+ if(s3_wbuf!=NULL) {
+ strcpy(name, DS_33_NAME);
+ strcat(name, dsidx);
+ /* make a DS dataset with an alternate scale for the second dimension */
+ if(H5LTmake_dataset_float(fid, name, rankds, s_dim, s3_wbuf) < 0)
+ return FAIL;
+ }
+
+ return SUCCEED;
+}
+
+herr_t test_attach_scale(hid_t fid, hid_t did, const char *name, unsigned int idx)
+{
+ herr_t ret_value = FAIL;
+ hid_t dsid = -1;
+
+ if((dsid = H5Dopen2(fid, name, H5P_DEFAULT)) >= 0) {
+ if(H5DSis_attached(did, dsid, idx) == 0) {
+ if(H5DSattach_scale(did, dsid, idx) >= 0) {
+ if(H5DSis_attached(did, dsid, idx) > 0) {
+ /* printf(" scale attached "); */
+ ret_value = SUCCEED;
+ }
+ else if(H5DSis_attached(did, dsid, idx) == 0) {
+ printf(" scale not attached ");
+ }
+ }
+ }
+ if(H5Dclose(dsid) < 0)
+ ret_value = FAIL;
+ }
+
+ return ret_value;
+}
+
+herr_t test_detach_scale(hid_t fid, hid_t did, const char *name, unsigned int idx)
+{
+ herr_t ret_value = FAIL;
+ hid_t dsid = -1;
+
+ if((dsid = H5Dopen2(fid, name, H5P_DEFAULT)) >= 0) {
+ if(H5DSis_attached(did, dsid, idx) == 1) {
+ if(H5DSdetach_scale(did, dsid, idx) >= 0) {
+ if(H5DSis_attached(did, dsid, idx) == 0) {
+ ret_value = SUCCEED;
+ }
+ }
+ }
+ if(H5Dclose(dsid) < 0)
+ ret_value = FAIL;
+ }
+
+ return ret_value;
+}
+
+herr_t test_set_scalename(hid_t fid, hid_t did, const char *name, const char *scalename, unsigned int idx)
+{
+ herr_t ret_value = FAIL;
+ hid_t dsid = -1;
+
+ if((dsid = H5Dopen2(fid, name, H5P_DEFAULT)) >= 0) {
+ if(H5DSis_attached(did, dsid, idx) == 1) {
+ if(H5DSset_scale(dsid, scalename) >= 0) {
+ if(H5DSis_attached(did, dsid, idx) == 1) {
+ ret_value = SUCCEED;
+ }
+ }
+ }
+ if(H5Dclose(dsid) < 0)
+ ret_value = FAIL;
+ }
+
+ return ret_value;
+}
+
+herr_t test_cmp_scalename(hid_t fid, hid_t did, const char *name, const char *scalename, unsigned int idx)
+{
+ herr_t ret_value = FAIL;
+ hid_t dsid = -1;
+ ssize_t name_len;
+ char *name_out=NULL;
+
+ if((dsid = H5Dopen2(fid, name, H5P_DEFAULT)) >= 0) {
+ if(H5DSis_attached(did, dsid, idx) == 1) {
+ if((name_len=H5DSget_scale_name(dsid,NULL,(size_t)0)) > 0) {
+ name_out = (char*)malloc(name_len * sizeof (char));
+ if(name_out != NULL) {
+ if(H5DSget_scale_name(dsid, name_out, (size_t)name_len) >= 0) {
+ if(strcmp(scalename,name_out)==0) {
+ ret_value = SUCCEED;
+ }
+ free(name_out);
+ name_out=NULL;
+ }
+ }
+ }
+ }
+ if(H5Dclose(dsid) < 0)
+ ret_value = FAIL;
+ }
+
+ return ret_value;
+}
+
+static int test_char_attachscales(const char *fileext)
+{
+ hid_t fid = -1;
+ hid_t did = -1;
+ char dsname[32];
+ char scalename[32];
+ strcpy(dsname, DATASET_NAME);
+ strcat(dsname, "ac");
+
+ TESTING2("test_char_attachscales");
+
+ if((fid = open_test_file(fileext)) < 0)
+ goto out;
+
+ /* make a dataset */
+ if(create_char_dataset(fid, "ac", 0) < 0)
+ goto out;
+
+ if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
+ strcpy(scalename, DS_1_NAME);
+ strcat(scalename, "ac");
+ if(test_attach_scale(fid, did, scalename, DIM0) < 0)
+ goto out;
+
+ strcpy(scalename, DS_2_NAME);
+ strcat(scalename, "ac");
+ if(test_attach_scale(fid, did, scalename, DIM1) < 0)
+ goto out;
+
+ strcpy(scalename, DS_3_NAME);
+ strcat(scalename, "ac");
+ if(test_attach_scale(fid, did, scalename, DIM2) < 0)
+ goto out;
+
+ if(H5Dclose(did) < 0)
+ goto out;
+ }
+ else
+ goto out;
+
+ PASSED();
+
+ H5Fclose(fid);
+ return SUCCEED;
+
+out:
+ H5E_BEGIN_TRY {
+ H5Dclose(did);
+ H5Fclose(fid);
+ } H5E_END_TRY;
+
+ H5_FAILED();
+
+ return FAIL;
+}
+
+static int test_short_attachscales(const char *fileext)
+{
+ hid_t fid = -1;
+ hid_t did = -1;
+ char dsname[32];
+ char scalename[32];
+ strcpy(dsname, DATASET_NAME);
+ strcat(dsname, "as");
+
+ TESTING2("test_short_attachscales");
+
+ if((fid = open_test_file(fileext)) < 0)
+ goto out;
+
+ /* make a dataset */
+ if(create_short_dataset(fid, "as", 1) < 0)
+ goto out;
+
+ if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
+ strcpy(scalename, DS_1_NAME);
+ strcat(scalename, "as");
+ if(test_attach_scale(fid, did, scalename, DIM0) < 0)
+ goto out;
+
+ strcpy(scalename, DS_11_NAME);
+ strcat(scalename, "as");
+ if(test_attach_scale(fid, did, scalename, DIM0) < 0)
+ goto out;
+
+ strcpy(scalename, DS_2_NAME);
+ strcat(scalename, "as");
+ if(test_attach_scale(fid, did, scalename, DIM1) < 0)
+ goto out;
+
+ strcpy(scalename, DS_21_NAME);
+ strcat(scalename, "as");
+ if(test_attach_scale(fid, did, scalename, DIM1) < 0)
+ goto out;
+
+ strcpy(scalename, DS_22_NAME);
+ strcat(scalename, "as");
+ if(test_attach_scale(fid, did, scalename, DIM1) < 0)
+ goto out;
+
+ strcpy(scalename, DS_3_NAME);
+ strcat(scalename, "as");
+ if(test_attach_scale(fid, did, scalename, DIM2) < 0)
+ goto out;
+
+ strcpy(scalename, DS_31_NAME);
+ strcat(scalename, "as");
+ if(test_attach_scale(fid, did, scalename, DIM2) < 0)
+ goto out;
+
+ strcpy(scalename, DS_32_NAME);
+ strcat(scalename, "as");
+ if(test_attach_scale(fid, did, scalename, DIM2) < 0)
+ goto out;
+
+ strcpy(scalename, DS_33_NAME);
+ strcat(scalename, "as");
+ if(test_attach_scale(fid, did, scalename, DIM2) < 0)
+ goto out;
+
+ if(H5Dclose(did) < 0)
+ goto out;
+ }
+ else
+ goto out;
+
+ PASSED();
+
+ H5Fclose(fid);
+ return SUCCEED;
+
+out:
+ H5E_BEGIN_TRY {
+ H5Dclose(did);
+ H5Fclose(fid);
+ } H5E_END_TRY;
+
+ H5_FAILED();
+
+ return FAIL;
+}
+
+static int test_int_attachscales(const char *fileext)
+{
+ hid_t fid = -1;
+ hid_t did = -1;
+ char dsname[32];
+ char scalename[32];
+ strcpy(dsname, DATASET_NAME);
+ strcat(dsname, "a");
+
+ TESTING2("test_int_attachscales");
+
+ if((fid = open_test_file(fileext)) < 0)
+ goto out;
+
+ /* make a dataset */
+ if(create_int_dataset(fid, "a", 1) < 0)
+ goto out;
+
+ if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
+ strcpy(scalename, DS_1_NAME);
+ strcat(scalename, "a");
+ if(test_attach_scale(fid, did, scalename, DIM0) < 0)
+ goto out;
+
+ strcpy(scalename, DS_11_NAME);
+ strcat(scalename, "a");
+ if(test_attach_scale(fid, did, scalename, DIM0) < 0)
+ goto out;
+
+ strcpy(scalename, DS_2_NAME);
+ strcat(scalename, "a");
+ if(test_attach_scale(fid, did, scalename, DIM1) < 0)
+ goto out;
+
+ strcpy(scalename, DS_21_NAME);
+ strcat(scalename, "a");
+ if(test_attach_scale(fid, did, scalename, DIM1) < 0)
+ goto out;
+
+ strcpy(scalename, DS_22_NAME);
+ strcat(scalename, "a");
+ if(test_attach_scale(fid, did, scalename, DIM1) < 0)
+ goto out;
+
+ if(H5Dclose(did) < 0)
+ goto out;
+ }
+ else
+ goto out;
+
+ PASSED();
+
+ H5Fclose(fid);
+ return SUCCEED;
+
+out:
+ H5E_BEGIN_TRY {
+ H5Dclose(did);
+ H5Fclose(fid);
+ } H5E_END_TRY;
+
+ H5_FAILED();
+
+ return FAIL;
+}
+
+static int test_long_attachscales(const char *fileext)
+{
+ hid_t fid = -1;
+ hid_t did = -1;
+ char dsname[32];
+ char scalename[32];
+ strcpy(dsname, DATASET_NAME);
+ strcat(dsname, "al");
+
+ TESTING2("test_long_attachscales");
+
+ if((fid = open_test_file(fileext)) < 0)
+ goto out;
+
+ /* make a dataset */
+ if(create_long_dataset(fid, dsname, "al", 0) < 0)
+ goto out;
+
+ if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
+ strcpy(scalename, DS_1_NAME);
+ strcat(scalename, "al");
+ if(test_attach_scale(fid, did, scalename, DIM0) < 0)
+ goto out;
+
+ strcpy(scalename, DS_2_NAME);
+ strcat(scalename, "al");
+ if(test_attach_scale(fid, did, scalename, DIM1) < 0)
+ goto out;
+
+ strcpy(scalename, DS_3_NAME);
+ strcat(scalename, "al");
+ if(test_attach_scale(fid, did, scalename, DIM2) < 0)
+ goto out;
+
+ strcpy(scalename, DS_4_NAME);
+ strcat(scalename, "al");
+ if(test_attach_scale(fid, did, scalename, DIM3) < 0)
+ goto out;
+
+ if(H5Dclose(did) < 0)
+ goto out;
+ }
+ else
+ goto out;
+
+ PASSED();
+
+ H5Fclose(fid);
+ return SUCCEED;
+
+out:
+ H5E_BEGIN_TRY {
+ H5Dclose(did);
+ H5Fclose(fid);
+ } H5E_END_TRY;
+
+ H5_FAILED();
+
+ return FAIL;
+}
+
+static int test_duplicatelong_attachscales(const char *fileext)
+{
+ hid_t fid = -1;
+ hid_t did = -1;
+ char dsname[32];
+ char scalename[32];
+ strcpy(dsname, DATASET_NAME);
+ strcat(dsname, "al2");
+
+ TESTING2("test_duplicatelong_attachscales");
+
+ if((fid = open_test_file(fileext)) < 0)
+ goto out;
+
+ /* make a dataset 2 */
+ if(create_long_dataset(fid, dsname, "al2", 0) < 0)
+ goto out;
+
+ if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
+ strcpy(scalename, DS_1_NAME);
+ strcat(scalename, "al");
+ if(test_attach_scale(fid, did, scalename, DIM0) < 0)
+ goto out;
+
+ strcpy(scalename, DS_2_NAME);
+ strcat(scalename, "al");
+ if(test_attach_scale(fid, did, scalename, DIM1) < 0)
+ goto out;
+
+ strcpy(scalename, DS_3_NAME);
+ strcat(scalename, "al");
+ if(test_attach_scale(fid, did, scalename, DIM2) < 0)
+ goto out;
+
+ strcpy(scalename, DS_4_NAME);
+ strcat(scalename, "al");
+ if(test_attach_scale(fid, did, scalename, DIM3) < 0)
+ goto out;
+
+ if(H5Dclose(did) < 0)
+ goto out;
+ }
+ else
+ goto out;
+
+ PASSED();
+
+ H5Fclose(fid);
+ return SUCCEED;
+
+out:
+ H5E_BEGIN_TRY {
+ H5Dclose(did);
+ H5Fclose(fid);
+ } H5E_END_TRY;
+
+ H5_FAILED();
+
+ return FAIL;
+}
+
+static int test_float_attachscales(const char *fileext)
+{
+ hid_t fid = -1;
+ hid_t did = -1;
+ char dsname[32];
+ char scalename[32];
+ strcpy(dsname, DATASET_NAME);
+ strcat(dsname, "af");
+
+ TESTING2("test_float_attachscales");
+
+ if((fid = open_test_file(fileext)) < 0)
+ goto out;
+
+ /* make a dataset */
+ if(create_float_dataset(fid, "af", 1) < 0)
+ goto out;
+
+ if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
+ strcpy(scalename, DS_1_NAME);
+ strcat(scalename, "af");
+ if(test_attach_scale(fid, did, scalename, DIM0) < 0)
+ goto out;
+
+ strcpy(scalename, DS_11_NAME);
+ strcat(scalename, "af");
+ if(test_attach_scale(fid, did, scalename, DIM0) < 0)
+ goto out;
+
+ strcpy(scalename, DS_2_NAME);
+ strcat(scalename, "af");
+ if(test_attach_scale(fid, did, scalename, DIM1) < 0)
+ goto out;
+
+ strcpy(scalename, DS_21_NAME);
+ strcat(scalename, "af");
+ if(test_attach_scale(fid, did, scalename, DIM1) < 0)
+ goto out;
+
+ strcpy(scalename, DS_22_NAME);
+ strcat(scalename, "af");
+ if(test_attach_scale(fid, did, scalename, DIM1) < 0)
+ goto out;
+
+ if(H5Dclose(did) < 0)
+ goto out;
+ }
+ else
+ goto out;
+
+ PASSED();
+
+ H5Fclose(fid);
+ return SUCCEED;
+
+out:
+ H5E_BEGIN_TRY {
+ H5Dclose(did);
+ H5Fclose(fid);
+ } H5E_END_TRY;
+
+ H5_FAILED();
+
+ return FAIL;
+}
+
+static int test_numberofscales(const char *fileext)
+{
+ hid_t fid = -1;
+ hid_t did = -1;
int nscales; /* number of scales in DIM */
- ssize_t name_len; /* lenght of name buffer */
- char *name_out=NULL; /* scale name buffer */
- char snames[3]; /* scale name buffer */
- int i, j;
+ char dsname[32];
+ char scalename[32];
+ strcpy(dsname, DATASET_NAME);
+ strcat(dsname, "a");
+
+ TESTING2("test_numberofscales");
+
+ if((fid = open_test_file(fileext)) < 0)
+ goto out;
+
+ if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
+ if((nscales = H5DSget_num_scales(did, 0)) < 0)
+ goto out;
+
+ if(nscales != 2)
+ goto out;
+
+ if((nscales = H5DSget_num_scales(did, 1)) < 0)
+ goto out;
+
+ if(nscales != 3)
+ goto out;
+
+ if(H5Dclose(did) < 0)
+ goto out;
+ }
+ else
+ goto out;
+
+ strcpy(dsname, DATASET_NAME);
+ strcat(dsname, "b");
+
+ /* make a dataset */
+ if(create_int_dataset(fid, "b", 1) < 0)
+ goto out;
+
+ /* make a DS dataset for the first dimension */
+ if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
+ strcpy(scalename, DS_1_NAME);
+ strcat(scalename, "b");
+ if(test_attach_scale(fid, did, scalename, DIM0) < 0)
+ goto out;
+
+ if((nscales = H5DSget_num_scales(did, 0)) < 0)
+ goto out;
+
+ if(nscales != 1)
+ goto out;
+
+ if((nscales = H5DSget_num_scales(did, 1)) < 0)
+ goto out;
+
+ if(nscales != 0)
+ goto out;
+
+ if(H5Dclose(did) < 0)
+ goto out;
+ }
+ else
+ goto out;
+
+ PASSED();
+
+ H5Fclose(fid);
+ return SUCCEED;
+
+out:
+ H5E_BEGIN_TRY {
+ H5Dclose(did);
+ H5Fclose(fid);
+ } H5E_END_TRY;
+
+ H5_FAILED();
+
+ return FAIL;
+}
+
+static int test_char_scalenames(const char *fileext) {
+ hid_t fid = -1;
+ hid_t did = -1;
+ char dsname[32];
+ char scalename[32];
+ char name[32];
+ strcpy(dsname, DATASET_NAME);
+ strcat(dsname, "ac");
+
+ if((fid = open_test_file(fileext)) < 0)
+ goto out;
+
+ TESTING2("set char scale/cmp scale name");
+ if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
+ strcpy(scalename, DS_1_NAME);
+ strcat(scalename, "ac");
+ strcpy(name, SCALE_1_NAME);
+ strcat(name, "ac");
+ if(test_set_scalename(fid, did, scalename, name, DIM0) < 0)
+ goto out;
+
+ if(test_cmp_scalename(fid, did, scalename, name, DIM0) < 0)
+ goto out;
+
+ strcpy(scalename, DS_2_NAME);
+ strcat(scalename, "ac");
+ strcpy(name, SCALE_2_NAME);
+ strcat(name, "ac");
+ if(test_set_scalename(fid, did, scalename, name, DIM1) < 0)
+ goto out;
+
+ if(test_cmp_scalename(fid, did, scalename, name, DIM1) < 0)
+ goto out;
+
+ strcpy(scalename, DS_3_NAME);
+ strcat(scalename, "ac");
+ strcpy(name, SCALE_3_NAME);
+ strcat(name, "ac");
+ if(test_set_scalename(fid, did, scalename, name, DIM2) < 0)
+ goto out;
+
+ if(test_cmp_scalename(fid, did, scalename, name, DIM2) < 0)
+ goto out;
+
+ if(H5Dclose(did) < 0)
+ goto out;
+ }
+ else
+ goto out;
+
+ PASSED();
+
+ H5Fclose(fid);
+ return SUCCEED;
+
+out:
+ H5E_BEGIN_TRY {
+ H5Dclose(did);
+ H5Fclose(fid);
+ } H5E_END_TRY;
+
+ H5_FAILED();
+
+ return FAIL;
+}
+
+static int test_short_scalenames(const char *fileext) {
+ hid_t fid = -1;
+ hid_t did = -1;
+ char dsname[32];
+ char scalename[32];
+ char name[32];
+ strcpy(dsname, DATASET_NAME);
+ strcat(dsname, "as");
+
+ if((fid = open_test_file(fileext)) < 0)
+ goto out;
+
+ TESTING2("set short scale/cmp scale name");
+ if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
+ strcpy(scalename, DS_1_NAME);
+ strcat(scalename, "as");
+ strcpy(name, SCALE_1_NAME);
+ strcat(name, "as");
+ if(test_set_scalename(fid, did, scalename, name, DIM0) < 0)
+ goto out;
+
+ if(test_cmp_scalename(fid, did, scalename, name, DIM0) < 0)
+ goto out;
+
+ strcpy(scalename, DS_11_NAME);
+ strcat(scalename, "as");
+ strcpy(name, SCALE_11_NAME);
+ strcat(name, "as");
+ if(test_set_scalename(fid, did, scalename, name, DIM0) < 0)
+ goto out;
+
+ if(test_cmp_scalename(fid, did, scalename, name, DIM0) < 0)
+ goto out;
+
+ strcpy(scalename, DS_2_NAME);
+ strcat(scalename, "as");
+ strcpy(name, SCALE_2_NAME);
+ strcat(name, "as");
+ if(test_set_scalename(fid, did, scalename, name, DIM1) < 0)
+ goto out;
+
+ if(test_cmp_scalename(fid, did, scalename, name, DIM1) < 0)
+ goto out;
+
+ strcpy(scalename, DS_21_NAME);
+ strcat(scalename, "as");
+ strcpy(name, SCALE_21_NAME);
+ strcat(name, "as");
+ if(test_set_scalename(fid, did, scalename, name, DIM1) < 0)
+ goto out;
+
+ if(test_cmp_scalename(fid, did, scalename, name, DIM1) < 0)
+ goto out;
+
+ strcpy(scalename, DS_22_NAME);
+ strcat(scalename, "as");
+ strcpy(name, SCALE_22_NAME);
+ strcat(name, "as");
+ if(test_set_scalename(fid, did, scalename, name, DIM1) < 0)
+ goto out;
+
+ if(test_cmp_scalename(fid, did, scalename, name, DIM1) < 0)
+ goto out;
+
+ strcpy(scalename, DS_3_NAME);
+ strcat(scalename, "as");
+ strcpy(name, SCALE_3_NAME);
+ strcat(name, "as");
+ if(test_set_scalename(fid, did, scalename, name, DIM2) < 0)
+ goto out;
+
+ if(test_cmp_scalename(fid, did, scalename, name, DIM2) < 0)
+ goto out;
+
+ strcpy(scalename, DS_31_NAME);
+ strcat(scalename, "as");
+ strcpy(name, SCALE_31_NAME);
+ strcat(name, "as");
+ if(test_set_scalename(fid, did, scalename, name, DIM2) < 0)
+ goto out;
+
+ if(test_cmp_scalename(fid, did, scalename, name, DIM2) < 0)
+ goto out;
+
+ strcpy(scalename, DS_32_NAME);
+ strcat(scalename, "as");
+ strcpy(name, SCALE_32_NAME);
+ strcat(name, "as");
+ if(test_set_scalename(fid, did, scalename, name, DIM2) < 0)
+ goto out;
+
+ if(test_cmp_scalename(fid, did, scalename, name, DIM2) < 0)
+ goto out;
+
+ strcpy(scalename, DS_33_NAME);
+ strcat(scalename, "as");
+ strcpy(name, SCALE_33_NAME);
+ strcat(name, "as");
+ if(test_set_scalename(fid, did, scalename, name, DIM2) < 0)
+ goto out;
+
+ if(test_cmp_scalename(fid, did, scalename, name, DIM2) < 0)
+ goto out;
+
+ if(H5Dclose(did) < 0)
+ goto out;
+ }
+ else
+ goto out;
+ PASSED();
+
+ H5Fclose(fid);
+ return SUCCEED;
+
+out:
+ H5E_BEGIN_TRY {
+ H5Dclose(did);
+ H5Fclose(fid);
+ } H5E_END_TRY;
+
+ H5_FAILED();
+
+ return FAIL;
+}
+
+static int test_int_scalenames(const char *fileext) {
+ hid_t fid = -1;
+ hid_t did = -1;
+ char dsname[32];
+ char scalename[32];
+ char name[32];
+ strcpy(dsname, DATASET_NAME);
+ strcat(dsname, "a");
+
+ if((fid = open_test_file(fileext)) < 0)
+ goto out;
+
+ TESTING2("set int scale/cmp scale name");
+ if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
+ strcpy(scalename, DS_1_NAME);
+ strcat(scalename, "a");
+ strcpy(name, SCALE_1_NAME);
+ strcat(name, "a");
+ if(test_set_scalename(fid, did, scalename, name, DIM0) < 0)
+ goto out;
+
+ if(test_cmp_scalename(fid, did, scalename, name, DIM0) < 0)
+ goto out;
+
+ strcpy(scalename, DS_11_NAME);
+ strcat(scalename, "a");
+ strcpy(name, SCALE_11_NAME);
+ strcat(name, "a");
+ if(test_set_scalename(fid, did, scalename, name, DIM0) < 0)
+ goto out;
+
+ if(test_cmp_scalename(fid, did, scalename, name, DIM0) < 0)
+ goto out;
+
+ strcpy(scalename, DS_2_NAME);
+ strcat(scalename, "a");
+ strcpy(name, SCALE_2_NAME);
+ strcat(name, "a");
+ if(test_set_scalename(fid, did, scalename, name, DIM1) < 0)
+ goto out;
+
+ if(test_cmp_scalename(fid, did, scalename, name, DIM1) < 0)
+ goto out;
+
+ strcpy(scalename, DS_21_NAME);
+ strcat(scalename, "a");
+ strcpy(name, SCALE_21_NAME);
+ strcat(name, "a");
+ if(test_set_scalename(fid, did, scalename, name, DIM1) < 0)
+ goto out;
+
+ if(test_cmp_scalename(fid, did, scalename, name, DIM1) < 0)
+ goto out;
+
+ strcpy(scalename, DS_22_NAME);
+ strcat(scalename, "a");
+ strcpy(name, SCALE_22_NAME);
+ strcat(name, "a");
+ if(test_set_scalename(fid, did, scalename, name, DIM1) < 0)
+ goto out;
+
+ if(test_cmp_scalename(fid, did, scalename, name, DIM1) < 0)
+ goto out;
+
+ if(H5Dclose(did) < 0)
+ goto out;
+ }
+ else
+ goto out;
+
+ PASSED();
+
+ H5Fclose(fid);
+ return 0;
+
+out:
+ H5E_BEGIN_TRY {
+ H5Dclose(did);
+ H5Fclose(fid);
+ } H5E_END_TRY;
+
+ H5_FAILED();
+
+ return FAIL;
+}
+
+static int test_long_scalenames(const char *fileext) {
+ hid_t fid = -1;
+ hid_t did = -1;
+ char dsname[32];
+ char scalename[32];
+ char name[32];
+ strcpy(dsname, DATASET_NAME);
+ strcat(dsname, "al");
+
+ if((fid = open_test_file(fileext)) < 0)
+ goto out;
+
+ TESTING2("set long scale/cmp scale name");
+ if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
+ strcpy(scalename, DS_1_NAME);
+ strcat(scalename, "al");
+ strcpy(name, SCALE_1_NAME);
+ strcat(name, "al");
+ if(test_set_scalename(fid, did, scalename, name, DIM0) < 0)
+ goto out;
+
+ if(test_cmp_scalename(fid, did, scalename, name, DIM0) < 0)
+ goto out;
+
+ strcpy(scalename, DS_2_NAME);
+ strcat(scalename, "al");
+ strcpy(name, SCALE_2_NAME);
+ strcat(name, "al");
+ if(test_set_scalename(fid, did, scalename, name, DIM1) < 0)
+ goto out;
+
+ if(test_cmp_scalename(fid, did, scalename, name, DIM1) < 0)
+ goto out;
+
+ strcpy(scalename, DS_3_NAME);
+ strcat(scalename, "al");
+ strcpy(name, SCALE_3_NAME);
+ strcat(name, "al");
+ if(test_set_scalename(fid, did, scalename, name, DIM2) < 0)
+ goto out;
+
+ if(test_cmp_scalename(fid, did, scalename, name, DIM2) < 0)
+ goto out;
+
+ strcpy(scalename, DS_4_NAME);
+ strcat(scalename, "al");
+ strcpy(name, SCALE_4_NAME);
+ strcat(name, "al");
+ if(test_set_scalename(fid, did, scalename, name, DIM3) < 0)
+ goto out;
+
+ if(test_cmp_scalename(fid, did, scalename, name, DIM3) < 0)
+ goto out;
+
+ if(H5Dclose(did) < 0)
+ goto out;
+ }
+ else
+ goto out;
+
+ PASSED();
+
+ H5Fclose(fid);
+ return SUCCEED;
+
+out:
+ H5E_BEGIN_TRY {
+ H5Dclose(did);
+ H5Fclose(fid);
+ } H5E_END_TRY;
+
+ H5_FAILED();
+
+ return FAIL;
+}
+
+static int test_samelong_scalenames(const char *fileext) {
+ hid_t fid = -1;
+ hid_t did = -1;
+ char dsname[32];
+ char scalename[32];
+ char name[32];
+ strcpy(dsname, DATASET_NAME);
+ strcat(dsname, "al2");
+
+ if((fid = open_test_file(fileext)) < 0)
+ goto out;
+
+ TESTING2("set same long scale/cmp scale name");
+ if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
+ strcpy(scalename, DS_1_NAME);
+ strcat(scalename, "al");
+ strcpy(name, DS_1_NAME);
+ strcat(name, "al");
+ if(test_set_scalename(fid, did, scalename, name, DIM0) < 0)
+ goto out;
+
+ if(test_cmp_scalename(fid, did, scalename, name, DIM0) < 0)
+ goto out;
+
+ strcpy(scalename, DS_2_NAME);
+ strcat(scalename, "al");
+ strcpy(name, DS_2_NAME);
+ strcat(name, "al");
+ if(test_set_scalename(fid, did, scalename, name, DIM1) < 0)
+ goto out;
+
+ if(test_cmp_scalename(fid, did, scalename, name, DIM1) < 0)
+ goto out;
+
+ strcpy(scalename, DS_3_NAME);
+ strcat(scalename, "al");
+ strcpy(name, DS_3_NAME);
+ strcat(name, "al");
+ if(test_set_scalename(fid, did, scalename, name, DIM2) < 0)
+ goto out;
+
+ if(test_cmp_scalename(fid, did, scalename, name, DIM2) < 0)
+ goto out;
+
+ strcpy(scalename, DS_4_NAME);
+ strcat(scalename, "al");
+ strcpy(name, DS_4_NAME);
+ strcat(name, "al");
+ if(test_set_scalename(fid, did, scalename, name, DIM3) < 0)
+ goto out;
+
+ if(test_cmp_scalename(fid, did, scalename, name, DIM3) < 0)
+ goto out;
+
+ if(H5Dclose(did) < 0)
+ goto out;
+ }
+ else
+ goto out;
+
+ PASSED();
+
+ H5Fclose(fid);
+ return SUCCEED;
+
+out:
+ H5E_BEGIN_TRY {
+ H5Dclose(did);
+ H5Fclose(fid);
+ } H5E_END_TRY;
+
+ H5_FAILED();
+
+ return FAIL;
+}
+static int test_float_scalenames(const char *fileext) {
+ hid_t fid = -1;
+ hid_t did = -1;
+ char dsname[32];
+ char scalename[32];
+ char name[32];
+ strcpy(dsname, DATASET_NAME);
+ strcat(dsname, "af");
+
+ if((fid = open_test_file(fileext)) < 0)
+ goto out;
+
+ TESTING2("set float scale/cmp scale name");
+ if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
+ strcpy(scalename, DS_1_NAME);
+ strcat(scalename, "af");
+ strcpy(name, SCALE_1_NAME);
+ strcat(name, "af");
+ if(test_set_scalename(fid, did, scalename, name, DIM0) < 0)
+ goto out;
+
+ if(test_cmp_scalename(fid, did, scalename, name, DIM0) < 0)
+ goto out;
+
+ strcpy(scalename, DS_11_NAME);
+ strcat(scalename, "af");
+ strcpy(name, SCALE_11_NAME);
+ strcat(name, "af");
+ if(test_set_scalename(fid, did, scalename, name, DIM0) < 0)
+ goto out;
+
+ if(test_cmp_scalename(fid, did, scalename, name, DIM0) < 0)
+ goto out;
+
+ strcpy(scalename, DS_2_NAME);
+ strcat(scalename, "af");
+ strcpy(name, SCALE_2_NAME);
+ strcat(name, "af");
+ if(test_set_scalename(fid, did, scalename, name, DIM1) < 0)
+ goto out;
+
+ if(test_cmp_scalename(fid, did, scalename, name, DIM1) < 0)
+ goto out;
+
+ strcpy(scalename, DS_21_NAME);
+ strcat(scalename, "af");
+ strcpy(name, SCALE_21_NAME);
+ strcat(name, "af");
+ if(test_set_scalename(fid, did, scalename, name, DIM1) < 0)
+ goto out;
+
+ if(test_cmp_scalename(fid, did, scalename, name, DIM1) < 0)
+ goto out;
+
+ strcpy(scalename, DS_22_NAME);
+ strcat(scalename, "af");
+ strcpy(name, SCALE_22_NAME);
+ strcat(name, "af");
+ if(test_set_scalename(fid, did, scalename, name, DIM1) < 0)
+ goto out;
+
+ if(test_cmp_scalename(fid, did, scalename, name, DIM1) < 0)
+ goto out;
+
+ if(H5Dclose(did) < 0)
+ goto out;
+ }
+ else
+ goto out;
+
+ PASSED();
+
+ H5Fclose(fid);
+ return 0;
+
+out:
+ H5E_BEGIN_TRY {
+ H5Dclose(did);
+ H5Fclose(fid);
+ } H5E_END_TRY;
+
+ H5_FAILED();
+
+ return FAIL;
+}
+
+static int test_foreign_scaleattached(const char *fileforeign)
+{
+ herr_t ret_value = FAIL;
+ hid_t fid = -1;
+ hid_t did = -1;
+ hid_t dsid = -1;
+ char *srcdir = getenv("srcdir"); /* the source directory */
+ char filename[512]=""; /* buffer to hold name of existing file */
+
+ /* compose the name of the file to open, using the srcdir, if appropriate */
+ if (srcdir) {
+ strcpy(filename,srcdir);
+ strcat(filename,"/");
+ }
+ strcat(filename, fileforeign);
+
+ TESTING2("test_foreign_scaleattached");
+
+ if((fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ goto out;
+
+ if((did = H5Dopen2(fid, "/dset_al", H5P_DEFAULT)) >= 0) {
+ if((dsid = H5Dopen2(fid, "/ds_4_al", H5P_DEFAULT)) >= 0) {
+ if(H5DSis_attached(did, dsid, 3) == 1) {
+ ret_value = SUCCEED;
+ }
+ if(H5Dclose(dsid) < 0)
+ goto out;
+ }
+ if(H5Dclose(did) < 0)
+ goto out;
+ }
+ else
+ goto out;
+
+ if(ret_value == FAIL)
+ goto out;
+
+ PASSED();
+
+ H5Fclose(fid);
+ return 0;
+
+out:
+ H5E_BEGIN_TRY {
+ H5Dclose(did);
+ H5Fclose(fid);
+ } H5E_END_TRY;
+
+ H5_FAILED();
+
+ return FAIL;
+}
+
+static int test_simple(void)
+{
+ hid_t fid = -1;
+ hid_t did = -1;
+ hid_t dsid = -1;
+ hid_t sid = -1;
+ hid_t gid = -1;
+ int rank = RANK;
+ int rankds = 1;
+ hsize_t dims[RANK] = {DIM1_SIZE,DIM2_SIZE};
+ int buf[DIM_DATA] = {1,2,3,4,5,6,7,8,9,10,11,12};
+ hsize_t s1_dim[1] = {DIM1_SIZE};
+ hsize_t s2_dim[1] = {DIM2_SIZE};
+ char sname[30];
+ char dname[30];
+ int s1_wbuf[DIM1_SIZE] = {10,20,30};
+ int s11_wbuf[DIM1_SIZE] = {10,100,300};
+ int s2_wbuf[DIM2_SIZE] = {100,200,300,400};
+ int s21_wbuf[DIM2_SIZE] = {10,20,30,40};
+ int s22_wbuf[DIM2_SIZE] = {5,10,50,300};
+ char dim0_label[16];
+ char dim1_label[16];
+ char *dim0_labeld;
+ char *dim1_labeld;
+ char dim0_labels[3];
+ char dim1_labels[3];
+ ssize_t dim0_label_size;
+ ssize_t dim1_label_size;
+ unsigned int dim;
+ int scale_idx;
+ int nscales;
+ ssize_t name_len;
+ char *name_out=NULL;
+ char snames[3];
+ int i, j;
+
printf("Testing API functions\n");
/*-------------------------------------------------------------------------
@@ -173,33 +2248,25 @@ static int test_simple(void)
goto out;
/* make a DS dataset for the first dimension */
- if(H5LTmake_dataset_int(fid,DS_1_NAME,rankds,s1_dim,s1_wbuf) < 0)
+ if(H5LTmake_dataset_int(fid,"ds_a_1",rankds,s1_dim,s1_wbuf) < 0)
goto out;
/* make a DS dataset with an alternate scale for the 2nd dimension */
- if(H5LTmake_dataset_int(fid,DS_11_NAME,rankds,s1_dim,s11_wbuf) < 0)
+ if(H5LTmake_dataset_int(fid,"ds_a_11",rankds,s1_dim,s11_wbuf) < 0)
goto out;
/* make a DS dataset for the second dimension */
- if(H5LTmake_dataset_int(fid,DS_2_NAME,rankds,s2_dim,s2_wbuf) < 0)
+ if(H5LTmake_dataset_int(fid,"ds_a_2",rankds,s2_dim,s2_wbuf) < 0)
goto out;
/* make a DS dataset with an alternate scale for the 2nd dimension */
- if(H5LTmake_dataset_int(fid,DS_21_NAME,rankds,s2_dim,s21_wbuf) < 0)
+ if(H5LTmake_dataset_int(fid,"ds_a_21",rankds,s2_dim,s21_wbuf) < 0)
goto out;
/* make a DS dataset with an alternate scale for the 2nd dimension */
- if(H5LTmake_dataset_int(fid,DS_22_NAME,rankds,s2_dim,s22_wbuf) < 0)
+ if(H5LTmake_dataset_int(fid,"ds_a_22",rankds,s2_dim,s22_wbuf) < 0)
goto out;
-
- /*-------------------------------------------------------------------------
- * H5DSattach_scale
- *-------------------------------------------------------------------------
- */
-
- TESTING2("attach scales");
-
/* get the dataset id for "dset_a" */
if((did = H5Dopen2(fid,"dset_a", H5P_DEFAULT)) < 0)
goto out;
@@ -210,7 +2277,7 @@ static int test_simple(void)
*/
/* get the DS dataset id */
- if((dsid = H5Dopen2(fid,DS_1_NAME, H5P_DEFAULT)) < 0)
+ if((dsid = H5Dopen2(fid,"ds_a_1", H5P_DEFAULT)) < 0)
goto out;
/* attach the DS_1_NAME dimension scale to "dset_a" at dimension 0 */
@@ -227,7 +2294,7 @@ static int test_simple(void)
*/
/* get the DS dataset id */
- if((dsid = H5Dopen2(fid,DS_11_NAME, H5P_DEFAULT)) < 0)
+ if((dsid = H5Dopen2(fid,"ds_a_11", H5P_DEFAULT)) < 0)
goto out;
/* attach the DS_11_NAME dimension scale to "dset_a" at dimension 0 */
@@ -244,7 +2311,7 @@ static int test_simple(void)
*/
/* get the DS dataset id */
- if((dsid = H5Dopen2(fid,DS_2_NAME, H5P_DEFAULT)) < 0)
+ if((dsid = H5Dopen2(fid,"ds_a_2", H5P_DEFAULT)) < 0)
goto out;
/* attach the "ds2" dimension scale to "dset_a" as the 2nd dimension */
@@ -261,7 +2328,7 @@ static int test_simple(void)
*/
/* get the DS dataset id */
- if((dsid = H5Dopen2(fid,DS_21_NAME, H5P_DEFAULT)) < 0)
+ if((dsid = H5Dopen2(fid,"ds_a_21", H5P_DEFAULT)) < 0)
goto out;
/* attach the DS_21_NAME dimension scale to "dset_a" as the 2nd dimension */
@@ -278,7 +2345,7 @@ static int test_simple(void)
*/
/* get the DS dataset id */
- if((dsid = H5Dopen2(fid,DS_22_NAME, H5P_DEFAULT)) < 0)
+ if((dsid = H5Dopen2(fid,"ds_a_22", H5P_DEFAULT)) < 0)
goto out;
/* attach the "ds22" dimension scale to "dset_a" as the 2nd dimension */
@@ -289,84 +2356,10 @@ static int test_simple(void)
if(H5Dclose(dsid) < 0)
goto out;
-
-
- /*-------------------------------------------------------------------------
- * verify attachment
- *-------------------------------------------------------------------------
- */
-
- if((dsid = H5Dopen2(fid,DS_1_NAME, H5P_DEFAULT)) < 0)
- goto out;
- if(H5DSis_attached(did,dsid,DIM0)<=0)
- goto out;
- if(H5Dclose(dsid))
- goto out;
-
- if((dsid = H5Dopen2(fid,DS_2_NAME, H5P_DEFAULT)) < 0)
- goto out;
- if(H5DSis_attached(did,dsid,DIM1)<=0)
- goto out;
- if(H5Dclose(dsid))
- goto out;
-
- if((dsid = H5Dopen2(fid,DS_21_NAME, H5P_DEFAULT)) < 0)
- goto out;
- if(H5DSis_attached(did,dsid,DIM1)<=0)
- goto out;
- if(H5Dclose(dsid))
- goto out;
-
- if((dsid = H5Dopen2(fid,DS_22_NAME, H5P_DEFAULT)) < 0)
- goto out;
- if(H5DSis_attached(did,dsid,DIM1)<=0)
- goto out;
- if(H5Dclose(dsid))
- goto out;
-
-
/* close dataset ID of "dset_a" */
if(H5Dclose(did) < 0)
goto out;
-
- PASSED();
-
-
- /*-------------------------------------------------------------------------
- * H5DSget_num_scales
- *-------------------------------------------------------------------------
- */
-
-
- TESTING2("get number of scales");
-
- /*-------------------------------------------------------------------------
- * verify that "dset_a" has dimension scales
- *-------------------------------------------------------------------------
- */
-
- /* get the dataset id for "dset_a" */
- if((did = H5Dopen2(fid,"dset_a", H5P_DEFAULT)) < 0)
- goto out;
-
- /* verify that "dset_a" has 1 dimension scale at DIM 0 */
- if((nscales = H5DSget_num_scales(did,0)) < 0)
- goto out;
- if(nscales!=2)
- goto out;
-
- /* verify that "dset_a" has 3 dimension scales at DIM 1 */
- if((nscales = H5DSget_num_scales(did,1)) < 0)
- goto out;
- if(nscales!=3)
- goto out;
-
- /* close dataset ID of "dset_a" */
- if(H5Dclose(did) < 0)
- goto out;
-
-
/*-------------------------------------------------------------------------
* create datasets: 1 "data" dataset and 1 dimension scale
*-------------------------------------------------------------------------
@@ -393,36 +2386,12 @@ static int test_simple(void)
goto out;
if(H5Dclose(dsid) < 0)
goto out;
- if(H5Dclose(did) < 0)
- goto out;
-
- /*-------------------------------------------------------------------------
- * verify if "dset_b" has dimension scales
- *-------------------------------------------------------------------------
- */
-
- /* get the dataset id for "dset_b" */
- if((did = H5Dopen2(fid,"dset_b", H5P_DEFAULT)) < 0)
- goto out;
-
- /* verify that "dset_b" has 1 dimension scale at DIM 0 */
- if((nscales = H5DSget_num_scales(did,0)) < 0)
- goto out;
- if(nscales!=1)
- goto out;
-
- /* verify that "dset_b" has 0 dimension scales at DIM 1 */
- if((nscales = H5DSget_num_scales(did,1)) < 0)
- goto out;
- if(nscales!=0)
- goto out;
/* close dataset ID of "dset_b" */
if(H5Dclose(did) < 0)
goto out;
- PASSED();
-
+
/*-------------------------------------------------------------------------
* H5DSdetach_scale
@@ -438,23 +2407,23 @@ static int test_simple(void)
*/
/* make a dataset */
- if(H5LTmake_dataset_int(fid,"dset_c",rank,dims,buf) < 0)
+ if(H5LTmake_dataset_int(fid, "dset_c", rank, dims, buf) < 0)
goto out;
/* make a DS dataset for the first dimension */
- if(H5LTmake_dataset_int(fid,"ds_c_1",rankds,s1_dim,s1_wbuf) < 0)
+ if(H5LTmake_dataset_int(fid, "ds_c_1", rankds, s1_dim, s1_wbuf) < 0)
goto out;
/* make a DS dataset for the second dimension */
- if(H5LTmake_dataset_int(fid,"ds_c_2",rankds,s2_dim,s2_wbuf) < 0)
+ if(H5LTmake_dataset_int(fid, "ds_c_2", rankds, s2_dim, s2_wbuf) < 0)
goto out;
/* make a DS dataset with an alternate scale for the 2nd dimension */
- if(H5LTmake_dataset_int(fid,"ds_c_21",rankds,s2_dim,s2_wbuf) < 0)
+ if(H5LTmake_dataset_int(fid, "ds_c_21", rankds, s2_dim, s2_wbuf) < 0)
goto out;
/* make a DS dataset with an alternate scale for the 2nd dimension */
- if(H5LTmake_dataset_int(fid,"ds_c_22",rankds,s2_dim,s2_wbuf) < 0)
+ if(H5LTmake_dataset_int(fid, "ds_c_22", rankds, s2_dim, s2_wbuf) < 0)
goto out;
@@ -465,32 +2434,35 @@ static int test_simple(void)
if((did = H5Dopen2(fid,"dset_c", H5P_DEFAULT)) < 0)
goto out;
-
if((dsid = H5Dopen2(fid,"ds_c_1", H5P_DEFAULT)) < 0)
goto out;
- if(H5DSattach_scale(did,dsid,0) < 0)
+ if(H5DSattach_scale(did, dsid, 0) < 0)
goto out;
+
if(H5Dclose(dsid) < 0)
goto out;
if((dsid = H5Dopen2(fid,"ds_c_2", H5P_DEFAULT)) < 0)
goto out;
- if(H5DSattach_scale(did,dsid,1) < 0)
+ if(H5DSattach_scale(did, dsid, 1) < 0)
goto out;
+
if(H5Dclose(dsid) < 0)
goto out;
if((dsid = H5Dopen2(fid,"ds_c_21", H5P_DEFAULT)) < 0)
goto out;
- if(H5DSattach_scale(did,dsid,1) < 0)
+ if(H5DSattach_scale(did, dsid, 1) < 0)
goto out;
+
if(H5Dclose(dsid) < 0)
goto out;
if((dsid = H5Dopen2(fid,"ds_c_22", H5P_DEFAULT)) < 0)
goto out;
- if(H5DSattach_scale(did,dsid,1) < 0)
+ if(H5DSattach_scale(did, dsid, 1) < 0)
goto out;
+
if(H5Dclose(dsid) < 0)
goto out;
@@ -505,15 +2477,18 @@ static int test_simple(void)
if((did = H5Dopen2(fid,"dset_c", H5P_DEFAULT)) < 0)
goto out;
/* verify that "dset_c" has 1 dimension scale at DIM 0 */
- if((nscales = H5DSget_num_scales(did,0)) < 0)
+ if((nscales = H5DSget_num_scales(did, 0)) < 0)
goto out;
- if(nscales!=1)
+
+ if(nscales != 1)
goto out;
/* verify that "dset_c" has 3 dimension scales at DIM 1 */
- if((nscales = H5DSget_num_scales(did,1)) < 0)
+ if((nscales = H5DSget_num_scales(did, 1)) < 0)
goto out;
- if(nscales!=3)
+
+ if(nscales != 3)
goto out;
+
if(H5Dclose(did) < 0)
goto out;
@@ -531,7 +2506,7 @@ static int test_simple(void)
goto out;
/* detach the "ds_c_21" dimension scale to "dset_c" in DIM 1 */
- if(H5DSdetach_scale(did,dsid,1) < 0)
+ if(H5DSdetach_scale(did, dsid, 1) < 0)
goto out;
/* close DS id */
@@ -550,10 +2525,12 @@ static int test_simple(void)
if((did = H5Dopen2(fid,"dset_c", H5P_DEFAULT)) < 0)
goto out;
/* verify that "dset_c" has 2 dimension scales at DIM 1 */
- if((nscales = H5DSget_num_scales(did,1)) < 0)
+ if((nscales = H5DSget_num_scales(did, 1)) < 0)
goto out;
- if(nscales!=2)
+
+ if(nscales != 2)
goto out;
+
if(H5Dclose(did) < 0)
goto out;
@@ -571,7 +2548,7 @@ static int test_simple(void)
goto out;
/* detach the "ds_c_22" dimension scale to "dset_c" in DIM 1 */
- if(H5DSdetach_scale(did,dsid,1) < 0)
+ if(H5DSdetach_scale(did, dsid, 1) < 0)
goto out;
/* close DS id */
@@ -590,10 +2567,12 @@ static int test_simple(void)
if((did = H5Dopen2(fid,"dset_c", H5P_DEFAULT)) < 0)
goto out;
/* verify that "dset_c" has 1 dimension scale at DIM 1 */
- if((nscales = H5DSget_num_scales(did,1)) < 0)
+ if((nscales = H5DSget_num_scales(did, 1)) < 0)
goto out;
- if(nscales!=1)
+
+ if(nscales != 1)
goto out;
+
if(H5Dclose(did) < 0)
goto out;
@@ -611,7 +2590,7 @@ static int test_simple(void)
goto out;
/* detach the "ds_c_2" dimension scale to "dset_c" in DIM 1 */
- if(H5DSdetach_scale(did,dsid,1) < 0)
+ if(H5DSdetach_scale(did, dsid, 1) < 0)
goto out;
/* close DS id */
@@ -630,10 +2609,12 @@ static int test_simple(void)
if((did = H5Dopen2(fid,"dset_c", H5P_DEFAULT)) < 0)
goto out;
/* verify that "dset_c" has 1 dimension scale at DIM 1 */
- if((nscales = H5DSget_num_scales(did,1)) < 0)
+ if((nscales = H5DSget_num_scales(did, 1)) < 0)
goto out;
- if(nscales!=0)
+
+ if(nscales != 0)
goto out;
+
if(H5Dclose(did) < 0)
goto out;
@@ -655,17 +2636,19 @@ static int test_simple(void)
*/
if((did = H5Dopen2(fid,"dset_d", H5P_DEFAULT)) < 0)
goto out;
-
if((dsid = H5Dopen2(fid,"ds_d_1", H5P_DEFAULT)) < 0)
goto out;
- if(H5DSattach_scale(did,dsid,0) < 0)
+ if(H5DSattach_scale(did, dsid, 0) < 0)
goto out;
+
if(H5Dclose(dsid) < 0)
goto out;
+
if((dsid = H5Dopen2(fid,"ds_d_2", H5P_DEFAULT)) < 0)
goto out;
- if(H5DSattach_scale(did,dsid,1) < 0)
+ if(H5DSattach_scale(did, dsid, 1) < 0)
goto out;
+
if(H5Dclose(dsid) < 0)
goto out;
@@ -679,7 +2662,6 @@ static int test_simple(void)
if((did = H5Dopen2(fid,"dset_d", H5P_DEFAULT)) < 0)
goto out;
-
if((dsid = H5Dopen2(fid,"ds_d_1", H5P_DEFAULT)) < 0)
goto out;
if(H5DSis_attached(did,dsid,DIM0)<=0)
@@ -751,7 +2733,7 @@ static int test_simple(void)
/* verify that "ds_d_1" has only 1 scale at DIM0 */
if((nscales = H5DSget_num_scales(did,DIM0)) < 0)
goto out;
- if(nscales!=1)
+ if(nscales != 1)
goto out;
/* close DS id */
@@ -790,7 +2772,7 @@ static int test_simple(void)
/* verify that "ds_d_1" has no scale at DIM1 */
if((nscales = H5DSget_num_scales(did,DIM1)) < 0)
goto out;
- if(nscales!=0)
+ if(nscales != 0)
goto out;
/* close DS id */
@@ -825,7 +2807,7 @@ static int test_simple(void)
/* verify that "ds_d_2" has only 1 scale at DIM1 */
if((nscales = H5DSget_num_scales(did,DIM0)) < 0)
goto out;
- if(nscales!=1)
+ if(nscales != 1)
goto out;
/* attach "ds_d_2" again in DIM 1 */
@@ -862,7 +2844,6 @@ static int test_simple(void)
/* create the data space for the dataset */
if((sid = H5Screate_simple(rank,dims,NULL)) < 0)
goto out;
-
for(i = 0; i < 5; i++) {
sprintf(dname,"dset_%d",i);
if((did = H5Dcreate2(gid, dname, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
@@ -950,6 +2931,7 @@ static int test_simple(void)
/* close */
if(H5Sclose(sid) < 0)
goto out;
+
if(H5Gclose(gid) < 0)
goto out;
@@ -993,9 +2975,9 @@ static int test_simple(void)
goto out;
}
}
-
if(H5Dclose(dsid) < 0)
goto out;
+
if(H5Dclose(did) < 0)
goto out;
@@ -1009,7 +2991,6 @@ static int test_simple(void)
*/
TESTING2("set/get label");
-
if((did = H5Dopen2(fid,"dset_a", H5P_DEFAULT)) < 0)
goto out;
@@ -1032,7 +3013,6 @@ static int test_simple(void)
goto out;
if(H5DSget_label(did,DIM1,dim1_label,sizeof(dim1_label)) < 0)
goto out;
-
if(strcmp(DIM0_LABEL,dim0_label)!=0)
goto out;
if(strcmp(DIM1_LABEL,dim1_label)!=0)
@@ -1049,21 +3029,18 @@ static int test_simple(void)
goto out;
/* allocate */
- dim0_labeld = (char*)malloc(dim0_label_size * sizeof(char));
- dim1_labeld = (char*)malloc(dim1_label_size * sizeof(char));
+ dim0_labeld = (char*)malloc(dim0_label_size * sizeof (char));
+ dim1_labeld = (char*)malloc(dim1_label_size * sizeof (char));
if( dim0_labeld==NULL || dim1_labeld==NULL)
goto out;
-
if(H5DSget_label(did,DIM0,dim0_labeld,(size_t)dim0_label_size) < 0)
goto out;
if(H5DSget_label(did,DIM1,dim1_labeld,(size_t)dim1_label_size) < 0)
goto out;
-
if(strncmp(DIM0_LABEL,dim0_labeld,(size_t)(dim0_label_size-1))!=0)
goto out;
if(strncmp(DIM1_LABEL,dim1_labeld,(size_t)(dim1_label_size-1))!=0)
goto out;
-
if(dim0_labeld)
{
free(dim0_labeld);
@@ -1085,14 +3062,10 @@ static int test_simple(void)
goto out;
if(H5DSget_label(did,DIM1,dim1_labels,sizeof(dim1_labels)) < 0)
goto out;
-
if(strncmp(DIM0_LABEL,dim0_label,sizeof(dim0_labels)-1)!=0)
goto out;
if(strncmp(DIM1_LABEL,dim1_label,sizeof(dim1_labels)-1)!=0)
goto out;
-
-
-
if(H5Dclose(did))
goto out;
@@ -1105,15 +3078,13 @@ static int test_simple(void)
TESTING2("set scale/get scale name");
-
- if((dsid = H5Dopen2(fid,DS_1_NAME, H5P_DEFAULT)) < 0)
+ if((dsid = H5Dopen2(fid,"ds_a_1", H5P_DEFAULT)) < 0)
goto out;
-
- if(H5DSset_scale(dsid,SCALE_1_NAME) < 0)
+ if(H5DSset_scale(dsid,"Latitude set 0") < 0)
goto out;
/* verify that DS_1_NAME is a dimension scale dataset */
- if((H5DSis_scale(dsid))==0)
+ if((H5DSis_scale(dsid)) == 0)
goto out;
/*-------------------------------------------------------------------------
@@ -1126,17 +3097,16 @@ static int test_simple(void)
goto out;
/* allocate a buffer */
- name_out = (char*)malloc(name_len * sizeof(char));
+ name_out = (char*)malloc(name_len * sizeof (char));
if(name_out == NULL)
goto out;
/* get the scale name using this buffer */
- if(H5DSget_scale_name(dsid,name_out,(size_t)name_len) < 0)
+ if(H5DSget_scale_name(dsid, name_out, (size_t)name_len) < 0)
goto out;
- if(strcmp(SCALE_1_NAME,name_out)!=0)
+ if(strcmp("Latitude set 0",name_out)!=0)
goto out;
-
if(name_out)
{
free(name_out);
@@ -1149,10 +3119,10 @@ static int test_simple(void)
*/
/* get the scale name using this buffer */
- if(H5DSget_scale_name(dsid,sname,sizeof(sname)) < 0)
+ if(H5DSget_scale_name(dsid, sname, sizeof (sname)) < 0)
goto out;
- if(strcmp(SCALE_1_NAME,sname)!=0)
+ if(strcmp("Latitude set 0",sname)!=0)
goto out;
/*-------------------------------------------------------------------------
@@ -1161,12 +3131,11 @@ static int test_simple(void)
*/
/* get the scale name using this buffer */
- if(H5DSget_scale_name(dsid,snames,sizeof(snames)) < 0)
+ if(H5DSget_scale_name(dsid, snames, sizeof (snames)) < 0)
goto out;
- if(strncmp(SCALE_1_NAME,snames,sizeof(snames)-1)!=0)
+ if(strncmp("Latitude set 0",snames,sizeof(snames)-1)!=0)
goto out;
-
if(H5Dclose(dsid))
goto out;
@@ -1175,35 +3144,34 @@ static int test_simple(void)
*-------------------------------------------------------------------------
*/
- if((dsid = H5Dopen2(fid,DS_11_NAME, H5P_DEFAULT)) < 0)
+ if((dsid = H5Dopen2(fid,"ds_a_11", H5P_DEFAULT)) < 0)
goto out;
- if(H5DSset_scale(dsid,SCALE_11_NAME) < 0)
+ if(H5DSset_scale(dsid,"Latitude set 1") < 0)
goto out;
if(H5Dclose(dsid))
goto out;
- if((dsid = H5Dopen2(fid,DS_2_NAME, H5P_DEFAULT)) < 0)
+ if((dsid = H5Dopen2(fid,"ds_a_2", H5P_DEFAULT)) < 0)
goto out;
- if(H5DSset_scale(dsid,SCALE_2_NAME) < 0)
+ if(H5DSset_scale(dsid,"Longitude set 0") < 0)
goto out;
if(H5Dclose(dsid))
goto out;
- if((dsid = H5Dopen2(fid,DS_21_NAME, H5P_DEFAULT)) < 0)
+ if((dsid = H5Dopen2(fid,"ds_a_21", H5P_DEFAULT)) < 0)
goto out;
- if(H5DSset_scale(dsid,SCALE_21_NAME) < 0)
+ if(H5DSset_scale(dsid,"Longitude set 1") < 0)
goto out;
if(H5Dclose(dsid))
goto out;
- if((dsid = H5Dopen2(fid,DS_22_NAME, H5P_DEFAULT)) < 0)
+ if((dsid = H5Dopen2(fid,"ds_a_22", H5P_DEFAULT)) < 0)
goto out;
- if(H5DSset_scale(dsid,SCALE_22_NAME) < 0)
+ if(H5DSset_scale(dsid,"Longitude set 2") < 0)
goto out;
if(H5Dclose(dsid))
goto out;
-
PASSED();
/*-------------------------------------------------------------------------
@@ -1223,7 +3191,6 @@ static int test_simple(void)
/* get the dataset id for "dset_a" */
if((did = H5Dopen2(fid,"dset_a", H5P_DEFAULT)) < 0)
goto out;
-
dim = 0;
/* iterate trough the 1st dimension of "dset_a" and verify that its DS is valid */
@@ -1234,7 +3201,6 @@ static int test_simple(void)
start at DS index 2 */
dim = 1;
scale_idx = 2;
-
if(H5DSiterate_scales(did,dim,&scale_idx,verify_scale,NULL) < 0)
goto out;
@@ -1252,7 +3218,6 @@ static int test_simple(void)
/* get the dataset id for "dset_a" */
if((did = H5Dopen2(fid,"dset_a", H5P_DEFAULT)) < 0)
goto out;
-
dim = 0;
/* iterate trough the 1st dimension of "dset_a" and read the DS */
@@ -1263,8 +3228,7 @@ static int test_simple(void)
start at DS index 2 */
dim = 1;
scale_idx = 2;
-
- if(H5DSiterate_scales(did,dim,&scale_idx,read_scale,s22_wbuf) < 0)
+ if(H5DSiterate_scales(did, dim, &scale_idx, read_scale, s22_wbuf) < 0)
goto out;
/* close dataset ID of "dset_a" */
@@ -1286,16 +3250,15 @@ static int test_simple(void)
goto out;
/* get rank */
- if((rank=H5Sget_simple_extent_ndims(sid)) < 0)
+ if((rank = H5Sget_simple_extent_ndims(sid)) < 0)
goto out;
/* get dimensions of dataset */
if(H5Sget_simple_extent_dims(sid,dims,NULL) < 0)
goto out;
-
{
- int match_size; /* does this scale size matches the dataset DIM size */
- int idx=0; /* scale index to start iterating, on return, index where iterator stoped */
+ int match_size; /* does this scale size matches the dataset DIM size */
+ int idx = 0; /* scale index to start iterating, on return, index where iterator stoped */
/* iterate trough all the dimensions */
for(dim=0; dim<(unsigned)rank; dim++)
@@ -1330,12 +3293,14 @@ static int test_simple(void)
* create 3 datasets: 1 "data" dataset and dimension scales (some are empty)
*-------------------------------------------------------------------------
*/
- if(H5LTmake_dataset_int(fid,"dset_f",rank,dims,buf) < 0)
+ if(H5LTmake_dataset_int(fid, "dset_f", rank, dims, buf) < 0)
goto out;
+
if(H5LTmake_dataset_int(fid,"ds_f_1",rankds,s1_dim,NULL) < 0)
goto out;
- if(H5LTmake_dataset_int(fid,"ds_f_11",rankds,s1_dim,s1_wbuf) < 0)
+ if(H5LTmake_dataset_int(fid, "ds_f_11", rankds, s1_dim, s1_wbuf) < 0)
goto out;
+
if(H5LTmake_dataset_int(fid,"ds_f_2",rankds,s2_dim,NULL) < 0)
goto out;
@@ -1345,19 +3310,20 @@ static int test_simple(void)
*/
if((did = H5Dopen2(fid,"dset_f", H5P_DEFAULT)) < 0)
goto out;
-
if((dsid = H5Dopen2(fid,"ds_f_1", H5P_DEFAULT)) < 0)
goto out;
if(H5DSattach_scale(did,dsid,DIM0) < 0)
goto out;
if(H5Dclose(dsid) < 0)
goto out;
+
if((dsid = H5Dopen2(fid,"ds_f_11", H5P_DEFAULT)) < 0)
goto out;
if(H5DSattach_scale(did,dsid,DIM0) < 0)
goto out;
if(H5Dclose(dsid) < 0)
goto out;
+
if((dsid = H5Dopen2(fid,"ds_f_2", H5P_DEFAULT)) < 0)
goto out;
if(H5DSattach_scale(did,dsid,DIM1) < 0)
@@ -1381,13 +3347,12 @@ static int test_simple(void)
goto out;
/* get rank */
- if((rank=H5Sget_simple_extent_ndims(sid)) < 0)
+ if((rank = H5Sget_simple_extent_ndims(sid)) < 0)
goto out;
/* get dimensions of dataset */
if(H5Sget_simple_extent_dims(sid,dims,NULL) < 0)
goto out;
-
{
int match_size; /* does this scale size matches the dataset DIM size */
int idx; /* scale index to start iterating, on return, index where iterator stoped */
@@ -1419,7 +3384,7 @@ static int test_simple(void)
break;
}/*switch*/
}/*for*/
- }
+ }
/* close */
if(H5Dclose(did) < 0)
@@ -1437,11 +3402,10 @@ static int test_simple(void)
/* close */
H5Fclose(fid);
-
return 0;
/* error zone */
-out:
+ out:
H5E_BEGIN_TRY
{
H5Dclose(did);
@@ -1711,7 +3675,6 @@ static herr_t op_continue(hid_t dset, unsigned dim, hid_t scale_id, void *visito
return 0;
}
-
/*-------------------------------------------------------------------------
* Function: op_stop
*
@@ -1745,9 +3708,6 @@ static herr_t op_stop(hid_t dset, unsigned dim, hid_t scale_id, void *visitor_da
return 1;
}
-
-
-
/*-------------------------------------------------------------------------
* test error conditions
*-------------------------------------------------------------------------
diff --git a/hl/test/test_ds_be.h5 b/hl/test/test_ds_be.h5
new file mode 100644
index 0000000..3da54f9
--- /dev/null
+++ b/hl/test/test_ds_be.h5
Binary files differ
diff --git a/hl/test/test_ds_le.h5 b/hl/test/test_ds_le.h5
new file mode 100644
index 0000000..1fcbe99
--- /dev/null
+++ b/hl/test/test_ds_le.h5
Binary files differ
diff --git a/hl/test/test_lite.c b/hl/test/test_lite.c
index ad12fb2..21afc54 100644
--- a/hl/test/test_lite.c
+++ b/hl/test/test_lite.c
@@ -1291,7 +1291,6 @@ static int test_enums(void)
H5T_class_t type_class;
char* dt_str;
size_t str_len;
- H5T_order_t native_order = H5Tget_order(H5T_NATIVE_INT);
TESTING3(" text for enum types");
diff --git a/hl/tools/Makefile.in b/hl/tools/Makefile.in
index cc38324..2738d84 100644
--- a/hl/tools/Makefile.in
+++ b/hl/tools/Makefile.in
@@ -111,6 +111,16 @@ am__relativize = \
ACLOCAL = /home1/packages/automake/automake-1.9.6/bin/aclocal-1.9 -I /afs/ncsa/projects/hdf/packages/libtool_1.5.14/Linux_2.4/share/aclocal
ADD_PARALLEL_FILES = @ADD_PARALLEL_FILES@
AMTAR = @AMTAR@
+
+# H5_CFLAGS holds flags that should be used when building hdf5,
+# but which should not be exported to h5cc for building other programs.
+# AM_CFLAGS is an automake construct which should be used by Makefiles
+# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
+AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
+AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@
+AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
+AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@
+AM_LDFLAGS = @AM_LDFLAGS@
AM_MAKEFLAGS = @AM_MAKEFLAGS@
AR = @AR@
@@ -124,21 +134,18 @@ BYTESEX = @BYTESEX@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CC_VERSION = @CC_VERSION@
-
-# H5_CFLAGS holds flags that should be used as CFLAGS when building hdf5,
-# but which shouldn't be exported to h5cc for building other programs.
-CFLAGS = @CFLAGS@ @H5_CFLAGS@
+CFLAGS = @CFLAGS@
CLEARFILEBUF = @CLEARFILEBUF@
CODESTACK = @CODESTACK@
CONFIG_DATE = @CONFIG_DATE@
CONFIG_MODE = @CONFIG_MODE@
CONFIG_USER = @CONFIG_USER@
CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@ @H5_CPPFLAGS@
+CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@ @H5_CXXFLAGS@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_PKG = @DEBUG_PKG@
DEFAULT_API_VERSION = @DEFAULT_API_VERSION@
@@ -161,7 +168,7 @@ F9XMODEXT = @F9XMODEXT@
F9XMODFLAG = @F9XMODFLAG@
F9XSUFFIXFLAG = @F9XSUFFIXFLAG@
FC = @FC@
-FCFLAGS = @FCFLAGS@ @H5_FCFLAGS@
+FCFLAGS = @FCFLAGS@
FCFLAGS_f90 = @FCFLAGS_f90@
FCLIBS = @FCLIBS@
FGREP = @FGREP@
diff --git a/hl/tools/gif2h5/Makefile.am b/hl/tools/gif2h5/Makefile.am
index f1cec06..895c75f 100644
--- a/hl/tools/gif2h5/Makefile.am
+++ b/hl/tools/gif2h5/Makefile.am
@@ -32,8 +32,8 @@ bin_PROGRAMS=gif2h5 h52gif
noinst_PROGRAMS=h52gifgentst
# Add h52gif and gif2h5 specific linker flags here
-h52gif_LDFLAGS = $(LT_STATIC_EXEC)
-gif2h5_LDFLAGS = $(LT_STATIC_EXEC)
+h52gif_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+gif2h5_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
gif2h5_SOURCES=gif2hdf.c gif2mem.c decompress.c gifread.c writehdf.c
diff --git a/hl/tools/gif2h5/Makefile.in b/hl/tools/gif2h5/Makefile.in
index 71a16c4..e43dd07 100644
--- a/hl/tools/gif2h5/Makefile.in
+++ b/hl/tools/gif2h5/Makefile.in
@@ -111,6 +111,16 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = /home1/packages/automake/automake-1.9.6/bin/aclocal-1.9 -I /afs/ncsa/projects/hdf/packages/libtool_1.5.14/Linux_2.4/share/aclocal
ADD_PARALLEL_FILES = @ADD_PARALLEL_FILES@
AMTAR = @AMTAR@
+
+# H5_CFLAGS holds flags that should be used when building hdf5,
+# but which should not be exported to h5cc for building other programs.
+# AM_CFLAGS is an automake construct which should be used by Makefiles
+# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
+AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
+AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@
+AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
+AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@
+AM_LDFLAGS = @AM_LDFLAGS@
AM_MAKEFLAGS = @AM_MAKEFLAGS@
AR = @AR@
@@ -124,21 +134,18 @@ BYTESEX = @BYTESEX@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CC_VERSION = @CC_VERSION@
-
-# H5_CFLAGS holds flags that should be used as CFLAGS when building hdf5,
-# but which shouldn't be exported to h5cc for building other programs.
-CFLAGS = @CFLAGS@ @H5_CFLAGS@
+CFLAGS = @CFLAGS@
CLEARFILEBUF = @CLEARFILEBUF@
CODESTACK = @CODESTACK@
CONFIG_DATE = @CONFIG_DATE@
CONFIG_MODE = @CONFIG_MODE@
CONFIG_USER = @CONFIG_USER@
CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@ @H5_CPPFLAGS@
+CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@ @H5_CXXFLAGS@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_PKG = @DEBUG_PKG@
DEFAULT_API_VERSION = @DEFAULT_API_VERSION@
@@ -161,7 +168,7 @@ F9XMODEXT = @F9XMODEXT@
F9XMODFLAG = @F9XMODFLAG@
F9XSUFFIXFLAG = @F9XSUFFIXFLAG@
FC = @FC@
-FCFLAGS = @FCFLAGS@ @H5_FCFLAGS@
+FCFLAGS = @FCFLAGS@
FCFLAGS_f90 = @FCFLAGS_f90@
FCLIBS = @FCLIBS@
FGREP = @FGREP@
@@ -367,8 +374,8 @@ TEST_SCRIPT = $(srcdir)/h52giftest.sh
check_SCRIPTS = $(TEST_SCRIPT)
# Add h52gif and gif2h5 specific linker flags here
-h52gif_LDFLAGS = $(LT_STATIC_EXEC)
-gif2h5_LDFLAGS = $(LT_STATIC_EXEC)
+h52gif_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+gif2h5_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
gif2h5_SOURCES = gif2hdf.c gif2mem.c decompress.c gifread.c writehdf.c
h52gif_SOURCES = hdf2gif.c hdfgifwr.c
h52gifgentst_SOURCES = h52gifgentst.c
diff --git a/perform/Makefile.am b/perform/Makefile.am
index 255275e..6836a2b 100644
--- a/perform/Makefile.am
+++ b/perform/Makefile.am
@@ -31,8 +31,8 @@ else
endif
# Add h5perf and h5perf_serial specific linker flags here
-h5perf_LDFLAGS = $(LT_STATIC_EXEC)
-h5perf_serial_LDFLAGS = $(LT_STATIC_EXEC)
+h5perf_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+h5perf_serial_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
# Some programs are not built or run by default, but can be built by hand or by
# specifying --enable-build-all at configure time.
diff --git a/perform/Makefile.in b/perform/Makefile.in
index 355b732..da941e3 100644
--- a/perform/Makefile.in
+++ b/perform/Makefile.in
@@ -147,6 +147,16 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = /home1/packages/automake/automake-1.9.6/bin/aclocal-1.9 -I /afs/ncsa/projects/hdf/packages/libtool_1.5.14/Linux_2.4/share/aclocal
ADD_PARALLEL_FILES = @ADD_PARALLEL_FILES@
AMTAR = @AMTAR@
+
+# H5_CFLAGS holds flags that should be used when building hdf5,
+# but which should not be exported to h5cc for building other programs.
+# AM_CFLAGS is an automake construct which should be used by Makefiles
+# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
+AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
+AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@
+AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
+AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@
+AM_LDFLAGS = @AM_LDFLAGS@
AM_MAKEFLAGS = @AM_MAKEFLAGS@
AR = @AR@
@@ -160,21 +170,18 @@ BYTESEX = @BYTESEX@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CC_VERSION = @CC_VERSION@
-
-# H5_CFLAGS holds flags that should be used as CFLAGS when building hdf5,
-# but which shouldn't be exported to h5cc for building other programs.
-CFLAGS = @CFLAGS@ @H5_CFLAGS@
+CFLAGS = @CFLAGS@
CLEARFILEBUF = @CLEARFILEBUF@
CODESTACK = @CODESTACK@
CONFIG_DATE = @CONFIG_DATE@
CONFIG_MODE = @CONFIG_MODE@
CONFIG_USER = @CONFIG_USER@
CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@ @H5_CPPFLAGS@
+CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@ @H5_CXXFLAGS@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_PKG = @DEBUG_PKG@
DEFAULT_API_VERSION = @DEFAULT_API_VERSION@
@@ -197,7 +204,7 @@ F9XMODEXT = @F9XMODEXT@
F9XMODFLAG = @F9XMODFLAG@
F9XSUFFIXFLAG = @F9XSUFFIXFLAG@
FC = @FC@
-FCFLAGS = @FCFLAGS@ @H5_FCFLAGS@
+FCFLAGS = @FCFLAGS@
FCFLAGS_f90 = @FCFLAGS_f90@
FCLIBS = @FCLIBS@
FGREP = @FGREP@
@@ -398,8 +405,8 @@ INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/test -I$(top_srcdir)/tools/lib
@BUILD_PARALLEL_CONDITIONAL_TRUE@TEST_PROG_PARA = h5perf perf
# Add h5perf and h5perf_serial specific linker flags here
-h5perf_LDFLAGS = $(LT_STATIC_EXEC)
-h5perf_serial_LDFLAGS = $(LT_STATIC_EXEC)
+h5perf_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+h5perf_serial_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
# Some programs are not built or run by default, but can be built by hand or by
# specifying --enable-build-all at configure time.
diff --git a/perform/pio_engine.c b/perform/pio_engine.c
index c5214d3..27606d0 100644
--- a/perform/pio_engine.c
+++ b/perform/pio_engine.c
@@ -107,12 +107,7 @@ static int clean_file_g = -1; /*whether to cleanup temporary test */
* is about the best guess.
*/
#ifndef HDF5_PARAPREFIX
-# ifdef __PUMAGON__
-/* For the PFS of TFLOPS */
-# define HDF5_PARAPREFIX "pfs:/pfs_grande/multi/tmp_1"
-# else
# define HDF5_PARAPREFIX ""
-# endif /* __PUMAGON__ */
#endif /* !HDF5_PARAPREFIX */
#ifndef MIN
@@ -3033,7 +3028,7 @@ gpfs_invalidate_file_cache(const char *filename)
filename);
fprintf(stderr, " errno=%d errorOffset=%d\n",
errno, inv_cache_hint.hdr.errorOffset);
- exit(1);
+ exit(EXIT_FAILURE);
}
/* Close the file */
@@ -3042,7 +3037,7 @@ gpfs_invalidate_file_cache(const char *filename)
"could not close file '%s' after flushing file cache, ",
filename);
fprintf(stderr, "errno=%d\n", errno);
- exit(1);
+ exit(EXIT_FAILURE);
}
}
diff --git a/perform/sio_engine.c b/perform/sio_engine.c
index adfd708..978ac03 100644
--- a/perform/sio_engine.c
+++ b/perform/sio_engine.c
@@ -1640,7 +1640,7 @@ gpfs_invalidate_file_cache(const char *filename)
filename);
fprintf(stderr, " errno=%d errorOffset=%d\n",
errno, inv_cache_hint.hdr.errorOffset);
- exit(1);
+ exit(EXIT_FAILURE);
}
/* Close the file */
@@ -1649,7 +1649,7 @@ gpfs_invalidate_file_cache(const char *filename)
"could not close file '%s' after flushing file cache, ",
filename);
fprintf(stderr, "errno=%d\n", errno);
- exit(1);
+ exit(EXIT_FAILURE);
}
}
diff --git a/release_docs/INSTALL_Windows.txt b/release_docs/INSTALL_Windows.txt
index d20c35f..a24e1d5 100644
--- a/release_docs/INSTALL_Windows.txt
+++ b/release_docs/INSTALL_Windows.txt
@@ -35,10 +35,9 @@ Contents:
Preconditions:
1. Installed Microsoft Visual Studio. This document is written for Visual
- Studio 2005, although we also support Visual Studio .NET 2003 and Visual
- Studio 2008 as well. Most of the instructions are the same, although some
- features are unsupported in Visual Studio .NET. For simple Visual Studio
- .NET instructions, see the document INSTALL_Windows_NET.TXT.
+ Studio 2005, although we also support Visual Studio 2008 as well. Most
+ of the instructions are the same. We no longer support building HDF5
+ using Microsoft Visual Studio .NET 2003.
2. (Optional) Installed Intel Compiler 9.1 or 10.1 if you want to build HDF5
Fortran libraries.
@@ -164,11 +163,8 @@ Notes:
directory, run copy_hdf.bat first and then open all.sln under
hdf5/windows/proj/all to start building process.
- 2. Visual Studio 6.0 will not be supported in HDF5 1.8 or later release.
-
- 2. Users who prefer to use Visual Studio .NET can follow instructions in
- INSTALL_Windows_Short_Net.txt. Note, however, HDF5 Fortran product
- will not be supported in HDF5 1.8 release with Visual Studio .NET.
+ 2. Visual Studio 6.0 is no longer supported in HDF5 1.8 or later releases.
+ Visual Studio .NET is no longer support in HDF5 1.8.4 or later releases.
3. For users who want to quickly build HDF5 library or do not want to know
HDF5 building and installation details, please read the
@@ -1123,7 +1119,6 @@ Notes: 1. For Intel Compiler users, Intel fortran Compiler 9.1 and 10.1 are
2. The Compaq Fortran Compiler is no longer supported for HDF5 1.8.
3. Intel Fortran 9.1 works only under Visual Studio 2005 environments.
- Building Fortran libraries under Visual Studio .NET is unsupported.
Visual Studio 2008 is supported only with Intel Fortran 10.1.
4. Parallel builds should be disabled. To do so: Go to Tools >
@@ -1393,51 +1388,7 @@ Notes: 1. For Intel Compiler users, Intel fortran Compiler 9.1 and 10.1 are
Notes: In Visual Studio 2005, the Single-threaded runtime libraries have been
depreciated, and Multi-threaded is built by default. Therefore, no extra
work needs to be done to build Multi-threaded libraries in Visual Studio
- 2005. This section applies only to Visual Studio .NET
-
- Preconditions and Section I also apply to this section. Users who
- want to build Multi-threaded version of HDF5 library, please read
- those two sections carefully before go to the following part.
-
-
-In Visual Studio .NET, users have the option of building multi-threaded
-libraries by manipulating the project settings. Otherwise, the build process
-is very much the same. Therefore, follow the instructions below, and refer
-to the earlier sections of this document for details on building and testing.
-
-
-1. Open the solution file
-
- Refer to previous sections to open the appropriate solution file,
- depending on whether you are building with or without Fortran libraries.
-
-2. Change Project Settings
-
- a) In Visual Studio, go to "Projects->Properties".
-
- b) Make sure in the "Configuration" box, "Release" is selected.
-
- c) Select all of the static project file in the main window by holding
- the "Ctrl" key while clicking the project file name.
-
- d) In the "Properties" window, choose "C/C++", and then "Code
- Generation".
-
- e) Under "Run-time Library", "Single-Threaded" should appear. If it is
- blank inside this box, check if you highlight some DLL project files.
-
- d) Change "Single-Threaded" to "Multithreaded".
-
- e) In the "Configuration" box, change to "Debug", keeping the static
- projects selected.
-
- f) Under "Run-time Library", change "Debug Single-Threaded" to "Debug
- Multithreaded".
-
-3. Build as Normal
-
- Refer to previous sections to build and test the HDF5 libraries
- and tools.
+ 2005.
========================================================================
@@ -1620,10 +1571,7 @@ to the earlier sections of this document for details on building and testing.
Section IX: How to build HDF5 for 64-bit Windows
========================================================================
-HDF5 can be built for 64-bit Windows in Visual Studio 2005 or 2008. Visual
-Studio .NET has very primative 64-bit support, but it is very difficult to
-set up, and debugging is not supported. Therefore, we recommend all users
-switch to Visual Studio 2005 or 2008 for 64-bit builds.
+HDF5 can be built for 64-bit Windows in Visual Studio 2005 or 2008.
Notes:
@@ -1680,14 +1628,9 @@ some minor changes. Therefore, follow the build instructions above, with the
following considerations:
1. Only Visual Studio 2005 and 2008 is currently supported on Windows Vista.
- This is because Microsoft has ended their support for and .NET.
-
- 2. Building Fortran libraries has not been tested, and is therefore also
- unsupported. You may attempt to build Fortran libraries following the
- instructions above, but they should be considered experimental and used
- for testing only.
+ This is because Microsoft has ended their support for .NET.
- 3. Elevated security permissions are required to test the HDF5 libraries.
+ 2. Elevated security permissions are required to test the HDF5 libraries.
This is because DLLs are installed in the system directory. To enable
elevated security:
diff --git a/release_docs/INSTALL_Windows_From_Command_Line.txt b/release_docs/INSTALL_Windows_From_Command_Line.txt
index 053ae72..c35fdbf 100755
--- a/release_docs/INSTALL_Windows_From_Command_Line.txt
+++ b/release_docs/INSTALL_Windows_From_Command_Line.txt
@@ -4,12 +4,13 @@
************************************************************************
Note: This instruction is written for users who would like to build HDF5
libraries and tools from the HDF5 source code package on command
- line.
+ line. We no longer support building HDF5 using Microsoft Visual
+ Studio .NET 2003.
Currently, we support:
1. Building and testing HDF5 C/C++/Fortran libraries on command line with
- Microsoft Visual Studio .NET, 2005 or 2008 for 32- or 64-bit Windows.
+ Microsoft Visual Studio 2005 or 2008 for 32- or 64-bit Windows.
For all other Windows development tools, HDF5 should be built in
the development environment. Please refer to INSTALL_Windows.txt
@@ -42,8 +43,7 @@ notes in INSTALL_Windows.txt before starting below procedures.
C:\Program Files\Microsoft Visual Studio 8\Common7\Tools\
- If you are using Visual Studio .NET, replace "vs80comntools" with
- "vs71comntools". For Visual Studio 2008, use "vs90comntools"
+ If you are using Visual Studio 2008, use "vs90comntools"
1.2 Run batch file copy_hdf.bat.
@@ -81,8 +81,7 @@ notes in INSTALL_Windows.txt before starting below procedures.
from command line.
hdf5bt file takes the following options:
- /vs7 Build HDF5 using Visual Studio .NET 2003
- Note: Default is Visual Studio 2005
+ /vs8 Build HDF5 using Visual Studio 2005
/vs9 Build HDF5 using Visual Studio 2008
Note: Default is Visual Studio 2005
/fort Build and test HDF5 with Fortran libraries
@@ -112,8 +111,7 @@ notes in INSTALL_Windows.txt before starting below procedures.
tools from command line.
hdf55build takes the following options:
- /vs7 Build HDF5 using Visual Studio .NET 2003
- Note: Default is Visual Studio 2005
+ /vs8 Build HDF5 using Visual Studio 2005
/vs9 Build HDF5 using Visual Studio 2008
Note: Default is Visual Studio 2005
/fort Build HDF5 with Fortran libraries
diff --git a/release_docs/INSTALL_Windows_Short_NET.TXT b/release_docs/INSTALL_Windows_Short_NET.TXT
index 1f2aa74..db144d1 100755
--- a/release_docs/INSTALL_Windows_Short_NET.TXT
+++ b/release_docs/INSTALL_Windows_Short_NET.TXT
@@ -3,176 +3,7 @@
* with Windows XP (Short Version) *
************************************************************************
-Notes: This short instruction is written for users who want to quickly
- build HDF5 library and tools from the HDF5 source code package
- with Microsoft Visual Studio .NET 2003 but do not want to know
- HDF5 building and installation details on Windows XP.
-
- Visual Studio .NET 2003 is NOT supported on Windows Vista, as Microsoft
- has ended their support. Also, we do not support building 64-bit
- libraries or Fortran libraries with Visual Studio .NET 2003. If you
- need any of these features, please upgrade to Visual STudio 2005.
-
- For detailed HDF5 build and install information, or if you have
- trouble following any steps in the instructions, please refer to
- INSTALL_Windows.txt for further information.
-
- For users who would like to build and test HDF5 package from the
- command line, please refer to
- INSATLL_Windows_From_Command_Line.txt. Note, however, that building
- from the command line requires Visual Studio 2005.
-
-WARNINGS:
-
-Please read CAREFULLY about HDF5 build and install preconditions and
-notes in INSTALL_Windows.txt before starting below procedures.
-
-
-========================================================================
- Preconditions
-========================================================================
-
- 1. Set up path for external libraries and headers
-
- Skip this part if you don't want to use ANY compression features
- provided by HDF5. Please do read Section V in INSTALL_Windows.txt.
-
- You have to read this part even if you want to only use Zlib
- or Szip. You also need to read Section V in INSTALL_Windows.txt.
-
- Invoke Microsoft Visual C++ .Net and go to "Tools" and select
- "Options". In the left pane of "Option" window poped up,
- choose and expand "Projects", Click on "VC++ Directories".
- In the right pane, Find the box "Show directories for", choose
- "Include files", if you can not find your Zlib and Szip
- header path
- (for example, c:\zlib123\include, c:\szip\include)
- from the directory list, add the header path
- (c:\zlib123\include, c:\szip\include) to the
- included directories.
-
- Find the box "Show directories for", choose "Library files",
- If you cannot find your Zlib and Szip library path
- (for example, c:\zlib123\dll, c:\szip\dll)
- from the directory list, add the library path
- (c:\zlib123\dll, c:\szip\dll) to the library directories.
-
-========================================================================
- Building HDF5 C/C++ Libraries with VS .NET
-========================================================================
-
- 1. Run batch file copy_hdf.bat
-
- Go to c:\MyHDFstuff\hdf5\windows and run copy_hdf.bat. This process will
- copy all the necessary batch files, windows specific source codes and
- text files saved under c:\MyHDFstuff\hdf5\windows directory to the
- corresponding directories under hdf5.
-
- 2. Invoke Microsoft Visual Studio compiler
-
- Invoke Microsoft Visual Studio. From the main menu, go to "File" and
- select the "Open Solution" option. Then open the
- c:\MyHDFstuff\hdf5\windows_vnet\proj\all\all.dsw workspace.
-
- You should find Windows project files listed as "all", "big", etc. on the
- left.
-
- 3. (Optional) Disable HDF5 C++ and High level C++
-
- In HDF5 1.8, C++ and HL C++ libraries are built by default. To opt-out,
- you must explicitly disable them.
-
- 4.1 Skip this step if you do want to build HDF5 High-Level C++ libraries
-
- Go to "Project" and select "Project Dependencies". Select "all", and
- disable all of the following projects:
-
- hdf5_hl_cpp
- hdf5_hl_cppdll
- hl_test_table_cpp
- hl_test_table_cppdll
-
- 4.2 Skip this step if you do want to build HDF5 High-Level libraries
-
- Go to "Project" and select "Project Dependencies". Select "all", and
- disable all of the project files listed in the previous step, as well
- as the following projects:
-
- hdf5_hl
- hdf5_hldll
- hl_test_image
- hl_test_imagedll
- hl_test_lite
- hl_test_litedll
- hl_test_table
- hl_test_tabledll
- hl_test_ds
- hl_test_dsdll
- hl_test_packet
- hl_test_packetdll
-
- Click on "OK", From the main menu, choose "Build"-> "Build" or
- "Rebuild ALL" to build both release and debug version of HDF5
- Libraries.
-
-
- 4. Select "Build", then Select "Configuration Manager".
-
- 5.1 To build debug static libraries, debug multithreaded DLLs, and tests:
-
- In "Active Solution Configuration", select "Debug". Select "Close".
- Select "Build" -> "Build Solution" or "Rebuild Solution" to build debug
- version of project "all".
-
- 5.2 To build release static libraries, multithreaded DLLs and tests:
-
- In "Active Solution Configuration", select "Release". Select "Close".
- Select "Build" -> "Build Solution" or "Rebuild Solution" to build release
- version of project "all".
-
- Both debug and release versions must be built.
-
- Warning messages can be ignored.
-
-========================================================================
- Testing HDF5 C/C++ Libraries with VS .NET
-========================================================================
-
-HDF5 libraries and tools should be tested to make sure that they were
-built correctly. c:\MyHDFstuff\hdf5\hdf5check.bat was provided to test
-HDF5 libraries and tools.
-
-hdf5check.bat has the following options:
-
- hdf5check test HDF5 C library and tools only
-
- hdf5check enablecpp test HDF5 C/C++ libraries and tools
-
-
-Invoke a command prompt window and run hdf5check with appropriate option.
-Users are encouraged to pipe the test output into a file. You should find
-no "*FAILED*" marks.
-
-If you want to test HDF5 libraries and tools one by one, please refer to
-Section II, step 2 in INSTALL_Windows.txt.
-
-
-========================================================================
- Installing HDF5 C/C++ Libraries
-========================================================================
-
-Run the batch file c:\MyHDFstuff\hdf5\installhdf5lib.bat to install
-all HDF5 libraries and tools into c:\MyHDFstuff\hdf5\hdf5lib directory.
-
-========================================================================
- Building HDF5 Examples and Applications
-========================================================================
-
-Building HDF5 Examples is Optional. Please read Section II, step 4 and
-the following part in INSTALL_Windows.txt for detailed information.
-
-
-
+Notes: We no longer support building HDF5 using Microsoft Visual Studio .NET 2003.
************************************************************************
Need further assistance, send email to help@hdfgroup.org
diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt
index 0d9289b..e122005 100644
--- a/release_docs/RELEASE.txt
+++ b/release_docs/RELEASE.txt
@@ -1,4 +1,4 @@
-HDF5 version 1.9.47-FA_a4 currently under development
+HDF5 version 1.9.51-FA_a4 currently under development
================================================================================
@@ -60,15 +60,17 @@ New Features
Library:
--------
+ - Added support for filtering densely stored groups. Many of the API
+ functions related to filters have been extended to support dense groups
+ as well as datasets. Pipeline messages can now be stored in a group's
+ object header. (NAF/QAK - 2009/10/8)
- The embedded library information is displayed by H5check_version() if a
version mismatch is detected. Also changed H5check_version() to
suppress the warning message totally if $HDF5_DISABLE_VERSION_CHECK is 2
or higher. (Old behavior treated 3 or higher the same as 1, that is
print a warning and allows the program to continue. (AKC - 2009/9/28)
- - Added a new feature that have the library information in the file
- libhdf5.settings embedded in the hdf5 library and statically linked
- executables. If a user does not care for the extra library information
- in the executable, he may turn it off by --disable-embedded-libinfo
+ - If a user does not care for the extra library information insert
+ in the executables, he may turn it off by --disable-embedded-libinfo
during configure. (AKC - 2009/9/15)
- Corrected problem where library would re-write the superblock in a file
opened for R/W access, even when no changes were made to the file.
@@ -173,6 +175,9 @@ New Features
- h5diff: h5diff treats two INFINITY values different. Fixed by checking (value==expect)
before call ABS(...) at h5diff_array.c This will make that (INF==INF) is true
(INF is treated as an number instead of NaN) (PC -- 2009/07/28)
+ - h5diff: add option "--use-system-epsilon" to print difference if (|a-b| > EPSILON)
+ Change default to use strict equality (PC -- 2009/09/12)
+
High-Level APIs:
------
@@ -193,6 +198,13 @@ Bug Fixes since HDF5-1.8.0 release
Library
-------
+ - Fixed a bug where writing and deleting many global heap objects (i.e.
+ variable length data) would render the file unreadable. Previously
+ created files exhibiting this problem should now be readable.
+ NAF - 2009/10/27 - 1483
+ - Fixed incorrect return value for H5Pget_preserve. AKC - 2009/10/08 - 1628
+ - Fixed an assertion failure that occurred when H5Ocopy was called on a
+ dataset using a vlen inside a compound. (NAF - 2009/10/02 - 1597)
- Fixed incorrect return value for H5Pget_filter_by_id1/2 in H5Ppublic.h.
(NAF - 2009/09/25 - 1620)
- Fixed a bug where properties weren't being compared with the registered
@@ -315,11 +327,32 @@ Bug Fixes since HDF5-1.8.0 release
Configuration
-------------
+ - Removed the following config files, as we no longer support them:
+ config/dec-osf*, config/hpux11.00, config/irix5.x,
+ config/powerpc-ibm-aix4.x config/rs6000-ibm-aix5.x config/unicos*
+ MAM - 2009/10/08
+ - Modified configure and make process to properly preserve user's CFLAGS
+ (and company) environment variables. Build will now properly use
+ automake's AM_CFLAGS for any compiler flags set by the configure
+ process. Configure will no longer modify CFLAGS directly, nor will
+ setting CFLAGS during make completely replace what configure has set up.
+ MAM - 2009/10/08
+ - Support for TFLOPS, config/intel-osf1, is removed since the TFLOPS
+ machine has long retired. AKC - 2009/10/06.
+ - Added $(EXEEXT) extension to H5detect when it's executed in the
+ src/Makfile to generate H5Tinit.c so it works correctly on platforms
+ that require the full extension when running executables.
+ MAM - 2009/10/01 - BZ #1613
+ - Configure will now set FC and CXX to "no" when fortran and c++
+ are not being compiled, respectively, so configure will not run
+ some of the compiler tests for these languages when they are not
+ being used. MAM - 2009/10/01
- The PathScale compiler (v3.2) was mistaken as gcc v4.2.0 but it fails to
recognize some gcc options. Fixed. (see bug 1301). AKC - 2009/7/28 -
- - The --enable-static-exec flag has been fixed and will now generate
- static executables within the installed bin directory when used.
- MAM - 2009/07/23 - BZ #1583
+ - The --enable-static-exec flag will now properly place the -static flag
+ on the link line of all installed executables. This will force the
+ executable to link with static libraries over shared libraries, provided
+ the static libraries are available. MAM - 2009/08/31 - BZ #1583
- The --includedir=DIR configuration option now works as intended, and can
be used to specify the location to install C header files. The default
location remains unchanged, residing at ${prefix}/include.
@@ -382,6 +415,10 @@ Bug Fixes since HDF5-1.8.0 release
High-Level APIs:
------
+ - Fixed a bug where the H5TB API would forget the order of fields when
+ added out of offset order. (NAF - 2009/10/27 - 1582)
+ - H5DSis_attached failed to account for different platform types. Added a
+ get native type call. (ADB - 2009/9/29 - 1562)
- Dimension scales: The scale index return value in H5DSiterate_scales was not always
incremented. (PVN - 2009/4/8 - 1538)
@@ -443,10 +480,6 @@ Platforms Tested
g++ 4.2.1 20080123
gfortran 4.2.1 20080123
- IRIX64 6.5 (64 & n32) MIPSpro cc 7.4.4m
- F90 MIPSpro 7.4.4m
- C++ MIPSpro cc 7.4.4m
-
Linux 2.6.9 (RHEL4) Intel 10.0 compilers
(abe.ncsa.uiuc.edu)
Linux 2.4.21-47 gcc 3.2.3 20030502
@@ -461,16 +494,12 @@ Platforms Tested
SMP ia64 Intel(R) C++ Version 9.0
(cobalt) Intel(R) Fortran Itanium(R) Version 9.0
SGI MPI
- SunOS 5.8 32,46 Sun WorkShop 6 update 2 C 5.3
- (Solaris 2.8) Sun WorkShop 6 update 2 Fortran 95 6.2
- Sun WorkShop 6 update 2 C++ 5.3
- SunOS 5.10 cc: Sun C 5.8
- (linew) f90: Sun Fortran 95 8.2
- CC: Sun C++ 5.8
- Xeon Linux 2.4.21-32.0.1.ELsmp-perfctr-lustre
- (tungsten) gcc 3.2.2 20030222
- Intel(R) C++ Version 9.0
- Intel(R) Fortran Compiler Version 9.0
+ SunOS 5.10 Sun C 5.9 SunOS_sparc
+ Patch 124867-11 2009/04/30
+ (linew) Sun Fortran 95 8.3 SunOS_sparc
+ Patch 127000-11 2009/10/06
+ Sun C++ 5.9 SunOS_sparc
+ Patch 124863-16 2009/09/15
IA-64 Linux 2.4.21.SuSE_292.til1 ia64
(NCSA tg-login) gcc 3.2.2
Intel(R) C++ Version 8.1
@@ -486,8 +515,9 @@ Platforms Tested
Windows Vista
Visual Studio 2005
- MAC OS 10.4 (Intel) gcc i686-apple-darwin8-gcc-4.0.1 (GCC) 4.0.1
+ MAC OS 10.5 (Intel) gcc i686-apple-darwin8-gcc-4.0.1 (GCC) 4.0.1
G95 (GCC 4.0.3 (g95 0.91!) Nov 21 2006)
+ GNU Fortran (GCC) 4.3.0 20070810
Alpha Open VMS 7.3
@@ -504,12 +534,8 @@ Supported Configuration Features Summary
Platform C F90 F90 C++ zlib SZIP
parallel parallel
-SunOS5.8 64-bit n y n y y y
-SunOS5.8 32-bit n y n y y y
SunOS5.10 64-bit n y n y y y
SunOS5.10 32-bit n y n y y y
-IRIX64_6.5 64-bit n y y y y y
-IRIX64_6.5 32-bit n n n n y y
AIX-5.2 32-bit y y y y y y
AIX-5.2 64-bit y y y y y y
Cray XT3 (not tested
@@ -517,8 +543,7 @@ Cray XT3 (not tested
Windows XP n y(3) n(3) y y y
Windows XP x64 n y(3) n(3) y y y
Windows Vista n n n y y y
-Mac OS X 10.4 PowerPC n n
-Mac OS X 10.4 Intel n y n y y y
+Mac OS X 10.5 Intel n y n y y y
FreeBSD 6.2 32-bit n n n y y y
FreeBSD 6.2 64-bit
RedHat EL4 2.6.9 i686 GNU W y(2) y(4) y(2) y y y
@@ -539,12 +564,8 @@ Alpha OpenVMS 7.3.2 n y n y n n
Platform Shared Shared Shared static- Thread-
C libs F90 libs C++ libs exec safe
-SunOS 5.8 32-bit y y y x y
-SunOS 5.8 64-bit y y y x y
SunOS 5.10 32-bit y y y x y
SunOS 5.10 64-bit y y y x y
-IRIX64_6.5 32-bit y n y x y
-IRIX64_6.5 64-bit y y n x y
AIX-5.2 32-bit n n n x n
AIX-5.2 64-bit n n n x n
Cray XT3 (not tested
@@ -552,7 +573,7 @@ Cray XT3 (not tested
Windows XP y y(3) y y y
Windows XP x64 y y(3) y y y
Windows Vista y n n y y
-Mac OS X 10.4 Intel Duo y y y x n
+Mac OS X 10.5 Intel y y y x n
FreeBSD 6.2 32-bit y y y x n
FreeBSD 6.2 64-bit y y y x n
RHEL4 2.6.9 i686 GNU W y y(4) y x y
@@ -580,6 +601,17 @@ SuSe Linux 2.6.5
Known Problems
==============
+* Parallel mode in AIX will fail some of the testcheck_version.sh tests where
+ it treats "exit(134) the same as if process 0 had received an abort signal.
+ This is fixed and will be available in the next release. AKC - 2009/11/3
+
+* Some tests in tools/h5repack may fail in AIX systems when -q32 mode is used.
+ The error is due to insufficient memory requested. Request a large amount
+ of runtime memory by setting the following environment variable for more
+ memory.
+ LDR_CNTRL=MAXDATA=0x20000000@DSA
+ AKC - 2009/10/31
+
* The PathScale MPI implementation, accessing a Panasas file system, would
cause H5Fcreate() with H5F_ACC_EXCL to fail even when the file is not
existing. This is due to the MPI_File_open() call failing if the amode has
@@ -590,26 +622,6 @@ Known Problems
collective abort of all ranks at t_posix_compliant / allwrite_allread_blocks
with MPI IO. (CMC - 2009/04/28)
-* We discovered two problems when running collective IO parallel HDF5 tests
- with chunking storage on ChaMPIon MPI compiler on tungsten, a linux
- cluster at NCSA.
- Under some complex selection cases,
- 1) MPI_Get_element returns the wrong value.
- 2) MPI_Type_struct also generates wrong derived data type and corrupt data
- may be generated.
- This only happens when turning on collective IO with chunking storage
- with some complex selections. We haven't found these problems on other
- MPI-IO compilers. If you encounter these problems, you may use Independent IO
- instead.
-
- Change the following line in your code:
- H5Pset_dxpl_mpio(xfer_plist, H5FD_MPIO_COLLECTIVE);
-
- to
- H5Pset_dxpl_mpio(xfer_plist, H5FD_MPIO_INDEPENDENT);
-
- KY - 2007/08/24
-
* For SNL, spirit/liberty/thunderbird: The serial tests pass but parallel
tests failed with MPI-IO file locking message. AKC - 2007/6/25.
* On Intel 64 Linux cluster (RH 4, Linux 2.6.9) with Intel 10.0 compilers use
@@ -619,9 +631,6 @@ Known Problems
shared libraries (tested for 1.8.0-beta2)
* For SNL, Red Storm: only paralle HDF5 is supported. The serial tests pass
and the parallel tests also pass with lots of non-fatal error messages.
-* For LLNL, uP: both serial and parallel pass. Zeus: serial passes but
- parallel fails with a known proglem in MPI. ubgl: serial passes but
- parallel fails.
* on SUN 5.10 C++ test fails in the "Testing Shared Datatypes with Attributes" test
* configuring with --enable-debug=all produces compiler errors on most
platforms. Users who want to run HDF5 in debug mode should use
@@ -641,11 +650,6 @@ Known Problems
contribute no IO and the application asks to do IO with collective, we found
that when using 4 processors, a simple collective write will be hung
sometimes. This can be verified with t_mpi test under testpar.
-* On IRIX6.5, when C compiler version >7.4, the complicate MPI derived data type
- code will work. However, the user should be aware to enlarge MPI_TYPE_MAX environment
- variable to some certian value in order to use collective irregular selection code.
- For example, the current parallel HDF5 test needs to enlarge MPI_TYPE_MAX to
- 200,000 to make the test pass.
* The dataset created or rewritten with the v1.6.3 library or after can't
be read with the v1.6.2 library or before when Fletcher32 EDC(filter) is
enabled. There was a bug in the calculating code of the Fletcher32
@@ -683,16 +687,13 @@ Known Problems
test again, change the port address in test/stream_test.c to one not
being used in the host.
-* The --enable-static-exec configure flag fails to compile for Solaris
- platforms. This is due to the fact that not all of the system
- libraries on Solaris are available in a static format.
-
- The --enable-static-exec configure flag also fails to correctly compile
- on IBM SP2 platform for the serial mode. The parallel mode works fine
- with this option.
-
- It is suggested that you don't use this option on these platforms
- during configuration.
+* The --enable-static-exec configure flag will only statically link libraries
+ if the static version of that library is present. If only the shared version
+ of a library exists (i.e., most system libraries on Solaris, AIX, and Mac,
+ for example, only have shared versions), the flag should still result in a
+ successful compilation, but note that the installed executables will not be
+ fully static. Thus, the only guarantee on these systems is that the
+ executable is statically linked with just the HDF5 library.
* With the gcc 2.95.2 compiler, HDF 5 uses the `-ansi' flag during
compilation. The ANSI version of the compiler complains about not being
@@ -702,17 +703,6 @@ Known Problems
This warning is innocuous and can be safely ignored.
-
-* The Stream VFD was not tested yet under Windows. It is not supported
- in the TFLOPS machine.
-
-
-* The ./dsets tests failed in the TFLOPS machine if the test program,
- dsets.c, is compiled with the -O option. The hdf5 library still works
- correctly with the -O option. The test program works fine if it is
- compiled with -O1 or -O0. Only -O (same as -O2) causes the test
- program to fail.
-
* Certain platforms give false negatives when testing h5ls:
- Cray J90 and Cray T90IEEE give errors during testing when displaying
some floating-point values. These are benign differences due to
diff --git a/src/H5.c b/src/H5.c
index 4041483..6bd96cb 100644
--- a/src/H5.c
+++ b/src/H5.c
@@ -61,6 +61,10 @@ static void H5_debug_mask(const char*);
/* Library Private Variables */
/*****************************/
+/* HDF5 API Entered variable */
+/* (move to H5.c when new FUNC_ENTER macros in actual use -QAK) */
+hbool_t H5_api_entered_g = FALSE;
+
/* statically initialize block for pthread_once call used in initializing */
/* the first global mutex */
#ifdef H5_HAVE_THREADSAFE
@@ -348,7 +352,7 @@ H5dont_atexit(void)
{
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_API_NOINIT_NOFS(H5dont_atexit)
+ FUNC_ENTER_API_NOINIT_NOERR_NOFS(H5dont_atexit)
H5TRACE0("e","");
if(H5_dont_atexit_g)
@@ -622,10 +626,10 @@ H5check_version(unsigned majnum, unsigned minnum, unsigned relnum)
char substr[] = H5_VERS_SUBRELEASE;
static int checked = 0; /* If we've already checked the version info */
static unsigned int disable_version_check = 0; /* Set if the version check should be disabled */
- herr_t ret_value=SUCCEED; /* Return value */
- static char *version_mismatch_warning=VERSION_MISMATCH_WARNING;
+ static const char *version_mismatch_warning = VERSION_MISMATCH_WARNING;
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_API_NOINIT_NOFS(H5check_version)
+ FUNC_ENTER_API_NOINIT_NOERR_NOFS(H5check_version)
H5TRACE3("e", "IuIuIu", majnum, minnum, relnum);
/* Don't check again, if we already have */
@@ -692,7 +696,7 @@ H5check_version(unsigned majnum, unsigned minnum, unsigned relnum)
*/
sprintf(lib_str, "HDF5 library version: %d.%d.%d",
H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE);
- if (*substr){
+ if(*substr) {
HDstrcat(lib_str, "-");
HDstrncat(lib_str, substr, (sizeof(lib_str) - HDstrlen(lib_str)) - 1);
} /* end if */
@@ -769,7 +773,7 @@ H5close(void)
* whole library just to release it all right away. It is safe to call
* this function for an uninitialized library.
*/
- FUNC_ENTER_API_NOINIT_NOFS(H5close)
+ FUNC_ENTER_API_NOINIT_NOERR_NOFS(H5close)
H5TRACE0("e","");
H5_term_library();
diff --git a/src/H5Abtree2.c b/src/H5Abtree2.c
index a0035b3..7d0bb4c 100644
--- a/src/H5Abtree2.c
+++ b/src/H5Abtree2.c
@@ -90,7 +90,6 @@ static herr_t H5A_dense_btree2_corder_debug(FILE *stream, const H5F_t *f, hid_t
/* v2 B-tree driver callbacks for 'name' index */
static herr_t H5A_dense_btree2_name_store(void *native, const void *udata);
-static herr_t H5A_dense_btree2_name_retrieve(void *udata, const void *native);
static herr_t H5A_dense_btree2_name_compare(const void *rec1, const void *rec2);
static herr_t H5A_dense_btree2_name_encode(const H5F_t *f, uint8_t *raw,
const void *native);
@@ -108,7 +107,8 @@ static herr_t H5A_dense_fh_name_cmp(const void *obj, size_t obj_len, void *op_da
/*********************/
/* v2 B-tree class for indexing 'name' field of attributes */
const H5B2_class_t H5A_BT2_NAME[1]={{ /* B-tree class information */
- H5B2_ATTR_DENSE_NAME_ID, /* Type of B-tree */
+ H5B2_ATTR_DENSE_NAME_ID, /* Type of B-tree */
+ "H5B2_ATTR_DENSE_NAME_ID", /* Name of B-tree class */
sizeof(H5A_dense_bt2_name_rec_t), /* Size of native record */
H5A_dense_btree2_name_store, /* Record storage callback */
H5A_dense_btree2_name_compare, /* Record comparison callback */
@@ -118,8 +118,9 @@ const H5B2_class_t H5A_BT2_NAME[1]={{ /* B-tree class information */
}};
/* v2 B-tree class for indexing 'creation order' field of attributes */
-const H5B2_class_t H5A_BT2_CORDER[1]={{ /* B-tree class information */
- H5B2_ATTR_DENSE_CORDER_ID, /* Type of B-tree */
+const H5B2_class_t H5A_BT2_CORDER[1]={{ /* B-tree class information */
+ H5B2_ATTR_DENSE_CORDER_ID, /* Type of B-tree */
+ "H5B2_ATTR_DENSE_CORDER_ID", /* Name of B-tree class */
sizeof(H5A_dense_bt2_corder_rec_t),/* Size of native record */
H5A_dense_btree2_corder_store, /* Record storage callback */
H5A_dense_btree2_corder_compare, /* Record comparison callback */
diff --git a/src/H5Adense.c b/src/H5Adense.c
index bc5ddfb..c9da207 100644
--- a/src/H5Adense.c
+++ b/src/H5Adense.c
@@ -186,8 +186,10 @@ herr_t
H5A_dense_create(H5F_t *f, hid_t dxpl_id, H5O_ainfo_t *ainfo)
{
H5HF_create_t fheap_cparam; /* Fractal heap creation parameters */
- H5HF_t *fheap; /* Fractal heap handle */
- size_t bt2_rrec_size; /* v2 B-tree raw record size */
+ H5B2_create_t bt2_cparam; /* v2 B-tree creation parameters */
+ H5HF_t *fheap = NULL; /* Fractal heap handle */
+ H5B2_t *bt2_name = NULL; /* v2 B-tree handle for names */
+ H5B2_t *bt2_corder = NULL; /* v2 B-tree handle for creation order */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5A_dense_create, FAIL)
@@ -234,20 +236,22 @@ HDfprintf(stderr, "%s: fheap_id_len = %Zu\n", FUNC, fheap_id_len);
}
#endif /* NDEBUG */
- /* Close the fractal heap */
- if(H5HF_close(fheap, dxpl_id) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
-
/* Create the name index v2 B-tree */
- bt2_rrec_size = 4 + /* Name's hash value */
+ HDmemset(&bt2_cparam, 0, sizeof(bt2_cparam));
+ bt2_cparam.cls = H5A_BT2_NAME;
+ bt2_cparam.node_size = (size_t)H5A_NAME_BT2_NODE_SIZE;
+ bt2_cparam.rrec_size = 4 + /* Name's hash value */
4 + /* Creation order index */
1 + /* Message flags */
H5O_FHEAP_ID_LEN; /* Fractal heap ID */
- if(H5B2_create(f, dxpl_id, H5A_BT2_NAME,
- (size_t)H5A_NAME_BT2_NODE_SIZE, bt2_rrec_size,
- H5A_NAME_BT2_SPLIT_PERC, H5A_NAME_BT2_MERGE_PERC,
- &ainfo->name_bt2_addr) < 0)
+ bt2_cparam.split_percent = H5A_NAME_BT2_SPLIT_PERC;
+ bt2_cparam.merge_percent = H5A_NAME_BT2_MERGE_PERC;
+ if(NULL == (bt2_name = H5B2_create(f, dxpl_id, &bt2_cparam)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to create v2 B-tree for name index")
+
+ /* Retrieve the v2 B-tree's address in the file */
+ if(H5B2_get_addr(bt2_name, &ainfo->name_bt2_addr) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get v2 B-tree address for name index")
#ifdef QAK
HDfprintf(stderr, "%s: ainfo->name_bt2_addr = %a\n", FUNC, ainfo->name_bt2_addr);
#endif /* QAK */
@@ -255,20 +259,34 @@ HDfprintf(stderr, "%s: ainfo->name_bt2_addr = %a\n", FUNC, ainfo->name_bt2_addr)
/* Check if we should create a creation order index v2 B-tree */
if(ainfo->index_corder) {
/* Create the creation order index v2 B-tree */
- bt2_rrec_size = 4 + /* Creation order index */
+ HDmemset(&bt2_cparam, 0, sizeof(bt2_cparam));
+ bt2_cparam.cls = H5A_BT2_CORDER;
+ bt2_cparam.node_size = (size_t)H5A_CORDER_BT2_NODE_SIZE;
+ bt2_cparam.rrec_size = 4 + /* Creation order index */
1 + /* Message flags */
H5O_FHEAP_ID_LEN; /* Fractal heap ID */
- if(H5B2_create(f, dxpl_id, H5A_BT2_CORDER,
- (size_t)H5A_CORDER_BT2_NODE_SIZE, bt2_rrec_size,
- H5A_CORDER_BT2_SPLIT_PERC, H5A_CORDER_BT2_MERGE_PERC,
- &ainfo->corder_bt2_addr) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to create v2 B-tree for name index")
+ bt2_cparam.split_percent = H5A_CORDER_BT2_SPLIT_PERC;
+ bt2_cparam.merge_percent = H5A_CORDER_BT2_MERGE_PERC;
+ if(NULL == (bt2_corder = H5B2_create(f, dxpl_id, &bt2_cparam)))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to create v2 B-tree for creation order index")
+
+ /* Retrieve the v2 B-tree's address in the file */
+ if(H5B2_get_addr(bt2_corder, &ainfo->corder_bt2_addr) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get v2 B-tree address for creation order index")
#ifdef QAK
HDfprintf(stderr, "%s: ainfo->corder_bt2_addr = %a\n", FUNC, ainfo->corder_bt2_addr);
#endif /* QAK */
} /* end if */
done:
+ /* Release resources */
+ if(fheap && H5HF_close(fheap, dxpl_id) < 0)
+ HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
+ if(bt2_name && H5B2_close(bt2_name, dxpl_id) < 0)
+ HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for name index")
+ if(bt2_corder && H5B2_close(bt2_corder, dxpl_id) < 0)
+ HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for creation order index")
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A_dense_create() */
@@ -326,6 +344,7 @@ H5A_dense_open(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo, const char *na
H5A_bt2_ud_common_t udata; /* User data for v2 B-tree modify */
H5HF_t *fheap = NULL; /* Fractal heap handle */
H5HF_t *shared_fheap = NULL; /* Fractal heap handle for shared header messages */
+ H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */
htri_t attr_sharable; /* Flag indicating attributes are sharable */
htri_t attr_exists; /* Attribute exists in v2 B-tree */
H5A_t *ret_value = NULL; /* Return value */
@@ -363,6 +382,10 @@ H5A_dense_open(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo, const char *na
} /* end if */
} /* end if */
+ /* Open the name index v2 B-tree */
+ if(NULL == (bt2_name = H5B2_open(f, dxpl_id, ainfo->name_bt2_addr)))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "unable to open v2 B-tree for name index")
+
/* Create the "udata" information for v2 B-tree record find */
udata.f = f;
udata.dxpl_id = dxpl_id;
@@ -376,7 +399,7 @@ H5A_dense_open(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo, const char *na
udata.found_op_data = &ret_value;
/* Find & copy the attribute in the 'name' index */
- if((attr_exists = H5B2_find(f, dxpl_id, H5A_BT2_NAME, ainfo->name_bt2_addr, &udata, NULL, NULL)) < 0)
+ if((attr_exists = H5B2_find(bt2_name, dxpl_id, &udata, NULL, NULL)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, NULL, "can't search for attribute in name index")
else if(attr_exists == FALSE)
HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, NULL, "can't locate attribute in name index")
@@ -387,6 +410,8 @@ done:
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, NULL, "can't close fractal heap")
if(fheap && H5HF_close(fheap, dxpl_id) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, NULL, "can't close fractal heap")
+ if(bt2_name && H5B2_close(bt2_name, dxpl_id) < 0)
+ HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, NULL, "can't close v2 B-tree for name index")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A_dense_open() */
@@ -411,6 +436,8 @@ H5A_dense_insert(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo, H5A_t *attr)
H5A_bt2_ud_ins_t udata; /* User data for v2 B-tree insertion */
H5HF_t *fheap = NULL; /* Fractal heap handle for attributes */
H5HF_t *shared_fheap = NULL; /* Fractal heap handle for shared header messages */
+ 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 */
H5WB_t *wb = NULL; /* Wrapped buffer for attribute data */
uint8_t attr_buf[H5A_ATTR_BUF_SIZE]; /* Buffer for serializing message */
unsigned mesg_flags = 0; /* Flags for storing message */
@@ -500,6 +527,10 @@ H5A_dense_insert(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo, H5A_t *attr)
HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "unable to insert attribute into fractal heap")
} /* end else */
+ /* Open the name index v2 B-tree */
+ if(NULL == (bt2_name = H5B2_open(f, dxpl_id, ainfo->name_bt2_addr)))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index")
+
/* Create the callback information for v2 B-tree record insertion */
udata.common.f = f;
udata.common.dxpl_id = dxpl_id;
@@ -514,15 +545,19 @@ H5A_dense_insert(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo, H5A_t *attr)
/* udata.id already set */
/* Insert attribute into 'name' tracking v2 B-tree */
- if(H5B2_insert(f, dxpl_id, H5A_BT2_NAME, ainfo->name_bt2_addr, &udata) < 0)
+ if(H5B2_insert(bt2_name, dxpl_id, &udata) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "unable to insert record into v2 B-tree")
/* Check if we should create a creation order index v2 B-tree record */
if(ainfo->index_corder) {
- /* Insert the record into the creation order index v2 B-tree */
+ /* Open the creation order index v2 B-tree */
HDassert(H5F_addr_defined(ainfo->corder_bt2_addr));
- if(H5B2_insert(f, dxpl_id, H5A_BT2_CORDER, ainfo->corder_bt2_addr, &udata) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert record into v2 B-tree")
+ if(NULL == (bt2_corder = H5B2_open(f, dxpl_id, ainfo->corder_bt2_addr)))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for creation order index")
+
+ /* Insert the record into the creation order index v2 B-tree */
+ if(H5B2_insert(bt2_corder, dxpl_id, &udata) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "unable to insert record into v2 B-tree")
} /* end if */
done:
@@ -531,6 +566,10 @@ done:
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
if(fheap && H5HF_close(fheap, dxpl_id) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
+ if(bt2_name && H5B2_close(bt2_name, dxpl_id) < 0)
+ HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for name index")
+ if(bt2_corder && H5B2_close(bt2_corder, dxpl_id) < 0)
+ HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for creation order index")
if(wb && H5WB_unwrap(wb) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close wrapped buffer")
@@ -594,6 +633,7 @@ H5A_dense_write_bt2_cb(void *_record, void *_op_data, hbool_t *changed)
{
H5A_dense_bt2_name_rec_t *record = (H5A_dense_bt2_name_rec_t *)_record; /* Record from B-tree */
H5A_bt2_od_wrt_t *op_data = (H5A_bt2_od_wrt_t *)_op_data; /* "op data" from v2 B-tree modify */
+ H5B2_t *bt2_corder = NULL; /* v2 B-tree handle for creation order index */
H5WB_t *wb = NULL; /* Wrapped buffer for attribute data */
uint8_t attr_buf[H5A_ATTR_BUF_SIZE]; /* Buffer for serializing attribute */
herr_t ret_value = SUCCEED; /* Return value */
@@ -619,6 +659,10 @@ H5A_dense_write_bt2_cb(void *_record, void *_op_data, hbool_t *changed)
if(H5F_addr_defined(op_data->corder_bt2_addr)) {
H5A_bt2_ud_common_t udata; /* User data for v2 B-tree modify */
+ /* Open the creation order index v2 B-tree */
+ if(NULL == (bt2_corder = H5B2_open(op_data->f, op_data->dxpl_id, op_data->corder_bt2_addr)))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for creation order index")
+
/* Create the "udata" information for v2 B-tree record modify */
udata.f = op_data->f;
udata.dxpl_id = op_data->dxpl_id;
@@ -632,7 +676,7 @@ H5A_dense_write_bt2_cb(void *_record, void *_op_data, hbool_t *changed)
udata.found_op_data = NULL;
/* Modify record for creation order index */
- if(H5B2_modify(op_data->f, op_data->dxpl_id, H5A_BT2_CORDER, op_data->corder_bt2_addr, &udata, H5A_dense_write_bt2_cb2, &op_data->attr->sh_loc.u.heap_id) < 0)
+ if(H5B2_modify(bt2_corder, op_data->dxpl_id, &udata, H5A_dense_write_bt2_cb2, &op_data->attr->sh_loc.u.heap_id) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "unable to modify record in v2 B-tree")
} /* end if */
@@ -677,6 +721,8 @@ H5A_dense_write_bt2_cb(void *_record, void *_op_data, hbool_t *changed)
done:
/* Release resources */
+ if(bt2_corder && H5B2_close(bt2_corder, op_data->dxpl_id) < 0)
+ HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for creation order index")
if(wb && H5WB_unwrap(wb) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close wrapped buffer")
@@ -704,6 +750,7 @@ H5A_dense_write(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo, H5A_t *attr)
H5A_bt2_od_wrt_t op_data; /* "Op data" for v2 B-tree modify */
H5HF_t *fheap = NULL; /* Fractal heap handle */
H5HF_t *shared_fheap = NULL; /* Fractal heap handle for shared header messages */
+ H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */
htri_t attr_sharable; /* Flag indicating attributes are sharable */
herr_t ret_value = SUCCEED; /* Return value */
@@ -742,6 +789,10 @@ H5A_dense_write(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo, H5A_t *attr)
if(NULL == (fheap = H5HF_open(f, dxpl_id, ainfo->fheap_addr)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap")
+ /* Open the name index v2 B-tree */
+ if(NULL == (bt2_name = H5B2_open(f, dxpl_id, ainfo->name_bt2_addr)))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index")
+
/* Create the "udata" information for v2 B-tree record modify */
udata.f = f;
udata.dxpl_id = dxpl_id;
@@ -763,7 +814,7 @@ H5A_dense_write(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo, H5A_t *attr)
op_data.corder_bt2_addr = ainfo->corder_bt2_addr;
/* Modify attribute through 'name' tracking v2 B-tree */
- if(H5B2_modify(f, dxpl_id, H5A_BT2_NAME, ainfo->name_bt2_addr, &udata, H5A_dense_write_bt2_cb, &op_data) < 0)
+ if(H5B2_modify(bt2_name, dxpl_id, &udata, H5A_dense_write_bt2_cb, &op_data) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "unable to modify record in v2 B-tree")
done:
@@ -772,6 +823,8 @@ done:
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
if(fheap && H5HF_close(fheap, dxpl_id) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
+ if(bt2_name && H5B2_close(bt2_name, dxpl_id) < 0)
+ HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for name index")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A_dense_write() */
@@ -841,6 +894,7 @@ H5A_dense_rename(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo, const char *
H5A_bt2_ud_common_t udata; /* User data for v2 B-tree modify */
H5HF_t *fheap = NULL; /* Fractal heap handle */
H5HF_t *shared_fheap = NULL; /* Fractal heap handle for shared header messages */
+ H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */
H5A_t *attr_copy = NULL; /* Copy of attribute to rename */
htri_t attr_sharable; /* Flag indicating attributes are sharable */
htri_t shared_mesg; /* Should this message be stored in the Shared Message table? */
@@ -881,6 +935,10 @@ H5A_dense_rename(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo, const char *
if(NULL == (fheap = H5HF_open(f, dxpl_id, ainfo->fheap_addr)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap")
+ /* Open the name index v2 B-tree */
+ if(NULL == (bt2_name = H5B2_open(f, dxpl_id, ainfo->name_bt2_addr)))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index")
+
/* Create the "udata" information for v2 B-tree record modify */
udata.f = f;
udata.dxpl_id = dxpl_id;
@@ -894,7 +952,7 @@ H5A_dense_rename(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo, const char *
udata.found_op_data = &attr_copy;
/* Get copy of attribute through 'name' tracking v2 B-tree */
- if((attr_exists = H5B2_find(f, dxpl_id, H5A_BT2_NAME, ainfo->name_bt2_addr, &udata, NULL, NULL)) < 0)
+ if((attr_exists = H5B2_find(bt2_name, dxpl_id, &udata, NULL, NULL)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "can't search for attribute in name index")
else if(attr_exists == FALSE)
HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "can't locate attribute in name index")
@@ -962,6 +1020,8 @@ done:
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
if(fheap && H5HF_close(fheap, dxpl_id) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
+ if(bt2_name && H5B2_close(bt2_name, dxpl_id) < 0)
+ HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for name index")
if(attr_copy)
H5O_msg_free(H5O_ATTR_ID, attr_copy);
@@ -1087,7 +1147,7 @@ H5A_dense_iterate(H5F_t *f, hid_t dxpl_id, hid_t loc_id, const H5O_ainfo_t *ainf
H5HF_t *fheap = NULL; /* Fractal heap handle */
H5HF_t *shared_fheap = NULL; /* Fractal heap handle for shared header messages */
H5A_attr_table_t atable = {0, NULL}; /* Table of attributes */
- const H5B2_class_t *bt2_class = NULL; /* Class of v2 B-tree */
+ H5B2_t *bt2 = NULL; /* v2 B-tree handle for index */
haddr_t bt2_addr; /* Address of v2 B-tree to use for lookup */
herr_t ret_value; /* Return value */
@@ -1111,7 +1171,6 @@ H5A_dense_iterate(H5F_t *f, hid_t dxpl_id, hid_t loc_id, const H5O_ainfo_t *ainf
if(order == H5_ITER_NATIVE) {
HDassert(H5F_addr_defined(ainfo->name_bt2_addr));
bt2_addr = ainfo->name_bt2_addr;
- bt2_class = H5A_BT2_NAME;
} /* end if */
else
bt2_addr = HADDR_UNDEF;
@@ -1124,7 +1183,6 @@ H5A_dense_iterate(H5F_t *f, hid_t dxpl_id, hid_t loc_id, const H5O_ainfo_t *ainf
* the links, a table will be built.
*/
bt2_addr = ainfo->corder_bt2_addr;
- bt2_class = H5A_BT2_CORDER;
} /* end else */
/* Check on iteration order */
@@ -1156,6 +1214,10 @@ H5A_dense_iterate(H5F_t *f, hid_t dxpl_id, hid_t loc_id, const H5O_ainfo_t *ainf
} /* end if */
} /* end if */
+ /* Open the index v2 B-tree */
+ if(NULL == (bt2 = H5B2_open(f, dxpl_id, bt2_addr)))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for index")
+
/* Construct the user data for v2 B-tree iterator callback */
udata.f = f;
udata.dxpl_id = dxpl_id;
@@ -1169,7 +1231,7 @@ H5A_dense_iterate(H5F_t *f, hid_t dxpl_id, hid_t loc_id, const H5O_ainfo_t *ainf
/* Iterate over the records in the v2 B-tree's "native" order */
/* (by hash of name) */
- if((ret_value = H5B2_iterate(f, dxpl_id, bt2_class, bt2_addr, H5A_dense_iterate_bt2_cb, &udata)) < 0)
+ if((ret_value = H5B2_iterate(bt2, dxpl_id, H5A_dense_iterate_bt2_cb, &udata)) < 0)
HERROR(H5E_ATTR, H5E_BADITER, "attribute iteration failed");
/* Update the last attribute examined, if requested */
@@ -1193,6 +1255,8 @@ done:
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
if(fheap && H5HF_close(fheap, dxpl_id) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
+ if(bt2 && H5B2_close(bt2, dxpl_id) < 0)
+ HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for index")
if(atable.attrs && H5A_attr_release_table(&atable) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "unable to release attribute table")
@@ -1219,18 +1283,23 @@ H5A_dense_remove_bt2_cb(const void *_record, void *_udata)
const H5A_dense_bt2_name_rec_t *record = (const H5A_dense_bt2_name_rec_t *)_record;
H5A_bt2_ud_rm_t *udata = (H5A_bt2_ud_rm_t *)_udata; /* User data for callback */
H5A_t *attr = *(H5A_t **)udata->common.found_op_data; /* Pointer to attribute to remove */
+ H5B2_t *bt2_corder = NULL; /* v2 B-tree handle for creation order index */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5A_dense_remove_bt2_cb)
/* Check for removing the link from the creation order index */
if(H5F_addr_defined(udata->corder_bt2_addr)) {
+ /* Open the creation order index v2 B-tree */
+ if(NULL == (bt2_corder = H5B2_open(udata->common.f, udata->common.dxpl_id, udata->corder_bt2_addr)))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for creation order index")
+
/* Set up the user data for the v2 B-tree 'record remove' callback */
udata->common.corder = attr->shared->crt_idx;
/* Remove the record from the creation order index v2 B-tree */
- if(H5B2_remove(udata->common.f, udata->common.dxpl_id, H5A_BT2_CORDER, udata->corder_bt2_addr, udata, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTREMOVE, FAIL, "unable to remove attribute from creation order index v2 B-tree")
+ if(H5B2_remove(bt2_corder, udata->common.dxpl_id, udata, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTREMOVE, FAIL, "unable to remove attribute from creation order index v2 B-tree")
} /* end if */
/* Check for removing shared attribute */
@@ -1251,6 +1320,10 @@ H5A_dense_remove_bt2_cb(const void *_record, void *_udata)
} /* end else */
done:
+ /* Release resources */
+ if(bt2_corder && H5B2_close(bt2_corder, udata->common.dxpl_id) < 0)
+ HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for creation order index")
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A_dense_remove_bt2_cb() */
@@ -1274,6 +1347,7 @@ H5A_dense_remove(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo, const char *
H5A_bt2_ud_rm_t udata; /* User data for v2 B-tree record removal */
H5HF_t *fheap = NULL; /* Fractal heap handle */
H5HF_t *shared_fheap = NULL; /* Fractal heap handle for shared header messages */
+ H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */
H5A_t *attr_copy = NULL; /* Copy of attribute to remove */
htri_t attr_sharable; /* Flag indicating attributes are sharable */
herr_t ret_value = SUCCEED; /* Return value */
@@ -1311,6 +1385,10 @@ H5A_dense_remove(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo, const char *
} /* end if */
} /* end if */
+ /* Open the name index v2 B-tree */
+ if(NULL == (bt2_name = H5B2_open(f, dxpl_id, ainfo->name_bt2_addr)))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index")
+
/* Set up the user data for the v2 B-tree 'record remove' callback */
udata.common.f = f;
udata.common.dxpl_id = dxpl_id;
@@ -1323,7 +1401,7 @@ H5A_dense_remove(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo, const char *
udata.corder_bt2_addr = ainfo->corder_bt2_addr;
/* Remove the record from the name index v2 B-tree */
- if(H5B2_remove(f, dxpl_id, H5A_BT2_NAME, ainfo->name_bt2_addr, &udata, H5A_dense_remove_bt2_cb, &udata) < 0)
+ if(H5B2_remove(bt2_name, dxpl_id, &udata, H5A_dense_remove_bt2_cb, &udata) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTREMOVE, FAIL, "unable to remove attribute from name index v2 B-tree")
done:
@@ -1332,6 +1410,8 @@ done:
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
if(fheap && H5HF_close(fheap, dxpl_id) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
+ if(bt2_name && H5B2_close(bt2_name, dxpl_id) < 0)
+ HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for name index")
if(attr_copy)
H5O_msg_free_real(H5O_MSG_ATTR, attr_copy);
@@ -1356,6 +1436,7 @@ static herr_t
H5A_dense_remove_by_idx_bt2_cb(const void *_record, void *_bt2_udata)
{
H5HF_t *fheap; /* Fractal heap handle */
+ H5B2_t *bt2 = NULL; /* v2 B-tree handle for index */
const H5A_dense_bt2_name_rec_t *record = (const H5A_dense_bt2_name_rec_t *)_record; /* v2 B-tree record */
H5A_bt2_ud_rmbi_t *bt2_udata = (H5A_bt2_ud_rmbi_t *)_bt2_udata; /* User data for callback */
H5A_fh_ud_cp_t fh_udata; /* User data for fractal heap 'op' callback */
@@ -1398,22 +1479,15 @@ H5A_dense_remove_by_idx_bt2_cb(const void *_record, void *_bt2_udata)
/* Check for removing the link from the "other" index (creation order, when name used and vice versa) */
if(H5F_addr_defined(bt2_udata->other_bt2_addr)) {
H5A_bt2_ud_common_t other_bt2_udata; /* Info for B-tree callbacks */
- const H5B2_class_t *other_bt2_class; /* Class of "other" v2 B-tree */
/* Determine the index being used */
if(bt2_udata->idx_type == H5_INDEX_NAME) {
- /* Set the class of the "other" index */
- other_bt2_class = H5A_BT2_CORDER;
-
/* Set up the user data for the v2 B-tree 'record remove' callback */
other_bt2_udata.corder = fh_udata.attr->shared->crt_idx;
} /* end if */
else {
HDassert(bt2_udata->idx_type == H5_INDEX_CRT_ORDER);
- /* Set the class of the "other" index */
- other_bt2_class = H5A_BT2_NAME;
-
/* Set up the user data for the v2 B-tree 'record remove' callback */
other_bt2_udata.f = bt2_udata->f;
other_bt2_udata.dxpl_id = bt2_udata->dxpl_id;
@@ -1425,10 +1499,14 @@ H5A_dense_remove_by_idx_bt2_cb(const void *_record, void *_bt2_udata)
other_bt2_udata.found_op_data = NULL;
} /* end else */
+ /* Open the index v2 B-tree */
+ if(NULL == (bt2 = H5B2_open(bt2_udata->f, bt2_udata->dxpl_id, bt2_udata->other_bt2_addr)))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for index")
+
/* Set the common information for the v2 B-tree remove operation */
/* Remove the record from the "other" index v2 B-tree */
- if(H5B2_remove(bt2_udata->f, bt2_udata->dxpl_id, other_bt2_class, bt2_udata->other_bt2_addr, &other_bt2_udata, NULL, NULL) < 0)
+ if(H5B2_remove(bt2, bt2_udata->dxpl_id, &other_bt2_udata, NULL, NULL) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTREMOVE, FAIL, "unable to remove record from 'other' index v2 B-tree")
} /* end if */
@@ -1459,6 +1537,8 @@ H5A_dense_remove_by_idx_bt2_cb(const void *_record, void *_bt2_udata)
done:
/* Release resources */
+ if(bt2 && H5B2_close(bt2, bt2_udata->dxpl_id) < 0)
+ HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for index")
if(fh_udata.attr)
H5O_msg_free(H5O_ATTR_ID, fh_udata.attr);
@@ -1487,7 +1567,7 @@ H5A_dense_remove_by_idx(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo,
H5HF_t *fheap = NULL; /* Fractal heap handle */
H5HF_t *shared_fheap = NULL; /* Fractal heap handle for shared header messages */
H5A_attr_table_t atable = {0, NULL}; /* Table of attributes */
- const H5B2_class_t *bt2_class = NULL; /* Class of v2 B-tree */
+ H5B2_t *bt2 = NULL; /* v2 B-tree handle for index */
haddr_t bt2_addr; /* Address of v2 B-tree to use for operation */
herr_t ret_value = SUCCEED; /* Return value */
@@ -1507,7 +1587,6 @@ H5A_dense_remove_by_idx(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo,
*/
if(order == H5_ITER_NATIVE) {
bt2_addr = ainfo->name_bt2_addr;
- bt2_class = H5A_BT2_NAME;
HDassert(H5F_addr_defined(bt2_addr));
} /* end if */
else
@@ -1521,7 +1600,6 @@ H5A_dense_remove_by_idx(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo,
* the links, a table will be built.
*/
bt2_addr = ainfo->corder_bt2_addr;
- bt2_class = H5A_BT2_CORDER;
} /* end else */
/* If there is an index defined for the field, use it */
@@ -1553,6 +1631,10 @@ H5A_dense_remove_by_idx(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo,
} /* end if */
} /* end if */
+ /* Open the index v2 B-tree */
+ if(NULL == (bt2 = H5B2_open(f, dxpl_id, bt2_addr)))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for index")
+
/* Set up the user data for the v2 B-tree 'record remove' callback */
udata.f = f;
udata.dxpl_id = dxpl_id;
@@ -1562,7 +1644,7 @@ H5A_dense_remove_by_idx(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo,
udata.other_bt2_addr = idx_type == H5_INDEX_NAME ? ainfo->corder_bt2_addr : ainfo->name_bt2_addr;
/* Remove the record from the name index v2 B-tree */
- if(H5B2_remove_by_idx(f, dxpl_id, bt2_class, bt2_addr, order, n, H5A_dense_remove_by_idx_bt2_cb, &udata) < 0)
+ if(H5B2_remove_by_idx(bt2, dxpl_id, order, n, H5A_dense_remove_by_idx_bt2_cb, &udata) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTREMOVE, FAIL, "unable to remove attribute from v2 B-tree index")
} /* end if */
else {
@@ -1586,6 +1668,8 @@ done:
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
if(fheap && H5HF_close(fheap, dxpl_id) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
+ if(bt2 && H5B2_close(bt2, dxpl_id) < 0)
+ HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for index")
if(atable.attrs && H5A_attr_release_table(&atable) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "unable to release attribute table")
@@ -1613,6 +1697,7 @@ H5A_dense_exists(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo, const char *
H5A_bt2_ud_common_t udata; /* User data for v2 B-tree modify */
H5HF_t *fheap = NULL; /* Fractal heap handle */
H5HF_t *shared_fheap = NULL; /* Fractal heap handle for shared header messages */
+ H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */
htri_t attr_sharable; /* Flag indicating attributes are sharable */
htri_t ret_value = TRUE; /* Return value */
@@ -1649,6 +1734,10 @@ H5A_dense_exists(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo, const char *
} /* end if */
} /* end if */
+ /* Open the name index v2 B-tree */
+ if(NULL == (bt2_name = H5B2_open(f, dxpl_id, ainfo->name_bt2_addr)))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index")
+
/* Create the "udata" information for v2 B-tree record 'find' */
udata.f = f;
udata.dxpl_id = dxpl_id;
@@ -1662,7 +1751,7 @@ H5A_dense_exists(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo, const char *
udata.found_op_data = NULL;
/* Find the attribute in the 'name' index */
- if((ret_value = H5B2_find(f, dxpl_id, H5A_BT2_NAME, ainfo->name_bt2_addr, &udata, NULL, NULL)) < 0)
+ if((ret_value = H5B2_find(bt2_name, dxpl_id, &udata, NULL, NULL)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "can't search for attribute in name index")
done:
@@ -1671,6 +1760,8 @@ done:
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
if(fheap && H5HF_close(fheap, dxpl_id) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
+ if(bt2_name && H5B2_close(bt2_name, dxpl_id) < 0)
+ HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for name index")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A_dense_exists() */
@@ -1785,7 +1876,7 @@ H5A_dense_delete(H5F_t *f, hid_t dxpl_id, H5O_ainfo_t *ainfo)
udata.found_op_data = NULL;
/* Delete name index v2 B-tree */
- if(H5B2_delete(f, dxpl_id, H5A_BT2_NAME, ainfo->name_bt2_addr, H5A_dense_delete_bt2_cb, &udata) < 0)
+ if(H5B2_delete(f, dxpl_id, ainfo->name_bt2_addr, H5A_dense_delete_bt2_cb, &udata) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete v2 B-tree for name index")
ainfo->name_bt2_addr = HADDR_UNDEF;
@@ -1797,8 +1888,8 @@ H5A_dense_delete(H5F_t *f, hid_t dxpl_id, H5O_ainfo_t *ainfo)
/* Check if we should delete the creation order index v2 B-tree */
if(H5F_addr_defined(ainfo->corder_bt2_addr)) {
/* Delete the creation order index, without adjusting the ref. count on the attributes */
- if(H5B2_delete(f, dxpl_id, H5A_BT2_CORDER, ainfo->corder_bt2_addr, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete v2 B-tree for creation order index")
+ if(H5B2_delete(f, dxpl_id, ainfo->corder_bt2_addr, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete v2 B-tree for creation order index")
ainfo->corder_bt2_addr = HADDR_UNDEF;
} /* end if */
diff --git a/src/H5Aint.c b/src/H5Aint.c
index 475239a..ab1d32c 100644
--- a/src/H5Aint.c
+++ b/src/H5Aint.c
@@ -314,6 +314,7 @@ herr_t
H5A_dense_build_table(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo,
H5_index_t idx_type, H5_iter_order_t order, H5A_attr_table_t *atable)
{
+ H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */
hsize_t nrec; /* # of records in v2 B-tree */
herr_t ret_value = SUCCEED; /* Return value */
@@ -326,9 +327,13 @@ H5A_dense_build_table(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo,
HDassert(H5F_addr_defined(ainfo->name_bt2_addr));
HDassert(atable);
+ /* Open the name index v2 B-tree */
+ if(NULL == (bt2_name = H5B2_open(f, dxpl_id, ainfo->name_bt2_addr)))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index")
+
/* Retrieve # of records in "name" B-tree */
/* (should be same # of records in all indices) */
- if(H5B2_get_nrec(f, dxpl_id, H5A_BT2_NAME, ainfo->name_bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2_name, &nrec) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't retrieve # of records in index")
/* Set size of table */
@@ -371,6 +376,10 @@ H5A_dense_build_table(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo,
atable->attrs = NULL;
done:
+ /* Release resources */
+ if(bt2_name && H5B2_close(bt2_name, dxpl_id) < 0)
+ HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for name index")
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A_dense_build_table() */
@@ -692,6 +701,7 @@ done:
htri_t
H5A_get_ainfo(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5O_ainfo_t *ainfo)
{
+ H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */
htri_t ret_value; /* Return value */
FUNC_ENTER_NOAPI(H5A_get_ainfo, FAIL)
@@ -713,9 +723,13 @@ H5A_get_ainfo(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5O_ainfo_t *ainfo)
if(ainfo->nattrs == HSIZET_MAX) {
/* Check if we are using "dense" attribute storage */
if(H5F_addr_defined(ainfo->fheap_addr)) {
+ /* Open the name index v2 B-tree */
+ if(NULL == (bt2_name = H5B2_open(f, dxpl_id, ainfo->name_bt2_addr)))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index")
+
/* Retrieve # of records in "name" B-tree */
/* (should be same # of records in all indices) */
- if(H5B2_get_nrec(f, dxpl_id, H5A_BT2_NAME, ainfo->name_bt2_addr, &ainfo->nattrs) < 0)
+ if(H5B2_get_nrec(bt2_name, &ainfo->nattrs) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't retrieve # of records in index")
} /* end if */
else
@@ -725,6 +739,10 @@ H5A_get_ainfo(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5O_ainfo_t *ainfo)
} /* end if */
done:
+ /* Release resources */
+ if(bt2_name && H5B2_close(bt2_name, dxpl_id) < 0)
+ HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for name index")
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A_get_ainfo() */
diff --git a/src/H5B.c b/src/H5B.c
index aba62b0..326d675 100644
--- a/src/H5B.c
+++ b/src/H5B.c
@@ -1286,7 +1286,7 @@ H5B_iterate(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr,
{
herr_t ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5B_iterate, FAIL)
+ FUNC_ENTER_NOAPI_NOERR(H5B_iterate, -)
/*
* Check arguments.
diff --git a/src/H5B2.c b/src/H5B2.c
index 45bfff0..b6e8392 100644
--- a/src/H5B2.c
+++ b/src/H5B2.c
@@ -41,7 +41,7 @@
#include "H5private.h" /* Generic Functions */
#include "H5B2pkg.h" /* v2 B-trees */
#include "H5Eprivate.h" /* Error handling */
-#include "H5MFprivate.h" /* File memory management */
+
/****************/
/* Local Macros */
@@ -67,8 +67,35 @@
/* Package Variables */
/*********************/
-/* Declare a free list to manage the H5B2_t struct */
-H5FL_DEFINE(H5B2_t);
+/* v2 B-tree client ID to class mapping */
+
+/* Remember to add client ID to H5B2_subid_t in H5B2private.h when adding a new
+ * client class..
+ */
+extern const H5B2_class_t H5B2_TEST[1];
+extern const H5B2_class_t H5HF_BT2_INDIR[1];
+extern const H5B2_class_t H5HF_BT2_FILT_INDIR[1];
+extern const H5B2_class_t H5HF_BT2_DIR[1];
+extern const H5B2_class_t H5HF_BT2_FILT_DIR[1];
+extern const H5B2_class_t H5G_BT2_NAME[1];
+extern const H5B2_class_t H5G_BT2_CORDER[1];
+extern const H5B2_class_t H5SM_INDEX[1];
+extern const H5B2_class_t H5A_BT2_NAME[1];
+extern const H5B2_class_t H5A_BT2_CORDER[1];
+
+const H5B2_class_t *const H5B2_client_class_g[] = {
+ H5B2_TEST, /* 0 - H5B2_TEST_ID */
+ H5HF_BT2_INDIR, /* 1 - H5B2_FHEAP_HUGE_INDIR_ID */
+ H5HF_BT2_FILT_INDIR, /* 2 - H5B2_FHEAP_HUGE_FILT_INDIR_ID */
+ H5HF_BT2_DIR, /* 3 - H5B2_FHEAP_HUGE_DIR_ID */
+ H5HF_BT2_FILT_DIR, /* 4 - H5B2_FHEAP_HUGE_FILT_DIR_ID */
+ H5G_BT2_NAME, /* 5 - H5B2_GRP_DENSE_NAME_ID */
+ H5G_BT2_CORDER, /* 6 - H5B2_GRP_DENSE_CORDER_ID */
+ H5SM_INDEX, /* 7 - H5B2_SOHM_INDEX_ID */
+ H5A_BT2_NAME, /* 8 - H5B2_ATTR_DENSE_NAME_ID */
+ H5A_BT2_CORDER, /* 9 - H5B2_ATTR_DENSE_CORDER_ID */
+};
+
/*****************************/
/* Library Private Variables */
@@ -79,6 +106,10 @@ H5FL_DEFINE(H5B2_t);
/* Local Variables */
/*******************/
+/* Declare a free list to manage the H5B2_t struct */
+H5FL_DEFINE_STATIC(H5B2_t);
+
+
/*-------------------------------------------------------------------------
* Function: H5B2_create
@@ -94,63 +125,129 @@ H5FL_DEFINE(H5B2_t);
*
*-------------------------------------------------------------------------
*/
-herr_t
-H5B2_create(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
- size_t node_size, size_t rrec_size,
- unsigned split_percent, unsigned merge_percent, haddr_t *addr_p)
+H5B2_t *
+H5B2_create(H5F_t *f, hid_t dxpl_id, const H5B2_create_t *cparam)
{
- H5B2_t *bt2 = NULL; /* The new B-tree header information */
- herr_t ret_value = SUCCEED;
+ H5B2_t *bt2 = NULL; /* Pointer to the B-tree */
+ H5B2_hdr_t *hdr = NULL; /* Pointer to the B-tree header */
+ haddr_t hdr_addr; /* B-tree header address */
+ H5B2_t *ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5B2_create, FAIL)
+ FUNC_ENTER_NOAPI(H5B2_create, NULL)
/*
* Check arguments.
*/
HDassert(f);
- HDassert(type);
- HDassert(node_size > 0);
- HDassert(rrec_size > 0);
- HDassert(merge_percent > 0 && merge_percent <= 100);
- HDassert(split_percent > 0 && split_percent <= 100);
- HDassert(merge_percent < (split_percent / 2));
- HDassert(addr_p);
+ HDassert(cparam);
- /*
- * Allocate file and memory data structures.
- */
+ /* H5B2 interface sanity check */
+ HDcompile_assert(H5B2_NUM_BTREE_ID == NELMTS(H5B2_client_class_g));
+
+ /* Create shared v2 B-tree header */
+ if(HADDR_UNDEF == (hdr_addr = H5B2_hdr_create(f, dxpl_id, cparam)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, NULL, "can't create v2 B-tree header")
+
+ /* Create v2 B-tree wrapper */
if(NULL == (bt2 = H5FL_MALLOC(H5B2_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree header")
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for v2 B-tree info")
- /* Assign internal information */
- HDmemset(&bt2->cache_info, 0, sizeof(H5AC_info_t));
- bt2->root.addr = HADDR_UNDEF;
- bt2->root.node_nrec = 0;
- bt2->root.all_nrec = 0;
+ /* Look up the B-tree header */
+ if(NULL == (hdr = (H5B2_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, hdr_addr, NULL, NULL, H5AC_WRITE)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, NULL, "unable to load B-tree header")
+
+ /* Point v2 B-tree wrapper at header and bump it's ref count */
+ bt2->hdr = hdr;
+ if(H5B2_hdr_incr(bt2->hdr) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTINC, NULL, "can't increment reference count on shared v2 B-tree header")
- /* Initialize shared B-tree info */
- if(H5B2_shared_init(f, bt2, type, 0, node_size, rrec_size, split_percent, merge_percent) < 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't create shared B-tree info")
+ /* Increment # of files using this v2 B-tree header */
+ if(H5B2_hdr_fuse_incr(bt2->hdr) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTINC, NULL, "can't increment file reference count on shared v2 B-tree header")
- /* Allocate space for the header on disk */
- if(HADDR_UNDEF == (*addr_p = H5MF_alloc(f, H5FD_MEM_BTREE, dxpl_id, (hsize_t)H5B2_HEADER_SIZE(f))))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for B-tree header")
+ /* Set file pointer for this v2 B-tree open context */
+ bt2->f = f;
- /* Cache the new B-tree node */
- if(H5AC_set(f, dxpl_id, H5AC_BT2_HDR, *addr_p, bt2, H5AC__NO_FLAGS_SET) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "can't add B-tree header to cache")
+ /* Set the return value */
+ ret_value = bt2;
done:
- if(ret_value < 0) {
- if(bt2)
- (void)H5B2_cache_hdr_dest(f, bt2);
- } /* end if */
+ if(hdr && H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, hdr_addr, hdr, H5AC__NO_FLAGS_SET) < 0)
+ HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, NULL, "unable to release v2 B-tree header")
+ if(!ret_value && bt2)
+ if(H5B2_close(bt2, dxpl_id) < 0)
+ HDONE_ERROR(H5E_BTREE, H5E_CANTCLOSEOBJ, NULL, "unable to close v2 B-tree")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B2_create() */
/*-------------------------------------------------------------------------
+ * Function: H5B2_open
+ *
+ * Purpose: Opens an existing v2 B-tree in the file.
+ *
+ * Return: Pointer to v2 B-tree wrapper on success
+ * NULL on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Oct 15 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+H5B2_t *
+H5B2_open(H5F_t *f, hid_t dxpl_id, haddr_t addr)
+{
+ H5B2_t *bt2 = NULL; /* Pointer to the B-tree */
+ H5B2_hdr_t *hdr = NULL; /* Pointer to the B-tree header */
+ H5B2_t *ret_value; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5B2_open)
+
+ /* Check arguments. */
+ HDassert(f);
+ HDassert(H5F_addr_defined(addr));
+
+ /* Look up the B-tree header */
+ if(NULL == (hdr = (H5B2_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, NULL, NULL, H5AC_READ)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, NULL, "unable to load B-tree header")
+
+ /* Check for pending heap deletion */
+ if(hdr->pending_delete)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTOPENOBJ, NULL, "can't open v2 B-tree pending deletion")
+
+ /* Create v2 B-tree info */
+ if(NULL == (bt2 = H5FL_MALLOC(H5B2_t)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for v2 B-tree info")
+
+ /* Point v2 B-tree wrapper at header */
+ bt2->hdr = hdr;
+ if(H5B2_hdr_incr(bt2->hdr) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTINC, NULL, "can't increment reference count on shared v2 B-tree header")
+
+ /* Increment # of files using this v2 B-tree header */
+ if(H5B2_hdr_fuse_incr(bt2->hdr) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTINC, NULL, "can't increment file reference count on shared v2 B-tree header")
+
+ /* Set file pointer for this v2 B-tree open context */
+ bt2->f = f;
+
+ /* Set the return value */
+ ret_value = bt2;
+
+done:
+ if(hdr && H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, hdr, H5AC__NO_FLAGS_SET) < 0)
+ HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, NULL, "unable to release v2 B-tree header")
+ if(!ret_value && bt2)
+ if(H5B2_close(bt2, dxpl_id) < 0)
+ HDONE_ERROR(H5E_BTREE, H5E_CANTCLOSEOBJ, NULL, "unable to close v2 B-tree")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5B2_open() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5B2_insert
*
* Purpose: Adds a new record to the B-tree.
@@ -164,68 +261,87 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5B2_insert(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
- void *udata)
+H5B2_insert(H5B2_t *bt2, hid_t dxpl_id, void *udata)
{
- H5B2_t *bt2 = NULL; /* Pointer to the B-tree header */
- unsigned bt2_flags = H5AC__NO_FLAGS_SET; /* Metadata cache flags for B-tree header */
- H5B2_shared_t *shared; /* Pointer to B-tree's shared information */
- herr_t ret_value = SUCCEED;
+ H5B2_hdr_t *hdr; /* Pointer to the B-tree header */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5B2_insert, FAIL)
/* Check arguments. */
- HDassert(f);
- HDassert(type);
- HDassert(H5F_addr_defined(addr));
+ HDassert(bt2);
+ HDassert(udata);
- /* Look up the b-tree header */
- if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, type, NULL, H5AC_WRITE)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree header")
+ /* Set the shared v2 B-tree header's file context for this operation */
+ bt2->hdr->f = bt2->f;
- /* Get the pointer to the shared B-tree info */
- shared = (H5B2_shared_t *)H5RC_GET_OBJ(bt2->shared);
- HDassert(shared);
+ /* Get the v2 B-tree header */
+ hdr = bt2->hdr;
/* Check if the root node is allocated yet */
- if(!H5F_addr_defined(bt2->root.addr)) {
+ if(!H5F_addr_defined(hdr->root.addr)) {
/* Create root node as leaf node in B-tree */
- if(H5B2_create_leaf(f, dxpl_id, bt2->shared, &(bt2->root)) < 0)
+ if(H5B2_create_leaf(hdr, dxpl_id, &(hdr->root)) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to create root node")
-
- /* Mark B-tree header as dirty, since we updated the address of the root node */
- bt2_flags |= H5AC__DIRTIED_FLAG;
} /* end if */
/* Check if we need to split the root node (equiv. to a 1->2 node split) */
- else if(bt2->root.node_nrec == shared->node_info[shared->depth].split_nrec) {
+ else if(hdr->root.node_nrec == hdr->node_info[hdr->depth].split_nrec) {
/* Split root node */
- if(H5B2_split_root(f, dxpl_id, bt2, &bt2_flags) < 0)
+ if(H5B2_split_root(hdr, dxpl_id) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to split root node")
} /* end if */
/* Attempt to insert record into B-tree */
- if(shared->depth > 0) {
- if(H5B2_insert_internal(f, dxpl_id, bt2->shared, shared->depth, &bt2_flags, &bt2->root, udata) < 0)
+ if(hdr->depth > 0) {
+ if(H5B2_insert_internal(hdr, dxpl_id, hdr->depth, NULL, &hdr->root, udata) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into B-tree internal node")
} /* end if */
else {
- if(H5B2_insert_leaf(f, dxpl_id, bt2->shared, &bt2->root, udata) < 0)
+ if(H5B2_insert_leaf(hdr, dxpl_id, &hdr->root, udata) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into B-tree leaf node")
} /* end else */
- /* Mark parent node as dirty */
- bt2_flags |= H5AC__DIRTIED_FLAG;
+ /* Mark B-tree header as dirty */
+ if(H5B2_hdr_dirty(hdr) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTMARKDIRTY, FAIL, "unable to mark B-tree header dirty")
done:
- /* Release the B-tree header info */
- if(bt2 && H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, bt2, bt2_flags) < 0)
- HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree header info")
-
FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2_insert() */
/*-------------------------------------------------------------------------
+ * Function: H5B2_get_addr
+ *
+ * Purpose: Get the address of a v2 B-tree
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Nov 5 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5B2_get_addr(const H5B2_t *bt2, haddr_t *addr_p)
+{
+ FUNC_ENTER_NOAPI_NOFUNC(H5B2_get_addr)
+
+ /*
+ * Check arguments.
+ */
+ HDassert(bt2);
+ HDassert(addr_p);
+
+ /* Retrieve the header address for this v2 B-tree */
+ *addr_p = bt2->hdr->addr;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5B2_get_addr() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5B2_iterate
*
* Purpose: Iterate over all the records in the B-tree, in "in-order"
@@ -243,61 +359,30 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5B2_iterate(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
- H5B2_operator_t op, void *op_data)
+H5B2_iterate(H5B2_t *bt2, hid_t dxpl_id, H5B2_operator_t op, void *op_data)
{
- H5B2_t *bt2=NULL; /* Pointer to the B-tree header */
- H5B2_shared_t *shared; /* Pointer to B-tree's shared information */
- H5RC_t *bt2_shared=NULL; /* Pointer to ref-counter for shared B-tree info */
- hbool_t incr_rc=FALSE; /* Flag to indicate that we've incremented the B-tree's shared info reference count */
- H5B2_node_ptr_t root_ptr; /* Node pointer info for root node */
- unsigned depth; /* Current depth of the tree */
- herr_t ret_value = SUCCEED;
+ H5B2_hdr_t *hdr; /* Pointer to the B-tree header */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5B2_iterate, FAIL)
+ FUNC_ENTER_NOAPI_NOERR(H5B2_iterate, -)
/* Check arguments. */
- HDassert(f);
- HDassert(type);
- HDassert(H5F_addr_defined(addr));
+ HDassert(bt2);
HDassert(op);
- /* Look up the B-tree header */
- if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, type, NULL, H5AC_READ)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree header")
-
- /* Safely grab pointer to reference counted shared B-tree info, so we can release the B-tree header if necessary */
- bt2_shared = bt2->shared;
- H5RC_INC(bt2_shared);
- incr_rc = TRUE;
+ /* Set the shared v2 B-tree header's file context for this operation */
+ bt2->hdr->f = bt2->f;
- /* Get the pointer to the shared B-tree info */
- shared = (H5B2_shared_t *)H5RC_GET_OBJ(bt2->shared);
- HDassert(shared);
-
- /* Make copy of the root node pointer */
- root_ptr = bt2->root;
-
- /* Current depth of the tree */
- depth = shared->depth;
-
- /* Release header */
- if(H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, bt2, H5AC__NO_FLAGS_SET) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree header info")
- bt2 = NULL;
+ /* Get the v2 B-tree header */
+ hdr = bt2->hdr;
/* Iterate through records */
- if(root_ptr.node_nrec > 0) {
+ if(hdr->root.node_nrec > 0) {
/* Iterate through nodes */
- if((ret_value = H5B2_iterate_node(f, dxpl_id, bt2_shared, depth, &root_ptr, op, op_data)) < 0)
+ if((ret_value = H5B2_iterate_node(hdr, dxpl_id, hdr->depth, &hdr->root, op, op_data)) < 0)
HERROR(H5E_BTREE, H5E_CANTLIST, "node iteration failed");
} /* end if */
-done:
- /* Check if we need to decrement the reference count for the B-tree's shared info */
- if(incr_rc)
- H5RC_DEC(bt2_shared);
-
FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2_iterate() */
@@ -326,49 +411,32 @@ done:
*-------------------------------------------------------------------------
*/
htri_t
-H5B2_find(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
- void *udata, H5B2_found_t op, void *op_data)
+H5B2_find(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_found_t op,
+ void *op_data)
{
- H5B2_t *bt2 = NULL; /* Pointer to the B-tree header */
- H5RC_t *bt2_shared = NULL; /* Pointer to ref-counter for shared B-tree info */
- H5B2_shared_t *shared; /* Pointer to B-tree's shared information */
- hbool_t incr_rc = FALSE; /* Flag to indicate that we've incremented the B-tree's shared info reference count */
+ H5B2_hdr_t *hdr; /* Pointer to the B-tree header */
H5B2_node_ptr_t curr_node_ptr; /* Node pointer info for current node */
unsigned depth; /* Current depth of the tree */
int cmp; /* Comparison value of records */
unsigned idx; /* Location of record which matches key */
- htri_t ret_value = TRUE /* Return value */;
+ htri_t ret_value = TRUE; /* Return value */
FUNC_ENTER_NOAPI(H5B2_find, FAIL)
/* Check arguments. */
- HDassert(f);
- HDassert(type);
- HDassert(H5F_addr_defined(addr));
-
- /* Look up the B-tree header */
- if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, type, NULL, H5AC_READ)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree header")
+ HDassert(bt2);
- /* Safely grab pointer to reference counted shared B-tree info, so we can release the B-tree header if necessary */
- bt2_shared = bt2->shared;
- H5RC_INC(bt2_shared);
- incr_rc = TRUE;
+ /* Set the shared v2 B-tree header's file context for this operation */
+ bt2->hdr->f = bt2->f;
- /* Get the pointer to the shared B-tree info */
- shared = (H5B2_shared_t *)H5RC_GET_OBJ(bt2_shared);
- HDassert(shared);
+ /* Get the v2 B-tree header */
+ hdr = bt2->hdr;
/* Make copy of the root node pointer to start search with */
- curr_node_ptr = bt2->root;
+ curr_node_ptr = hdr->root;
/* Current depth of the tree */
- depth = shared->depth;
-
- /* Release header */
- if(H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, bt2, H5AC__NO_FLAGS_SET) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree header info")
- bt2 = NULL;
+ depth = hdr->depth;
/* Check for empty tree */
if(curr_node_ptr.node_nrec == 0)
@@ -381,11 +449,11 @@ H5B2_find(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
H5B2_node_ptr_t next_node_ptr; /* Node pointer info for next node */
/* Lock B-tree current node */
- if(NULL == (internal = H5B2_protect_internal(f, dxpl_id, bt2_shared, curr_node_ptr.addr, curr_node_ptr.node_nrec, depth, H5AC_READ)))
+ if(NULL == (internal = H5B2_protect_internal(hdr, dxpl_id, curr_node_ptr.addr, curr_node_ptr.node_nrec, depth, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
/* Locate node pointer for child */
- cmp = H5B2_locate_record(shared->type, internal->nrec, shared->nat_off, internal->int_native, udata, &idx);
+ cmp = H5B2_locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx);
if(cmp > 0)
idx++;
@@ -394,7 +462,7 @@ H5B2_find(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
next_node_ptr=internal->node_ptrs[idx];
/* Unlock current node */
- if(H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
/* Set pointer to next node to load */
@@ -402,16 +470,16 @@ H5B2_find(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
} /* end if */
else {
/* Make callback for current record */
- if(op && (op)(H5B2_INT_NREC(internal, shared, idx), op_data) < 0) {
+ if(op && (op)(H5B2_INT_NREC(internal, hdr, idx), op_data) < 0) {
/* Unlock current node */
- if(H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "'found' callback failed for B-tree find operation")
} /* end if */
/* Unlock current node */
- if(H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
/* Indicate record found */
@@ -426,15 +494,15 @@ H5B2_find(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
H5B2_leaf_t *leaf; /* Pointer to leaf node in B-tree */
/* Lock B-tree leaf node */
- if(NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, &(curr_node_ptr.node_nrec), bt2_shared, H5AC_READ)))
+ if(NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(hdr->f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, &(curr_node_ptr.node_nrec), hdr, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
/* Locate record */
- cmp = H5B2_locate_record(shared->type, leaf->nrec, shared->nat_off, leaf->leaf_native, udata, &idx);
+ cmp = H5B2_locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx);
if(cmp != 0) {
/* Unlock leaf node */
- if(H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
/* Record not found */
@@ -442,9 +510,9 @@ H5B2_find(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
} /* end if */
else {
/* Make callback for current record */
- if(op && (op)(H5B2_LEAF_NREC(leaf, shared, idx), op_data) < 0) {
+ if(op && (op)(H5B2_LEAF_NREC(leaf, hdr, idx), op_data) < 0) {
/* Unlock current node */
- if(H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "'found' callback failed for B-tree find operation")
@@ -452,15 +520,11 @@ H5B2_find(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
} /* end else */
/* Unlock current node */
- if(H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
} /* end block */
done:
- /* Check if we need to decrement the reference count for the B-tree's shared info */
- if(incr_rc)
- H5RC_DEC(bt2_shared);
-
FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2_find() */
@@ -484,48 +548,31 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5B2_index(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
- H5_iter_order_t order, hsize_t idx, H5B2_found_t op, void *op_data)
+H5B2_index(H5B2_t *bt2, hid_t dxpl_id, H5_iter_order_t order, hsize_t idx,
+ H5B2_found_t op, void *op_data)
{
- H5B2_t *bt2=NULL; /* Pointer to the B-tree header */
- H5RC_t *bt2_shared=NULL; /* Pointer to ref-counter for shared B-tree info */
- H5B2_shared_t *shared; /* Pointer to B-tree's shared information */
- hbool_t incr_rc=FALSE; /* Flag to indicate that we've incremented the B-tree's shared info reference count */
+ H5B2_hdr_t *hdr; /* Pointer to the B-tree header */
H5B2_node_ptr_t curr_node_ptr; /* Node pointer info for current node */
unsigned depth; /* Current depth of the tree */
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5B2_index, FAIL)
/* Check arguments. */
- HDassert(f);
- HDassert(type);
- HDassert(H5F_addr_defined(addr));
+ HDassert(bt2);
HDassert(op);
- /* Look up the B-tree header */
- if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, type, NULL, H5AC_READ)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree header")
-
- /* Safely grab pointer to reference counted shared B-tree info, so we can release the B-tree header if necessary */
- bt2_shared = bt2->shared;
- H5RC_INC(bt2_shared);
- incr_rc = TRUE;
+ /* Set the shared v2 B-tree header's file context for this operation */
+ bt2->hdr->f = bt2->f;
- /* Get the pointer to the shared B-tree info */
- shared = (H5B2_shared_t *)H5RC_GET_OBJ(bt2_shared);
- HDassert(shared);
+ /* Get the v2 B-tree header */
+ hdr = bt2->hdr;
/* Make copy of the root node pointer to start search with */
- curr_node_ptr = bt2->root;
+ curr_node_ptr = hdr->root;
/* Current depth of the tree */
- depth = shared->depth;
-
- /* Release header */
- if(H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, bt2, H5AC__NO_FLAGS_SET) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree header info")
- bt2 = NULL;
+ depth = hdr->depth;
/* Check for empty tree */
if(curr_node_ptr.node_nrec == 0)
@@ -546,7 +593,7 @@ H5B2_index(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
unsigned u; /* Local index variable */
/* Lock B-tree current node */
- if(NULL == (internal = H5B2_protect_internal(f, dxpl_id, bt2_shared, curr_node_ptr.addr, curr_node_ptr.node_nrec, depth, H5AC_READ)))
+ if(NULL == (internal = H5B2_protect_internal(hdr, dxpl_id, curr_node_ptr.addr, curr_node_ptr.node_nrec, depth, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
/* Search for record with correct index */
@@ -557,7 +604,7 @@ H5B2_index(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
next_node_ptr = internal->node_ptrs[u];
/* Unlock current node */
- if(H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
/* Set pointer to next node to load */
@@ -570,16 +617,16 @@ H5B2_index(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
/* Check if record is in this node */
if(internal->node_ptrs[u].all_nrec == idx) {
/* Make callback for current record */
- if((op)(H5B2_INT_NREC(internal, shared, u), op_data) < 0) {
+ if((op)(H5B2_INT_NREC(internal, hdr, u), op_data) < 0) {
/* Unlock current node */
- if(H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "'found' callback failed for B-tree find operation")
} /* end if */
/* Unlock current node */
- if(H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
HGOTO_DONE(SUCCEED);
@@ -599,7 +646,7 @@ H5B2_index(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
next_node_ptr = internal->node_ptrs[u];
/* Unlock current node */
- if(H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
/* Set pointer to next node to load */
@@ -618,31 +665,27 @@ H5B2_index(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
H5B2_leaf_t *leaf; /* Pointer to leaf node in B-tree */
/* Lock B-tree leaf node */
- if(NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, &(curr_node_ptr.node_nrec), bt2_shared, H5AC_READ)))
+ if(NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(hdr->f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, &(curr_node_ptr.node_nrec), hdr, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
/* Sanity check index */
HDassert(idx < leaf->nrec);
/* Make callback for correct record */
- if((op)(H5B2_LEAF_NREC(leaf, shared, idx), op_data) < 0) {
+ if((op)(H5B2_LEAF_NREC(leaf, hdr, idx), op_data) < 0) {
/* Unlock current node */
- if(H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "'found' callback failed for B-tree find operation")
} /* end if */
/* Unlock current node */
- if(H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
} /* end block */
done:
- /* Check if we need to decrement the reference count for the B-tree's shared info */
- if(incr_rc)
- H5RC_DEC(bt2_shared);
-
FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2_index() */
@@ -661,70 +704,61 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5B2_remove(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
- void *udata, H5B2_remove_t op, void *op_data)
+H5B2_remove(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_remove_t op,
+ void *op_data)
{
- H5B2_t *bt2 = NULL; /* Pointer to the B-tree header */
- unsigned bt2_flags = H5AC__NO_FLAGS_SET;
- H5B2_shared_t *shared; /* Pointer to B-tree's shared information */
- herr_t ret_value = SUCCEED;
+ H5B2_hdr_t *hdr; /* Pointer to the B-tree header */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5B2_remove, FAIL)
/* Check arguments. */
- HDassert(f);
- HDassert(type);
- HDassert(H5F_addr_defined(addr));
+ HDassert(bt2);
- /* Look up the b-tree header */
- if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, type, NULL, H5AC_WRITE)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree header")
+ /* Set the shared v2 B-tree header's file context for this operation */
+ bt2->hdr->f = bt2->f;
- /* Get the pointer to the shared B-tree info */
- shared = (H5B2_shared_t *)H5RC_GET_OBJ(bt2->shared);
- HDassert(shared);
+ /* Get the v2 B-tree header */
+ hdr = bt2->hdr;
/* Check for empty B-tree */
- if(bt2->root.all_nrec == 0)
+ if(0 == hdr->root.all_nrec)
HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "record is not in B-tree")
/* Attempt to remove record from B-tree */
- if(shared->depth > 0) {
+ if(hdr->depth > 0) {
hbool_t depth_decreased = FALSE; /* Flag to indicate whether the depth of the B-tree decreased */
- if(H5B2_remove_internal(f, dxpl_id, bt2->shared, &depth_decreased, NULL, shared->depth,
- &(bt2->cache_info), &bt2_flags, &bt2->root, udata, op, op_data) < 0)
+ if(H5B2_remove_internal(hdr, dxpl_id, &depth_decreased, NULL, hdr->depth,
+ &(hdr->cache_info), NULL, &hdr->root, udata, op, op_data) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to remove record from B-tree internal node")
/* Check for decreasing the depth of the B-tree */
if(depth_decreased) {
/* Destroy free list factories for previous depth */
- if(shared->node_info[shared->depth].nat_rec_fac)
- if(H5FL_fac_term(shared->node_info[shared->depth].nat_rec_fac) < 0)
+ if(hdr->node_info[hdr->depth].nat_rec_fac)
+ if(H5FL_fac_term(hdr->node_info[hdr->depth].nat_rec_fac) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't destroy node's native record block factory")
- if(shared->node_info[shared->depth].node_ptr_fac)
- if(H5FL_fac_term(shared->node_info[shared->depth].node_ptr_fac) < 0)
+ if(hdr->node_info[hdr->depth].node_ptr_fac)
+ if(H5FL_fac_term(hdr->node_info[hdr->depth].node_ptr_fac) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't destroy node's node pointer block factory")
- shared->depth -= depth_decreased;
+ hdr->depth -= (uint16_t)depth_decreased;
} /* end for */
} /* end if */
else {
- if(H5B2_remove_leaf(f, dxpl_id, bt2->shared, &bt2->root, udata, op, op_data) < 0)
+ if(H5B2_remove_leaf(hdr, dxpl_id, &hdr->root, udata, op, op_data) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to remove record from B-tree leaf node")
} /* end else */
/* Decrement # of records in B-tree */
- bt2->root.all_nrec--;
+ hdr->root.all_nrec--;
- /* Mark parent node as dirty */
- bt2_flags |= H5AC__DIRTIED_FLAG;
+ /* Mark B-tree header as dirty */
+ if(H5B2_hdr_dirty(hdr) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTMARKDIRTY, FAIL, "unable to mark B-tree header dirty")
done:
- /* Release the B-tree header info */
- if (bt2 && H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, bt2, bt2_flags) < 0)
- HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree header info")
-
FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2_remove() */
@@ -743,79 +777,69 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5B2_remove_by_idx(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
- haddr_t addr, H5_iter_order_t order, hsize_t idx, H5B2_remove_t op,
- void *op_data)
+H5B2_remove_by_idx(H5B2_t *bt2, hid_t dxpl_id, H5_iter_order_t order,
+ hsize_t idx, H5B2_remove_t op, void *op_data)
{
- H5B2_t *bt2 = NULL; /* Pointer to the B-tree header */
- unsigned bt2_flags = H5AC__NO_FLAGS_SET;
- H5B2_shared_t *shared; /* Pointer to B-tree's shared information */
- herr_t ret_value = SUCCEED;
+ H5B2_hdr_t *hdr; /* Pointer to the B-tree header */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5B2_remove_by_idx, FAIL)
/* Check arguments. */
- HDassert(f);
- HDassert(type);
- HDassert(H5F_addr_defined(addr));
+ HDassert(bt2);
- /* Look up the b-tree header */
- if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, type, NULL, H5AC_WRITE)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree header")
+ /* Set the shared v2 B-tree header's file context for this operation */
+ bt2->hdr->f = bt2->f;
- /* Get the pointer to the shared B-tree info */
- shared = (H5B2_shared_t *)H5RC_GET_OBJ(bt2->shared);
- HDassert(shared);
+ /* Get the v2 B-tree header */
+ hdr = bt2->hdr;
/* Check for empty B-tree */
- if(bt2->root.all_nrec == 0)
+ if(0 == hdr->root.all_nrec)
HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "record is not in B-tree")
/* Check for index greater than the number of records in the tree */
- if(idx >= bt2->root.all_nrec)
+ if(idx >= hdr->root.all_nrec)
HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "B-tree doesn't have that many records")
/* Check for reverse indexing and map requested index to appropriate forward index */
- if(order == H5_ITER_DEC)
- idx = bt2->root.all_nrec - (idx + 1);
+ if(H5_ITER_DEC == order)
+ idx = hdr->root.all_nrec - (idx + 1);
/* Attempt to remove record from B-tree */
- if(shared->depth > 0) {
+ if(hdr->depth > 0) {
hbool_t depth_decreased = FALSE; /* Flag to indicate whether the depth of the B-tree decreased */
- if(H5B2_remove_internal_by_idx(f, dxpl_id, bt2->shared, &depth_decreased, NULL, shared->depth,
- &(bt2->cache_info), &bt2_flags, &bt2->root, idx, op, op_data) < 0)
+ if(H5B2_remove_internal_by_idx(hdr, dxpl_id, &depth_decreased, NULL, hdr->depth,
+ &(hdr->cache_info), NULL, &hdr->root, idx, op, op_data) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to remove record from B-tree internal node")
/* Check for decreasing the depth of the B-tree */
if(depth_decreased) {
/* Destroy free list factories for previous depth */
- if(shared->node_info[shared->depth].nat_rec_fac)
- if(H5FL_fac_term(shared->node_info[shared->depth].nat_rec_fac) < 0)
+ if(hdr->node_info[hdr->depth].nat_rec_fac)
+ if(H5FL_fac_term(hdr->node_info[hdr->depth].nat_rec_fac) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't destroy node's native record block factory")
- if(shared->node_info[shared->depth].node_ptr_fac)
- if(H5FL_fac_term(shared->node_info[shared->depth].node_ptr_fac) < 0)
+ if(hdr->node_info[hdr->depth].node_ptr_fac)
+ if(H5FL_fac_term(hdr->node_info[hdr->depth].node_ptr_fac) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't destroy node's node pointer block factory")
- shared->depth -= depth_decreased;
+ hdr->depth -= (uint16_t)depth_decreased;
} /* end for */
} /* end if */
else {
- if(H5B2_remove_leaf_by_idx(f, dxpl_id, bt2->shared, &bt2->root, (unsigned)idx, op, op_data) < 0)
+ if(H5B2_remove_leaf_by_idx(hdr, dxpl_id, &hdr->root, (unsigned)idx, op, op_data) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to remove record from B-tree leaf node")
} /* end else */
/* Decrement # of records in B-tree */
- bt2->root.all_nrec--;
+ hdr->root.all_nrec--;
- /* Mark parent node as dirty */
- bt2_flags |= H5AC__DIRTIED_FLAG;
+ /* Mark B-tree header as dirty */
+ if(H5B2_hdr_dirty(hdr) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTMARKDIRTY, FAIL, "unable to mark B-tree header dirty")
done:
- /* Release the B-tree header info */
- if (bt2 && H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, bt2, bt2_flags) < 0)
- HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree header info")
-
FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2_remove_by_idx() */
@@ -834,33 +858,18 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5B2_get_nrec(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
- hsize_t *nrec)
+H5B2_get_nrec(const H5B2_t *bt2, hsize_t *nrec)
{
- H5B2_t *bt2=NULL; /* Pointer to the B-tree header */
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI(H5B2_get_nrec, FAIL)
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5B2_get_nrec)
/* Check arguments. */
- HDassert(f);
- HDassert(type);
- HDassert(H5F_addr_defined(addr));
+ HDassert(bt2);
HDassert(nrec);
- /* Look up the B-tree header */
- if (NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, type, NULL, H5AC_READ)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree header")
-
/* Get B-tree number of records */
- *nrec = bt2->root.all_nrec;
-
-done:
- /* Release B-tree header node */
- if (bt2 && H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, bt2, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree header info")
+ *nrec = bt2->hdr->root.all_nrec;
- FUNC_LEAVE_NOAPI(ret_value)
+ FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5B2_get_nrec() */
@@ -890,112 +899,44 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5B2_neighbor(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
- H5B2_compare_t range, void *udata, H5B2_found_t op, void *op_data)
+H5B2_neighbor(H5B2_t *bt2, hid_t dxpl_id, H5B2_compare_t range, void *udata,
+ H5B2_found_t op, void *op_data)
{
- H5B2_t *bt2 = NULL; /* Pointer to the B-tree header */
- H5B2_shared_t *shared; /* Pointer to B-tree's shared information */
- herr_t ret_value = SUCCEED;
+ H5B2_hdr_t *hdr; /* Pointer to the B-tree header */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5B2_neighbor, FAIL)
/* Check arguments. */
- HDassert(f);
- HDassert(type);
- HDassert(H5F_addr_defined(addr));
+ HDassert(bt2);
HDassert(op);
- /* Look up the B-tree header */
- if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, type, NULL, H5AC_READ)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree header")
+ /* Set the shared v2 B-tree header's file context for this operation */
+ bt2->hdr->f = bt2->f;
- /* Get the pointer to the shared B-tree info */
- shared = (H5B2_shared_t *)H5RC_GET_OBJ(bt2->shared);
- HDassert(shared);
+ /* Get the v2 B-tree header */
+ hdr = bt2->hdr;
/* Check for empty tree */
- if(!H5F_addr_defined(bt2->root.addr))
+ if(!H5F_addr_defined(hdr->root.addr))
HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "B-tree has no records")
/* Attempt to find neighbor record in B-tree */
- if(shared->depth > 0) {
- if(H5B2_neighbor_internal(f, dxpl_id, bt2->shared, shared->depth, &bt2->root, NULL, range, udata, op, op_data)<0)
+ if(hdr->depth > 0) {
+ if(H5B2_neighbor_internal(hdr, dxpl_id, hdr->depth, &hdr->root, NULL, range, udata, op, op_data) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "unable to find neighbor record in B-tree internal node")
} /* end if */
else {
- if(H5B2_neighbor_leaf(f, dxpl_id, bt2->shared, &bt2->root, NULL, range, udata, op, op_data)<0)
+ if(H5B2_neighbor_leaf(hdr, dxpl_id, &hdr->root, NULL, range, udata, op, op_data) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "unable to find neighbor record in B-tree leaf node")
} /* end else */
done:
- /* Release the B-tree header info */
- if (bt2 && H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, bt2, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree header info")
-
FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2_neighbor() */
/*-------------------------------------------------------------------------
- * Function: H5B2_delete
- *
- * Purpose: Delete an entire B-tree from a file.
- *
- * The 'OP' routine is called for each record and the
- * OP_DATA pointer, to allow caller to perform an operation as
- * each record is removed from the B-tree.
- *
- * If 'OP' is NULL, the records are just removed in the process
- * of deleting the B-tree.
- *
- * Note: The records are _not_ guaranteed to be visited in order.
- *
- * Return: Non-negative on success, negative on failure.
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Mar 9 2005
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5B2_delete(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
- H5B2_remove_t op, void *op_data)
-{
- H5B2_t *bt2 = NULL; /* Pointer to the B-tree header */
- H5B2_shared_t *shared; /* Pointer to B-tree's shared information */
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI(H5B2_delete, FAIL)
-
- /* Check arguments. */
- HDassert(f);
- HDassert(type);
- HDassert(H5F_addr_defined(addr));
-
- /* Look up the B-tree header */
- if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, type, NULL, H5AC_WRITE)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree header")
-
- /* Get the pointer to the shared B-tree info */
- shared = (H5B2_shared_t *)H5RC_GET_OBJ(bt2->shared);
- HDassert(shared);
-
- /* Delete all nodes in B-tree */
- if(H5F_addr_defined(bt2->root.addr))
- if(H5B2_delete_node(f, dxpl_id, bt2->shared, shared->depth, &bt2->root, op, op_data) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to delete B-tree nodes")
-
-done:
- /* Release the B-tree header info */
- if(bt2 && H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, bt2, H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG) < 0)
- HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to delete B-tree header info")
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5B2_delete() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5B2_modify
*
* Purpose: Locate the specified information in a B-tree and modify it.
@@ -1016,53 +957,36 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5B2_modify(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
- void *udata, H5B2_modify_t op, void *op_data)
+H5B2_modify(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_modify_t op,
+ void *op_data)
{
- H5B2_t *bt2=NULL; /* Pointer to the B-tree header */
- H5RC_t *bt2_shared=NULL; /* Pointer to ref-counter for shared B-tree info */
- H5B2_shared_t *shared; /* Pointer to B-tree's shared information */
- hbool_t incr_rc=FALSE; /* Flag to indicate that we've incremented the B-tree's shared info reference count */
+ H5B2_hdr_t *hdr; /* Pointer to the B-tree header */
H5B2_node_ptr_t curr_node_ptr; /* Node pointer info for current node */
unsigned depth; /* Current depth of the tree */
int cmp; /* Comparison value of records */
unsigned idx; /* Location of record which matches key */
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5B2_modify, FAIL)
/* Check arguments. */
- HDassert(f);
- HDassert(type);
- HDassert(H5F_addr_defined(addr));
+ HDassert(bt2);
HDassert(op);
- /* Look up the B-tree header */
- if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, type, NULL, H5AC_READ)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree header")
-
- /* Safely grab pointer to reference counted shared B-tree info, so we can release the B-tree header if necessary */
- bt2_shared = bt2->shared;
- H5RC_INC(bt2_shared);
- incr_rc = TRUE;
+ /* Set the shared v2 B-tree header's file context for this operation */
+ bt2->hdr->f = bt2->f;
- /* Get the pointer to the shared B-tree info */
- shared=(H5B2_shared_t *)H5RC_GET_OBJ(bt2_shared);
- HDassert(shared);
+ /* Get the v2 B-tree header */
+ hdr = bt2->hdr;
/* Make copy of the root node pointer to start search with */
- curr_node_ptr = bt2->root;
+ curr_node_ptr = hdr->root;
/* Current depth of the tree */
- depth = shared->depth;
-
- /* Release header */
- if(H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, bt2, H5AC__NO_FLAGS_SET) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree header info")
- bt2 = NULL;
+ depth = hdr->depth;
/* Check for empty tree */
- if(curr_node_ptr.node_nrec==0)
+ if(0 == curr_node_ptr.node_nrec)
HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "B-tree has no records")
/* Walk down B-tree to find record or leaf node where record is located */
@@ -1073,20 +997,20 @@ H5B2_modify(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
H5B2_node_ptr_t next_node_ptr; /* Node pointer info for next node */
/* Lock B-tree current node */
- if(NULL == (internal = H5B2_protect_internal(f, dxpl_id, bt2_shared, curr_node_ptr.addr, curr_node_ptr.node_nrec, depth, H5AC_WRITE)))
+ if(NULL == (internal = H5B2_protect_internal(hdr, dxpl_id, curr_node_ptr.addr, curr_node_ptr.node_nrec, depth, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
/* Locate node pointer for child */
- cmp = H5B2_locate_record(shared->type, internal->nrec, shared->nat_off, internal->int_native, udata, &idx);
+ cmp = H5B2_locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx);
if(cmp > 0)
idx++;
if(cmp != 0) {
/* Get node pointer for next node to search */
- next_node_ptr=internal->node_ptrs[idx];
+ next_node_ptr = internal->node_ptrs[idx];
/* Unlock current node */
- if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
/* Set pointer to next node to load */
@@ -1096,12 +1020,12 @@ H5B2_modify(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
hbool_t changed; /* Whether the 'modify' callback changed the record */
/* Make callback for current record */
- if ( (op)(H5B2_INT_NREC(internal,shared,idx), op_data, &changed) <0) {
+ if((op)(H5B2_INT_NREC(internal, hdr, idx), op_data, &changed) < 0) {
/* Make certain that the callback didn't modify the value if it failed */
- HDassert(changed==FALSE);
+ HDassert(changed == FALSE);
/* Unlock current node */
- if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
HGOTO_ERROR(H5E_BTREE, H5E_CANTMODIFY, FAIL, "'modify' callback failed for B-tree find operation")
@@ -1111,7 +1035,7 @@ H5B2_modify(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
internal_flags |= changed ? H5AC__DIRTIED_FLAG : 0;
/* Unlock current node */
- if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, internal_flags) < 0)
+ if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, internal_flags) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
HGOTO_DONE(SUCCEED);
@@ -1127,15 +1051,15 @@ H5B2_modify(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
hbool_t changed = FALSE;/* Whether the 'modify' callback changed the record */
/* Lock B-tree leaf node */
- if (NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, &(curr_node_ptr.node_nrec), bt2_shared, H5AC_WRITE)))
+ if(NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(hdr->f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, &(curr_node_ptr.node_nrec), hdr, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
/* Locate record */
- cmp = H5B2_locate_record(shared->type, leaf->nrec, shared->nat_off, leaf->leaf_native, udata, &idx);
+ cmp = H5B2_locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx);
if(cmp != 0) {
/* Unlock leaf node */
- if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
/* Note: don't push error on stack, leave that to next higher level,
@@ -1150,12 +1074,12 @@ H5B2_modify(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
} /* end if */
else {
/* Make callback for current record */
- if ((op)(H5B2_LEAF_NREC(leaf,shared,idx), op_data, &changed) <0) {
+ if((op)(H5B2_LEAF_NREC(leaf, hdr, idx), op_data, &changed) < 0) {
/* Make certain that the callback didn't modify the value if it failed */
- HDassert(changed==FALSE);
+ HDassert(changed == FALSE);
/* Unlock current node */
- if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
HGOTO_ERROR(H5E_BTREE, H5E_CANTMODIFY, FAIL, "'modify' callback failed for B-tree find operation")
@@ -1166,94 +1090,155 @@ H5B2_modify(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
leaf_flags |= (changed ? H5AC__DIRTIED_FLAG : 0);
/* Unlock current node */
- if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, leaf_flags) < 0)
+ if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, leaf_flags) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
}
done:
- /* Check if we need to decrement the reference count for the B-tree's shared info */
- if(incr_rc)
- H5RC_DEC(bt2_shared);
-
FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2_modify() */
/*-------------------------------------------------------------------------
- * Function: H5B2_iterate_size
+ * Function: H5B2_close
*
- * Purpose: Iterate over all the records in the B-tree, collecting
- * storage info.
+ * Purpose: Close a v2 B-tree
*
- * Return: non-negative on success, negative on error
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Vailin Choi
- * June 19 2007
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Oct 15 2009
*
*-------------------------------------------------------------------------
*/
herr_t
-H5B2_iterate_size(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr, hsize_t *btree_size)
+H5B2_close(H5B2_t *bt2, hid_t dxpl_id)
{
- H5B2_t *bt2 = NULL; /* Pointer to the B-tree header */
- H5B2_shared_t *shared; /* Pointer to B-tree's shared information */
- H5RC_t *bt2_shared = NULL; /* Pointer to ref-counter for shared B-tree info */
- hbool_t incr_rc = FALSE; /* Flag to indicate that we've incremented the B-tree's shared info reference count */
- H5B2_node_ptr_t root_ptr; /* Node pointer info for root node */
- unsigned depth; /* Current depth of the tree */
- herr_t ret_value = SUCCEED;
+ haddr_t bt2_addr = HADDR_UNDEF; /* Address of v2 B-tree (for deletion) */
+ hbool_t pending_delete = FALSE; /* Whether the v2 B-tree is pending deletion */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5B2_iterate_size, FAIL)
+ FUNC_ENTER_NOAPI_NOINIT(H5B2_close)
/* Check arguments. */
- HDassert(f);
- HDassert(type);
- HDassert(H5F_addr_defined(addr));
- HDassert(btree_size);
+ HDassert(bt2);
+ HDassert(bt2->f);
+
+ /* Decrement file reference & check if this is the last open v2 B-tree using the shared B-tree header */
+ if(0 == H5B2_hdr_fuse_decr(bt2->hdr)) {
+ /* Set the shared v2 B-tree header's file context for this operation */
+ bt2->hdr->f = bt2->f;
+
+ /* Check for pending B-tree deletion */
+ if(bt2->hdr->pending_delete) {
+ /* Set local info, so B-tree deletion can occur after decrementing the
+ * header's ref count
+ */
+ pending_delete = TRUE;
+ bt2_addr = bt2->hdr->addr;
+ } /* end if */
+ } /* end if */
- /* Look up the B-tree header */
- if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, type, NULL, H5AC_READ)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree header")
+ /* Decrement the reference count on the B-tree header */
+ /* (don't put in H5B2_hdr_fuse_decr() as the B-tree header may be evicted
+ * immediately -QAK)
+ */
+ if(H5B2_hdr_decr(bt2->hdr) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTDEC, FAIL, "can't decrement reference count on shared v2 B-tree header")
- /* Safely grab pointer to reference counted shared B-tree info, so we can release the B-tree header if necessary */
- bt2_shared = bt2->shared;
- H5RC_INC(bt2_shared);
- incr_rc = TRUE;
+ /* Check for pending v2 B-tree deletion */
+ if(pending_delete) {
+ H5B2_hdr_t *hdr; /* Another pointer to v2 B-tree header */
- /* Get the pointer to the shared B-tree info */
- shared = (H5B2_shared_t *)H5RC_GET_OBJ(bt2->shared);
- HDassert(shared);
+ /* Sanity check */
+ HDassert(H5F_addr_defined(bt2_addr));
- /* Add size of header to B-tree metadata total */
- *btree_size += H5B2_HEADER_SIZE(f);
+ /* Lock the v2 B-tree header into memory */
+ if(NULL == (hdr = (H5B2_hdr_t *)H5AC_protect(bt2->f, dxpl_id, H5AC_BT2_HDR, bt2_addr, NULL, NULL, H5AC_WRITE)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load v2 B-tree header")
- /* Make copy of the root node pointer */
- root_ptr = bt2->root;
+ /* Set the shared v2 B-tree header's file context for this operation */
+ hdr->f = bt2->f;
- /* Current depth of the tree */
- depth = shared->depth;
+ /* Delete v2 B-tree, starting with header (unprotects header) */
+ if(H5B2_hdr_delete(hdr, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to delete v2 B-tree")
+ } /* end if */
- /* Release header */
- if(H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, bt2, H5AC__NO_FLAGS_SET) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree header info")
- bt2 = NULL;
+ /* Release the v2 B-tree wrapper */
+ bt2 = H5FL_FREE(H5B2_t, bt2);
- /* Iterate through records */
- if(root_ptr.node_nrec > 0) {
- /* Check for root node being a leaf */
- if(depth == 0)
- *btree_size += shared->node_size;
- else
- /* Iterate through nodes */
- if(H5B2_iterate_size_node(f, dxpl_id, bt2_shared, depth, &root_ptr, btree_size) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTLIST, FAIL, "node iteration failed");
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5B2_close() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5B2_delete
+ *
+ * Purpose: Delete an entire B-tree from a file.
+ *
+ * The 'OP' routine is called for each record and the
+ * OP_DATA pointer, to allow caller to perform an operation as
+ * each record is removed from the B-tree.
+ *
+ * If 'OP' is NULL, the records are just removed in the process
+ * of deleting the B-tree.
+ *
+ * Note: The records are _not_ guaranteed to be visited in order.
+ *
+ * Return: Non-negative on success, negative on failure.
+ *
+ * Programmer: Quincey Koziol
+ * koziol@ncsa.uiuc.edu
+ * Mar 9 2005
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5B2_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr, H5B2_remove_t op,
+ void *op_data)
+{
+ H5B2_hdr_t *hdr = NULL; /* Pointer to the B-tree header */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5B2_delete, FAIL)
+
+ /* Check arguments. */
+ HDassert(f);
+ HDassert(H5F_addr_defined(addr));
+
+ /* Lock the v2 B-tree header into memory */
+#ifdef QAK
+HDfprintf(stderr, "%s: addr = %a\n", FUNC, addr);
+#endif /* QAK */
+ if(NULL == (hdr = (H5B2_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, NULL, NULL, H5AC_WRITE)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load v2 B-tree header")
+
+ /* Remember the callback & context for later */
+ hdr->remove_op = op;
+ hdr->remove_op_data = op_data;
+
+ /* Check for files using shared v2 B-tree header */
+ if(hdr->file_rc)
+ hdr->pending_delete = TRUE;
+ else {
+ /* Set the shared v2 B-tree header's file context for this operation */
+ hdr->f = f;
+
+ /* Delete v2 B-tree now, starting with header (unprotects header) */
+ if(H5B2_hdr_delete(hdr, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to delete v2 B-tree")
+ hdr = NULL;
} /* end if */
done:
- /* Check if we need to decrement the reference count for the B-tree's shared info */
- if(incr_rc)
- H5RC_DEC(bt2_shared);
+ /* Unprotect the header, if an error occurred */
+ if(hdr && H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, hdr, H5AC__NO_FLAGS_SET) < 0)
+ HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release v2 B-tree header")
+
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5B2_iterate_size() */
+} /* H5B2_delete() */
diff --git a/src/H5B2cache.c b/src/H5B2cache.c
index 5ca7ed8..6737076 100644
--- a/src/H5B2cache.c
+++ b/src/H5B2cache.c
@@ -69,15 +69,15 @@
/********************/
/* Metadata cache callbacks */
-static H5B2_t *H5B2_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, void *udata);
-static herr_t H5B2_cache_hdr_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5B2_t *b, unsigned UNUSED * flags_ptr);
-static herr_t H5B2_cache_hdr_clear(H5F_t *f, H5B2_t *b, hbool_t destroy);
-static herr_t H5B2_cache_hdr_size(const H5F_t *f, const H5B2_t *bt, size_t *size_ptr);
-static H5B2_internal_t *H5B2_cache_internal_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_nrec, void *_shared);
+static H5B2_hdr_t *H5B2_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, void *udata);
+static herr_t H5B2_cache_hdr_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5B2_hdr_t *hdr, unsigned UNUSED * flags_ptr);
+static herr_t H5B2_cache_hdr_clear(H5F_t *f, H5B2_hdr_t *hdr, hbool_t destroy);
+static herr_t H5B2_cache_hdr_size(const H5F_t *f, const H5B2_hdr_t *hdr, size_t *size_ptr);
+static H5B2_internal_t *H5B2_cache_internal_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_nrec, void *udata2);
static herr_t H5B2_cache_internal_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5B2_internal_t *i, unsigned UNUSED * flags_ptr);
static herr_t H5B2_cache_internal_clear(H5F_t *f, H5B2_internal_t *i, hbool_t destroy);
static herr_t H5B2_cache_internal_size(const H5F_t *f, const H5B2_internal_t *i, size_t *size_ptr);
-static H5B2_leaf_t *H5B2_cache_leaf_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_nrec, void *_shared);
+static H5B2_leaf_t *H5B2_cache_leaf_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_nrec, void *_hdr);
static herr_t H5B2_cache_leaf_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5B2_leaf_t *l, unsigned UNUSED * flags_ptr);
static herr_t H5B2_cache_leaf_clear(H5F_t *f, H5B2_leaf_t *l, hbool_t destroy);
static herr_t H5B2_cache_leaf_size(const H5F_t *f, const H5B2_leaf_t *l, size_t *size_ptr);
@@ -138,7 +138,6 @@ const H5AC_class_t H5AC_BT2_LEAF[1] = {{
* Purpose: Loads a B-tree header from the disk.
*
* Return: Success: Pointer to a new B-tree.
- *
* Failure: NULL
*
* Programmer: Quincey Koziol
@@ -147,52 +146,49 @@ const H5AC_class_t H5AC_BT2_LEAF[1] = {{
*
*-------------------------------------------------------------------------
*/
-static H5B2_t *
-H5B2_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, void UNUSED *udata)
+static H5B2_hdr_t *
+H5B2_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *udata1, void UNUSED *udata2)
{
- const H5B2_class_t *type = (const H5B2_class_t *) _type; /* Type of B-tree */
- unsigned depth; /* Depth of B-tree */
- size_t node_size, rrec_size; /* Size info for B-tree */
- uint8_t split_percent, merge_percent; /* Split & merge %s for B-tree */
- H5B2_t *bt2 = NULL; /* B-tree info */
+ H5B2_create_t cparam; /* B-tree creation parameters */
+ H5B2_subid_t id; /* ID of B-tree class, as found in file */
+ uint16_t depth; /* Depth of B-tree */
+ H5B2_hdr_t *hdr = NULL; /* B-tree header */
size_t size; /* Header size */
uint32_t stored_chksum; /* Stored metadata checksum value */
uint32_t computed_chksum; /* Computed metadata checksum value */
H5WB_t *wb = NULL; /* Wrapped buffer for header data */
uint8_t hdr_buf[H5B2_HDR_BUF_SIZE]; /* Buffer for header */
- uint8_t *hdr; /* Pointer to header buffer */
+ uint8_t *buf; /* Pointer to header buffer */
uint8_t *p; /* Pointer into raw data buffer */
- H5B2_t *ret_value; /* Return value */
+ H5B2_hdr_t *ret_value; /* Return value */
FUNC_ENTER_NOAPI(H5B2_cache_hdr_load, NULL)
/* Check arguments */
HDassert(f);
HDassert(H5F_addr_defined(addr));
- HDassert(type);
- /* Allocate space for the B-tree data structure */
- if(NULL == (bt2 = H5FL_MALLOC(H5B2_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- HDmemset(&bt2->cache_info, 0, sizeof(H5AC_info_t));
+ /* Allocate new B-tree header and reset cache info */
+ if(NULL == (hdr = H5B2_hdr_alloc(f)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "allocation failed for B-tree header")
/* Wrap the local buffer for serialized header info */
if(NULL == (wb = H5WB_wrap(hdr_buf, sizeof(hdr_buf))))
HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, NULL, "can't wrap buffer")
/* Compute the size of the serialized B-tree header on disk */
- size = H5B2_HEADER_SIZE(f);
+ size = H5B2_HEADER_SIZE(hdr);
/* Get a pointer to a buffer that's large enough for header */
- if(NULL == (hdr = (uint8_t *)H5WB_actual(wb, size)))
+ if(NULL == (buf = (uint8_t *)H5WB_actual(wb, size)))
HGOTO_ERROR(H5E_BTREE, H5E_NOSPACE, NULL, "can't get actual buffer")
/* Read header from disk */
- if(H5F_block_read(f, H5FD_MEM_BTREE, addr, size, dxpl_id, hdr) < 0)
+ if(H5F_block_read(f, H5FD_MEM_BTREE, addr, size, dxpl_id, buf) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_READERROR, NULL, "can't read B-tree header")
/* Get temporary pointer to serialized header */
- p = hdr;
+ p = buf;
/* Magic number */
if(HDmemcmp(p, H5B2_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC))
@@ -203,54 +199,60 @@ H5B2_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, vo
if(*p++ != H5B2_HDR_VERSION)
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, NULL, "wrong B-tree header version")
- /* B-tree type */
- if(*p++ != (uint8_t)type->id)
- HGOTO_ERROR(H5E_BTREE, H5E_BADTYPE, NULL, "incorrect B-tree type")
+ /* B-tree class */
+ id = *p++;
+ if(id >= H5B2_NUM_BTREE_ID)
+ HGOTO_ERROR(H5E_BTREE, H5E_BADTYPE, NULL, "invalid B-tree type")
/* Node size (in bytes) */
- UINT32DECODE(p, node_size);
+ UINT32DECODE(p, cparam.node_size);
/* Raw key size (in bytes) */
- UINT16DECODE(p, rrec_size);
+ UINT16DECODE(p, cparam.rrec_size);
/* Depth of tree */
UINT16DECODE(p, depth);
/* Split & merge %s */
- split_percent = *p++;
- merge_percent = *p++;
+ cparam.split_percent = *p++;
+ cparam.merge_percent = *p++;
/* Root node pointer */
- H5F_addr_decode(f, (const uint8_t **)&p, &(bt2->root.addr));
- UINT16DECODE(p, bt2->root.node_nrec);
- H5F_DECODE_LENGTH(f, p, bt2->root.all_nrec);
+ H5F_addr_decode(f, (const uint8_t **)&p, &(hdr->root.addr));
+ UINT16DECODE(p, hdr->root.node_nrec);
+ H5F_DECODE_LENGTH(f, p, hdr->root.all_nrec);
/* Metadata checksum */
UINT32DECODE(p, stored_chksum);
/* Sanity check */
- HDassert((size_t)(p - hdr) == size);
+ HDassert((size_t)(p - buf) == size);
/* Compute checksum on entire header */
- computed_chksum = H5_checksum_metadata(hdr, (size - H5B2_SIZEOF_CHKSUM), 0);
+ computed_chksum = H5_checksum_metadata(buf, (size - H5B2_SIZEOF_CHKSUM), 0);
/* Verify checksum */
if(stored_chksum != computed_chksum)
HGOTO_ERROR(H5E_BTREE, H5E_BADVALUE, NULL, "incorrect metadata checksum for v2 B-tree header")
- /* Initialize shared B-tree info */
- if(H5B2_shared_init(f, bt2, type, depth, node_size, rrec_size, split_percent, merge_percent) < 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't create shared B-tree info")
+ /* Initialize B-tree header info */
+ cparam.cls = H5B2_client_class_g[id];
+ if(H5B2_hdr_init(f, hdr, &cparam, depth) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, NULL, "can't initialize B-tree header info")
+
+ /* Set the B-tree header's address */
+ hdr->addr = addr;
/* Set return value */
- ret_value = bt2;
+ ret_value = hdr;
done:
/* Release resources */
if(wb && H5WB_unwrap(wb) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CLOSEERROR, NULL, "can't close wrapped buffer")
- if(!ret_value && bt2)
- (void)H5B2_cache_hdr_dest(f, bt2);
+ if(!ret_value && hdr)
+ if(H5B2_hdr_free(hdr) < 0)
+ HDONE_ERROR(H5E_BTREE, H5E_CANTRELEASE, NULL, "can't release v2 B-tree header")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B2_cache_hdr_load() */ /*lint !e818 Can't make udata a pointer to const */
@@ -266,17 +268,12 @@ done:
* Programmer: Quincey Koziol
* koziol@ncsa.uiuc.edu
* Feb 1 2005
- * 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
H5B2_cache_hdr_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr,
- H5B2_t *bt2, unsigned UNUSED * flags_ptr)
+ H5B2_hdr_t *hdr, unsigned UNUSED * flags_ptr)
{
H5WB_t *wb = NULL; /* Wrapped buffer for header data */
uint8_t hdr_buf[H5B2_HDR_BUF_SIZE]; /* Buffer for header */
@@ -287,32 +284,30 @@ H5B2_cache_hdr_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr,
/* check arguments */
HDassert(f);
HDassert(H5F_addr_defined(addr));
- HDassert(bt2);
+ HDassert(hdr);
- if (bt2->cache_info.is_dirty) {
- H5B2_shared_t *shared; /* Shared B-tree information */
- uint8_t *hdr; /* Pointer to header buffer */
+ if(hdr->cache_info.is_dirty) {
+ uint8_t *buf; /* Pointer to header buffer */
uint8_t *p; /* Pointer into raw data buffer */
size_t size; /* Header size on disk */
uint32_t metadata_chksum; /* Computed metadata checksum value */
- /* Get the pointer to the shared B-tree info */
- shared = (H5B2_shared_t *)H5RC_GET_OBJ(bt2->shared);
- HDassert(shared);
+ /* Set the B-tree header's file context for this operation */
+ hdr->f = f;
/* Wrap the local buffer for serialized header info */
if(NULL == (wb = H5WB_wrap(hdr_buf, sizeof(hdr_buf))))
HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "can't wrap buffer")
/* Compute the size of the serialized B-tree header on disk */
- size = H5B2_HEADER_SIZE(f);
+ size = H5B2_HEADER_SIZE(hdr);
/* Get a pointer to a buffer that's large enough for header */
- if(NULL == (hdr = (uint8_t *)H5WB_actual(wb, size)))
+ if(NULL == (buf = (uint8_t *)H5WB_actual(wb, size)))
HGOTO_ERROR(H5E_BTREE, H5E_NOSPACE, FAIL, "can't get actual buffer")
/* Get temporary pointer to serialized header */
- p = hdr;
+ p = buf;
/* Magic number */
HDmemcpy(p, H5B2_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC);
@@ -322,44 +317,44 @@ H5B2_cache_hdr_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr,
*p++ = H5B2_HDR_VERSION;
/* B-tree type */
- *p++ = shared->type->id;
+ *p++ = hdr->cls->id;
/* Node size (in bytes) */
- UINT32ENCODE(p, shared->node_size);
+ UINT32ENCODE(p, hdr->node_size);
/* Raw key size (in bytes) */
- UINT16ENCODE(p, shared->rrec_size);
+ UINT16ENCODE(p, hdr->rrec_size);
/* Depth of tree */
- UINT16ENCODE(p, shared->depth);
+ UINT16ENCODE(p, hdr->depth);
/* Split & merge %s */
- H5_CHECK_OVERFLOW(shared->split_percent, /* From: */ unsigned, /* To: */ uint8_t);
- *p++ = (uint8_t)shared->split_percent;
- H5_CHECK_OVERFLOW(shared->merge_percent, /* From: */ unsigned, /* To: */ uint8_t);
- *p++ = (uint8_t)shared->merge_percent;
+ H5_CHECK_OVERFLOW(hdr->split_percent, /* From: */ unsigned, /* To: */ uint8_t);
+ *p++ = (uint8_t)hdr->split_percent;
+ H5_CHECK_OVERFLOW(hdr->merge_percent, /* From: */ unsigned, /* To: */ uint8_t);
+ *p++ = (uint8_t)hdr->merge_percent;
/* Root node pointer */
- H5F_addr_encode(f, &p, bt2->root.addr);
- UINT16ENCODE(p, bt2->root.node_nrec);
- H5F_ENCODE_LENGTH(f, p, bt2->root.all_nrec);
+ H5F_addr_encode(f, &p, hdr->root.addr);
+ UINT16ENCODE(p, hdr->root.node_nrec);
+ H5F_ENCODE_LENGTH(f, p, hdr->root.all_nrec);
/* Compute metadata checksum */
- metadata_chksum = H5_checksum_metadata(hdr, (size - H5B2_SIZEOF_CHKSUM), 0);
+ metadata_chksum = H5_checksum_metadata(buf, (size - H5B2_SIZEOF_CHKSUM), 0);
/* Metadata checksum */
UINT32ENCODE(p, metadata_chksum);
/* Write the B-tree header. */
- HDassert((size_t)(p - hdr) == size);
- if(H5F_block_write(f, H5FD_MEM_BTREE, addr, size, dxpl_id, hdr) < 0)
+ HDassert((size_t)(p - buf) == size);
+ if(H5F_block_write(f, H5FD_MEM_BTREE, addr, size, dxpl_id, buf) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTFLUSH, FAIL, "unable to save B-tree header to disk")
- bt2->cache_info.is_dirty = FALSE;
+ hdr->cache_info.is_dirty = FALSE;
} /* end if */
if(destroy)
- if(H5B2_cache_hdr_dest(f, bt2) < 0)
+ if(H5B2_cache_hdr_dest(f, hdr) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to destroy B-tree header")
done:
@@ -385,7 +380,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5B2_cache_hdr_dest(H5F_t *f, H5B2_t *bt2)
+H5B2_cache_hdr_dest(H5F_t *f, H5B2_hdr_t *hdr)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -394,25 +389,23 @@ H5B2_cache_hdr_dest(H5F_t *f, H5B2_t *bt2)
/*
* Check arguments.
*/
- HDassert(bt2);
+ HDassert(hdr);
+ HDassert(hdr->rc == 0);
/* If we're going to free the space on disk, the address must be valid */
- HDassert(!bt2->cache_info.free_file_space_on_destroy || H5F_addr_defined(bt2->cache_info.addr));
+ HDassert(!hdr->cache_info.free_file_space_on_destroy || H5F_addr_defined(hdr->cache_info.addr));
/* Check for freeing file space for B-tree header */
- if(bt2->cache_info.free_file_space_on_destroy) {
+ if(hdr->cache_info.free_file_space_on_destroy) {
/* Release the space on disk */
/* (XXX: Nasty usage of internal DXPL value! -QAK) */
- if(H5MF_xfree(f, H5FD_MEM_BTREE, H5AC_dxpl_id, bt2->cache_info.addr, (hsize_t)H5B2_HEADER_SIZE(f)) < 0)
+ if(H5MF_xfree(f, H5FD_MEM_BTREE, H5AC_dxpl_id, hdr->cache_info.addr, (hsize_t)H5B2_HEADER_SIZE(hdr)) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to free v2 B-tree header")
} /* end if */
- /* Decrement reference count on shared B-tree info */
- if(bt2->shared)
- H5RC_DEC(bt2->shared);
-
- /* Free B-tree header info */
- (void)H5FL_FREE(H5B2_t, bt2);
+ /* Release B-tree header info */
+ if(H5B2_hdr_free(hdr) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to free v2 B-tree header info")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -433,7 +426,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5B2_cache_hdr_clear(H5F_t *f, H5B2_t *bt2, hbool_t destroy)
+H5B2_cache_hdr_clear(H5F_t *f, H5B2_hdr_t *hdr, hbool_t destroy)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -442,13 +435,13 @@ H5B2_cache_hdr_clear(H5F_t *f, H5B2_t *bt2, hbool_t destroy)
/*
* Check arguments.
*/
- HDassert(bt2);
+ HDassert(hdr);
/* Reset the dirty flag. */
- bt2->cache_info.is_dirty = FALSE;
+ hdr->cache_info.is_dirty = FALSE;
if(destroy)
- if(H5B2_cache_hdr_dest(f, bt2) < 0)
+ if(H5B2_cache_hdr_dest(f, hdr) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to destroy B-tree header")
done:
@@ -472,7 +465,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5B2_cache_hdr_size(const H5F_t *f, const H5B2_t UNUSED *bt2, size_t *size_ptr)
+H5B2_cache_hdr_size(const H5F_t UNUSED *f, const H5B2_hdr_t *hdr, size_t *size_ptr)
{
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5B2_cache_hdr_size)
@@ -481,7 +474,7 @@ H5B2_cache_hdr_size(const H5F_t *f, const H5B2_t UNUSED *bt2, size_t *size_ptr)
HDassert(size_ptr);
/* Set size value */
- *size_ptr = H5B2_HEADER_SIZE(f);
+ *size_ptr = H5B2_HEADER_SIZE(hdr);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5B2_cache_hdr_size() */
@@ -493,7 +486,6 @@ H5B2_cache_hdr_size(const H5F_t *f, const H5B2_t UNUSED *bt2, size_t *size_ptr)
* Purpose: Loads a B-tree internal node from the disk.
*
* Return: Success: Pointer to a new B-tree internal node.
- *
* Failure: NULL
*
* Programmer: Quincey Koziol
@@ -506,7 +498,6 @@ static H5B2_internal_t *
H5B2_cache_internal_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_udata, void UNUSED *udata2)
{
const H5B2_int_load_ud1_t *udata = (const H5B2_int_load_ud1_t *)_udata; /* Pointer to user data */
- H5B2_shared_t *shared; /* Shared B-tree information */
H5B2_internal_t *internal = NULL; /* Internal node read */
uint8_t *p; /* Pointer into raw data buffer */
uint8_t *native; /* Pointer to native record info */
@@ -528,19 +519,21 @@ H5B2_cache_internal_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_uda
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
HDmemset(&internal->cache_info, 0, sizeof(H5AC_info_t));
- /* Share common B-tree information */
- internal->shared = udata->bt2_shared;
- H5RC_INC(internal->shared);
+ /* Set the B-tree header's file context for this operation */
+ udata->hdr->f = f;
+
+ /* Increment ref. count on B-tree header */
+ if(H5B2_hdr_incr(udata->hdr) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTINC, NULL, "can't increment ref. count on B-tree header")
- /* Get the pointer to the shared B-tree info */
- shared=(H5B2_shared_t *)H5RC_GET_OBJ(internal->shared);
- HDassert(shared);
+ /* Share B-tree information */
+ internal->hdr = udata->hdr;
/* Read header from disk */
- if(H5F_block_read(f, H5FD_MEM_BTREE, addr, shared->node_size, dxpl_id, shared->page)<0)
+ if(H5F_block_read(f, H5FD_MEM_BTREE, addr, udata->hdr->node_size, dxpl_id, udata->hdr->page) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_READERROR, NULL, "can't read B-tree internal node")
- p = shared->page;
+ p = udata->hdr->page;
/* Magic number */
if(HDmemcmp(p, H5B2_INT_MAGIC, (size_t)H5_SIZEOF_MAGIC))
@@ -552,15 +545,15 @@ H5B2_cache_internal_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_uda
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, NULL, "wrong B-tree internal node version")
/* B-tree type */
- if(*p++ != (uint8_t)shared->type->id)
+ if(*p++ != (uint8_t)udata->hdr->cls->id)
HGOTO_ERROR(H5E_BTREE, H5E_BADTYPE, NULL, "incorrect B-tree type")
/* Allocate space for the native keys in memory */
- if((internal->int_native = (uint8_t *)H5FL_FAC_MALLOC(shared->node_info[udata->depth].nat_rec_fac)) == NULL)
+ if(NULL == (internal->int_native = (uint8_t *)H5FL_FAC_MALLOC(udata->hdr->node_info[udata->depth].nat_rec_fac)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for B-tree internal native keys")
/* Allocate space for the node pointers in memory */
- if((internal->node_ptrs = (H5B2_node_ptr_t *)H5FL_FAC_MALLOC(shared->node_info[udata->depth].node_ptr_fac)) == NULL)
+ if(NULL == (internal->node_ptrs = (H5B2_node_ptr_t *)H5FL_FAC_MALLOC(udata->hdr->node_info[udata->depth].node_ptr_fac)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for B-tree internal node pointers")
/* Set the number of records in the leaf & it's depth */
@@ -571,22 +564,22 @@ H5B2_cache_internal_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_uda
native = internal->int_native;
for(u = 0; u < internal->nrec; u++) {
/* Decode record */
- if((shared->type->decode)(f, p, native) < 0)
+ if((udata->hdr->cls->decode)(f, p, native) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTDECODE, NULL, "unable to decode B-tree record")
/* Move to next record */
- p += shared->rrec_size;
- native += shared->type->nrec_size;
+ p += udata->hdr->rrec_size;
+ native += udata->hdr->cls->nrec_size;
} /* end for */
/* Deserialize node pointers for internal node */
int_node_ptr = internal->node_ptrs;
- for(u = 0; u < internal->nrec + 1; u++) {
+ for(u = 0; u < (unsigned)(internal->nrec + 1); u++) {
/* Decode node pointer */
H5F_addr_decode(f, (const uint8_t **)&p, &(int_node_ptr->addr));
- UINT64DECODE_VAR(p, int_node_ptr->node_nrec, shared->max_nrec_size);
+ UINT64DECODE_VAR(p, int_node_ptr->node_nrec, udata->hdr->max_nrec_size);
if(udata->depth > 1)
- UINT64DECODE_VAR(p, int_node_ptr->all_nrec, shared->node_info[udata->depth - 1].cum_max_nrec_size)
+ UINT64DECODE_VAR(p, int_node_ptr->all_nrec, udata->hdr->node_info[udata->depth - 1].cum_max_nrec_size)
else
int_node_ptr->all_nrec = int_node_ptr->node_nrec;
@@ -595,13 +588,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(shared->page, (size_t)(p - shared->page), 0);
+ computed_chksum = H5_checksum_metadata(udata->hdr->page, (size_t)(p - udata->hdr->page), 0);
/* Metadata checksum */
UINT32DECODE(p, stored_chksum);
/* Sanity check parsing */
- HDassert((size_t)(p - shared->page) <= shared->node_size);
+ HDassert((size_t)(p - udata->hdr->page) <= udata->hdr->node_size);
/* Verify checksum */
if(stored_chksum != computed_chksum)
@@ -627,11 +620,6 @@ done:
* Programmer: Quincey Koziol
* koziol@ncsa.uiuc.edu
* Feb 3 2005
- * 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.
*
*-------------------------------------------------------------------------
*/
@@ -646,20 +634,19 @@ H5B2_cache_internal_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr
HDassert(f);
HDassert(H5F_addr_defined(addr));
HDassert(internal);
+ HDassert(internal->hdr);
if(internal->cache_info.is_dirty) {
- H5B2_shared_t *shared; /* Shared B-tree information */
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 metadata_chksum; /* Computed metadata checksum value */
unsigned u; /* Local index variable */
- /* Get the pointer to the shared B-tree info */
- shared = (H5B2_shared_t *)H5RC_GET_OBJ(internal->shared);
- HDassert(shared);
+ /* Set the B-tree header's file context for this operation */
+ internal->hdr->f = f;
- p = shared->page;
+ p = internal->hdr->page;
/* Magic number */
HDmemcpy(p, H5B2_INT_MAGIC, (size_t)H5_SIZEOF_MAGIC);
@@ -669,43 +656,43 @@ H5B2_cache_internal_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr
*p++ = H5B2_INT_VERSION;
/* B-tree type */
- *p++ = shared->type->id;
- HDassert((size_t)(p - shared->page) == (H5B2_INT_PREFIX_SIZE - H5B2_SIZEOF_CHKSUM));
+ *p++ = internal->hdr->cls->id;
+ HDassert((size_t)(p - internal->hdr->page) == (H5B2_INT_PREFIX_SIZE - H5B2_SIZEOF_CHKSUM));
/* Serialize records for internal node */
native = internal->int_native;
for(u = 0; u < internal->nrec; u++) {
/* Encode record */
- if((shared->type->encode)(f, p, native) < 0)
+ if((internal->hdr->cls->encode)(f, p, native) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTENCODE, FAIL, "unable to encode B-tree record")
/* Move to next record */
- p += shared->rrec_size;
- native += shared->type->nrec_size;
+ p += internal->hdr->rrec_size;
+ native += internal->hdr->cls->nrec_size;
} /* end for */
/* Serialize node pointers for internal node */
int_node_ptr = internal->node_ptrs;
- for(u = 0; u < internal->nrec + 1; u++) {
+ for(u = 0; u < (unsigned)(internal->nrec + 1); u++) {
/* Encode node pointer */
H5F_addr_encode(f, &p, int_node_ptr->addr);
- UINT64ENCODE_VAR(p, int_node_ptr->node_nrec, shared->max_nrec_size);
+ UINT64ENCODE_VAR(p, int_node_ptr->node_nrec, internal->hdr->max_nrec_size);
if(internal->depth > 1)
- UINT64ENCODE_VAR(p, int_node_ptr->all_nrec, shared->node_info[internal->depth - 1].cum_max_nrec_size);
+ UINT64ENCODE_VAR(p, int_node_ptr->all_nrec, internal->hdr->node_info[internal->depth - 1].cum_max_nrec_size);
/* Move to next node pointer */
int_node_ptr++;
} /* end for */
/* Compute metadata checksum */
- metadata_chksum = H5_checksum_metadata(shared->page, (size_t)(p - shared->page), 0);
+ metadata_chksum = H5_checksum_metadata(internal->hdr->page, (size_t)(p - internal->hdr->page), 0);
/* Metadata checksum */
UINT32ENCODE(p, metadata_chksum);
/* Write the B-tree internal node */
- HDassert((size_t)(p - shared->page) <= shared->node_size);
- if(H5F_block_write(f, H5FD_MEM_BTREE, addr, shared->node_size, dxpl_id, shared->page) < 0)
+ HDassert((size_t)(p - internal->hdr->page) <= internal->hdr->node_size);
+ if(H5F_block_write(f, H5FD_MEM_BTREE, addr, internal->hdr->node_size, dxpl_id, internal->hdr->page) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTFLUSH, FAIL, "unable to save B-tree internal node to disk")
internal->cache_info.is_dirty = FALSE;
@@ -736,7 +723,6 @@ done:
herr_t
H5B2_cache_internal_dest(H5F_t *f, H5B2_internal_t *internal)
{
- H5B2_shared_t *shared; /* Shared B-tree information */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5B2_cache_internal_dest)
@@ -744,37 +730,38 @@ H5B2_cache_internal_dest(H5F_t *f, H5B2_internal_t *internal)
/*
* Check arguments.
*/
+ HDassert(f);
HDassert(internal);
+ HDassert(internal->hdr);
/* If we're going to free the space on disk, the address must be valid */
HDassert(!internal->cache_info.free_file_space_on_destroy || H5F_addr_defined(internal->cache_info.addr));
- /* Get the pointer to the shared B-tree info */
- shared = (H5B2_shared_t *)H5RC_GET_OBJ(internal->shared);
- HDassert(shared);
-
/* Check for freeing file space for B-tree internal node */
if(internal->cache_info.free_file_space_on_destroy) {
/* Release the space on disk */
/* (XXX: Nasty usage of internal DXPL value! -QAK) */
- if(H5MF_xfree(f, H5FD_MEM_BTREE, H5AC_dxpl_id, internal->cache_info.addr, (hsize_t)shared->node_size) < 0)
+ if(H5MF_xfree(f, H5FD_MEM_BTREE, H5AC_dxpl_id, internal->cache_info.addr, (hsize_t)internal->hdr->node_size) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to free v2 B-tree internal node")
} /* end if */
+ /* Set the B-tree header's file context for this operation */
+ internal->hdr->f = f;
+
/* Release internal node's native key buffer */
if(internal->int_native)
- H5FL_FAC_FREE(shared->node_info[internal->depth].nat_rec_fac, internal->int_native);
+ H5FL_FAC_FREE(internal->hdr->node_info[internal->depth].nat_rec_fac, internal->int_native);
/* Release internal node's node pointer buffer */
if(internal->node_ptrs)
- H5FL_FAC_FREE(shared->node_info[internal->depth].node_ptr_fac, internal->node_ptrs);
+ H5FL_FAC_FREE(internal->hdr->node_info[internal->depth].node_ptr_fac, internal->node_ptrs);
- /* Decrement reference count on shared B-tree info */
- if(internal->shared)
- H5RC_DEC(internal->shared);
+ /* Decrement ref. count on B-tree header */
+ if(H5B2_hdr_decr(internal->hdr) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTDEC, FAIL, "can't decrement ref. count on B-tree header")
/* Free B-tree internal node info */
- (void)H5FL_FREE(H5B2_internal_t, internal);
+ internal = H5FL_FREE(H5B2_internal_t, internal);
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -836,20 +823,15 @@ done:
static herr_t
H5B2_cache_internal_size(const H5F_t UNUSED *f, const H5B2_internal_t *internal, size_t *size_ptr)
{
- H5B2_shared_t *shared; /* Shared B-tree information */
-
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5B2_cache_internal_size)
/* check arguments */
HDassert(internal);
+ HDassert(internal->hdr);
HDassert(size_ptr);
- /* Get the pointer to the shared B-tree info */
- shared = (H5B2_shared_t *)H5RC_GET_OBJ(internal->shared);
- HDassert(shared);
-
/* Set size value */
- *size_ptr = shared->node_size;
+ *size_ptr = internal->hdr->node_size;
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5B2_cache_internal_size() */
@@ -861,7 +843,6 @@ H5B2_cache_internal_size(const H5F_t UNUSED *f, const H5B2_internal_t *internal,
* Purpose: Loads a B-tree leaf from the disk.
*
* Return: Success: Pointer to a new B-tree leaf node.
- *
* Failure: NULL
*
* Programmer: Quincey Koziol
@@ -871,11 +852,10 @@ H5B2_cache_internal_size(const H5F_t UNUSED *f, const H5B2_internal_t *internal,
*-------------------------------------------------------------------------
*/
static H5B2_leaf_t *
-H5B2_cache_leaf_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_nrec, void *_bt2_shared)
+H5B2_cache_leaf_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_nrec, void *_hdr)
{
- const unsigned *nrec = (const unsigned *)_nrec;
- H5RC_t *bt2_shared = (H5RC_t *)_bt2_shared; /* Shared B-tree information */
- H5B2_shared_t *shared; /* Shared B-tree information */
+ 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 */
uint8_t *native; /* Pointer to native keys */
@@ -889,25 +869,28 @@ H5B2_cache_leaf_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_nrec, v
/* Check arguments */
HDassert(f);
HDassert(H5F_addr_defined(addr));
- HDassert(bt2_shared);
+ HDassert(hdr);
+ /* Allocate new leaf node and reset cache info */
if(NULL == (leaf = H5FL_MALLOC(H5B2_leaf_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
HDmemset(&leaf->cache_info, 0, sizeof(H5AC_info_t));
- /* Share common B-tree information */
- leaf->shared = bt2_shared;
- H5RC_INC(leaf->shared);
+ /* Set the B-tree header's file context for this operation */
+ hdr->f = f;
- /* Get the pointer to the shared B-tree info */
- shared = (H5B2_shared_t *)H5RC_GET_OBJ(leaf->shared);
- HDassert(shared);
+ /* Increment ref. count on B-tree header */
+ if(H5B2_hdr_incr(hdr) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTINC, NULL, "can't increment ref. count on B-tree header")
+
+ /* Share B-tree header information */
+ leaf->hdr = hdr;
/* Read header from disk */
- if(H5F_block_read(f, H5FD_MEM_BTREE, addr, shared->node_size, dxpl_id, shared->page) < 0)
+ if(H5F_block_read(f, H5FD_MEM_BTREE, addr, hdr->node_size, dxpl_id, hdr->page) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_READERROR, NULL, "can't read B-tree leaf node")
- p = shared->page;
+ p = hdr->page;
/* Magic number */
if(HDmemcmp(p, H5B2_LEAF_MAGIC, (size_t)H5_SIZEOF_MAGIC))
@@ -919,12 +902,12 @@ H5B2_cache_leaf_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_nrec, v
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, NULL, "wrong B-tree leaf node version")
/* B-tree type */
- if(*p++ != (uint8_t)shared->type->id)
+ if(*p++ != (uint8_t)hdr->cls->id)
HGOTO_ERROR(H5E_BTREE, H5E_BADTYPE, NULL, "incorrect B-tree type")
/* Allocate space for the native keys in memory */
- if((leaf->leaf_native = (uint8_t *)H5FL_FAC_MALLOC(shared->node_info[0].nat_rec_fac)) == NULL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for B-tree leaf native keys")
+ if(NULL == (leaf->leaf_native = (uint8_t *)H5FL_FAC_MALLOC(hdr->node_info[0].nat_rec_fac)))
+ HGOTO_ERROR(H5E_BTREE, H5E_NOSPACE, NULL, "memory allocation failed for B-tree leaf native keys")
/* Set the number of records in the leaf */
leaf->nrec = *nrec;
@@ -933,22 +916,22 @@ H5B2_cache_leaf_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_nrec, v
native = leaf->leaf_native;
for(u = 0; u < leaf->nrec; u++) {
/* Decode record */
- if((shared->type->decode)(f, p, native) < 0)
+ if((hdr->cls->decode)(f, p, native) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTENCODE, NULL, "unable to decode B-tree record")
/* Move to next record */
- p += shared->rrec_size;
- native += shared->type->nrec_size;
+ p += hdr->rrec_size;
+ native += hdr->cls->nrec_size;
} /* end for */
/* Compute checksum on internal node */
- computed_chksum = H5_checksum_metadata(shared->page, (size_t)(p - shared->page), 0);
+ computed_chksum = H5_checksum_metadata(hdr->page, (size_t)(p - hdr->page), 0);
/* Metadata checksum */
UINT32DECODE(p, stored_chksum);
/* Sanity check parsing */
- HDassert((size_t)(p - shared->page) <= shared->node_size);
+ HDassert((size_t)(p - hdr->page) <= hdr->node_size);
/* Verify checksum */
if(stored_chksum != computed_chksum)
@@ -959,7 +942,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);
+ (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 */
@@ -975,13 +958,6 @@ done:
* koziol@ncsa.uiuc.edu
* Feb 2 2005
*
- * 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
@@ -995,19 +971,18 @@ H5B2_cache_leaf_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5
HDassert(f);
HDassert(H5F_addr_defined(addr));
HDassert(leaf);
+ HDassert(leaf->hdr);
if(leaf->cache_info.is_dirty) {
- H5B2_shared_t *shared; /* Shared B-tree information */
uint8_t *p; /* Pointer into raw data buffer */
uint8_t *native; /* Pointer to native keys */
uint32_t metadata_chksum; /* Computed metadata checksum value */
unsigned u; /* Local index variable */
- /* Get the pointer to the shared B-tree info */
- shared = (H5B2_shared_t *)H5RC_GET_OBJ(leaf->shared);
- HDassert(shared);
+ /* Set the B-tree header's file context for this operation */
+ leaf->hdr->f = f;
- p = shared->page;
+ p = leaf->hdr->page;
/* magic number */
HDmemcpy(p, H5B2_LEAF_MAGIC, (size_t)H5_SIZEOF_MAGIC);
@@ -1017,30 +992,30 @@ H5B2_cache_leaf_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5
*p++ = H5B2_LEAF_VERSION;
/* b-tree type */
- *p++ = shared->type->id;
- HDassert((size_t)(p - shared->page) == (H5B2_LEAF_PREFIX_SIZE - H5B2_SIZEOF_CHKSUM));
+ *p++ = leaf->hdr->cls->id;
+ HDassert((size_t)(p - leaf->hdr->page) == (H5B2_LEAF_PREFIX_SIZE - H5B2_SIZEOF_CHKSUM));
/* Serialize records for leaf node */
native = leaf->leaf_native;
for(u = 0; u < leaf->nrec; u++) {
/* Encode record */
- if((shared->type->encode)(f, p, native) < 0)
+ if((leaf->hdr->cls->encode)(f, p, native) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTENCODE, FAIL, "unable to encode B-tree record")
/* Move to next record */
- p += shared->rrec_size;
- native += shared->type->nrec_size;
+ p += leaf->hdr->rrec_size;
+ native += leaf->hdr->cls->nrec_size;
} /* end for */
/* Compute metadata checksum */
- metadata_chksum = H5_checksum_metadata(shared->page, (size_t)(p - shared->page), 0);
+ metadata_chksum = H5_checksum_metadata(leaf->hdr->page, (size_t)(p - leaf->hdr->page), 0);
/* Metadata checksum */
UINT32ENCODE(p, metadata_chksum);
/* Write the B-tree leaf node */
- HDassert((size_t)(p - shared->page) <= shared->node_size);
- if(H5F_block_write(f, H5FD_MEM_BTREE, addr, shared->node_size, dxpl_id, shared->page) < 0)
+ HDassert((size_t)(p - leaf->hdr->page) <= leaf->hdr->node_size);
+ if(H5F_block_write(f, H5FD_MEM_BTREE, addr, leaf->hdr->node_size, dxpl_id, leaf->hdr->page) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTFLUSH, FAIL, "unable to save B-tree leaf node to disk")
leaf->cache_info.is_dirty = FALSE;
@@ -1071,7 +1046,6 @@ done:
herr_t
H5B2_cache_leaf_dest(H5F_t *f, H5B2_leaf_t *leaf)
{
- H5B2_shared_t *shared; /* Shared B-tree information */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5B2_cache_leaf_dest)
@@ -1079,33 +1053,34 @@ H5B2_cache_leaf_dest(H5F_t *f, H5B2_leaf_t *leaf)
/*
* Check arguments.
*/
+ HDassert(f);
HDassert(leaf);
+ HDassert(leaf->hdr);
/* If we're going to free the space on disk, the address must be valid */
HDassert(!leaf->cache_info.free_file_space_on_destroy || H5F_addr_defined(leaf->cache_info.addr));
- /* Get the pointer to the shared B-tree info */
- shared = (H5B2_shared_t *)H5RC_GET_OBJ(leaf->shared);
- HDassert(shared);
-
/* Check for freeing file space for B-tree leaf node */
if(leaf->cache_info.free_file_space_on_destroy) {
/* Release the space on disk */
/* (XXX: Nasty usage of internal DXPL value! -QAK) */
- if(H5MF_xfree(f, H5FD_MEM_BTREE, H5AC_dxpl_id, leaf->cache_info.addr, (hsize_t)shared->node_size) < 0)
+ if(H5MF_xfree(f, H5FD_MEM_BTREE, H5AC_dxpl_id, leaf->cache_info.addr, (hsize_t)leaf->hdr->node_size) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to free v2 B-tree leaf node")
} /* end if */
+ /* Set the B-tree header's file context for this operation */
+ leaf->hdr->f = f;
+
/* Release leaf's native key buffer */
if(leaf->leaf_native)
- H5FL_FAC_FREE(shared->node_info[0].nat_rec_fac, leaf->leaf_native);
+ H5FL_FAC_FREE(leaf->hdr->node_info[0].nat_rec_fac, leaf->leaf_native);
- /* Decrement reference count on shared B-tree info */
- if(leaf->shared)
- H5RC_DEC(leaf->shared);
+ /* Decrement ref. count on B-tree header */
+ if(H5B2_hdr_decr(leaf->hdr) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTDEC, FAIL, "can't decrement ref. count on B-tree header")
/* Free B-tree leaf node info */
- (void)H5FL_FREE(H5B2_leaf_t, leaf);
+ leaf = H5FL_FREE(H5B2_leaf_t, leaf);
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1167,20 +1142,15 @@ done:
static herr_t
H5B2_cache_leaf_size(const H5F_t UNUSED *f, const H5B2_leaf_t *leaf, size_t *size_ptr)
{
- H5B2_shared_t *shared; /* Shared B-tree information */
-
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5B2_cache_leaf_size)
/* check arguments */
HDassert(leaf);
+ HDassert(leaf->hdr);
HDassert(size_ptr);
- /* Get the pointer to the shared B-tree info */
- shared = (H5B2_shared_t *)H5RC_GET_OBJ(leaf->shared);
- HDassert(shared);
-
/* Set size value */
- *size_ptr = shared->node_size;
+ *size_ptr = leaf->hdr->node_size;
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5B2_cache_leaf_size() */
diff --git a/src/H5B2dbg.c b/src/H5B2dbg.c
index 836486e..17a64cd 100644
--- a/src/H5B2dbg.c
+++ b/src/H5B2dbg.c
@@ -90,10 +90,9 @@ herr_t
H5B2_hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int fwidth,
const H5B2_class_t *type)
{
- H5B2_t *bt2 = NULL; /* B-tree header info */
- H5B2_shared_t *shared; /* Shared B-tree information */
+ H5B2_hdr_t *hdr = NULL; /* B-tree header info */
unsigned u; /* Local index variable */
- char temp_str[128]; /* Temporary string, for formatting */
+ char temp_str[128]; /* Temporary string, for formatting */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5B2_hdr_debug, FAIL)
@@ -111,12 +110,11 @@ H5B2_hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent,
/*
* Load the B-tree header.
*/
- if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, type, NULL, H5AC_READ)))
+ if(NULL == (hdr = (H5B2_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, type, NULL, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree header")
- /* Get the pointer to the shared B-tree info */
- shared = (H5B2_shared_t *)H5RC_GET_OBJ(bt2->shared);
- HDassert(shared);
+ /* Set file pointer for this B-tree operation */
+ hdr->f = f;
/* Print opening message */
HDfprintf(stream, "%*sv2 B-tree Header...\n", indent, "");
@@ -124,59 +122,51 @@ H5B2_hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent,
/*
* Print the values.
*/
- HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
- "Tree type ID:",
- (shared->type->id == H5B2_TEST_ID ? "H5B2_TEST_ID" :
- (shared->type->id == H5B2_FHEAP_HUGE_INDIR_ID ? "H5B2_FHEAP_HUGE_INDIR_ID" :
- (shared->type->id == H5B2_FHEAP_HUGE_FILT_INDIR_ID ? "H5B2_FHEAP_HUGE_FILT_INDIR_ID" :
- (shared->type->id == H5B2_FHEAP_HUGE_DIR_ID ? "H5B2_FHEAP_HUGE_DIR_ID" :
- (shared->type->id == H5B2_FHEAP_HUGE_FILT_DIR_ID ? "H5B2_FHEAP_HUGE_FILT_DIR_ID" :
- (shared->type->id == H5B2_GRP_DENSE_NAME_ID ? "H5B2_GRP_DENSE_NAME_ID" :
- (shared->type->id == H5B2_GRP_DENSE_CORDER_ID ? "H5B2_GRP_DENSE_CORDER_ID" :
- (shared->type->id == H5B2_SOHM_INDEX_ID ? "H5B2_SOHM_INDEX_ID" :
- (shared->type->id == H5B2_ATTR_DENSE_NAME_ID ? "H5B2_ATTR_DENSE_NAME_ID" :
- (shared->type->id == H5B2_ATTR_DENSE_CORDER_ID ? "H5B2_ATTR_DENSE_CORDER_ID" :
- "Unknown!")))))))))));
+ HDfprintf(stream, "%*s%-*s %s (%u)\n", indent, "", fwidth,
+ "Tree type ID:", hdr->cls->name, (unsigned)hdr->cls->id);
HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth,
"Size of node:",
- shared->node_size);
+ hdr->node_size);
HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth,
"Size of raw (disk) record:",
- shared->rrec_size);
+ hdr->rrec_size);
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
"Dirty flag:",
- bt2->cache_info.is_dirty ? "True" : "False");
+ hdr->cache_info.is_dirty ? "True" : "False");
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
"Depth:",
- shared->depth);
+ hdr->depth);
HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth,
"Number of records in tree:",
- bt2->root.all_nrec);
+ hdr->root.all_nrec);
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
"Number of records in root node:",
- bt2->root.node_nrec);
+ hdr->root.node_nrec);
HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
"Address of root node:",
- bt2->root.addr);
+ hdr->root.addr);
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
"Split percent:",
- shared->split_percent);
+ hdr->split_percent);
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
"Merge percent:",
- shared->merge_percent);
+ hdr->merge_percent);
/* Print relevant node info */
HDfprintf(stream, "%*sNode Info: (max_nrec/split_nrec/merge_nrec)\n", indent, "");
- for(u = 0; u < (shared->depth + 1); u++) {
+ for(u = 0; u < (unsigned)(hdr->depth + 1); u++) {
sprintf(temp_str, "Depth %u:", u);
HDfprintf(stream, "%*s%-*s (%u/%u/%u)\n", indent + 3, "", MAX(0, fwidth - 3),
temp_str,
- shared->node_info[u].max_nrec, shared->node_info[u].split_nrec, shared->node_info[u].merge_nrec);
+ hdr->node_info[u].max_nrec, hdr->node_info[u].split_nrec, hdr->node_info[u].merge_nrec);
} /* end for */
done:
- if(bt2 && H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, bt2, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree header")
+ if(hdr) {
+ hdr->f = NULL;
+ if(H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, hdr, H5AC__NO_FLAGS_SET) < 0)
+ HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree header")
+ } /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B2_hdr_debug() */
@@ -199,11 +189,10 @@ herr_t
H5B2_int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int fwidth,
const H5B2_class_t *type, haddr_t hdr_addr, unsigned nrec, unsigned depth)
{
- H5B2_t *bt2 = NULL;
- H5B2_internal_t *internal = NULL;
- H5B2_shared_t *shared; /* Shared B-tree information */
- unsigned u; /* Local index variable */
- char temp_str[128]; /* Temporary string, for formatting */
+ H5B2_hdr_t *hdr = NULL; /* B-tree header */
+ H5B2_internal_t *internal = NULL; /* B-tree internal node */
+ unsigned u; /* Local index variable */
+ char temp_str[128]; /* Temporary string, for formatting */
herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5B2_int_debug, FAIL)
@@ -223,24 +212,18 @@ H5B2_int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent,
/*
* Load the B-tree header.
*/
- if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, hdr_addr, type, NULL, H5AC_READ)))
+ if(NULL == (hdr = (H5B2_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, hdr_addr, type, NULL, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree header")
- /* Get the pointer to the shared B-tree info */
- shared = (H5B2_shared_t *)H5RC_GET_OBJ(bt2->shared);
- HDassert(shared);
+ /* Set file pointer for this B-tree operation */
+ hdr->f = f;
/*
* Load the B-tree internal node
*/
- if(NULL == (internal = H5B2_protect_internal(f, dxpl_id, bt2->shared, addr, nrec, depth, H5AC_READ)))
+ if(NULL == (internal = H5B2_protect_internal(hdr, dxpl_id, addr, nrec, depth, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree internal node")
- /* Release the B-tree header */
- if(H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, hdr_addr, bt2, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree header")
- bt2 = NULL;
-
/* Print opening message */
if(internal->depth == 1)
HDfprintf(stream, "%*sv2 B-tree Internal 'Leaf' Node...\n", indent, "");
@@ -250,25 +233,14 @@ H5B2_int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent,
/*
* Print the values.
*/
- HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
- "Tree type ID:",
- (shared->type->id == H5B2_TEST_ID ? "H5B2_TEST_ID" :
- (shared->type->id == H5B2_FHEAP_HUGE_INDIR_ID ? "H5B2_FHEAP_HUGE_INDIR_ID" :
- (shared->type->id == H5B2_FHEAP_HUGE_FILT_INDIR_ID ? "H5B2_FHEAP_HUGE_FILT_INDIR_ID" :
- (shared->type->id == H5B2_FHEAP_HUGE_DIR_ID ? "H5B2_FHEAP_HUGE_DIR_ID" :
- (shared->type->id == H5B2_FHEAP_HUGE_FILT_DIR_ID ? "H5B2_FHEAP_HUGE_FILT_DIR_ID" :
- (shared->type->id == H5B2_GRP_DENSE_NAME_ID ? "H5B2_GRP_DENSE_NAME_ID" :
- (shared->type->id == H5B2_GRP_DENSE_CORDER_ID ? "H5B2_GRP_DENSE_CORDER_ID" :
- (shared->type->id == H5B2_SOHM_INDEX_ID ? "H5B2_SOHM_INDEX_ID" :
- (shared->type->id == H5B2_ATTR_DENSE_NAME_ID ? "H5B2_ATTR_DENSE_NAME_ID" :
- (shared->type->id == H5B2_ATTR_DENSE_CORDER_ID ? "H5B2_ATTR_DENSE_CORDER_ID" :
- "Unknown!")))))))))));
+ HDfprintf(stream, "%*s%-*s %s (%u)\n", indent, "", fwidth,
+ "Tree type ID:", hdr->cls->name, (unsigned)hdr->cls->id);
HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth,
"Size of node:",
- shared->node_size);
+ hdr->node_size);
HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth,
"Size of raw (disk) record:",
- shared->rrec_size);
+ hdr->rrec_size);
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
"Dirty flag:",
internal->cache_info.is_dirty ? "True" : "False");
@@ -290,9 +262,9 @@ H5B2_int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent,
sprintf(temp_str, "Record #%u:", u);
HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3),
temp_str);
- HDassert(H5B2_INT_NREC(internal, shared, u));
+ HDassert(H5B2_INT_NREC(internal, hdr, u));
(void)(type->debug)(stream, f, dxpl_id, indent + 6, MAX (0, fwidth-6),
- H5B2_INT_NREC(internal,shared,u), NULL);
+ H5B2_INT_NREC(internal, hdr, u), NULL);
} /* end for */
/* Print final node pointer */
@@ -304,6 +276,11 @@ H5B2_int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent,
internal->node_ptrs[u].addr);
done:
+ if(hdr) {
+ hdr->f = NULL;
+ if(H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, hdr_addr, hdr, H5AC__NO_FLAGS_SET) < 0)
+ HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree header")
+ } /* end if */
if(internal && H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, addr, internal, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree internal node")
@@ -328,12 +305,11 @@ herr_t
H5B2_leaf_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int fwidth,
const H5B2_class_t *type, haddr_t hdr_addr, unsigned nrec)
{
- H5B2_t *bt2 = NULL;
- H5B2_leaf_t *leaf = NULL;
- H5B2_shared_t *shared; /* Shared B-tree information */
- unsigned u; /* Local index variable */
- char temp_str[128]; /* Temporary string, for formatting */
- herr_t ret_value=SUCCEED; /* Return value */
+ H5B2_hdr_t *hdr = NULL; /* B-tree header */
+ H5B2_leaf_t *leaf = NULL; /* B-tree leaf node */
+ unsigned u; /* Local index variable */
+ char temp_str[128]; /* Temporary string, for formatting */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5B2_leaf_debug, FAIL)
@@ -352,49 +328,32 @@ H5B2_leaf_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent,
/*
* Load the B-tree header.
*/
- if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, hdr_addr, type, NULL, H5AC_READ)))
+ if(NULL == (hdr = (H5B2_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, hdr_addr, type, NULL, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree header")
- /* Get the pointer to the shared B-tree info */
- shared = (H5B2_shared_t *)H5RC_GET_OBJ(bt2->shared);
- HDassert(shared);
+ /* Set file pointer for this B-tree operation */
+ hdr->f = f;
/*
* Load the B-tree leaf node
*/
- if(NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_LEAF, addr, &nrec, bt2->shared, H5AC_READ)))
+ if(NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_LEAF, addr, &nrec, hdr, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree leaf node")
- /* Release the B-tree header */
- if(H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, hdr_addr, bt2, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree header")
- bt2 = NULL;
-
/* Print opening message */
HDfprintf(stream, "%*sv2 B-tree Leaf Node...\n", indent, "");
/*
* Print the values.
*/
- HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
- "Tree type ID:",
- (shared->type->id == H5B2_TEST_ID ? "H5B2_TEST_ID" :
- (shared->type->id == H5B2_FHEAP_HUGE_INDIR_ID ? "H5B2_FHEAP_HUGE_INDIR_ID" :
- (shared->type->id == H5B2_FHEAP_HUGE_FILT_INDIR_ID ? "H5B2_FHEAP_HUGE_FILT_INDIR_ID" :
- (shared->type->id == H5B2_FHEAP_HUGE_DIR_ID ? "H5B2_FHEAP_HUGE_DIR_ID" :
- (shared->type->id == H5B2_FHEAP_HUGE_FILT_DIR_ID ? "H5B2_FHEAP_HUGE_FILT_DIR_ID" :
- (shared->type->id == H5B2_GRP_DENSE_NAME_ID ? "H5B2_GRP_DENSE_NAME_ID" :
- (shared->type->id == H5B2_GRP_DENSE_CORDER_ID ? "H5B2_GRP_DENSE_CORDER_ID" :
- (shared->type->id == H5B2_SOHM_INDEX_ID ? "H5B2_SOHM_INDEX_ID" :
- (shared->type->id == H5B2_ATTR_DENSE_NAME_ID ? "H5B2_ATTR_DENSE_NAME_ID" :
- (shared->type->id == H5B2_ATTR_DENSE_CORDER_ID ? "H5B2_ATTR_DENSE_CORDER_ID" :
- "Unknown!")))))))))));
+ HDfprintf(stream, "%*s%-*s %s (%u)\n", indent, "", fwidth,
+ "Tree type ID:", hdr->cls->name, (unsigned)hdr->cls->id);
HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth,
"Size of node:",
- shared->node_size);
+ hdr->node_size);
HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth,
"Size of raw (disk) record:",
- shared->rrec_size);
+ hdr->rrec_size);
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
"Dirty flag:",
leaf->cache_info.is_dirty ? "True" : "False");
@@ -408,12 +367,17 @@ H5B2_leaf_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent,
sprintf(temp_str, "Record #%u:", u);
HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3),
temp_str);
- HDassert(H5B2_LEAF_NREC(leaf, shared, u));
- (void)(type->debug)(stream, f, dxpl_id, indent+6, MAX (0, fwidth-6),
- H5B2_LEAF_NREC(leaf,shared,u), NULL);
+ HDassert(H5B2_LEAF_NREC(leaf, hdr, u));
+ (void)(type->debug)(stream, f, dxpl_id, indent + 6, MAX (0, fwidth-6),
+ H5B2_LEAF_NREC(leaf, hdr, u), NULL);
} /* end for */
done:
+ if(hdr) {
+ hdr->f = NULL;
+ if(H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, hdr_addr, hdr, H5AC__NO_FLAGS_SET) < 0)
+ HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree header")
+ } /* end if */
if(leaf && H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, addr, leaf, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree leaf node")
diff --git a/src/H5B2hdr.c b/src/H5B2hdr.c
new file mode 100644
index 0000000..ec46729
--- /dev/null
+++ b/src/H5B2hdr.c
@@ -0,0 +1,597 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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: H5B2int.c
+ * Feb 27 2006
+ * Quincey Koziol <koziol@ncsa.uiuc.edu>
+ *
+ * Purpose: Internal routines for managing v2 B-trees.
+ *
+ *-------------------------------------------------------------------------
+ */
+
+/****************/
+/* Module Setup */
+/****************/
+
+#define H5B2_PACKAGE /*suppress error about including H5B2pkg */
+
+/***********/
+/* Headers */
+/***********/
+#include "H5private.h" /* Generic Functions */
+#include "H5B2pkg.h" /* v2 B-trees */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5MFprivate.h" /* File memory management */
+#include "H5Vprivate.h" /* Vectors and arrays */
+
+/****************/
+/* Local Macros */
+/****************/
+
+/* Number of records that fit into leaf node */
+#define H5B2_NUM_LEAF_REC(n, r) \
+ (((n) - H5B2_LEAF_PREFIX_SIZE) / (r))
+
+/* Uncomment this macro to enable extra sanity checking */
+/* #define H5B2_DEBUG */
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+
+/********************/
+/* Package Typedefs */
+/********************/
+
+
+/********************/
+/* Local Prototypes */
+/********************/
+
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/*******************/
+/* Local Variables */
+/*******************/
+
+/* Declare a free list to manage the H5B2_hdr_t struct */
+H5FL_DEFINE_STATIC(H5B2_hdr_t);
+
+/* Declare a free list to manage B-tree node pages to/from disk */
+H5FL_BLK_DEFINE_STATIC(node_page);
+
+/* Declare a free list to manage the 'size_t' sequence information */
+H5FL_SEQ_DEFINE_STATIC(size_t);
+
+/* Declare a free list to manage the 'H5B2_node_info_t' sequence information */
+H5FL_SEQ_DEFINE(H5B2_node_info_t);
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5B2_hdr_init
+ *
+ * Purpose: Allocate & initialize B-tree header info
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@ncsa.uiuc.edu
+ * Feb 2 2005
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5B2_hdr_init(H5F_t *f, H5B2_hdr_t *hdr, const H5B2_create_t *cparam,
+ uint16_t depth)
+{
+ size_t sz_max_nrec; /* Temporary variable for range checking */
+ unsigned u_max_nrec_size; /* Temporary variable for range checking */
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5B2_hdr_init)
+
+ /*
+ * Check arguments.
+ */
+ HDassert(f);
+ HDassert(hdr);
+ HDassert(cparam);
+ HDassert(cparam->cls);
+ HDassert(cparam->node_size > 0);
+ HDassert(cparam->rrec_size > 0);
+ HDassert(cparam->merge_percent > 0 && cparam->merge_percent <= 100);
+ HDassert(cparam->split_percent > 0 && cparam->split_percent <= 100);
+ HDassert(cparam->merge_percent < (cparam->split_percent / 2));
+
+ /* Initialize basic information */
+ hdr->f = f;
+ hdr->rc = 0;
+ hdr->pending_delete = FALSE;
+
+ /* Assign dynamic information */
+ hdr->depth = depth;
+
+ /* Assign user's information */
+ hdr->split_percent = cparam->split_percent;
+ hdr->merge_percent = cparam->merge_percent;
+ hdr->node_size = cparam->node_size;
+ hdr->rrec_size = cparam->rrec_size;
+
+ /* Assign common type information */
+ hdr->cls = cparam->cls;
+
+ /* Allocate "page" for node I/O */
+ if(NULL == (hdr->page = H5FL_BLK_MALLOC(node_page, hdr->node_size)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
+#ifdef H5_CLEAR_MEMORY
+HDmemset(hdr->page, 0, hdr->node_size);
+#endif /* H5_CLEAR_MEMORY */
+
+ /* Allocate array of node info structs */
+ if(NULL == (hdr->node_info = H5FL_SEQ_MALLOC(H5B2_node_info_t, (size_t)(hdr->depth + 1))))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
+
+ /* Initialize leaf node info */
+ sz_max_nrec = H5B2_NUM_LEAF_REC(hdr->node_size, hdr->rrec_size);
+ H5_ASSIGN_OVERFLOW(/* To: */ hdr->node_info[0].max_nrec, /* From: */ sz_max_nrec, /* From: */ size_t, /* To: */ unsigned)
+ hdr->node_info[0].split_nrec = (hdr->node_info[0].max_nrec * hdr->split_percent) / 100;
+ hdr->node_info[0].merge_nrec = (hdr->node_info[0].max_nrec * hdr->merge_percent) / 100;
+ hdr->node_info[0].cum_max_nrec = hdr->node_info[0].max_nrec;
+ hdr->node_info[0].cum_max_nrec_size = 0;
+ if(NULL == (hdr->node_info[0].nat_rec_fac = H5FL_fac_init(hdr->cls->nrec_size * hdr->node_info[0].max_nrec)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't create node native key block factory")
+ hdr->node_info[0].node_ptr_fac = NULL;
+
+ /* Allocate array of pointers to internal node native keys */
+ /* (uses leaf # of records because its the largest) */
+ if(NULL == (hdr->nat_off = H5FL_SEQ_MALLOC(size_t, (size_t)hdr->node_info[0].max_nrec)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
+
+ /* Initialize offsets in native key block */
+ /* (uses leaf # of records because its the largest) */
+ for(u = 0; u < hdr->node_info[0].max_nrec; u++)
+ hdr->nat_off[u] = hdr->cls->nrec_size * u;
+
+ /* Compute size to store # of records in each node */
+ /* (uses leaf # of records because its the largest) */
+ u_max_nrec_size = H5V_limit_enc_size((uint64_t)hdr->node_info[0].max_nrec);
+ H5_ASSIGN_OVERFLOW(/* To: */ hdr->max_nrec_size, /* From: */ u_max_nrec_size, /* From: */ unsigned, /* To: */ uint8_t)
+ HDassert(hdr->max_nrec_size <= H5B2_SIZEOF_RECORDS_PER_NODE);
+
+ /* Initialize internal node info */
+ if(depth > 0) {
+ for(u = 1; u < (unsigned)(depth + 1); u++) {
+ sz_max_nrec = H5B2_NUM_INT_REC(hdr, u);
+ H5_ASSIGN_OVERFLOW(/* To: */ hdr->node_info[u].max_nrec, /* From: */ sz_max_nrec, /* From: */ size_t, /* To: */ unsigned)
+ HDassert(hdr->node_info[u].max_nrec <= hdr->node_info[u - 1].max_nrec);
+
+ hdr->node_info[u].split_nrec = (hdr->node_info[u].max_nrec * hdr->split_percent) / 100;
+ hdr->node_info[u].merge_nrec = (hdr->node_info[u].max_nrec * hdr->merge_percent) / 100;
+
+ hdr->node_info[u].cum_max_nrec = ((hdr->node_info[u].max_nrec + 1) *
+ hdr->node_info[u - 1].cum_max_nrec) + hdr->node_info[u].max_nrec;
+ u_max_nrec_size = H5V_limit_enc_size((uint64_t)hdr->node_info[u].cum_max_nrec);
+ H5_ASSIGN_OVERFLOW(/* To: */ hdr->node_info[u].cum_max_nrec_size, /* From: */ u_max_nrec_size, /* From: */ unsigned, /* To: */ uint8_t)
+
+ if(NULL == (hdr->node_info[u].nat_rec_fac = H5FL_fac_init(hdr->cls->nrec_size * hdr->node_info[u].max_nrec)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't create node native key block factory")
+ if(NULL == (hdr->node_info[u].node_ptr_fac = H5FL_fac_init(sizeof(H5B2_node_ptr_t) * (hdr->node_info[u].max_nrec + 1))))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't create internal 'branch' node node pointer block factory")
+ } /* end for */
+ } /* end if */
+
+done:
+ if(ret_value < 0)
+ if(H5B2_hdr_free(hdr) < 0)
+ HDONE_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to free shared v2 B-tree info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5B2_hdr_init() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5B2_hdr_alloc
+ *
+ * Purpose: Allocate B-tree header
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Oct 27 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+H5B2_hdr_t *
+H5B2_hdr_alloc(H5F_t *f)
+{
+ H5B2_hdr_t *hdr = NULL; /* v2 B-tree header */
+ H5B2_hdr_t *ret_value; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5B2_hdr_alloc)
+
+ /*
+ * Check arguments.
+ */
+ HDassert(f);
+
+ /* Allocate space for the shared information */
+ if(NULL == (hdr = H5FL_CALLOC(H5B2_hdr_t)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for B-tree header")
+
+ /* Assign non-zero information */
+ hdr->f = f;
+ hdr->sizeof_addr = H5F_SIZEOF_ADDR(f);
+ hdr->sizeof_size = H5F_SIZEOF_SIZE(f);
+ hdr->root.addr = HADDR_UNDEF;
+
+ /* Set return value */
+ ret_value = hdr;
+
+done:
+ if(!ret_value && hdr)
+ if(H5B2_hdr_free(hdr) < 0)
+ HDONE_ERROR(H5E_BTREE, H5E_CANTFREE, NULL, "unable to free shared v2 B-tree info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5B2_hdr_alloc() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5HF_hdr_create
+ *
+ * Purpose: Create new fractal heap header
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@ncsa.uiuc.edu
+ * Mar 21 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+haddr_t
+H5B2_hdr_create(H5F_t *f, hid_t dxpl_id, const H5B2_create_t *cparam)
+{
+ H5B2_hdr_t *hdr = NULL; /* The new v2 B-tree header information */
+ haddr_t ret_value; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5B2_hdr_create)
+
+ /*
+ * Check arguments.
+ */
+ HDassert(f);
+ HDassert(cparam);
+
+ /* Allocate v2 B-tree header */
+ if(NULL == (hdr = H5B2_hdr_alloc(f)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, HADDR_UNDEF, "allocation failed for B-tree header")
+
+ /* Initialize shared B-tree info */
+ if(H5B2_hdr_init(f, hdr, cparam, (uint16_t)0) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, HADDR_UNDEF, "can't create shared B-tree info")
+
+ /* Allocate space for the header on disk */
+ if(HADDR_UNDEF == (hdr->addr = H5MF_alloc(f, H5FD_MEM_BTREE, dxpl_id, (hsize_t)H5B2_HEADER_SIZE(hdr))))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, HADDR_UNDEF, "file allocation failed for B-tree header")
+
+ /* Cache the new B-tree node */
+ if(H5AC_set(f, dxpl_id, H5AC_BT2_HDR, hdr->addr, hdr, H5AC__NO_FLAGS_SET) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, HADDR_UNDEF, "can't add B-tree header to cache")
+
+ /* Set address of v2 B-tree header to return */
+ ret_value = hdr->addr;
+
+done:
+ if(!H5F_addr_defined(ret_value) && hdr)
+ if(H5B2_hdr_free(hdr) < 0)
+ HDONE_ERROR(H5E_BTREE, H5E_CANTRELEASE, HADDR_UNDEF, "unable to release v2 B-tree header")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5B2_hdr_create() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5B2_hdr_incr
+ *
+ * Purpose: Increment reference count on B-tree header
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Oct 13 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5B2_hdr_incr(H5B2_hdr_t *hdr)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5B2_hdr_incr)
+
+ /* 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)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTPIN, FAIL, "unable to pin v2 B-tree header")
+
+ /* Increment reference count on B-tree header */
+ hdr->rc++;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5B2_incr_hdr() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5B2_hdr_decr
+ *
+ * Purpose: Decrement reference count on B-tree header
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Oct 13 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5B2_hdr_decr(H5B2_hdr_t *hdr)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5B2_hdr_decr)
+
+ /* Sanity check */
+ HDassert(hdr);
+ HDassert(hdr->f);
+ HDassert(hdr->rc > 0);
+
+ /* Decrement reference count on B-tree header */
+ hdr->rc--;
+
+ /* Mark header as evictable again when no nodes depend on it */
+ if(hdr->rc == 0)
+ if(H5AC_unpin_entry(hdr->f, hdr) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPIN, FAIL, "unable to unpin v2 B-tree header")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5B2_hdr_decr() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5B2_hdr_fuse_incr
+ *
+ * Purpose: Increment file reference count on shared v2 B-tree header
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Oct 27 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5B2_hdr_fuse_incr(H5B2_hdr_t *hdr)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5B2_hdr_fuse_incr)
+
+ /* Sanity check */
+ HDassert(hdr);
+
+ /* Increment file reference count on shared header */
+ hdr->file_rc++;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5B2_hdr_fuse_incr() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5B2_hdr_fuse_decr
+ *
+ * Purpose: Decrement file reference count on shared v2 B-tree header
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Oct 27 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+size_t
+H5B2_hdr_fuse_decr(H5B2_hdr_t *hdr)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5B2_hdr_fuse_decr)
+
+ /* Sanity check */
+ HDassert(hdr);
+ HDassert(hdr->file_rc);
+
+ /* Decrement file reference count on shared header */
+ hdr->file_rc--;
+
+ FUNC_LEAVE_NOAPI(hdr->file_rc)
+} /* end H5B2_hdr_fuse_decr() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5B2_hdr_dirty
+ *
+ * Purpose: Mark B-tree header as dirty
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Oct 13 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5B2_hdr_dirty(H5B2_hdr_t *hdr)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5B2_hdr_dirty)
+
+ /* 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)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTMARKDIRTY, FAIL, "unable to mark v2 B-tree header as dirty")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5B2_hdr_dirty() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5B2_hdr_free
+ *
+ * Purpose: Free B-tree header info
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@ncsa.uiuc.edu
+ * Feb 2 2005
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5B2_hdr_free(H5B2_hdr_t *hdr)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5B2_hdr_free)
+
+ /* Sanity check */
+ HDassert(hdr);
+
+ /* Free the B-tree node buffer */
+ if(hdr->page)
+ (void)H5FL_BLK_FREE(node_page, hdr->page);
+
+ /* Free the array of offsets into the native key block */
+ if(hdr->nat_off)
+ hdr->nat_off = H5FL_SEQ_FREE(size_t, hdr->nat_off);
+
+ /* Release the node info */
+ if(hdr->node_info) {
+ unsigned u; /* Local index variable */
+
+ /* Destroy free list factories */
+ for(u = 0; u < (unsigned)(hdr->depth + 1); u++) {
+ if(hdr->node_info[u].nat_rec_fac)
+ if(H5FL_fac_term(hdr->node_info[u].nat_rec_fac) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTRELEASE, FAIL, "can't destroy node's native record block factory")
+ if(hdr->node_info[u].node_ptr_fac)
+ if(H5FL_fac_term(hdr->node_info[u].node_ptr_fac) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTRELEASE, FAIL, "can't destroy node's node pointer block factory")
+ } /* end for */
+
+ /* Free the array of node info structs */
+ hdr->node_info = H5FL_SEQ_FREE(H5B2_node_info_t, hdr->node_info);
+ } /* end if */
+
+ /* Free B-tree header info */
+ (void)H5FL_FREE(H5B2_hdr_t, hdr);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5B2_hdr_free() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5B2_hdr_delete
+ *
+ * Purpose: Delete a v2 B-tree, starting with the header
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Oct 15 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5B2_hdr_delete(H5B2_hdr_t *hdr, hid_t dxpl_id)
+{
+ unsigned cache_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting v2 B-tree header */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5B2_hdr_delete, FAIL)
+
+ /* Sanity check */
+ HDassert(hdr);
+
+#ifndef NDEBUG
+{
+ unsigned hdr_status = 0; /* v2 B-tree header's status in the metadata cache */
+
+ /* Check the v2 B-tree header's status in the metadata cache */
+ if(H5AC_get_entry_status(hdr->f, hdr->addr, &hdr_status) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "unable to check metadata cache status for v2 B-tree header")
+
+ /* Sanity checks on v2 B-tree header */
+ HDassert(hdr_status & H5AC_ES__IN_CACHE);
+ HDassert(hdr_status & H5AC_ES__IS_PROTECTED);
+} /* end block */
+#endif /* NDEBUG */
+
+ /* Delete all nodes in B-tree */
+ if(H5F_addr_defined(hdr->root.addr))
+ if(H5B2_delete_node(hdr, dxpl_id, hdr->depth, &hdr->root, hdr->remove_op, hdr->remove_op_data) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to delete B-tree nodes")
+
+ /* Indicate that the heap header should be deleted & file space freed */
+ cache_flags |= H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG;
+
+done:
+ /* Unprotect the header with appropriate flags */
+ if(hdr && H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_HDR, hdr->addr, hdr, cache_flags) < 0)
+ HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree header")
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5B2_hdr_delete() */
+
diff --git a/src/H5B2int.c b/src/H5B2int.c
index 550a5b6..f7312a5 100644
--- a/src/H5B2int.c
+++ b/src/H5B2int.c
@@ -43,15 +43,6 @@
/* Local Macros */
/****************/
-/* Number of records that fit into internal node */
-/* (accounts for extra node pointer by counting it in with the prefix bytes) */
-#define H5B2_NUM_INT_REC(f, s, d) \
- (((s)->node_size - (H5B2_INT_PREFIX_SIZE + H5B2_INT_POINTER_SIZE(f, s, d))) / ((s)->rrec_size + H5B2_INT_POINTER_SIZE(f, s, d)))
-
-/* Number of records that fit into leaf node */
-#define H5B2_NUM_LEAF_REC(n, r) \
- (((n) - H5B2_LEAF_PREFIX_SIZE) / (r))
-
/* Uncomment this macro to enable extra sanity checking */
/* #define H5B2_DEBUG */
@@ -70,30 +61,29 @@
/********************/
/* Helper functions */
-static herr_t H5B2_shared_free(void *_shared);
-static herr_t H5B2_create_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
+static herr_t H5B2_create_internal(H5B2_hdr_t *hdr, hid_t dxpl_id,
H5B2_node_ptr_t *node_ptr, unsigned depth);
-static herr_t H5B2_split1(H5F_t *f, hid_t dxpl_id, unsigned depth,
+static herr_t H5B2_split1(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth,
H5B2_node_ptr_t *curr_node_ptr, unsigned *parent_cache_info_flags_ptr,
H5B2_internal_t *internal, unsigned *internal_flags_ptr, unsigned idx);
-static herr_t H5B2_redistribute2(H5F_t *f, hid_t dxpl_id, unsigned depth,
+static herr_t H5B2_redistribute2(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth,
H5B2_internal_t *internal, unsigned idx);
-static herr_t H5B2_redistribute3(H5F_t *f, hid_t dxpl_id, unsigned depth,
+static herr_t H5B2_redistribute3(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth,
H5B2_internal_t *internal, unsigned *internal_flags_ptr, unsigned idx);
-static herr_t H5B2_merge2(H5F_t *f, hid_t dxpl_id, unsigned depth,
+static herr_t H5B2_merge2(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth,
H5B2_node_ptr_t *curr_node_ptr, unsigned *parent_cache_info_flags_ptr,
H5B2_internal_t *internal, unsigned *internal_flags_ptr, unsigned idx);
-static herr_t H5B2_merge3(H5F_t *f, hid_t dxpl_id, unsigned depth,
+static herr_t H5B2_merge3(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth,
H5B2_node_ptr_t *curr_node_ptr, unsigned *parent_cache_info_flags_ptr,
H5B2_internal_t *internal, unsigned *internal_flags_ptr, unsigned idx);
-static herr_t H5B2_swap_leaf(H5F_t *f, hid_t dxpl_id, unsigned depth,
+static herr_t H5B2_swap_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth,
H5B2_internal_t *internal, unsigned *internal_flags_ptr,
unsigned idx, void *swap_loc);
#ifdef H5B2_DEBUG
-static herr_t H5B2_assert_leaf(H5B2_shared_t *shared, H5B2_leaf_t *leaf);
-static herr_t H5B2_assert_leaf2(H5B2_shared_t *shared, H5B2_leaf_t *leaf, H5B2_leaf_t *leaf2);
-static herr_t H5B2_assert_internal(hsize_t parent_all_nrec, H5B2_shared_t *shared, H5B2_internal_t *internal);
-static herr_t H5B2_assert_internal2(hsize_t parent_all_nrec, H5B2_shared_t *shared, H5B2_internal_t *internal, H5B2_internal_t *internal2);
+static herr_t H5B2_assert_leaf(H5B2_hdr_t *hdr, H5B2_leaf_t *leaf);
+static herr_t H5B2_assert_leaf2(H5B2_hdr_t *hdr, H5B2_leaf_t *leaf, H5B2_leaf_t *leaf2);
+static herr_t H5B2_assert_internal(hsize_t parent_all_nrec, H5B2_hdr_t *hdr, H5B2_internal_t *internal);
+static herr_t H5B2_assert_internal2(hsize_t parent_all_nrec, H5B2_hdr_t *hdr, H5B2_internal_t *internal, H5B2_internal_t *internal2);
#endif /* H5B2_DEBUG */
/*********************/
@@ -116,194 +106,12 @@ H5FL_DEFINE(H5B2_leaf_t);
/* Local Variables */
/*******************/
-/* Declare a free list to manage B-tree node pages to/from disk */
-H5FL_BLK_DEFINE_STATIC(node_page);
-
-/* Declare a free list to manage the 'size_t' sequence information */
-H5FL_SEQ_DEFINE_STATIC(size_t);
-
/* Declare a free list to manage the 'H5B2_node_info_t' sequence information */
-H5FL_SEQ_DEFINE_STATIC(H5B2_node_info_t);
-
-/* Declare a free list to manage the H5B2_shared_t struct */
-H5FL_DEFINE_STATIC(H5B2_shared_t);
+H5FL_SEQ_EXTERN(H5B2_node_info_t);
/*-------------------------------------------------------------------------
- * Function: H5B2_shared_init
- *
- * Purpose: Allocate & initialize shared B-tree info
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Feb 2 2005
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5B2_shared_init (H5F_t *f, H5B2_t *bt2, const H5B2_class_t *type,
- unsigned depth, size_t node_size, size_t rrec_size,
- unsigned split_percent, unsigned merge_percent)
-{
- H5B2_shared_t *shared = NULL; /* Shared B-tree information */
- size_t sz_max_nrec; /* Temporary variable for range checking */
- unsigned u_max_nrec_size; /* Temporary variable for range checking */
- unsigned u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT(H5B2_shared_init)
-
- /* Allocate space for the shared information */
- if(NULL == (shared = H5FL_CALLOC(H5B2_shared_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree shared information")
-
- /* Assign dynamic information */
- shared->depth = depth;
-
- /* Assign user's information */
- shared->split_percent = split_percent;
- shared->merge_percent = merge_percent;
- shared->node_size = node_size;
- shared->rrec_size = rrec_size;
-
- /* Assign common type information */
- shared->type = type;
-
- /* Allocate "page" for node I/O */
- if((shared->page = H5FL_BLK_MALLOC(node_page, shared->node_size)) == NULL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
-#ifdef H5_CLEAR_MEMORY
-HDmemset(shared->page, 0, shared->node_size);
-#endif /* H5_CLEAR_MEMORY */
-
- /* Allocate array of node info structs */
- if((shared->node_info = H5FL_SEQ_MALLOC(H5B2_node_info_t, (size_t)(shared->depth + 1))) == NULL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
-
- /* Initialize leaf node info */
- sz_max_nrec = H5B2_NUM_LEAF_REC(shared->node_size, shared->rrec_size);
- H5_ASSIGN_OVERFLOW(/* To: */ shared->node_info[0].max_nrec, /* From: */ sz_max_nrec, /* From: */ size_t, /* To: */ unsigned)
- shared->node_info[0].split_nrec = (shared->node_info[0].max_nrec * shared->split_percent) / 100;
- shared->node_info[0].merge_nrec = (shared->node_info[0].max_nrec * shared->merge_percent) / 100;
- shared->node_info[0].cum_max_nrec = shared->node_info[0].max_nrec;
- shared->node_info[0].cum_max_nrec_size = 0;
- if((shared->node_info[0].nat_rec_fac = H5FL_fac_init(type->nrec_size * shared->node_info[0].max_nrec)) == NULL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't create node native key block factory")
- shared->node_info[0].node_ptr_fac = NULL;
-
- /* Allocate array of pointers to internal node native keys */
- /* (uses leaf # of records because its the largest) */
- if((shared->nat_off = H5FL_SEQ_MALLOC(size_t, (size_t)shared->node_info[0].max_nrec)) == NULL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
-
- /* Initialize offsets in native key block */
- /* (uses leaf # of records because its the largest) */
- for(u = 0; u < shared->node_info[0].max_nrec; u++)
- shared->nat_off[u] = type->nrec_size * u;
-
- /* Compute size to store # of records in each node */
- /* (uses leaf # of records because its the largest) */
- u_max_nrec_size = H5V_limit_enc_size((uint64_t)shared->node_info[0].max_nrec);
- H5_ASSIGN_OVERFLOW(/* To: */ shared->max_nrec_size, /* From: */ u_max_nrec_size, /* From: */ unsigned, /* To: */ uint8_t)
- HDassert(shared->max_nrec_size <= H5B2_SIZEOF_RECORDS_PER_NODE);
-
- /* Initialize internal node info */
- if(depth > 0) {
- for(u = 1; u < (depth + 1); u++) {
- sz_max_nrec = H5B2_NUM_INT_REC(f, shared, u);
- H5_ASSIGN_OVERFLOW(/* To: */ shared->node_info[u].max_nrec, /* From: */ sz_max_nrec, /* From: */ size_t, /* To: */ unsigned)
- HDassert(shared->node_info[u].max_nrec <= shared->node_info[u - 1].max_nrec);
-
- shared->node_info[u].split_nrec = (shared->node_info[u].max_nrec * shared->split_percent) / 100;
- shared->node_info[u].merge_nrec = (shared->node_info[u].max_nrec * shared->merge_percent) / 100;
-
- shared->node_info[u].cum_max_nrec = ((shared->node_info[u].max_nrec + 1) *
- shared->node_info[u - 1].cum_max_nrec) + shared->node_info[u].max_nrec;
- u_max_nrec_size = H5V_limit_enc_size((uint64_t)shared->node_info[u].cum_max_nrec);
- H5_ASSIGN_OVERFLOW(/* To: */ shared->node_info[u].cum_max_nrec_size, /* From: */ u_max_nrec_size, /* From: */ unsigned, /* To: */ uint8_t)
-
- if((shared->node_info[u].nat_rec_fac = H5FL_fac_init(shared->type->nrec_size * shared->node_info[u].max_nrec)) == NULL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't create node native key block factory")
- if((shared->node_info[u].node_ptr_fac = H5FL_fac_init(sizeof(H5B2_node_ptr_t) * (shared->node_info[u].max_nrec + 1))) == NULL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't create internal 'branch' node node pointer block factory")
- } /* end for */
- } /* end if */
-
- /* Make shared B-tree info reference counted */
- if(NULL == (bt2->shared = H5RC_create(shared, H5B2_shared_free)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't create ref-count wrapper for shared B-tree info")
-
-done:
- if(ret_value < 0)
- if(shared)
- H5B2_shared_free(shared);
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5B2_shared_init() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5B2_shared_free
- *
- * Purpose: Free shared B-tree info
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Feb 2 2005
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5B2_shared_free(void *_shared)
-{
- H5B2_shared_t *shared = (H5B2_shared_t *)_shared;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI_NOINIT(H5B2_shared_free)
-
- /* Sanity check */
- HDassert(shared);
-
- /* Free the B-tree node buffer */
- if(shared->page)
- (void)H5FL_BLK_FREE(node_page, shared->page);
-
- /* Free the array of offsets into the native key block */
- if(shared->nat_off)
- shared->nat_off = H5FL_SEQ_FREE(size_t, shared->nat_off);
-
- /* Release the node info */
- if(shared->node_info) {
- unsigned u; /* Local index variable */
-
- /* Destroy free list factories */
- for(u = 0; u < (shared->depth + 1); u++) {
- if(shared->node_info[u].nat_rec_fac)
- if(H5FL_fac_term(shared->node_info[u].nat_rec_fac) < 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't destroy node's native record block factory")
- if(shared->node_info[u].node_ptr_fac)
- if(H5FL_fac_term(shared->node_info[u].node_ptr_fac) < 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't destroy node's node pointer block factory")
- } /* end for */
-
- /* Free the array of node info structs */
- shared->node_info = H5FL_SEQ_FREE(H5B2_node_info_t, shared->node_info);
- } /* end if */
-
- /* Free the shared B-tree info itself */
- shared = H5FL_FREE(H5B2_shared_t, shared);
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5B2_shared_free() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5B2_locate_record
*
* Purpose: Performs a binary search to locate a record in a sorted
@@ -345,7 +153,7 @@ H5B2_locate_record(const H5B2_class_t *type, unsigned nrec, size_t *rec_off,
*idx = my_idx;
- FUNC_LEAVE_NOAPI(cmp);
+ FUNC_LEAVE_NOAPI(cmp)
} /* end H5B2_locate_record */
@@ -364,35 +172,30 @@ H5B2_locate_record(const H5B2_class_t *type, unsigned nrec, size_t *rec_off,
*-------------------------------------------------------------------------
*/
static herr_t
-H5B2_split1(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_node_ptr_t *curr_node_ptr,
+H5B2_split1(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, H5B2_node_ptr_t *curr_node_ptr,
unsigned *parent_cache_info_flags_ptr, H5B2_internal_t *internal,
unsigned *internal_flags_ptr, unsigned idx)
{
const H5AC_class_t *child_class; /* Pointer to child node's class info */
haddr_t left_addr, right_addr; /* Addresses of left & right child nodes */
void *left_child, *right_child; /* Pointers to child nodes */
- unsigned *left_nrec, *right_nrec; /* Pointers to child # of records */
+ uint16_t *left_nrec, *right_nrec; /* Pointers to child # of records */
uint8_t *left_native, *right_native;/* Pointers to childs' native records */
- H5B2_node_ptr_t *left_node_ptrs=NULL, *right_node_ptrs=NULL;/* Pointers to childs' node pointer info */
- H5B2_shared_t *shared; /* B-tree's shared info */
- unsigned mid_record; /* Index of "middle" record in current node */
- unsigned old_node_nrec; /* Number of records in internal node split */
+ H5B2_node_ptr_t *left_node_ptrs = NULL, *right_node_ptrs = NULL;/* Pointers to childs' node pointer info */
+ uint16_t mid_record; /* Index of "middle" record in current node */
+ uint16_t old_node_nrec; /* Number of records in internal node split */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5B2_split1)
- HDassert(f);
- HDassert(parent_cache_info_flags_ptr);
+ /* Check arguments. */
+ HDassert(hdr);
HDassert(internal);
HDassert(internal_flags_ptr);
- /* Get the pointer to the shared B-tree info */
- shared = (H5B2_shared_t *)H5RC_GET_OBJ(internal->shared);
- HDassert(shared);
-
/* Slide records in parent node up one space, to make room for promoted record */
if(idx < internal->nrec) {
- HDmemmove(H5B2_INT_NREC(internal, shared, idx + 1), H5B2_INT_NREC(internal, shared, idx), shared->type->nrec_size * (internal->nrec - idx));
+ HDmemmove(H5B2_INT_NREC(internal, hdr, idx + 1), H5B2_INT_NREC(internal, hdr, idx), hdr->cls->nrec_size * (internal->nrec - idx));
HDmemmove(&(internal->node_ptrs[idx + 2]), &(internal->node_ptrs[idx + 1]), sizeof(H5B2_node_ptr_t) * (internal->nrec - idx));
} /* end if */
@@ -402,7 +205,7 @@ H5B2_split1(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_node_ptr_t *curr_node_
/* Create new internal node */
internal->node_ptrs[idx + 1].all_nrec = internal->node_ptrs[idx + 1].node_nrec = 0;
- if(H5B2_create_internal(f, dxpl_id, internal->shared, &(internal->node_ptrs[idx + 1]), (depth - 1)) < 0)
+ if(H5B2_create_internal(hdr, dxpl_id, &(internal->node_ptrs[idx + 1]), (depth - 1)) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to create new internal node")
/* Setup information for unlocking child nodes */
@@ -411,9 +214,9 @@ H5B2_split1(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_node_ptr_t *curr_node_
right_addr = internal->node_ptrs[idx + 1].addr;
/* Protect both leafs */
- if(NULL == (left_int = H5B2_protect_internal(f, dxpl_id, internal->shared, left_addr, internal->node_ptrs[idx].node_nrec, (depth - 1), H5AC_WRITE)))
+ if(NULL == (left_int = H5B2_protect_internal(hdr, dxpl_id, left_addr, internal->node_ptrs[idx].node_nrec, (depth - 1), H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
- if(NULL == (right_int = H5B2_protect_internal(f, dxpl_id, internal->shared, right_addr, internal->node_ptrs[idx + 1].node_nrec, (depth - 1), H5AC_WRITE)))
+ if(NULL == (right_int = H5B2_protect_internal(hdr, dxpl_id, right_addr, internal->node_ptrs[idx + 1].node_nrec, (depth - 1), H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
/* More setup for child nodes */
@@ -431,7 +234,7 @@ H5B2_split1(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_node_ptr_t *curr_node_
/* Create new leaf node */
internal->node_ptrs[idx + 1].all_nrec = internal->node_ptrs[idx + 1].node_nrec = 0;
- if(H5B2_create_leaf(f, dxpl_id, internal->shared, &(internal->node_ptrs[idx + 1])) < 0)
+ if(H5B2_create_leaf(hdr, dxpl_id, &(internal->node_ptrs[idx + 1])) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to create new leaf node")
/* Setup information for unlocking child nodes */
@@ -440,9 +243,9 @@ H5B2_split1(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_node_ptr_t *curr_node_
right_addr = internal->node_ptrs[idx + 1].addr;
/* Protect both leafs */
- if(NULL == (left_leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, child_class, left_addr, &(internal->node_ptrs[idx].node_nrec), internal->shared, H5AC_WRITE)))
+ if(NULL == (left_leaf = (H5B2_leaf_t *)H5AC_protect(hdr->f, dxpl_id, child_class, left_addr, &(internal->node_ptrs[idx].node_nrec), hdr, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
- if(NULL == (right_leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, child_class, right_addr, &(internal->node_ptrs[idx + 1].node_nrec), internal->shared, H5AC_WRITE)))
+ if(NULL == (right_leaf = (H5B2_leaf_t *)H5AC_protect(hdr->f, dxpl_id, child_class, right_addr, &(internal->node_ptrs[idx + 1].node_nrec), hdr, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
/* More setup for child nodes */
@@ -461,21 +264,21 @@ H5B2_split1(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_node_ptr_t *curr_node_
mid_record = old_node_nrec / 2;
/* Copy "upper half" of records to new child */
- HDmemcpy(H5B2_NAT_NREC(right_native, shared, 0),
- H5B2_NAT_NREC(left_native, shared, mid_record + 1),
- shared->type->nrec_size * (old_node_nrec - (mid_record + 1)));
+ HDmemcpy(H5B2_NAT_NREC(right_native, hdr, 0),
+ H5B2_NAT_NREC(left_native, hdr, mid_record + (unsigned)1),
+ hdr->cls->nrec_size * (old_node_nrec - (mid_record + (unsigned)1)));
/* Copy "upper half" of node pointers, if the node is an internal node */
if(depth > 1)
- HDmemcpy(&(right_node_ptrs[0]), &(left_node_ptrs[mid_record + 1]),
+ HDmemcpy(&(right_node_ptrs[0]), &(left_node_ptrs[mid_record + (unsigned)1]),
sizeof(H5B2_node_ptr_t) * (old_node_nrec - mid_record));
/* Copy "middle" record to internal node */
- HDmemcpy(H5B2_INT_NREC(internal, shared, idx), H5B2_NAT_NREC(left_native, shared, mid_record), shared->type->nrec_size);
+ HDmemcpy(H5B2_INT_NREC(internal, hdr, idx), H5B2_NAT_NREC(left_native, hdr, mid_record), hdr->cls->nrec_size);
/* Update record counts in child nodes */
internal->node_ptrs[idx].node_nrec = *left_nrec = mid_record;
- internal->node_ptrs[idx + 1].node_nrec = *right_nrec = old_node_nrec - (mid_record + 1);
+ internal->node_ptrs[idx + 1].node_nrec = *right_nrec = old_node_nrec - (mid_record + (unsigned)1);
/* Determine total number of records in new child nodes */
if(depth > 1) {
@@ -485,11 +288,11 @@ H5B2_split1(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_node_ptr_t *curr_node_
/* Compute total of all records in each child node */
new_left_all_nrec = internal->node_ptrs[idx].node_nrec;
- for(u = 0; u < (*left_nrec + 1); u++)
+ for(u = 0; u < (*left_nrec + (unsigned)1); u++)
new_left_all_nrec += left_node_ptrs[u].all_nrec;
new_right_all_nrec = internal->node_ptrs[idx + 1].node_nrec;
- for(u = 0; u < (*right_nrec + 1); u++)
+ for(u = 0; u < (*right_nrec + (unsigned)1); u++)
new_right_all_nrec += right_node_ptrs[u].all_nrec;
internal->node_ptrs[idx].all_nrec = new_left_all_nrec;
@@ -509,29 +312,30 @@ H5B2_split1(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_node_ptr_t *curr_node_
/* Update grandparent info */
curr_node_ptr->node_nrec++;
- /* Mark grandparent as dirty */
- *parent_cache_info_flags_ptr |= H5AC__DIRTIED_FLAG;
+ /* Mark grandparent as dirty, if given */
+ if(parent_cache_info_flags_ptr)
+ *parent_cache_info_flags_ptr |= H5AC__DIRTIED_FLAG;
#ifdef H5B2_DEBUG
- H5B2_assert_internal((hsize_t)0,shared,internal);
+ H5B2_assert_internal((hsize_t)0, hdr, internal);
if(depth > 1) {
- H5B2_assert_internal2(internal->node_ptrs[idx].all_nrec, shared, left_child, right_child);
- H5B2_assert_internal2(internal->node_ptrs[idx + 1].all_nrec, shared, right_child, left_child);
+ H5B2_assert_internal2(internal->node_ptrs[idx].all_nrec, hdr, left_child, right_child);
+ H5B2_assert_internal2(internal->node_ptrs[idx + 1].all_nrec, hdr, right_child, left_child);
} /* end if */
else {
- H5B2_assert_leaf2(shared, left_child, right_child);
- H5B2_assert_leaf(shared, right_child);
+ H5B2_assert_leaf2(hdr, left_child, right_child);
+ H5B2_assert_leaf(hdr, right_child);
} /* end else */
#endif /* H5B2_DEBUG */
/* Release child nodes (marked as dirty) */
- if(H5AC_unprotect(f, dxpl_id, child_class, left_addr, left_child, H5AC__DIRTIED_FLAG) < 0)
+ if(H5AC_unprotect(hdr->f, dxpl_id, child_class, left_addr, left_child, H5AC__DIRTIED_FLAG) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree leaf node")
- if(H5AC_unprotect(f, dxpl_id, child_class, right_addr, right_child, H5AC__DIRTIED_FLAG) < 0)
+ if(H5AC_unprotect(hdr->f, dxpl_id, child_class, right_addr, right_child, H5AC__DIRTIED_FLAG) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree leaf node")
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B2_split1 */
@@ -541,7 +345,6 @@ done:
* Purpose: Split the root node
*
* Return: Success: Non-negative
- *
* Failure: Negative
*
* Programmer: Quincey Koziol
@@ -551,10 +354,9 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5B2_split_root(H5F_t *f, hid_t dxpl_id, H5B2_t *bt2, unsigned *bt2_flags_ptr)
+H5B2_split_root(H5B2_hdr_t *hdr, hid_t dxpl_id)
{
H5B2_internal_t *new_root; /* Pointer to new root node */
- H5B2_shared_t *shared; /* Pointer to B-tree's shared information */
unsigned new_root_flags = H5AC__NO_FLAGS_SET; /* Cache flags for new root node */
H5B2_node_ptr_t old_root_ptr; /* Old node pointer to root node in B-tree */
size_t sz_max_nrec; /* Temporary variable for range checking */
@@ -563,61 +365,56 @@ H5B2_split_root(H5F_t *f, hid_t dxpl_id, H5B2_t *bt2, unsigned *bt2_flags_ptr)
FUNC_ENTER_NOAPI_NOINIT(H5B2_split_root)
- HDassert(f);
- HDassert(bt2);
- HDassert(bt2_flags_ptr);
-
- /* Get the pointer to the shared B-tree info */
- shared = (H5B2_shared_t *)H5RC_GET_OBJ(bt2->shared);
- HDassert(shared);
+ /* Check arguments. */
+ HDassert(hdr);
/* Update depth of B-tree */
- shared->depth++;
+ hdr->depth++;
/* Re-allocate array of node info structs */
- if((shared->node_info = H5FL_SEQ_REALLOC(H5B2_node_info_t, shared->node_info, (size_t)(shared->depth + 1))) == NULL)
+ if(NULL == (hdr->node_info = H5FL_SEQ_REALLOC(H5B2_node_info_t, hdr->node_info, (size_t)(hdr->depth + 1))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
/* Update node info for new depth of tree */
- sz_max_nrec = H5B2_NUM_INT_REC(f, shared, shared->depth);
- H5_ASSIGN_OVERFLOW(/* To: */ shared->node_info[shared->depth].max_nrec, /* From: */ sz_max_nrec, /* From: */ size_t, /* To: */ unsigned)
- shared->node_info[shared->depth].split_nrec = (shared->node_info[shared->depth].max_nrec * shared->split_percent) / 100;
- shared->node_info[shared->depth].merge_nrec = (shared->node_info[shared->depth].max_nrec * shared->merge_percent) / 100;
- shared->node_info[shared->depth].cum_max_nrec = ((shared->node_info[shared->depth].max_nrec + 1) *
- shared->node_info[shared->depth - 1].cum_max_nrec) + shared->node_info[shared->depth].max_nrec;
- u_max_nrec_size = H5V_limit_enc_size((uint64_t)shared->node_info[shared->depth].cum_max_nrec);
- H5_ASSIGN_OVERFLOW(/* To: */ shared->node_info[shared->depth].cum_max_nrec_size, /* From: */ u_max_nrec_size, /* From: */ unsigned, /* To: */ uint8_t)
- if((shared->node_info[shared->depth].nat_rec_fac = H5FL_fac_init(shared->type->nrec_size * shared->node_info[shared->depth].max_nrec)) == NULL)
+ sz_max_nrec = H5B2_NUM_INT_REC(hdr, hdr->depth);
+ H5_ASSIGN_OVERFLOW(/* To: */ hdr->node_info[hdr->depth].max_nrec, /* From: */ sz_max_nrec, /* From: */ size_t, /* To: */ unsigned)
+ hdr->node_info[hdr->depth].split_nrec = (hdr->node_info[hdr->depth].max_nrec * hdr->split_percent) / 100;
+ hdr->node_info[hdr->depth].merge_nrec = (hdr->node_info[hdr->depth].max_nrec * hdr->merge_percent) / 100;
+ hdr->node_info[hdr->depth].cum_max_nrec = ((hdr->node_info[hdr->depth].max_nrec + 1) *
+ hdr->node_info[hdr->depth - 1].cum_max_nrec) + hdr->node_info[hdr->depth].max_nrec;
+ u_max_nrec_size = H5V_limit_enc_size((uint64_t)hdr->node_info[hdr->depth].cum_max_nrec);
+ H5_ASSIGN_OVERFLOW(/* To: */ hdr->node_info[hdr->depth].cum_max_nrec_size, /* From: */ u_max_nrec_size, /* From: */ unsigned, /* To: */ uint8_t)
+ if(NULL == (hdr->node_info[hdr->depth].nat_rec_fac = H5FL_fac_init(hdr->cls->nrec_size * hdr->node_info[hdr->depth].max_nrec)))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't create node native key block factory")
- if((shared->node_info[shared->depth].node_ptr_fac = H5FL_fac_init(sizeof(H5B2_node_ptr_t) * (shared->node_info[shared->depth].max_nrec + 1))) == NULL)
+ if(NULL == (hdr->node_info[hdr->depth].node_ptr_fac = H5FL_fac_init(sizeof(H5B2_node_ptr_t) * (hdr->node_info[hdr->depth].max_nrec + 1))))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't create internal 'branch' node node pointer block factory")
/* Keep old root node pointer info */
- old_root_ptr = bt2->root;
+ old_root_ptr = hdr->root;
/* Create new internal node to use as root */
- bt2->root.node_nrec = 0;
- if(H5B2_create_internal(f, dxpl_id, bt2->shared, &(bt2->root), shared->depth) < 0)
+ hdr->root.node_nrec = 0;
+ if(H5B2_create_internal(hdr, dxpl_id, &(hdr->root), hdr->depth) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to create new internal node")
/* Protect new root node */
- if(NULL == (new_root = H5B2_protect_internal(f, dxpl_id, bt2->shared, bt2->root.addr, bt2->root.node_nrec, shared->depth, H5AC_WRITE)))
+ if(NULL == (new_root = H5B2_protect_internal(hdr, dxpl_id, hdr->root.addr, hdr->root.node_nrec, hdr->depth, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
/* Set first node pointer in root node to old root node pointer info */
new_root->node_ptrs[0] = old_root_ptr;
/* Split original root node */
- if(H5B2_split1(f, dxpl_id, shared->depth, &(bt2->root), bt2_flags_ptr, new_root, &new_root_flags, 0) < 0)
+ if(H5B2_split1(hdr, dxpl_id, hdr->depth, &(hdr->root), NULL, new_root, &new_root_flags, 0) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to split old root node")
/* Release new root node (marked as dirty) */
- if(H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, bt2->root.addr, new_root, new_root_flags) < 0)
+ if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_INT, hdr->root.addr, new_root, new_root_flags) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree internal node")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5B2_split_root */
+} /* end H5B2_split_root() */
/*-------------------------------------------------------------------------
@@ -626,7 +423,6 @@ done:
* Purpose: Redistribute records between two nodes
*
* Return: Success: Non-negative
- *
* Failure: Negative
*
* Programmer: Quincey Koziol
@@ -636,27 +432,24 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5B2_redistribute2(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_internal_t *internal, unsigned idx)
+H5B2_redistribute2(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth,
+ H5B2_internal_t *internal, unsigned idx)
{
const H5AC_class_t *child_class; /* Pointer to child node's class info */
haddr_t left_addr, right_addr; /* Addresses of left & right child nodes */
void *left_child, *right_child; /* Pointers to child nodes */
- unsigned *left_nrec, *right_nrec; /* Pointers to child # of records */
+ uint16_t *left_nrec, *right_nrec; /* Pointers to child # of records */
uint8_t *left_native, *right_native; /* Pointers to childs' native records */
- H5B2_node_ptr_t *left_node_ptrs=NULL, *right_node_ptrs=NULL;/* Pointers to childs' node pointer info */
- H5B2_shared_t *shared; /* B-tree's shared info */
- hssize_t left_moved_nrec=0, right_moved_nrec=0; /* Number of records moved, for internal redistrib */
- herr_t ret_value=SUCCEED; /* Return value */
+ H5B2_node_ptr_t *left_node_ptrs = NULL, *right_node_ptrs = NULL;/* Pointers to childs' node pointer info */
+ hssize_t left_moved_nrec = 0, right_moved_nrec = 0; /* Number of records moved, for internal redistrib */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5B2_redistribute2)
- HDassert(f);
+ /* Check arguments. */
+ HDassert(hdr);
HDassert(internal);
- /* Get the pointer to the shared B-tree info */
- shared=(H5B2_shared_t *)H5RC_GET_OBJ(internal->shared);
- HDassert(shared);
-
/* Check for the kind of B-tree node to redistribute */
if(depth > 1) {
H5B2_internal_t *left_internal; /* Pointer to left internal node */
@@ -665,12 +458,12 @@ H5B2_redistribute2(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_internal_t *int
/* Setup information for unlocking child nodes */
child_class = H5AC_BT2_INT;
left_addr = internal->node_ptrs[idx].addr;
- right_addr = internal->node_ptrs[idx+1].addr;
+ right_addr = internal->node_ptrs[idx + 1].addr;
/* Lock left & right B-tree child nodes */
- if (NULL == (left_internal = H5B2_protect_internal(f, dxpl_id, internal->shared, left_addr, internal->node_ptrs[idx].node_nrec, (depth - 1), H5AC_WRITE)))
+ if(NULL == (left_internal = H5B2_protect_internal(hdr, dxpl_id, left_addr, internal->node_ptrs[idx].node_nrec, (depth - 1), H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
- if (NULL == (right_internal = H5B2_protect_internal(f, dxpl_id, internal->shared, right_addr, internal->node_ptrs[idx+1].node_nrec, (depth - 1), H5AC_WRITE)))
+ if(NULL == (right_internal = H5B2_protect_internal(hdr, dxpl_id, right_addr, internal->node_ptrs[idx + 1].node_nrec, (depth - 1), H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
/* More setup for child nodes */
@@ -690,12 +483,12 @@ H5B2_redistribute2(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_internal_t *int
/* Setup information for unlocking child nodes */
child_class = H5AC_BT2_LEAF;
left_addr = internal->node_ptrs[idx].addr;
- right_addr = internal->node_ptrs[idx+1].addr;
+ right_addr = internal->node_ptrs[idx + 1].addr;
/* Lock left & right B-tree child nodes */
- if (NULL == (left_leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, child_class, left_addr, &(internal->node_ptrs[idx].node_nrec), internal->shared, H5AC_WRITE)))
+ if(NULL == (left_leaf = (H5B2_leaf_t *)H5AC_protect(hdr->f, dxpl_id, child_class, left_addr, &(internal->node_ptrs[idx].node_nrec), hdr, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
- if (NULL == (right_leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, child_class, right_addr, &(internal->node_ptrs[idx+1].node_nrec), internal->shared, H5AC_WRITE)))
+ if(NULL == (right_leaf = (H5B2_leaf_t *)H5AC_protect(hdr->f, dxpl_id, child_class, right_addr, &(internal->node_ptrs[idx + 1].node_nrec), hdr, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
/* More setup for child nodes */
@@ -708,14 +501,14 @@ H5B2_redistribute2(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_internal_t *int
} /* end else */
#ifdef H5B2_DEBUG
- H5B2_assert_internal((hsize_t)0,shared,internal);
- if(depth>1) {
- H5B2_assert_internal2(internal->node_ptrs[idx].all_nrec,shared,left_child,right_child);
- H5B2_assert_internal2(internal->node_ptrs[idx+1].all_nrec,shared,right_child,left_child);
+ H5B2_assert_internal((hsize_t)0, hdr, internal);
+ if(depth > 1) {
+ H5B2_assert_internal2(internal->node_ptrs[idx].all_nrec, hdr, left_child, right_child);
+ H5B2_assert_internal2(internal->node_ptrs[idx + 1].all_nrec, hdr, right_child, left_child);
} /* end if */
else {
- H5B2_assert_leaf2(shared,left_child,right_child);
- H5B2_assert_leaf(shared,right_child);
+ H5B2_assert_leaf2(hdr, left_child, right_child);
+ H5B2_assert_leaf(hdr, right_child);
} /* end else */
#endif /* H5B2_DEBUG */
@@ -723,24 +516,24 @@ H5B2_redistribute2(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_internal_t *int
if(*left_nrec < *right_nrec) {
/* Moving record from right node to left */
- unsigned new_right_nrec = (*left_nrec + *right_nrec) / 2; /* New number of records for right child */
- unsigned move_nrec = *right_nrec - new_right_nrec; /* Number of records to move from right node to left */
+ uint16_t new_right_nrec = (*left_nrec + *right_nrec) / 2; /* New number of records for right child */
+ uint16_t move_nrec = *right_nrec - new_right_nrec; /* Number of records to move from right node to left */
/* Copy record from parent node down into left child */
- HDmemcpy(H5B2_NAT_NREC(left_native,shared,*left_nrec),H5B2_INT_NREC(internal,shared,idx),shared->type->nrec_size);
+ HDmemcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec), H5B2_INT_NREC(internal, hdr, idx), hdr->cls->nrec_size);
/* See if we need to move records from right node */
- if(move_nrec>1)
- HDmemcpy(H5B2_NAT_NREC(left_native,shared,(*left_nrec+1)),H5B2_NAT_NREC(right_native,shared,0),shared->type->nrec_size*(move_nrec-1));
+ if(move_nrec > 1)
+ HDmemcpy(H5B2_NAT_NREC(left_native, hdr, (*left_nrec + 1)), H5B2_NAT_NREC(right_native, hdr, 0), hdr->cls->nrec_size * (move_nrec - 1));
/* Move record from right node into parent node */
- HDmemcpy(H5B2_INT_NREC(internal,shared,idx),H5B2_NAT_NREC(right_native,shared,(move_nrec-1)),shared->type->nrec_size);
+ HDmemcpy(H5B2_INT_NREC(internal, hdr, idx), H5B2_NAT_NREC(right_native, hdr, (move_nrec - 1)), hdr->cls->nrec_size);
/* Slide records in right node down */
- HDmemmove(H5B2_NAT_NREC(right_native,shared,0),H5B2_NAT_NREC(right_native,shared,move_nrec),shared->type->nrec_size*new_right_nrec);
+ HDmemmove(H5B2_NAT_NREC(right_native, hdr, 0), H5B2_NAT_NREC(right_native, hdr, move_nrec), hdr->cls->nrec_size * new_right_nrec);
/* Handle node pointers, if we have an internal node */
- if(depth>1) {
+ if(depth > 1) {
hsize_t moved_nrec = move_nrec; /* Total number of records moved, for internal redistrib */
unsigned u; /* Local index variable */
@@ -754,7 +547,7 @@ H5B2_redistribute2(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_internal_t *int
HDmemcpy(&(left_node_ptrs[*left_nrec + 1]), &(right_node_ptrs[0]), sizeof(H5B2_node_ptr_t) * move_nrec);
/* Slide node pointers in right node down */
- HDmemmove(&(right_node_ptrs[0]), &(right_node_ptrs[move_nrec]), sizeof(H5B2_node_ptr_t) * (new_right_nrec + 1));
+ HDmemmove(&(right_node_ptrs[0]), &(right_node_ptrs[move_nrec]), sizeof(H5B2_node_ptr_t) * (new_right_nrec + (unsigned)1));
} /* end if */
/* Update number of records in child nodes */
@@ -764,37 +557,37 @@ H5B2_redistribute2(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_internal_t *int
else {
/* Moving record from left node to right */
- unsigned new_left_nrec = (*left_nrec + *right_nrec) / 2; /* New number of records for left child */
- unsigned move_nrec = *left_nrec - new_left_nrec; /* Number of records to move from left node to right */
+ uint16_t new_left_nrec = (*left_nrec + *right_nrec) / 2; /* New number of records for left child */
+ uint16_t move_nrec = *left_nrec - new_left_nrec; /* Number of records to move from left node to right */
/* Slide records in right node up */
- HDmemmove(H5B2_NAT_NREC(right_native,shared,move_nrec),
- H5B2_NAT_NREC(right_native,shared,0),
- shared->type->nrec_size*(*right_nrec));
+ HDmemmove(H5B2_NAT_NREC(right_native, hdr, move_nrec),
+ H5B2_NAT_NREC(right_native, hdr, 0),
+ hdr->cls->nrec_size * (*right_nrec));
/* Copy record from parent node down into right child */
- HDmemcpy(H5B2_NAT_NREC(right_native,shared,(move_nrec-1)),H5B2_INT_NREC(internal,shared,idx),shared->type->nrec_size);
+ HDmemcpy(H5B2_NAT_NREC(right_native, hdr, (move_nrec - 1)), H5B2_INT_NREC(internal, hdr, idx), hdr->cls->nrec_size);
/* See if we need to move records from left node */
- if(move_nrec>1)
- HDmemcpy(H5B2_NAT_NREC(right_native,shared,0),H5B2_NAT_NREC(left_native,shared,((*left_nrec-move_nrec)+1)),shared->type->nrec_size*(move_nrec-1));
+ if(move_nrec > 1)
+ HDmemcpy(H5B2_NAT_NREC(right_native, hdr, 0), H5B2_NAT_NREC(left_native, hdr, ((*left_nrec - move_nrec) + 1)), hdr->cls->nrec_size * (move_nrec - 1));
/* Move record from left node into parent node */
- HDmemcpy(H5B2_INT_NREC(internal,shared,idx),H5B2_NAT_NREC(left_native,shared,(*left_nrec-move_nrec)),shared->type->nrec_size);
+ HDmemcpy(H5B2_INT_NREC(internal, hdr, idx), H5B2_NAT_NREC(left_native, hdr, (*left_nrec - move_nrec)), hdr->cls->nrec_size);
/* Handle node pointers, if we have an internal node */
- if(depth>1) {
- hsize_t moved_nrec=move_nrec; /* Total number of records moved, for internal redistrib */
+ if(depth > 1) {
+ hsize_t moved_nrec = move_nrec; /* Total number of records moved, for internal redistrib */
unsigned u; /* Local index variable */
/* Slide node pointers in right node up */
- HDmemmove(&(right_node_ptrs[move_nrec]),&(right_node_ptrs[0]),sizeof(H5B2_node_ptr_t)*(*right_nrec+1));
+ HDmemmove(&(right_node_ptrs[move_nrec]), &(right_node_ptrs[0]), sizeof(H5B2_node_ptr_t) * (*right_nrec + 1));
/* Copy node pointers from left node to right */
- HDmemcpy(&(right_node_ptrs[0]),&(left_node_ptrs[new_left_nrec+1]),sizeof(H5B2_node_ptr_t)*move_nrec);
+ HDmemcpy(&(right_node_ptrs[0]), &(left_node_ptrs[new_left_nrec + 1]), sizeof(H5B2_node_ptr_t) * move_nrec);
/* Count the number of records being moved */
- for(u=0; u<move_nrec; u++)
+ for(u = 0; u < move_nrec; u++)
moved_nrec += right_node_ptrs[u].all_nrec;
left_moved_nrec -= (hssize_t)moved_nrec;
H5_ASSIGN_OVERFLOW(/* To: */ right_moved_nrec, /* From: */ moved_nrec, /* From: */ hsize_t, /* To: */ hssize_t)
@@ -807,38 +600,38 @@ H5B2_redistribute2(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_internal_t *int
/* Update # of records in child nodes */
internal->node_ptrs[idx].node_nrec = *left_nrec;
- internal->node_ptrs[idx+1].node_nrec = *right_nrec;
+ internal->node_ptrs[idx + 1].node_nrec = *right_nrec;
/* Update total # of records in child B-trees */
- if(depth>1) {
+ if(depth > 1) {
internal->node_ptrs[idx].all_nrec += left_moved_nrec;
- internal->node_ptrs[idx+1].all_nrec += right_moved_nrec;
+ internal->node_ptrs[idx + 1].all_nrec += right_moved_nrec;
} /* end if */
else {
internal->node_ptrs[idx].all_nrec = internal->node_ptrs[idx].node_nrec;
- internal->node_ptrs[idx+1].all_nrec = internal->node_ptrs[idx+1].node_nrec;
+ internal->node_ptrs[idx + 1].all_nrec = internal->node_ptrs[idx + 1].node_nrec;
} /* end else */
#ifdef H5B2_DEBUG
- H5B2_assert_internal((hsize_t)0,shared,internal);
- if(depth>1) {
- H5B2_assert_internal2(internal->node_ptrs[idx].all_nrec,shared,left_child,right_child);
- H5B2_assert_internal2(internal->node_ptrs[idx+1].all_nrec,shared,right_child,left_child);
+ H5B2_assert_internal((hsize_t)0, hdr, internal);
+ if(depth > 1) {
+ H5B2_assert_internal2(internal->node_ptrs[idx].all_nrec, hdr, left_child, right_child);
+ H5B2_assert_internal2(internal->node_ptrs[idx + 1].all_nrec, hdr, right_child, left_child);
} /* end if */
else {
- H5B2_assert_leaf2(shared,left_child,right_child);
- H5B2_assert_leaf(shared,right_child);
+ H5B2_assert_leaf2(hdr, left_child, right_child);
+ H5B2_assert_leaf(hdr, right_child);
} /* end else */
#endif /* H5B2_DEBUG */
/* Release child nodes (marked as dirty) */
- if (H5AC_unprotect(f, dxpl_id, child_class, left_addr, left_child, H5AC__DIRTIED_FLAG) < 0)
+ if(H5AC_unprotect(hdr->f, dxpl_id, child_class, left_addr, left_child, H5AC__DIRTIED_FLAG) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node")
- if (H5AC_unprotect(f, dxpl_id, child_class, right_addr, right_child, H5AC__DIRTIED_FLAG) < 0)
+ if(H5AC_unprotect(hdr->f, dxpl_id, child_class, right_addr, right_child, H5AC__DIRTIED_FLAG) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node")
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B2_redistribute2 */
@@ -848,7 +641,6 @@ done:
* Purpose: Redistribute records between three nodes
*
* Return: Success: Non-negative
- *
* Failure: Negative
*
* Programmer: Quincey Koziol
@@ -858,7 +650,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5B2_redistribute3(H5F_t *f, hid_t dxpl_id, unsigned depth,
+H5B2_redistribute3(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth,
H5B2_internal_t *internal, unsigned *internal_flags_ptr, unsigned idx)
{
const H5AC_class_t *child_class; /* Pointer to child node's class info */
@@ -866,27 +658,23 @@ H5B2_redistribute3(H5F_t *f, hid_t dxpl_id, unsigned depth,
haddr_t middle_addr; /* Address of middle child node */
void *left_child, *right_child; /* Pointers to child nodes */
void *middle_child; /* Pointers to middle child node */
- unsigned *left_nrec, *right_nrec; /* Pointers to child # of records */
- unsigned *middle_nrec; /* Pointers to middle child # of records */
+ uint16_t *left_nrec, *right_nrec; /* Pointers to child # of records */
+ uint16_t *middle_nrec; /* Pointers to middle child # of records */
uint8_t *left_native, *right_native; /* Pointers to childs' native records */
uint8_t *middle_native; /* Pointers to middle child's native records */
- H5B2_shared_t *shared; /* B-tree's shared info */
- H5B2_node_ptr_t *left_node_ptrs=NULL, *right_node_ptrs=NULL;/* Pointers to childs' node pointer info */
- H5B2_node_ptr_t *middle_node_ptrs=NULL;/* Pointers to childs' node pointer info */
- hssize_t left_moved_nrec=0, right_moved_nrec=0; /* Number of records moved, for internal split */
- hssize_t middle_moved_nrec=0; /* Number of records moved, for internal split */
- herr_t ret_value=SUCCEED; /* Return value */
+ H5B2_node_ptr_t *left_node_ptrs = NULL, *right_node_ptrs = NULL; /* Pointers to childs' node pointer info */
+ H5B2_node_ptr_t *middle_node_ptrs = NULL; /* Pointers to childs' node pointer info */
+ hssize_t left_moved_nrec = 0, right_moved_nrec = 0; /* Number of records moved, for internal split */
+ hssize_t middle_moved_nrec = 0; /* Number of records moved, for internal split */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5B2_redistribute3)
- HDassert(f);
+ /* Check arguments. */
+ HDassert(hdr);
HDassert(internal);
HDassert(internal_flags_ptr);
- /* Get the pointer to the shared B-tree info */
- shared=(H5B2_shared_t *)H5RC_GET_OBJ(internal->shared);
- HDassert(shared);
-
/* Check for the kind of B-tree node to redistribute */
if(depth > 1) {
H5B2_internal_t *left_internal; /* Pointer to left internal node */
@@ -895,16 +683,16 @@ H5B2_redistribute3(H5F_t *f, hid_t dxpl_id, unsigned depth,
/* Setup information for unlocking child nodes */
child_class = H5AC_BT2_INT;
- left_addr = internal->node_ptrs[idx-1].addr;
+ left_addr = internal->node_ptrs[idx - 1].addr;
middle_addr = internal->node_ptrs[idx].addr;
- right_addr = internal->node_ptrs[idx+1].addr;
+ right_addr = internal->node_ptrs[idx + 1].addr;
/* Lock B-tree child nodes */
- if (NULL == (left_internal = H5B2_protect_internal(f, dxpl_id, internal->shared, left_addr, internal->node_ptrs[idx-1].node_nrec, (depth - 1), H5AC_WRITE)))
+ if(NULL == (left_internal = H5B2_protect_internal(hdr, dxpl_id, left_addr, internal->node_ptrs[idx - 1].node_nrec, (depth - 1), H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
- if (NULL == (middle_internal = H5B2_protect_internal(f, dxpl_id, internal->shared, middle_addr, internal->node_ptrs[idx].node_nrec, (depth - 1), H5AC_WRITE)))
+ if(NULL == (middle_internal = H5B2_protect_internal(hdr, dxpl_id, middle_addr, internal->node_ptrs[idx].node_nrec, (depth - 1), H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
- if (NULL == (right_internal = H5B2_protect_internal(f, dxpl_id, internal->shared, right_addr, internal->node_ptrs[idx+1].node_nrec, (depth - 1), H5AC_WRITE)))
+ if(NULL == (right_internal = H5B2_protect_internal(hdr, dxpl_id, right_addr, internal->node_ptrs[idx + 1].node_nrec, (depth - 1), H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
/* More setup for child nodes */
@@ -928,16 +716,16 @@ H5B2_redistribute3(H5F_t *f, hid_t dxpl_id, unsigned depth,
/* Setup information for unlocking child nodes */
child_class = H5AC_BT2_LEAF;
- left_addr = internal->node_ptrs[idx-1].addr;
+ left_addr = internal->node_ptrs[idx - 1].addr;
middle_addr = internal->node_ptrs[idx].addr;
- right_addr = internal->node_ptrs[idx+1].addr;
+ right_addr = internal->node_ptrs[idx + 1].addr;
/* Lock B-tree child nodes */
- if (NULL == (left_leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, child_class, left_addr, &(internal->node_ptrs[idx-1].node_nrec), internal->shared, H5AC_WRITE)))
+ if(NULL == (left_leaf = (H5B2_leaf_t *)H5AC_protect(hdr->f, dxpl_id, child_class, left_addr, &(internal->node_ptrs[idx - 1].node_nrec), hdr, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
- if (NULL == (middle_leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, child_class, middle_addr, &(internal->node_ptrs[idx].node_nrec), internal->shared, H5AC_WRITE)))
+ if(NULL == (middle_leaf = (H5B2_leaf_t *)H5AC_protect(hdr->f, dxpl_id, child_class, middle_addr, &(internal->node_ptrs[idx].node_nrec), hdr, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
- if (NULL == (right_leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, child_class, right_addr, &(internal->node_ptrs[idx+1].node_nrec), internal->shared, H5AC_WRITE)))
+ if(NULL == (right_leaf = (H5B2_leaf_t *)H5AC_protect(hdr->f, dxpl_id, child_class, right_addr, &(internal->node_ptrs[idx + 1].node_nrec), hdr, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
/* More setup for child nodes */
@@ -956,10 +744,10 @@ H5B2_redistribute3(H5F_t *f, hid_t dxpl_id, unsigned depth,
{
/* Compute new # of records in each node */
unsigned total_nrec = *left_nrec + *middle_nrec + *right_nrec + 2;
- unsigned new_middle_nrec = (total_nrec - 2) / 3;
- unsigned new_left_nrec = ((total_nrec - 2) - new_middle_nrec) / 2;
- unsigned new_right_nrec = (total_nrec - 2) - (new_left_nrec + new_middle_nrec);
- unsigned curr_middle_nrec = *middle_nrec;
+ uint16_t new_middle_nrec = (total_nrec - 2) / 3;
+ uint16_t new_left_nrec = ((total_nrec - 2) - new_middle_nrec) / 2;
+ uint16_t new_right_nrec = (total_nrec - 2) - (new_left_nrec + new_middle_nrec);
+ uint16_t curr_middle_nrec = *middle_nrec;
/* Sanity check rounding */
HDassert(new_middle_nrec <= new_left_nrec);
@@ -967,42 +755,42 @@ H5B2_redistribute3(H5F_t *f, hid_t dxpl_id, unsigned depth,
/* Move records into left node */
if(new_left_nrec > *left_nrec) {
- unsigned moved_middle_nrec = 0; /* Number of records moved into left node */
+ uint16_t moved_middle_nrec = 0; /* Number of records moved into left node */
/* Move left parent record down to left node */
- HDmemcpy(H5B2_NAT_NREC(left_native,shared,*left_nrec),H5B2_INT_NREC(internal,shared,idx-1),shared->type->nrec_size);
+ HDmemcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec), H5B2_INT_NREC(internal, hdr, idx - 1), hdr->cls->nrec_size);
/* Move records from middle node into left node */
if((new_left_nrec - 1) > *left_nrec) {
- moved_middle_nrec = new_left_nrec-(*left_nrec + 1);
- HDmemcpy(H5B2_NAT_NREC(left_native, shared, *left_nrec + 1),H5B2_NAT_NREC(middle_native, shared, 0), shared->type->nrec_size * moved_middle_nrec);
+ moved_middle_nrec = new_left_nrec - (*left_nrec + 1);
+ HDmemcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec + 1), H5B2_NAT_NREC(middle_native, hdr, 0), hdr->cls->nrec_size * moved_middle_nrec);
} /* end if */
/* Move record from middle node up to parent node */
- HDmemcpy(H5B2_INT_NREC(internal,shared,idx-1),H5B2_NAT_NREC(middle_native,shared,moved_middle_nrec),shared->type->nrec_size);
+ HDmemcpy(H5B2_INT_NREC(internal, hdr, idx - 1), H5B2_NAT_NREC(middle_native, hdr, moved_middle_nrec), hdr->cls->nrec_size);
moved_middle_nrec++;
/* Slide records in middle node down */
- HDmemmove(H5B2_NAT_NREC(middle_native,shared,0),H5B2_NAT_NREC(middle_native,shared,moved_middle_nrec),shared->type->nrec_size*(*middle_nrec-moved_middle_nrec));
+ HDmemmove(H5B2_NAT_NREC(middle_native, hdr, 0), H5B2_NAT_NREC(middle_native, hdr, moved_middle_nrec), hdr->cls->nrec_size * (*middle_nrec - moved_middle_nrec));
/* Move node pointers also if this is an internal node */
- if(depth>1) {
+ if(depth > 1) {
hsize_t moved_nrec; /* Total number of records moved, for internal redistrib */
unsigned move_nptrs; /* Number of node pointers to move */
unsigned u; /* Local index variable */
/* Move middle node pointers into left node */
move_nptrs = new_left_nrec - *left_nrec;
- HDmemcpy(&(left_node_ptrs[*left_nrec+1]),&(middle_node_ptrs[0]),sizeof(H5B2_node_ptr_t)*move_nptrs);
+ HDmemcpy(&(left_node_ptrs[*left_nrec + 1]), &(middle_node_ptrs[0]), sizeof(H5B2_node_ptr_t)*move_nptrs);
/* Count the number of records being moved into the left node */
- for(u=0, moved_nrec=0; u<move_nptrs; u++)
+ for(u = 0, moved_nrec = 0; u < move_nptrs; u++)
moved_nrec += middle_node_ptrs[u].all_nrec;
- left_moved_nrec = moved_nrec+move_nptrs;
- middle_moved_nrec -= moved_nrec+move_nptrs;
+ left_moved_nrec = moved_nrec + move_nptrs;
+ middle_moved_nrec -= moved_nrec + move_nptrs;
/* Slide the node pointers in middle node down */
- HDmemmove(&(middle_node_ptrs[0]),&(middle_node_ptrs[move_nptrs]),sizeof(H5B2_node_ptr_t)*((*middle_nrec-move_nptrs)+1));
+ HDmemmove(&(middle_node_ptrs[0]), &(middle_node_ptrs[move_nptrs]), sizeof(H5B2_node_ptr_t) * ((*middle_nrec - move_nptrs) + 1));
} /* end if */
/* Update the current number of records in middle node */
@@ -1010,38 +798,38 @@ H5B2_redistribute3(H5F_t *f, hid_t dxpl_id, unsigned depth,
} /* end if */
/* Move records into right node */
- if(new_right_nrec>*right_nrec) {
- unsigned right_nrec_move = new_right_nrec-*right_nrec; /* Number of records to move out of right node */
+ if(new_right_nrec > *right_nrec) {
+ unsigned right_nrec_move = new_right_nrec - *right_nrec; /* Number of records to move out of right node */
/* Slide records in right node up */
- HDmemmove(H5B2_NAT_NREC(right_native,shared,right_nrec_move),H5B2_NAT_NREC(right_native,shared,0),shared->type->nrec_size*(*right_nrec));
+ HDmemmove(H5B2_NAT_NREC(right_native, hdr, right_nrec_move), H5B2_NAT_NREC(right_native, hdr, 0), hdr->cls->nrec_size * (*right_nrec));
/* Move right parent record down to right node */
- HDmemcpy(H5B2_NAT_NREC(right_native,shared,right_nrec_move-1),H5B2_INT_NREC(internal,shared,idx),shared->type->nrec_size);
+ HDmemcpy(H5B2_NAT_NREC(right_native, hdr, right_nrec_move - 1), H5B2_INT_NREC(internal, hdr, idx), hdr->cls->nrec_size);
/* Move records from middle node into right node */
- if(right_nrec_move>1)
- HDmemcpy(H5B2_NAT_NREC(right_native,shared,0),H5B2_NAT_NREC(middle_native,shared,((curr_middle_nrec-right_nrec_move)+1)),shared->type->nrec_size*(right_nrec_move-1));
+ if(right_nrec_move > 1)
+ HDmemcpy(H5B2_NAT_NREC(right_native, hdr, 0), H5B2_NAT_NREC(middle_native, hdr, ((curr_middle_nrec - right_nrec_move) + 1)), hdr->cls->nrec_size * (right_nrec_move - 1));
/* Move record from middle node up to parent node */
- HDmemcpy(H5B2_INT_NREC(internal,shared,idx),H5B2_NAT_NREC(middle_native,shared,(curr_middle_nrec-right_nrec_move)),shared->type->nrec_size);
+ HDmemcpy(H5B2_INT_NREC(internal, hdr, idx), H5B2_NAT_NREC(middle_native, hdr, (curr_middle_nrec - right_nrec_move)), hdr->cls->nrec_size);
/* Move node pointers also if this is an internal node */
- if(depth>1) {
+ if(depth > 1) {
hsize_t moved_nrec; /* Total number of records moved, for internal redistrib */
unsigned u; /* Local index variable */
/* Slide the node pointers in right node up */
- HDmemmove(&(right_node_ptrs[right_nrec_move]),&(right_node_ptrs[0]),sizeof(H5B2_node_ptr_t)*(*right_nrec+1));
+ HDmemmove(&(right_node_ptrs[right_nrec_move]), &(right_node_ptrs[0]), sizeof(H5B2_node_ptr_t) * (*right_nrec + 1));
/* Move middle node pointers into right node */
- HDmemcpy(&(right_node_ptrs[0]),&(middle_node_ptrs[(curr_middle_nrec-right_nrec_move)+1]),sizeof(H5B2_node_ptr_t)*right_nrec_move);
+ HDmemcpy(&(right_node_ptrs[0]), &(middle_node_ptrs[(curr_middle_nrec - right_nrec_move) + 1]), sizeof(H5B2_node_ptr_t) * right_nrec_move);
/* Count the number of records being moved into the right node */
- for(u=0, moved_nrec=0; u<right_nrec_move; u++)
+ for(u = 0, moved_nrec = 0; u < right_nrec_move; u++)
moved_nrec += right_node_ptrs[u].all_nrec;
- right_moved_nrec = moved_nrec+right_nrec_move;
- middle_moved_nrec -= moved_nrec+right_nrec_move;
+ right_moved_nrec = moved_nrec + right_nrec_move;
+ middle_moved_nrec -= moved_nrec + right_nrec_move;
} /* end if */
/* Update the current number of records in middle node */
@@ -1049,38 +837,38 @@ H5B2_redistribute3(H5F_t *f, hid_t dxpl_id, unsigned depth,
} /* end if */
/* Move records out of left node */
- if(new_left_nrec<*left_nrec) {
- unsigned left_nrec_move = *left_nrec-new_left_nrec; /* Number of records to move out of left node */
+ if(new_left_nrec < *left_nrec) {
+ unsigned left_nrec_move = *left_nrec - new_left_nrec; /* Number of records to move out of left node */
/* Slide middle records up */
- HDmemmove(H5B2_NAT_NREC(middle_native,shared,left_nrec_move),H5B2_NAT_NREC(middle_native,shared,0),shared->type->nrec_size*curr_middle_nrec);
+ HDmemmove(H5B2_NAT_NREC(middle_native, hdr, left_nrec_move), H5B2_NAT_NREC(middle_native, hdr, 0), hdr->cls->nrec_size * curr_middle_nrec);
/* Move left parent record down to middle node */
- HDmemcpy(H5B2_NAT_NREC(middle_native,shared,left_nrec_move-1),H5B2_INT_NREC(internal,shared,idx-1),shared->type->nrec_size);
+ HDmemcpy(H5B2_NAT_NREC(middle_native, hdr, left_nrec_move - 1), H5B2_INT_NREC(internal, hdr, idx - 1), hdr->cls->nrec_size);
/* Move left records to middle node */
- if(left_nrec_move>1)
- HDmemmove(H5B2_NAT_NREC(middle_native,shared,0),H5B2_NAT_NREC(left_native,shared,new_left_nrec+1),shared->type->nrec_size*(left_nrec_move-1));
+ if(left_nrec_move > 1)
+ HDmemmove(H5B2_NAT_NREC(middle_native, hdr, 0), H5B2_NAT_NREC(left_native, hdr, new_left_nrec + 1), hdr->cls->nrec_size * (left_nrec_move - 1));
/* Move left parent record up from left node */
- HDmemcpy(H5B2_INT_NREC(internal,shared,idx-1),H5B2_NAT_NREC(left_native,shared,new_left_nrec),shared->type->nrec_size);
+ HDmemcpy(H5B2_INT_NREC(internal, hdr, idx - 1), H5B2_NAT_NREC(left_native, hdr, new_left_nrec), hdr->cls->nrec_size);
/* Move node pointers also if this is an internal node */
- if(depth>1) {
+ if(depth > 1) {
hsize_t moved_nrec; /* Total number of records moved, for internal redistrib */
unsigned u; /* Local index variable */
/* Slide the node pointers in middle node up */
- HDmemmove(&(middle_node_ptrs[left_nrec_move]),&(middle_node_ptrs[0]),sizeof(H5B2_node_ptr_t)*(curr_middle_nrec+1));
+ HDmemmove(&(middle_node_ptrs[left_nrec_move]), &(middle_node_ptrs[0]), sizeof(H5B2_node_ptr_t) * (curr_middle_nrec + 1));
/* Move left node pointers into middle node */
- HDmemcpy(&(middle_node_ptrs[0]),&(left_node_ptrs[new_left_nrec+1]),sizeof(H5B2_node_ptr_t)*left_nrec_move);
+ HDmemcpy(&(middle_node_ptrs[0]), &(left_node_ptrs[new_left_nrec + 1]), sizeof(H5B2_node_ptr_t) * left_nrec_move);
/* Count the number of records being moved into the left node */
- for(u=0, moved_nrec=0; u<left_nrec_move; u++)
+ for(u = 0, moved_nrec = 0; u < left_nrec_move; u++)
moved_nrec += middle_node_ptrs[u].all_nrec;
- left_moved_nrec -= moved_nrec+left_nrec_move;
- middle_moved_nrec += moved_nrec+left_nrec_move;
+ left_moved_nrec -= moved_nrec + left_nrec_move;
+ middle_moved_nrec += moved_nrec + left_nrec_move;
} /* end if */
/* Update the current number of records in middle node */
@@ -1088,37 +876,37 @@ H5B2_redistribute3(H5F_t *f, hid_t dxpl_id, unsigned depth,
} /* end if */
/* Move records out of right node */
- if(new_right_nrec<*right_nrec) {
- unsigned right_nrec_move = *right_nrec-new_right_nrec; /* Number of records to move out of right node */
+ if(new_right_nrec < *right_nrec) {
+ unsigned right_nrec_move = *right_nrec - new_right_nrec; /* Number of records to move out of right node */
/* Move right parent record down to middle node */
- HDmemcpy(H5B2_NAT_NREC(middle_native,shared,curr_middle_nrec),H5B2_INT_NREC(internal,shared,idx),shared->type->nrec_size);
+ HDmemcpy(H5B2_NAT_NREC(middle_native, hdr, curr_middle_nrec), H5B2_INT_NREC(internal, hdr, idx), hdr->cls->nrec_size);
/* Move right records to middle node */
- HDmemmove(H5B2_NAT_NREC(middle_native,shared,(curr_middle_nrec+1)),H5B2_NAT_NREC(right_native,shared,0),shared->type->nrec_size*(right_nrec_move-1));
+ HDmemmove(H5B2_NAT_NREC(middle_native, hdr, (curr_middle_nrec + 1)), H5B2_NAT_NREC(right_native, hdr, 0), hdr->cls->nrec_size * (right_nrec_move - 1));
/* Move right parent record up from right node */
- HDmemcpy(H5B2_INT_NREC(internal,shared,idx),H5B2_NAT_NREC(right_native,shared,right_nrec_move-1),shared->type->nrec_size);
+ HDmemcpy(H5B2_INT_NREC(internal, hdr, idx), H5B2_NAT_NREC(right_native, hdr, right_nrec_move - 1), hdr->cls->nrec_size);
/* Slide right records down */
- HDmemmove(H5B2_NAT_NREC(right_native,shared,0),H5B2_NAT_NREC(right_native,shared,right_nrec_move),shared->type->nrec_size*new_right_nrec);
+ HDmemmove(H5B2_NAT_NREC(right_native, hdr, 0), H5B2_NAT_NREC(right_native, hdr, right_nrec_move), hdr->cls->nrec_size * new_right_nrec);
/* Move node pointers also if this is an internal node */
- if(depth>1) {
+ if(depth > 1) {
hsize_t moved_nrec; /* Total number of records moved, for internal redistrib */
unsigned u; /* Local index variable */
/* Move right node pointers into middle node */
- HDmemcpy(&(middle_node_ptrs[curr_middle_nrec+1]),&(right_node_ptrs[0]),sizeof(H5B2_node_ptr_t)*right_nrec_move);
+ HDmemcpy(&(middle_node_ptrs[curr_middle_nrec + 1]), &(right_node_ptrs[0]), sizeof(H5B2_node_ptr_t) * right_nrec_move);
/* Count the number of records being moved into the right node */
- for(u=0, moved_nrec=0; u<right_nrec_move; u++)
+ for(u = 0, moved_nrec = 0; u < right_nrec_move; u++)
moved_nrec += right_node_ptrs[u].all_nrec;
- right_moved_nrec -= moved_nrec+right_nrec_move;
- middle_moved_nrec += moved_nrec+right_nrec_move;
+ right_moved_nrec -= moved_nrec + right_nrec_move;
+ middle_moved_nrec += moved_nrec + right_nrec_move;
/* Slide the node pointers in right node down */
- HDmemmove(&(right_node_ptrs[0]),&(right_node_ptrs[right_nrec_move]),sizeof(H5B2_node_ptr_t)*(new_right_nrec+1));
+ HDmemmove(&(right_node_ptrs[0]), &(right_node_ptrs[right_nrec_move]), sizeof(H5B2_node_ptr_t) * (new_right_nrec + 1));
} /* end if */
} /* end if */
@@ -1129,20 +917,20 @@ H5B2_redistribute3(H5F_t *f, hid_t dxpl_id, unsigned depth,
} /* end block */
/* Update # of records in child nodes */
- internal->node_ptrs[idx-1].node_nrec = *left_nrec;
+ internal->node_ptrs[idx - 1].node_nrec = *left_nrec;
internal->node_ptrs[idx].node_nrec = *middle_nrec;
- internal->node_ptrs[idx+1].node_nrec = *right_nrec;
+ internal->node_ptrs[idx + 1].node_nrec = *right_nrec;
/* Update total # of records in child B-trees */
- if(depth>1) {
- internal->node_ptrs[idx-1].all_nrec += left_moved_nrec;
+ if(depth > 1) {
+ internal->node_ptrs[idx - 1].all_nrec += left_moved_nrec;
internal->node_ptrs[idx].all_nrec += middle_moved_nrec;
- internal->node_ptrs[idx+1].all_nrec += right_moved_nrec;
+ internal->node_ptrs[idx + 1].all_nrec += right_moved_nrec;
} /* end if */
else {
- internal->node_ptrs[idx-1].all_nrec = internal->node_ptrs[idx-1].node_nrec;
+ internal->node_ptrs[idx - 1].all_nrec = internal->node_ptrs[idx - 1].node_nrec;
internal->node_ptrs[idx].all_nrec = internal->node_ptrs[idx].node_nrec;
- internal->node_ptrs[idx+1].all_nrec = internal->node_ptrs[idx+1].node_nrec;
+ internal->node_ptrs[idx + 1].all_nrec = internal->node_ptrs[idx + 1].node_nrec;
} /* end else */
/* Mark parent as dirty */
@@ -1152,67 +940,67 @@ H5B2_redistribute3(H5F_t *f, hid_t dxpl_id, unsigned depth,
{
unsigned u;
- HDfprintf(stderr,"%s: Internal records:\n",FUNC);
- for(u=0; u<internal->nrec; u++) {
- HDfprintf(stderr,"%s: u=%u\n",FUNC,u);
- (shared->type->debug)(stderr,f,dxpl_id,3,4,H5B2_INT_NREC(internal,shared,u),NULL);
+ HDfprintf(stderr, "%s: Internal records:\n", FUNC);
+ for(u = 0; u < internal->nrec; u++) {
+ HDfprintf(stderr, "%s: u = %u\n", FUNC, u);
+ (hdr->cls->debug)(stderr, hdr->f, dxpl_id, 3, 4, H5B2_INT_NREC(internal, hdr, u), NULL);
} /* end for */
- HDfprintf(stderr,"%s: Left Child records:\n",FUNC);
- for(u=0; u<*left_nrec; u++) {
- HDfprintf(stderr,"%s: u=%u\n",FUNC,u);
- (shared->type->debug)(stderr,f,dxpl_id,3,4,H5B2_NAT_NREC(left_native,shared,u),NULL);
+ HDfprintf(stderr, "%s: Left Child records:\n", FUNC);
+ for(u = 0; u < *left_nrec; u++) {
+ HDfprintf(stderr, "%s: u = %u\n", FUNC, u);
+ (hdr->cls->debug)(stderr, hdr->f, dxpl_id, 3, 4, H5B2_NAT_NREC(left_native, hdr, u), NULL);
} /* end for */
- HDfprintf(stderr,"%s: Middle Child records:\n",FUNC);
- for(u=0; u<*middle_nrec; u++) {
- HDfprintf(stderr,"%s: u=%u\n",FUNC,u);
- (shared->type->debug)(stderr,f,dxpl_id,3,4,H5B2_NAT_NREC(middle_native,shared,u),NULL);
+ HDfprintf(stderr, "%s: Middle Child records:\n", FUNC);
+ for(u = 0; u < *middle_nrec; u++) {
+ HDfprintf(stderr, "%s: u = %u\n", FUNC, u);
+ (hdr->cls->debug)(stderr, hdr->f, dxpl_id, 3, 4, H5B2_NAT_NREC(middle_native, hdr, u), NULL);
} /* end for */
- HDfprintf(stderr,"%s: Right Child records:\n",FUNC);
- for(u=0; u<*right_nrec; u++) {
- HDfprintf(stderr,"%s: u=%u\n",FUNC,u);
- (shared->type->debug)(stderr,f,dxpl_id,3,4,H5B2_NAT_NREC(right_native,shared,u),NULL);
+ HDfprintf(stderr, "%s: Right Child records:\n", FUNC);
+ for(u = 0; u < *right_nrec; u++) {
+ HDfprintf(stderr, "%s: u = %u\n", FUNC, u);
+ (hdr->cls->debug)(stderr, hdr->f, dxpl_id, 3, 4, H5B2_NAT_NREC(right_native, hdr, u), NULL);
} /* end for */
- for(u=0; u<internal->nrec+1; u++)
- HDfprintf(stderr,"%s: internal->node_ptrs[%u]=(%Hu/%u/%a)\n",FUNC,u,internal->node_ptrs[u].all_nrec,internal->node_ptrs[u].node_nrec,internal->node_ptrs[u].addr);
- if(depth>1) {
- for(u=0; u<*left_nrec+1; u++)
- HDfprintf(stderr,"%s: left_node_ptr[%u]=(%Hu/%u/%a)\n",FUNC,u,left_node_ptrs[u].all_nrec,left_node_ptrs[u].node_nrec,left_node_ptrs[u].addr);
- for(u=0; u<*middle_nrec+1; u++)
- HDfprintf(stderr,"%s: middle_node_ptr[%u]=(%Hu/%u/%a)\n",FUNC,u,middle_node_ptrs[u].all_nrec,middle_node_ptrs[u].node_nrec,middle_node_ptrs[u].addr);
- for(u=0; u<*right_nrec+1; u++)
- HDfprintf(stderr,"%s: right_node_ptr[%u]=(%Hu/%u/%a)\n",FUNC,u,right_node_ptrs[u].all_nrec,right_node_ptrs[u].node_nrec,right_node_ptrs[u].addr);
+ for(u = 0; u < internal->nrec + 1; u++)
+ HDfprintf(stderr, "%s: internal->node_ptrs[%u] = (%Hu/%u/%a)\n", FUNC, u, internal->node_ptrs[u].all_nrec, internal->node_ptrs[u].node_nrec, internal->node_ptrs[u].addr);
+ if(depth > 1) {
+ for(u = 0; u < *left_nrec + 1; u++)
+ HDfprintf(stderr, "%s: left_node_ptr[%u] = (%Hu/%u/%a)\n", FUNC, u, left_node_ptrs[u].all_nrec, left_node_ptrs[u].node_nrec, left_node_ptrs[u].addr);
+ for(u = 0; u < *middle_nrec + 1; u++)
+ HDfprintf(stderr, "%s: middle_node_ptr[%u] = (%Hu/%u/%a)\n", FUNC, u, middle_node_ptrs[u].all_nrec, middle_node_ptrs[u].node_nrec, middle_node_ptrs[u].addr);
+ for(u = 0; u < *right_nrec + 1; u++)
+ HDfprintf(stderr, "%s: right_node_ptr[%u] = (%Hu/%u/%a)\n", FUNC, u, right_node_ptrs[u].all_nrec, right_node_ptrs[u].node_nrec, right_node_ptrs[u].addr);
} /* end if */
}
#endif /* QAK */
#ifdef H5B2_DEBUG
- H5B2_assert_internal((hsize_t)0,shared,internal);
- if(depth>1) {
- H5B2_assert_internal2(internal->node_ptrs[idx-1].all_nrec,shared,left_child,middle_child);
- H5B2_assert_internal2(internal->node_ptrs[idx].all_nrec,shared,middle_child,left_child);
- H5B2_assert_internal2(internal->node_ptrs[idx].all_nrec,shared,middle_child,right_child);
- H5B2_assert_internal2(internal->node_ptrs[idx+1].all_nrec,shared,right_child,middle_child);
+ H5B2_assert_internal((hsize_t)0, hdr, internal);
+ if(depth > 1) {
+ H5B2_assert_internal2(internal->node_ptrs[idx - 1].all_nrec, hdr, left_child, middle_child);
+ H5B2_assert_internal2(internal->node_ptrs[idx].all_nrec, hdr, middle_child, left_child);
+ H5B2_assert_internal2(internal->node_ptrs[idx].all_nrec, hdr, middle_child, right_child);
+ H5B2_assert_internal2(internal->node_ptrs[idx + 1].all_nrec, hdr, right_child, middle_child);
} /* end if */
else {
- H5B2_assert_leaf2(shared,left_child,middle_child);
- H5B2_assert_leaf2(shared,middle_child,right_child);
- H5B2_assert_leaf(shared,right_child);
+ H5B2_assert_leaf2(hdr, left_child, middle_child);
+ H5B2_assert_leaf2(hdr, middle_child, right_child);
+ H5B2_assert_leaf(hdr, right_child);
} /* end else */
#endif /* H5B2_DEBUG */
/* Unlock child nodes (marked as dirty) */
- if (H5AC_unprotect(f, dxpl_id, child_class, left_addr, left_child, H5AC__DIRTIED_FLAG) < 0)
+ if(H5AC_unprotect(hdr->f, dxpl_id, child_class, left_addr, left_child, H5AC__DIRTIED_FLAG) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node")
- if (H5AC_unprotect(f, dxpl_id, child_class, middle_addr, middle_child, H5AC__DIRTIED_FLAG) < 0)
+ if(H5AC_unprotect(hdr->f, dxpl_id, child_class, middle_addr, middle_child, H5AC__DIRTIED_FLAG) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node")
- if (H5AC_unprotect(f, dxpl_id, child_class, right_addr, right_child, H5AC__DIRTIED_FLAG) < 0)
+ if(H5AC_unprotect(hdr->f, dxpl_id, child_class, right_addr, right_child, H5AC__DIRTIED_FLAG) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node")
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B2_redistribute3 */
@@ -1232,31 +1020,26 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5B2_merge2(H5F_t *f, hid_t dxpl_id, unsigned depth,
+H5B2_merge2(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth,
H5B2_node_ptr_t *curr_node_ptr, unsigned *parent_cache_info_flags_ptr,
H5B2_internal_t *internal, unsigned *internal_flags_ptr, unsigned idx)
{
const H5AC_class_t *child_class; /* Pointer to child node's class info */
haddr_t left_addr, right_addr; /* Addresses of left & right child nodes */
void *left_child, *right_child; /* Pointers to left & right child nodes */
- unsigned *left_nrec, *right_nrec; /* Pointers to left & right child # of records */
+ uint16_t *left_nrec, *right_nrec; /* Pointers to left & right child # of records */
uint8_t *left_native, *right_native; /* Pointers to left & right children's native records */
- H5B2_node_ptr_t *left_node_ptrs=NULL, *right_node_ptrs=NULL;/* Pointers to childs' node pointer info */
- H5B2_shared_t *shared; /* B-tree's shared info */
- herr_t ret_value=SUCCEED; /* Return value */
+ H5B2_node_ptr_t *left_node_ptrs = NULL, *right_node_ptrs = NULL;/* Pointers to childs' node pointer info */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5B2_merge2)
- HDassert(f);
+ /* Check arguments. */
+ HDassert(hdr);
HDassert(curr_node_ptr);
- HDassert(parent_cache_info_flags_ptr);
HDassert(internal);
HDassert(internal_flags_ptr);
- /* Get the pointer to the shared B-tree info */
- shared=(H5B2_shared_t *)H5RC_GET_OBJ(internal->shared);
- HDassert(shared);
-
/* Check for the kind of B-tree node to split */
if(depth > 1) {
H5B2_internal_t *left_internal; /* Pointer to left internal node */
@@ -1265,12 +1048,12 @@ H5B2_merge2(H5F_t *f, hid_t dxpl_id, unsigned depth,
/* Setup information for unlocking child nodes */
child_class = H5AC_BT2_INT;
left_addr = internal->node_ptrs[idx].addr;
- right_addr = internal->node_ptrs[idx+1].addr;
+ right_addr = internal->node_ptrs[idx + 1].addr;
/* Lock left & right B-tree child nodes */
- if(NULL == (left_internal = H5B2_protect_internal(f, dxpl_id, internal->shared, left_addr, internal->node_ptrs[idx].node_nrec, (depth - 1), H5AC_WRITE)))
+ if(NULL == (left_internal = H5B2_protect_internal(hdr, dxpl_id, left_addr, internal->node_ptrs[idx].node_nrec, (depth - 1), H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
- if(NULL == (right_internal = H5B2_protect_internal(f, dxpl_id, internal->shared, right_addr, internal->node_ptrs[idx+1].node_nrec, (depth - 1), H5AC_WRITE)))
+ if(NULL == (right_internal = H5B2_protect_internal(hdr, dxpl_id, right_addr, internal->node_ptrs[idx + 1].node_nrec, (depth - 1), H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
/* More setup for accessing child node information */
@@ -1290,12 +1073,12 @@ H5B2_merge2(H5F_t *f, hid_t dxpl_id, unsigned depth,
/* Setup information for unlocking child nodes */
child_class = H5AC_BT2_LEAF;
left_addr = internal->node_ptrs[idx].addr;
- right_addr = internal->node_ptrs[idx+1].addr;
+ right_addr = internal->node_ptrs[idx + 1].addr;
/* Lock left & right B-tree child nodes */
- if(NULL == (left_leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, child_class, left_addr, &(internal->node_ptrs[idx].node_nrec), internal->shared, H5AC_WRITE)))
+ if(NULL == (left_leaf = (H5B2_leaf_t *)H5AC_protect(hdr->f, dxpl_id, child_class, left_addr, &(internal->node_ptrs[idx].node_nrec), hdr, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
- if(NULL == (right_leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, child_class, right_addr, &(internal->node_ptrs[idx+1].node_nrec), internal->shared, H5AC_WRITE)))
+ if(NULL == (right_leaf = (H5B2_leaf_t *)H5AC_protect(hdr->f, dxpl_id, child_class, right_addr, &(internal->node_ptrs[idx + 1].node_nrec), hdr, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
/* More setup for accessing child node information */
@@ -1310,14 +1093,14 @@ H5B2_merge2(H5F_t *f, hid_t dxpl_id, unsigned depth,
/* Redistribute records into left node */
{
/* Copy record from parent node to proper location */
- HDmemcpy(H5B2_NAT_NREC(left_native,shared,*left_nrec),H5B2_INT_NREC(internal,shared,idx),shared->type->nrec_size);
+ HDmemcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec), H5B2_INT_NREC(internal, hdr, idx), hdr->cls->nrec_size);
/* Copy records from right node to left node */
- HDmemcpy(H5B2_NAT_NREC(left_native,shared,*left_nrec+1),H5B2_NAT_NREC(right_native,shared,0),shared->type->nrec_size*(*right_nrec));
+ HDmemcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec + 1), H5B2_NAT_NREC(right_native, hdr, 0), hdr->cls->nrec_size * (*right_nrec));
/* Copy node pointers from right node into left node */
- if(depth>1)
- HDmemcpy(&(left_node_ptrs[*left_nrec+1]),&(right_node_ptrs[0]),sizeof(H5B2_node_ptr_t)*(*right_nrec+1));
+ if(depth > 1)
+ HDmemcpy(&(left_node_ptrs[*left_nrec + 1]), &(right_node_ptrs[0]), sizeof(H5B2_node_ptr_t) * (*right_nrec + 1));
/* Update # of records in left node */
*left_nrec += *right_nrec + 1;
@@ -1327,12 +1110,12 @@ H5B2_merge2(H5F_t *f, hid_t dxpl_id, unsigned depth,
internal->node_ptrs[idx].node_nrec = *left_nrec;
/* Update total # of records in child B-trees */
- internal->node_ptrs[idx].all_nrec += internal->node_ptrs[idx+1].all_nrec + 1;
+ internal->node_ptrs[idx].all_nrec += internal->node_ptrs[idx + 1].all_nrec + 1;
/* Slide records in parent node down, to eliminate demoted record */
- if((idx+1) < internal->nrec) {
- HDmemmove(H5B2_INT_NREC(internal,shared,idx),H5B2_INT_NREC(internal,shared,idx+1),shared->type->nrec_size*(internal->nrec-(idx+1)));
- HDmemmove(&(internal->node_ptrs[idx+1]),&(internal->node_ptrs[idx+2]),sizeof(H5B2_node_ptr_t)*(internal->nrec-(idx+1)));
+ if((idx + 1) < internal->nrec) {
+ HDmemmove(H5B2_INT_NREC(internal, hdr, idx), H5B2_INT_NREC(internal, hdr, idx + 1), hdr->cls->nrec_size * (internal->nrec - (idx + 1)));
+ HDmemmove(&(internal->node_ptrs[idx + 1]), &(internal->node_ptrs[idx + 2]), sizeof(H5B2_node_ptr_t) * (internal->nrec - (idx + 1)));
} /* end if */
/* Update # of records in parent node */
@@ -1344,28 +1127,29 @@ H5B2_merge2(H5F_t *f, hid_t dxpl_id, unsigned depth,
/* Update grandparent info */
curr_node_ptr->node_nrec--;
- /* Mark grandparent as dirty */
- *parent_cache_info_flags_ptr |= H5AC__DIRTIED_FLAG;
+ /* Mark grandparent as dirty, if given */
+ if(parent_cache_info_flags_ptr)
+ *parent_cache_info_flags_ptr |= H5AC__DIRTIED_FLAG;
#ifdef H5B2_DEBUG
- H5B2_assert_internal((hsize_t)0,shared,internal);
- if(depth>1)
- H5B2_assert_internal(internal->node_ptrs[idx].all_nrec,shared,left_child);
+ H5B2_assert_internal((hsize_t)0, hdr, internal);
+ if(depth > 1)
+ H5B2_assert_internal(internal->node_ptrs[idx].all_nrec, hdr, left_child);
else
- H5B2_assert_leaf(shared,left_child);
+ H5B2_assert_leaf(hdr, left_child);
#endif /* H5B2_DEBUG */
/* Unlock left node (marked as dirty) */
- if(H5AC_unprotect(f, dxpl_id, child_class, left_addr, left_child, H5AC__DIRTIED_FLAG) < 0)
+ if(H5AC_unprotect(hdr->f, dxpl_id, child_class, left_addr, left_child, H5AC__DIRTIED_FLAG) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node")
/* Delete right node & remove from cache (marked as dirty) */
- if(H5AC_unprotect(f, dxpl_id, child_class, right_addr, right_child, H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG) < 0)
+ if(H5AC_unprotect(hdr->f, dxpl_id, child_class, right_addr, right_child, H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node")
done:
- FUNC_LEAVE_NOAPI(ret_value);
-} /* end H5B2_merge2 */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5B2_merge2() */
/*-------------------------------------------------------------------------
@@ -1384,7 +1168,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5B2_merge3(H5F_t *f, hid_t dxpl_id, unsigned depth,
+H5B2_merge3(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth,
H5B2_node_ptr_t *curr_node_ptr, unsigned *parent_cache_info_flags_ptr,
H5B2_internal_t *internal, unsigned *internal_flags_ptr, unsigned idx)
{
@@ -1393,28 +1177,23 @@ H5B2_merge3(H5F_t *f, hid_t dxpl_id, unsigned depth,
haddr_t middle_addr; /* Address of middle child node */
void *left_child, *right_child; /* Pointers to left & right child nodes */
void *middle_child; /* Pointer to middle child node */
- unsigned *left_nrec, *right_nrec; /* Pointers to left & right child # of records */
- unsigned *middle_nrec; /* Pointer to middle child # of records */
+ uint16_t *left_nrec, *right_nrec; /* Pointers to left & right child # of records */
+ uint16_t *middle_nrec; /* Pointer to middle child # of records */
uint8_t *left_native, *right_native; /* Pointers to left & right children's native records */
uint8_t *middle_native; /* Pointer to middle child's native records */
- H5B2_node_ptr_t *left_node_ptrs=NULL, *right_node_ptrs=NULL;/* Pointers to childs' node pointer info */
- H5B2_node_ptr_t *middle_node_ptrs=NULL;/* Pointer to child's node pointer info */
- H5B2_shared_t *shared; /* B-tree's shared info */
+ H5B2_node_ptr_t *left_node_ptrs = NULL, *right_node_ptrs = NULL;/* Pointers to childs' node pointer info */
+ H5B2_node_ptr_t *middle_node_ptrs = NULL;/* Pointer to child's node pointer info */
hsize_t middle_moved_nrec; /* Number of records moved, for internal split */
- herr_t ret_value=SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5B2_merge3)
- HDassert(f);
+ /* Check arguments. */
+ HDassert(hdr);
HDassert(curr_node_ptr);
- HDassert(parent_cache_info_flags_ptr);
HDassert(internal);
HDassert(internal_flags_ptr);
- /* Get the pointer to the shared B-tree info */
- shared=(H5B2_shared_t *)H5RC_GET_OBJ(internal->shared);
- HDassert(shared);
-
/* Check for the kind of B-tree node to split */
if(depth > 1) {
H5B2_internal_t *left_internal; /* Pointer to left internal node */
@@ -1423,16 +1202,16 @@ H5B2_merge3(H5F_t *f, hid_t dxpl_id, unsigned depth,
/* Setup information for unlocking child nodes */
child_class = H5AC_BT2_INT;
- left_addr = internal->node_ptrs[idx-1].addr;
+ left_addr = internal->node_ptrs[idx - 1].addr;
middle_addr = internal->node_ptrs[idx].addr;
- right_addr = internal->node_ptrs[idx+1].addr;
+ right_addr = internal->node_ptrs[idx + 1].addr;
/* Lock B-tree child nodes */
- if (NULL == (left_internal = H5B2_protect_internal(f, dxpl_id, internal->shared, left_addr, internal->node_ptrs[idx-1].node_nrec, (depth - 1), H5AC_WRITE)))
+ if(NULL == (left_internal = H5B2_protect_internal(hdr, dxpl_id, left_addr, internal->node_ptrs[idx - 1].node_nrec, (depth - 1), H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
- if (NULL == (middle_internal = H5B2_protect_internal(f, dxpl_id, internal->shared, middle_addr, internal->node_ptrs[idx].node_nrec, (depth - 1), H5AC_WRITE)))
+ if(NULL == (middle_internal = H5B2_protect_internal(hdr, dxpl_id, middle_addr, internal->node_ptrs[idx].node_nrec, (depth - 1), H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
- if (NULL == (right_internal = H5B2_protect_internal(f, dxpl_id, internal->shared, right_addr, internal->node_ptrs[idx+1].node_nrec, (depth - 1), H5AC_WRITE)))
+ if(NULL == (right_internal = H5B2_protect_internal(hdr, dxpl_id, right_addr, internal->node_ptrs[idx + 1].node_nrec, (depth - 1), H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
/* More setup for accessing child node information */
@@ -1456,16 +1235,16 @@ H5B2_merge3(H5F_t *f, hid_t dxpl_id, unsigned depth,
/* Setup information for unlocking child nodes */
child_class = H5AC_BT2_LEAF;
- left_addr = internal->node_ptrs[idx-1].addr;
+ left_addr = internal->node_ptrs[idx - 1].addr;
middle_addr = internal->node_ptrs[idx].addr;
- right_addr = internal->node_ptrs[idx+1].addr;
+ right_addr = internal->node_ptrs[idx + 1].addr;
/* Lock B-tree child nodes */
- if (NULL == (left_leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, child_class, left_addr, &(internal->node_ptrs[idx-1].node_nrec), internal->shared, H5AC_WRITE)))
+ if(NULL == (left_leaf = (H5B2_leaf_t *)H5AC_protect(hdr->f, dxpl_id, child_class, left_addr, &(internal->node_ptrs[idx - 1].node_nrec), hdr, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
- if (NULL == (middle_leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, child_class, middle_addr, &(internal->node_ptrs[idx].node_nrec), internal->shared, H5AC_WRITE)))
+ if(NULL == (middle_leaf = (H5B2_leaf_t *)H5AC_protect(hdr->f, dxpl_id, child_class, middle_addr, &(internal->node_ptrs[idx].node_nrec), hdr, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
- if (NULL == (right_leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, child_class, right_addr, &(internal->node_ptrs[idx+1].node_nrec), internal->shared, H5AC_WRITE)))
+ if(NULL == (right_leaf = (H5B2_leaf_t *)H5AC_protect(hdr->f, dxpl_id, child_class, right_addr, &(internal->node_ptrs[idx + 1].node_nrec), hdr, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
/* More setup for accessing child node information */
@@ -1489,30 +1268,30 @@ H5B2_merge3(H5F_t *f, hid_t dxpl_id, unsigned depth,
middle_moved_nrec = middle_nrec_move;
/* Copy record from parent node to proper location in left node */
- HDmemcpy(H5B2_NAT_NREC(left_native,shared,*left_nrec),H5B2_INT_NREC(internal,shared,idx-1),shared->type->nrec_size);
+ HDmemcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec), H5B2_INT_NREC(internal, hdr, idx - 1), hdr->cls->nrec_size);
/* Copy records from middle node to left node */
- HDmemcpy(H5B2_NAT_NREC(left_native,shared,*left_nrec+1),H5B2_NAT_NREC(middle_native,shared,0),shared->type->nrec_size*(middle_nrec_move-1));
+ HDmemcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec + 1), H5B2_NAT_NREC(middle_native, hdr, 0), hdr->cls->nrec_size * (middle_nrec_move - 1));
/* Copy record from middle node to proper location in parent node */
- HDmemcpy(H5B2_INT_NREC(internal,shared,idx-1),H5B2_NAT_NREC(middle_native,shared,(middle_nrec_move-1)),shared->type->nrec_size);
+ HDmemcpy(H5B2_INT_NREC(internal, hdr, idx - 1), H5B2_NAT_NREC(middle_native, hdr, (middle_nrec_move - 1)), hdr->cls->nrec_size);
/* Slide records in middle node down */
- HDmemmove(H5B2_NAT_NREC(middle_native,shared,0),H5B2_NAT_NREC(middle_native,shared,middle_nrec_move),shared->type->nrec_size*(*middle_nrec-middle_nrec_move));
+ HDmemmove(H5B2_NAT_NREC(middle_native, hdr, 0), H5B2_NAT_NREC(middle_native, hdr, middle_nrec_move), hdr->cls->nrec_size * (*middle_nrec - middle_nrec_move));
/* Move node pointers also if this is an internal node */
- if(depth>1) {
+ if(depth > 1) {
unsigned u; /* Local index variable */
/* Copy node pointers from middle node into left node */
- HDmemcpy(&(left_node_ptrs[*left_nrec+1]),&(middle_node_ptrs[0]),sizeof(H5B2_node_ptr_t)*middle_nrec_move);
+ HDmemcpy(&(left_node_ptrs[*left_nrec + 1]), &(middle_node_ptrs[0]), sizeof(H5B2_node_ptr_t) * middle_nrec_move);
/* Count the number of records being moved into the left node */
- for(u=0; u<middle_nrec_move; u++)
+ for(u = 0; u < middle_nrec_move; u++)
middle_moved_nrec += middle_node_ptrs[u].all_nrec;
/* Slide the node pointers in right node down */
- HDmemmove(&(middle_node_ptrs[0]),&(middle_node_ptrs[middle_nrec_move]),sizeof(H5B2_node_ptr_t)*((*middle_nrec+1)-middle_nrec_move));
+ HDmemmove(&(middle_node_ptrs[0]), &(middle_node_ptrs[middle_nrec_move]), sizeof(H5B2_node_ptr_t) * ((*middle_nrec + 1) - middle_nrec_move));
} /* end if */
/* Update # of records in left & middle nodes */
@@ -1523,32 +1302,32 @@ H5B2_merge3(H5F_t *f, hid_t dxpl_id, unsigned depth,
/* Redistribute records into middle node */
{
/* Copy record from parent node to proper location in middle node */
- HDmemcpy(H5B2_NAT_NREC(middle_native,shared,*middle_nrec),H5B2_INT_NREC(internal,shared,idx),shared->type->nrec_size);
+ HDmemcpy(H5B2_NAT_NREC(middle_native, hdr, *middle_nrec), H5B2_INT_NREC(internal, hdr, idx), hdr->cls->nrec_size);
/* Copy records from right node to middle node */
- HDmemcpy(H5B2_NAT_NREC(middle_native,shared,*middle_nrec+1),H5B2_NAT_NREC(right_native,shared,0),shared->type->nrec_size*(*right_nrec));
+ HDmemcpy(H5B2_NAT_NREC(middle_native, hdr, *middle_nrec + 1), H5B2_NAT_NREC(right_native, hdr, 0), hdr->cls->nrec_size * (*right_nrec));
/* Move node pointers also if this is an internal node */
- if(depth>1)
+ if(depth > 1)
/* Copy node pointers from middle node into left node */
- HDmemcpy(&(middle_node_ptrs[*middle_nrec+1]),&(right_node_ptrs[0]),sizeof(H5B2_node_ptr_t)*(*right_nrec+1));
+ HDmemcpy(&(middle_node_ptrs[*middle_nrec + 1]), &(right_node_ptrs[0]), sizeof(H5B2_node_ptr_t) * (*right_nrec + 1));
/* Update # of records in middle node */
*middle_nrec += *right_nrec + 1;
} /* end block */
/* Update # of records in child nodes */
- internal->node_ptrs[idx-1].node_nrec = *left_nrec;
+ internal->node_ptrs[idx - 1].node_nrec = *left_nrec;
internal->node_ptrs[idx].node_nrec = *middle_nrec;
/* Update total # of records in child B-trees */
- internal->node_ptrs[idx-1].all_nrec += middle_moved_nrec;
- internal->node_ptrs[idx].all_nrec += (internal->node_ptrs[idx+1].all_nrec + 1) - middle_moved_nrec;
+ internal->node_ptrs[idx - 1].all_nrec += middle_moved_nrec;
+ internal->node_ptrs[idx].all_nrec += (internal->node_ptrs[idx + 1].all_nrec + 1) - middle_moved_nrec;
/* Slide records in parent node down, to eliminate demoted record */
- if((idx+1) < internal->nrec) {
- HDmemmove(H5B2_INT_NREC(internal,shared,idx),H5B2_INT_NREC(internal,shared,idx+1),shared->type->nrec_size*(internal->nrec-(idx+1)));
- HDmemmove(&(internal->node_ptrs[idx+1]),&(internal->node_ptrs[idx+2]),sizeof(H5B2_node_ptr_t)*(internal->nrec-(idx+1)));
+ if((idx + 1) < internal->nrec) {
+ HDmemmove(H5B2_INT_NREC(internal, hdr, idx), H5B2_INT_NREC(internal, hdr, idx + 1), hdr->cls->nrec_size * (internal->nrec - (idx + 1)));
+ HDmemmove(&(internal->node_ptrs[idx + 1]), &(internal->node_ptrs[idx + 2]), sizeof(H5B2_node_ptr_t) * (internal->nrec - (idx + 1)));
} /* end if */
/* Update # of records in parent node */
@@ -1560,34 +1339,35 @@ H5B2_merge3(H5F_t *f, hid_t dxpl_id, unsigned depth,
/* Update grandparent info */
curr_node_ptr->node_nrec--;
- /* Mark grandparent as dirty */
- *parent_cache_info_flags_ptr |= H5AC__DIRTIED_FLAG;
+ /* Mark grandparent as dirty, if given */
+ if(parent_cache_info_flags_ptr)
+ *parent_cache_info_flags_ptr |= H5AC__DIRTIED_FLAG;
#ifdef H5B2_DEBUG
- H5B2_assert_internal((hsize_t)0,shared,internal);
- if(depth>1) {
- H5B2_assert_internal2(internal->node_ptrs[idx-1].all_nrec,shared,left_child,middle_child);
- H5B2_assert_internal(internal->node_ptrs[idx].all_nrec,shared,middle_child);
+ H5B2_assert_internal((hsize_t)0, hdr, internal);
+ if(depth > 1) {
+ H5B2_assert_internal2(internal->node_ptrs[idx - 1].all_nrec, hdr, left_child, middle_child);
+ H5B2_assert_internal(internal->node_ptrs[idx].all_nrec, hdr, middle_child);
} /* end if */
else {
- H5B2_assert_leaf2(shared,left_child,middle_child);
- H5B2_assert_leaf(shared,middle_child);
+ H5B2_assert_leaf2(hdr, left_child, middle_child);
+ H5B2_assert_leaf(hdr, middle_child);
} /* end else */
#endif /* H5B2_DEBUG */
/* Unlock left & middle nodes (marked as dirty) */
- if (H5AC_unprotect(f, dxpl_id, child_class, left_addr, left_child, H5AC__DIRTIED_FLAG) < 0)
+ if(H5AC_unprotect(hdr->f, dxpl_id, child_class, left_addr, left_child, H5AC__DIRTIED_FLAG) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node")
- if (H5AC_unprotect(f, dxpl_id, child_class, middle_addr, middle_child, H5AC__DIRTIED_FLAG) < 0)
+ if(H5AC_unprotect(hdr->f, dxpl_id, child_class, middle_addr, middle_child, H5AC__DIRTIED_FLAG) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node")
/* Delete right node & remove from cache (marked as dirty) */
- if(H5AC_unprotect(f, dxpl_id, child_class, right_addr, right_child, H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG) < 0)
+ if(H5AC_unprotect(hdr->f, dxpl_id, child_class, right_addr, right_child, H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node")
done:
- FUNC_LEAVE_NOAPI(ret_value);
-} /* end H5B2_merge3 */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5B2_merge3() */
/*-------------------------------------------------------------------------
@@ -1606,7 +1386,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5B2_swap_leaf(H5F_t *f, hid_t dxpl_id, unsigned depth,
+H5B2_swap_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth,
H5B2_internal_t *internal, unsigned *internal_flags_ptr,
unsigned idx, void *swap_loc)
{
@@ -1614,20 +1394,16 @@ H5B2_swap_leaf(H5F_t *f, hid_t dxpl_id, unsigned depth,
haddr_t child_addr; /* Address of child node */
void *child; /* Pointer to child node */
uint8_t *child_native; /* Pointer to child's native records */
- H5B2_shared_t *shared; /* B-tree's shared info */
- herr_t ret_value=SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5B2_swap_leaf)
- HDassert(f);
+ /* Check arguments. */
+ HDassert(hdr);
HDassert(internal);
HDassert(internal_flags_ptr);
HDassert(idx <= internal->nrec);
- /* Get the pointer to the shared B-tree info */
- shared=(H5B2_shared_t *)H5RC_GET_OBJ(internal->shared);
- HDassert(shared);
-
/* Check for the kind of B-tree node to swap */
if(depth > 1) {
H5B2_internal_t *child_internal; /* Pointer to internal node */
@@ -1637,7 +1413,7 @@ H5B2_swap_leaf(H5F_t *f, hid_t dxpl_id, unsigned depth,
child_addr = internal->node_ptrs[idx].addr;
/* Lock B-tree child nodes */
- if(NULL == (child_internal = H5B2_protect_internal(f, dxpl_id, internal->shared, child_addr, internal->node_ptrs[idx].node_nrec, (depth - 1), H5AC_WRITE)))
+ if(NULL == (child_internal = H5B2_protect_internal(hdr, dxpl_id, child_addr, internal->node_ptrs[idx].node_nrec, (depth - 1), H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
/* More setup for accessing child node information */
@@ -1652,7 +1428,7 @@ H5B2_swap_leaf(H5F_t *f, hid_t dxpl_id, unsigned depth,
child_addr = internal->node_ptrs[idx].addr;
/* Lock B-tree child node */
- if (NULL == (child_leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, child_class, child_addr, &(internal->node_ptrs[idx].node_nrec), internal->shared, H5AC_WRITE)))
+ if(NULL == (child_leaf = (H5B2_leaf_t *)H5AC_protect(hdr->f, dxpl_id, child_class, child_addr, &(internal->node_ptrs[idx].node_nrec), hdr, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
/* More setup for accessing child node information */
@@ -1661,27 +1437,27 @@ H5B2_swap_leaf(H5F_t *f, hid_t dxpl_id, unsigned depth,
} /* end else */
/* Swap records (use disk page as temporary buffer) */
- HDmemcpy(shared->page, H5B2_NAT_NREC(child_native,shared,0), shared->type->nrec_size);
- HDmemcpy(H5B2_NAT_NREC(child_native,shared,0), swap_loc, shared->type->nrec_size);
- HDmemcpy(swap_loc, shared->page, shared->type->nrec_size);
+ HDmemcpy(hdr->page, H5B2_NAT_NREC(child_native, hdr, 0), hdr->cls->nrec_size);
+ HDmemcpy(H5B2_NAT_NREC(child_native, hdr, 0), swap_loc, hdr->cls->nrec_size);
+ HDmemcpy(swap_loc, hdr->page, hdr->cls->nrec_size);
/* Mark parent as dirty */
*internal_flags_ptr |= H5AC__DIRTIED_FLAG;
#ifdef H5B2_DEBUG
- H5B2_assert_internal((hsize_t)0,shared,internal);
- if(depth>1)
- H5B2_assert_internal(internal->node_ptrs[idx].all_nrec,shared,child);
+ H5B2_assert_internal((hsize_t)0, hdr, internal);
+ if(depth > 1)
+ H5B2_assert_internal(internal->node_ptrs[idx].all_nrec, hdr, child);
else
- H5B2_assert_leaf(shared,child);
+ H5B2_assert_leaf(hdr, child);
#endif /* H5B2_DEBUG */
/* Unlock child node */
- if (H5AC_unprotect(f, dxpl_id, child_class, child_addr, child, H5AC__DIRTIED_FLAG) < 0)
+ if(H5AC_unprotect(hdr->f, dxpl_id, child_class, child_addr, child, H5AC__DIRTIED_FLAG) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node")
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B2_swap_leaf */
@@ -1699,11 +1475,10 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5B2_insert_leaf(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
- H5B2_node_ptr_t *curr_node_ptr, void *udata)
+H5B2_insert_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *curr_node_ptr,
+ void *udata)
{
H5B2_leaf_t *leaf; /* Pointer to leaf node */
- H5B2_shared_t *shared; /* Pointer to B-tree's shared information */
int cmp; /* Comparison value of records */
unsigned idx; /* Location of record which matches key */
herr_t ret_value = SUCCEED;
@@ -1711,21 +1486,16 @@ H5B2_insert_leaf(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
FUNC_ENTER_NOAPI_NOINIT(H5B2_insert_leaf)
/* Check arguments. */
- HDassert(f);
- HDassert(bt2_shared);
+ HDassert(hdr);
HDassert(curr_node_ptr);
HDassert(H5F_addr_defined(curr_node_ptr->addr));
/* Lock current B-tree node */
- if (NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr->addr, &(curr_node_ptr->node_nrec), bt2_shared, H5AC_WRITE)))
+ if(NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(hdr->f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr->addr, &(curr_node_ptr->node_nrec), hdr, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
- /* Get the pointer to the shared B-tree info */
- shared=(H5B2_shared_t *)H5RC_GET_OBJ(bt2_shared);
- HDassert(shared);
-
/* Must have a leaf node with enough space to insert a record now */
- HDassert(curr_node_ptr->node_nrec < shared->node_info[0].max_nrec);
+ HDassert(curr_node_ptr->node_nrec < hdr->node_info[0].max_nrec);
/* Sanity check number of records */
HDassert(curr_node_ptr->all_nrec == curr_node_ptr->node_nrec);
@@ -1736,18 +1506,18 @@ H5B2_insert_leaf(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
idx = 0;
else {
/* Find correct location to insert this record */
- if((cmp = H5B2_locate_record(shared->type, leaf->nrec, shared->nat_off, leaf->leaf_native, udata, &idx)) == 0)
+ if((cmp = H5B2_locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx)) == 0)
HGOTO_ERROR(H5E_BTREE, H5E_EXISTS, FAIL, "record is already in B-tree")
if(cmp > 0)
idx++;
/* Make room for new record */
if(idx < leaf->nrec)
- HDmemmove(H5B2_LEAF_NREC(leaf, shared, idx + 1), H5B2_LEAF_NREC(leaf, shared, idx), shared->type->nrec_size * (leaf->nrec-idx));
+ HDmemmove(H5B2_LEAF_NREC(leaf, hdr, idx + 1), H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size * (leaf->nrec - idx));
} /* end else */
/* Make callback to store record in native form */
- if((shared->type->store)(H5B2_LEAF_NREC(leaf, shared, idx), udata) < 0)
+ if((hdr->cls->store)(H5B2_LEAF_NREC(leaf, hdr, idx), udata) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into leaf node")
/* Update record count for node pointer to current node */
@@ -1759,7 +1529,7 @@ H5B2_insert_leaf(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
done:
/* Release the B-tree leaf node (marked as dirty) */
- if(leaf && H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr->addr, leaf, H5AC__DIRTIED_FLAG) < 0)
+ if(leaf && H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr->addr, leaf, H5AC__DIRTIED_FLAG) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release leaf B-tree node")
FUNC_LEAVE_NOAPI(ret_value)
@@ -1780,34 +1550,27 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5B2_insert_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
- unsigned depth, unsigned *parent_cache_info_flags_ptr,
- H5B2_node_ptr_t *curr_node_ptr, void *udata)
+H5B2_insert_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth,
+ unsigned *parent_cache_info_flags_ptr, H5B2_node_ptr_t *curr_node_ptr,
+ void *udata)
{
H5B2_internal_t *internal; /* Pointer to internal node */
unsigned internal_flags = H5AC__NO_FLAGS_SET;
- H5B2_shared_t *shared; /* Pointer to B-tree's shared information */
unsigned idx; /* Location of record which matches key */
herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI_NOINIT(H5B2_insert_internal)
/* Check arguments. */
- HDassert(f);
- HDassert(bt2_shared);
+ HDassert(hdr);
HDassert(depth > 0);
- HDassert(parent_cache_info_flags_ptr);
HDassert(curr_node_ptr);
HDassert(H5F_addr_defined(curr_node_ptr->addr));
/* Lock current B-tree node */
- if(NULL == (internal = H5B2_protect_internal(f, dxpl_id, bt2_shared, curr_node_ptr->addr, curr_node_ptr->node_nrec, depth, H5AC_WRITE)))
+ if(NULL == (internal = H5B2_protect_internal(hdr, dxpl_id, curr_node_ptr->addr, curr_node_ptr->node_nrec, depth, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
- /* Get the pointer to the shared B-tree info */
- shared=(H5B2_shared_t *)H5RC_GET_OBJ(bt2_shared);
- HDassert(shared);
-
/* Split or redistribute child node pointers, if necessary */
{
int cmp; /* Comparison value of records */
@@ -1815,7 +1578,7 @@ H5B2_insert_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
size_t split_nrec; /* Number of records to split node at */
/* Locate node pointer for child */
- if((cmp = H5B2_locate_record(shared->type, internal->nrec, shared->nat_off, internal->int_native, udata, &idx)) == 0)
+ if((cmp = H5B2_locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx)) == 0)
HGOTO_ERROR(H5E_BTREE, H5E_EXISTS, FAIL, "record is already in B-tree")
if(cmp > 0)
idx++;
@@ -1829,29 +1592,29 @@ H5B2_insert_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
retries = 2;
/* Determine the correct number of records to split child node at */
- split_nrec = shared->node_info[depth - 1].split_nrec;
+ split_nrec = hdr->node_info[depth - 1].split_nrec;
/* Preemptively split/redistribute a node we will enter */
while(internal->node_ptrs[idx].node_nrec == split_nrec) {
/* Attempt to redistribute records among children */
if(idx == 0) { /* Left-most child */
- if(retries > 0 && (internal->node_ptrs[idx+1].node_nrec < split_nrec)) {
- if(H5B2_redistribute2(f, dxpl_id, depth, internal, idx) < 0)
+ if(retries > 0 && (internal->node_ptrs[idx + 1].node_nrec < split_nrec)) {
+ if(H5B2_redistribute2(hdr, dxpl_id, depth, internal, idx) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTREDISTRIBUTE, FAIL, "unable to redistribute child node records")
} /* end if */
else {
- if(H5B2_split1(f, dxpl_id, depth, curr_node_ptr,
+ if(H5B2_split1(hdr, dxpl_id, depth, curr_node_ptr,
parent_cache_info_flags_ptr, internal, &internal_flags, idx) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to split child node")
} /* end else */
} /* end if */
else if(idx == internal->nrec) { /* Right-most child */
if(retries > 0 && (internal->node_ptrs[idx - 1].node_nrec < split_nrec)) {
- if(H5B2_redistribute2(f, dxpl_id, depth, internal, (idx - 1)) < 0)
+ if(H5B2_redistribute2(hdr, dxpl_id, depth, internal, (idx - 1)) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTREDISTRIBUTE, FAIL, "unable to redistribute child node records")
} /* end if */
else {
- if(H5B2_split1(f, dxpl_id, depth, curr_node_ptr,
+ if(H5B2_split1(hdr, dxpl_id, depth, curr_node_ptr,
parent_cache_info_flags_ptr, internal, &internal_flags, idx) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to split child node")
} /* end else */
@@ -1859,11 +1622,11 @@ H5B2_insert_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
else { /* Middle child */
if(retries > 0 && ((internal->node_ptrs[idx + 1].node_nrec < split_nrec) ||
(internal->node_ptrs[idx - 1].node_nrec < split_nrec))) {
- if(H5B2_redistribute3(f, dxpl_id, depth, internal, &internal_flags, idx) < 0)
+ if(H5B2_redistribute3(hdr, dxpl_id, depth, internal, &internal_flags, idx) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTREDISTRIBUTE, FAIL, "unable to redistribute child node records")
} /* end if */
else {
- if(H5B2_split1(f, dxpl_id, depth, curr_node_ptr,
+ if(H5B2_split1(hdr, dxpl_id, depth, curr_node_ptr,
parent_cache_info_flags_ptr, internal, &internal_flags, idx) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to split child node")
} /* end else */
@@ -1871,7 +1634,7 @@ H5B2_insert_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
/* Locate node pointer for child (after split/redistribute) */
/* Actually, this can be easily updated (for 2-node redistrib.) and shouldn't require re-searching */
- if((cmp = H5B2_locate_record(shared->type, internal->nrec, shared->nat_off, internal->int_native, udata, &idx)) == 0)
+ if((cmp = H5B2_locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx)) == 0)
HGOTO_ERROR(H5E_BTREE, H5E_EXISTS, FAIL, "record is already in B-tree")
if(cmp > 0)
idx++;
@@ -1883,11 +1646,11 @@ H5B2_insert_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
/* Attempt to insert node */
if(depth > 1) {
- if(H5B2_insert_internal(f, dxpl_id, bt2_shared, (depth - 1), &internal_flags, &internal->node_ptrs[idx], udata) < 0)
+ if(H5B2_insert_internal(hdr, dxpl_id, (depth - 1), &internal_flags, &internal->node_ptrs[idx], udata) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into B-tree internal node")
} /* end if */
else {
- if(H5B2_insert_leaf(f, dxpl_id, bt2_shared, &internal->node_ptrs[idx], udata) < 0)
+ if(H5B2_insert_leaf(hdr, dxpl_id, &internal->node_ptrs[idx], udata) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into B-tree leaf node")
} /* end else */
@@ -1899,7 +1662,7 @@ H5B2_insert_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
done:
/* Release the B-tree internal node */
- if (internal && H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, curr_node_ptr->addr, internal, internal_flags) < 0)
+ if(internal && H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_INT, curr_node_ptr->addr, internal, internal_flags) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release internal B-tree node")
FUNC_LEAVE_NOAPI(ret_value)
@@ -1921,56 +1684,53 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5B2_create_leaf(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared, H5B2_node_ptr_t *node_ptr)
+H5B2_create_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *node_ptr)
{
H5B2_leaf_t *leaf = NULL; /* Pointer to new leaf node created */
- H5B2_shared_t *shared; /* Shared B-tree information */
herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI_NOINIT(H5B2_create_leaf)
/* Check arguments. */
- HDassert(f);
- HDassert(bt2_shared);
+ HDassert(hdr);
HDassert(node_ptr);
/* Allocate memory for leaf information */
if(NULL == (leaf = H5FL_MALLOC(H5B2_leaf_t)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree leaf info")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree leaf info")
/* Set metadata cache info */
HDmemset(&leaf->cache_info, 0, sizeof(H5AC_info_t));
- /* Share common B-tree information */
- leaf->shared = bt2_shared;
- H5RC_INC(leaf->shared);
+ /* Increment ref. count on B-tree header */
+ if(H5B2_hdr_incr(hdr) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTINC, FAIL, "can't increment ref. count on B-tree header")
- /* Get the pointer to the shared B-tree info */
- shared = (H5B2_shared_t *)H5RC_GET_OBJ(leaf->shared);
- HDassert(shared);
+ /* Share B-tree header information */
+ leaf->hdr = hdr;
/* Allocate space for the native keys in memory */
- if((leaf->leaf_native = (uint8_t *)H5FL_FAC_MALLOC(shared->node_info[0].nat_rec_fac)) == NULL)
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree leaf native keys")
+ if(NULL == (leaf->leaf_native = (uint8_t *)H5FL_FAC_MALLOC(hdr->node_info[0].nat_rec_fac)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree leaf native keys")
#ifdef H5_CLEAR_MEMORY
-HDmemset(leaf->leaf_native, 0, shared->type->nrec_size * shared->node_info[0].max_nrec);
+HDmemset(leaf->leaf_native, 0, hdr->cls->nrec_size * hdr->node_info[0].max_nrec);
#endif /* H5_CLEAR_MEMORY */
/* Set number of records */
leaf->nrec = 0;
/* Allocate space on disk for the leaf */
- if(HADDR_UNDEF == (node_ptr->addr=H5MF_alloc(f, H5FD_MEM_BTREE, dxpl_id, (hsize_t)shared->node_size)))
+ if(HADDR_UNDEF == (node_ptr->addr = H5MF_alloc(hdr->f, H5FD_MEM_BTREE, dxpl_id, (hsize_t)hdr->node_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for B-tree leaf node")
/* Cache the new B-tree node */
- if(H5AC_set(f, dxpl_id, H5AC_BT2_LEAF, node_ptr->addr, leaf, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC_set(hdr->f, dxpl_id, H5AC_BT2_LEAF, node_ptr->addr, leaf, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "can't add B-tree leaf to cache")
done:
if(ret_value < 0) {
if(leaf)
- (void)H5B2_cache_leaf_dest(f,leaf);
+ (void)H5B2_cache_leaf_dest(hdr->f, leaf);
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
@@ -1992,18 +1752,16 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5B2_create_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
- H5B2_node_ptr_t *node_ptr, unsigned depth)
+H5B2_create_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *node_ptr,
+ unsigned depth)
{
- H5B2_internal_t *internal=NULL; /* Pointer to new internal node created */
- H5B2_shared_t *shared; /* Shared B-tree information */
+ H5B2_internal_t *internal = NULL; /* Pointer to new internal node created */
herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI_NOINIT(H5B2_create_internal)
/* Check arguments. */
- HDassert(f);
- HDassert(bt2_shared);
+ HDassert(hdr);
HDassert(node_ptr);
HDassert(depth > 0);
@@ -2014,26 +1772,25 @@ H5B2_create_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
/* Set metadata cache info */
HDmemset(&internal->cache_info, 0, sizeof(H5AC_info_t));
- /* Share common B-tree information */
- internal->shared = bt2_shared;
- H5RC_INC(internal->shared);
+ /* Increment ref. count on B-tree header */
+ if(H5B2_hdr_incr(hdr) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTINC, FAIL, "can't increment ref. count on B-tree header")
- /* Get the pointer to the shared B-tree info */
- shared = (H5B2_shared_t *)H5RC_GET_OBJ(internal->shared);
- HDassert(shared);
+ /* Share B-tree header information */
+ internal->hdr = hdr;
/* Allocate space for the native keys in memory */
- if((internal->int_native = (uint8_t *)H5FL_FAC_MALLOC(shared->node_info[depth].nat_rec_fac)) == NULL)
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree internal native keys")
+ if(NULL == (internal->int_native = (uint8_t *)H5FL_FAC_MALLOC(hdr->node_info[depth].nat_rec_fac)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree internal native keys")
#ifdef H5_CLEAR_MEMORY
-HDmemset(internal->int_native, 0, shared->type->nrec_size * shared->node_info[depth].max_nrec);
+HDmemset(internal->int_native, 0, hdr->cls->nrec_size * hdr->node_info[depth].max_nrec);
#endif /* H5_CLEAR_MEMORY */
/* Allocate space for the node pointers in memory */
- if((internal->node_ptrs = (H5B2_node_ptr_t *)H5FL_FAC_MALLOC(shared->node_info[depth].node_ptr_fac)) == NULL)
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree internal node pointers")
+ if(NULL == (internal->node_ptrs = (H5B2_node_ptr_t *)H5FL_FAC_MALLOC(hdr->node_info[depth].node_ptr_fac)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree internal node pointers")
#ifdef H5_CLEAR_MEMORY
-HDmemset(internal->node_ptrs, 0, sizeof(H5B2_node_ptr_t) * (shared->node_info[depth].max_nrec + 1));
+HDmemset(internal->node_ptrs, 0, sizeof(H5B2_node_ptr_t) * (hdr->node_info[depth].max_nrec + 1));
#endif /* H5_CLEAR_MEMORY */
/* Set number of records & depth of the node */
@@ -2041,17 +1798,17 @@ HDmemset(internal->node_ptrs, 0, sizeof(H5B2_node_ptr_t) * (shared->node_info[de
internal->depth = depth;
/* Allocate space on disk for the internal node */
- if(HADDR_UNDEF == (node_ptr->addr = H5MF_alloc(f, H5FD_MEM_BTREE, dxpl_id, (hsize_t)shared->node_size)))
+ if(HADDR_UNDEF == (node_ptr->addr = H5MF_alloc(hdr->f, H5FD_MEM_BTREE, dxpl_id, (hsize_t)hdr->node_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for B-tree internal node")
/* Cache the new B-tree node */
- if(H5AC_set(f, dxpl_id, H5AC_BT2_INT, node_ptr->addr, internal, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC_set(hdr->f, dxpl_id, H5AC_BT2_INT, node_ptr->addr, internal, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "can't add B-tree internal node to cache")
done:
if(ret_value < 0) {
if(internal)
- (void)H5B2_cache_internal_dest(f,internal);
+ (void)H5B2_cache_internal_dest(hdr->f, internal);
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
@@ -2072,7 +1829,7 @@ done:
*-------------------------------------------------------------------------
*/
H5B2_internal_t *
-H5B2_protect_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared, haddr_t addr,
+H5B2_protect_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, haddr_t addr,
unsigned nrec, unsigned depth, H5AC_protect_t rw)
{
H5B2_int_load_ud1_t udata; /* User data to pass through to cache 'load' callback */
@@ -2081,18 +1838,17 @@ H5B2_protect_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared, haddr_t addr,
FUNC_ENTER_NOAPI_NOINIT(H5B2_protect_internal)
/* Check arguments. */
- HDassert(f);
- HDassert(bt2_shared);
+ HDassert(hdr);
HDassert(H5F_addr_defined(addr));
HDassert(depth > 0);
/* Set up user data for callback */
- udata.bt2_shared = bt2_shared;
+ udata.hdr = hdr;
udata.nrec = nrec;
udata.depth = depth;
/* Protect the internal node */
- if(NULL == (ret_value = (H5B2_internal_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_INT, addr, &udata, NULL, rw)))
+ if(NULL == (ret_value = (H5B2_internal_t *)H5AC_protect(hdr->f, dxpl_id, H5AC_BT2_INT, addr, &udata, NULL, rw)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, NULL, "unable to load B-tree internal node")
done:
@@ -2118,10 +1874,9 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5B2_iterate_node(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared, unsigned depth,
+H5B2_iterate_node(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth,
const H5B2_node_ptr_t *curr_node, H5B2_operator_t op, void *op_data)
{
- H5B2_shared_t *shared; /* Pointer to B-tree's shared information */
const H5AC_class_t *curr_node_class = NULL; /* Pointer to current node's class info */
void *node = NULL; /* Pointers to current node */
uint8_t *node_native; /* Pointers to node's native records */
@@ -2133,21 +1888,16 @@ H5B2_iterate_node(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared, unsigned depth,
FUNC_ENTER_NOAPI_NOINIT(H5B2_iterate_node)
/* Check arguments. */
- HDassert(f);
- HDassert(bt2_shared);
+ HDassert(hdr);
HDassert(curr_node);
HDassert(op);
- /* Get the pointer to the shared B-tree info */
- shared = (H5B2_shared_t *)H5RC_GET_OBJ(bt2_shared);
- HDassert(shared);
-
/* Protect current node & set up variables */
if(depth > 0) {
H5B2_internal_t *internal; /* Pointer to internal node */
/* Lock the current B-tree node */
- if(NULL == (internal = H5B2_protect_internal(f, dxpl_id, bt2_shared, curr_node->addr, curr_node->node_nrec, depth, H5AC_READ)))
+ if(NULL == (internal = H5B2_protect_internal(hdr, dxpl_id, curr_node->addr, curr_node->node_nrec, depth, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
/* Set up information about current node */
@@ -2156,8 +1906,8 @@ H5B2_iterate_node(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared, unsigned depth,
node_native = internal->int_native;
/* Allocate space for the node pointers in memory */
- if((node_ptrs = (H5B2_node_ptr_t *)H5FL_FAC_MALLOC(shared->node_info[depth].node_ptr_fac)) == NULL)
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree internal node pointers")
+ if(NULL == (node_ptrs = (H5B2_node_ptr_t *)H5FL_FAC_MALLOC(hdr->node_info[depth].node_ptr_fac)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree internal node pointers")
/* Copy the node pointers */
HDmemcpy(node_ptrs, internal->node_ptrs, (sizeof(H5B2_node_ptr_t) * (curr_node->node_nrec + 1)));
@@ -2166,7 +1916,7 @@ H5B2_iterate_node(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared, unsigned depth,
H5B2_leaf_t *leaf; /* Pointer to leaf node */
/* Lock the current B-tree node */
- if (NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_LEAF, curr_node->addr, &(curr_node->node_nrec), bt2_shared, H5AC_READ)))
+ if(NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(hdr->f, dxpl_id, H5AC_BT2_LEAF, curr_node->addr, &(curr_node->node_nrec), hdr, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
/* Set up information about current node */
@@ -2176,14 +1926,14 @@ H5B2_iterate_node(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared, unsigned depth,
} /* end else */
/* Allocate space for the native keys in memory */
- if((native = (uint8_t *)H5FL_FAC_MALLOC(shared->node_info[depth].nat_rec_fac)) == NULL)
+ if(NULL == (native = (uint8_t *)H5FL_FAC_MALLOC(hdr->node_info[depth].nat_rec_fac)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree internal native keys")
/* Copy the native keys */
- HDmemcpy(native, node_native, (shared->type->nrec_size * curr_node->node_nrec));
+ HDmemcpy(native, node_native, (hdr->cls->nrec_size * curr_node->node_nrec));
/* Unlock the node */
- if(H5AC_unprotect(f, dxpl_id, curr_node_class, curr_node->addr, node, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC_unprotect(hdr->f, dxpl_id, curr_node_class, curr_node->addr, node, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
node = NULL;
@@ -2191,29 +1941,29 @@ H5B2_iterate_node(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared, unsigned depth,
for(u = 0; u < curr_node->node_nrec && !ret_value; u++) {
/* Descend into child node, if current node is an internal node */
if(depth > 0) {
- if((ret_value = H5B2_iterate_node(f, dxpl_id, bt2_shared, (depth - 1), &(node_ptrs[u]), op, op_data)) < 0)
+ if((ret_value = H5B2_iterate_node(hdr, dxpl_id, (depth - 1), &(node_ptrs[u]), op, op_data)) < 0)
HERROR(H5E_BTREE, H5E_CANTLIST, "node iteration failed");
} /* end if */
/* Make callback for current record */
if(!ret_value) {
- if((ret_value = (op)(H5B2_NAT_NREC(native, shared, u), op_data)) < 0)
+ if((ret_value = (op)(H5B2_NAT_NREC(native, hdr, u), op_data)) < 0)
HERROR(H5E_BTREE, H5E_CANTLIST, "iterator function failed");
} /* end if */
} /* end for */
/* Descend into last child node, if current node is an internal node */
if(!ret_value && depth > 0) {
- if((ret_value = H5B2_iterate_node(f, dxpl_id, bt2_shared, (depth - 1), &(node_ptrs[u]), op, op_data)) < 0)
+ if((ret_value = H5B2_iterate_node(hdr, dxpl_id, (depth - 1), &(node_ptrs[u]), op, op_data)) < 0)
HERROR(H5E_BTREE, H5E_CANTLIST, "node iteration failed");
} /* end if */
done:
/* Release the node pointers & native records, if they were copied */
if(node_ptrs)
- H5FL_FAC_FREE(shared->node_info[depth].node_ptr_fac, node_ptrs);
+ H5FL_FAC_FREE(hdr->node_info[depth].node_ptr_fac, node_ptrs);
if(native)
- H5FL_FAC_FREE(shared->node_info[depth].nat_rec_fac, native);
+ H5FL_FAC_FREE(hdr->node_info[depth].nat_rec_fac, native);
FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2_iterate_node() */
@@ -2233,45 +1983,38 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5B2_remove_leaf(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
- H5B2_node_ptr_t *curr_node_ptr, void *udata, H5B2_remove_t op,
- void *op_data)
+H5B2_remove_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *curr_node_ptr,
+ void *udata, H5B2_remove_t op, void *op_data)
{
H5B2_leaf_t *leaf; /* Pointer to leaf node */
haddr_t leaf_addr = HADDR_UNDEF; /* Leaf address on disk */
unsigned leaf_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting leaf node */
- H5B2_shared_t *shared; /* Pointer to B-tree's shared information */
unsigned idx; /* Location of record which matches key */
herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI_NOINIT(H5B2_remove_leaf)
/* Check arguments. */
- HDassert(f);
- HDassert(bt2_shared);
+ HDassert(hdr);
HDassert(curr_node_ptr);
HDassert(H5F_addr_defined(curr_node_ptr->addr));
/* Lock current B-tree node */
leaf_addr = curr_node_ptr->addr;
- if(NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_LEAF, leaf_addr, &(curr_node_ptr->node_nrec), bt2_shared, H5AC_WRITE)))
+ if(NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(hdr->f, dxpl_id, H5AC_BT2_LEAF, leaf_addr, &(curr_node_ptr->node_nrec), hdr, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
- /* Get the pointer to the shared B-tree info */
- shared = (H5B2_shared_t *)H5RC_GET_OBJ(bt2_shared);
- HDassert(shared);
-
/* Sanity check number of records */
HDassert(curr_node_ptr->all_nrec == curr_node_ptr->node_nrec);
HDassert(leaf->nrec == curr_node_ptr->node_nrec);
/* Find correct location to remove this record */
- if(H5B2_locate_record(shared->type, leaf->nrec, shared->nat_off, leaf->leaf_native, udata, &idx) != 0)
+ if(H5B2_locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx) != 0)
HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "record is not in B-tree")
/* Make 'remove' callback if there is one */
if(op)
- if((op)(H5B2_LEAF_NREC(leaf, shared, idx), op_data) < 0)
+ if((op)(H5B2_LEAF_NREC(leaf, hdr, idx), op_data) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to remove record into leaf node")
/* Update number of records in node */
@@ -2283,7 +2026,7 @@ H5B2_remove_leaf(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
if(leaf->nrec > 0) {
/* Pack record out of leaf */
if(idx < leaf->nrec)
- HDmemmove(H5B2_LEAF_NREC(leaf, shared, idx), H5B2_LEAF_NREC(leaf, shared, (idx + 1)), shared->type->nrec_size * (leaf->nrec-idx));
+ HDmemmove(H5B2_LEAF_NREC(leaf, hdr, idx), H5B2_LEAF_NREC(leaf, hdr, (idx + 1)), hdr->cls->nrec_size * (leaf->nrec - idx));
} /* end if */
else {
/* Let the cache know that the object is deleted */
@@ -2298,7 +2041,7 @@ H5B2_remove_leaf(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
done:
/* Release the B-tree leaf node */
- if(leaf && H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, leaf_addr, leaf, leaf_flags) < 0)
+ if(leaf && H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_LEAF, leaf_addr, leaf, leaf_flags) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release leaf B-tree node")
FUNC_LEAVE_NOAPI(ret_value)
@@ -2319,11 +2062,10 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5B2_remove_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
- hbool_t *depth_decreased, void *swap_loc, unsigned depth,
- H5AC_info_t *parent_cache_info, unsigned *parent_cache_info_flags_ptr,
- H5B2_node_ptr_t *curr_node_ptr, void *udata, H5B2_remove_t op,
- void *op_data)
+H5B2_remove_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, hbool_t *depth_decreased,
+ void *swap_loc, unsigned depth, H5AC_info_t *parent_cache_info,
+ unsigned *parent_cache_info_flags_ptr, H5B2_node_ptr_t *curr_node_ptr,
+ void *udata, H5B2_remove_t op, void *op_data)
{
H5AC_info_t *new_cache_info; /* Pointer to new cache info */
unsigned *new_cache_info_flags_ptr = NULL;
@@ -2331,7 +2073,6 @@ H5B2_remove_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
H5B2_internal_t *internal; /* Pointer to internal node */
unsigned internal_flags = H5AC__NO_FLAGS_SET;
haddr_t internal_addr; /* Address of internal node */
- H5B2_shared_t *shared; /* Pointer to B-tree's shared information */
size_t merge_nrec; /* Number of records to merge node at */
hbool_t collapsed_root = FALSE; /* Whether the root was collapsed */
herr_t ret_value = SUCCEED;
@@ -2339,25 +2080,19 @@ H5B2_remove_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
FUNC_ENTER_NOAPI_NOINIT(H5B2_remove_internal)
/* Check arguments. */
- HDassert(f);
- HDassert(bt2_shared);
+ HDassert(hdr);
HDassert(depth > 0);
HDassert(parent_cache_info);
- HDassert(parent_cache_info_flags_ptr);
HDassert(curr_node_ptr);
HDassert(H5F_addr_defined(curr_node_ptr->addr));
/* Lock current B-tree node */
internal_addr = curr_node_ptr->addr;
- if(NULL == (internal = H5B2_protect_internal(f, dxpl_id, bt2_shared, internal_addr, curr_node_ptr->node_nrec, depth, H5AC_WRITE)))
+ if(NULL == (internal = H5B2_protect_internal(hdr, dxpl_id, internal_addr, curr_node_ptr->node_nrec, depth, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
- /* Get the pointer to the shared B-tree info */
- shared = (H5B2_shared_t *)H5RC_GET_OBJ(bt2_shared);
- HDassert(shared);
-
/* Determine the correct number of records to merge at */
- merge_nrec = shared->node_info[depth - 1].merge_nrec;
+ merge_nrec = hdr->node_info[depth - 1].merge_nrec;
/* Check for needing to collapse the root node */
/* (The root node is the only internal node allowed to have 1 record) */
@@ -2365,7 +2100,7 @@ H5B2_remove_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
((internal->node_ptrs[0].node_nrec + internal->node_ptrs[1].node_nrec) <= ((merge_nrec * 2) + 1))) {
/* Merge children of root node */
- if(H5B2_merge2(f, dxpl_id, depth, curr_node_ptr,
+ if(H5B2_merge2(hdr, dxpl_id, depth, curr_node_ptr,
parent_cache_info_flags_ptr, internal, &internal_flags, 0) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to merge child node")
@@ -2397,7 +2132,7 @@ H5B2_remove_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
if(swap_loc)
idx = 0;
else {
- cmp = H5B2_locate_record(shared->type, internal->nrec, shared->nat_off, internal->int_native, udata, &idx);
+ cmp = H5B2_locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx);
if(cmp >= 0)
idx++;
} /* end else */
@@ -2421,22 +2156,22 @@ H5B2_remove_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
*/
if(idx == 0) { /* Left-most child */
if(retries > 0 && (internal->node_ptrs[idx + 1].node_nrec > merge_nrec)) {
- if(H5B2_redistribute2(f, dxpl_id, depth, internal, idx) < 0)
+ if(H5B2_redistribute2(hdr, dxpl_id, depth, internal, idx) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTREDISTRIBUTE, FAIL, "unable to redistribute child node records")
} /* end if */
else {
- if(H5B2_merge2(f, dxpl_id, depth, curr_node_ptr,
+ if(H5B2_merge2(hdr, dxpl_id, depth, curr_node_ptr,
parent_cache_info_flags_ptr, internal, &internal_flags, idx) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to merge child node")
} /* end else */
} /* end if */
else if(idx == internal->nrec) { /* Right-most child */
if(retries > 0 && (internal->node_ptrs[idx - 1].node_nrec > merge_nrec)) {
- if(H5B2_redistribute2(f, dxpl_id, depth, internal, (idx - 1)) < 0)
+ if(H5B2_redistribute2(hdr, dxpl_id, depth, internal, (idx - 1)) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTREDISTRIBUTE, FAIL, "unable to redistribute child node records")
} /* end if */
else {
- if(H5B2_merge2(f, dxpl_id, depth, curr_node_ptr,
+ if(H5B2_merge2(hdr, dxpl_id, depth, curr_node_ptr,
parent_cache_info_flags_ptr, internal, &internal_flags, (idx - 1)) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to merge child node")
} /* end else */
@@ -2444,11 +2179,11 @@ H5B2_remove_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
else { /* Middle child */
if(retries > 0 && ((internal->node_ptrs[idx + 1].node_nrec > merge_nrec) ||
(internal->node_ptrs[idx - 1].node_nrec > merge_nrec))) {
- if(H5B2_redistribute3(f, dxpl_id, depth, internal, &internal_flags, idx) < 0)
+ if(H5B2_redistribute3(hdr, dxpl_id, depth, internal, &internal_flags, idx) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTREDISTRIBUTE, FAIL, "unable to redistribute child node records")
} /* end if */
else {
- if(H5B2_merge3(f, dxpl_id, depth, curr_node_ptr,
+ if(H5B2_merge3(hdr, dxpl_id, depth, curr_node_ptr,
parent_cache_info_flags_ptr, internal, &internal_flags, idx) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to merge child node")
} /* end else */
@@ -2459,7 +2194,7 @@ H5B2_remove_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
idx = 0;
else {
/* Actually, this can be easily updated (for 2-node redistrib.) and shouldn't require re-searching */
- cmp = H5B2_locate_record(shared->type, internal->nrec, shared->nat_off, internal->int_native, udata, &idx);
+ cmp = H5B2_locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx);
if(cmp >= 0)
idx++;
} /* end else */
@@ -2470,11 +2205,11 @@ H5B2_remove_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
/* Handle deleting a record from an internal node */
if(!swap_loc && cmp == 0)
- swap_loc = H5B2_INT_NREC(internal, shared, idx - 1);
+ swap_loc = H5B2_INT_NREC(internal, hdr, idx - 1);
/* Swap record to delete with record from leaf, if we are the last internal node */
if(swap_loc && depth == 1)
- if(H5B2_swap_leaf(f, dxpl_id, depth, internal, &internal_flags, idx, swap_loc) < 0)
+ if(H5B2_swap_leaf(hdr, dxpl_id, depth, internal, &internal_flags, idx, swap_loc) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSWAP, FAIL, "Can't swap records in B-tree")
/* Set pointers for advancing to child node */
@@ -2485,12 +2220,12 @@ H5B2_remove_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
/* Attempt to remove record from child node */
if(depth > 1) {
- if(H5B2_remove_internal(f, dxpl_id, bt2_shared, depth_decreased, swap_loc, depth - 1,
+ if(H5B2_remove_internal(hdr, dxpl_id, depth_decreased, swap_loc, depth - 1,
new_cache_info, new_cache_info_flags_ptr, new_node_ptr, udata, op, op_data) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to remove record from B-tree internal node")
} /* end if */
else {
- if(H5B2_remove_leaf(f, dxpl_id, bt2_shared, new_node_ptr, udata, op, op_data) < 0)
+ if(H5B2_remove_leaf(hdr, dxpl_id, new_node_ptr, udata, op, op_data) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to remove record from B-tree leaf node")
} /* end else */
@@ -2502,12 +2237,12 @@ H5B2_remove_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
internal_flags |= H5AC__DIRTIED_FLAG;
#ifdef H5B2_DEBUG
- H5B2_assert_internal((!collapsed_root ? (curr_node_ptr->all_nrec-1) : new_node_ptr->all_nrec),shared,internal);
+ H5B2_assert_internal((!collapsed_root ? (curr_node_ptr->all_nrec - 1) : new_node_ptr->all_nrec), hdr, internal);
#endif /* H5B2_DEBUG */
done:
/* Release the B-tree internal node */
- if(internal && H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, internal_addr, internal, internal_flags) < 0)
+ if(internal && H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_INT, internal_addr, internal, internal_flags) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release internal B-tree node")
FUNC_LEAVE_NOAPI(ret_value)
@@ -2529,33 +2264,27 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5B2_remove_leaf_by_idx(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
+H5B2_remove_leaf_by_idx(H5B2_hdr_t *hdr, hid_t dxpl_id,
H5B2_node_ptr_t *curr_node_ptr, unsigned idx, H5B2_remove_t op,
void *op_data)
{
H5B2_leaf_t *leaf; /* Pointer to leaf node */
haddr_t leaf_addr = HADDR_UNDEF; /* Leaf address on disk */
unsigned leaf_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting leaf node */
- H5B2_shared_t *shared; /* Pointer to B-tree's shared information */
herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI_NOINIT(H5B2_remove_leaf_by_idx)
/* Check arguments. */
- HDassert(f);
- HDassert(bt2_shared);
+ HDassert(hdr);
HDassert(curr_node_ptr);
HDassert(H5F_addr_defined(curr_node_ptr->addr));
/* Lock B-tree leaf node */
leaf_addr = curr_node_ptr->addr;
- if(NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_LEAF, leaf_addr, &(curr_node_ptr->node_nrec), bt2_shared, H5AC_WRITE)))
+ if(NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(hdr->f, dxpl_id, H5AC_BT2_LEAF, leaf_addr, &(curr_node_ptr->node_nrec), hdr, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
- /* Get the pointer to the shared B-tree info */
- shared = (H5B2_shared_t *)H5RC_GET_OBJ(bt2_shared);
- HDassert(shared);
-
/* Sanity check number of records */
HDassert(curr_node_ptr->all_nrec == curr_node_ptr->node_nrec);
HDassert(leaf->nrec == curr_node_ptr->node_nrec);
@@ -2563,7 +2292,7 @@ H5B2_remove_leaf_by_idx(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
/* Make 'remove' callback if there is one */
if(op)
- if((op)(H5B2_LEAF_NREC(leaf, shared, idx), op_data) < 0)
+ if((op)(H5B2_LEAF_NREC(leaf, hdr, idx), op_data) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to remove record into leaf node")
/* Update number of records in node */
@@ -2575,7 +2304,7 @@ H5B2_remove_leaf_by_idx(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
if(leaf->nrec > 0) {
/* Pack record out of leaf */
if(idx < leaf->nrec)
- HDmemmove(H5B2_LEAF_NREC(leaf, shared, idx), H5B2_LEAF_NREC(leaf, shared, (idx + 1)), shared->type->nrec_size * (leaf->nrec-idx));
+ HDmemmove(H5B2_LEAF_NREC(leaf, hdr, idx), H5B2_LEAF_NREC(leaf, hdr, (idx + 1)), hdr->cls->nrec_size * (leaf->nrec - idx));
} /* end if */
else {
/* Let the cache know that the object is deleted */
@@ -2590,7 +2319,7 @@ H5B2_remove_leaf_by_idx(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
done:
/* Release the B-tree leaf node */
- if(leaf && H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, leaf_addr, leaf, leaf_flags) < 0)
+ if(leaf && H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_LEAF, leaf_addr, leaf, leaf_flags) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release leaf B-tree node")
FUNC_LEAVE_NOAPI(ret_value)
@@ -2612,7 +2341,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5B2_remove_internal_by_idx(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
+H5B2_remove_internal_by_idx(H5B2_hdr_t *hdr, hid_t dxpl_id,
hbool_t *depth_decreased, void *swap_loc, unsigned depth,
H5AC_info_t *parent_cache_info, unsigned *parent_cache_info_flags_ptr,
H5B2_node_ptr_t *curr_node_ptr, hsize_t n, H5B2_remove_t op,
@@ -2624,7 +2353,6 @@ H5B2_remove_internal_by_idx(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
H5B2_internal_t *internal; /* Pointer to internal node */
unsigned internal_flags = H5AC__NO_FLAGS_SET;
haddr_t internal_addr; /* Address of internal node */
- H5B2_shared_t *shared; /* Pointer to B-tree's shared information */
size_t merge_nrec; /* Number of records to merge node at */
hbool_t collapsed_root = FALSE; /* Whether the root was collapsed */
herr_t ret_value = SUCCEED;
@@ -2632,36 +2360,30 @@ H5B2_remove_internal_by_idx(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
FUNC_ENTER_NOAPI_NOINIT(H5B2_remove_internal_by_idx)
/* Check arguments. */
- HDassert(f);
- HDassert(bt2_shared);
+ HDassert(hdr);
HDassert(depth > 0);
HDassert(parent_cache_info);
- HDassert(parent_cache_info_flags_ptr);
HDassert(curr_node_ptr);
HDassert(H5F_addr_defined(curr_node_ptr->addr));
/* Lock current B-tree node */
internal_addr = curr_node_ptr->addr;
- if(NULL == (internal = H5B2_protect_internal(f, dxpl_id, bt2_shared, internal_addr, curr_node_ptr->node_nrec, depth, H5AC_WRITE)))
+ if(NULL == (internal = H5B2_protect_internal(hdr, dxpl_id, internal_addr, curr_node_ptr->node_nrec, depth, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
HDassert(internal->nrec == curr_node_ptr->node_nrec);
-
- /* Get the pointer to the shared B-tree info */
- shared = (H5B2_shared_t *)H5RC_GET_OBJ(bt2_shared);
- HDassert(shared);
- HDassert(depth == shared->depth || internal->nrec > 1);
+ HDassert(depth == hdr->depth || internal->nrec > 1);
/* Determine the correct number of records to merge at */
- merge_nrec = shared->node_info[depth - 1].merge_nrec;
+ merge_nrec = hdr->node_info[depth - 1].merge_nrec;
/* Check for needing to collapse the root node */
/* (The root node is the only internal node allowed to have 1 record) */
if(internal->nrec == 1 &&
((internal->node_ptrs[0].node_nrec + internal->node_ptrs[1].node_nrec) <= ((merge_nrec * 2) + 1))) {
- HDassert(depth == shared->depth);
+ HDassert(depth == hdr->depth);
/* Merge children of root node */
- if(H5B2_merge2(f, dxpl_id, depth, curr_node_ptr,
+ if(H5B2_merge2(hdr, dxpl_id, depth, curr_node_ptr,
parent_cache_info_flags_ptr, internal, &internal_flags, 0) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to merge child node")
@@ -2740,22 +2462,22 @@ H5B2_remove_internal_by_idx(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
*/
if(idx == 0) { /* Left-most child */
if(retries > 0 && (internal->node_ptrs[idx + 1].node_nrec > merge_nrec)) {
- if(H5B2_redistribute2(f, dxpl_id, depth, internal, idx) < 0)
+ if(H5B2_redistribute2(hdr, dxpl_id, depth, internal, idx) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTREDISTRIBUTE, FAIL, "unable to redistribute child node records")
} /* end if */
else {
- if(H5B2_merge2(f, dxpl_id, depth, curr_node_ptr,
+ if(H5B2_merge2(hdr, dxpl_id, depth, curr_node_ptr,
parent_cache_info_flags_ptr, internal, &internal_flags, idx) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to merge child node")
} /* end else */
} /* end if */
else if(idx == internal->nrec) { /* Right-most child */
if(retries > 0 && (internal->node_ptrs[idx - 1].node_nrec > merge_nrec)) {
- if(H5B2_redistribute2(f, dxpl_id, depth, internal, (idx - 1)) < 0)
+ if(H5B2_redistribute2(hdr, dxpl_id, depth, internal, (idx - 1)) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTREDISTRIBUTE, FAIL, "unable to redistribute child node records")
} /* end if */
else {
- if(H5B2_merge2(f, dxpl_id, depth, curr_node_ptr,
+ if(H5B2_merge2(hdr, dxpl_id, depth, curr_node_ptr,
parent_cache_info_flags_ptr, internal, &internal_flags, (idx - 1)) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to merge child node")
} /* end else */
@@ -2763,11 +2485,11 @@ H5B2_remove_internal_by_idx(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
else { /* Middle child */
if(retries > 0 && ((internal->node_ptrs[idx + 1].node_nrec > merge_nrec) ||
(internal->node_ptrs[idx - 1].node_nrec > merge_nrec))) {
- if(H5B2_redistribute3(f, dxpl_id, depth, internal, &internal_flags, idx) < 0)
+ if(H5B2_redistribute3(hdr, dxpl_id, depth, internal, &internal_flags, idx) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTREDISTRIBUTE, FAIL, "unable to redistribute child node records")
} /* end if */
else {
- if(H5B2_merge3(f, dxpl_id, depth, curr_node_ptr,
+ if(H5B2_merge3(hdr, dxpl_id, depth, curr_node_ptr,
parent_cache_info_flags_ptr, internal, &internal_flags, idx) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to merge child node")
} /* end else */
@@ -2818,11 +2540,11 @@ H5B2_remove_internal_by_idx(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
/* Handle deleting a record from an internal node */
if(!swap_loc && found)
- swap_loc = H5B2_INT_NREC(internal, shared, idx - 1);
+ swap_loc = H5B2_INT_NREC(internal, hdr, idx - 1);
/* Swap record to delete with record from leaf, if we are the last internal node */
if(swap_loc && depth == 1)
- if(H5B2_swap_leaf(f, dxpl_id, depth, internal, &internal_flags, idx, swap_loc) < 0)
+ if(H5B2_swap_leaf(hdr, dxpl_id, depth, internal, &internal_flags, idx, swap_loc) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSWAP, FAIL, "can't swap records in B-tree")
/* Set pointers for advancing to child node */
@@ -2833,12 +2555,12 @@ H5B2_remove_internal_by_idx(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
/* Attempt to remove record from child node */
if(depth > 1) {
- if(H5B2_remove_internal_by_idx(f, dxpl_id, bt2_shared, depth_decreased, swap_loc, depth - 1,
+ if(H5B2_remove_internal_by_idx(hdr, dxpl_id, depth_decreased, swap_loc, depth - 1,
new_cache_info, new_cache_info_flags_ptr, new_node_ptr, n, op, op_data) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to remove record from B-tree internal node")
} /* end if */
else {
- if(H5B2_remove_leaf_by_idx(f, dxpl_id, bt2_shared, new_node_ptr, (unsigned)n, op, op_data) < 0)
+ if(H5B2_remove_leaf_by_idx(hdr, dxpl_id, new_node_ptr, (unsigned)n, op, op_data) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to remove record from B-tree leaf node")
} /* end else */
@@ -2850,12 +2572,12 @@ H5B2_remove_internal_by_idx(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
internal_flags |= H5AC__DIRTIED_FLAG;
#ifdef H5B2_DEBUG
- H5B2_assert_internal((!collapsed_root ? (curr_node_ptr->all_nrec-1) : new_node_ptr->all_nrec),shared,internal);
+ H5B2_assert_internal((!collapsed_root ? (curr_node_ptr->all_nrec - 1) : new_node_ptr->all_nrec), hdr, internal);
#endif /* H5B2_DEBUG */
done:
/* Release the B-tree internal node */
- if(internal && H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, internal_addr, internal, internal_flags) < 0)
+ if(internal && H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_INT, internal_addr, internal, internal_flags) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release internal B-tree node")
FUNC_LEAVE_NOAPI(ret_value)
@@ -2889,36 +2611,29 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5B2_neighbor_leaf(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
- H5B2_node_ptr_t *curr_node_ptr, void *neighbor_loc,
- H5B2_compare_t comp, void *udata, H5B2_found_t op, void *op_data)
+H5B2_neighbor_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *curr_node_ptr,
+ void *neighbor_loc, H5B2_compare_t comp, void *udata, H5B2_found_t op,
+ void *op_data)
{
H5B2_leaf_t *leaf; /* Pointer to leaf node */
- H5B2_shared_t *shared; /* Pointer to B-tree's shared information */
unsigned idx; /* Location of record which matches key */
- int cmp=0; /* Comparison value of records */
+ int cmp = 0; /* Comparison value of records */
herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI_NOINIT(H5B2_neighbor_leaf)
/* Check arguments. */
- HDassert(f);
- HDassert(bt2_shared);
+ HDassert(hdr);
HDassert(curr_node_ptr);
HDassert(H5F_addr_defined(curr_node_ptr->addr));
HDassert(op);
/* Lock current B-tree node */
- if (NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr->addr, &(curr_node_ptr->node_nrec), bt2_shared, H5AC_READ)))
+ if(NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(hdr->f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr->addr, &(curr_node_ptr->node_nrec), hdr, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
- /* Get the pointer to the shared B-tree info */
- shared=(H5B2_shared_t *)H5RC_GET_OBJ(bt2_shared);
- HDassert(shared);
-
-
/* Locate node pointer for child */
- cmp = H5B2_locate_record(shared->type, leaf->nrec, shared->nat_off, leaf->leaf_native, udata, &idx);
+ cmp = H5B2_locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx);
if(cmp > 0)
idx++;
else
@@ -2928,19 +2643,19 @@ H5B2_neighbor_leaf(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
/* Set the neighbor location, if appropriate */
if(comp == H5B2_COMPARE_LESS) {
if(idx > 0)
- neighbor_loc = H5B2_LEAF_NREC(leaf,shared,idx-1);
+ neighbor_loc = H5B2_LEAF_NREC(leaf, hdr, idx - 1);
} /* end if */
else {
HDassert(comp == H5B2_COMPARE_GREATER);
if(idx < leaf->nrec)
- neighbor_loc = H5B2_LEAF_NREC(leaf,shared,idx);
+ neighbor_loc = H5B2_LEAF_NREC(leaf, hdr, idx);
} /* end else */
/* Make callback if neighbor record has been found */
if(neighbor_loc) {
/* Make callback for current record */
- if ((op)(neighbor_loc, op_data) < 0)
+ if((op)(neighbor_loc, op_data) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "'found' callback failed for B-tree neighbor operation")
} /* end if */
else
@@ -2948,7 +2663,7 @@ H5B2_neighbor_leaf(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
done:
/* Release the B-tree internal node */
- if (leaf && H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr->addr, leaf, H5AC__NO_FLAGS_SET) < 0)
+ if(leaf && H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr->addr, leaf, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree leaf node")
FUNC_LEAVE_NOAPI(ret_value)
@@ -2982,64 +2697,58 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5B2_neighbor_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
- unsigned depth, H5B2_node_ptr_t *curr_node_ptr, void *neighbor_loc,
- H5B2_compare_t comp, void *udata, H5B2_found_t op, void *op_data)
+H5B2_neighbor_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth,
+ H5B2_node_ptr_t *curr_node_ptr, void *neighbor_loc, H5B2_compare_t comp,
+ void *udata, H5B2_found_t op, void *op_data)
{
H5B2_internal_t *internal; /* Pointer to internal node */
- H5B2_shared_t *shared; /* Pointer to B-tree's shared information */
unsigned idx; /* Location of record which matches key */
- int cmp=0; /* Comparison value of records */
+ int cmp = 0; /* Comparison value of records */
herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI_NOINIT(H5B2_neighbor_internal)
/* Check arguments. */
- HDassert(f);
- HDassert(bt2_shared);
- HDassert(depth>0);
+ HDassert(hdr);
+ HDassert(depth > 0);
HDassert(curr_node_ptr);
HDassert(H5F_addr_defined(curr_node_ptr->addr));
HDassert(op);
/* Lock current B-tree node */
- if(NULL == (internal = H5B2_protect_internal(f, dxpl_id, bt2_shared, curr_node_ptr->addr, curr_node_ptr->node_nrec, depth, H5AC_READ)))
+ if(NULL == (internal = H5B2_protect_internal(hdr, dxpl_id, curr_node_ptr->addr, curr_node_ptr->node_nrec, depth, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
- /* Get the pointer to the shared B-tree info */
- shared = (H5B2_shared_t *)H5RC_GET_OBJ(bt2_shared);
- HDassert(shared);
-
/* Locate node pointer for child */
- cmp = H5B2_locate_record(shared->type, internal->nrec, shared->nat_off, internal->int_native, udata, &idx);
+ cmp = H5B2_locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx);
if(cmp > 0)
idx++;
/* Set the neighbor location, if appropriate */
if(comp == H5B2_COMPARE_LESS) {
if(idx > 0)
- neighbor_loc = H5B2_INT_NREC(internal,shared,idx-1);
+ neighbor_loc = H5B2_INT_NREC(internal, hdr, idx - 1);
} /* end if */
else {
HDassert(comp == H5B2_COMPARE_GREATER);
if(idx < internal->nrec)
- neighbor_loc = H5B2_INT_NREC(internal,shared,idx);
+ neighbor_loc = H5B2_INT_NREC(internal, hdr, idx);
} /* end else */
/* Attempt to find neighboring record */
- if(depth>1) {
- if(H5B2_neighbor_internal(f, dxpl_id, bt2_shared, depth-1, &internal->node_ptrs[idx], neighbor_loc, comp, udata, op, op_data) < 0)
+ if(depth > 1) {
+ if(H5B2_neighbor_internal(hdr, dxpl_id, depth - 1, &internal->node_ptrs[idx], neighbor_loc, comp, udata, op, op_data) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "unable to find neighbor record in B-tree internal node")
} /* end if */
else {
- if(H5B2_neighbor_leaf(f, dxpl_id, bt2_shared, &internal->node_ptrs[idx], neighbor_loc, comp, udata, op, op_data) < 0)
+ if(H5B2_neighbor_leaf(hdr, dxpl_id, &internal->node_ptrs[idx], neighbor_loc, comp, udata, op, op_data) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "unable to find neighbor record in B-tree leaf node")
} /* end else */
done:
/* Release the B-tree internal node */
- if (internal && H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, curr_node_ptr->addr, internal, H5AC__NO_FLAGS_SET) < 0)
+ if(internal && H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_INT, curr_node_ptr->addr, internal, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release internal B-tree node")
FUNC_LEAVE_NOAPI(ret_value)
@@ -3061,32 +2770,26 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5B2_delete_node(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared, unsigned depth,
+H5B2_delete_node(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth,
const H5B2_node_ptr_t *curr_node, H5B2_remove_t op, void *op_data)
{
- H5B2_shared_t *shared; /* Pointer to B-tree's shared information */
- const H5AC_class_t *curr_node_class=NULL; /* Pointer to current node's class info */
- void *node=NULL; /* Pointers to current node */
+ const H5AC_class_t *curr_node_class = NULL; /* Pointer to current node's class info */
+ void *node = NULL; /* Pointers to current node */
uint8_t *native; /* Pointers to node's native records */
herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI_NOINIT(H5B2_delete_node)
/* Check arguments. */
- HDassert(f);
- HDassert(bt2_shared);
+ HDassert(hdr);
HDassert(curr_node);
- /* Get the pointer to the shared B-tree info */
- shared=(H5B2_shared_t *)H5RC_GET_OBJ(bt2_shared);
- HDassert(shared);
-
- if(depth>0) {
+ if(depth > 0) {
H5B2_internal_t *internal; /* Pointer to internal node */
unsigned u; /* Local index */
/* Lock the current B-tree node */
- if (NULL == (internal = H5B2_protect_internal(f, dxpl_id, bt2_shared, curr_node->addr, curr_node->node_nrec, depth, H5AC_WRITE)))
+ if(NULL == (internal = H5B2_protect_internal(hdr, dxpl_id, curr_node->addr, curr_node->node_nrec, depth, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
/* Set up information about current node */
@@ -3095,15 +2798,15 @@ H5B2_delete_node(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared, unsigned depth,
native = internal->int_native;
/* Descend into children */
- for(u=0; u<internal->nrec+1; u++)
- if(H5B2_delete_node(f, dxpl_id, bt2_shared, depth-1, &(internal->node_ptrs[u]), op, op_data) < 0)
+ for(u = 0; u < internal->nrec + 1; u++)
+ if(H5B2_delete_node(hdr, dxpl_id, depth - 1, &(internal->node_ptrs[u]), op, op_data) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTLIST, FAIL, "node descent failed")
} /* end if */
else {
H5B2_leaf_t *leaf; /* Pointer to leaf node */
/* Lock the current B-tree node */
- if (NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_LEAF, curr_node->addr, &(curr_node->node_nrec), bt2_shared, H5AC_WRITE)))
+ if(NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(hdr->f, dxpl_id, H5AC_BT2_LEAF, curr_node->addr, &(curr_node->node_nrec), hdr, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
/* Set up information about current node */
@@ -3119,14 +2822,14 @@ H5B2_delete_node(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared, unsigned depth,
/* Iterate through records in this node */
for(u = 0; u < curr_node->node_nrec; u++) {
/* Make callback for each record */
- if((op)(H5B2_NAT_NREC(native, shared, u), op_data) < 0)
+ if((op)(H5B2_NAT_NREC(native, hdr, u), op_data) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTLIST, FAIL, "iterator function failed")
} /* end for */
} /* end if */
done:
/* Unlock & delete current node */
- if(node && H5AC_unprotect(f, dxpl_id, curr_node_class, curr_node->addr, node, H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG) < 0)
+ if(node && H5AC_unprotect(hdr->f, dxpl_id, curr_node_class, curr_node->addr, node, H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
FUNC_LEAVE_NOAPI(ret_value)
@@ -3134,7 +2837,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5B2_iterate_size_node
+ * Function: H5B2_node_size
*
* Purpose: Iterate over all the records from a B-tree node, collecting
* btree storage info.
@@ -3147,28 +2850,22 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5B2_iterate_size_node(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared, unsigned depth,
+H5B2_node_size(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth,
const H5B2_node_ptr_t *curr_node, hsize_t *btree_size)
{
- H5B2_shared_t *shared; /* Pointer to B-tree's shared information */
H5B2_internal_t *internal = NULL; /* Pointer to internal node */
herr_t ret_value = SUCCEED; /* Iterator return value */
- FUNC_ENTER_NOAPI(H5B2_iterate_size_node, FAIL)
+ FUNC_ENTER_NOAPI(H5B2_node_size, FAIL)
/* Check arguments. */
- HDassert(f);
- HDassert(bt2_shared);
+ HDassert(hdr);
HDassert(curr_node);
HDassert(btree_size);
HDassert(depth > 0);
- /* Get the pointer to the shared B-tree info */
- shared = (H5B2_shared_t *)H5RC_GET_OBJ(bt2_shared);
- HDassert(shared);
-
/* Lock the current B-tree node */
- if(NULL == (internal = H5B2_protect_internal(f, dxpl_id, bt2_shared, curr_node->addr, curr_node->node_nrec, depth, H5AC_READ)))
+ if(NULL == (internal = H5B2_protect_internal(hdr, dxpl_id, curr_node->addr, curr_node->node_nrec, depth, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
/* Recursively descend into child nodes, if we are above the "twig" level in the B-tree */
@@ -3177,21 +2874,21 @@ H5B2_iterate_size_node(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared, unsigned dep
/* Descend into children */
for(u = 0; u < internal->nrec + 1; u++)
- if(H5B2_iterate_size_node(f, dxpl_id, bt2_shared, (depth - 1), &(internal->node_ptrs[u]), btree_size) < 0)
+ if(H5B2_node_size(hdr, dxpl_id, (depth - 1), &(internal->node_ptrs[u]), btree_size) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTLIST, FAIL, "node iteration failed")
} /* end if */
else /* depth is 1: count all the leaf nodes from this node */
- *btree_size += (internal->nrec + 1) * shared->node_size;
+ *btree_size += (internal->nrec + 1) * hdr->node_size;
/* Count this node */
- *btree_size += shared->node_size;
+ *btree_size += hdr->node_size;
done:
- if(internal && H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, curr_node->addr, internal, H5AC__NO_FLAGS_SET) < 0)
+ if(internal && H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_INT, curr_node->addr, internal, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5B2_iterate_size_node() */
+} /* H5B2_node_size() */
#ifdef H5B2_DEBUG
@@ -3209,10 +2906,10 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5B2_assert_leaf(H5B2_shared_t *shared, H5B2_leaf_t *leaf)
+H5B2_assert_leaf(H5B2_hdr_t *hdr, H5B2_leaf_t *leaf)
{
/* General sanity checking on node */
- HDassert(leaf->nrec<=shared->node_info->split_nrec);
+ HDassert(leaf->nrec <= hdr->node_info->split_nrec);
return(0);
} /* end H5B2_assert_leaf() */
@@ -3232,10 +2929,10 @@ H5B2_assert_leaf(H5B2_shared_t *shared, H5B2_leaf_t *leaf)
*-------------------------------------------------------------------------
*/
static herr_t
-H5B2_assert_leaf2(H5B2_shared_t *shared, H5B2_leaf_t *leaf, H5B2_leaf_t *leaf2)
+H5B2_assert_leaf2(H5B2_hdr_t *hdr, H5B2_leaf_t *leaf, H5B2_leaf_t *leaf2)
{
/* General sanity checking on node */
- HDassert(leaf->nrec<=shared->node_info->split_nrec);
+ HDassert(leaf->nrec <= hdr->node_info->split_nrec);
return(0);
} /* end H5B2_assert_leaf() */
@@ -3255,27 +2952,27 @@ H5B2_assert_leaf2(H5B2_shared_t *shared, H5B2_leaf_t *leaf, H5B2_leaf_t *leaf2)
*-------------------------------------------------------------------------
*/
static herr_t
-H5B2_assert_internal(hsize_t parent_all_nrec, H5B2_shared_t *shared, H5B2_internal_t *internal)
+H5B2_assert_internal(hsize_t parent_all_nrec, H5B2_hdr_t *hdr, H5B2_internal_t *internal)
{
hsize_t tot_all_nrec; /* Total number of records at or below this node */
- unsigned u,v; /* Local index variables */
+ unsigned u, v; /* Local index variables */
/* General sanity checking on node */
- HDassert(internal->nrec<=shared->node_info->split_nrec);
+ HDassert(internal->nrec <= hdr->node_info->split_nrec);
/* Sanity checking on node pointers */
- tot_all_nrec=internal->nrec;
- for(u=0; u<internal->nrec+1; u++) {
+ tot_all_nrec = internal->nrec;
+ for(u = 0; u < internal->nrec + 1; u++) {
tot_all_nrec += internal->node_ptrs[u].all_nrec;
HDassert(H5F_addr_defined(internal->node_ptrs[u].addr));
- HDassert(internal->node_ptrs[u].addr>0);
- for(v=0; v<u; v++)
- HDassert(internal->node_ptrs[u].addr!=internal->node_ptrs[v].addr);
+ HDassert(internal->node_ptrs[u].addr > 0);
+ for(v = 0; v < u; v++)
+ HDassert(internal->node_ptrs[u].addr != internal->node_ptrs[v].addr);
} /* end for */
/* Sanity check all_nrec total in parent */
- if(parent_all_nrec>0)
+ if(parent_all_nrec > 0)
HDassert(tot_all_nrec == parent_all_nrec);
return(0);
@@ -3296,29 +2993,29 @@ H5B2_assert_internal(hsize_t parent_all_nrec, H5B2_shared_t *shared, H5B2_intern
*-------------------------------------------------------------------------
*/
static herr_t
-H5B2_assert_internal2(hsize_t parent_all_nrec, H5B2_shared_t *shared, H5B2_internal_t *internal, H5B2_internal_t *internal2)
+H5B2_assert_internal2(hsize_t parent_all_nrec, H5B2_hdr_t *hdr, H5B2_internal_t *internal, H5B2_internal_t *internal2)
{
hsize_t tot_all_nrec; /* Total number of records at or below this node */
- unsigned u,v; /* Local index variables */
+ unsigned u, v; /* Local index variables */
/* General sanity checking on node */
- HDassert(internal->nrec<=shared->node_info->split_nrec);
+ HDassert(internal->nrec <= hdr->node_info->split_nrec);
/* Sanity checking on node pointers */
- tot_all_nrec=internal->nrec;
- for(u=0; u<internal->nrec+1; u++) {
+ tot_all_nrec =internal->nrec;
+ for(u =0; u < internal->nrec + 1; u++) {
tot_all_nrec += internal->node_ptrs[u].all_nrec;
HDassert(H5F_addr_defined(internal->node_ptrs[u].addr));
- HDassert(internal->node_ptrs[u].addr>0);
- for(v=0; v<u; v++)
- HDassert(internal->node_ptrs[u].addr!=internal->node_ptrs[v].addr);
- for(v=0; v<internal2->nrec+1; v++)
- HDassert(internal->node_ptrs[u].addr!=internal2->node_ptrs[v].addr);
+ HDassert(internal->node_ptrs[u].addr > 0);
+ for(v = 0; v < u; v++)
+ HDassert(internal->node_ptrs[u].addr != internal->node_ptrs[v].addr);
+ for(v = 0; v < internal2->nrec + 1; v++)
+ HDassert(internal->node_ptrs[u].addr != internal2->node_ptrs[v].addr);
} /* end for */
/* Sanity check all_nrec total in parent */
- if(parent_all_nrec>0)
+ if(parent_all_nrec > 0)
HDassert(tot_all_nrec == parent_all_nrec);
return(0);
diff --git a/src/H5B2pkg.h b/src/H5B2pkg.h
index c5af54f..8b68d1e 100644
--- a/src/H5B2pkg.h
+++ b/src/H5B2pkg.h
@@ -34,24 +34,28 @@
/* Other private headers needed by this file */
#include "H5ACprivate.h" /* Metadata cache */
#include "H5FLprivate.h" /* Free Lists */
-#include "H5RCprivate.h" /* Reference counted object functions */
+
/**************************/
/* Package Private Macros */
/**************************/
/* Size of storage for number of records per node (on disk) */
-#define H5B2_SIZEOF_RECORDS_PER_NODE 2
+#define H5B2_SIZEOF_RECORDS_PER_NODE (unsigned)2
/* Size of a "tree pointer" (on disk) */
/* (essentially, the largest internal pointer allowed) */
-#define H5B2_TREE_POINTER_SIZE(f) (H5F_SIZEOF_ADDR(f)+H5B2_SIZEOF_RECORDS_PER_NODE+H5F_SIZEOF_SIZE(f))
+#define H5B2_TREE_POINTER_SIZE(h) ( \
+ (h)->sizeof_addr + \
+ H5B2_SIZEOF_RECORDS_PER_NODE + \
+ (h)->sizeof_size \
+ )
/* Size of a internal node pointer (on disk) */
-#define H5B2_INT_POINTER_SIZE(f, s, d) ( \
- H5F_SIZEOF_ADDR(f) /* Address of child node */ \
- + (s)->max_nrec_size /* # of records in child node */ \
- + (s)->node_info[(d) - 1].cum_max_nrec_size /* Total # of records in child & below */ \
+#define H5B2_INT_POINTER_SIZE(h, d) ( \
+ (h)->sizeof_addr /* Address of child node */ \
+ + (h)->max_nrec_size /* # of records in child node */ \
+ + (h)->node_info[(d) - 1].cum_max_nrec_size /* Total # of records in child & below */ \
)
/* Size of checksum information (on disk) */
@@ -59,24 +63,24 @@
/* Format overhead for all v2 B-tree metadata in the file */
#define H5B2_METADATA_PREFIX_SIZE ( \
- H5_SIZEOF_MAGIC /* Signature */ \
- + 1 /* Version */ \
- + 1 /* Tree type */ \
- + H5B2_SIZEOF_CHKSUM /* Metadata checksum */ \
+ (unsigned)H5_SIZEOF_MAGIC /* Signature */ \
+ + (unsigned)1 /* Version */ \
+ + (unsigned)1 /* Tree type */ \
+ + (unsigned)H5B2_SIZEOF_CHKSUM /* Metadata checksum */ \
)
/* Size of the v2 B-tree header on disk */
-#define H5B2_HEADER_SIZE(f) ( \
+#define H5B2_HEADER_SIZE(h) ( \
/* General metadata fields */ \
H5B2_METADATA_PREFIX_SIZE \
\
/* Header specific fields */ \
- + 4 /* Node size, in bytes */ \
- + 2 /* Record size, in bytes */ \
- + 2 /* Depth of tree */ \
- + 1 /* Split % of full (as integer, ie. "98" means 98%) */ \
- + 1 /* Merge % of full (as integer, ie. "98" means 98%) */ \
- + H5B2_TREE_POINTER_SIZE(f) /* Node pointer to root node in tree */ \
+ + (unsigned)4 /* Node size, in bytes */ \
+ + (unsigned)2 /* Record size, in bytes */ \
+ + (unsigned)2 /* Depth of tree */ \
+ + (unsigned)1 /* Split % of full (as integer, ie. "98" means 98%) */ \
+ + (unsigned)1 /* Merge % of full (as integer, ie. "98" means 98%) */ \
+ + H5B2_TREE_POINTER_SIZE(h) /* Node pointer to root node in tree */ \
)
/* Size of the v2 B-tree internal node prefix */
@@ -98,13 +102,18 @@
)
/* Macro to retrieve pointer to i'th native record for native record buffer */
-#define H5B2_NAT_NREC(b, shared, idx) ((b) + (shared)->nat_off[(idx)])
+#define H5B2_NAT_NREC(b, hdr, idx) ((b) + (hdr)->nat_off[(idx)])
/* Macro to retrieve pointer to i'th native record for internal node */
-#define H5B2_INT_NREC(i, shared, idx) H5B2_NAT_NREC((i)->int_native, (shared), (idx))
+#define H5B2_INT_NREC(i, hdr, idx) H5B2_NAT_NREC((i)->int_native, (hdr), (idx))
/* Macro to retrieve pointer to i'th native record for leaf node */
-#define H5B2_LEAF_NREC(l, shared, idx) H5B2_NAT_NREC((l)->leaf_native, (shared), (idx))
+#define H5B2_LEAF_NREC(l, hdr, idx) H5B2_NAT_NREC((l)->leaf_native, (hdr), (idx))
+
+/* Number of records that fit into internal node */
+/* (accounts for extra node pointer by counting it in with the prefix bytes) */
+#define H5B2_NUM_INT_REC(h, d) \
+ (((h)->node_size - (H5B2_INT_PREFIX_SIZE + H5B2_INT_POINTER_SIZE(h, d))) / ((h)->rrec_size + H5B2_INT_POINTER_SIZE(h, d)))
/****************************/
@@ -114,7 +123,7 @@
/* A "node pointer" to another B-tree node */
typedef struct {
haddr_t addr; /* Address of other node */
- unsigned node_nrec; /* Number of records used in node pointed to */
+ uint16_t node_nrec; /* Number of records used in node pointed to */
hsize_t all_nrec; /* Number of records in node pointed to and all it's children */
} H5B2_node_ptr_t;
@@ -129,38 +138,41 @@ typedef struct {
H5FL_fac_head_t *node_ptr_fac; /* Factory for node pointer blocks */
} H5B2_node_info_t;
-/* Each B-tree has certain information that can be shared across all
- * the instances of nodes in that B-tree.
- */
-typedef struct H5B2_shared_t {
- /* Shared internal data structures */
- const H5B2_class_t *type; /* Type of tree */
- uint8_t *page; /* Common disk page for I/O */
- size_t *nat_off; /* Array of offsets of native records */
- H5B2_node_info_t *node_info; /* Table of node info structs for current depth of B-tree */
+/* The B-tree header information */
+typedef struct H5B2_hdr_t {
+ /* Information for H5AC cache functions, _must_ be first field in structure */
+ H5AC_info_t cache_info;
+
+ /* Internal B-tree information (stored) */
+ H5B2_node_ptr_t root; /* Node pointer to root node in B-tree */
/* Information set by user (stored) */
- unsigned split_percent; /* Percent full at which to split the node, when inserting */
- unsigned merge_percent; /* Percent full at which to merge the node, when deleting */
- size_t node_size; /* Size of B-tree nodes, in bytes */
- size_t rrec_size; /* Size of "raw" (on disk) record, in bytes */
+ uint8_t split_percent; /* Percent full at which to split the node, when inserting */
+ uint8_t merge_percent; /* Percent full at which to merge the node, when deleting */
+ uint32_t node_size; /* Size of B-tree nodes, in bytes */
+ uint32_t rrec_size; /* Size of "raw" (on disk) record, in bytes */
/* Dynamic information (stored) */
- unsigned depth; /* B-tree's overall depth */
+ uint16_t depth; /* B-tree's overall depth */
- /* Derived information from user's information */
+ /* Derived information from user's information (not stored) */
uint8_t max_nrec_size; /* Size to store max. # of records in any node (in bytes) */
-} H5B2_shared_t;
-
-/* The B-tree information */
-typedef struct H5B2_t {
- /* Information for H5AC cache functions, _must_ be first field in structure */
- H5AC_info_t cache_info;
- /* Internal B-tree information */
- H5B2_node_ptr_t root; /* Node pointer to root node in B-tree */
- H5RC_t *shared; /* Ref-counted shared info */
-} H5B2_t;
+ /* Shared internal data structures (not stored) */
+ H5F_t *f; /* Pointer to the file that the B-tree is in */
+ haddr_t addr; /* Address of B-tree header in the file */
+ size_t rc; /* Reference count of nodes using this header */
+ size_t file_rc; /* Reference count of files using this header */
+ hbool_t pending_delete; /* B-tree is pending deletion */
+ uint8_t sizeof_size; /* Size of file sizes */
+ uint8_t sizeof_addr; /* Size of file addresses */
+ H5B2_remove_t remove_op; /* Callback operator for deleting B-tree */
+ void *remove_op_data;/* B-tree deletion callback's context */
+ const H5B2_class_t *cls; /* Class of B-tree client */
+ uint8_t *page; /* Common disk page for I/O */
+ size_t *nat_off; /* Array of offsets of native records */
+ H5B2_node_info_t *node_info; /* Table of node info structs for current depth of B-tree */
+} H5B2_hdr_t;
/* B-tree leaf node information */
typedef struct H5B2_leaf_t {
@@ -168,9 +180,9 @@ typedef struct H5B2_leaf_t {
H5AC_info_t cache_info;
/* Internal B-tree information */
- H5RC_t *shared; /* Ref-counted shared info */
+ H5B2_hdr_t *hdr; /* Pointer to the [pinned] v2 B-tree header */
uint8_t *leaf_native; /* Pointer to native records */
- unsigned nrec; /* Number of records in node */
+ uint16_t nrec; /* Number of records in node */
} H5B2_leaf_t;
/* B-tree internal node information */
@@ -179,18 +191,24 @@ typedef struct H5B2_internal_t {
H5AC_info_t cache_info;
/* Internal B-tree information */
- H5RC_t *shared; /* Ref-counted shared info */
+ H5B2_hdr_t *hdr; /* Pointer to the [pinned] v2 B-tree header */
uint8_t *int_native; /* Pointer to native records */
H5B2_node_ptr_t *node_ptrs; /* Pointer to node pointers */
- unsigned nrec; /* Number of records in node */
- unsigned depth; /* Depth of this node in the B-tree */
+ uint16_t nrec; /* Number of records in node */
+ uint16_t depth; /* Depth of this node in the B-tree */
} H5B2_internal_t;
+/* v2 B-tree */
+struct H5B2_t {
+ H5B2_hdr_t *hdr; /* Pointer to internal v2 B-tree header info */
+ H5F_t *f; /* Pointer to file for v2 B-tree */
+};
+
/* User data for metadata cache 'load' callback */
typedef struct {
- H5RC_t *bt2_shared; /* Ref counter for shared B-tree info */
- unsigned nrec; /* Number of records in node to load */
- unsigned depth; /* Depth of node to load */
+ H5B2_hdr_t *hdr; /* Pointer to the [pinned] v2 B-tree header */
+ uint16_t nrec; /* Number of records in node to load */
+ uint16_t depth; /* Depth of node to load */
} H5B2_int_load_ud1_t;
#ifdef H5B2_TESTING
@@ -215,9 +233,6 @@ H5_DLLVAR const H5AC_class_t H5AC_BT2_INT[1];
/* H5B2 leaf node inherits cache-like properties from H5AC */
H5_DLLVAR const H5AC_class_t H5AC_BT2_LEAF[1];
-/* Declare a free list to manage the H5B2_t struct */
-H5FL_EXTERN(H5B2_t);
-
/* Declare a free list to manage the H5B2_internal_t struct */
H5FL_EXTERN(H5B2_internal_t);
@@ -229,74 +244,82 @@ H5FL_EXTERN(H5B2_leaf_t);
H5_DLLVAR const H5B2_class_t H5B2_TEST[1];
#endif /* H5B2_TESTING */
+/* Array of v2 B-tree client ID -> client class mappings */
+extern const H5B2_class_t *const H5B2_client_class_g[];
+
/******************************/
/* Package Private Prototypes */
/******************************/
-/* Routines for managing shared B-tree info */
-H5_DLL herr_t H5B2_shared_init(H5F_t *f, H5B2_t *bt2, const H5B2_class_t *type,
- unsigned depth, size_t node_size, size_t rrec_size,
- unsigned split_percent, unsigned merge_percent);
+/* Routines for managing B-tree header info */
+H5_DLL H5B2_hdr_t *H5B2_hdr_alloc(H5F_t *f);
+H5_DLL haddr_t H5B2_hdr_create(H5F_t *f, hid_t dxpl_id,
+ const H5B2_create_t *cparam);
+H5_DLL herr_t H5B2_hdr_init(H5F_t *f, H5B2_hdr_t *hdr,
+ const H5B2_create_t *cparam, uint16_t depth);
+H5_DLL herr_t H5B2_hdr_incr(H5B2_hdr_t *hdr);
+H5_DLL herr_t H5B2_hdr_decr(H5B2_hdr_t *hdr);
+H5_DLL herr_t H5B2_hdr_fuse_incr(H5B2_hdr_t *hdr);
+H5_DLL size_t H5B2_hdr_fuse_decr(H5B2_hdr_t *hdr);
+H5_DLL herr_t H5B2_hdr_dirty(H5B2_hdr_t *hdr);
+H5_DLL herr_t H5B2_hdr_free(H5B2_hdr_t *hdr);
+H5_DLL herr_t H5B2_hdr_delete(H5B2_hdr_t *hdr, hid_t dxpl_id);
/* Routines for operating on internal nodes */
-H5_DLL H5B2_internal_t *H5B2_protect_internal(H5F_t *f, hid_t dxpl_id,
- H5RC_t *bt2_shared, haddr_t addr, unsigned nrec, unsigned depth,
- H5AC_protect_t rw);
+H5_DLL H5B2_internal_t *H5B2_protect_internal(H5B2_hdr_t *hdr, hid_t dxpl_id,
+ haddr_t addr, unsigned nrec, unsigned depth, H5AC_protect_t rw);
/* Routines for allocating nodes */
-H5_DLL herr_t H5B2_split_root(H5F_t *f, hid_t dxpl_id, H5B2_t *bt2,
- unsigned *bt2_flags_ptr);
-H5_DLL herr_t H5B2_create_leaf(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
+H5_DLL herr_t H5B2_split_root(H5B2_hdr_t *hdr, hid_t dxpl_id);
+H5_DLL herr_t H5B2_create_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id,
H5B2_node_ptr_t *node_ptr);
/* Routines for inserting records */
-H5_DLL herr_t H5B2_insert_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
+H5_DLL herr_t H5B2_insert_internal(H5B2_hdr_t *hdr, hid_t dxpl_id,
unsigned depth, unsigned *parent_cache_info_flags_ptr,
H5B2_node_ptr_t *curr_node_ptr, void *udata);
-H5_DLL herr_t H5B2_insert_leaf(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
+H5_DLL herr_t H5B2_insert_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id,
H5B2_node_ptr_t *curr_node_ptr, void *udata);
/* Routines for iterating over nodes/records */
-H5_DLL herr_t H5B2_iterate_node(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
- unsigned depth, const H5B2_node_ptr_t *curr_node, H5B2_operator_t op,
- void *op_data);
-H5_DLL herr_t H5B2_iterate_size_node(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
+H5_DLL herr_t H5B2_iterate_node(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth,
+ const H5B2_node_ptr_t *curr_node, H5B2_operator_t op, void *op_data);
+H5_DLL herr_t H5B2_node_size(H5B2_hdr_t *hdr, hid_t dxpl_id,
unsigned depth, const H5B2_node_ptr_t *curr_node, hsize_t *op_data);
/* Routines for locating records */
H5_DLL int H5B2_locate_record(const H5B2_class_t *type, unsigned nrec,
size_t *rec_off, const uint8_t *native, const void *udata, unsigned *idx);
-H5_DLL herr_t H5B2_neighbor_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
+H5_DLL herr_t H5B2_neighbor_internal(H5B2_hdr_t *hdr, hid_t dxpl_id,
unsigned depth, H5B2_node_ptr_t *curr_node_ptr, void *neighbor_loc,
H5B2_compare_t comp, void *udata, H5B2_found_t op, void *op_data);
-H5_DLL herr_t H5B2_neighbor_leaf(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
+H5_DLL herr_t H5B2_neighbor_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id,
H5B2_node_ptr_t *curr_node_ptr, void *neighbor_loc,
H5B2_compare_t comp, void *udata, H5B2_found_t op, void *op_data);
/* Routines for removing records */
-H5_DLL herr_t H5B2_remove_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
+H5_DLL herr_t H5B2_remove_internal(H5B2_hdr_t *hdr, hid_t dxpl_id,
hbool_t *depth_decreased, void *swap_loc, unsigned depth, H5AC_info_t *parent_cache_info,
hbool_t * parent_cache_info_dirtied_ptr, H5B2_node_ptr_t *curr_node_ptr, void *udata,
H5B2_remove_t op, void *op_data);
-H5_DLL herr_t H5B2_remove_leaf(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
+H5_DLL herr_t H5B2_remove_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id,
H5B2_node_ptr_t *curr_node_ptr, void *udata, H5B2_remove_t op,
void *op_data);
-H5_DLL herr_t H5B2_remove_internal_by_idx(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
+H5_DLL herr_t H5B2_remove_internal_by_idx(H5B2_hdr_t *hdr, hid_t dxpl_id,
hbool_t *depth_decreased, void *swap_loc, unsigned depth, H5AC_info_t *parent_cache_info,
hbool_t * parent_cache_info_dirtied_ptr, H5B2_node_ptr_t *curr_node_ptr, hsize_t idx,
H5B2_remove_t op, void *op_data);
-H5_DLL herr_t H5B2_remove_leaf_by_idx(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
+H5_DLL herr_t H5B2_remove_leaf_by_idx(H5B2_hdr_t *hdr, hid_t dxpl_id,
H5B2_node_ptr_t *curr_node_ptr, unsigned idx, H5B2_remove_t op,
void *op_data);
/* Routines for deleting nodes */
-H5_DLL herr_t H5B2_delete_node(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
- unsigned depth, const H5B2_node_ptr_t *curr_node, H5B2_remove_t op,
- void *op_data);
+H5_DLL herr_t H5B2_delete_node(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth,
+ const H5B2_node_ptr_t *curr_node, H5B2_remove_t op, void *op_data);
/* Metadata cache callbacks */
-H5_DLL herr_t H5B2_cache_hdr_dest(H5F_t *f, H5B2_t *b);
+H5_DLL herr_t H5B2_cache_hdr_dest(H5F_t *f, H5B2_hdr_t *b);
H5_DLL herr_t H5B2_cache_leaf_dest(H5F_t *f, H5B2_leaf_t *l);
H5_DLL herr_t H5B2_cache_internal_dest(H5F_t *f, H5B2_internal_t *i);
@@ -312,13 +335,10 @@ H5_DLL herr_t H5B2_leaf_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr,
/* Testing routines */
#ifdef H5B2_TESTING
-H5_DLL herr_t H5B2_get_root_addr_test(H5F_t *f, hid_t dxpl_id,
- const H5B2_class_t *type, haddr_t addr, haddr_t *root_addr);
-H5_DLL int H5B2_get_node_depth_test(H5F_t *f, hid_t dxpl_id,
- const H5B2_class_t *type, haddr_t addr, void *udata);
-H5_DLL herr_t H5B2_get_node_info_test(H5F_t *f, hid_t dxpl_id,
- const H5B2_class_t *type, haddr_t addr, void *udata,
- H5B2_node_info_test_t *ninfo);
+H5_DLL herr_t H5B2_get_root_addr_test(H5B2_t *bt2, haddr_t *root_addr);
+H5_DLL int H5B2_get_node_depth_test(H5B2_t *bt2, hid_t dxpl_id, void *udata);
+H5_DLL herr_t H5B2_get_node_info_test(H5B2_t *bt2, hid_t dxpl_id,
+ void *udata, H5B2_node_info_test_t *ninfo);
#endif /* H5B2_TESTING */
#endif /* _H5B2pkg_H */
diff --git a/src/H5B2private.h b/src/H5B2private.h
index 0a516d2..cfdf868 100644
--- a/src/H5B2private.h
+++ b/src/H5B2private.h
@@ -82,6 +82,7 @@ typedef enum H5B2_compare_t {
typedef struct H5B2_class_t H5B2_class_t;
struct H5B2_class_t {
H5B2_subid_t id; /* ID of B-tree class, as found in file */
+ const char *name; /* Name of B-tree class, for debugging */
size_t nrec_size; /* Size of native (memory) record */
/* Store record from application to B-tree 'native' form */
@@ -100,52 +101,60 @@ struct H5B2_class_t {
const void *udata);
};
+/* v2 B-tree creation parameters */
+typedef struct H5B2_create_t {
+ const H5B2_class_t *cls; /* v2 B-tree client class */
+ uint32_t node_size; /* Size of each node (in bytes) */
+ uint32_t rrec_size; /* Size of raw record (in bytes) */
+ uint8_t split_percent; /* % full to split nodes */
+ uint8_t merge_percent; /* % full to merge nodes */
+} H5B2_create_t;
+
/* v2 B-tree metadata statistics info */
typedef struct H5B2_stat_t {
unsigned depth; /* Depth of B-tree */
hsize_t nrecords; /* Number of records */
} H5B2_stat_t;
+/* v2 B-tree info (forward decl - defined in H5B2pkg.h) */
+typedef struct H5B2_t H5B2_t;
+
+
/*****************************/
/* Library-private Variables */
/*****************************/
+
/***************************************/
/* Library-private Function Prototypes */
/***************************************/
-H5_DLL herr_t H5B2_create(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
- size_t node_size, size_t rrec_size,
- unsigned split_percent, unsigned merge_percent,
- haddr_t *addr_p);
-H5_DLL herr_t H5B2_insert(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
- haddr_t addr, void *udata);
-H5_DLL herr_t H5B2_iterate(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
- haddr_t addr, H5B2_operator_t op, void *op_data);
-H5_DLL herr_t H5B2_iterate_size(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
- haddr_t addr, hsize_t *op_data);
-H5_DLL htri_t H5B2_find(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
- haddr_t addr, void *udata, H5B2_found_t op, void *op_data);
-H5_DLL herr_t H5B2_index(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
- haddr_t addr, H5_iter_order_t order, hsize_t idx, H5B2_found_t op,
- void *op_data);
-H5_DLL herr_t H5B2_neighbor(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
- haddr_t addr, H5B2_compare_t comp, void *udata, H5B2_found_t op,
- void *op_data);
-H5_DLL herr_t H5B2_modify(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
- haddr_t addr, void *udata, H5B2_modify_t op, void *op_data);
-H5_DLL herr_t H5B2_remove(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
- haddr_t addr, void *udata, H5B2_remove_t op, void *op_data);
-H5_DLL herr_t H5B2_remove_by_idx(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
- haddr_t addr, H5_iter_order_t order, hsize_t idx, H5B2_remove_t op,
+H5_DLL H5B2_t *H5B2_create(H5F_t *f, hid_t dxpl_id, const H5B2_create_t *cparam);
+H5_DLL H5B2_t *H5B2_open(H5F_t *f, hid_t dxpl_id, haddr_t addr);
+H5_DLL herr_t H5B2_get_addr(const H5B2_t *bt2, haddr_t *addr/*out*/);
+H5_DLL herr_t H5B2_insert(H5B2_t *bt2, hid_t dxpl_id, void *udata);
+H5_DLL herr_t H5B2_iterate(H5B2_t *bt2, hid_t dxpl_id, H5B2_operator_t op,
void *op_data);
-H5_DLL herr_t H5B2_get_nrec(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
- haddr_t addr, hsize_t *nrec);
-H5_DLL herr_t H5B2_delete(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
- haddr_t addr, H5B2_remove_t op, void *op_data);
+H5_DLL htri_t H5B2_find(H5B2_t *bt2, hid_t dxpl_id, void *udata,
+ H5B2_found_t op, void *op_data);
+H5_DLL herr_t H5B2_index(H5B2_t *bt2, hid_t dxpl_id, H5_iter_order_t order,
+ hsize_t idx, H5B2_found_t op, void *op_data);
+H5_DLL herr_t H5B2_neighbor(H5B2_t *bt2, hid_t dxpl_id, H5B2_compare_t range,
+ void *udata, H5B2_found_t op, void *op_data);
+H5_DLL herr_t H5B2_modify(H5B2_t *bt2, hid_t dxpl_id, void *udata,
+ H5B2_modify_t op, void *op_data);
+H5_DLL herr_t H5B2_remove(H5B2_t *b2, hid_t dxpl_id, void *udata,
+ H5B2_remove_t op, void *op_data);
+H5_DLL herr_t H5B2_remove_by_idx(H5B2_t *bt2, hid_t dxpl_id,
+ H5_iter_order_t order, hsize_t idx, H5B2_remove_t op, void *op_data);
+H5_DLL herr_t H5B2_get_nrec(const H5B2_t *bt2, hsize_t *nrec);
+H5_DLL herr_t H5B2_size(H5B2_t *bt2, hid_t dxpl_id,
+ hsize_t *btree_size);
+H5_DLL herr_t H5B2_close(H5B2_t *bt2, hid_t dxpl_id);
+H5_DLL herr_t H5B2_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr,
+ H5B2_remove_t op, void *op_data);
/* Statistics routines */
-H5_DLL herr_t H5B2_stat_info(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
- haddr_t addr, H5B2_stat_t *info);
+H5_DLL herr_t H5B2_stat_info(H5B2_t *bt2, H5B2_stat_t *info);
#endif /* _H5B2private_H */
diff --git a/src/H5B2stat.c b/src/H5B2stat.c
index 899bb8a..0ee404e 100644
--- a/src/H5B2stat.c
+++ b/src/H5B2stat.c
@@ -26,6 +26,7 @@
#define H5B2_PACKAGE /*suppress error about including H5B2pkg */
+
/***********/
/* Headers */
/***********/
@@ -33,6 +34,7 @@
#include "H5B2pkg.h" /* v2 B-trees */
#include "H5Eprivate.h" /* Error handling */
+
/****************/
/* Local Macros */
/****************/
@@ -74,7 +76,6 @@
* Purpose: Retrieve metadata statistics for a v2 B-tree
*
* Return: Success: non-negative
- *
* Failure: negative
*
* Programmer: Quincey Koziol
@@ -83,37 +84,75 @@
*-------------------------------------------------------------------------
*/
herr_t
-H5B2_stat_info(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
- haddr_t addr, H5B2_stat_t *info)
+H5B2_stat_info(H5B2_t *bt2, H5B2_stat_t *info)
{
- H5B2_t *bt2 = NULL; /* Pointer to the B-tree header */
- H5B2_shared_t *shared; /* Pointer to B-tree's shared information */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5B2_hdr_t *hdr; /* Pointer to the B-tree header */
- FUNC_ENTER_NOAPI_NOINIT(H5B2_stat_info)
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5B2_stat_info)
/* Check arguments. */
- HDassert(f);
- HDassert(type);
- HDassert(H5F_addr_defined(addr));
HDassert(info);
- /* Look up the B-tree header */
- if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, type, NULL, H5AC_READ)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree header")
+ /* Set the shared v2 B-tree header's file context for this operation */
+ bt2->hdr->f = bt2->f;
- /* Get pointer to reference counted shared B-tree info */
- shared = (H5B2_shared_t *)H5RC_GET_OBJ(bt2->shared);
+ /* Get the v2 B-tree header */
+ hdr = bt2->hdr;
/* Get information about the B-tree */
- info->depth = shared->depth;
- info->nrecords = bt2->root.all_nrec;
+ info->depth = hdr->depth;
+ info->nrecords = hdr->root.all_nrec;
-done:
- /* Release B-tree header node */
- if(bt2 && H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, bt2, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree header info")
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* H5B2_stat_info() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5B2_size
+ *
+ * Purpose: Iterate over all the records in the B-tree, collecting
+ * storage info.
+ *
+ * Return: non-negative on success, negative on error
+ *
+ * Programmer: Vailin Choi
+ * June 19 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5B2_size(H5B2_t *bt2, hid_t dxpl_id, hsize_t *btree_size)
+{
+ H5B2_hdr_t *hdr; /* Pointer to the B-tree header */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5B2_size, FAIL)
+
+ /* Check arguments. */
+ HDassert(bt2);
+ HDassert(btree_size);
+
+ /* Set the shared v2 B-tree header's file context for this operation */
+ bt2->hdr->f = bt2->f;
+
+ /* Get the v2 B-tree header */
+ hdr = bt2->hdr;
+
+ /* Add size of header to B-tree metadata total */
+ *btree_size += H5B2_HEADER_SIZE(hdr);
+
+ /* Iterate through records */
+ if(hdr->root.node_nrec > 0) {
+ /* Check for root node being a leaf */
+ if(hdr->depth == 0)
+ *btree_size += hdr->node_size;
+ else
+ /* Iterate through nodes */
+ if(H5B2_node_size(hdr, dxpl_id, hdr->depth, &hdr->root, btree_size) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTLIST, FAIL, "node iteration failed")
+ } /* end if */
+
+done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5B2_stat_info() */
+} /* H5B2_size() */
diff --git a/src/H5B2test.c b/src/H5B2test.c
index 3fa5d27..863c886 100644
--- a/src/H5B2test.c
+++ b/src/H5B2test.c
@@ -20,6 +20,7 @@
*
*/
+
/****************/
/* Module Setup */
/****************/
@@ -27,6 +28,7 @@
#define H5B2_PACKAGE /*suppress error about including H5B2pkg */
#define H5B2_TESTING /*suppress warning about H5B2 testing funcs*/
+
/***********/
/* Headers */
/***********/
@@ -34,6 +36,7 @@
#include "H5B2pkg.h" /* v2 B-trees */
#include "H5Eprivate.h" /* Error handling */
+
/****************/
/* Local Macros */
/****************/
@@ -52,6 +55,7 @@
/********************/
/* Local Prototypes */
/********************/
+
static herr_t H5B2_test_store(void *nrecord, const void *udata);
static herr_t H5B2_test_compare(const void *rec1, const void *rec2);
static herr_t H5B2_test_encode(const H5F_t *f, uint8_t *raw,
@@ -61,11 +65,14 @@ static herr_t H5B2_test_decode(const H5F_t *f, const uint8_t *raw,
static herr_t H5B2_test_debug(FILE *stream, const H5F_t *f, hid_t dxpl_id,
int indent, int fwidth, const void *record, const void *_udata);
+
/*********************/
/* Package Variables */
/*********************/
+
const H5B2_class_t H5B2_TEST[1]={{ /* B-tree class information */
H5B2_TEST_ID, /* Type of B-tree */
+ "H5B2_TEST_ID", /* Name of B-tree class */
sizeof(hsize_t), /* Size of native record */
H5B2_test_store, /* Record storage callback */
H5B2_test_compare, /* Record comparison callback */
@@ -74,6 +81,7 @@ const H5B2_class_t H5B2_TEST[1]={{ /* B-tree class information */
H5B2_test_debug /* Record debugging callback */
}};
+
/*****************************/
/* Library Private Variables */
/*****************************/
@@ -83,6 +91,7 @@ const H5B2_class_t H5B2_TEST[1]={{ /* B-tree class information */
/* Local Variables */
/*******************/
+
/*-------------------------------------------------------------------------
* Function: H5B2_test_store
@@ -128,7 +137,7 @@ H5B2_test_compare(const void *rec1, const void *rec2)
{
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5B2_test_compare)
- FUNC_LEAVE_NOAPI((herr_t)(*(const hssize_t *)rec1-*(const hssize_t *)rec2))
+ FUNC_LEAVE_NOAPI((herr_t)(*(const hssize_t *)rec1 - *(const hssize_t *)rec2))
} /* H5B2_test_compare() */
@@ -218,7 +227,6 @@ H5B2_test_debug(FILE *stream, const H5F_t UNUSED *f, hid_t UNUSED dxpl_id,
* Purpose: Retrieve the root node's address
*
* Return: Success: non-negative
- *
* Failure: negative
*
* Programmer: Quincey Koziol
@@ -227,33 +235,18 @@ H5B2_test_debug(FILE *stream, const H5F_t UNUSED *f, hid_t UNUSED dxpl_id,
*-------------------------------------------------------------------------
*/
herr_t
-H5B2_get_root_addr_test(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
- haddr_t addr, haddr_t *root_addr)
+H5B2_get_root_addr_test(H5B2_t *bt2, haddr_t *root_addr)
{
- H5B2_t *bt2 = NULL; /* Pointer to the B-tree header */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT(H5B2_get_root_addr_test)
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5B2_get_root_addr_test)
/* Check arguments. */
- HDassert(f);
- HDassert(type);
- HDassert(H5F_addr_defined(addr));
+ HDassert(bt2);
HDassert(root_addr);
- /* Look up the B-tree header */
- if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, type, NULL, H5AC_READ)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree header")
-
/* Get B-tree root addr */
- *root_addr = bt2->root.addr;
+ *root_addr = bt2->hdr->root.addr;
-done:
- /* Release B-tree header node */
- if(bt2 && H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, bt2, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree header info")
-
- FUNC_LEAVE_NOAPI(ret_value)
+ FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5B2_get_root_addr_test() */
@@ -271,13 +264,10 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5B2_get_node_info_test(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
- void *udata, H5B2_node_info_test_t *ninfo)
+H5B2_get_node_info_test(H5B2_t *bt2, hid_t dxpl_id, void *udata,
+ H5B2_node_info_test_t *ninfo)
{
- H5B2_t *bt2=NULL; /* Pointer to the B-tree header */
- H5RC_t *bt2_shared=NULL; /* Pointer to ref-counter for shared B-tree info */
- H5B2_shared_t *shared; /* Pointer to B-tree's shared information */
- hbool_t incr_rc=FALSE; /* Flag to indicate that we've incremented the B-tree's shared info reference count */
+ H5B2_hdr_t *hdr; /* Pointer to the B-tree header */
H5B2_node_ptr_t curr_node_ptr; /* Node pointer info for current node */
unsigned depth; /* Current depth of the tree */
int cmp; /* Comparison value of records */
@@ -287,36 +277,22 @@ H5B2_get_node_info_test(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr
FUNC_ENTER_NOAPI(H5B2_get_node_info_test, FAIL)
/* Check arguments. */
- HDassert(f);
- HDassert(type);
- HDassert(H5F_addr_defined(addr));
-
- /* Look up the B-tree header */
- if (NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, type, NULL, H5AC_READ)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree header")
+ HDassert(bt2);
- /* Safely grab pointer to reference counted shared B-tree info, so we can release the B-tree header if necessary */
- bt2_shared=bt2->shared;
- H5RC_INC(bt2_shared);
- incr_rc=TRUE;
+ /* Set the shared v2 B-tree header's file context for this operation */
+ bt2->hdr->f = bt2->f;
- /* Get the pointer to the shared B-tree info */
- shared = (H5B2_shared_t *)H5RC_GET_OBJ(bt2_shared);
- HDassert(shared);
+ /* Get the v2 B-tree header */
+ hdr = bt2->hdr;
/* Make copy of the root node pointer to start search with */
- curr_node_ptr = bt2->root;
+ curr_node_ptr = hdr->root;
/* Current depth of the tree */
- depth = shared->depth;
-
- /* Release header */
- if(H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, bt2, H5AC__NO_FLAGS_SET) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree header info")
- bt2 = NULL;
+ depth = hdr->depth;
/* Check for empty tree */
- if(curr_node_ptr.node_nrec==0)
+ if(0 == curr_node_ptr.node_nrec)
HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "B-tree has no records")
/* Walk down B-tree to find record or leaf node where record is located */
@@ -326,11 +302,11 @@ H5B2_get_node_info_test(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr
H5B2_node_ptr_t next_node_ptr; /* Node pointer info for next node */
/* Lock B-tree current node */
- if(NULL == (internal = H5B2_protect_internal(f, dxpl_id, bt2_shared, curr_node_ptr.addr, curr_node_ptr.node_nrec, depth, H5AC_READ)))
+ if(NULL == (internal = H5B2_protect_internal(hdr, dxpl_id, curr_node_ptr.addr, curr_node_ptr.node_nrec, depth, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
/* Locate node pointer for child */
- cmp = H5B2_locate_record(shared->type, internal->nrec, shared->nat_off, internal->int_native, udata, &idx);
+ cmp = H5B2_locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx);
if(cmp > 0)
idx++;
@@ -339,7 +315,7 @@ H5B2_get_node_info_test(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr
next_node_ptr = internal->node_ptrs[idx];
/* Unlock current node */
- if(H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
/* Set pointer to next node to load */
@@ -347,7 +323,7 @@ H5B2_get_node_info_test(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr
} /* end if */
else {
/* Unlock current node */
- if(H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
/* Fill in information about the node */
@@ -366,14 +342,14 @@ H5B2_get_node_info_test(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr
H5B2_leaf_t *leaf; /* Pointer to leaf node in B-tree */
/* Lock B-tree leaf node */
- if(NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, &(curr_node_ptr.node_nrec), bt2_shared, H5AC_READ)))
+ if(NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(hdr->f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, &(curr_node_ptr.node_nrec), hdr, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
/* Locate record */
- cmp = H5B2_locate_record(shared->type, leaf->nrec, shared->nat_off, leaf->leaf_native, udata, &idx);
+ cmp = H5B2_locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx);
/* Unlock current node */
- if(H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
/* Indicate the depth that the record was found */
@@ -386,10 +362,6 @@ H5B2_get_node_info_test(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr
ninfo->nrec = curr_node_ptr.node_nrec;
done:
- /* Check if we need to decrement the reference count for the B-tree's shared info */
- if(incr_rc)
- H5RC_DEC(bt2_shared);
-
FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2_get_node_info_test() */
@@ -411,8 +383,7 @@ done:
*-------------------------------------------------------------------------
*/
int
-H5B2_get_node_depth_test(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
- void *udata)
+H5B2_get_node_depth_test(H5B2_t *bt2, hid_t dxpl_id, void *udata)
{
H5B2_node_info_test_t ninfo; /* Node information */
int ret_value; /* Return information */
@@ -420,12 +391,10 @@ H5B2_get_node_depth_test(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, hadd
FUNC_ENTER_NOAPI(H5B2_get_node_depth_test, FAIL)
/* Check arguments. */
- HDassert(f);
- HDassert(type);
- HDassert(H5F_addr_defined(addr));
+ HDassert(bt2);
/* Get information abou the node */
- if(H5B2_get_node_info_test(f, dxpl_id, type, addr, udata, &ninfo) < 0)
+ if(H5B2_get_node_info_test(bt2, dxpl_id, udata, &ninfo) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "error looking up node info")
/* Set return value */
diff --git a/src/H5Dbtree.c b/src/H5Dbtree.c
index 9676ab2..2c13677 100644
--- a/src/H5Dbtree.c
+++ b/src/H5Dbtree.c
@@ -1043,7 +1043,7 @@ H5D_btree_idx_iterate_cb(H5F_t UNUSED *f, hid_t UNUSED dxpl_id,
H5D_chunk_rec_t chunk_rec; /* Generic chunk record for callback */
int ret_value; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5D_btree_idx_iterate_cb)
+ FUNC_ENTER_NOAPI_NOINIT_NOERR(H5D_btree_idx_iterate_cb)
/* Sanity check for memcpy() */
HDcompile_assert(offsetof(H5D_chunk_rec_t, nbytes) == offsetof(H5D_btree_key_t, nbytes));
@@ -1085,7 +1085,7 @@ H5D_btree_idx_iterate(const H5D_chk_idx_info_t *idx_info,
H5D_btree_it_ud_t udata; /* User data for B-tree iterator callback */
int ret_value; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5D_btree_idx_iterate)
+ FUNC_ENTER_NOAPI_NOINIT_NOERR(H5D_btree_idx_iterate)
HDassert(idx_info);
HDassert(idx_info->f);
@@ -1463,6 +1463,7 @@ herr_t
H5D_btree_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent,
int fwidth, unsigned ndims)
{
+ H5D_chunk_common_ud_t udata; /* User data for B-tree callback */
H5O_storage_chunk_t storage; /* Storage information for B-tree callback */
hbool_t shared_init = FALSE; /* Whether B-tree shared info is initialized */
herr_t ret_value = SUCCEED; /* Return value */
@@ -1478,8 +1479,13 @@ H5D_btree_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't create wrapper for shared B-tree info")
shared_init = TRUE;
+ /* Set up user data for callback */
+ udata.layout = NULL;
+ udata.storage = &storage;
+ udata.offset = NULL;
+
/* Dump the records for the B-tree */
- (void)H5B_debug(f, dxpl_id, addr, stream, indent, fwidth, H5B_BTREE, &ndims);
+ (void)H5B_debug(f, dxpl_id, addr, stream, indent, fwidth, H5B_BTREE, &udata);
done:
if(shared_init) {
diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c
index f05b3ce..5b1703a 100644
--- a/src/H5Dchunk.c
+++ b/src/H5Dchunk.c
@@ -4317,7 +4317,7 @@ H5D_chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
/* Convert from source file to memory */
H5_CHECK_OVERFLOW(udata->nelmts, uint32_t, size_t);
- if(H5T_convert(tpath_src_mem, tid_src, tid_mem, (size_t)udata->nelmts, (size_t)0, (size_t)0, buf, NULL, udata->idx_info_dst->dxpl_id) < 0)
+ if(H5T_convert(tpath_src_mem, tid_src, tid_mem, (size_t)udata->nelmts, (size_t)0, (size_t)0, buf, bkg, udata->idx_info_dst->dxpl_id) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5_ITER_ERROR, "datatype conversion failed")
/* Copy into another buffer, to reclaim memory later */
diff --git a/src/H5Dcompact.c b/src/H5Dcompact.c
index a3ce68a..f66e955 100644
--- a/src/H5Dcompact.c
+++ b/src/H5Dcompact.c
@@ -494,15 +494,19 @@ H5D_compact_copy(H5F_t *f_src, H5O_storage_compact_t *storage_src, H5F_t *f_dst,
HDmemcpy(buf, storage_src->buf, storage_src->size);
+ /* allocate temporary bkg buff for data conversion */
+ if(NULL == (bkg = H5FL_BLK_MALLOC(type_conv, buf_size)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
+
/* Convert from source file to memory */
- if(H5T_convert(tpath_src_mem, tid_src, tid_mem, nelmts, (size_t)0, (size_t)0, buf, NULL, dxpl_id) < 0)
+ if(H5T_convert(tpath_src_mem, tid_src, tid_mem, nelmts, (size_t)0, (size_t)0, buf, bkg, dxpl_id) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype conversion failed")
+ /* Copy into another buffer, to reclaim memory later */
HDmemcpy(reclaim_buf, buf, buf_size);
- /* allocate temporary bkg buff for data conversion */
- if(NULL == (bkg = H5FL_BLK_CALLOC(type_conv, buf_size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
+ /* Set background buffer to all zeros */
+ HDmemset(bkg, 0, buf_size);
/* Convert from memory to destination file */
if(H5T_convert(tpath_mem_dst, tid_mem, tid_dst, nelmts, (size_t)0, (size_t)0, buf, bkg, dxpl_id) < 0)
diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c
index 0ff3964..3e88be6 100644
--- a/src/H5Dcontig.c
+++ b/src/H5Dcontig.c
@@ -1396,7 +1396,7 @@ H5D_contig_copy(H5F_t *f_src, const H5O_storage_contig_t *storage_src,
/* Perform datatype conversion, if necessary */
if(is_vlen) {
/* Convert from source file to memory */
- if(H5T_convert(tpath_src_mem, tid_src, tid_mem, nelmts, (size_t)0, (size_t)0, buf, NULL, dxpl_id) < 0)
+ if(H5T_convert(tpath_src_mem, tid_src, tid_mem, nelmts, (size_t)0, (size_t)0, buf, bkg, dxpl_id) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype conversion failed")
/* Copy into another buffer, to reclaim memory later */
diff --git a/src/H5Dearray.c b/src/H5Dearray.c
index 55c0a8f..2215951 100644
--- a/src/H5Dearray.c
+++ b/src/H5Dearray.c
@@ -727,7 +727,6 @@ done:
static herr_t
H5D_earray_idx_open(const H5D_chk_idx_info_t *idx_info)
{
- const H5EA_class_t *cls; /* Extensible array class to use */
H5D_earray_ctx_ud_t udata; /* User data for extensible array open call */
herr_t ret_value = SUCCEED; /* Return value */
@@ -749,8 +748,7 @@ H5D_earray_idx_open(const H5D_chk_idx_info_t *idx_info)
udata.chunk_size = idx_info->layout->size;
/* Open the extensible array for the chunk index */
- cls = (idx_info->pline->nused > 0) ? H5EA_CLS_FILT_CHUNK : H5EA_CLS_CHUNK;
- if(NULL == (idx_info->storage->u.earray.ea = H5EA_open(idx_info->f, idx_info->dxpl_id, idx_info->storage->idx_addr, cls, &udata)))
+ if(NULL == (idx_info->storage->u.earray.ea = H5EA_open(idx_info->f, idx_info->dxpl_id, idx_info->storage->idx_addr, &udata)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't open extensible array")
/* Check for SWMR writes to the file */
@@ -1528,6 +1526,7 @@ H5D_earray_idx_delete(const H5D_chk_idx_info_t *idx_info)
/* Check if the index data structure has been allocated */
if(H5F_addr_defined(idx_info->storage->idx_addr)) {
H5D_earray_ud_t udata; /* User data for callback */
+ H5D_earray_ctx_ud_t ctx_udata; /* User data for extensible array open call */
/* Initialize user data for callback */
udata.f = idx_info->f;
@@ -1542,8 +1541,12 @@ H5D_earray_idx_delete(const H5D_chk_idx_info_t *idx_info)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close extensible array")
idx_info->storage->u.earray.ea = NULL;
+ /* Set up the context user data */
+ ctx_udata.f = idx_info->f;
+ ctx_udata.chunk_size = idx_info->layout->size;
+
/* Delete extensible array */
- if(H5EA_delete(idx_info->f, idx_info->dxpl_id, idx_info->storage->idx_addr) < 0)
+ if(H5EA_delete(idx_info->f, idx_info->dxpl_id, idx_info->storage->idx_addr, &ctx_udata) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTDELETE, FAIL, "unable to delete chunk extensible array")
idx_info->storage->idx_addr = HADDR_UNDEF;
} /* end if */
diff --git a/src/H5Defl.c b/src/H5Defl.c
index 7ce0c67..8b2da6a 100644
--- a/src/H5Defl.c
+++ b/src/H5Defl.c
@@ -32,6 +32,7 @@
#include "H5Dpkg.h" /* Datasets */
#include "H5Eprivate.h" /* Error handling */
#include "H5Fprivate.h" /* Files */
+#include "H5HLprivate.h" /* Local Heaps */
/****************/
@@ -50,7 +51,6 @@
/* Layout operation callbacks */
static herr_t H5D_efl_construct(H5F_t *f, H5D_t *dset);
-static hbool_t H5D_efl_is_space_alloc(const H5O_storage_t *storage);
static herr_t H5D_efl_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space,
H5D_chunk_map_t *cm);
@@ -181,7 +181,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-static hbool_t
+hbool_t
H5D_efl_is_space_alloc(const H5O_storage_t UNUSED *storage)
{
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_efl_is_space_alloc)
@@ -556,3 +556,37 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D_efl_writevv() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5D_efl_bh_size
+ *
+ * Purpose: Retrieve the amount of heap storage used for External File
+ * List message
+ *
+ * Return: Success: Non-negative
+ * Failure: negative
+ *
+ * Programmer: Vailin Choi; August 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5D_efl_bh_info(H5F_t *f, hid_t dxpl_id, H5O_efl_t *efl, hsize_t *heap_size)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5D_efl_bh_info, FAIL)
+
+ /* Check args */
+ HDassert(f);
+ HDassert(efl);
+ HDassert(H5F_addr_defined(efl->heap_addr));
+ HDassert(heap_size);
+
+ /* Get the size of the local heap for EFL's file list */
+ if(H5HL_heapsize(f, dxpl_id, efl->heap_addr, heap_size) < 0)
+ HGOTO_ERROR(H5E_EFL, H5E_CANTINIT, FAIL, "unable to retrieve local heap info")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5D_chunk_bh_info() */
diff --git a/src/H5Dfarray.c b/src/H5Dfarray.c
index 7b0e8a7..a62ae7a 100644
--- a/src/H5Dfarray.c
+++ b/src/H5Dfarray.c
@@ -731,7 +731,6 @@ H5D_farray_filt_debug(FILE *stream, int indent, int fwidth, hsize_t idx,
static herr_t
H5D_farray_idx_open(const H5D_chk_idx_info_t *idx_info)
{
- const H5FA_class_t *cls; /* Fixed array class to use */
H5D_farray_ctx_ud_t udata; /* User data for fixed array open call */
herr_t ret_value = SUCCEED; /* Return value */
@@ -753,8 +752,7 @@ H5D_farray_idx_open(const H5D_chk_idx_info_t *idx_info)
udata.chunk_size = idx_info->layout->size;
/* Open the fixed array for the chunk index */
- cls = (idx_info->pline->nused > 0) ? H5FA_CLS_FILT_CHUNK : H5FA_CLS_CHUNK;
- if(NULL == (idx_info->storage->u.farray.fa = H5FA_open(idx_info->f, idx_info->dxpl_id, idx_info->storage->idx_addr, cls, &udata)))
+ if(NULL == (idx_info->storage->u.farray.fa = H5FA_open(idx_info->f, idx_info->dxpl_id, idx_info->storage->idx_addr, &udata)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't open fixed array")
done:
@@ -1390,6 +1388,7 @@ H5D_farray_idx_delete(const H5D_chk_idx_info_t *idx_info)
if(H5F_addr_defined(idx_info->storage->idx_addr)) {
H5FA_t *fa; /* Pointer to fixed array structure */
H5FA_stat_t fa_stat; /* Fixed array statistics */
+ H5D_farray_ctx_ud_t ctx_udata; /* User data for fixed array open call */
/* Check if the fixed array is open yet */
if(NULL == idx_info->storage->u.farray.fa) {
@@ -1425,8 +1424,12 @@ H5D_farray_idx_delete(const H5D_chk_idx_info_t *idx_info)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close fixed array")
idx_info->storage->u.farray.fa = NULL;
+ /* Set up the user data */
+ ctx_udata.f = idx_info->f;
+ ctx_udata.chunk_size = idx_info->layout->size;
+
/* Delete fixed array */
- if(H5FA_delete(idx_info->f, idx_info->dxpl_id, idx_info->storage->idx_addr) < 0)
+ if(H5FA_delete(idx_info->f, idx_info->dxpl_id, idx_info->storage->idx_addr, &ctx_udata) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTDELETE, FAIL, "unable to delete chunk fixed array")
idx_info->storage->idx_addr = HADDR_UNDEF;
} /* end if */
diff --git a/src/H5Dint.c b/src/H5Dint.c
index 8ad3736..85d421a 100644
--- a/src/H5Dint.c
+++ b/src/H5Dint.c
@@ -178,7 +178,7 @@ H5D_init_interface(void)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve external file list")
if(H5P_get(def_dcpl, H5D_CRT_FILL_VALUE_NAME, &H5D_def_dset.dcpl_cache.fill) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve fill value")
- if(H5P_get(def_dcpl, H5D_CRT_DATA_PIPELINE_NAME, &H5D_def_dset.dcpl_cache.pline) < 0)
+ if(H5P_get(def_dcpl, H5O_CRT_PIPELINE_NAME, &H5D_def_dset.dcpl_cache.pline) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve pipeline filter")
/* Reset the "default DXPL cache" information */
@@ -978,7 +978,7 @@ H5D_create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id,
/* Retrieve the properties we need */
pline = &new_dset->shared->dcpl_cache.pline;
- if(H5P_get(dc_plist, H5D_CRT_DATA_PIPELINE_NAME, pline) < 0)
+ if(H5P_get(dc_plist, H5O_CRT_PIPELINE_NAME, pline) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't retrieve pipeline filter")
layout = &new_dset->shared->layout;
if(H5P_get(dc_plist, H5D_CRT_LAYOUT_NAME, layout) < 0)
@@ -1009,7 +1009,7 @@ H5D_create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id,
/* Set the latest version of the layout, pline & fill messages, if requested */
if(H5F_USE_LATEST_FORMAT(file)) {
/* Set the latest version for the I/O pipeline message */
- if(H5Z_set_latest_version(&new_dset->shared->dcpl_cache.pline) < 0)
+ if(H5O_pline_set_latest_version(&new_dset->shared->dcpl_cache.pline) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of I/O filter pipeline")
/* Set the latest version for the fill value message */
diff --git a/src/H5Dio.c b/src/H5Dio.c
index 463c56e..62d2177 100644
--- a/src/H5Dio.c
+++ b/src/H5Dio.c
@@ -159,7 +159,7 @@ H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id,
else
if(TRUE != H5P_isa_class(plist_id, H5P_DATASET_XFER))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms")
- if(!buf && H5S_GET_SELECT_NPOINTS(file_space) != 0)
+ if(!buf && (NULL == file_space || H5S_GET_SELECT_NPOINTS(file_space) != 0))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no output buffer")
/* If the buffer is nil, and 0 element is selected, make a fake buffer.
@@ -251,7 +251,7 @@ H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id,
else
if(TRUE != H5P_isa_class(plist_id, H5P_DATASET_XFER))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms")
- if(!buf && H5S_GET_SELECT_NPOINTS(file_space) != 0)
+ if(!buf && (NULL == file_space || H5S_GET_SELECT_NPOINTS(file_space) != 0))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no output buffer")
/* If the buffer is nil, and 0 element is selected, make a fake buffer.
@@ -312,7 +312,7 @@ H5D_read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
if(!mem_space)
mem_space = file_space;
if((snelmts = H5S_GET_SELECT_NPOINTS(mem_space)) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "src dataspace has invalid selection")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dst dataspace has invalid selection")
H5_ASSIGN_OVERFLOW(nelmts,snelmts,hssize_t,hsize_t);
/* Fill the DXPL cache values for later use */
diff --git a/src/H5Dlayout.c b/src/H5Dlayout.c
index 4453735..c0a4aa3 100644
--- a/src/H5Dlayout.c
+++ b/src/H5Dlayout.c
@@ -509,7 +509,7 @@ H5D_layout_oh_read(H5D_t *dataset, hid_t dxpl_id, hid_t dapl_id, H5P_genplist_t
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve message")
/* Set the I/O pipeline info in the property list */
- if(H5P_set(plist, H5D_CRT_DATA_PIPELINE_NAME, &dataset->shared->dcpl_cache.pline) < 0)
+ if(H5P_set(plist, H5O_CRT_PIPELINE_NAME, &dataset->shared->dcpl_cache.pline) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set pipeline")
} /* end if */
diff --git a/src/H5Doh.c b/src/H5Doh.c
index e1d9827..30f1829 100644
--- a/src/H5Doh.c
+++ b/src/H5Doh.c
@@ -53,6 +53,8 @@ static hid_t H5O_dset_open(const H5G_loc_t *obj_loc, hid_t lapl_id,
static void *H5O_dset_create(H5F_t *f, void *_crt_info, H5G_loc_t *obj_loc,
hid_t dxpl_id);
static H5O_loc_t *H5O_dset_get_oloc(hid_t obj_id);
+static herr_t H5O_dset_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh,
+ H5_ih_info_t *bh_info);
/*********************/
@@ -78,7 +80,8 @@ const H5O_obj_class_t H5O_OBJ_DATASET[1] = {{
H5O_dset_isa, /* "isa" message */
H5O_dset_open, /* open an object of this class */
H5O_dset_create, /* create an object of this class */
- H5O_dset_get_oloc /* get an object header location for an object */
+ H5O_dset_get_oloc, /* get an object header location for an object */
+ H5O_dset_bh_info /* get the index & heap info for an object */
}};
/* Declare a free list to manage the H5D_copy_file_ud_t struct */
@@ -152,8 +155,8 @@ H5O_dset_free_copy_file_udata(void *_udata)
H5T_close(udata->src_dtype);
/* Release copy of dataset's filter pipeline, if it was set */
- if(udata->src_pline)
- H5O_msg_free(H5O_PLINE_ID, udata->src_pline);
+ if(udata->common.src_pline)
+ H5O_msg_free(H5O_PLINE_ID, udata->common.src_pline);
/* Release copy of dataset's layout, if it was set */
if(udata->src_layout)
@@ -362,13 +365,14 @@ done:
*
*-------------------------------------------------------------------------
*/
-herr_t
+static herr_t
H5O_dset_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info)
{
H5O_layout_t layout; /* Data storage layout message */
- herr_t ret_value = SUCCEED; /* Return value */
+ htri_t exists; /* Flag if header message of interest exists */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5O_dset_bh_info, FAIL)
+ FUNC_ENTER_NOAPI_NOINIT(H5O_dset_bh_info)
/* Sanity check */
HDassert(f);
@@ -391,7 +395,6 @@ H5O_dset_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info)
/* Check for chunked dataset storage */
if(layout.type == H5D_CHUNKED && H5D_chunk_is_space_alloc(&layout.storage)) {
H5O_pline_t pline; /* I/O pipeline message */
- htri_t exists; /* Flag if header message of interest exists */
/* Check for I/O pipeline message */
if((exists = H5O_msg_exists_oh(oh, H5O_PLINE_ID)) < 0)
@@ -407,6 +410,25 @@ H5O_dset_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't determine chunked dataset btree info")
} /* end if */
+ /* Check for External File List message in the object header */
+ if((exists = H5O_msg_exists_oh(oh, H5O_EFL_ID)) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "unable to check for EFL message")
+
+ if(exists && H5D_efl_is_space_alloc(&layout.storage)) {
+ H5O_efl_t efl; /* External File List message */
+
+ /* Start with clean EFL info */
+ HDmemset(&efl, 0, sizeof(efl));
+
+ /* Get External File List message from the object header */
+ if(NULL == H5O_msg_read_oh(f, dxpl_id, oh, H5O_EFL_ID, &efl))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't find EFL message")
+
+ /* Get size of local heap for EFL message's file list */
+ if(H5D_efl_bh_info(f, dxpl_id, &efl, &(bh_info->heap_size)) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't determine EFL heap info")
+ } /* end if */
+
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_dset_bh_info() */
diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h
index 6790212..4596b05 100644
--- a/src/H5Dpkg.h
+++ b/src/H5Dpkg.h
@@ -668,6 +668,11 @@ H5_DLL herr_t H5D_compact_copy(H5F_t *f_src, H5O_storage_compact_t *storage_src,
H5F_t *f_dst, H5O_storage_compact_t *storage_dst, H5T_t *src_dtype,
H5O_copy_t *cpy_info, hid_t dxpl_id);
+/* Functions that operate on EFL (External File List)*/
+H5_DLL hbool_t H5D_efl_is_space_alloc(const H5O_storage_t *storage);
+H5_DLL herr_t H5D_efl_bh_info(H5F_t *f, hid_t dxpl_id, H5O_efl_t *efl,
+ hsize_t *heap_size);
+
/* Functions that perform fill value operations on datasets */
H5_DLL herr_t H5D_fill(const void *fill, const H5T_t *fill_type, void *buf,
const H5T_t *buf_type, const H5S_t *space, hid_t dxpl_id);
diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h
index 3f5e379..666f969 100644
--- a/src/H5Dprivate.h
+++ b/src/H5Dprivate.h
@@ -47,7 +47,6 @@
#define H5D_CRT_FILL_VALUE_NAME "fill_value" /* Fill value */
#define H5D_CRT_ALLOC_TIME_STATE_NAME "alloc_time_state" /* Space allocation time state */
#define H5D_CRT_EXT_FILE_LIST_NAME "efl" /* External file list */
-#define H5D_CRT_DATA_PIPELINE_NAME "pline" /* Data filter pipeline */
/* ======== Dataset access property names ======== */
#define H5D_ACS_DATA_CACHE_NUM_SLOTS_NAME "rdcc_nslots" /* Size of raw data chunk cache(slots) */
@@ -135,15 +134,15 @@ typedef struct H5D_dxpl_cache_t {
/* Typedef for cached dataset creation property list information */
typedef struct H5D_dcpl_cache_t {
H5O_fill_t fill; /* Fill value info (H5D_CRT_FILL_VALUE_NAME) */
- H5O_pline_t pline; /* I/O pipeline info (H5D_CRT_DATA_PIPELINE_NAME) */
+ H5O_pline_t pline; /* I/O pipeline info (H5O_CRT_PIPELINE_NAME) */
H5O_efl_t efl; /* External file list info (H5D_CRT_EXT_FILE_LIST_NAME) */
} H5D_dcpl_cache_t;
-/* Callback information for copying dataset */
+/* Callback information for copying datasets */
typedef struct H5D_copy_file_ud_t {
+ H5O_copy_file_ud_common_t common; /* Shared information (must be first) */
struct H5S_extent_t *src_space_extent; /* Copy of dataspace extent for dataset */
H5T_t *src_dtype; /* Copy of datatype for dataset */
- H5O_pline_t *src_pline; /* Copy of filter pipeline for dataset */
H5O_layout_t *src_layout; /* Copy of layout for dataset */
} H5D_copy_file_ud_t;
diff --git a/src/H5EA.c b/src/H5EA.c
index ea21b15..1850b0e 100644
--- a/src/H5EA.c
+++ b/src/H5EA.c
@@ -79,9 +79,20 @@ typedef herr_t (*H5EA__unprotect_func_t)(void *thing, hid_t dxpl_id,
/* Package Variables */
/*********************/
-/* HDF5 API Entered variable */
-/* (move to H5.c when new FUNC_ENTER macros in actual use -QAK) */
-hbool_t H5_api_entered_g = FALSE;
+/* Extensible array client ID to class mapping */
+
+/* Remember to add client ID to H5EA_cls_id_t in H5EAprivate.h when adding a new
+ * client class..
+ */
+extern const H5EA_class_t H5EA_CLS_CHUNK[1];
+extern const H5EA_class_t H5EA_CLS_FILT_CHUNK[1];
+extern const H5EA_class_t H5EA_CLS_TEST[1];
+
+const H5EA_class_t *const H5EA_client_class_g[] = {
+ H5EA_CLS_CHUNK, /* 0 - H5EA_CLS_CHUNK_ID */
+ H5EA_CLS_FILT_CHUNK, /* 1 - H5EA_CLS_FILT_CHUNK_ID */
+ H5EA_CLS_TEST, /* ? - H5EA_CLS_TEST_ID */
+};
/*****************************/
@@ -131,6 +142,9 @@ HDfprintf(stderr, "%s: Called\n", FUNC);
HDassert(f);
HDassert(cparam);
+ /* H5EA interface sanity check */
+ HDcompile_assert(H5EA_NUM_CLS_ID == NELMTS(H5EA_client_class_g));
+
/* Create extensible array header */
if(HADDR_UNDEF == (ea_addr = H5EA__hdr_create(f, dxpl_id, cparam, ctx_udata)))
H5E_THROW(H5E_CANTINIT, "can't create extensible array header")
@@ -140,7 +154,7 @@ HDfprintf(stderr, "%s: Called\n", FUNC);
H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array info")
/* Lock the array header into memory */
- if(NULL == (hdr = (H5EA_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_EARRAY_HDR, ea_addr, cparam->cls, NULL, H5AC_WRITE)))
+ if(NULL == (hdr = (H5EA_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_EARRAY_HDR, ea_addr, NULL, ctx_udata, H5AC_WRITE)))
H5E_THROW(H5E_CANTPROTECT, "unable to load extensible array header")
/* Point extensible array wrapper at header and bump it's ref count */
@@ -185,8 +199,7 @@ END_FUNC(PRIV) /* end H5EA_create() */
*/
BEGIN_FUNC(PRIV, ERR,
H5EA_t *, NULL, NULL,
-H5EA_open(H5F_t *f, hid_t dxpl_id, haddr_t ea_addr, const H5EA_class_t *cls,
- void *ctx_udata))
+H5EA_open(H5F_t *f, hid_t dxpl_id, haddr_t ea_addr, void *ctx_udata))
/* Local variables */
H5EA_t *ea = NULL; /* Pointer to new extensible array wrapper */
@@ -197,13 +210,12 @@ H5EA_open(H5F_t *f, hid_t dxpl_id, haddr_t ea_addr, const H5EA_class_t *cls,
*/
HDassert(f);
HDassert(H5F_addr_defined(ea_addr));
- HDassert(cls);
/* Load the array header into memory */
#ifdef QAK
HDfprintf(stderr, "%s: ea_addr = %a\n", FUNC, ea_addr);
#endif /* QAK */
- if(NULL == (hdr = (H5EA_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_EARRAY_HDR, ea_addr, cls, ctx_udata, H5AC_READ)))
+ if(NULL == (hdr = (H5EA_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_EARRAY_HDR, ea_addr, NULL, ctx_udata, H5AC_READ)))
H5E_THROW(H5E_CANTPROTECT, "unable to load extensible array header, address = %llu", (unsigned long long)ea_addr)
/* Check for pending array deletion */
@@ -1031,28 +1043,52 @@ HDfprintf(stderr, "%s: Called\n", FUNC);
} /* end if */
} /* end if */
- /* Decrement the reference count on the array header */
- /* (don't put in H5EA_hdr_fuse_decr() as the array header may be evicted
- * immediately -QAK)
- */
- if(H5EA__hdr_decr(ea->hdr) < 0)
- H5E_THROW(H5E_CANTDEC, "can't decrement reference count on shared array header")
-
/* Check for pending array deletion */
if(pending_delete) {
H5EA_hdr_t *hdr; /* Another pointer to extensible array header */
+#ifndef NDEBUG
+{
+ unsigned hdr_status = 0; /* Header's status in the metadata cache */
+
+ /* Check the header's status in the metadata cache */
+ if(H5AC_get_entry_status(ea->f, ea_addr, &hdr_status) < 0)
+ H5E_THROW(H5E_CANTGET, "unable to check metadata cache status for extensible array header")
+
+ /* Sanity checks on header */
+ HDassert(hdr_status & H5AC_ES__IN_CACHE);
+ HDassert(hdr_status & H5AC_ES__IS_PINNED);
+ HDassert(!(hdr_status & H5AC_ES__IS_PROTECTED));
+}
+#endif /* NDEBUG */
+
/* Lock the array header into memory */
+ /* (OK to pass in NULL for callback context, since we know the header must be in the cache) */
if(NULL == (hdr = (H5EA_hdr_t *)H5AC_protect(ea->f, dxpl_id, H5AC_EARRAY_HDR, ea_addr, NULL, NULL, H5AC_WRITE)))
H5E_THROW(H5E_CANTLOAD, "unable to load extensible array header")
/* Set the shared array header's file context for this operation */
hdr->f = ea->f;
+ /* Decrement the reference count on the array header */
+ /* (don't put in H5EA_hdr_fuse_decr() as the array header may be evicted
+ * immediately -QAK)
+ */
+ if(H5EA__hdr_decr(ea->hdr) < 0)
+ H5E_THROW(H5E_CANTDEC, "can't decrement reference count on shared array header")
+
/* Delete array, starting with header (unprotects header) */
if(H5EA__hdr_delete(hdr, dxpl_id) < 0)
H5E_THROW(H5E_CANTDELETE, "unable to delete extensible array")
} /* end if */
+ else {
+ /* Decrement the reference count on the array header */
+ /* (don't put in H5EA_hdr_fuse_decr() as the array header may be evicted
+ * immediately -QAK)
+ */
+ if(H5EA__hdr_decr(ea->hdr) < 0)
+ H5E_THROW(H5E_CANTDEC, "can't decrement reference count on shared array header")
+ } /* end else */
/* Release the extensible array wrapper */
ea = (H5EA_t *)H5FL_FREE(H5EA_t, ea);
@@ -1077,7 +1113,7 @@ END_FUNC(PRIV) /* end H5EA_close() */
*/
BEGIN_FUNC(PRIV, ERR,
herr_t, SUCCEED, FAIL,
-H5EA_delete(H5F_t *f, hid_t dxpl_id, haddr_t ea_addr))
+H5EA_delete(H5F_t *f, hid_t dxpl_id, haddr_t ea_addr, void *ctx_udata))
/* Local variables */
H5EA_hdr_t *hdr = NULL; /* The fractal heap header information */
@@ -1092,7 +1128,7 @@ H5EA_delete(H5F_t *f, hid_t dxpl_id, haddr_t ea_addr))
#ifdef QAK
HDfprintf(stderr, "%s: ea_addr = %a\n", FUNC, ea_addr);
#endif /* QAK */
- if(NULL == (hdr = (H5EA_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_EARRAY_HDR, ea_addr, NULL, NULL, H5AC_WRITE)))
+ if(NULL == (hdr = (H5EA_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_EARRAY_HDR, ea_addr, NULL, ctx_udata, H5AC_WRITE)))
H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array header, address = %llu", (unsigned long long)ea_addr)
/* Check for files using shared array header */
diff --git a/src/H5EAcache.c b/src/H5EAcache.c
index a254e84..2e1c632 100644
--- a/src/H5EAcache.c
+++ b/src/H5EAcache.c
@@ -198,11 +198,11 @@ const H5AC_class_t H5AC_EARRAY_DBLK_PAGE[1] = {{
*/
BEGIN_FUNC(STATIC, ERR,
H5EA_hdr_t *, NULL, NULL,
-H5EA__cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_cls,
+H5EA__cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *udata1,
void *ctx_udata))
/* Local variables */
- const H5EA_class_t *cls = (const H5EA_class_t *)_cls; /* Extensible array class */
+ H5EA_cls_id_t id; /* ID of extensible array class, as found in file */
H5EA_hdr_t *hdr = NULL; /* Extensible array info */
size_t size; /* Header size */
H5WB_t *wb = NULL; /* Wrapped buffer for header data */
@@ -217,7 +217,7 @@ H5EA__cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_cls,
HDassert(H5F_addr_defined(addr));
/* Allocate space for the extensible array data structure */
- if(NULL == (hdr = H5EA__hdr_alloc(f, cls, ctx_udata)))
+ if(NULL == (hdr = H5EA__hdr_alloc(f)))
H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array shared header")
/* Set the extensible array header's address */
@@ -250,9 +250,11 @@ H5EA__cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_cls,
if(*p++ != H5EA_HDR_VERSION)
H5E_THROW(H5E_VERSION, "wrong extensible array header version")
- /* Extensible array type */
- if(*p++ != (uint8_t)cls->id)
+ /* Extensible array class */
+ id = *p++;
+ if(id >= H5EA_NUM_CLS_ID)
H5E_THROW(H5E_BADTYPE, "incorrect extensible array class")
+ hdr->cparam.cls = H5EA_client_class_g[id];
/* General array creation/configuration information */
hdr->cparam.raw_elmt_size = *p++; /* Element size in file (in bytes) */
@@ -314,7 +316,7 @@ H5EA__cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_cls,
H5E_THROW(H5E_BADVALUE, "incorrect metadata checksum for extensible array header")
/* Finish initializing extensible array header */
- if(H5EA__hdr_init(hdr) < 0)
+ if(H5EA__hdr_init(hdr, ctx_udata) < 0)
H5E_THROW(H5E_CANTINIT, "initialization failed for extensible array header")
HDassert(hdr->size == size);
diff --git a/src/H5EAhdr.c b/src/H5EAhdr.c
index c8dd34d..4280767 100644
--- a/src/H5EAhdr.c
+++ b/src/H5EAhdr.c
@@ -118,14 +118,13 @@ H5FL_SEQ_DEFINE_STATIC(H5EA_sblk_info_t);
*/
BEGIN_FUNC(PKG, ERR,
H5EA_hdr_t *, NULL, NULL,
-H5EA__hdr_alloc(H5F_t *f, const H5EA_class_t *cls, void *udata))
+H5EA__hdr_alloc(H5F_t *f))
/* Local variables */
H5EA_hdr_t *hdr = NULL; /* Shared extensible array header */
/* Check arguments */
HDassert(f);
- HDassert(cls);
/* Allocate space for the shared information */
if(NULL == (hdr = H5FL_CALLOC(H5EA_hdr_t)))
@@ -140,13 +139,6 @@ H5EA__hdr_alloc(H5F_t *f, const H5EA_class_t *cls, void *udata))
hdr->sizeof_addr = H5F_SIZEOF_ADDR(f);
hdr->sizeof_size = H5F_SIZEOF_SIZE(f);
- /* Set the class of the array */
- hdr->cparam.cls = cls;
-
- /* Create the callback context */
- if(NULL == (hdr->cb_ctx = (*cls->crt_context)(udata)))
- H5E_THROW(H5E_CANTCREATE, "unable to create extensible array client callback context")
-
/* Set the return value */
ret_value = hdr;
@@ -196,7 +188,7 @@ END_FUNC(PKG) /* end H5EA__hdr_alloc() */
*/
BEGIN_FUNC(PKG, ERR,
herr_t, SUCCEED, FAIL,
-H5EA__hdr_init(H5EA_hdr_t *hdr))
+H5EA__hdr_init(H5EA_hdr_t *hdr, void *ctx_udata))
/* Local variables */
hsize_t start_idx; /* First element index for each super block */
@@ -241,6 +233,12 @@ HDfprintf(stderr, "%s: hdr->sblk_info[%Zu] = {%Zu, %Zu, %Hu, %Hu}\n", FUNC, u, h
/* Set size of header on disk (locally and in statistics) */
hdr->stats.computed.hdr_size = hdr->size = H5EA_HEADER_SIZE(hdr);
+ /* Create the callback context, if there's one */
+ if(hdr->cparam.cls->crt_context) {
+ if(NULL == (hdr->cb_ctx = (*hdr->cparam.cls->crt_context)(ctx_udata)))
+ H5E_THROW(H5E_CANTCREATE, "unable to create extensible array client callback context")
+ } /* end if */
+
CATCH
END_FUNC(PKG) /* end H5EA__hdr_init() */
@@ -420,7 +418,7 @@ HDfprintf(stderr, "%s: Called\n", FUNC);
#endif /* NDEBUG */
/* Allocate space for the shared information */
- if(NULL == (hdr = H5EA__hdr_alloc(f, cparam->cls, ctx_udata)))
+ if(NULL == (hdr = H5EA__hdr_alloc(f)))
H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array shared header")
/* Set the internal parameters for the array */
@@ -430,7 +428,7 @@ HDfprintf(stderr, "%s: Called\n", FUNC);
HDmemcpy(&hdr->cparam, cparam, sizeof(hdr->cparam));
/* Finish initializing extensible array header */
- if(H5EA__hdr_init(hdr) < 0)
+ if(H5EA__hdr_init(hdr, ctx_udata) < 0)
H5E_THROW(H5E_CANTINIT, "initialization failed for extensible array header")
/* Allocate space for the header on disk */
@@ -695,8 +693,10 @@ H5EA__hdr_dest(H5EA_hdr_t *hdr))
HDassert(hdr->rc == 0);
/* Destroy the callback context */
- if((*hdr->cparam.cls->dst_context)(hdr->cb_ctx) < 0)
- H5E_THROW(H5E_CANTRELEASE, "unable to destroy extensible array client callback context")
+ if(hdr->cb_ctx) {
+ if((*hdr->cparam.cls->dst_context)(hdr->cb_ctx) < 0)
+ H5E_THROW(H5E_CANTRELEASE, "unable to destroy extensible array client callback context")
+ } /* end if */
hdr->cb_ctx = NULL;
/* Check for data block element buffer factory info to free */
diff --git a/src/H5EApkg.h b/src/H5EApkg.h
index 9b91bdb..f729b69 100644
--- a/src/H5EApkg.h
+++ b/src/H5EApkg.h
@@ -354,6 +354,9 @@ H5_DLLVAR const H5AC_class_t H5AC_EARRAY_DBLK_PAGE[1];
H5_DLLVAR const H5EA_class_t H5EA_CLS_TEST[1];
#endif /* H5EA_TESTING */
+/* Array of extensible array client ID -> client class mappings */
+extern const H5EA_class_t *const H5EA_client_class_g[];
+
/******************************/
/* Package Private Prototypes */
@@ -366,9 +369,8 @@ H5_DLL herr_t H5EA__destroy_flush_depend(H5EA_hdr_t *hdr, H5AC_info_t *parent_en
H5AC_info_t *child_entry);
/* Header routines */
-H5_DLL H5EA_hdr_t *H5EA__hdr_alloc(H5F_t *f, const H5EA_class_t *cls,
- void *ctx_udata);
-H5_DLL herr_t H5EA__hdr_init(H5EA_hdr_t *hdr);
+H5_DLL H5EA_hdr_t *H5EA__hdr_alloc(H5F_t *f);
+H5_DLL herr_t H5EA__hdr_init(H5EA_hdr_t *hdr, void *ctx_udata);
H5_DLL haddr_t H5EA__hdr_create(H5F_t *f, hid_t dxpl_id, const H5EA_create_t *cparam,
void *ctx_udata);
H5_DLL void *H5EA__hdr_alloc_elmts(H5EA_hdr_t *hdr, size_t nelmts);
diff --git a/src/H5EAprivate.h b/src/H5EAprivate.h
index 12074fe..06bdd55 100644
--- a/src/H5EAprivate.h
+++ b/src/H5EAprivate.h
@@ -52,6 +52,7 @@ typedef enum H5EA_cls_id_t {
H5EA_CLS_CHUNK_ID = 0, /* Extensible array is for indexing dataset chunks w/o filters */
H5EA_CLS_FILT_CHUNK_ID, /* Extensible array is for indexing dataset chunks w/filters */
+ /* Start real class IDs at 0 -QAK */
/* (keep these last) */
H5EA_CLS_TEST_ID, /* Extensible array is for testing (do not use for actual data) */
H5EA_NUM_CLS_ID /* Number of Extensible Array class IDs (must be last) */
@@ -124,8 +125,7 @@ typedef struct H5EA_t H5EA_t;
/* General routines */
H5_DLL H5EA_t *H5EA_create(H5F_t *f, hid_t dxpl_id, const H5EA_create_t *cparam,
void *ctx_udata);
-H5_DLL H5EA_t *H5EA_open(H5F_t *f, hid_t dxpl_id, haddr_t ea_addr,
- const H5EA_class_t *cls, void *ctx_udata);
+H5_DLL H5EA_t *H5EA_open(H5F_t *f, hid_t dxpl_id, haddr_t ea_addr, void *ctx_udata);
H5_DLL herr_t H5EA_get_nelmts(const H5EA_t *ea, hsize_t *nelmts);
H5_DLL herr_t H5EA_get_addr(const H5EA_t *ea, haddr_t *addr);
H5_DLL herr_t H5EA_set(const H5EA_t *ea, hid_t dxpl_id, hsize_t idx, const void *elmt);
@@ -137,7 +137,7 @@ H5_DLL herr_t H5EA_support(const H5EA_t *ea, hid_t dxpl_id, hsize_t idx,
H5_DLL herr_t H5EA_unsupport(const H5EA_t *ea, hid_t dxpl_id, hsize_t idx,
H5AC_info_t *child_entry);
H5_DLL herr_t H5EA_close(H5EA_t *ea, hid_t dxpl_id);
-H5_DLL herr_t H5EA_delete(H5F_t *f, hid_t dxpl_id, haddr_t ea_addr);
+H5_DLL herr_t H5EA_delete(H5F_t *f, hid_t dxpl_id, haddr_t ea_addr, void *ctx_udata);
/* Statistics routines */
H5_DLL herr_t H5EA_get_stats(const H5EA_t *ea, H5EA_stat_t *stats);
diff --git a/src/H5Eprivate.h b/src/H5Eprivate.h
index 3ca05e7..4c226d0 100644
--- a/src/H5Eprivate.h
+++ b/src/H5Eprivate.h
@@ -32,14 +32,14 @@ typedef struct H5E_t H5E_t;
* and a FUNC_LEAVE() within a function body. The arguments are the major
* error number, the minor error number, and a description of the error.
*/
-#define HERROR(maj_id, min_id, str) H5E_push_stack(NULL, __FILE__, FUNC, __LINE__, H5E_ERR_CLS_g, maj_id, min_id, str)
+#define HERROR(maj_id, min_id, ...) H5E_printf_stack(NULL, __FILE__, FUNC, __LINE__, H5E_ERR_CLS_g, maj_id, min_id, __VA_ARGS__)
/*
* HCOMMON_ERROR macro, used by HDONE_ERROR and HGOTO_ERROR
* (Shouldn't need to be used outside this header file)
*/
-#define HCOMMON_ERROR(maj, min, str) \
- HERROR(maj, min, str); \
+#define HCOMMON_ERROR(maj, min, ...) \
+ HERROR(maj, min, __VA_ARGS__); \
err_occurred = TRUE;
/*
@@ -51,8 +51,8 @@ typedef struct H5E_t H5E_t;
* (This macro can also be used to push an error and set the return value
* without jumping to any labels)
*/
-#define HDONE_ERROR(maj, min, ret_val, str) { \
- HCOMMON_ERROR(maj, min, str); \
+#define HDONE_ERROR(maj, min, ret_val, ...) { \
+ HCOMMON_ERROR(maj, min, __VA_ARGS__); \
ret_value = ret_val; \
}
@@ -63,8 +63,8 @@ typedef struct H5E_t H5E_t;
* error string. The return value is assigned to a variable `ret_value' and
* control branches to the `done' label.
*/
-#define HGOTO_ERROR(maj, min, ret_val, str) { \
- HCOMMON_ERROR(maj, min, str); \
+#define HGOTO_ERROR(maj, min, ret_val, ...) { \
+ HCOMMON_ERROR(maj, min, __VA_ARGS__); \
HGOTO_DONE(ret_val) \
}
@@ -84,16 +84,13 @@ typedef struct H5E_t H5E_t;
/* Retrieve the error code description string and push it onto the error
* stack.
*/
-#define HSYS_ERROR(errnum) { \
- HERROR(H5E_INTERNAL, H5E_SYSERRSTR, HDstrerror(errnum)); \
-}
#define HSYS_DONE_ERROR(majorcode, minorcode, retcode, str) { \
- HSYS_ERROR(errno); \
- HDONE_ERROR(majorcode, minorcode, retcode, str); \
+ int myerrno = errno; \
+ HDONE_ERROR(majorcode, minorcode, retcode, "%s, errno = %d, error message = '%s'", str, myerrno, HDstrerror(myerrno)); \
}
#define HSYS_GOTO_ERROR(majorcode, minorcode, retcode, str) { \
- HSYS_ERROR(errno); \
- HGOTO_ERROR(majorcode, minorcode, retcode, str); \
+ int myerrno = errno; \
+ HGOTO_ERROR(majorcode, minorcode, retcode, "%s, errno = %d, error message = '%s'", str, myerrno, HDstrerror(myerrno)); \
}
#ifdef H5_HAVE_PARALLEL
diff --git a/src/H5F.c b/src/H5F.c
index 6d16e73..064988e 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -891,6 +891,10 @@ H5F_new(H5F_file_t *shared, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf)
if(H5P_get(plist, H5F_CRT_SHMSG_NINDEXES_NAME, &f->shared->sohm_nindexes) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get number of SOHM indexes")
HDassert(f->shared->sohm_nindexes < 255);
+ if(H5P_get(plist, H5F_CRT_FILE_SPACE_STRATEGY_NAME, &f->shared->fs_strategy) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get file space strategy")
+ if(H5P_get(plist, H5F_CRT_FREE_SPACE_THRESHOLD_NAME, &f->shared->fs_threshold) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get free-space section threshold")
/* Get the FAPL values to cache */
if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id)))
@@ -1025,9 +1029,11 @@ H5F_dest(H5F_t *f, hid_t dxpl_id)
* and also because releasing free space can shrink the file's
* 'eoa' value)
*/
- if(H5MF_close(f, dxpl_id) < 0)
- /* Push error, but keep going*/
- HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release file free space info")
+ if(H5F_ACC_RDWR & H5F_INTENT(f)) {
+ if(H5MF_close(f, dxpl_id) < 0)
+ /* Push error, but keep going*/
+ HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release file free space info")
+ } /* end if */
/* Unpin the superblock, since we're about to destroy the cache */
if(H5AC_unpin_entry(f, f->shared->sblock) < 0)
@@ -1084,7 +1090,7 @@ H5F_dest(H5F_t *f, hid_t dxpl_id)
HDONE_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "can't close property list")
/* Only truncate the file on an orderly close, with write-access */
- if(f->closing && (H5F_ACC_RDWR & f->shared->flags)) {
+ if(f->closing && (H5F_ACC_RDWR & H5F_INTENT(f))) {
/* Truncate the file to the current allocated size */
if(H5FD_truncate(f->shared->lf, dxpl_id, (unsigned)TRUE) < 0)
/* Push error, but keep going*/
@@ -1629,7 +1635,7 @@ H5Fflush(hid_t object_id, H5F_scope_t scope)
* calling H5Fflush() with the read-only handle, still causes data
* to be flushed.
*/
- if(H5F_ACC_RDWR & f->shared->flags) {
+ if(H5F_ACC_RDWR & H5F_INTENT(f)) {
/* Flush other files, depending on scope */
if(H5F_SCOPE_GLOBAL == scope) {
/* Call the flush routine for mounted file hierarchies */
@@ -1907,7 +1913,7 @@ H5F_try_close(H5F_t *f)
* copy of the cache needs to be clean.
* Only try to flush the file if it was opened with write access.
*/
- if(f->intent&H5F_ACC_RDWR) {
+ if(f->intent & H5F_ACC_RDWR) {
/* Flush all caches */
if(H5F_flush(f, H5AC_dxpl_id) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush cache")
@@ -2798,11 +2804,13 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Fget_info
- * 1. Get storage size for superblock extension if there is one
+ * Function: H5Fget_info2
+ *
+ * Purpose: Gets general information about the file, including:
+ * 1. Get storage size for superblock extension if there is one.
* 2. Get the amount of btree and heap storage for entries
* in the SOHM table if there is one.
- * Consider success when there is no superblock extension and/or SOHM table
+ * 3. The amount of free space tracked in the file.
*
* Return: Success: non-negative on success
* Failure: Negative
@@ -2813,12 +2821,12 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Fget_info(hid_t obj_id, H5F_info_t *finfo)
+H5Fget_info2(hid_t obj_id, H5F_info2_t *finfo)
{
H5F_t *f; /* Top file in mount hierarchy */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_API(H5Fget_info, FAIL)
+ FUNC_ENTER_API(H5Fget_info2, FAIL)
H5TRACE2("e", "i*x", obj_id, finfo);
/* Check args */
@@ -2844,18 +2852,67 @@ H5Fget_info(hid_t obj_id, H5F_info_t *finfo)
HDassert(f->shared);
/* Reset file info struct */
- HDmemset(finfo, 0, sizeof(H5F_info_t));
+ HDmemset(finfo, 0, sizeof(*finfo));
+
+ /* Get the size of the superblock and any superblock extensions */
+ if(H5F_super_size(f, H5AC_ind_dxpl_id, &finfo->super.super_size, &finfo->super.super_ext_size) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "Unable to retrieve superblock sizes")
- /* Check for superblock extension info */
- if(H5F_super_size(f, H5AC_ind_dxpl_id, NULL, &finfo->super_ext_size) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "Unable to retrieve superblock extension size")
+ /* Get the size of any persistent free space */
+ if(H5MF_get_freespace(f, H5AC_ind_dxpl_id, &finfo->free.tot_space, &finfo->free.meta_size) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "Unable to retrieve free space information")
/* Check for SOHM info */
if(H5F_addr_defined(f->shared->sohm_addr))
- if(H5SM_ih_size(f, H5AC_ind_dxpl_id, finfo) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "Unable to retrieve SOHM btree & heap storage info")
+ if(H5SM_ih_size(f, H5AC_ind_dxpl_id, &finfo->sohm.hdr_size, &finfo->sohm.msgs_info) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "Unable to retrieve SOHM index & heap storage info")
+
+ /* Set version # fields */
+ finfo->super.version = f->shared->sblock->super_vers;
+ finfo->sohm.version = f->shared->sohm_vers;
+ finfo->free.version = HDF5_FREESPACE_VERSION;
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Fget_info2() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Fget_free_sections
+ *
+ * Purpose: To get free-space section information for free-space manager with
+ * TYPE that is associated with file FILE_ID.
+ * If SECT_INFO is null, this routine returns the total # of free-space
+ * sections.
+ *
+ * Return: Success: non-negative, the total # of free space sections
+ * Failure: negative
+ *
+ * Programmer: Vailin Choi; July 1st, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+ssize_t
+H5Fget_free_sections(hid_t file_id, H5F_mem_t type, size_t nsects,
+ H5F_sect_info_t *sect_info/*out*/)
+{
+ H5F_t *file; /* Top file in mount hierarchy */
+ ssize_t ret_value; /* Return value */
+
+ FUNC_ENTER_API(H5Fget_free_sections, FAIL)
+ H5TRACE4("Zs", "iFmzx", file_id, type, nsects, sect_info);
+
+ /* Check args */
+ if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID")
+ if(sect_info && nsects == 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "nsects must be > 0")
+
+ /* Go get the free-space section information in the file */
+ if((ret_value = H5MF_get_free_sections(file, H5AC_ind_dxpl_id, type, nsects, sect_info)) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check free space for file")
done:
FUNC_LEAVE_API(ret_value)
-} /* end H5Fget_info() */
+} /* end H5Fget_free_sections() */
diff --git a/src/H5FA.c b/src/H5FA.c
index 7d6a136..1e2bd1a 100644
--- a/src/H5FA.c
+++ b/src/H5FA.c
@@ -70,6 +70,17 @@
/* Package Variables */
/*********************/
+/* Fixed array client ID to class mapping */
+
+/* Remember to add client ID to H5FA_cls_id_t in H5FAprivate.h when adding a new
+ * client class..
+ */
+const H5FA_class_t *const H5FA_client_class_g[] = {
+ H5FA_CLS_CHUNK, /* 0 - H5FA_CLS_CHUNK_ID */
+ H5FA_CLS_FILT_CHUNK, /* 1 - H5FA_CLS_FILT_CHUNK_ID */
+ H5FA_CLS_TEST, /* ? - H5FA_CLS_TEST_ID */
+};
+
/*****************************/
/* Library Private Variables */
@@ -120,6 +131,9 @@ HDfprintf(stderr, "%s: Called\n", FUNC);
HDassert(f);
HDassert(cparam);
+ /* H5FA interface sanity check */
+ HDcompile_assert(H5FA_NUM_CLS_ID == NELMTS(H5FA_client_class_g));
+
/* Create fixed array header */
if(HADDR_UNDEF == (fa_addr = H5FA__hdr_create(f, dxpl_id, cparam, ctx_udata)))
H5E_THROW(H5E_CANTINIT, "can't create fixed array header")
@@ -129,7 +143,7 @@ HDfprintf(stderr, "%s: Called\n", FUNC);
H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array info")
/* Lock the array header into memory */
- if(NULL == (hdr = (H5FA_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_FARRAY_HDR, fa_addr, cparam->cls, NULL, H5AC_WRITE)))
+ if(NULL == (hdr = (H5FA_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_FARRAY_HDR, fa_addr, NULL, ctx_udata, H5AC_WRITE)))
H5E_THROW(H5E_CANTPROTECT, "unable to load fixed array header")
/* Point fixed array wrapper at header and bump it's ref count */
@@ -173,8 +187,7 @@ END_FUNC(PRIV) /* end H5FA_create() */
*/
BEGIN_FUNC(PRIV, ERR,
H5FA_t *, NULL, NULL,
-H5FA_open(H5F_t *f, hid_t dxpl_id, haddr_t fa_addr, const H5FA_class_t *cls,
- void *ctx_udata))
+H5FA_open(H5F_t *f, hid_t dxpl_id, haddr_t fa_addr, void *ctx_udata))
/* Local variables */
H5FA_t *fa = NULL; /* Pointer to new fixed array wrapper */
@@ -185,13 +198,12 @@ H5FA_open(H5F_t *f, hid_t dxpl_id, haddr_t fa_addr, const H5FA_class_t *cls,
*/
HDassert(f);
HDassert(H5F_addr_defined(fa_addr));
- HDassert(cls);
/* Load the array header into memory */
#ifdef H5FA_DEBUG
HDfprintf(stderr, "%s: fa_addr = %a\n", FUNC, fa_addr);
#endif /* H5FA_DEBUG */
- if(NULL == (hdr = (H5FA_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_FARRAY_HDR, fa_addr, cls, ctx_udata, H5AC_READ)))
+ if(NULL == (hdr = (H5FA_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_FARRAY_HDR, fa_addr, NULL, ctx_udata, H5AC_READ)))
H5E_THROW(H5E_CANTPROTECT, "unable to load fixed array header, address = %llu", (unsigned long long)fa_addr)
/* Check for pending array deletion */
@@ -561,28 +573,52 @@ HDfprintf(stderr, "%s: Called\n", FUNC);
} /* end if */
} /* end if */
- /* Decrement the reference count on the array header */
- /* (don't put in H5FA_hdr_fuse_decr() as the array header may be evicted
- * immediately -QAK)
- */
- if(H5FA__hdr_decr(fa->hdr) < 0)
- H5E_THROW(H5E_CANTDEC, "can't decrement reference count on shared array header")
-
/* Check for pending array deletion */
if(pending_delete) {
H5FA_hdr_t *hdr; /* Another pointer to fixed array header */
+#ifndef NDEBUG
+{
+ unsigned hdr_status = 0; /* Header's status in the metadata cache */
+
+ /* Check the header's status in the metadata cache */
+ if(H5AC_get_entry_status(fa->f, fa_addr, &hdr_status) < 0)
+ H5E_THROW(H5E_CANTGET, "unable to check metadata cache status for fixed array header")
+
+ /* Sanity checks on header */
+ HDassert(hdr_status & H5AC_ES__IN_CACHE);
+ HDassert(hdr_status & H5AC_ES__IS_PINNED);
+ HDassert(!(hdr_status & H5AC_ES__IS_PROTECTED));
+}
+#endif /* NDEBUG */
+
/* Lock the array header into memory */
+ /* (OK to pass in NULL for callback context, since we know the header must be in the cache) */
if(NULL == (hdr = (H5FA_hdr_t *)H5AC_protect(fa->f, dxpl_id, H5AC_FARRAY_HDR, fa_addr, NULL, NULL, H5AC_WRITE)))
H5E_THROW(H5E_CANTLOAD, "unable to load fixed array header")
/* Set the shared array header's file context for this operation */
hdr->f = fa->f;
+ /* Decrement the reference count on the array header */
+ /* (don't put in H5FA_hdr_fuse_decr() as the array header may be evicted
+ * immediately -QAK)
+ */
+ if(H5FA__hdr_decr(fa->hdr) < 0)
+ H5E_THROW(H5E_CANTDEC, "can't decrement reference count on shared array header")
+
/* Delete array, starting with header (unprotects header) */
if(H5FA__hdr_delete(hdr, dxpl_id) < 0)
H5E_THROW(H5E_CANTDELETE, "unable to delete fixed array")
} /* end if */
+ else {
+ /* Decrement the reference count on the array header */
+ /* (don't put in H5FA_hdr_fuse_decr() as the array header may be evicted
+ * immediately -QAK)
+ */
+ if(H5FA__hdr_decr(fa->hdr) < 0)
+ H5E_THROW(H5E_CANTDEC, "can't decrement reference count on shared array header")
+ } /* end else */
/* Release the fixed array wrapper */
fa = H5FL_FREE(H5FA_t, fa);
@@ -606,7 +642,7 @@ END_FUNC(PRIV) /* end H5FA_close() */
*/
BEGIN_FUNC(PRIV, ERR,
herr_t, SUCCEED, FAIL,
-H5FA_delete(H5F_t *f, hid_t dxpl_id, haddr_t fa_addr))
+H5FA_delete(H5F_t *f, hid_t dxpl_id, haddr_t fa_addr, void *ctx_udata))
/* Local variables */
H5FA_hdr_t *hdr = NULL; /* The fixed array header information */
@@ -621,7 +657,7 @@ H5FA_delete(H5F_t *f, hid_t dxpl_id, haddr_t fa_addr))
#ifdef H5FA_DEBUG
HDfprintf(stderr, "%s: fa_addr = %a\n", FUNC, fa_addr);
#endif /* H5FA_DEBUG */
- if(NULL == (hdr = (H5FA_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_FARRAY_HDR, fa_addr, NULL, NULL, H5AC_WRITE)))
+ if(NULL == (hdr = (H5FA_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_FARRAY_HDR, fa_addr, NULL, ctx_udata, H5AC_WRITE)))
H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array header, address = %llu", (unsigned long long)fa_addr)
/* Check for files using shared array header */
diff --git a/src/H5FAcache.c b/src/H5FAcache.c
index 59a81e2..3488531 100644
--- a/src/H5FAcache.c
+++ b/src/H5FAcache.c
@@ -158,11 +158,11 @@ const H5AC_class_t H5AC_FARRAY_DBLK_PAGE[1] = {{
*/
BEGIN_FUNC(STATIC, ERR,
H5FA_hdr_t *, NULL, NULL,
-H5FA__cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_cls,
+H5FA__cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *udata1,
void *ctx_udata))
/* Local variables */
- const H5FA_class_t *cls = (const H5FA_class_t *)_cls; /* Fixed array class */
+ H5FA_cls_id_t id; /* ID of fixed array class, as found in file */
H5FA_hdr_t *hdr = NULL; /* Fixed array info */
size_t size; /* Header size */
H5WB_t *wb = NULL; /* Wrapped buffer for header data */
@@ -177,7 +177,7 @@ H5FA__cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_cls,
HDassert(H5F_addr_defined(addr));
/* Allocate space for the fixed array data structure */
- if(NULL == (hdr = H5FA__hdr_alloc(f, cls, ctx_udata)))
+ if(NULL == (hdr = H5FA__hdr_alloc(f)))
H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array shared header")
/* Set the fixed array header's address */
@@ -210,9 +210,11 @@ H5FA__cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_cls,
if(*p++ != H5FA_HDR_VERSION)
H5E_THROW(H5E_VERSION, "wrong fixed array header version")
- /* Fixed array type */
- if(*p++ != (uint8_t)cls->id)
+ /* Fixed array class */
+ id = *p++;
+ if(id >= H5FA_NUM_CLS_ID)
H5E_THROW(H5E_BADTYPE, "incorrect fixed array class")
+ hdr->cparam.cls = H5FA_client_class_g[id];
/* General array creation/configuration information */
hdr->cparam.raw_elmt_size = *p++; /* Element size in file (in bytes) */
@@ -226,10 +228,6 @@ H5FA__cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_cls,
/* Internal information */
H5F_addr_decode(f, &p, &hdr->dblk_addr); /* Address of index block */
- /* Initializations of header info */
- hdr->stats.nelmts = hdr->cparam.nelmts;
- hdr->stats.hdr_size = hdr->size = size; /* Size of header in file */
-
/* Check for data block */
if(H5F_addr_defined(hdr->dblk_addr)) {
H5FA_dblock_t dblock; /* Fake data block for computing size */
@@ -267,6 +265,11 @@ H5FA__cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_cls,
if(stored_chksum != computed_chksum)
H5E_THROW(H5E_BADVALUE, "incorrect metadata checksum for fixed array header")
+ /* Finish initializing fixed array header */
+ if(H5FA__hdr_init(hdr, ctx_udata) < 0)
+ H5E_THROW(H5E_CANTINIT, "initialization failed for fixed array header")
+ HDassert(hdr->size == size);
+
/* Set return value */
ret_value = hdr;
diff --git a/src/H5FAhdr.c b/src/H5FAhdr.c
index e6231d4..94fb7b2 100644
--- a/src/H5FAhdr.c
+++ b/src/H5FAhdr.c
@@ -95,14 +95,13 @@ H5FL_DEFINE_STATIC(H5FA_hdr_t);
*/
BEGIN_FUNC(PKG, ERR,
H5FA_hdr_t *, NULL, NULL,
-H5FA__hdr_alloc(H5F_t *f, const H5FA_class_t *cls, void *udata))
+H5FA__hdr_alloc(H5F_t *f))
/* Local variables */
H5FA_hdr_t *hdr = NULL; /* Shared Fixed Array header */
/* Check arguments */
HDassert(f);
- HDassert(cls);
/* Allocate space for the shared information */
if(NULL == (hdr = H5FL_CALLOC(H5FA_hdr_t)))
@@ -116,13 +115,6 @@ H5FA__hdr_alloc(H5F_t *f, const H5FA_class_t *cls, void *udata))
hdr->sizeof_addr = H5F_SIZEOF_ADDR(f);
hdr->sizeof_size = H5F_SIZEOF_SIZE(f);
- /* Set the class of the array */
- hdr->cparam.cls = cls;
-
- /* Create the callback context */
- if(NULL == (hdr->cb_ctx = (*cls->crt_context)(udata)))
- H5E_THROW(H5E_CANTCREATE, "unable to create fixed array client callback context")
-
/* Set the return value */
ret_value = hdr;
@@ -135,6 +127,44 @@ END_FUNC(PKG) /* end H5FA__hdr_alloc() */
/*-------------------------------------------------------------------------
+ * Function: H5FA__hdr_init
+ *
+ * Purpose: Initialize shared fixed array header
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Sunday, November 15, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+BEGIN_FUNC(PKG, ERR,
+herr_t, SUCCEED, FAIL,
+H5FA__hdr_init(H5FA_hdr_t *hdr, void *ctx_udata))
+
+ /* Local variables */
+
+ /* Check arguments */
+ HDassert(hdr);
+
+ /* Set size of header on disk (locally and in statistics) */
+ hdr->stats.hdr_size = hdr->size = H5FA_HEADER_SIZE(hdr);
+
+ /* Set number of elements for Fixed Array in statistics */
+ hdr->stats.nelmts = hdr->cparam.nelmts;
+
+ /* Create the callback context, if there's one */
+ if(hdr->cparam.cls->crt_context) {
+ if(NULL == (hdr->cb_ctx = (*hdr->cparam.cls->crt_context)(ctx_udata)))
+ H5E_THROW(H5E_CANTCREATE, "unable to create fixed array client callback context")
+ } /* end if */
+
+CATCH
+
+END_FUNC(PKG) /* end H5FA__hdr_init() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5FA__hdr_create
*
* Purpose: Creates a new Fixed Array header in the file
@@ -175,7 +205,7 @@ HDfprintf(stderr, "%s: Called\n", FUNC);
#endif /* NDEBUG */
/* Allocate space for the shared information */
- if(NULL == (hdr = H5FA__hdr_alloc(f, cparam->cls, ctx_udata)))
+ if(NULL == (hdr = H5FA__hdr_alloc(f)))
H5E_THROW(H5E_CANTALLOC, "memory allocation failed for Fixed Array shared header")
hdr->dblk_addr = HADDR_UNDEF;
@@ -183,11 +213,9 @@ HDfprintf(stderr, "%s: Called\n", FUNC);
/* Set the creation parameters for the array */
HDmemcpy(&hdr->cparam, cparam, sizeof(hdr->cparam));
- /* Set size of header on disk (locally and in statistics) */
- hdr->stats.hdr_size = hdr->size = H5FA_HEADER_SIZE(hdr);
-
- /* Set number of elements for Fixed Array in statistics */
- hdr->stats.nelmts = hdr->cparam.nelmts;
+ /* Finish initializing fixed array header */
+ if(H5FA__hdr_init(hdr, ctx_udata) < 0)
+ H5E_THROW(H5E_CANTINIT, "initialization failed for fixed array header")
/* Allocate space for the header on disk */
if(HADDR_UNDEF == (hdr->addr = H5MF_alloc(f, H5FD_MEM_FARRAY_HDR, dxpl_id, (hsize_t)hdr->size)))
@@ -445,8 +473,10 @@ H5FA__hdr_dest(H5FA_hdr_t *hdr))
HDassert(hdr->rc == 0);
/* Destroy the callback context */
- if((*hdr->cparam.cls->dst_context)(hdr->cb_ctx) < 0)
- H5E_THROW(H5E_CANTRELEASE, "unable to destroy fixed array client callback context")
+ if(hdr->cb_ctx) {
+ if((*hdr->cparam.cls->dst_context)(hdr->cb_ctx) < 0)
+ H5E_THROW(H5E_CANTRELEASE, "unable to destroy fixed array client callback context")
+ } /* end if */
hdr->cb_ctx = NULL;
/* Free the shared info itself */
diff --git a/src/H5FApkg.h b/src/H5FApkg.h
index 1ba8f84..8e2a515 100644
--- a/src/H5FApkg.h
+++ b/src/H5FApkg.h
@@ -224,9 +224,10 @@ H5_DLLVAR const H5FA_class_t H5FA_CLS_CHUNK[1];
H5_DLLVAR const H5FA_class_t H5FA_CLS_FILT_CHUNK[1];
/* Internal fixed array testing class */
-#ifdef H5FA_TESTING
H5_DLLVAR const H5FA_class_t H5FA_CLS_TEST[1];
-#endif /* H5FA_TESTING */
+
+/* Array of fixed array client ID -> client class mappings */
+extern const H5FA_class_t *const H5FA_client_class_g[];
/******************************/
@@ -234,7 +235,8 @@ H5_DLLVAR const H5FA_class_t H5FA_CLS_TEST[1];
/******************************/
/* Header routines */
-H5_DLL H5FA_hdr_t *H5FA__hdr_alloc(H5F_t *f, const H5FA_class_t *cls, void *ctx_udata);
+H5_DLL H5FA_hdr_t *H5FA__hdr_alloc(H5F_t *f);
+H5_DLL herr_t H5FA__hdr_init(H5FA_hdr_t *hdr, void *ctx_udata);
H5_DLL haddr_t H5FA__hdr_create(H5F_t *f, hid_t dxpl_id, const H5FA_create_t *cparam, void *ctx_udata);
H5_DLL void *H5FA__hdr_alloc_elmts(H5FA_hdr_t *hdr, size_t nelmts);
H5_DLL herr_t H5FA__hdr_free_elmts(H5FA_hdr_t *hdr, size_t nelmts, void *elmts);
diff --git a/src/H5FAprivate.h b/src/H5FAprivate.h
index 16397fd..08e6e50 100644
--- a/src/H5FAprivate.h
+++ b/src/H5FAprivate.h
@@ -49,6 +49,7 @@ typedef enum H5FA_cls_id_t {
H5FA_CLS_CHUNK_ID = 0, /* Fixed array is for indexing dataset chunks w/o filters */
H5FA_CLS_FILT_CHUNK_ID, /* Fixed array is for indexing dataset chunks w/filters */
+ /* Start real class IDs at 0 -QAK */
/* (keep these last) */
H5FA_CLS_TEST_ID, /* Fixed array is for testing (do not use for actual data) */
H5FA_NUM_CLS_ID /* Number of Fixed Array class IDs (must be last) */
@@ -113,15 +114,14 @@ typedef int (*H5FA_operator_t)(hsize_t idx, const void *_elmt, void *_udata);
/* General routines */
H5_DLL H5FA_t *H5FA_create(H5F_t *f, hid_t dxpl_id, const H5FA_create_t *cparam,
void *ctx_udata);
-H5_DLL H5FA_t *H5FA_open(H5F_t *f, hid_t dxpl_id, haddr_t ea_addr, const H5FA_class_t *cls,
- void *ctx_udata);
+H5_DLL H5FA_t *H5FA_open(H5F_t *f, hid_t dxpl_id, haddr_t ea_addr, void *ctx_udata);
H5_DLL herr_t H5FA_get_nelmts(const H5FA_t *ea, hsize_t *nelmts);
H5_DLL herr_t H5FA_get_addr(const H5FA_t *ea, haddr_t *addr);
H5_DLL herr_t H5FA_set(const H5FA_t *ea, hid_t dxpl_id, hsize_t idx, const void *elmt);
H5_DLL herr_t H5FA_get(const H5FA_t *ea, hid_t dxpl_id, hsize_t idx, void *elmt);
-H5_DLL herr_t H5FA_close(H5FA_t *ea, hid_t dxpl_id);
-H5_DLL herr_t H5FA_delete(H5F_t *f, hid_t dxpl_id, haddr_t ea_addr);
H5_DLL herr_t H5FA_iterate(H5FA_t *fa, hid_t dxpl_id, H5FA_operator_t op, void *udata);
+H5_DLL herr_t H5FA_close(H5FA_t *ea, hid_t dxpl_id);
+H5_DLL herr_t H5FA_delete(H5F_t *f, hid_t dxpl_id, haddr_t ea_addr, void *ctx_udata);
/* Statistics routines */
H5_DLL herr_t H5FA_get_stats(const H5FA_t *ea, H5FA_stat_t *stats);
diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c
index 54f0d03..318839d 100644
--- a/src/H5FDsec2.c
+++ b/src/H5FDsec2.c
@@ -739,11 +739,11 @@ H5FD_sec2_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id,
/* Check for overflow conditions */
if(!H5F_addr_defined(addr))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "addr undefined")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "addr undefined, addr = %llu", (unsigned long long)addr)
if(REGION_OVERFLOW(addr, size))
- HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow")
+ HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow, addr = %llu", (unsigned long long)addr)
if((addr + size) > file->eoa)
- HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow")
+ HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow, addr = %llu", (unsigned long long)addr)
/* Seek to the correct location */
if((addr != file->pos || OP_READ != file->op) &&
@@ -820,9 +820,9 @@ H5FD_sec2_write(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, had
/* Check for overflow conditions */
if(!H5F_addr_defined(addr))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "addr undefined")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "addr undefined, addr = %llu", (unsigned long long)addr)
if(REGION_OVERFLOW(addr, size))
- HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow")
+ HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow, addr = %llu", (unsigned long long)addr)
/* If the file is open for SWMR read access, allow access to data past
* the end of the allocated space (the 'eoa'). This is done because the
* eoa stored in the file's superblock might be out of sync with the
@@ -830,7 +830,7 @@ H5FD_sec2_write(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, had
* SWMR write operations.
*/
if(!file->swmr_read && (addr + size) > file->eoa)
- HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow")
+ HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow, addr = %llu", (unsigned long long)addr)
/* Seek to the correct location */
if((addr != file->pos || OP_WRITE != file->op) &&
diff --git a/src/H5FS.c b/src/H5FS.c
index deb9378..5e3392e 100644
--- a/src/H5FS.c
+++ b/src/H5FS.c
@@ -477,9 +477,6 @@ HDfprintf(stderr, "%s: Section info is NOT for file free space\n", FUNC);
if(fspace->serial_sect_count > 0)
/* Sanity check that section info has address */
HDassert(H5F_addr_defined(fspace->sect_addr));
- else
- /* Sanity check that section info doesn't have address */
- HDassert(!H5F_addr_defined(fspace->sect_addr));
} /* end else */
/* Decrement the reference count on the free space manager header */
@@ -723,6 +720,183 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FS_dirty() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5FS_alloc_hdr()
+ *
+ * Purpose: Allocate space for the free-space manager header
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Vailin Choi; Feb 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5FS_alloc_hdr(H5F_t *f, H5FS_t *fspace, haddr_t *fs_addr, hid_t dxpl_id)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5FS_alloc_hdr, FAIL)
+
+ /* Check arguments. */
+ HDassert(f);
+ HDassert(fspace);
+
+ if(!H5F_addr_defined(fspace->addr)) {
+ /* Allocate space for the free space header */
+ if(HADDR_UNDEF == (fspace->addr = H5MF_alloc(f, H5FD_MEM_FSPACE_HDR, dxpl_id, (hsize_t)H5FS_HEADER_SIZE(f))))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for free space header")
+
+ /* Cache the new free space header (pinned) */
+ if(H5AC_set(f, dxpl_id, H5AC_FSPACE_HDR, fspace->addr, fspace, H5AC__PIN_ENTRY_FLAG) < 0)
+ HGOTO_ERROR(H5E_FSPACE, H5E_CANTINIT, FAIL, "can't add free space header to cache")
+ } /* end if */
+
+ if(fs_addr)
+ *fs_addr = fspace->addr;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5FS_alloc_hdr() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5FS_alloc_sect()
+ *
+ * Purpose: Allocate space for the free-space manager section info header
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Vailin Choi; Feb 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5FS_alloc_sect(H5F_t *f, H5FS_t *fspace, hid_t dxpl_id)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5FS_alloc_sect, FAIL)
+
+ /* Check arguments. */
+ HDassert(f);
+ HDassert(fspace);
+
+ if(!H5F_addr_defined(fspace->sect_addr) && fspace->sinfo && fspace->serial_sect_count > 0) {
+ /* Allocate space for section info from aggregator/vfd */
+ /* (The original version called H5MF_alloc(), but that may cause sect_size to change again) */
+ if(HADDR_UNDEF == (fspace->sect_addr = H5MF_aggr_vfd_alloc(f, H5FD_MEM_FSPACE_SINFO, dxpl_id, fspace->sect_size)))
+ HGOTO_ERROR(H5E_FSPACE, H5E_NOSPACE, FAIL, "file allocation failed for section info")
+
+ fspace->alloc_sect_size = fspace->sect_size;
+
+ /* Mark free-space header as dirty */
+ if(H5FS_dirty(f, fspace) < 0)
+ HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty")
+
+ /* Cache the free-space section info */
+ if(H5AC_set(f, dxpl_id, H5AC_FSPACE_SINFO, fspace->sect_addr, fspace->sinfo, H5AC__NO_FLAGS_SET) < 0)
+ HGOTO_ERROR(H5E_FSPACE, H5E_CANTINIT, FAIL, "can't add free space sections to cache")
+
+ fspace->sinfo = NULL;
+ } /* end if */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5FS_alloc_sect() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5FS_free()
+ *
+ * Purpose: Free space for free-space manager header and section info header
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Vailin Choi; Feb 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5FS_free(H5F_t *f, H5FS_t *fspace, hid_t dxpl_id)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+ haddr_t saved_addr;
+ hsize_t saved_size;
+ unsigned cache_flags;
+ unsigned sinfo_status = 0;
+ unsigned hdr_status = 0;
+
+ FUNC_ENTER_NOAPI(H5FS_free, FAIL)
+
+ /* Check arguments. */
+ HDassert(f);
+ HDassert(fspace);
+
+ cache_flags = H5AC__DELETED_FLAG | H5AC__TAKE_OWNERSHIP_FLAG;;
+
+ if(H5F_addr_defined(fspace->sect_addr)) {
+
+ /* Check whether free-space manager section info is in cache or not */
+ if(H5AC_get_entry_status(f, fspace->sect_addr, &sinfo_status) < 0)
+ HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "unable to check metadata cache status for free-space section info")
+
+ /* Load free-space manager section info */
+ if(sinfo_status & H5AC_ES__IN_CACHE || !fspace->sinfo) {
+ if(NULL == (fspace->sinfo = (H5FS_sinfo_t *)H5AC_protect(f, dxpl_id, H5AC_FSPACE_SINFO, fspace->sect_addr, NULL, fspace, H5AC_READ)))
+ HGOTO_ERROR(H5E_FSPACE, H5E_CANTUNPROTECT, FAIL, "unable to load free space section info")
+
+ /* Unload and release ownership of the free-space manager section info */
+ if(H5AC_unprotect(f, dxpl_id, H5AC_FSPACE_SINFO, fspace->sect_addr, fspace->sinfo, cache_flags) < 0)
+ HGOTO_ERROR(H5E_FSPACE, H5E_CANTUNPROTECT, FAIL, "unable to release free space section info")
+ }
+
+ saved_addr = fspace->sect_addr;
+ saved_size = fspace->alloc_sect_size;
+
+ fspace->sect_addr = HADDR_UNDEF;
+ fspace->alloc_sect_size = 0;
+
+ /* Free space for the free-space manager section info */
+ if(H5MF_xfree(f, H5FD_MEM_FSPACE_SINFO, dxpl_id, saved_addr, saved_size) < 0)
+ HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to release free space sections")
+
+ /* Mark free-space manager header as dirty */
+ if(H5FS_dirty(f, fspace) < 0)
+ HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty")
+ }
+
+ if(H5F_addr_defined(fspace->addr)) {
+ /* Check whether free-space manager header is in cache or not */
+ if(H5AC_get_entry_status(f, fspace->addr, &hdr_status) < 0)
+ HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "unable to check metadata cache status for free-space section info")
+
+ if(hdr_status & H5AC_ES__IN_CACHE) {
+ /* Unpin the free-space manager header */
+ if(H5AC_unpin_entry(f, fspace) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPIN, FAIL, "unable to unpin fractal heap header")
+
+ /* Load the free-space manager header */
+ if(NULL == (fspace = (H5FS_t *)H5AC_protect(f, dxpl_id, H5AC_FSPACE_HDR, fspace->addr, NULL, fspace, H5AC_READ)))
+ HGOTO_ERROR(H5E_FSPACE, H5E_CANTUNPROTECT, FAIL, "unable to load free space section info")
+
+ /* Unload and release ownership of the free-space header */
+ if(H5AC_unprotect(f, dxpl_id, H5AC_FSPACE_HDR, fspace->addr, fspace, cache_flags) < 0)
+ HGOTO_ERROR(H5E_FSPACE, H5E_CANTUNPROTECT, FAIL, "unable to release free space section info")
+ }
+ saved_addr = fspace->addr;
+ fspace->addr = HADDR_UNDEF;
+
+ /* Free space for the free-space manager header */
+ if(H5MF_xfree(f, H5FD_MEM_FSPACE_HDR, dxpl_id, saved_addr, (hsize_t)H5FS_HEADER_SIZE(f)) < 0)
+ HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to free free space header")
+ }
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5FS_free() */
+
#ifdef H5FS_DEBUG_ASSERT
/*-------------------------------------------------------------------------
diff --git a/src/H5FScache.c b/src/H5FScache.c
index a7978f5..482b9cb 100644
--- a/src/H5FScache.c
+++ b/src/H5FScache.c
@@ -334,10 +334,7 @@ HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n"
if(H5FS_cache_sinfo_flush(f, dxpl_id, FALSE, fspace->sect_addr, fspace->sinfo, NULL) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTFLUSH, FAIL, "unable to save free space section info to disk")
} /* end if */
- else {
- /* Sanity check that section info doesn't have address */
- HDassert(!H5F_addr_defined(fspace->sect_addr));
- } /* end else */
+
#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);
@@ -348,15 +345,9 @@ HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n"
fspace->sinfo->dirty = FALSE;
} /* end if */
} /* end if */
- else {
- /* Just sanity checks... */
- if(fspace->serial_sect_count > 0)
- /* Sanity check that section info has address */
- HDassert(H5F_addr_defined(fspace->sect_addr));
- else
- /* Sanity check that section info doesn't have address */
- HDassert(!H5F_addr_defined(fspace->sect_addr));
- } /* end else */
+ else if(fspace->serial_sect_count > 0)
+ /* Sanity check that section info has address */
+ HDassert(H5F_addr_defined(fspace->sect_addr));
if(fspace->cache_info.is_dirty) {
uint8_t *hdr; /* Pointer to header buffer */
diff --git a/src/H5FSdbg.c b/src/H5FSdbg.c
index df48240..8cf64ef 100644
--- a/src/H5FSdbg.c
+++ b/src/H5FSdbg.c
@@ -286,10 +286,8 @@ H5FS_sects_debug(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, FILE *stream, int
break;
case H5FS_CLIENT_FILE_ID:
-#ifdef NOT_YET
- if(H5MF_sects_debug(f, dxpl_id, fs_addr, stream, indent + 3, MAX(0, fwidth - 3)) < 0)
- HGOTO_ERROR(H5E_FSPACE, H5E_SYSTEM, FAIL, "unable to dump file free space sections")
-#endif /* NOT_YET */
+ if(H5MF_sects_debug(f, dxpl_id, fs_addr, stream, indent + 3, MAX(0, fwidth - 3)) < 0)
+ HGOTO_ERROR(H5E_FSPACE, H5E_SYSTEM, FAIL, "unable to dump file free space sections")
break;
default:
diff --git a/src/H5FSprivate.h b/src/H5FSprivate.h
index 056449d..145c374 100644
--- a/src/H5FSprivate.h
+++ b/src/H5FSprivate.h
@@ -180,10 +180,15 @@ H5_DLL H5FS_t *H5FS_open(H5F_t *f, hid_t dxpl_id, haddr_t fs_addr,
H5_DLL herr_t H5FS_size(const H5F_t *f, const H5FS_t *fspace, hsize_t *meta_size);
H5_DLL herr_t H5FS_delete(H5F_t *f, hid_t dxpl_id, haddr_t fs_addr);
H5_DLL herr_t H5FS_close(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace);
+H5_DLL herr_t H5FS_alloc_hdr(H5F_t *f, H5FS_t *fspace, haddr_t *fs_addr, hid_t dxpl_id);
+H5_DLL herr_t H5FS_alloc_sect(H5F_t *f, H5FS_t *fspace, hid_t dxpl_id);
+H5_DLL herr_t H5FS_free(H5F_t *f, H5FS_t *fspace, hid_t dxpl_id);
/* Free space section routines */
H5_DLL herr_t H5FS_sect_add(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace,
H5FS_section_info_t *node, unsigned flags, void *op_data);
+H5_DLL htri_t H5FS_sect_try_merge(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace,
+ H5FS_section_info_t *sect, unsigned flags, void *op_data);
H5_DLL htri_t H5FS_sect_try_extend(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace,
haddr_t addr, hsize_t size, hsize_t extra_requested);
H5_DLL herr_t H5FS_sect_remove(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace,
diff --git a/src/H5FSsection.c b/src/H5FSsection.c
index 26ff7b9..30885a9 100644
--- a/src/H5FSsection.c
+++ b/src/H5FSsection.c
@@ -1562,6 +1562,71 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5FS_sect_try_merge
+ *
+ * Purpose: Try to merge/shrink a block
+ *
+ * Return: TRUE: merged/shrunk
+ * FALSE: not merged/not shrunk
+ * Failure: negative
+ *
+ * Programmer: Vailin Choi; June 10, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+htri_t
+H5FS_sect_try_merge(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace, H5FS_section_info_t *sect,
+ unsigned flags, void *op_data)
+{
+ hbool_t sinfo_valid = FALSE; /* Whether the section info is valid */
+ hbool_t sinfo_modified = FALSE; /* Whether the section info was modified */
+ hsize_t saved_fs_size; /* copy the free-space section size */
+ htri_t ret_value = FALSE; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5FS_sect_try_merge, FAIL)
+
+ /* Check arguments. */
+ HDassert(f);
+ HDassert(fspace);
+ HDassert(sect);
+ HDassert(H5F_addr_defined(sect->addr));
+ HDassert(sect->size);
+
+ /* Get a pointer to the section info */
+ if(H5FS_sinfo_lock(f, dxpl_id, fspace, H5AC_WRITE) < 0)
+ HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't get section info")
+ sinfo_valid = TRUE;
+ saved_fs_size = sect->size;
+
+ /* Attempt to merge/shrink section with existing sections */
+ if(H5FS_sect_merge(fspace, &sect, op_data) < 0)
+ HGOTO_ERROR(H5E_FSPACE, H5E_CANTMERGE, FAIL, "can't merge sections")
+
+ /* Check if section is shrunk and/or merged away completely */
+ if(!sect) {
+ sinfo_modified = TRUE;
+ HGOTO_DONE(TRUE)
+ } /* end if */
+ else {
+ /* Check if section is merged */
+ if(sect->size > saved_fs_size) {
+ if(H5FS_sect_link(fspace, sect, flags) < 0)
+ HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't insert free space section into skip list")
+ sinfo_modified = TRUE;
+ HGOTO_DONE(TRUE)
+ } /* end if */
+ } /* end else */
+
+done:
+ /* Release the section info */
+ if(sinfo_valid && H5FS_sinfo_unlock(f, dxpl_id, fspace, sinfo_modified) < 0)
+ HDONE_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release section info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5FS_sect_try_merge() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5FS_sect_find_node
*
* Purpose: Locate a section of free space (in existing free space list
diff --git a/src/H5FStest.c b/src/H5FStest.c
index 719e553..af9eaec 100644
--- a/src/H5FStest.c
+++ b/src/H5FStest.c
@@ -69,7 +69,7 @@
/*-------------------------------------------------------------------------
- * Function: H5HF_get_cparam_test
+ * Function: H5FS_get_cparam_test
*
* Purpose: Retrieve the parameters used to create the free-space manager
*
@@ -101,7 +101,7 @@ H5FS_get_cparam_test(const H5FS_t *frsp, H5FS_create_t *cparam)
} /* H5FS_get_cparam_test() */
/*-------------------------------------------------------------------------
- * Function: H5HF_cmp_cparam_test
+ * Function: H5FS_cmp_cparam_test
*
* Purpose: Compare the parameters used to create the fractal heap
*
diff --git a/src/H5Faccum.c b/src/H5Faccum.c
index d8b9820..e525a08 100644
--- a/src/H5Faccum.c
+++ b/src/H5Faccum.c
@@ -99,6 +99,10 @@ H5FL_BLK_DEFINE_STATIC(meta_accum);
* Purpose: Attempts to read some data from the metadata accumulator for
* a file into a buffer.
*
+ * Note: We can't change (or add to) the metadata accumulator, because
+ * this might be a speculative read and could possibly read raw
+ * data into the metadata accumulator.
+ *
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
@@ -185,69 +189,11 @@ H5F_accum_read(const H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, haddr_t addr,
/* Make certain we've read it all */
HDassert(size == 0);
} /* end if */
- /* Current read doesn't overlap with metadata accumulator, read it into accumulator */
+ /* Current read doesn't overlap with metadata accumulator, read it from file */
else {
- /* Only update the metadata accumulator if it is not dirty or if
- * we are allowed to write the accumulator out during reads (when
- * it is dirty)
- */
- if(f->shared->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA_READ || !f->shared->accum.dirty) {
- /* Flush current contents, if dirty */
- if(f->shared->accum.dirty) {
- if(H5FD_write(f->shared->lf, dxpl_id, H5FD_MEM_DEFAULT, f->shared->accum.loc, f->shared->accum.size, f->shared->accum.buf) < 0)
- HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "driver write request failed")
-
- /* Reset accumulator dirty flag */
- f->shared->accum.dirty = FALSE;
- } /* end if */
-
- /* Cache the new piece of metadata */
- /* Check if we need to resize the buffer */
- if(size > f->shared->accum.alloc_size) {
- size_t new_size; /* New size of accumulator */
-
- /* Adjust the buffer size to be a power of 2 that is large enough to hold data */
- new_size = (size_t)1 << (1 + H5V_log2_gen((uint64_t)(size - 1)));
-
- /* Grow the metadata accumulator buffer */
- if(NULL == (f->shared->accum.buf = H5FL_BLK_REALLOC(meta_accum, f->shared->accum.buf, new_size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer")
-
- /* Note the new buffer size */
- f->shared->accum.alloc_size = new_size;
- } /* end if */
- else {
- /* Check if we should shrink the accumulator buffer */
- if(size < (f->shared->accum.alloc_size / H5F_ACCUM_THROTTLE) &&
- f->shared->accum.alloc_size > H5F_ACCUM_THRESHOLD) {
- size_t new_size = (f->shared->accum.alloc_size / H5F_ACCUM_THROTTLE); /* New size of accumulator buffer */
-
- /* Shrink the accumulator buffer */
- if(NULL == (f->shared->accum.buf = H5FL_BLK_REALLOC(meta_accum, f->shared->accum.buf, new_size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer")
-
- /* Note the new buffer size */
- f->shared->accum.alloc_size = new_size;
- } /* end if */
- } /* end else */
-
- /* Update accumulator information */
- f->shared->accum.loc = addr;
- f->shared->accum.size = size;
- f->shared->accum.dirty = FALSE;
-
- /* Read into accumulator */
- if(H5FD_read(f->shared->lf, dxpl_id, H5FD_MEM_DEFAULT, f->shared->accum.loc, f->shared->accum.size, f->shared->accum.buf) < 0)
- HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "driver read request failed")
-
- /* Copy into buffer */
- HDmemcpy(buf, f->shared->accum.buf, size);
- } /* end if */
- else {
- /* Dispatch to driver */
- if(H5FD_read(f->shared->lf, dxpl_id, type, addr, size, buf) < 0)
- HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "driver read request failed")
- } /* end else */
+ /* Dispatch to driver */
+ if(H5FD_read(f->shared->lf, dxpl_id, type, addr, size, buf) < 0)
+ HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "driver read request failed")
} /* end else */
/* Indicate success */
diff --git a/src/H5Fdeprec.c b/src/H5Fdeprec.c
new file mode 100644
index 0000000..7e1136c
--- /dev/null
+++ b/src/H5Fdeprec.c
@@ -0,0 +1,173 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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: H5Fdeprec.c
+ * October 1 2009
+ * Quincey Koziol <koziol@hdfgroup.org>
+ *
+ * Purpose: Deprecated functions from the H5F interface. These
+ * functions are here for compatibility purposes and may be
+ * removed in the future. Applications should switch to the
+ * newer APIs.
+ *
+ *-------------------------------------------------------------------------
+ */
+
+/****************/
+/* Module Setup */
+/****************/
+
+#define H5F_PACKAGE /*suppress error about including H5Fpkg */
+
+/* Interface initialization */
+#define H5_INTERFACE_INIT_FUNC H5F_init_deprec_interface
+
+
+/***********/
+/* Headers */
+/***********/
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fpkg.h" /* File access */
+#include "H5Iprivate.h" /* IDs */
+#include "H5SMprivate.h" /* Shared object header messages */
+
+
+/****************/
+/* Local Macros */
+/****************/
+
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+
+/********************/
+/* Package Typedefs */
+/********************/
+
+
+/********************/
+/* Local Prototypes */
+/********************/
+
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/*******************/
+/* Local Variables */
+/*******************/
+
+
+
+/*--------------------------------------------------------------------------
+NAME
+ H5F_init_deprec_interface -- Initialize interface-specific information
+USAGE
+ herr_t H5F_init_deprec_interface()
+RETURNS
+ Non-negative on success/Negative on failure
+DESCRIPTION
+ Initializes any interface-specific data or routines. (Just calls
+ H5F_init() currently).
+
+--------------------------------------------------------------------------*/
+static herr_t
+H5F_init_deprec_interface(void)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5F_init_deprec_interface)
+
+ FUNC_LEAVE_NOAPI(H5F_init())
+} /* H5F_init_deprec_interface() */
+
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+
+/*-------------------------------------------------------------------------
+ * Function: H5Fget_info1
+ *
+ * Purpose: Gets general information about the file, including:
+ * 1. Get storage size for superblock extension if there is one.
+ * 2. Get the amount of btree and heap storage for entries
+ * in the SOHM table if there is one.
+ * 3. The amount of free space tracked in the file.
+ *
+ * Return: Success: non-negative on success
+ * Failure: Negative
+ *
+ * Programmer: Vailin Choi
+ * July 11, 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Fget_info1(hid_t obj_id, H5F_info1_t *finfo)
+{
+ H5F_t *f; /* Top file in mount hierarchy */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(H5Fget_info1, FAIL)
+ H5TRACE2("e", "i*x", obj_id, finfo);
+
+ /* Check args */
+ if(!finfo)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct")
+
+ /* For file IDs, get the file object directly */
+ /* (This prevents the H5G_loc() call from returning the file pointer for
+ * the top file in a mount hierarchy)
+ */
+ if(H5I_get_type(obj_id) == H5I_FILE ) {
+ if(NULL == (f = (H5F_t *)H5I_object(obj_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file")
+ } /* end if */
+ else {
+ H5G_loc_t loc; /* Object location */
+
+ /* Get symbol table entry */
+ if(H5G_loc(obj_id, &loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid object ID")
+ f = loc.oloc->file;
+ } /* end else */
+ HDassert(f->shared);
+
+ /* Reset file info struct */
+ HDmemset(finfo, 0, sizeof(*finfo));
+
+ /* Get the size of the superblock extension */
+ if(H5F_super_size(f, H5AC_ind_dxpl_id, NULL, &finfo->super_ext_size) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "Unable to retrieve superblock extension size")
+
+ /* Check for SOHM info */
+ if(H5F_addr_defined(f->shared->sohm_addr))
+ if(H5SM_ih_size(f, H5AC_ind_dxpl_id, &finfo->sohm.hdr_size, &finfo->sohm.msgs_info) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "Unable to retrieve SOHM index & heap storage info")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Fget_info1() */
+
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+
diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h
index 15946d4..e664ca8 100644
--- a/src/H5Fpkg.h
+++ b/src/H5Fpkg.h
@@ -69,7 +69,9 @@
#define H5F_FS_MERGE_RAWDATA 0x02 /* Section can merge with small 'raw' data aggregator */
/* Macro to abstract checking whether file is using a free space manager */
-#define H5F_HAVE_FREE_SPACE_MANAGER(F) TRUE /* Currently always have a free space manager */
+#define H5F_HAVE_FREE_SPACE_MANAGER(F) \
+ ((F)->shared->fs_strategy == H5F_FILE_SPACE_ALL || \
+ (F)->shared->fs_strategy == H5F_FILE_SPACE_ALL_PERSIST)
/* Macros for encoding/decoding superblock */
#define H5F_MAX_DRVINFOBLOCK_SIZE 1024 /* Maximum size of superblock driver info buffer */
@@ -197,8 +199,8 @@ typedef struct H5F_file_t {
H5F_mtab_t mtab; /* File mount table */
/* Cached values from FCPL/superblock */
- size_t sizeof_addr; /* Size of addresses in file */
- size_t sizeof_size; /* Size of offsets in file */
+ uint8_t sizeof_addr; /* Size of addresses in file */
+ uint8_t sizeof_size; /* Size of offsets in file */
haddr_t sohm_addr; /* Relative address of shared object header message table */
unsigned sohm_vers; /* Version of shared message table on disk */
unsigned sohm_nindexes; /* Number of shared messages indexes in the table */
@@ -229,6 +231,8 @@ typedef struct H5F_file_t {
H5RC_t *grp_btree_shared; /* Ref-counted group B-tree node info */
/* File space allocation information */
+ H5F_file_space_type_t fs_strategy; /* File space handling strategy */
+ hsize_t fs_threshold; /* Free space section threshold */
hbool_t use_tmp_space; /* Whether temp. file space allocation is allowed */
haddr_t tmp_addr; /* Next address to use for temp. space in the file */
unsigned fs_aggr_merge[H5FD_MEM_NTYPES]; /* Flags for whether free space can merge with aggregator(s) */
@@ -303,6 +307,7 @@ H5_DLL herr_t H5F_super_size(H5F_t *f, hid_t dxpl_id, hsize_t *super_size, hsize
/* Superblock extension related routines */
H5_DLL herr_t H5F_super_ext_open(H5F_t *f, haddr_t ext_addr, H5O_loc_t *ext_ptr);
H5_DLL herr_t H5F_super_ext_write_msg(H5F_t *f, hid_t dxpl_id, void *mesg, unsigned id, hbool_t may_create);
+H5_DLL herr_t H5F_super_ext_remove_msg(H5F_t *f, hid_t dxpl_id, unsigned id);
H5_DLL herr_t H5F_super_ext_close(H5F_t *f, H5O_loc_t *ext_ptr);
/* Metadata accumulator routines */
diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h
index 1e816f9..6ddbae3 100644
--- a/src/H5Fprivate.h
+++ b/src/H5Fprivate.h
@@ -350,6 +350,8 @@ typedef struct H5F_blk_aggr_t H5F_blk_aggr_t;
#define H5F_CRT_SHMSG_INDEX_MINSIZE_NAME "shmsg_message_minsize" /* Minimum size of messages in each index */
#define H5F_CRT_SHMSG_LIST_MAX_NAME "shmsg_list_max" /* Shared message list maximum size */
#define H5F_CRT_SHMSG_BTREE_MIN_NAME "shmsg_btree_min" /* Shared message B-tree minimum size */
+#define H5F_CRT_FILE_SPACE_STRATEGY_NAME "file_space_strategy" /* File space handling strategy */
+#define H5F_CRT_FREE_SPACE_THRESHOLD_NAME "free_space_threshold" /* Free space section threshold */
@@ -401,6 +403,11 @@ typedef struct H5F_blk_aggr_t H5F_blk_aggr_t;
must compensate. -QAK
*/
+/* Default file space handling strategy */
+#define H5F_FILE_SPACE_STRATEGY_DEF H5F_FILE_SPACE_ALL
+/* Default free space section threshold used by free-space managers */
+#define H5F_FREE_SPACE_THRESHOLD_DEF 1
+
/* Macros to define signatures of all objects in the file */
/* Size of signature information (on disk) */
@@ -475,8 +482,8 @@ H5_DLL haddr_t H5F_get_next_proxy_addr(const H5F_t *f);
/* Functions than retrieve values set/cached from the superblock/FCPL */
H5_DLL hid_t H5F_get_fcpl(const H5F_t *f);
-H5_DLL size_t H5F_sizeof_addr(const H5F_t *f);
-H5_DLL size_t H5F_sizeof_size(const H5F_t *f);
+H5_DLL uint8_t H5F_sizeof_addr(const H5F_t *f);
+H5_DLL uint8_t H5F_sizeof_size(const H5F_t *f);
H5_DLL unsigned H5F_sym_leaf_k(const H5F_t *f);
H5_DLL unsigned H5F_Kvalue(const H5F_t *f, const struct H5B_class_t *type);
H5_DLL size_t H5F_rdcc_nbytes(const H5F_t *f);
diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h
index 6392c9e..0f79660 100644
--- a/src/H5Fpublic.h
+++ b/src/H5Fpublic.h
@@ -118,14 +118,23 @@ typedef enum H5F_close_degree_t {
} H5F_close_degree_t;
/* Current "global" information about file */
-/* (just size info currently) */
-typedef struct H5F_info_t {
- hsize_t super_ext_size; /* Superblock extension size */
+typedef struct H5F_info2_t {
+ struct {
+ unsigned version; /* Superblock version # */
+ hsize_t super_size; /* Superblock size */
+ hsize_t super_ext_size; /* Superblock extension size */
+ } super;
+ struct {
+ unsigned version; /* Version # of file free space management */
+ hsize_t meta_size; /* Free space manager metadata size */
+ hsize_t tot_space; /* Amount of free space in the file */
+ } free;
struct {
+ unsigned version; /* Version # of shared object header info */
hsize_t hdr_size; /* Shared object header message header size */
H5_ih_info_t msgs_info; /* Shared object header message index & heap size */
} sohm;
-} H5F_info_t;
+} H5F_info2_t;
/*
* Types of allocation requests. The values larger than H5FD_MEM_DEFAULT
@@ -145,12 +154,30 @@ typedef enum H5F_mem_t {
H5FD_MEM_NTYPES /*must be last*/
} H5F_mem_t;
+/* Free space section information */
+typedef struct H5F_sect_info_t {
+ haddr_t addr; /* Address of free space section */
+ hsize_t size; /* Size of free space section */
+} H5F_sect_info_t;
+
/* Library's file format versions */
typedef enum H5F_libver_t {
H5F_LIBVER_EARLIEST, /* Use the earliest possible format for storing objects */
H5F_LIBVER_LATEST /* Use the latest possible format available for storing objects*/
} H5F_libver_t;
+/* File space handling strategy */
+typedef enum H5F_file_space_type_t {
+ H5F_FILE_SPACE_DEFAULT = 0, /* Default (or current) free space strategy setting */
+ H5F_FILE_SPACE_ALL_PERSIST = 1, /* Persistent free space managers, aggregators, virtual file driver */
+ H5F_FILE_SPACE_ALL = 2, /* Non-persistent free space managers, aggregators, virtual file driver */
+ /* This is the library default */
+ H5F_FILE_SPACE_AGGR_VFD = 3, /* Aggregators, Virtual file driver */
+ H5F_FILE_SPACE_VFD = 4, /* Virtual file driver */
+ H5F_FILE_SPACE_NTYPES /* must be last */
+} H5F_file_space_type_t;
+
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -186,7 +213,35 @@ H5_DLL herr_t H5Fget_mdc_size(hid_t file_id,
int * cur_num_entries_ptr);
H5_DLL herr_t H5Freset_mdc_hit_rate_stats(hid_t file_id);
H5_DLL ssize_t H5Fget_name(hid_t obj_id, char *name, size_t size);
-H5_DLL herr_t H5Fget_info(hid_t obj_id, H5F_info_t *bh_info);
+H5_DLL herr_t H5Fget_info2(hid_t obj_id, H5F_info2_t *finfo);
+H5_DLL ssize_t H5Fget_free_sections(hid_t file_id, H5F_mem_t type,
+ size_t nsects, H5F_sect_info_t *sect_info/*out*/);
+
+/* Symbols defined for compatibility with previous versions of the HDF5 API.
+ *
+ * Use of these symbols is deprecated.
+ */
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+
+/* Macros */
+
+
+/* Typedefs */
+
+/* Current "global" information about file */
+typedef struct H5F_info1_t {
+ hsize_t super_ext_size; /* Superblock extension size */
+ struct {
+ hsize_t hdr_size; /* Shared object header message header size */
+ H5_ih_info_t msgs_info; /* Shared object header message index & heap size */
+ } sohm;
+} H5F_info1_t;
+
+
+/* Function prototypes */
+H5_DLL herr_t H5Fget_info1(hid_t obj_id, H5F_info1_t *finfo);
+
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
#ifdef __cplusplus
}
diff --git a/src/H5Fquery.c b/src/H5Fquery.c
index 93f2d6e..70c5ff1 100644
--- a/src/H5Fquery.c
+++ b/src/H5Fquery.c
@@ -195,7 +195,7 @@ H5F_get_fcpl(const H5F_t *f)
*
*-------------------------------------------------------------------------
*/
-size_t
+uint8_t
H5F_sizeof_addr(const H5F_t *f)
{
/* Use FUNC_ENTER_NOAPI_NOINIT_NOFUNC here to avoid performance issues */
@@ -222,7 +222,7 @@ H5F_sizeof_addr(const H5F_t *f)
*
*-------------------------------------------------------------------------
*/
-size_t
+uint8_t
H5F_sizeof_size(const H5F_t *f)
{
/* Use FUNC_ENTER_NOAPI_NOINIT_NOFUNC here to avoid performance issues */
diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c
index e85c980..c24cfa1 100644
--- a/src/H5Fsuper.c
+++ b/src/H5Fsuper.c
@@ -400,6 +400,12 @@ H5F_super_init(H5F_t *f, hid_t dxpl_id)
/* Bump superblock version to create superblock extension for SOHM info */
else if(f->shared->sohm_nindexes > 0)
super_vers = HDF5_SUPERBLOCK_VERSION_2;
+ /* Bump superblock version to create superblock extension for
+ * non-default file space strategy or non-default free-space threshold
+ */
+ else if(f->shared->fs_strategy != H5F_FILE_SPACE_STRATEGY_DEF ||
+ f->shared->fs_threshold != H5F_FREE_SPACE_THRESHOLD_DEF)
+ super_vers = HDF5_SUPERBLOCK_VERSION_2;
/* Check for non-default indexed storage B-tree internal 'K' value
* and set the version # of the superblock to 1 if it is a non-default
* value.
@@ -495,6 +501,12 @@ H5F_super_init(H5F_t *f, hid_t dxpl_id)
HDassert(super_vers >= HDF5_SUPERBLOCK_VERSION_2);
need_ext = TRUE;
} /* end if */
+ /* Files with non-default free space settings always need the superblock extension */
+ else if(f->shared->fs_strategy != H5F_FILE_SPACE_STRATEGY_DEF ||
+ f->shared->fs_threshold != H5F_FREE_SPACE_THRESHOLD_DEF) {
+ HDassert(super_vers >= HDF5_SUPERBLOCK_VERSION_2);
+ need_ext = TRUE;
+ } /* end if */
/* If we're going to use a version of the superblock format which allows
* for the superblock extension, check for non-default values to store
* in it.
@@ -571,6 +583,18 @@ H5F_super_init(H5F_t *f, hid_t dxpl_id)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to update driver info header message")
} /* end if */
+ /* Check for non-default free space settings */
+ if(f->shared->fs_strategy != H5F_FILE_SPACE_STRATEGY_DEF ||
+ f->shared->fs_threshold != H5F_FREE_SPACE_THRESHOLD_DEF) {
+ H5O_fsinfo_t fsinfo; /* Free space manager info message */
+
+ /* Write free-space manager info message to superblock extension object header if needed */
+ fsinfo.strategy = f->shared->fs_strategy;
+ fsinfo.threshold = f->shared->fs_threshold;
+ if(H5O_msg_create(&ext_loc, H5O_FSINFO_ID, H5O_MSG_FLAG_DONTSHARE, H5O_UPDATE_TIME, &fsinfo, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to update free-space info header message")
+ } /* end if */
+
/* Close superblock extension */
if(H5F_super_ext_close(f, &ext_loc) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "unable to close file's superblock extension")
@@ -670,8 +694,8 @@ H5F_super_size(H5F_t *f, hid_t dxpl_id, hsize_t *super_size, hsize_t *super_ext_
/* Set the superblock extension size */
if(super_ext_size) {
if(H5F_addr_defined(f->shared->sblock->ext_addr)) {
- H5O_loc_t ext_loc; /* "Object location" for superblock extension */
- H5O_info_t oinfo; /* Object info for superblock extension */
+ H5O_loc_t ext_loc; /* "Object location" for superblock extension */
+ H5O_hdr_info_t hdr_info; /* Object info for superblock extension */
/* Set up "fake" object location for superblock extension */
H5O_loc_reset(&ext_loc);
@@ -679,11 +703,11 @@ H5F_super_size(H5F_t *f, hid_t dxpl_id, hsize_t *super_size, hsize_t *super_ext_
ext_loc.addr = f->shared->sblock->ext_addr;
/* Get object header info for superblock extension */
- if(H5O_get_info(&ext_loc, dxpl_id, FALSE, &oinfo) < 0)
+ if(H5O_get_hdr_info(&ext_loc, dxpl_id, &hdr_info) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to retrieve superblock extension info")
/* Set the superblock extension size */
- *super_ext_size = oinfo.hdr.space.total;
+ *super_ext_size = hdr_info.space.total;
} /* end if */
else
/* Set the superblock extension size to zero */
@@ -769,3 +793,66 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5F_super_ext_write_msg() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5F_super_ext_remove_msg
+ *
+ * Purpose: Remove the message with ID from the superblock extension
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Vailin Choi; Feb 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5F_super_ext_remove_msg(H5F_t *f, hid_t dxpl_id, unsigned id)
+{
+ htri_t status; /* Indicate whether the message exists or not */
+ H5O_loc_t ext_loc; /* "Object location" for superblock extension */
+ int null_count = 0; /* # of null messages */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5F_super_ext_remove_msg, FAIL)
+
+ /* Make sure that the superblock extension object header exists */
+ HDassert(H5F_addr_defined(f->shared->sblock->ext_addr));
+
+ /* Open superblock extension object header */
+ if(H5F_super_ext_open(f, f->shared->sblock->ext_addr, &ext_loc) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "error in starting file's superblock extension")
+
+ /* Check if message with ID exists in the object header */
+ if((status = H5O_msg_exists(&ext_loc, id, dxpl_id)) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to check object header for message")
+ else if(status) { /* message exists */
+ H5O_hdr_info_t hdr_info; /* Object header info for superblock extension */
+
+ /* Remove the message */
+ if(H5O_msg_remove(&ext_loc, id, H5O_ALL, TRUE, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to delete free-space manager info message")
+
+ /* Get info for the superblock extension's object header */
+ if(H5O_get_hdr_info(&ext_loc, dxpl_id, &hdr_info) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to retrieve superblock extension info")
+
+ /* If the object header is an empty base chunk, remove superblock extension */
+ if(hdr_info.nchunks == 1) {
+ if((null_count = H5O_msg_count(&ext_loc, H5O_NULL_ID, dxpl_id)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "unable to count messages")
+ else if((unsigned)null_count == hdr_info.nmesgs) {
+ HDassert(H5F_addr_defined(ext_loc.addr));
+ if(H5O_delete(f, dxpl_id, ext_loc.addr) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "unable to count messages")
+ f->shared->sblock->ext_addr = HADDR_UNDEF;
+ } /* end if */
+ } /* end if */
+ } /* end if */
+
+ /* Close superblock extension object header */
+ if(H5F_super_ext_close(f, &ext_loc) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "unable to close file's superblock extension")
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5F_super_ext_remove_msg() */
+
diff --git a/src/H5Fsuper_cache.c b/src/H5Fsuper_cache.c
index 14454ef..1f2de6d 100644
--- a/src/H5Fsuper_cache.c
+++ b/src/H5Fsuper_cache.c
@@ -121,8 +121,8 @@ H5F_sblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *udata1
H5FD_t *lf; /* file driver part of `shared' */
haddr_t stored_eoa; /*relative end-of-addr in file */
haddr_t eof; /*end of file address */
- size_t sizeof_addr; /* Size of offsets in the file (in bytes) */
- size_t sizeof_size; /* Size of lengths in the file (in bytes) */
+ uint8_t sizeof_addr; /* Size of offsets in the file (in bytes) */
+ uint8_t sizeof_size; /* Size of lengths in the file (in bytes) */
const size_t fixed_size = H5F_SUPERBLOCK_FIXED_SIZE; /*fixed sizeof superblock */
size_t variable_size; /*variable sizeof superblock */
uint8_t *p; /* Temporary pointer into encoding buffer */
@@ -154,7 +154,7 @@ H5F_sblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *udata1
/* Read fixed-size portion of the superblock */
p = sbuf;
- if(H5FD_set_eoa(lf, H5FD_MEM_SUPER, fixed_size) < 0)
+ 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)
HGOTO_ERROR(H5E_FILE, H5E_READERROR, NULL, "unable to read superblock")
@@ -181,7 +181,7 @@ H5F_sblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *udata1
HDassert(fixed_size + variable_size <= sizeof(sbuf));
/* Read in variable-sized portion of superblock */
- if(H5FD_set_eoa(lf, H5FD_MEM_SUPER, fixed_size + variable_size) < 0)
+ if(H5FD_set_eoa(lf, H5FD_MEM_SUPER, (haddr_t)(fixed_size + variable_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)fixed_size, variable_size, p) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to read superblock")
@@ -480,6 +480,7 @@ H5F_sblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *udata1
H5O_loc_t ext_loc; /* "Object location" for superblock extension */
H5O_btreek_t btreek; /* v1 B-tree 'K' value message from superblock extension */
H5O_drvinfo_t drvinfo; /* Driver info message from superblock extension */
+ size_t u; /* Local index variable */
htri_t status; /* Status for message existing */
/* Sanity check - superblock extension should only be defined for
@@ -564,6 +565,41 @@ H5F_sblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *udata1
sblock->sym_leaf_k = H5F_CRT_SYM_LEAF_DEF;
} /* end if */
+ /* Check for the extension having a 'free-space manager info' message */
+ if((status = H5O_msg_exists(&ext_loc, H5O_FSINFO_ID, dxpl_id)) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "unable to check object header")
+ if(status) {
+ H5O_fsinfo_t fsinfo; /* Free-space manager info message from superblock extension */
+
+ /* Retrieve the 'free-space manager info' structure */
+ if(NULL == H5O_msg_read(&ext_loc, H5O_FSINFO_ID, &fsinfo, dxpl_id))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, NULL, "unable to get free-space manager info message")
+
+ if(shared->fs_strategy != fsinfo.strategy) {
+ shared->fs_strategy = fsinfo.strategy;
+
+ /* Set non-default strategy in the property list */
+ if(H5P_set(c_plist, H5F_CRT_FILE_SPACE_STRATEGY_NAME, &fsinfo.strategy) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, NULL, "unable to set file space strategy")
+ } /* end if */
+ if(shared->fs_threshold != fsinfo.threshold) {
+ shared->fs_threshold = fsinfo.threshold;
+
+ /* Set non-default threshold in the property list */
+ if(H5P_set(c_plist, H5F_CRT_FREE_SPACE_THRESHOLD_NAME, &fsinfo.threshold) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, NULL, "unable to set file space strategy")
+ } /* end if */
+
+ /* set free-space manager addresses */
+ shared->fs_addr[0] = HADDR_UNDEF;
+ for(u = 1; u < NELMTS(f->shared->fs_addr); u++)
+ shared->fs_addr[u] = fsinfo.fs_addr[u-1];
+ } /* end if */
+ else {
+ for(u = 0; u < NELMTS(f->shared->fs_addr); u++)
+ shared->fs_addr[u] = HADDR_UNDEF;
+ } /* end else */
+
/* Close superblock extension */
if(H5F_super_ext_close(f, &ext_loc) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, NULL, "unable to close file's superblock extension")
@@ -573,7 +609,6 @@ H5F_sblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *udata1
ret_value = sblock;
done:
-
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5F_sblock_load() */
@@ -714,7 +749,7 @@ H5F_sblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5F_sup
H5F_addr_encode(f, &p, root_oloc->addr);
/* Compute superblock checksum */
- chksum = H5_checksum_metadata(buf, (H5F_SUPERBLOCK_SIZE(sblock->super_vers, f) - H5F_SIZEOF_CHKSUM), 0);
+ chksum = H5_checksum_metadata(buf, (size_t)(H5F_SUPERBLOCK_SIZE(sblock->super_vers, f) - H5F_SIZEOF_CHKSUM), 0);
/* Superblock checksum */
UINT32ENCODE(p, chksum);
diff --git a/src/H5G.c b/src/H5G.c
index 2afd837..204245a 100644
--- a/src/H5G.c
+++ b/src/H5G.c
@@ -432,6 +432,7 @@ H5Gget_create_plist(hid_t group_id)
H5O_linfo_t linfo; /* Link info message */
htri_t ginfo_exists;
htri_t linfo_exists;
+ htri_t pline_exists;
H5G_t *grp = NULL;
H5P_genplist_t *gcpl_plist;
H5P_genplist_t *new_plist;
@@ -481,6 +482,21 @@ H5Gget_create_plist(hid_t group_id)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set link info")
} /* end if */
+ /* Check for the group having a pipeline message */
+ if((pline_exists = H5O_msg_exists(&(grp->oloc), H5O_PLINE_ID, H5AC_ind_dxpl_id)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to read object header")
+ if(pline_exists) {
+ H5O_pline_t pline; /* Pipeline message */
+
+ /* Read the pipeline */
+ if(NULL == H5O_msg_read(&(grp->oloc), H5O_PLINE_ID, &pline, H5AC_ind_dxpl_id))
+ HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get link pipeline")
+
+ /* Set the pipeline for the property list */
+ if(H5P_set(new_plist, H5O_CRT_PIPELINE_NAME, &pline) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set link pipeline")
+ } /* end if */
+
/* Set the return value */
ret_value = new_gcpl_id;
@@ -838,9 +854,6 @@ H5G_t *
H5G_create(H5F_t *file, hid_t gcpl_id, hid_t dxpl_id)
{
H5G_t *grp = NULL; /*new group */
- H5P_genplist_t *gc_plist; /* Property list created */
- H5O_ginfo_t ginfo; /* Group info */
- H5O_linfo_t linfo; /* Link info */
unsigned oloc_init = 0; /* Flag to indicate that the group object location was created successfully */
H5G_t *ret_value; /* Return value */
@@ -857,20 +870,8 @@ H5G_create(H5F_t *file, hid_t gcpl_id, hid_t dxpl_id)
if(NULL == (grp->shared = H5FL_CALLOC(H5G_shared_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- /* Get the property list */
- if(NULL == (gc_plist = (H5P_genplist_t *)H5I_object(gcpl_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a property list")
-
- /* Get the group info property */
- if(H5P_get(gc_plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get group info")
-
- /* Get the link info property */
- if(H5P_get(gc_plist, H5G_CRT_LINK_INFO_NAME, &linfo) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get group info")
-
/* Create the group object header */
- if(H5G_obj_create(file, dxpl_id, &ginfo, &linfo, gcpl_id, &(grp->oloc)/*out*/) < 0)
+ if(H5G_obj_create(file, dxpl_id, gcpl_id, &(grp->oloc)/*out*/) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "unable to create group object header")
oloc_init = 1; /* Indicate that the object location information is valid */
diff --git a/src/H5Gbtree2.c b/src/H5Gbtree2.c
index 5f7ad23..29ab309 100644
--- a/src/H5Gbtree2.c
+++ b/src/H5Gbtree2.c
@@ -104,8 +104,9 @@ static herr_t H5G_dense_fh_name_cmp(const void *obj, size_t obj_len, void *op_da
/* Package Variables */
/*********************/
/* v2 B-tree class for indexing 'name' field of links */
-const H5B2_class_t H5G_BT2_NAME[1]={{ /* B-tree class information */
+const H5B2_class_t H5G_BT2_NAME[1]={{ /* B-tree class information */
H5B2_GRP_DENSE_NAME_ID, /* Type of B-tree */
+ "H5B2_GRP_DENSE_NAME_ID", /* Name of B-tree class */
sizeof(H5G_dense_bt2_name_rec_t), /* Size of native record */
H5G_dense_btree2_name_store, /* Record storage callback */
H5G_dense_btree2_name_compare, /* Record comparison callback */
@@ -117,6 +118,7 @@ const H5B2_class_t H5G_BT2_NAME[1]={{ /* B-tree class information */
/* v2 B-tree class for indexing 'creation order' field of links */
const H5B2_class_t H5G_BT2_CORDER[1]={{ /* B-tree class information */
H5B2_GRP_DENSE_CORDER_ID, /* Type of B-tree */
+ "H5B2_GRP_DENSE_CORDER_ID", /* Name of B-tree class */
sizeof(H5G_dense_bt2_corder_rec_t), /* Size of native record */
H5G_dense_btree2_corder_store, /* Record storage callback */
H5G_dense_btree2_corder_compare, /* Record comparison callback */
diff --git a/src/H5Gdense.c b/src/H5Gdense.c
index 322b31b..f935a74 100644
--- a/src/H5Gdense.c
+++ b/src/H5Gdense.c
@@ -267,12 +267,15 @@ typedef struct {
*-------------------------------------------------------------------------
*/
herr_t
-H5G_dense_create(H5F_t *f, hid_t dxpl_id, H5O_linfo_t *linfo)
+H5G_dense_create(H5F_t *f, hid_t dxpl_id, H5O_linfo_t *linfo,
+ const H5O_pline_t *pline)
{
H5HF_create_t fheap_cparam; /* Fractal heap creation parameters */
- H5HF_t *fheap; /* Fractal heap handle */
+ H5B2_create_t bt2_cparam; /* v2 B-tree creation parameters */
+ H5HF_t *fheap = NULL; /* Fractal heap handle */
+ H5B2_t *bt2_name = NULL; /* v2 B-tree handle for names */
+ H5B2_t *bt2_corder = NULL; /* v2 B-tree handle for creation order */
size_t fheap_id_len; /* Fractal heap ID length */
- size_t bt2_rrec_size; /* v2 B-tree raw record size */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5G_dense_create, FAIL)
@@ -293,6 +296,8 @@ H5G_dense_create(H5F_t *f, hid_t dxpl_id, H5O_linfo_t *linfo)
fheap_cparam.managed.start_root_rows = H5G_FHEAP_MAN_START_ROOT_ROWS;
fheap_cparam.checksum_dblocks = H5G_FHEAP_CHECKSUM_DBLOCKS;
fheap_cparam.max_man_size = H5G_FHEAP_MAX_MAN_SIZE;
+ if(pline)
+ fheap_cparam.pline = *pline;
/* Create fractal heap for storing links */
if(NULL == (fheap = H5HF_create(f, dxpl_id, &fheap_cparam)))
@@ -300,7 +305,7 @@ H5G_dense_create(H5F_t *f, hid_t dxpl_id, H5O_linfo_t *linfo)
/* Retrieve the heap's address in the file */
if(H5HF_get_heap_addr(fheap, &(linfo->fheap_addr)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGETSIZE, FAIL, "can't get fractal heap address")
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get fractal heap address")
#ifdef QAK
HDfprintf(stderr, "%s: linfo->fheap_addr = %a\n", FUNC, linfo->fheap_addr);
#endif /* QAK */
@@ -313,18 +318,20 @@ HDfprintf(stderr, "%s: linfo->fheap_addr = %a\n", FUNC, linfo->fheap_addr);
HDfprintf(stderr, "%s: fheap_id_len = %Zu\n", FUNC, fheap_id_len);
#endif /* QAK */
- /* Close the fractal heap */
- if(H5HF_close(fheap, dxpl_id) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
-
/* Create the name index v2 B-tree */
- bt2_rrec_size = 4 + /* Name's hash value */
+ HDmemset(&bt2_cparam, 0, sizeof(bt2_cparam));
+ bt2_cparam.cls = H5G_BT2_NAME;
+ bt2_cparam.node_size = (size_t)H5G_NAME_BT2_NODE_SIZE;
+ bt2_cparam.rrec_size = 4 + /* Name's hash value */
fheap_id_len; /* Fractal heap ID */
- if(H5B2_create(f, dxpl_id, H5G_BT2_NAME,
- (size_t)H5G_NAME_BT2_NODE_SIZE, bt2_rrec_size,
- H5G_NAME_BT2_SPLIT_PERC, H5G_NAME_BT2_MERGE_PERC,
- &(linfo->name_bt2_addr)) < 0)
+ bt2_cparam.split_percent = H5G_NAME_BT2_SPLIT_PERC;
+ bt2_cparam.merge_percent = H5G_NAME_BT2_MERGE_PERC;
+ if(NULL == (bt2_name = H5B2_create(f, dxpl_id, &bt2_cparam)))
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create v2 B-tree for name index")
+
+ /* Retrieve the v2 B-tree's address in the file */
+ if(H5B2_get_addr(bt2_name, &(linfo->name_bt2_addr)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get v2 B-tree address for name index")
#ifdef QAK
HDfprintf(stderr, "%s: linfo->name_bt2_addr = %a\n", FUNC, linfo->name_bt2_addr);
#endif /* QAK */
@@ -332,19 +339,33 @@ HDfprintf(stderr, "%s: linfo->name_bt2_addr = %a\n", FUNC, linfo->name_bt2_addr)
/* Check if we should create a creation order index v2 B-tree */
if(linfo->index_corder) {
/* Create the creation order index v2 B-tree */
- bt2_rrec_size = 8 + /* Creation order value */
+ HDmemset(&bt2_cparam, 0, sizeof(bt2_cparam));
+ bt2_cparam.cls = H5G_BT2_CORDER;
+ bt2_cparam.node_size = (size_t)H5G_CORDER_BT2_NODE_SIZE;
+ bt2_cparam.rrec_size = 8 + /* Creation order value */
fheap_id_len; /* Fractal heap ID */
- if(H5B2_create(f, dxpl_id, H5G_BT2_CORDER,
- (size_t)H5G_CORDER_BT2_NODE_SIZE, bt2_rrec_size,
- H5G_CORDER_BT2_SPLIT_PERC, H5G_CORDER_BT2_MERGE_PERC,
- &(linfo->corder_bt2_addr)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create v2 B-tree for name index")
+ bt2_cparam.split_percent = H5G_CORDER_BT2_SPLIT_PERC;
+ bt2_cparam.merge_percent = H5G_CORDER_BT2_MERGE_PERC;
+ if(NULL == (bt2_corder = H5B2_create(f, dxpl_id, &bt2_cparam)))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create v2 B-tree for creation order index")
+
+ /* Retrieve the v2 B-tree's address in the file */
+ if(H5B2_get_addr(bt2_corder, &(linfo->corder_bt2_addr)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get v2 B-tree address for creation order index")
#ifdef QAK
HDfprintf(stderr, "%s: linfo->corder_bt2_addr = %a\n", FUNC, linfo->corder_bt2_addr);
#endif /* QAK */
} /* end if */
done:
+ /* Close the open objects */
+ if(fheap && H5HF_close(fheap, dxpl_id) < 0)
+ HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
+ if(bt2_name && H5B2_close(bt2_name, dxpl_id) < 0)
+ HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for name index")
+ if(bt2_corder && H5B2_close(bt2_corder, dxpl_id) < 0)
+ HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for creation order index")
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G_dense_create() */
@@ -368,6 +389,8 @@ H5G_dense_insert(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo,
{
H5G_bt2_ud_ins_t udata; /* User data for v2 B-tree insertion */
H5HF_t *fheap = NULL; /* Fractal heap handle */
+ 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 */
size_t link_size; /* Size of serialized link in the heap */
H5WB_t *wb = NULL; /* Wrapped buffer for link data */
uint8_t link_buf[H5G_LINK_BUF_SIZE]; /* Buffer for serializing link */
@@ -414,6 +437,10 @@ HDfprintf(stderr, "%s: HDstrlen(lnk->name) = %Zu, link_size = %Zu\n", FUNC, HDst
if(H5HF_insert(fheap, dxpl_id, link_size, link_ptr, udata.id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert link into fractal heap")
+ /* Open the name index v2 B-tree */
+ if(NULL == (bt2_name = H5B2_open(f, dxpl_id, linfo->name_bt2_addr)))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index")
+
/* Create the callback information for v2 B-tree record insertion */
udata.common.f = f;
udata.common.dxpl_id = dxpl_id;
@@ -426,14 +453,18 @@ HDfprintf(stderr, "%s: HDstrlen(lnk->name) = %Zu, link_size = %Zu\n", FUNC, HDst
/* udata.id already set in H5HF_insert() call */
/* Insert link into 'name' tracking v2 B-tree */
- if(H5B2_insert(f, dxpl_id, H5G_BT2_NAME, linfo->name_bt2_addr, &udata) < 0)
+ if(H5B2_insert(bt2_name, dxpl_id, &udata) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert record into v2 B-tree")
/* Check if we should create a creation order index v2 B-tree record */
if(linfo->index_corder) {
- /* Insert the record into the creation order index v2 B-tree */
+ /* Open the creation order index v2 B-tree */
HDassert(H5F_addr_defined(linfo->corder_bt2_addr));
- if(H5B2_insert(f, dxpl_id, H5G_BT2_CORDER, linfo->corder_bt2_addr, &udata) < 0)
+ if(NULL == (bt2_corder = H5B2_open(f, dxpl_id, linfo->corder_bt2_addr)))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for creation order index")
+
+ /* Insert the record into the creation order index v2 B-tree */
+ if(H5B2_insert(bt2_corder, dxpl_id, &udata) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert record into v2 B-tree")
} /* end if */
@@ -441,6 +472,10 @@ done:
/* Release resources */
if(fheap && H5HF_close(fheap, dxpl_id) < 0)
HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
+ if(bt2_name && H5B2_close(bt2_name, dxpl_id) < 0)
+ HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for name index")
+ if(bt2_corder && H5B2_close(bt2_corder, dxpl_id) < 0)
+ HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for creation order index")
if(wb && H5WB_unwrap(wb) < 0)
HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close wrapped buffer")
@@ -504,6 +539,7 @@ H5G_dense_lookup(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo,
{
H5G_bt2_ud_common_t udata; /* User data for v2 B-tree link lookup */
H5HF_t *fheap = NULL; /* Fractal heap handle */
+ H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */
htri_t ret_value; /* Return value */
FUNC_ENTER_NOAPI(H5G_dense_lookup, FAIL)
@@ -520,6 +556,10 @@ H5G_dense_lookup(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo,
if(NULL == (fheap = H5HF_open(f, dxpl_id, linfo->fheap_addr)))
HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap")
+ /* Open the name index v2 B-tree */
+ if(NULL == (bt2_name = H5B2_open(f, dxpl_id, linfo->name_bt2_addr)))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index")
+
/* Construct the user data for v2 B-tree callback */
udata.f = f;
udata.dxpl_id = dxpl_id;
@@ -530,13 +570,15 @@ H5G_dense_lookup(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo,
udata.found_op_data = lnk;
/* Find & copy the named link in the 'name' index */
- if((ret_value = H5B2_find(f, dxpl_id, H5G_BT2_NAME, linfo->name_bt2_addr, &udata, NULL, NULL)) < 0)
+ if((ret_value = H5B2_find(bt2_name, dxpl_id, &udata, NULL, NULL)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to locate link in name index")
done:
/* Release resources */
if(fheap && H5HF_close(fheap, dxpl_id) < 0)
HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
+ if(bt2_name && H5B2_close(bt2_name, dxpl_id) < 0)
+ HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for name index")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G_dense_lookup() */
@@ -641,7 +683,7 @@ H5G_dense_lookup_by_idx(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo,
{
H5HF_t *fheap = NULL; /* Fractal heap handle */
H5G_link_table_t ltable = {0, NULL}; /* Table of links */
- const H5B2_class_t *bt2_class = NULL; /* Class of v2 B-tree */
+ H5B2_t *bt2 = NULL; /* v2 B-tree handle for index */
haddr_t bt2_addr; /* Address of v2 B-tree to use for lookup */
herr_t ret_value = SUCCEED; /* Return value */
@@ -671,7 +713,6 @@ H5G_dense_lookup_by_idx(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo,
* Otherwise, build a table.
*/
bt2_addr = linfo->corder_bt2_addr;
- bt2_class = H5G_BT2_CORDER;
} /* end else */
/* If the order is native and there's no B-tree for indexing the links,
@@ -680,7 +721,6 @@ H5G_dense_lookup_by_idx(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo,
*/
if(order == H5_ITER_NATIVE && !H5F_addr_defined(bt2_addr)) {
bt2_addr = linfo->name_bt2_addr;
- bt2_class = H5G_BT2_NAME;
HDassert(H5F_addr_defined(bt2_addr));
} /* end if */
@@ -692,6 +732,10 @@ H5G_dense_lookup_by_idx(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo,
if(NULL == (fheap = H5HF_open(f, dxpl_id, linfo->fheap_addr)))
HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap")
+ /* Open the index v2 B-tree */
+ if(NULL == (bt2 = H5B2_open(f, dxpl_id, bt2_addr)))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for index")
+
/* Construct the user data for v2 B-tree callback */
udata.f = f;
udata.dxpl_id = dxpl_id;
@@ -699,7 +743,7 @@ H5G_dense_lookup_by_idx(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo,
udata.lnk = lnk;
/* Find & copy the link in the appropriate index */
- if(H5B2_index(f, dxpl_id, bt2_class, bt2_addr, order, n, H5G_dense_lookup_by_idx_bt2_cb, &udata) < 0)
+ if(H5B2_index(bt2, dxpl_id, order, n, H5G_dense_lookup_by_idx_bt2_cb, &udata) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to locate link in index")
} /* end if */
else { /* Otherwise, we need to build a table of the links and sort it */
@@ -720,6 +764,8 @@ done:
/* Release resources */
if(fheap && H5HF_close(fheap, dxpl_id) < 0)
HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
+ if(bt2 && H5B2_close(bt2, dxpl_id) < 0)
+ HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for index")
if(ltable.lnks && H5G_link_release_table(&ltable) < 0)
HDONE_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to release link table")
@@ -943,7 +989,7 @@ H5G_dense_iterate(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo,
{
H5HF_t *fheap = NULL; /* Fractal heap handle */
H5G_link_table_t ltable = {0, NULL}; /* Table of links */
- const H5B2_class_t *bt2_class = NULL; /* Class of v2 B-tree */
+ H5B2_t *bt2 = NULL; /* v2 B-tree handle for index */
haddr_t bt2_addr; /* Address of v2 B-tree to use for lookup */
herr_t ret_value; /* Return value */
@@ -973,7 +1019,6 @@ H5G_dense_iterate(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo,
* Otherwise, build a table.
*/
bt2_addr = linfo->corder_bt2_addr;
- bt2_class = H5G_BT2_CORDER;
} /* end else */
/* If the order is native and there's no B-tree for indexing the links,
@@ -983,19 +1028,23 @@ H5G_dense_iterate(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo,
if(order == H5_ITER_NATIVE && !H5F_addr_defined(bt2_addr)) {
HDassert(H5F_addr_defined(linfo->name_bt2_addr));
bt2_addr = linfo->name_bt2_addr;
- bt2_class = H5G_BT2_NAME;
} /* end if */
/* Check on iteration order */
if(order == H5_ITER_NATIVE) {
H5G_bt2_ud_it_t udata; /* User data for iterator callback */
+ /* Sanity check */
HDassert(H5F_addr_defined(bt2_addr));
/* Open the fractal heap */
if(NULL == (fheap = H5HF_open(f, dxpl_id, linfo->fheap_addr)))
HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap")
+ /* Open the index v2 B-tree */
+ if(NULL == (bt2 = H5B2_open(f, dxpl_id, bt2_addr)))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for index")
+
/* Construct the user data for v2 B-tree iterator callback */
udata.f = f;
udata.dxpl_id = dxpl_id;
@@ -1007,7 +1056,7 @@ H5G_dense_iterate(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo,
/* Iterate over the records in the v2 B-tree's "native" order */
/* (by hash of name) */
- if((ret_value = H5B2_iterate(f, dxpl_id, bt2_class, bt2_addr, H5G_dense_iterate_bt2_cb, &udata)) < 0)
+ if((ret_value = H5B2_iterate(bt2, dxpl_id, H5G_dense_iterate_bt2_cb, &udata)) < 0)
HERROR(H5E_SYM, H5E_BADITER, "link iteration failed");
/* Update the last link examined, if requested */
@@ -1028,6 +1077,8 @@ done:
/* Release resources */
if(fheap && H5HF_close(fheap, dxpl_id) < 0)
HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
+ if(bt2 && H5B2_close(bt2, dxpl_id) < 0)
+ HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for index")
if(ltable.lnks && H5G_link_release_table(&ltable) < 0)
HDONE_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to release link table")
@@ -1142,10 +1193,10 @@ H5G_dense_get_name_by_idx(H5F_t *f, hid_t dxpl_id, H5O_linfo_t *linfo,
H5_index_t idx_type, H5_iter_order_t order, hsize_t n, char *name,
size_t size)
{
- H5HF_t *fheap = NULL; /* Fractal heap handle */
+ H5HF_t *fheap = NULL; /* Fractal heap handle */
H5G_link_table_t ltable = {0, NULL}; /* Table of links */
- const H5B2_class_t *bt2_class = NULL; /* Class of v2 B-tree */
- haddr_t bt2_addr; /* Address of v2 B-tree to use for lookup */
+ H5B2_t *bt2 = NULL; /* v2 B-tree handle for index */
+ haddr_t bt2_addr; /* Address of v2 B-tree to use for lookup */
ssize_t ret_value; /* Return value */
FUNC_ENTER_NOAPI(H5G_dense_get_name_by_idx, FAIL)
@@ -1173,7 +1224,6 @@ H5G_dense_get_name_by_idx(H5F_t *f, hid_t dxpl_id, H5O_linfo_t *linfo,
* Otherwise, build a table.
*/
bt2_addr = linfo->corder_bt2_addr;
- bt2_class = H5G_BT2_CORDER;
} /* end else */
/* If the order is native and there's no B-tree for indexing the links,
@@ -1182,7 +1232,6 @@ H5G_dense_get_name_by_idx(H5F_t *f, hid_t dxpl_id, H5O_linfo_t *linfo,
*/
if(order == H5_ITER_NATIVE && !H5F_addr_defined(bt2_addr)) {
bt2_addr = linfo->name_bt2_addr;
- bt2_class = H5G_BT2_NAME;
HDassert(H5F_addr_defined(bt2_addr));
} /* end if */
@@ -1194,6 +1243,10 @@ H5G_dense_get_name_by_idx(H5F_t *f, hid_t dxpl_id, H5O_linfo_t *linfo,
if(NULL == (fheap = H5HF_open(f, dxpl_id, linfo->fheap_addr)))
HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap")
+ /* Open the index v2 B-tree */
+ if(NULL == (bt2 = H5B2_open(f, dxpl_id, bt2_addr)))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for index")
+
/* Set up the user data for the v2 B-tree 'record remove' callback */
udata.f = f;
udata.dxpl_id = dxpl_id;
@@ -1202,7 +1255,7 @@ H5G_dense_get_name_by_idx(H5F_t *f, hid_t dxpl_id, H5O_linfo_t *linfo,
udata.name_size = size;
/* Retrieve the name according to the v2 B-tree's index order */
- if(H5B2_index(f, dxpl_id, bt2_class, bt2_addr, order, n, H5G_dense_get_name_by_idx_bt2_cb, &udata) < 0)
+ if(H5B2_index(bt2, dxpl_id, order, n, H5G_dense_get_name_by_idx_bt2_cb, &udata) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTLIST, FAIL, "can't locate object in v2 B-tree")
/* Set return value */
@@ -1232,6 +1285,8 @@ done:
/* Release resources */
if(fheap && H5HF_close(fheap, dxpl_id) < 0)
HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
+ if(bt2 && H5B2_close(bt2, dxpl_id) < 0)
+ HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for index")
if(ltable.lnks && H5G_link_release_table(&ltable) < 0)
HDONE_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to release link table")
@@ -1257,6 +1312,7 @@ H5G_dense_remove_fh_cb(const void *obj, size_t UNUSED obj_len, void *_udata)
{
H5G_fh_ud_rm_t *udata = (H5G_fh_ud_rm_t *)_udata; /* User data for fractal heap 'op' callback */
H5O_link_t *lnk = NULL; /* Pointer to link created from heap object */
+ H5B2_t *bt2 = NULL; /* v2 B-tree handle for index */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5G_dense_remove_fh_cb)
@@ -1269,13 +1325,16 @@ H5G_dense_remove_fh_cb(const void *obj, size_t UNUSED obj_len, void *_udata)
if(H5F_addr_defined(udata->corder_bt2_addr)) {
H5G_bt2_ud_common_t bt2_udata; /* Info for B-tree callbacks */
+ /* Open the creation order index v2 B-tree */
+ if(NULL == (bt2 = H5B2_open(udata->f, udata->dxpl_id, udata->corder_bt2_addr)))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for creation order index")
+
/* Set up the user data for the v2 B-tree 'record remove' callback */
HDassert(lnk->corder_valid);
bt2_udata.corder = lnk->corder;
/* Remove the record from the name index v2 B-tree */
- if(H5B2_remove(udata->f, udata->dxpl_id, H5G_BT2_CORDER, udata->corder_bt2_addr,
- &bt2_udata, NULL, NULL) < 0)
+ if(H5B2_remove(bt2, udata->dxpl_id, &bt2_udata, NULL, NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTREMOVE, FAIL, "unable to remove link from creation order index v2 B-tree")
} /* end if */
@@ -1290,7 +1349,9 @@ H5G_dense_remove_fh_cb(const void *obj, size_t UNUSED obj_len, void *_udata)
HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete link")
done:
- /* Release the space allocated for the link */
+ /* Release resources */
+ if(bt2 && H5B2_close(bt2, udata->dxpl_id) < 0)
+ HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for creation order index")
if(lnk)
H5O_msg_free(H5O_LINK_ID, lnk);
@@ -1361,7 +1422,8 @@ H5G_dense_remove(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo,
H5RS_str_t *grp_full_path_r, const char *name)
{
H5HF_t *fheap = NULL; /* Fractal heap handle */
- H5G_bt2_ud_rm_t udata; /* User data for v2 B-tree record removal */
+ H5G_bt2_ud_rm_t udata; /* User data for v2 B-tree record removal */
+ H5B2_t *bt2 = NULL; /* v2 B-tree handle for index */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5G_dense_remove, FAIL)
@@ -1377,6 +1439,10 @@ H5G_dense_remove(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo,
if(NULL == (fheap = H5HF_open(f, dxpl_id, linfo->fheap_addr)))
HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap")
+ /* Open the name index v2 B-tree */
+ if(NULL == (bt2 = H5B2_open(f, dxpl_id, linfo->name_bt2_addr)))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index")
+
/* Set up the user data for the v2 B-tree 'record remove' callback */
udata.common.f = f;
udata.common.dxpl_id = dxpl_id;
@@ -1391,13 +1457,15 @@ H5G_dense_remove(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo,
udata.replace_names = TRUE;
/* Remove the record from the name index v2 B-tree */
- if(H5B2_remove(f, dxpl_id, H5G_BT2_NAME, linfo->name_bt2_addr, &udata, H5G_dense_remove_bt2_cb, &udata) < 0)
+ if(H5B2_remove(bt2, dxpl_id, &udata, H5G_dense_remove_bt2_cb, &udata) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTREMOVE, FAIL, "unable to remove link from name index v2 B-tree")
done:
/* Release resources */
if(fheap && H5HF_close(fheap, dxpl_id) < 0)
HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
+ if(bt2 && H5B2_close(bt2, dxpl_id) < 0)
+ HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for name index")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G_dense_remove() */
@@ -1453,6 +1521,7 @@ H5G_dense_remove_by_idx_bt2_cb(const void *_record, void *_bt2_udata)
{
H5G_bt2_ud_rmbi_t *bt2_udata = (H5G_bt2_ud_rmbi_t *)_bt2_udata; /* User data for callback */
H5G_fh_ud_rmbi_t fh_udata; /* User data for fractal heap 'op' callback */
+ H5B2_t *bt2 = NULL; /* v2 B-tree handle for index */
const uint8_t *heap_id; /* Heap ID for link */
herr_t ret_value = SUCCEED; /* Return value */
@@ -1488,22 +1557,15 @@ H5G_dense_remove_by_idx_bt2_cb(const void *_record, void *_bt2_udata)
/* Check for removing the link from the "other" index (creation order, when name used and vice versa) */
if(H5F_addr_defined(bt2_udata->other_bt2_addr)) {
H5G_bt2_ud_common_t other_bt2_udata; /* Info for B-tree callbacks */
- const H5B2_class_t *other_bt2_class; /* Class of "other" v2 B-tree */
/* Determine the index being used */
if(bt2_udata->idx_type == H5_INDEX_NAME) {
- /* Set the class of the "other" index */
- other_bt2_class = H5G_BT2_CORDER;
-
/* Set up the user data for the v2 B-tree 'record remove' callback */
other_bt2_udata.corder = fh_udata.lnk->corder;
} /* end if */
else {
HDassert(bt2_udata->idx_type == H5_INDEX_CRT_ORDER);
- /* Set the class of the "other" index */
- other_bt2_class = H5G_BT2_NAME;
-
/* Set up the user data for the v2 B-tree 'record remove' callback */
other_bt2_udata.f = bt2_udata->f;
other_bt2_udata.dxpl_id = bt2_udata->dxpl_id;
@@ -1514,12 +1576,15 @@ H5G_dense_remove_by_idx_bt2_cb(const void *_record, void *_bt2_udata)
other_bt2_udata.found_op_data = NULL;
} /* end else */
+ /* Open the index v2 B-tree */
+ if(NULL == (bt2 = H5B2_open(bt2_udata->f, bt2_udata->dxpl_id, bt2_udata->other_bt2_addr)))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for 'other' index")
+
/* Set the common information for the v2 B-tree remove operation */
/* Remove the record from the name index v2 B-tree */
- if(H5B2_remove(bt2_udata->f, bt2_udata->dxpl_id, other_bt2_class, bt2_udata->other_bt2_addr,
- &other_bt2_udata, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTREMOVE, H5_ITER_ERROR, "unable to remove link from creation order index v2 B-tree")
+ if(H5B2_remove(bt2, bt2_udata->dxpl_id, &other_bt2_udata, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTREMOVE, H5_ITER_ERROR, "unable to remove link from 'other' index v2 B-tree")
} /* end if */
/* Replace open objects' names */
@@ -1539,6 +1604,10 @@ H5G_dense_remove_by_idx_bt2_cb(const void *_record, void *_bt2_udata)
HGOTO_ERROR(H5E_SYM, H5E_CANTREMOVE, FAIL, "unable to remove link from fractal heap")
done:
+ /* Release resources */
+ if(bt2 && H5B2_close(bt2, bt2_udata->dxpl_id) < 0)
+ HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for 'other' index")
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G_dense_remove_by_idx_bt2_cb() */
@@ -1564,7 +1633,7 @@ H5G_dense_remove_by_idx(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo,
{
H5HF_t *fheap = NULL; /* Fractal heap handle */
H5G_link_table_t ltable = {0, NULL}; /* Table of links */
- const H5B2_class_t *bt2_class = NULL; /* Class of v2 B-tree */
+ H5B2_t *bt2 = NULL; /* v2 B-tree handle for index */
haddr_t bt2_addr; /* Address of v2 B-tree to use for lookup */
herr_t ret_value = SUCCEED; /* Return value */
@@ -1593,7 +1662,6 @@ H5G_dense_remove_by_idx(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo,
* Otherwise, build a table.
*/
bt2_addr = linfo->corder_bt2_addr;
- bt2_class = H5G_BT2_CORDER;
} /* end else */
/* If the order is native and there's no B-tree for indexing the links,
@@ -1602,7 +1670,6 @@ H5G_dense_remove_by_idx(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo,
*/
if(order == H5_ITER_NATIVE && !H5F_addr_defined(bt2_addr)) {
bt2_addr = linfo->name_bt2_addr;
- bt2_class = H5G_BT2_NAME;
HDassert(H5F_addr_defined(bt2_addr));
} /* end if */
@@ -1614,6 +1681,10 @@ H5G_dense_remove_by_idx(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo,
if(NULL == (fheap = H5HF_open(f, dxpl_id, linfo->fheap_addr)))
HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap")
+ /* Open the index v2 B-tree */
+ if(NULL == (bt2 = H5B2_open(f, dxpl_id, bt2_addr)))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for index")
+
/* Set up the user data for the v2 B-tree 'remove by index' callback */
udata.f = f;
udata.dxpl_id = dxpl_id;
@@ -1623,8 +1694,7 @@ H5G_dense_remove_by_idx(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo,
udata.grp_full_path_r = grp_full_path_r;
/* Remove the record from the name index v2 B-tree */
- if(H5B2_remove_by_idx(f, dxpl_id, bt2_class, bt2_addr,
- order, n, H5G_dense_remove_by_idx_bt2_cb, &udata) < 0)
+ if(H5B2_remove_by_idx(bt2, dxpl_id, order, n, H5G_dense_remove_by_idx_bt2_cb, &udata) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTREMOVE, FAIL, "unable to remove link from indexed v2 B-tree")
} /* end if */
else { /* Otherwise, we need to build a table of the links and sort it */
@@ -1645,6 +1715,8 @@ done:
/* Release resources */
if(fheap && H5HF_close(fheap, dxpl_id) < 0)
HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
+ if(bt2 && H5B2_close(bt2, dxpl_id) < 0)
+ HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for index")
if(ltable.lnks && H5G_link_release_table(&ltable) < 0)
HDONE_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to release link table")
@@ -1704,7 +1776,7 @@ H5G_dense_delete(H5F_t *f, hid_t dxpl_id, H5O_linfo_t *linfo, hbool_t adj_link)
udata.replace_names = FALSE;
/* Delete the name index, adjusting the ref. count on links removed */
- if(H5B2_delete(f, dxpl_id, H5G_BT2_NAME, linfo->name_bt2_addr, H5G_dense_remove_bt2_cb, &udata) < 0)
+ if(H5B2_delete(f, dxpl_id, linfo->name_bt2_addr, H5G_dense_remove_bt2_cb, &udata) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete v2 B-tree for name index")
/* Close the fractal heap */
@@ -1713,7 +1785,7 @@ H5G_dense_delete(H5F_t *f, hid_t dxpl_id, H5O_linfo_t *linfo, hbool_t adj_link)
} /* end if */
else {
/* Delete the name index, without adjusting the ref. count on the links */
- if(H5B2_delete(f, dxpl_id, H5G_BT2_NAME, linfo->name_bt2_addr, NULL, NULL) < 0)
+ if(H5B2_delete(f, dxpl_id, linfo->name_bt2_addr, NULL, NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete v2 B-tree for name index")
} /* end else */
linfo->name_bt2_addr = HADDR_UNDEF;
@@ -1722,7 +1794,7 @@ H5G_dense_delete(H5F_t *f, hid_t dxpl_id, H5O_linfo_t *linfo, hbool_t adj_link)
if(linfo->index_corder) {
/* Delete the creation order index, without adjusting the ref. count on the links */
HDassert(H5F_addr_defined(linfo->corder_bt2_addr));
- if(H5B2_delete(f, dxpl_id, H5G_BT2_CORDER, linfo->corder_bt2_addr, NULL, NULL) < 0)
+ if(H5B2_delete(f, dxpl_id, linfo->corder_bt2_addr, NULL, NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete v2 B-tree for creation order index")
linfo->corder_bt2_addr = HADDR_UNDEF;
} /* end if */
diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c
index ddb5dfe..a18339b 100644
--- a/src/H5Gdeprec.c
+++ b/src/H5Gdeprec.c
@@ -890,7 +890,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5G_get_objinfo_cb(H5G_loc_t *grp_loc/*in*/, const char UNUSED *name, const H5O_link_t *lnk,
+H5G_get_objinfo_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk,
H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/)
{
H5G_trav_goi_t *udata = (H5G_trav_goi_t *)_udata; /* User data passed in */
@@ -900,7 +900,7 @@ H5G_get_objinfo_cb(H5G_loc_t *grp_loc/*in*/, const char UNUSED *name, const H5O_
/* Check if the name in this group resolved to a valid link */
if(lnk == NULL && obj_loc == NULL)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "name doesn't exist")
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "'%s' doesn't exist", name)
/* Only modify user's buffer if it's available */
if(udata->statbuf) {
diff --git a/src/H5Glink.c b/src/H5Glink.c
index 37a0ede..488c05b 100644
--- a/src/H5Glink.c
+++ b/src/H5Glink.c
@@ -609,7 +609,7 @@ H5G_link_iterate_table(const H5G_link_table_t *ltable, hsize_t skip,
size_t u; /* Local index variable */
herr_t ret_value = H5_ITER_CONT; /* Return value */
- FUNC_ENTER_NOAPI(H5G_link_iterate_table, FAIL)
+ FUNC_ENTER_NOAPI_NOERR(H5G_link_iterate_table, -)
/* Sanity check */
HDassert(ltable);
diff --git a/src/H5Gobj.c b/src/H5Gobj.c
index a11dc13..4281ac0 100644
--- a/src/H5Gobj.c
+++ b/src/H5Gobj.c
@@ -125,20 +125,78 @@ static herr_t H5G_obj_remove_update_linfo(H5O_loc_t *oloc, H5O_linfo_t *linfo,
*-------------------------------------------------------------------------
*/
herr_t
-H5G_obj_create(H5F_t *f, hid_t dxpl_id, const H5O_ginfo_t *ginfo,
- const H5O_linfo_t *linfo, hid_t gcpl_id, H5O_loc_t *oloc/*out*/)
+H5G_obj_create(H5F_t *f, hid_t dxpl_id, hid_t gcpl_id, H5O_loc_t *oloc/*out*/)
+{
+ H5P_genplist_t *gc_plist; /* Group creation property list */
+ H5O_ginfo_t ginfo; /* Group info */
+ H5O_linfo_t linfo; /* Link info */
+ H5O_pline_t pline; /* Pipeline */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5G_obj_create, FAIL)
+
+ /*
+ * Check arguments.
+ */
+ HDassert(f);
+ HDassert(oloc);
+
+ /* Get the property list */
+ if(NULL == (gc_plist = (H5P_genplist_t *)H5I_object(gcpl_id)))
+ HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a property list")
+
+ /* Get the group info property */
+ if(H5P_get(gc_plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get group info")
+
+ /* Get the link info property */
+ if(H5P_get(gc_plist, H5G_CRT_LINK_INFO_NAME, &linfo) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get group info")
+
+ /* Get the pipeline property */
+ if(H5P_get(gc_plist, H5O_CRT_PIPELINE_NAME, &pline) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get group info")
+
+ /* Call the "real" group creation routine now */
+ if(H5G_obj_create_real(f, dxpl_id, &ginfo, &linfo, &pline, gcpl_id, oloc) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTCREATE, FAIL, "unable to create group")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5G_obj_create() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5G_obj_create_real
+ *
+ * Purpose: Create an object header for a group and update object location info
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@ncsa.uiuc.edu
+ * Sep 29 2005
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5G_obj_create_real(H5F_t *f, hid_t dxpl_id, const H5O_ginfo_t *ginfo,
+ const H5O_linfo_t *linfo, const H5O_pline_t *pline, hid_t gcpl_id,
+ H5O_loc_t *oloc/*out*/)
{
size_t hdr_size; /* Size of object header to request */
hbool_t use_latest_format; /* Flag indicating the new group format should be used */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5G_obj_create, FAIL)
+ FUNC_ENTER_NOAPI(H5G_obj_create_real, FAIL)
/*
* Check arguments.
*/
HDassert(f);
HDassert(ginfo);
+ HDassert(linfo);
+ HDassert(pline);
HDassert(oloc);
/* Check for invalid access request */
@@ -147,7 +205,8 @@ H5G_obj_create(H5F_t *f, hid_t dxpl_id, const H5O_ginfo_t *ginfo,
/* Check for using the latest version of the group format */
/* (add more checks for creating "new format" groups when needed) */
- if(H5F_USE_LATEST_FORMAT(f) || linfo->track_corder)
+ if(H5F_USE_LATEST_FORMAT(f) || linfo->track_corder
+ || (pline && pline->nused))
use_latest_format = TRUE;
else
use_latest_format = FALSE;
@@ -164,6 +223,7 @@ H5G_obj_create(H5F_t *f, hid_t dxpl_id, const H5O_ginfo_t *ginfo,
char null_char = '\0'; /* Character for creating null string */
size_t ginfo_size; /* Size of the group info message */
size_t linfo_size; /* Size of the link info message */
+ size_t pline_size = 0; /* Size of the pipeline message */
size_t link_size; /* Size of a link message */
/* Calculate message size infomation, for creating group's object header */
@@ -173,6 +233,11 @@ H5G_obj_create(H5F_t *f, hid_t dxpl_id, const H5O_ginfo_t *ginfo,
ginfo_size = H5O_msg_size_f(f, gcpl_id, H5O_GINFO_ID, ginfo, (size_t)0);
HDassert(ginfo_size);
+ if(pline && pline->nused) {
+ pline_size = H5O_msg_size_f(f, gcpl_id, H5O_PLINE_ID, pline, (size_t)0);
+ HDassert(pline_size);
+ } /* end if */
+
lnk.type = H5L_TYPE_HARD;
lnk.corder = 0;
lnk.corder_valid = linfo->track_corder;
@@ -184,10 +249,11 @@ H5G_obj_create(H5F_t *f, hid_t dxpl_id, const H5O_ginfo_t *ginfo,
/* Compute size of header to use for creation */
hdr_size = linfo_size +
ginfo_size +
+ pline_size +
(ginfo->est_num_entries * link_size);
} /* end if */
else
- hdr_size = 4 + 2 * H5F_SIZEOF_ADDR(f);
+ hdr_size = (size_t)(4 + 2 * H5F_SIZEOF_ADDR(f));
/*
* Create group's object header. It has a zero link count
@@ -200,12 +266,17 @@ H5G_obj_create(H5F_t *f, hid_t dxpl_id, const H5O_ginfo_t *ginfo,
/* Check for format of group to create */
if(use_latest_format) {
/* Insert link info message */
- if(H5O_msg_create(oloc, H5O_LINFO_ID, 0, 0, linfo, dxpl_id) < 0)
+ if(H5O_msg_create(oloc, H5O_LINFO_ID, 0, H5O_UPDATE_TIME, linfo, dxpl_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create message")
/* Insert group info message */
- if(H5O_msg_create(oloc, H5O_GINFO_ID, H5O_MSG_FLAG_CONSTANT, H5O_UPDATE_TIME, ginfo, dxpl_id) < 0)
+ if(H5O_msg_create(oloc, H5O_GINFO_ID, H5O_MSG_FLAG_CONSTANT, 0, ginfo, dxpl_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create message")
+
+ /* Insert pipeline message */
+ if(pline && pline->nused)
+ if(H5O_msg_create(oloc, H5O_PLINE_ID, H5O_MSG_FLAG_CONSTANT, 0, pline, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create message")
} /* end if */
else {
H5O_stab_t stab; /* Symbol table message */
@@ -217,7 +288,7 @@ H5G_obj_create(H5F_t *f, hid_t dxpl_id, const H5O_ginfo_t *ginfo,
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5G_obj_create() */
+} /* end H5G_obj_create_real() */
/*-------------------------------------------------------------------------
@@ -238,6 +309,7 @@ done:
htri_t
H5G_obj_get_linfo(const H5O_loc_t *grp_oloc, H5O_linfo_t *linfo, hid_t dxpl_id)
{
+ H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */
htri_t ret_value; /* Return value */
FUNC_ENTER_NOAPI(H5G_obj_get_linfo, FAIL)
@@ -258,9 +330,13 @@ H5G_obj_get_linfo(const H5O_loc_t *grp_oloc, H5O_linfo_t *linfo, hid_t dxpl_id)
if(linfo->nlinks == HSIZET_MAX) {
/* Check if we are using "dense" link storage */
if(H5F_addr_defined(linfo->fheap_addr)) {
+ /* Open the name index v2 B-tree */
+ if(NULL == (bt2_name = H5B2_open(grp_oloc->file, dxpl_id, linfo->name_bt2_addr)))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index")
+
/* Retrieve # of records in "name" B-tree */
/* (should be same # of records in all indices) */
- if(H5B2_get_nrec(grp_oloc->file, dxpl_id, H5G_BT2_NAME, linfo->name_bt2_addr, &linfo->nlinks) < 0)
+ if(H5B2_get_nrec(bt2_name, &linfo->nlinks) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve # of records in index")
} /* end if */
else {
@@ -272,6 +348,10 @@ H5G_obj_get_linfo(const H5O_loc_t *grp_oloc, H5O_linfo_t *linfo, hid_t dxpl_id)
} /* end if */
done:
+ /* Release resources */
+ if(bt2_name && H5B2_close(bt2_name, dxpl_id) < 0)
+ HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for name index")
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G_obj_get_linfo() */
@@ -369,6 +449,8 @@ herr_t
H5G_obj_insert(const H5O_loc_t *grp_oloc, const char *name, H5O_link_t *obj_lnk,
hbool_t adj_link, hid_t dxpl_id)
{
+ H5O_pline_t tmp_pline; /* Pipeline message */
+ H5O_pline_t *pline = NULL; /* Pointer to pipeline message */
H5O_linfo_t linfo; /* Link info message */
htri_t linfo_exists; /* Whether the link info message exists */
hbool_t use_old_format; /* Whether to use 'old format' (symbol table) for insertions or not */
@@ -420,11 +502,21 @@ H5G_obj_insert(const H5O_loc_t *grp_oloc, const char *name, H5O_link_t *obj_lnk,
else if(linfo.nlinks < ginfo.max_compact && link_msg_size < H5O_MESG_MAX_SIZE)
use_new_dense = FALSE;
else {
+ htri_t pline_exists; /* Whether the pipeline message exists */
H5G_obj_oh_it_ud1_t udata; /* User data for iteration */
H5O_mesg_operator_t op; /* Message operator */
+ /* Get the pipeline message, if it exists */
+ if((pline_exists = H5O_msg_exists(grp_oloc, H5O_PLINE_ID, dxpl_id)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to read object header")
+ if(pline_exists) {
+ if(NULL == H5O_msg_read(grp_oloc, H5O_PLINE_ID, &tmp_pline, dxpl_id))
+ HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get link pipeline")
+ pline = &tmp_pline;
+ } /* end if */
+
/* The group doesn't currently have "dense" storage for links */
- if(H5G_dense_create(grp_oloc->file, dxpl_id, &linfo) < 0)
+ if(H5G_dense_create(grp_oloc->file, dxpl_id, &linfo, pline) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create 'dense' form of new format group")
/* Set up user data for object header message iteration */
@@ -529,6 +621,10 @@ H5G_obj_insert(const H5O_loc_t *grp_oloc, const char *name, H5O_link_t *obj_lnk,
} /* end if */
done:
+ /* Free any space used by the pipeline message */
+ if(pline && H5O_msg_reset(H5O_PLINE_ID, pline) < 0)
+ HDONE_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "can't release pipeline")
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G_obj_insert() */
diff --git a/src/H5Goh.c b/src/H5Goh.c
index d727cb7..2494838 100644
--- a/src/H5Goh.c
+++ b/src/H5Goh.c
@@ -45,12 +45,16 @@
/* Local Prototypes */
/********************/
+static void *H5O_group_get_copy_file_udata(void);
+static void H5O_group_free_copy_file_udata(void *udata);
static htri_t H5O_group_isa(H5O_t *loc);
static hid_t H5O_group_open(const H5G_loc_t *obj_loc, hid_t lapl_id,
hid_t dxpl_id, hbool_t app_ref);
static void *H5O_group_create(H5F_t *f, void *_crt_info, H5G_loc_t *obj_loc,
hid_t dxpl_id);
static H5O_loc_t *H5O_group_get_oloc(hid_t obj_id);
+static herr_t H5O_group_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh,
+ H5_ih_info_t *bh_info);
/*********************/
@@ -71,14 +75,84 @@ static H5O_loc_t *H5O_group_get_oloc(hid_t obj_id);
const H5O_obj_class_t H5O_OBJ_GROUP[1] = {{
H5O_TYPE_GROUP, /* object type */
"group", /* object name, for debugging */
- NULL, /* get 'copy file' user data */
- NULL, /* free 'copy file' user data */
+ H5O_group_get_copy_file_udata, /* get 'copy file' user data */
+ H5O_group_free_copy_file_udata, /* free 'copy file' user data */
H5O_group_isa, /* "isa" message */
H5O_group_open, /* open an object of this class */
H5O_group_create, /* create an object of this class */
- H5O_group_get_oloc /* get an object header location for an object */
+ H5O_group_get_oloc, /* get an object header location for an object */
+ H5O_group_bh_info /* get the index & heap info for an object */
}};
+/* Declare the external free list to manage the H5O_ginfo_t struct */
+H5FL_DEFINE(H5G_copy_file_ud_t);
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_group_get_copy_file_udata
+ *
+ * Purpose: Allocates the user data needed for copying a group's
+ * object header from file to file.
+ *
+ * Return: Success: Non-NULL pointer to user data
+ *
+ * Failure: NULL
+ *
+ * Programmer: Neil Fortner
+ * Thursday, July 30, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5O_group_get_copy_file_udata(void)
+{
+ void *ret_value; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5O_group_get_copy_file_udata)
+
+ /* Allocate space for the 'copy file' user data for copying groups.
+ * Currently this is only a ginfo, so there is no specific struct type for
+ * this operation. */
+ if(NULL == (ret_value = H5FL_CALLOC(H5G_copy_file_ud_t)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_group_get_copy_file_udata() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_group_free_copy_file_udata
+ *
+ * Purpose: Release the user data needed for copying a group's
+ * object header from file to file.
+ *
+ * Return: <none>
+ *
+ * Programmer: Neil Fortner
+ * Thursday, July 30, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+H5O_group_free_copy_file_udata(void *_udata)
+{
+ H5G_copy_file_ud_t *udata = (H5G_copy_file_ud_t *)_udata;
+
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_group_free_copy_file_udata)
+
+ /* Sanity check */
+ HDassert(udata);
+
+ /* Free the ginfo struct (including nested data structs) */
+ H5O_msg_free(H5O_PLINE_ID, udata->common.src_pline);
+
+ /* Release space for 'copy file' user data (ginfo struct) */
+ (void)H5FL_FREE(H5G_copy_file_ud_t, udata);
+
+ FUNC_LEAVE_NOAPI_VOID
+} /* end H5O_group_free_copy_file_udata() */
+
/*-------------------------------------------------------------------------
* Function: H5O_group_isa
@@ -257,14 +331,16 @@ done:
*
*-------------------------------------------------------------------------
*/
-herr_t
+static herr_t
H5O_group_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info)
{
htri_t exists; /* Flag if header message of interest exists */
H5HF_t *fheap = NULL; /* Fractal heap handle */
+ 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 */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5O_group_bh_info, FAIL)
+ FUNC_ENTER_NOAPI_NOINIT(H5O_group_bh_info)
/* Sanity check */
HDassert(f);
@@ -281,30 +357,37 @@ H5O_group_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info)
if(NULL == H5O_msg_read_oh(f, dxpl_id, oh, H5O_LINFO_ID, &linfo))
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't read LINFO message")
- /* Get creation order B-tree size, if available */
- if(H5F_addr_defined(linfo.corder_bt2_addr))
- if(H5B2_iterate_size(f, dxpl_id, H5G_BT2_CORDER, linfo.corder_bt2_addr, &bh_info->index_size) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree storage info")
+ /* Check if name index available */
+ if(H5F_addr_defined(linfo.name_bt2_addr)) {
+ /* Open the name index v2 B-tree */
+ if(NULL == (bt2_name = H5B2_open(f, dxpl_id, linfo.name_bt2_addr)))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index")
- /* Get name order B-tree size, if available */
- if(H5F_addr_defined(linfo.name_bt2_addr))
- if(H5B2_iterate_size(f, dxpl_id, H5G_BT2_NAME, linfo.name_bt2_addr, &bh_info->index_size) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree storage info")
+ /* Get name index B-tree size */
+ if(H5B2_size(bt2_name, dxpl_id, &bh_info->index_size) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve B-tree storage info for name index")
+ } /* end if */
+
+ /* Check if creation order index available */
+ if(H5F_addr_defined(linfo.corder_bt2_addr)) {
+ /* Open the creation order index v2 B-tree */
+ if(NULL == (bt2_corder = H5B2_open(f, dxpl_id, linfo.corder_bt2_addr)))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for creation order index")
+
+ /* Get creation order index B-tree size */
+ if(H5B2_size(bt2_corder, dxpl_id, &bh_info->index_size) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve B-tree storage info for creation order index")
+ } /* end if */
/* Get fractal heap size, if available */
if(H5F_addr_defined(linfo.fheap_addr)) {
/* Open the fractal heap for links */
if(NULL == (fheap = H5HF_open(f, dxpl_id, linfo.fheap_addr)))
- HGOTO_ERROR(H5E_HEAP, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap")
+ HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap")
/* Get heap storage size */
if(H5HF_size(fheap, dxpl_id, &bh_info->heap_size) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't retrieve fractal heap storage info")
-
- /* Release the fractal heap */
- if(H5HF_close(fheap, dxpl_id) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
- fheap = NULL;
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve fractal heap storage info")
} /* end if */
} /* end if */
else {
@@ -322,7 +405,11 @@ H5O_group_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info)
done:
/* Release resources */
if(fheap && H5HF_close(fheap, dxpl_id) < 0)
- HDONE_ERROR(H5E_HEAP, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
+ HDONE_ERROR(H5E_SYM, H5E_CANTCLOSEOBJ, FAIL, "can't close fractal heap")
+ if(bt2_name && H5B2_close(bt2_name, dxpl_id) < 0)
+ HDONE_ERROR(H5E_SYM, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for name index")
+ if(bt2_corder && H5B2_close(bt2_corder, dxpl_id) < 0)
+ HDONE_ERROR(H5E_SYM, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for creation order index")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_group_bh_info() */
diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h
index 3d25109..80c4a7b 100644
--- a/src/H5Gpkg.h
+++ b/src/H5Gpkg.h
@@ -501,7 +501,8 @@ H5_DLL H5G_obj_t H5G_compact_get_type_by_idx(H5O_loc_t *oloc, hid_t dxpl_id,
/* Functions that understand "dense" link storage */
H5_DLL herr_t H5G_dense_build_table(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo,
H5_index_t idx_type, H5_iter_order_t order, H5G_link_table_t *ltable);
-H5_DLL herr_t H5G_dense_create(H5F_t *f, hid_t dxpl_id, H5O_linfo_t *linfo);
+H5_DLL herr_t H5G_dense_create(H5F_t *f, hid_t dxpl_id, H5O_linfo_t *linfo,
+ const H5O_pline_t *pline);
H5_DLL herr_t H5G_dense_insert(H5F_t *f, hid_t dxpl_id,
const H5O_linfo_t *linfo, const H5O_link_t *lnk);
H5_DLL htri_t H5G_dense_lookup(H5F_t *f, hid_t dxpl_id,
@@ -528,8 +529,11 @@ H5_DLL H5G_obj_t H5G_dense_get_type_by_idx(H5F_t *f, hid_t dxpl_id,
#endif /* H5_NO_DEPRECATED_SYMBOLS */
/* Functions that understand group objects */
-H5_DLL herr_t H5G_obj_create(H5F_t *f, hid_t dxpl_id, const H5O_ginfo_t *ginfo,
- const H5O_linfo_t *linfo, hid_t gcpl_id, H5O_loc_t *oloc/*out*/);
+H5_DLL herr_t H5G_obj_create(H5F_t *f, hid_t dxpl_id, hid_t gcpl_id,
+ H5O_loc_t *oloc/*out*/);
+H5_DLL herr_t H5G_obj_create_real(H5F_t *f, hid_t dxpl_id, const H5O_ginfo_t *ginfo,
+ const H5O_linfo_t *linfo, const H5O_pline_t *pline, hid_t gcpl_id,
+ H5O_loc_t *oloc/*out*/);
H5_DLL htri_t H5G_obj_get_linfo(const H5O_loc_t *grp_oloc, H5O_linfo_t *linfo,
hid_t dxpl_id);
H5_DLL herr_t H5G_obj_insert(const H5O_loc_t *grp_oloc, const char *name,
diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h
index ff20fe6..526fa82 100644
--- a/src/H5Gprivate.h
+++ b/src/H5Gprivate.h
@@ -141,6 +141,11 @@ typedef struct {
H5G_name_t *path; /* Group hierarchy path */
} H5G_loc_t;
+/* Callback information for copying groups */
+typedef struct H5G_copy_file_ud_t {
+ H5O_copy_file_ud_common_t common; /* Shared information (must be first) */
+} H5G_copy_file_ud_t;
+
typedef struct H5G_t H5G_t;
typedef struct H5G_shared_t H5G_shared_t;
typedef struct H5G_entry_t H5G_entry_t;
diff --git a/src/H5Groot.c b/src/H5Groot.c
index 5d07142..7dc98d1 100644
--- a/src/H5Groot.c
+++ b/src/H5Groot.c
@@ -137,25 +137,9 @@ H5G_mkroot(H5F_t *f, hid_t dxpl_id, hbool_t create_root)
* with a hard link count of one since it's pointed to by the superblock.
*/
if(create_root) {
- H5P_genplist_t *fc_plist; /* File creation property list */
- H5O_ginfo_t ginfo; /* Group info parameters */
- H5O_linfo_t linfo; /* Link info parameters */
-
- /* Get the file creation property list */
- /* (Which is a sub-class of the group creation property class) */
- if(NULL == (fc_plist = (H5P_genplist_t *)H5I_object(f->shared->fcpl_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
-
- /* Get the group info property */
- if(H5P_get(fc_plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get group info")
-
- /* Get the link info property */
- if(H5P_get(fc_plist, H5G_CRT_LINK_INFO_NAME, &linfo) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get link info")
-
/* Create root group */
- if(H5G_obj_create(f, dxpl_id, &ginfo, &linfo, f->shared->fcpl_id, root_loc.oloc/*out*/) < 0)
+ /* (Pass the FCPL which is a sub-class of the group creation property class) */
+ if(H5G_obj_create(f, dxpl_id, f->shared->fcpl_id, root_loc.oloc/*out*/) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group entry")
if(1 != H5O_link(root_loc.oloc, 1, dxpl_id))
HGOTO_ERROR(H5E_SYM, H5E_LINKCOUNT, FAIL, "internal error (wrong link count)")
diff --git a/src/H5Gtest.c b/src/H5Gtest.c
index f3508eb..791c13a 100644
--- a/src/H5Gtest.c
+++ b/src/H5Gtest.c
@@ -382,6 +382,8 @@ done:
herr_t
H5G_new_dense_info_test(hid_t gid, 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_linfo_t linfo; /* Link info message */
H5G_t *grp = NULL; /* Pointer to group */
herr_t ret_value = SUCCEED; /* Return value */
@@ -402,20 +404,34 @@ H5G_new_dense_info_test(hid_t gid, hsize_t *name_count, hsize_t *corder_count)
if(!H5F_addr_defined(linfo.name_bt2_addr))
HGOTO_DONE(FAIL)
+ /* Open the name index v2 B-tree */
+ if(NULL == (bt2_name = H5B2_open(grp->oloc.file, H5AC_dxpl_id, linfo.name_bt2_addr)))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index")
+
/* Retrieve # of records in name index */
- if(H5B2_get_nrec(grp->oloc.file, H5AC_dxpl_id, H5G_BT2_NAME, linfo.name_bt2_addr, name_count) < 0)
+ if(H5B2_get_nrec(bt2_name, name_count) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "unable to retrieve # of records from name index")
/* Check if there is a creation order index */
if(H5F_addr_defined(linfo.corder_bt2_addr)) {
+ /* Open the creation order index v2 B-tree */
+ if(NULL == (bt2_corder = H5B2_open(grp->oloc.file, H5AC_dxpl_id, linfo.corder_bt2_addr)))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for creation order index")
+
/* Retrieve # of records in creation order index */
- if(H5B2_get_nrec(grp->oloc.file, H5AC_dxpl_id, H5G_BT2_CORDER, linfo.corder_bt2_addr, corder_count) < 0)
+ if(H5B2_get_nrec(bt2_corder, corder_count) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "unable to retrieve # of records from creation order index")
} /* end if */
else
*corder_count = 0;
done:
+ /* Release resources */
+ if(bt2_name && H5B2_close(bt2_name, H5AC_dxpl_id) < 0)
+ HDONE_ERROR(H5E_SYM, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for name index")
+ if(bt2_corder && H5B2_close(bt2_corder, H5AC_dxpl_id) < 0)
+ HDONE_ERROR(H5E_SYM, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for creation order index")
+
FUNC_LEAVE_NOAPI(ret_value)
} /* H5G_new_dense_info_test() */
diff --git a/src/H5Gtraverse.c b/src/H5Gtraverse.c
index 87ebc74..4c287d5 100644
--- a/src/H5Gtraverse.c
+++ b/src/H5Gtraverse.c
@@ -711,12 +711,15 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target,
if(target & H5G_CRT_INTMD_GROUP) {
const H5O_ginfo_t def_ginfo = H5G_CRT_GROUP_INFO_DEF; /* Default group info settings */
const H5O_linfo_t def_linfo = H5G_CRT_LINK_INFO_DEF; /* Default link info settings */
+ const H5O_pline_t def_pline = H5O_CRT_PIPELINE_DEF; /* Default filter pipeline settings */
H5O_ginfo_t par_ginfo; /* Group info settings for parent group */
H5O_linfo_t par_linfo; /* Link info settings for parent group */
+ H5O_pline_t par_pline; /* Filter pipeline settings for parent group */
H5O_linfo_t tmp_linfo; /* Temporary link info settings */
htri_t exists; /* Whether a group or link info message exists */
const H5O_ginfo_t *ginfo; /* Group info settings for new group */
const H5O_linfo_t *linfo; /* Link info settings for new group */
+ const H5O_pline_t *pline; /* Filter pipeline settings for new group */
/* Check for the parent group having a group info message */
/* (OK if not found) */
@@ -752,9 +755,25 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target,
/* Use default link info settings */
linfo = &def_linfo;
+ /* Check for the parent group having a filter pipeline message */
+ /* (OK if not found) */
+ if((exists = H5O_msg_exists(grp_loc.oloc, H5O_PLINE_ID, dxpl_id)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to read object header")
+ if(exists) {
+ /* Get the filter pipeline for parent group */
+ if(NULL == H5O_msg_read(grp_loc.oloc, H5O_PLINE_ID, &par_pline, dxpl_id))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "filter pipeline message not present")
+
+ /* Use parent filter pipeline settings */
+ pline = &par_pline;
+ } /* end if */
+ else
+ /* Use default filter pipeline settings */
+ pline = &def_pline;
+
/* Create the intermediate group */
/* XXX: Should we allow user to control the group creation params here? -QAK */
- if(H5G_obj_create(grp_oloc.file, dxpl_id, ginfo, linfo, H5P_GROUP_CREATE_DEFAULT, obj_loc.oloc/*out*/) < 0)
+ if(H5G_obj_create_real(grp_oloc.file, dxpl_id, ginfo, linfo, pline, H5P_GROUP_CREATE_DEFAULT, obj_loc.oloc/*out*/) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group entry")
/* Insert new group into current group's symbol table */
diff --git a/src/H5HF.c b/src/H5HF.c
index 79032d3..539a14f 100644
--- a/src/H5HF.c
+++ b/src/H5HF.c
@@ -172,7 +172,7 @@ HDfprintf(stderr, "%s: Called\n", FUNC);
/* Allocate fractal heap wrapper */
if(NULL == (fh = H5FL_MALLOC(H5HF_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fractal heap info")
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "memory allocation failed for fractal heap info")
/* Lock the heap header into memory */
if(NULL == (hdr = (H5HF_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_FHEAP_HDR, fh_addr, NULL, NULL, H5AC_WRITE)))
@@ -196,10 +196,9 @@ HDfprintf(stderr, "%s: Called\n", FUNC);
done:
if(hdr && H5AC_unprotect(f, dxpl_id, H5AC_FHEAP_HDR, fh_addr, hdr, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, NULL, "unable to release fractal heap header")
- if(!ret_value) {
- if(fh)
- (void)H5HF_close(fh, dxpl_id);
- } /* end if */
+ if(!ret_value && fh)
+ if(H5HF_close(fh, dxpl_id) < 0)
+ HDONE_ERROR(H5E_HEAP, H5E_CANTCLOSEOBJ, NULL, "unable to close fractal heap")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5HF_create() */
@@ -250,7 +249,7 @@ HDfprintf(stderr, "%s: hdr->rc = %u, hdr->fspace = %p\n", FUNC, hdr->rc, hdr->fs
/* Create fractal heap info */
if(NULL == (fh = H5FL_MALLOC(H5HF_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fractal heap info")
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "memory allocation failed for fractal heap info")
/* Point fractal heap wrapper at header */
fh->hdr = hdr;
@@ -270,10 +269,9 @@ HDfprintf(stderr, "%s: hdr->rc = %u, hdr->fspace = %p\n", FUNC, hdr->rc, hdr->fs
done:
if(hdr && H5AC_unprotect(f, dxpl_id, H5AC_FHEAP_HDR, fh_addr, hdr, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, NULL, "unable to release fractal heap header")
- if(!ret_value) {
- if(fh)
- (void)H5HF_close(fh, dxpl_id);
- } /* end if */
+ if(!ret_value && fh)
+ if(H5HF_close(fh, dxpl_id) < 0)
+ HDONE_ERROR(H5E_HEAP, H5E_CANTCLOSEOBJ, NULL, "unable to close fractal heap")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5HF_open() */
@@ -324,7 +322,7 @@ H5HF_get_id_len(H5HF_t *fh, size_t *id_len_p)
*-------------------------------------------------------------------------
*/
herr_t
-H5HF_get_heap_addr(H5HF_t *fh, haddr_t *heap_addr_p)
+H5HF_get_heap_addr(const H5HF_t *fh, haddr_t *heap_addr_p)
{
FUNC_ENTER_NOAPI_NOFUNC(H5HF_get_heap_addr)
diff --git a/src/H5HFbtree2.c b/src/H5HFbtree2.c
index 5958c03..ae50bf3 100644
--- a/src/H5HFbtree2.c
+++ b/src/H5HFbtree2.c
@@ -102,6 +102,7 @@ static herr_t H5HF_huge_btree2_filt_dir_debug(FILE *stream, const H5F_t *f, hid_
/* v2 B-tree class for indirectly accessed 'huge' objects */
const H5B2_class_t H5HF_BT2_INDIR[1]={{ /* B-tree class information */
H5B2_FHEAP_HUGE_INDIR_ID, /* Type of B-tree */
+ "H5B2_FHEAP_HUGE_INDIR_ID", /* Name of B-tree class */
sizeof(H5HF_huge_bt2_indir_rec_t), /* Size of native record */
H5HF_huge_btree2_indir_store, /* Record storage callback */
H5HF_huge_btree2_indir_compare, /* Record comparison callback */
@@ -111,8 +112,9 @@ const H5B2_class_t H5HF_BT2_INDIR[1]={{ /* B-tree class information */
}};
/* v2 B-tree class for indirectly accessed, filtered 'huge' objects */
-const H5B2_class_t H5HF_BT2_FILT_INDIR[1]={{ /* B-tree class information */
+const H5B2_class_t H5HF_BT2_FILT_INDIR[1]={{ /* B-tree class information */
H5B2_FHEAP_HUGE_FILT_INDIR_ID, /* Type of B-tree */
+ "H5B2_FHEAP_HUGE_FILT_INDIR_ID", /* Name of B-tree class */
sizeof(H5HF_huge_bt2_filt_indir_rec_t), /* Size of native record */
H5HF_huge_btree2_filt_indir_store, /* Record storage callback */
H5HF_huge_btree2_filt_indir_compare, /* Record comparison callback */
@@ -122,8 +124,9 @@ const H5B2_class_t H5HF_BT2_FILT_INDIR[1]={{ /* B-tree class information */
}};
/* v2 B-tree class for directly accessed 'huge' objects */
-const H5B2_class_t H5HF_BT2_DIR[1]={{ /* B-tree class information */
+const H5B2_class_t H5HF_BT2_DIR[1]={{ /* B-tree class information */
H5B2_FHEAP_HUGE_DIR_ID, /* Type of B-tree */
+ "H5B2_FHEAP_HUGE_DIR_ID", /* Name of B-tree class */
sizeof(H5HF_huge_bt2_dir_rec_t), /* Size of native record */
H5HF_huge_btree2_dir_store, /* Record storage callback */
H5HF_huge_btree2_dir_compare, /* Record comparison callback */
@@ -133,8 +136,9 @@ const H5B2_class_t H5HF_BT2_DIR[1]={{ /* B-tree class information */
}};
/* v2 B-tree class for directly accessed, filtered 'huge' objects */
-const H5B2_class_t H5HF_BT2_FILT_DIR[1]={{ /* B-tree class information */
+const H5B2_class_t H5HF_BT2_FILT_DIR[1]={{ /* B-tree class information */
H5B2_FHEAP_HUGE_FILT_DIR_ID, /* Type of B-tree */
+ "H5B2_FHEAP_HUGE_FILT_DIR_ID", /* Name of B-tree class */
sizeof(H5HF_huge_bt2_filt_dir_rec_t),/* Size of native record */
H5HF_huge_btree2_filt_dir_store, /* Record storage callback */
H5HF_huge_btree2_filt_dir_compare, /* Record comparison callback */
diff --git a/src/H5HFcache.c b/src/H5HFcache.c
index b5d7cb5..6669853 100644
--- a/src/H5HFcache.c
+++ b/src/H5HFcache.c
@@ -294,7 +294,7 @@ HDfprintf(stderr, "%s: Load heap header, addr = %a\n", FUNC, addr);
HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, NULL, "can't wrap buffer")
/* Compute the 'base' size of the fractal heap header on disk */
- size = H5HF_HEADER_SIZE(hdr);
+ size = (size_t)H5HF_HEADER_SIZE(hdr);
/* Get a pointer to a buffer that's large enough for serialized header */
if(NULL == (buf = (uint8_t *)H5WB_actual(wb, size)))
@@ -364,9 +364,9 @@ HDfprintf(stderr, "%s: Load heap header, addr = %a\n", FUNC, addr);
filter_info_off = (size_t)(p - buf);
/* Compute the size of the extra filter information */
- filter_info_size = hdr->sizeof_size /* Size of size for filtered root direct block */
- + 4 /* Size of filter mask for filtered root direct block */
- + hdr->filter_len; /* Size of encoded I/O filter info */
+ filter_info_size = (size_t)(hdr->sizeof_size /* Size of size for filtered root direct block */
+ + (unsigned)4 /* Size of filter mask for filtered root direct block */
+ + hdr->filter_len); /* Size of encoded I/O filter info */
/* Compute the heap header's size */
hdr->heap_size = size + filter_info_size;
@@ -434,7 +434,8 @@ done:
if(wb && H5WB_unwrap(wb) < 0)
HDONE_ERROR(H5E_HEAP, H5E_CLOSEERROR, NULL, "can't close wrapped buffer")
if(!ret_value && hdr)
- (void)H5HF_cache_hdr_dest(f, 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_cache_hdr_load() */ /*lint !e818 Can't make udata a pointer to const */
@@ -482,9 +483,6 @@ HDfprintf(stderr, "%s: Flushing heap header, addr = %a, destroy = %u\n", FUNC, a
uint8_t heap_flags; /* Status flags for heap */
uint32_t metadata_chksum; /* Computed metadata checksum value */
- /* Sanity check */
- HDassert(hdr->dirty);
-
/* Set the shared heap header's file context for this operation */
hdr->f = f;
@@ -569,7 +567,6 @@ HDfprintf(stderr, "%s: Flushing heap header, addr = %a, destroy = %u\n", FUNC, a
if(H5F_block_write(f, H5FD_MEM_FHEAP_HDR, addr, size, dxpl_id, buf) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTFLUSH, FAIL, "unable to save fractal heap header to disk")
- hdr->dirty = FALSE;
hdr->cache_info.is_dirty = FALSE;
} /* end if */
@@ -623,16 +620,9 @@ H5HF_cache_hdr_dest(H5F_t *f, H5HF_hdr_t *hdr)
HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free fractal heap header")
} /* end if */
- /* Free the block size lookup table for the doubling table */
- H5HF_dtable_dest(&hdr->man_dtable);
-
- /* Release any I/O pipeline filter information */
- if(hdr->pline.nused)
- H5O_msg_reset(H5O_PLINE_ID, &(hdr->pline));
-
/* Free the shared info itself */
- (void)H5FL_FREE(H5HF_hdr_t, hdr);
-
+ if(H5HF_hdr_free(hdr) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "unable to release fractal heap header")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5HF_cache_hdr_dest() */
@@ -1445,7 +1435,7 @@ HDfprintf(stderr, "%s: nbytes = %Zu, read_size = %Zu, read_buf = %p\n", FUNC, nb
} /* end if */
/* Sanity check */
- HDassert((size_t)(p - dblock->blk) == H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr));
+ HDassert((size_t)(p - dblock->blk) == (size_t)H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr));
/* Set return value */
ret_value = dblock;
@@ -1533,7 +1523,7 @@ H5HF_cache_dblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr,
} /* end if */
/* Sanity check */
- HDassert((size_t)(p - dblock->blk) == H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr));
+ HDassert((size_t)(p - dblock->blk) == (size_t)H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr));
/* Check for I/O filters on this heap */
if(hdr->filter_len > 0) {
diff --git a/src/H5HFhdr.c b/src/H5HFhdr.c
index d1f2675..c326a59 100644
--- a/src/H5HFhdr.c
+++ b/src/H5HFhdr.c
@@ -79,7 +79,7 @@
/*********************/
/* Declare a free list to manage the H5HF_hdr_t struct */
-H5FL_DEFINE(H5HF_hdr_t);
+H5FL_DEFINE_STATIC(H5HF_hdr_t);
/*****************************/
@@ -110,7 +110,7 @@ H5HF_hdr_t *
H5HF_hdr_alloc(H5F_t *f)
{
H5HF_hdr_t *hdr = NULL; /* Shared fractal heap header */
- H5HF_hdr_t *ret_value = NULL; /* Return value */
+ H5HF_hdr_t *ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5HF_hdr_alloc)
@@ -121,7 +121,7 @@ H5HF_hdr_alloc(H5F_t *f)
/* Allocate space for the shared information */
if(NULL == (hdr = H5FL_CALLOC(H5HF_hdr_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fractal heap shared header")
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "allocation failed for fractal heap shared header")
/* Set the internal parameters for the heap */
hdr->f = f;
@@ -132,9 +132,9 @@ H5HF_hdr_alloc(H5F_t *f)
ret_value = hdr;
done:
- if(!ret_value)
- if(hdr)
- (void)H5HF_cache_hdr_dest(f, hdr);
+ 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() */
@@ -409,9 +409,6 @@ H5HF_hdr_create(H5F_t *f, hid_t dxpl_id, const H5HF_create_t *cparam)
/* Set "huge" object tracker v2 B-tree address to indicate that there aren't any yet */
hdr->huge_bt2_addr = HADDR_UNDEF;
- /* Note that the shared info is dirty (it's not written to the file yet) */
- hdr->dirty = TRUE;
-
/* First phase of header final initialization */
/* (doesn't need ID length set up) */
if(H5HF_hdr_finish_init_phase1(hdr) < 0)
@@ -423,6 +420,17 @@ H5HF_hdr_create(H5F_t *f, hid_t dxpl_id, const H5HF_create_t *cparam)
* length is already set in that case (its stored in the header on disk))
*/
if(cparam->pline.nused > 0) {
+ /* Check if the filters in the DCPL can be applied to this dataset */
+ if(H5Z_can_apply_direct(&(cparam->pline)) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, HADDR_UNDEF, "I/O filters can't operate on this heap")
+
+ /* Mark the filters as checked */
+ hdr->checked_filters = TRUE;
+
+ /* Make the "set local" filter callbacks for this dataset */
+ if(H5Z_set_local_direct(&(cparam->pline)) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, HADDR_UNDEF, "unable to set local filter parameters")
+
/* Copy the I/O filter pipeline from the creation parameters to the header */
if(NULL == H5O_msg_copy(H5O_PLINE_ID, &(cparam->pline), &(hdr->pline)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTCOPY, HADDR_UNDEF, "can't copy I/O filter pipeline")
@@ -430,7 +438,7 @@ H5HF_hdr_create(H5F_t *f, hid_t dxpl_id, const H5HF_create_t *cparam)
/* Pay attention to the latest version flag for the file */
if(H5F_USE_LATEST_FORMAT(hdr->f))
/* Set the latest version for the I/O pipeline message */
- if(H5Z_set_latest_version(&(hdr->pline)) < 0)
+ if(H5O_pline_set_latest_version(&(hdr->pline)) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTSET, HADDR_UNDEF, "can't set latest version of I/O filter pipeline")
/* Compute the I/O filters' encoded size */
@@ -446,10 +454,14 @@ HDfprintf(stderr, "%s: hdr->filter_len = %u\n", FUNC, hdr->filter_len);
+ 4 /* Size of filter mask for filtered root direct block */
+ hdr->filter_len; /* Size of encoded I/O filter info */
} /* end if */
- else
+ else {
/* Set size of header on disk */
hdr->heap_size = H5HF_HEADER_SIZE(hdr);
+ /* Mark filters as checked, for performance reasons */
+ hdr->checked_filters = TRUE;
+ } /* end else */
+
/* Set the length of IDs in the heap */
/* (This code is not in the "finish init phase" routines because those
* routines are also called from the cache 'load' callback, and the ID
@@ -457,7 +469,7 @@ HDfprintf(stderr, "%s: hdr->filter_len = %u\n", FUNC, hdr->filter_len);
*/
switch(cparam->id_len) {
case 0: /* Set the length of heap IDs to just enough to hold the offset & length of 'normal' objects in the heap */
- hdr->id_len = 1 + hdr->heap_off_size + hdr->heap_len_size;
+ hdr->id_len = (unsigned)1 + hdr->heap_off_size + hdr->heap_len_size;
break;
case 1: /* Set the length of heap IDs to just enough to hold the information needed to directly access 'huge' objects in the heap */
@@ -505,15 +517,15 @@ HDfprintf(stderr, "%s: hdr->id_len = %Zu\n", FUNC, hdr->id_len);
/* Cache the new fractal heap header */
if(H5AC_set(f, dxpl_id, H5AC_FHEAP_HDR, hdr->heap_addr, hdr, H5AC__NO_FLAGS_SET) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, HADDR_UNDEF, "can't add fractal heap header to cache")
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTINSERT, HADDR_UNDEF, "can't add fractal heap header to cache")
/* Set address of heap header to return */
ret_value = hdr->heap_addr;
done:
- if(!H5F_addr_defined(ret_value))
- if(hdr)
- (void)H5HF_cache_hdr_dest(NULL, hdr);
+ if(!H5F_addr_defined(ret_value) && hdr)
+ if(H5HF_hdr_free(hdr) < 0)
+ HDONE_ERROR(H5E_HEAP, H5E_CANTRELEASE, HADDR_UNDEF, "unable to release fractal heap header")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5HF_hdr_create() */
@@ -681,9 +693,6 @@ HDfprintf(stderr, "%s: Marking heap header as dirty\n", FUNC);
if(H5AC_mark_pinned_or_protected_entry_dirty(hdr->f, hdr) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTMARKDIRTY, FAIL, "unable to mark fractal heap header as dirty")
- /* Set the dirty flags for the heap header */
- hdr->dirty = TRUE;
-
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5HF_hdr_dirty() */
@@ -1493,6 +1502,43 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5HF_hdr_free
+ *
+ * Purpose: Free shared fractal heap header
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Oct 27 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5HF_hdr_free(H5HF_hdr_t *hdr)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_hdr_free)
+
+ /*
+ * Check arguments.
+ */
+ HDassert(hdr);
+
+ /* Free the block size lookup table for the doubling table */
+ H5HF_dtable_dest(&hdr->man_dtable);
+
+ /* Release any I/O pipeline filter information */
+ if(hdr->pline.nused)
+ H5O_msg_reset(H5O_PLINE_ID, &(hdr->pline));
+
+ /* Free the shared info itself */
+ hdr = H5FL_FREE(H5HF_hdr_t, hdr);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5HF_hdr_free() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5HF_hdr_delete
*
* Purpose: Delete a fractal heap, starting with the header
@@ -1508,8 +1554,8 @@ done:
herr_t
H5HF_hdr_delete(H5HF_hdr_t *hdr, hid_t dxpl_id)
{
- unsigned cache_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting heap header */
- herr_t ret_value = SUCCEED;
+ unsigned cache_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting heap header */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5HF_hdr_delete, FAIL)
diff --git a/src/H5HFhuge.c b/src/H5HFhuge.c
index 792a865..353ceb3 100644
--- a/src/H5HFhuge.c
+++ b/src/H5HFhuge.c
@@ -105,8 +105,7 @@ static herr_t H5HF_huge_op_real(H5HF_hdr_t *hdr, hid_t dxpl_id,
static herr_t
H5HF_huge_bt2_create(H5HF_hdr_t *hdr, hid_t dxpl_id)
{
- const H5B2_class_t *bt2_class; /* v2 B-tree class to use */
- size_t rrec_size; /* Size of 'raw' records on disk */
+ H5B2_create_t bt2_cparam; /* v2 B-tree creation parameters */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5HF_huge_bt2_create)
@@ -125,40 +124,46 @@ H5HF_huge_bt2_create(H5HF_hdr_t *hdr, hid_t dxpl_id)
*/
if(hdr->huge_ids_direct) {
if(hdr->filter_len > 0) {
- rrec_size = hdr->sizeof_addr /* Address of object */
+ bt2_cparam.rrec_size = (size_t)(hdr->sizeof_addr /* Address of object */
+ hdr->sizeof_size /* Length of object */
+ 4 /* Filter mask for filtered object */
- + hdr->sizeof_size; /* Size of de-filtered object in memory */
- bt2_class = H5HF_BT2_FILT_DIR;
+ + hdr->sizeof_size); /* Size of de-filtered object in memory */
+ bt2_cparam.cls = H5HF_BT2_FILT_DIR;
} /* end if */
else {
- rrec_size = hdr->sizeof_addr /* Address of object */
- + hdr->sizeof_size; /* Length of object */
- bt2_class = H5HF_BT2_DIR;
+ bt2_cparam.rrec_size = (size_t)(hdr->sizeof_addr /* Address of object */
+ + hdr->sizeof_size); /* Length of object */
+ bt2_cparam.cls = H5HF_BT2_DIR;
} /* end else */
} /* end if */
else {
- if (hdr->filter_len > 0) {
- rrec_size = hdr->sizeof_addr /* Address of filtered object */
+ if(hdr->filter_len > 0) {
+ bt2_cparam.rrec_size = (size_t)(hdr->sizeof_addr /* Address of filtered object */
+ hdr->sizeof_size /* Length of filtered object */
+ 4 /* Filter mask for filtered object */
+ hdr->sizeof_size /* Size of de-filtered object in memory */
- + hdr->sizeof_size; /* Unique ID for object */
- bt2_class = H5HF_BT2_FILT_INDIR;
+ + hdr->sizeof_size); /* Unique ID for object */
+ bt2_cparam.cls = H5HF_BT2_FILT_INDIR;
} /* end if */
else {
- rrec_size = hdr->sizeof_addr /* Address of object */
+ bt2_cparam.rrec_size = (size_t)(hdr->sizeof_addr /* Address of object */
+ hdr->sizeof_size /* Length of object */
- + hdr->sizeof_size; /* Unique ID for object */
- bt2_class = H5HF_BT2_INDIR;
+ + hdr->sizeof_size); /* Unique ID for object */
+ bt2_cparam.cls = H5HF_BT2_INDIR;
} /* end else */
} /* end else */
+ bt2_cparam.node_size = (size_t)H5HF_HUGE_BT2_NODE_SIZE;
+ bt2_cparam.split_percent = H5HF_HUGE_BT2_SPLIT_PERC;
+ bt2_cparam.merge_percent = H5HF_HUGE_BT2_MERGE_PERC;
/* Create v2 B-tree for tracking 'huge' objects */
- if(H5B2_create(hdr->f, dxpl_id, bt2_class, (size_t)H5HF_HUGE_BT2_NODE_SIZE, rrec_size,
- H5HF_HUGE_BT2_SPLIT_PERC, H5HF_HUGE_BT2_MERGE_PERC, &hdr->huge_bt2_addr/*out*/) < 0)
+ if(NULL == (hdr->huge_bt2 = H5B2_create(hdr->f, dxpl_id, &bt2_cparam)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTCREATE, FAIL, "can't create v2 B-tree for tracking 'huge' heap objects")
+ /* Retrieve the v2 B-tree's address in the file */
+ if(H5B2_get_addr(hdr->huge_bt2, &hdr->huge_bt2_addr) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't get v2 B-tree address for tracking 'huge' heap objects")
+
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5HF_huge_bt2_create() */
@@ -198,12 +203,12 @@ HDfprintf(stderr, "%s: hdr->id_len = %u\n", "H5HF_huge_init", (unsigned)hdr->id_
HDfprintf(stderr, "%s: hdr->filter_len = %u\n", "H5HF_huge_init", (unsigned)hdr->filter_len);
#endif /* QAK */
if(hdr->filter_len > 0) {
- if((hdr->id_len - 1) >= (hdr->sizeof_addr + hdr->sizeof_size + 4 + hdr->sizeof_size)) {
+ if((hdr->id_len - 1) >= (unsigned)(hdr->sizeof_addr + hdr->sizeof_size + 4 + hdr->sizeof_size)) {
/* Indicate that v2 B-tree doesn't have to be used to locate object */
hdr->huge_ids_direct = TRUE;
/* Set the size of 'huge' object IDs */
- hdr->huge_id_size = hdr->sizeof_addr + hdr->sizeof_size + hdr->sizeof_size;
+ hdr->huge_id_size = (uint8_t)(hdr->sizeof_addr + hdr->sizeof_size + hdr->sizeof_size);
} /* end if */
else
/* Indicate that v2 B-tree must be used to access object */
@@ -215,7 +220,7 @@ HDfprintf(stderr, "%s: hdr->filter_len = %u\n", "H5HF_huge_init", (unsigned)hdr-
hdr->huge_ids_direct = TRUE;
/* Set the size of 'huge' object IDs */
- hdr->huge_id_size = hdr->sizeof_addr + hdr->sizeof_size;
+ hdr->huge_id_size = (uint8_t)(hdr->sizeof_addr + hdr->sizeof_size);
} /* end if */
else
/* Indicate that v2 B-tree must be used to locate object */
@@ -224,7 +229,7 @@ HDfprintf(stderr, "%s: hdr->filter_len = %u\n", "H5HF_huge_init", (unsigned)hdr-
if(!hdr->huge_ids_direct) {
/* Set the size and maximum value of 'huge' object ID */
if((hdr->id_len - 1) < sizeof(hsize_t)) {
- hdr->huge_id_size = hdr->id_len - 1;
+ hdr->huge_id_size = (uint8_t)(hdr->id_len - 1);
hdr->huge_max_id = ((hsize_t)1 << (hdr->huge_id_size * 8)) - 1;
} /*end if */
else {
@@ -232,6 +237,7 @@ HDfprintf(stderr, "%s: hdr->filter_len = %u\n", "H5HF_huge_init", (unsigned)hdr-
hdr->huge_max_id = HSIZET_MAX;
} /* end else */
} /* end if */
+ hdr->huge_bt2 = NULL;
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5HF_huge_init() */
@@ -324,9 +330,20 @@ HDfprintf(stderr, "%s: obj_size = %Zu\n", FUNC, obj_size);
HDassert(id);
/* Check if the v2 B-tree for tracking 'huge' heap objects has been created yet */
- if(!H5F_addr_defined(hdr->huge_bt2_addr))
+ if(!H5F_addr_defined(hdr->huge_bt2_addr)) {
+ /* Go create (& open) v2 B-tree */
if(H5HF_huge_bt2_create(hdr, dxpl_id) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTCREATE, FAIL, "can't create v2 B-tree for tracking 'huge' heap objects")
+ } /* end if */
+ else {
+ /* Check if v2 B-tree is open yet */
+ if(NULL == hdr->huge_bt2) {
+ /* Open existing v2 B-tree */
+ if(NULL == (hdr->huge_bt2 = H5B2_open(hdr->f, dxpl_id, hdr->huge_bt2_addr)))
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for tracking 'huge' heap objects")
+ } /* end if */
+ } /* end else */
+ HDassert(hdr->huge_bt2);
/* Check for I/O pipeline filter on heap */
if(hdr->filter_len > 0) {
@@ -386,7 +403,7 @@ HDfprintf(stderr, "%s: obj_rec = {%a, %Hu, %x, %Hu}\n", FUNC, obj_rec.addr, obj_
#endif /* QAK */
/* Insert record for object in v2 B-tree */
- if(H5B2_insert(hdr->f, dxpl_id, H5HF_BT2_FILT_DIR, hdr->huge_bt2_addr, &obj_rec) < 0)
+ if(H5B2_insert(hdr->huge_bt2, dxpl_id, &obj_rec) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTINSERT, FAIL, "couldn't insert object tracking record in v2 B-tree")
/* Encode ID for user */
@@ -407,7 +424,7 @@ HDfprintf(stderr, "%s: obj_rec = {%a, %Hu}\n", FUNC, obj_rec.addr, obj_rec.len);
#endif /* QAK */
/* Insert record for object in v2 B-tree */
- if(H5B2_insert(hdr->f, dxpl_id, H5HF_BT2_DIR, hdr->huge_bt2_addr, &obj_rec) < 0)
+ if(H5B2_insert(hdr->huge_bt2, dxpl_id, &obj_rec) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTINSERT, FAIL, "couldn't insert object tracking record in v2 B-tree")
/* Encode ID for user */
@@ -419,7 +436,6 @@ HDfprintf(stderr, "%s: obj_rec = {%a, %Hu}\n", FUNC, obj_rec.addr, obj_rec.len);
else {
H5HF_huge_bt2_filt_indir_rec_t filt_indir_rec; /* Record for tracking filtered object */
H5HF_huge_bt2_indir_rec_t indir_rec; /* Record for tracking non-filtered object */
- const H5B2_class_t *bt2_class; /* v2 B-tree class to use */
void *ins_rec; /* Pointer to record to insert */
hsize_t new_id; /* New ID for object */
@@ -440,7 +456,6 @@ HDfprintf(stderr, "%s: filt_indir_rec = {%a, %Hu, %x, %Hu, %Hu}\n", FUNC, filt_i
/* Set pointer to record to insert */
ins_rec = &filt_indir_rec;
- bt2_class = H5HF_BT2_FILT_INDIR;
} /* end if */
else {
/* Initialize record for object in v2 B-tree */
@@ -453,11 +468,10 @@ HDfprintf(stderr, "%s: indir_rec = {%a, %Hu, %Hu}\n", FUNC, indir_rec.addr, indi
/* Set pointer to record to insert */
ins_rec = &indir_rec;
- bt2_class = H5HF_BT2_INDIR;
} /* end else */
/* Insert record for tracking object in v2 B-tree */
- if(H5B2_insert(hdr->f, dxpl_id, bt2_class, hdr->huge_bt2_addr, ins_rec) < 0)
+ if(H5B2_insert(hdr->huge_bt2, dxpl_id, ins_rec) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTINSERT, FAIL, "couldn't insert object tracking record in v2 B-tree")
/* Encode ID for user */
@@ -528,6 +542,13 @@ H5HF_huge_get_obj_len(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id,
} /* end else */
} /* end if */
else {
+ /* Check if v2 B-tree is open yet */
+ if(NULL == hdr->huge_bt2) {
+ /* Open existing v2 B-tree */
+ if(NULL == (hdr->huge_bt2 = H5B2_open(hdr->f, dxpl_id, hdr->huge_bt2_addr)))
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for tracking 'huge' heap objects")
+ } /* end if */
+
if(hdr->filter_len > 0) {
H5HF_huge_bt2_filt_indir_rec_t found_rec; /* Record found from tracking object */
H5HF_huge_bt2_filt_indir_rec_t search_rec; /* Record for searching for object */
@@ -536,8 +557,7 @@ H5HF_huge_get_obj_len(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id,
UINT64DECODE_VAR(id, search_rec.id, hdr->huge_id_size)
/* Look up object in v2 B-tree */
- if(H5B2_find(hdr->f, dxpl_id, H5HF_BT2_FILT_INDIR, hdr->huge_bt2_addr,
- &search_rec, H5HF_huge_bt2_filt_indir_found, &found_rec) != TRUE)
+ if(H5B2_find(hdr->huge_bt2, dxpl_id, &search_rec, H5HF_huge_bt2_filt_indir_found, &found_rec) != TRUE)
HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "can't find object in B-tree")
/* Retrieve the object's length */
@@ -551,8 +571,7 @@ H5HF_huge_get_obj_len(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id,
UINT64DECODE_VAR(id, search_rec.id, hdr->huge_id_size)
/* Look up object in v2 B-tree */
- if(H5B2_find(hdr->f, dxpl_id, H5HF_BT2_INDIR, hdr->huge_bt2_addr,
- &search_rec, H5HF_huge_bt2_indir_found, &found_rec) != TRUE)
+ if(H5B2_find(hdr->huge_bt2, dxpl_id, &search_rec, H5HF_huge_bt2_indir_found, &found_rec) != TRUE)
HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "can't find object in B-tree")
/* Retrieve the object's length */
@@ -611,6 +630,16 @@ H5HF_huge_op_real(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id,
UINT32DECODE(id, filter_mask);
} /* end if */
else {
+ /* Sanity check */
+ HDassert(H5F_addr_defined(hdr->huge_bt2_addr));
+
+ /* Check if v2 B-tree is open yet */
+ if(NULL == hdr->huge_bt2) {
+ /* Open existing v2 B-tree */
+ if(NULL == (hdr->huge_bt2 = H5B2_open(hdr->f, dxpl_id, hdr->huge_bt2_addr)))
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for tracking 'huge' heap objects")
+ } /* end if */
+
if(hdr->filter_len > 0) {
H5HF_huge_bt2_filt_indir_rec_t found_rec; /* Record found from tracking object */
H5HF_huge_bt2_filt_indir_rec_t search_rec; /* Record for searching for object */
@@ -619,8 +648,7 @@ H5HF_huge_op_real(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id,
UINT64DECODE_VAR(id, search_rec.id, hdr->huge_id_size)
/* Look up object in v2 B-tree */
- if(H5B2_find(hdr->f, dxpl_id, H5HF_BT2_FILT_INDIR, hdr->huge_bt2_addr,
- &search_rec, H5HF_huge_bt2_filt_indir_found, &found_rec) != TRUE)
+ if(H5B2_find(hdr->huge_bt2, dxpl_id, &search_rec, H5HF_huge_bt2_filt_indir_found, &found_rec) != TRUE)
HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "can't find object in B-tree")
/* Retrieve the object's address & length */
@@ -636,8 +664,7 @@ H5HF_huge_op_real(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id,
UINT64DECODE_VAR(id, search_rec.id, hdr->huge_id_size)
/* Look up object in v2 B-tree */
- if(H5B2_find(hdr->f, dxpl_id, H5HF_BT2_INDIR, hdr->huge_bt2_addr,
- &search_rec, H5HF_huge_bt2_indir_found, &found_rec) != TRUE)
+ if(H5B2_find(hdr->huge_bt2, dxpl_id, &search_rec, H5HF_huge_bt2_indir_found, &found_rec) != TRUE)
HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "can't find object in B-tree")
/* Retrieve the object's address & length */
@@ -751,12 +778,21 @@ H5HF_huge_write(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id,
H5HF_huge_bt2_indir_rec_t found_rec; /* Record found from tracking object */
H5HF_huge_bt2_indir_rec_t search_rec; /* Record for searching for object */
+ /* Sanity check */
+ HDassert(H5F_addr_defined(hdr->huge_bt2_addr));
+
+ /* Check if v2 B-tree is open yet */
+ if(NULL == hdr->huge_bt2) {
+ /* Open existing v2 B-tree */
+ if(NULL == (hdr->huge_bt2 = H5B2_open(hdr->f, dxpl_id, hdr->huge_bt2_addr)))
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for tracking 'huge' heap objects")
+ } /* end if */
+
/* Get ID for looking up 'huge' object in v2 B-tree */
UINT64DECODE_VAR(id, search_rec.id, hdr->huge_id_size)
/* Look up object in v2 B-tree */
- if(H5B2_find(hdr->f, dxpl_id, H5HF_BT2_INDIR, hdr->huge_bt2_addr,
- &search_rec, H5HF_huge_bt2_indir_found, &found_rec) != TRUE)
+ if(H5B2_find(hdr->huge_bt2, dxpl_id, &search_rec, H5HF_huge_bt2_indir_found, &found_rec) != TRUE)
HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "can't find object in B-tree")
/* Retrieve the object's address & length */
@@ -872,8 +908,16 @@ H5HF_huge_remove(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id)
* Check arguments.
*/
HDassert(hdr);
+ HDassert(H5F_addr_defined(hdr->huge_bt2_addr));
HDassert(id);
+ /* Check if v2 B-tree is open yet */
+ if(NULL == hdr->huge_bt2) {
+ /* Open existing v2 B-tree */
+ if(NULL == (hdr->huge_bt2 = H5B2_open(hdr->f, dxpl_id, hdr->huge_bt2_addr)))
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for tracking 'huge' heap objects")
+ } /* end if */
+
/* Skip over the flag byte */
id++;
@@ -893,8 +937,7 @@ H5HF_huge_remove(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id)
/* Remove the record for tracking the 'huge' object from the v2 B-tree */
/* (space in the file for the object is freed in the 'remove' callback) */
- if(H5B2_remove(hdr->f, dxpl_id, H5HF_BT2_FILT_DIR, hdr->huge_bt2_addr,
- &search_rec, H5HF_huge_bt2_filt_dir_remove, &udata) < 0)
+ if(H5B2_remove(hdr->huge_bt2, dxpl_id, &search_rec, H5HF_huge_bt2_filt_dir_remove, &udata) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTREMOVE, FAIL, "can't remove object from B-tree")
} /* end if */
else {
@@ -907,8 +950,7 @@ H5HF_huge_remove(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id)
/* Remove the record for tracking the 'huge' object from the v2 B-tree */
/* (space in the file for the object is freed in the 'remove' callback) */
- if(H5B2_remove(hdr->f, dxpl_id, H5HF_BT2_DIR, hdr->huge_bt2_addr,
- &search_rec, H5HF_huge_bt2_dir_remove, &udata) < 0)
+ if(H5B2_remove(hdr->huge_bt2, dxpl_id, &search_rec, H5HF_huge_bt2_dir_remove, &udata) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTREMOVE, FAIL, "can't remove object from B-tree")
} /* end else */
} /* end if */
@@ -921,8 +963,7 @@ H5HF_huge_remove(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id)
/* Remove the record for tracking the 'huge' object from the v2 B-tree */
/* (space in the file for the object is freed in the 'remove' callback) */
- if(H5B2_remove(hdr->f, dxpl_id, H5HF_BT2_FILT_INDIR, hdr->huge_bt2_addr,
- &search_rec, H5HF_huge_bt2_filt_indir_remove, &udata) < 0)
+ if(H5B2_remove(hdr->huge_bt2, dxpl_id, &search_rec, H5HF_huge_bt2_filt_indir_remove, &udata) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTREMOVE, FAIL, "can't remove object from B-tree")
} /* end if */
else {
@@ -933,8 +974,7 @@ H5HF_huge_remove(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id)
/* Remove the record for tracking the 'huge' object from the v2 B-tree */
/* (space in the file for the object is freed in the 'remove' callback) */
- if(H5B2_remove(hdr->f, dxpl_id, H5HF_BT2_INDIR, hdr->huge_bt2_addr,
- &search_rec, H5HF_huge_bt2_indir_remove, &udata) < 0)
+ if(H5B2_remove(hdr->huge_bt2, dxpl_id, &search_rec, H5HF_huge_bt2_indir_remove, &udata) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTREMOVE, FAIL, "can't remove object from B-tree")
} /* end else */
} /* end else */
@@ -977,6 +1017,17 @@ H5HF_huge_term(H5HF_hdr_t *hdr, hid_t dxpl_id)
*/
HDassert(hdr);
+ /* Check if v2 B-tree index is open */
+ if(hdr->huge_bt2) {
+ /* Sanity check */
+ HDassert(H5F_addr_defined(hdr->huge_bt2_addr));
+
+ /* Close v2 B-tree index */
+ if(H5B2_close(hdr->huge_bt2, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree")
+ hdr->huge_bt2 = NULL;
+ } /* end if */
+
/* Check if there are no more 'huge' objects in the heap and delete the
* v2 B-tree that tracks them, if so
*/
@@ -986,7 +1037,7 @@ H5HF_huge_term(H5HF_hdr_t *hdr, hid_t dxpl_id)
/* Delete the v2 B-tree */
/* (any v2 B-tree class will work here) */
- if(H5B2_delete(hdr->f, dxpl_id, H5HF_BT2_INDIR, hdr->huge_bt2_addr, NULL, NULL) < 0)
+ if(H5B2_delete(hdr->f, dxpl_id, hdr->huge_bt2_addr, NULL, NULL) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTDELETE, FAIL, "can't delete v2 B-tree")
/* Reset the information about 'huge' objects in the file */
@@ -1022,6 +1073,7 @@ herr_t
H5HF_huge_delete(H5HF_hdr_t *hdr, hid_t dxpl_id)
{
H5HF_huge_remove_ud1_t udata; /* User callback data for v2 B-tree remove call */
+ H5B2_remove_t op; /* Callback for v2 B-tree removal */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5HF_huge_delete)
@@ -1038,28 +1090,24 @@ H5HF_huge_delete(H5HF_hdr_t *hdr, hid_t dxpl_id)
udata.hdr = hdr;
udata.dxpl_id = dxpl_id;
- /* Delete the v2 B-tree */
+ /* Set the v2 B-tree callback operator */
if(hdr->huge_ids_direct) {
- if(hdr->filter_len > 0) {
- if(H5B2_delete(hdr->f, dxpl_id, H5HF_BT2_FILT_DIR, hdr->huge_bt2_addr, H5HF_huge_bt2_filt_dir_remove, &udata) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTDELETE, FAIL, "can't delete v2 B-tree")
- } /* end if */
- else {
- if(H5B2_delete(hdr->f, dxpl_id, H5HF_BT2_DIR, hdr->huge_bt2_addr, H5HF_huge_bt2_dir_remove, &udata) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTDELETE, FAIL, "can't delete v2 B-tree")
- } /* end else */
+ if(hdr->filter_len > 0)
+ op = H5HF_huge_bt2_filt_dir_remove;
+ else
+ op = H5HF_huge_bt2_dir_remove;
} /* end if */
else {
- if(hdr->filter_len > 0) {
- if(H5B2_delete(hdr->f, dxpl_id, H5HF_BT2_FILT_INDIR, hdr->huge_bt2_addr, H5HF_huge_bt2_filt_indir_remove, &udata) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTDELETE, FAIL, "can't delete v2 B-tree")
- } /* end if */
- else {
- if(H5B2_delete(hdr->f, dxpl_id, H5HF_BT2_INDIR, hdr->huge_bt2_addr, H5HF_huge_bt2_indir_remove, &udata) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTDELETE, FAIL, "can't delete v2 B-tree")
- } /* end else */
+ if(hdr->filter_len > 0)
+ op = H5HF_huge_bt2_filt_indir_remove;
+ else
+ op = H5HF_huge_bt2_indir_remove;
} /* end else */
+ /* Delete the v2 B-tree */
+ if(H5B2_delete(hdr->f, dxpl_id, hdr->huge_bt2_addr, op, &udata) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTDELETE, FAIL, "can't delete v2 B-tree")
+
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5HF_huge_delete() */
diff --git a/src/H5HFman.c b/src/H5HFman.c
index 5bdc769..3fb0cfb 100644
--- a/src/H5HFman.c
+++ b/src/H5HFman.c
@@ -44,6 +44,19 @@
/* Local Macros */
/****************/
+/* Macro to check if we can apply all filters in the pipeline. Use whenever
+ * performing a modification operation */
+ #define H5HF_MAN_WRITE_CHECK_PLINE(HDR) \
+{ \
+ if(!((HDR)->checked_filters)) { \
+ if((HDR)->pline.nused) \
+ if(H5Z_can_apply_direct(&((HDR)->pline)) < 0) \
+ HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "I/O filters can't operate on this heap") \
+ \
+ (HDR)->checked_filters = TRUE; \
+ } /* end if */ \
+}
+
/******************/
/* Local Typedefs */
@@ -116,6 +129,9 @@ HDfprintf(stderr, "%s: obj_size = %Zu\n", FUNC, obj_size);
HDassert(obj);
HDassert(id);
+ /* Check pipeline */
+ H5HF_MAN_WRITE_CHECK_PLINE(hdr)
+
/* 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")
@@ -272,6 +288,9 @@ H5HF_man_op_real(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id,
/* Set the access mode for the direct block */
if(op_flags & H5HF_OP_MODIFY) {
+ /* Check pipeline */
+ H5HF_MAN_WRITE_CHECK_PLINE(hdr)
+
dblock_access = H5AC_WRITE;
dblock_cache_flags = H5AC__DIRTIED_FLAG;
} /* end if */
@@ -533,6 +552,9 @@ H5HF_man_remove(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id)
HDassert(hdr);
HDassert(id);
+ /* Check pipeline */
+ H5HF_MAN_WRITE_CHECK_PLINE(hdr)
+
/* Skip over the flag byte */
id++;
diff --git a/src/H5HFpkg.h b/src/H5HFpkg.h
index 3fe3ad2..dac6d39 100644
--- a/src/H5HFpkg.h
+++ b/src/H5HFpkg.h
@@ -335,25 +335,26 @@ typedef struct H5HF_hdr_t {
/* Cached/computed values (not stored in header) */
size_t rc; /* Reference count of heap's components using heap header */
- hbool_t dirty; /* Shared info is modified */
haddr_t heap_addr; /* Address of heap header in the file */
size_t heap_size; /* Size of heap header in the file */
H5AC_protect_t mode; /* Access mode for heap */
H5F_t *f; /* Pointer to file for heap */
size_t file_rc; /* Reference count of files using heap header */
hbool_t pending_delete; /* Heap is pending deletion */
- size_t sizeof_size; /* Size of file sizes */
- size_t sizeof_addr; /* Size of file addresses */
+ uint8_t sizeof_size; /* Size of file sizes */
+ uint8_t sizeof_addr; /* Size of file addresses */
struct H5HF_indirect_t *root_iblock; /* Pointer to pinned root indirect block */
H5FS_t *fspace; /* Free space list for objects in heap */
H5HF_block_iter_t next_block; /* Block iterator for searching for next block with space */
+ H5B2_t *huge_bt2; /* v2 B-tree handle for huge objects */
hsize_t huge_max_id; /* Max. 'huge' heap ID before rolling 'huge' heap IDs over */
+ uint8_t huge_id_size; /* Size of 'huge' heap IDs (in bytes) */
hbool_t huge_ids_direct; /* Flag to indicate that 'huge' object's offset & length are stored directly in heap ID */
size_t tiny_max_len; /* Max. size of tiny objects for this heap */
hbool_t tiny_len_extended; /* Flag to indicate that 'tiny' object's length is stored in extended form (i.e. w/extra byte) */
- uint8_t huge_id_size; /* Size of 'huge' heap IDs (in bytes) */
- uint8_t heap_off_size; /* Size of heap offsets (in bytes) */
- uint8_t heap_len_size; /* Size of heap ID lengths (in bytes) */
+ uint8_t heap_off_size; /* Size of heap offsets (in bytes) */
+ uint8_t heap_len_size; /* Size of heap ID lengths (in bytes) */
+ hbool_t checked_filters; /* TRUE if pipeline passes can_apply checks */
} H5HF_hdr_t;
/* Common indirect block doubling table entry */
@@ -503,9 +504,6 @@ H5_DLLVAR H5FS_section_class_t H5HF_FSPACE_SECT_CLS_NORMAL_ROW[1];
/* H5HF indirect section inherits serializable properties from H5FS_section_class_t */
H5_DLLVAR H5FS_section_class_t H5HF_FSPACE_SECT_CLS_INDIRECT[1];
-/* Declare a free list to manage the H5HF_hdr_t struct */
-H5FL_EXTERN(H5HF_hdr_t);
-
/* Declare a free list to manage the H5HF_indirect_t struct */
H5FL_EXTERN(H5HF_indirect_t);
@@ -563,6 +561,7 @@ H5_DLL herr_t H5HF_hdr_reverse_iter(H5HF_hdr_t *hdr, hid_t dxpl_id,
haddr_t dblock_addr);
H5_DLL herr_t H5HF_hdr_reset_iter(H5HF_hdr_t *hdr, hsize_t curr_off);
H5_DLL herr_t H5HF_hdr_empty(H5HF_hdr_t *hdr);
+H5_DLL herr_t H5HF_hdr_free(H5HF_hdr_t *hdr);
H5_DLL herr_t H5HF_hdr_delete(H5HF_hdr_t *hdr, hid_t dxpl_id);
/* Indirect block routines */
diff --git a/src/H5HFprivate.h b/src/H5HFprivate.h
index 790f5ea..55daa30 100644
--- a/src/H5HFprivate.h
+++ b/src/H5HFprivate.h
@@ -111,7 +111,7 @@ typedef herr_t (*H5HF_operator_t)(const void *obj/*in*/, size_t obj_len,
H5_DLL H5HF_t *H5HF_create(H5F_t *f, hid_t dxpl_id, const H5HF_create_t *cparam);
H5_DLL H5HF_t *H5HF_open(H5F_t *f, hid_t dxpl_id, haddr_t fh_addr);
H5_DLL herr_t H5HF_get_id_len(H5HF_t *fh, size_t *id_len_p/*out*/);
-H5_DLL herr_t H5HF_get_heap_addr(H5HF_t *fh, haddr_t *heap_addr/*out*/);
+H5_DLL herr_t H5HF_get_heap_addr(const H5HF_t *fh, haddr_t *heap_addr/*out*/);
H5_DLL herr_t H5HF_insert(H5HF_t *fh, hid_t dxpl_id, size_t size,
const void *obj, void *id/*out*/);
H5_DLL herr_t H5HF_get_obj_len(H5HF_t *fh, hid_t dxpl_id, const void *id,
diff --git a/src/H5HFstat.c b/src/H5HFstat.c
index 8d6b2ba..fb535b9 100644
--- a/src/H5HFstat.c
+++ b/src/H5HFstat.c
@@ -126,9 +126,10 @@ H5HF_stat_info(const H5HF_t *fh, H5HF_stat_t *stats)
herr_t
H5HF_size(const H5HF_t *fh, hid_t dxpl_id, hsize_t *heap_size)
{
- H5HF_hdr_t *hdr; /* Fractal heap header */
- herr_t ret_value = SUCCEED; /* Return value */
- hsize_t meta_size = 0; /* free space storage size */
+ H5HF_hdr_t *hdr; /* Fractal heap header */
+ H5B2_t *bt2 = NULL; /* v2 B-tree handle for index */
+ hsize_t meta_size = 0; /* free space storage size */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5HF_size, FAIL)
@@ -151,35 +152,29 @@ H5HF_size(const H5HF_t *fh, hid_t dxpl_id, hsize_t *heap_size)
if(H5HF_man_iblock_size(hdr->f, dxpl_id, hdr, hdr->man_dtable.table_addr, hdr->man_dtable.curr_root_rows, NULL, 0, heap_size) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "unable to get fractal heap storage info for indirect block")
- /* Get B-tree storage for huge objects in fractal heap */
+ /* Check for B-tree storage of huge objects in fractal heap */
if(H5F_addr_defined(hdr->huge_bt2_addr)) {
- const H5B2_class_t *huge_bt2_class; /* Class for huge v2 B-tree */
-
- /* Determine the class of the huge v2 B-tree */
- if(hdr->huge_ids_direct)
- if(hdr->filter_len > 0)
- huge_bt2_class = H5HF_BT2_FILT_DIR;
- else
- huge_bt2_class = H5HF_BT2_DIR;
- else
- if(hdr->filter_len > 0)
- huge_bt2_class = H5HF_BT2_FILT_INDIR;
- else
- huge_bt2_class = H5HF_BT2_INDIR;
-
- /* Get the B-tree storage for the appropriate class */
- if(H5B2_iterate_size(hdr->f, dxpl_id, huge_bt2_class, hdr->huge_bt2_addr, heap_size) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree storage info")
+ /* Open the huge object index v2 B-tree */
+ if(NULL == (bt2 = H5B2_open(hdr->f, dxpl_id, hdr->huge_bt2_addr)))
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for tracking 'huge' objects")
+
+ /* Get the B-tree storage */
+ if(H5B2_size(bt2, dxpl_id, heap_size) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't retrieve B-tree storage info")
} /* end if */
/* Get storage for free-space tracking info */
if(H5F_addr_defined(hdr->fs_addr)) {
if(H5HF_space_size(hdr, dxpl_id, &meta_size) < 0)
- HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't retrieve FS meta storage info")
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't retrieve FS meta storage info")
*heap_size += meta_size;
- }
+ } /* end if */
done:
+ /* Release resources */
+ if(bt2 && H5B2_close(bt2, dxpl_id) < 0)
+ HDONE_ERROR(H5E_HEAP, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for tracking 'huge' objects")
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5HF_size() */
diff --git a/src/H5HFtest.c b/src/H5HFtest.c
index ab42735..30adf96 100644
--- a/src/H5HFtest.c
+++ b/src/H5HFtest.c
@@ -124,7 +124,7 @@ H5HF_get_cparam_test(const H5HF_t *fh, H5HF_create_t *cparam)
int
H5HF_cmp_cparam_test(const H5HF_create_t *cparam1, const H5HF_create_t *cparam2)
{
- int ret_value; /* Return value */
+ int ret_value = 0; /* Return value */
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_cmp_cparam_test)
@@ -133,8 +133,26 @@ H5HF_cmp_cparam_test(const H5HF_create_t *cparam1, const H5HF_create_t *cparam2)
HDassert(cparam2);
/* Compare doubling table parameters */
- if((ret_value = HDmemcmp(&(cparam1->managed), &(cparam2->managed), sizeof(H5HF_dtable_cparam_t))))
- HGOTO_DONE(ret_value)
+ if(cparam1->managed.width < cparam2->managed.width)
+ HGOTO_DONE(-1)
+ else if(cparam1->managed.width > cparam2->managed.width)
+ HGOTO_DONE(1)
+ if(cparam1->managed.start_block_size < cparam2->managed.start_block_size)
+ HGOTO_DONE(-1)
+ else if(cparam1->managed.start_block_size > cparam2->managed.start_block_size)
+ HGOTO_DONE(1)
+ if(cparam1->managed.max_direct_size < cparam2->managed.max_direct_size)
+ HGOTO_DONE(-1)
+ else if(cparam1->managed.max_direct_size > cparam2->managed.max_direct_size)
+ HGOTO_DONE(1)
+ if(cparam1->managed.max_index < cparam2->managed.max_index)
+ HGOTO_DONE(-1)
+ else if(cparam1->managed.max_index > cparam2->managed.max_index)
+ HGOTO_DONE(1)
+ if(cparam1->managed.start_root_rows < cparam2->managed.start_root_rows)
+ HGOTO_DONE(-1)
+ else if(cparam1->managed.start_root_rows > cparam2->managed.start_root_rows)
+ HGOTO_DONE(1)
/* Compare other general parameters for heap */
if(cparam1->max_man_size < cparam2->max_man_size)
diff --git a/src/H5HG.c b/src/H5HG.c
index bb5e664..520f2eb 100644
--- a/src/H5HG.c
+++ b/src/H5HG.c
@@ -310,7 +310,7 @@ H5HG_alloc (H5F_t *f, H5HG_heap_t *heap, size_t size, unsigned * heap_flags_ptr)
* Find an ID for the new object. ID zero is reserved for the free space
* object.
*/
- if(heap->nused<H5HG_MAXIDX)
+ if(heap->nused<=H5HG_MAXIDX)
idx=heap->nused++;
else {
for (idx=1; idx<heap->nused; idx++)
@@ -326,17 +326,21 @@ H5HG_alloc (H5F_t *f, H5HG_heap_t *heap, size_t size, unsigned * heap_flags_ptr)
H5HG_obj_t *new_obj; /* New array of object descriptions */
/* Determine the new number of objects to index */
- new_alloc=MAX(heap->nalloc*2,(idx+1));
- assert(new_alloc<=(H5HG_MAXIDX+1));
+ /* nalloc is *not* guaranteed to be a power of 2! - NAF 10/26/09 */
+ new_alloc = MIN(MAX(heap->nalloc * 2, (idx + 1)), (H5HG_MAXIDX + 1));
+ HDassert(idx < new_alloc);
/* Reallocate array of objects */
if (NULL==(new_obj = H5FL_SEQ_REALLOC (H5HG_obj_t, heap->obj, new_alloc)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed")
+ /* Clear newly allocated space */
+ HDmemset(&new_obj[heap->nalloc], 0, (new_alloc - heap->nalloc) * sizeof(heap->obj[0]));
+
/* Update heap information */
heap->nalloc=new_alloc;
heap->obj=new_obj;
- assert(heap->nalloc>heap->nused);
+ HDassert(heap->nalloc>heap->nused);
} /* end if */
/* Initialize the new object */
diff --git a/src/H5HGcache.c b/src/H5HGcache.c
index f3d0f3a..ee318aa 100644
--- a/src/H5HGcache.c
+++ b/src/H5HGcache.c
@@ -171,11 +171,12 @@ H5HG_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * udata1,
/* Decode each object */
p = heap->chunk + H5HG_SIZEOF_HDR(f);
nalloc = H5HG_NOBJS(f, heap->size);
- if(NULL == (heap->obj = H5FL_SEQ_MALLOC(H5HG_obj_t, nalloc)))
+
+ /* Calloc the obj array because the file format spec makes no guarantee
+ * about the order of the objects, and unused slots must be set to zero.
+ */
+ if(NULL == (heap->obj = H5FL_SEQ_CALLOC(H5HG_obj_t, nalloc)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- heap->obj[0].nrefs = 0;
- heap->obj[0].size = 0;
- heap->obj[0].begin = NULL;
heap->nalloc = nalloc;
while(p < (heap->chunk + heap->size)) {
@@ -202,14 +203,19 @@ H5HG_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * udata1,
/* Determine the new number of objects to index */
new_alloc = MAX(heap->nalloc * 2, (idx + 1));
+ HDassert(idx < new_alloc);
/* Reallocate array of objects */
if(NULL == (new_obj = H5FL_SEQ_REALLOC(H5HG_obj_t, heap->obj, new_alloc)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ /* Clear newly allocated space */
+ HDmemset(&new_obj[heap->nalloc], 0, (new_alloc - heap->nalloc) * sizeof(heap->obj[0]));
+
/* Update heap information */
heap->nalloc = new_alloc;
heap->obj = new_obj;
+ HDassert(heap->nalloc>heap->nused);
} /* end if */
UINT16DECODE(p, heap->obj[idx].nrefs);
@@ -220,16 +226,16 @@ H5HG_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * udata1,
/*
* The total storage size includes the size of the object header
* and is zero padded so the next object header is properly
- * aligned. The last bit of space is the free space object whose
- * size is never padded and already includes the object header.
+ * aligned. The entire obj array was calloc'ed, so no need to zero
+ * the space here. The last bit of space is the free space object
+ * whose size is never padded and already includes the object
+ * header.
*/
if(idx > 0) {
need = H5HG_SIZEOF_OBJHDR(f) + H5HG_ALIGN(heap->obj[idx].size);
- /* Check for "gap" in index numbers (caused by deletions) and fill in heap object values */
- if(idx > (max_idx + 1))
- HDmemset(&heap->obj[max_idx + 1], 0, sizeof(H5HG_obj_t) * (idx - (max_idx + 1)));
- max_idx = idx;
+ if(idx > max_idx)
+ max_idx = idx;
} /* end if */
else
need = heap->obj[idx].size;
diff --git a/src/H5HGdbg.c b/src/H5HGdbg.c
index 7030da5..bda9832 100644
--- a/src/H5HGdbg.c
+++ b/src/H5HGdbg.c
@@ -93,7 +93,10 @@ H5HG_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent,
fprintf (stream, "%*s%-*s %u/%lu/", indent, "", fwidth,
"Objects defined/allocated/max:",
nused, (unsigned long)h->nalloc);
- fprintf (stream, nused ? "%u\n": "NA\n", maxobj);
+ if(nused)
+ fprintf(stream, "%u\n", maxobj);
+ else
+ fprintf(stream, "NA\n");
fprintf (stream, "%*s%-*s %lu\n", indent, "", fwidth,
"Free space:",
diff --git a/src/H5L.c b/src/H5L.c
index 0de2e10..b217abe 100644
--- a/src/H5L.c
+++ b/src/H5L.c
@@ -716,7 +716,7 @@ H5Lget_val(hid_t loc_id, const char *name, void *buf/*out*/, size_t size,
/* Get the link value */
if(H5L_get_val(&loc, name, buf, size, lapl_id, H5AC_ind_dxpl_id) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to get link value")
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to get link value for '%s'", name)
done:
FUNC_LEAVE_API(ret_value)
@@ -2120,7 +2120,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5L_get_val_cb(H5G_loc_t UNUSED *grp_loc/*in*/, const char UNUSED *name, const H5O_link_t *lnk,
+H5L_get_val_cb(H5G_loc_t UNUSED *grp_loc/*in*/, const char *name, const H5O_link_t *lnk,
H5G_loc_t UNUSED *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/)
{
H5L_trav_gv_t *udata = (H5L_trav_gv_t *)_udata; /* User data passed in */
@@ -2130,7 +2130,7 @@ H5L_get_val_cb(H5G_loc_t UNUSED *grp_loc/*in*/, const char UNUSED *name, const H
/* Check if the name in this group resolved to a valid link */
if(lnk == NULL)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "name doesn't exist")
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "'%s' doesn't exist", name)
/* Retrieve the value for the link */
if(H5L_get_val_real(lnk, udata->buf, udata->size) < 0)
diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c
index 57414c7..640ac07 100644
--- a/src/H5Lexternal.c
+++ b/src/H5Lexternal.c
@@ -514,6 +514,7 @@ H5Lcreate_external(const char *file_name, const char *obj_name,
hid_t link_loc_id, const char *link_name, hid_t lcpl_id, hid_t lapl_id)
{
H5G_loc_t link_loc; /* Group location to create link */
+ char *norm_obj_name = NULL; /* Pointer to normalized current name */
void *ext_link_buf = NULL; /* Buffer to contain external link */
size_t buf_size; /* Size of buffer to hold external link */
uint8_t *p; /* Pointer into external link buffer */
@@ -533,8 +534,12 @@ H5Lcreate_external(const char *file_name, const char *obj_name,
if(!link_name || !*link_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no link name specified")
+ /* Get normalized copy of the link target */
+ if(NULL == (norm_obj_name = H5G_normalize(obj_name)))
+ HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "can't normalize object name")
+
/* Combine the filename and link name into a single buffer to give to the UD link */
- buf_size = 1 + (HDstrlen(file_name) + 1) + (HDstrlen(obj_name) + 1);
+ buf_size = 1 + (HDstrlen(file_name) + 1) + (HDstrlen(norm_obj_name) + 1);
if(NULL == (ext_link_buf = H5MM_malloc(buf_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate udata buffer")
@@ -543,14 +548,14 @@ H5Lcreate_external(const char *file_name, const char *obj_name,
*p++ = (H5L_EXT_VERSION << 4) | H5L_EXT_FLAGS_ALL; /* External link version & flags */
HDstrcpy((char *)p, file_name); /* Name of file containing external link's object */
p += HDstrlen(file_name) + 1;
- HDstrcpy((char *)p, obj_name); /* External link's object */
+ HDstrcpy((char *)p, norm_obj_name); /* External link's object */
/* Create an external link */
if(H5L_create_ud(&link_loc, link_name, ext_link_buf, buf_size, H5L_TYPE_EXTERNAL, lcpl_id, lapl_id, H5AC_dxpl_id) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link")
done:
- if(ext_link_buf != NULL)
+ if(norm_obj_name)
H5MM_free(ext_link_buf);
FUNC_LEAVE_API(ret_value)
diff --git a/src/H5MF.c b/src/H5MF.c
index b59af88..0129c1d 100644
--- a/src/H5MF.c
+++ b/src/H5MF.c
@@ -65,6 +65,13 @@ typedef enum {
H5MF_AGGR_MERGE_TOGETHER /* Metadata & raw data in one free list */
} H5MF_aggr_merge_t;
+/* User data for section info iterator callback for iterating over free space sections */
+typedef struct {
+ H5F_sect_info_t *sects; /* section info to be retrieved */
+ size_t sect_count; /* # of sections requested */
+ size_t sect_idx; /* the current count of sections */
+} H5MF_sect_iter_ud_t;
+
/********************/
/* Package Typedefs */
@@ -628,6 +635,12 @@ HDfprintf(stderr, "%s: Trying to avoid starting up free space manager\n", FUNC);
else if(status > 0)
/* Indicate success */
HGOTO_DONE(SUCCEED)
+ else if(size < f->shared->fs_threshold) {
+#ifdef H5MF_ALLOC_DEBUG_MORE
+HDfprintf(stderr, "%s: dropping addr = %a, size = %Hu, on the floor!\n", FUNC, addr, size);
+#endif /* H5MF_ALLOC_DEBUG_MORE */
+ HGOTO_DONE(SUCCEED)
+ }
} /* end if */
/* If we are deleting the free space manager, leave now, to avoid
@@ -654,7 +667,6 @@ HDfprintf(stderr, "%s: dropping addr = %a, size = %Hu, on the floor!\n", FUNC, a
if(H5MF_alloc_start(f, dxpl_id, fs_type) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize file free space")
} /* end if */
- HDassert(f->shared->fs_man[fs_type]);
/* Create free space section for block */
if(NULL == (node = H5MF_sect_simple_new(addr, size)))
@@ -666,16 +678,31 @@ HDfprintf(stderr, "%s: dropping addr = %a, size = %Hu, on the floor!\n", FUNC, a
udata.alloc_type = alloc_type;
udata.allow_sect_absorb = TRUE;
- /* Add to the free space for the file */
+ /* If size of section freed is larger than threshold, add it to the free space manager */
+ if(size >= f->shared->fs_threshold) {
+ HDassert(f->shared->fs_man[fs_type]);
+
#ifdef H5MF_ALLOC_DEBUG_MORE
HDfprintf(stderr, "%s: Before H5FS_sect_add()\n", FUNC);
#endif /* H5MF_ALLOC_DEBUG_MORE */
- if(H5FS_sect_add(f, dxpl_id, f->shared->fs_man[fs_type], (H5FS_section_info_t *)node, H5FS_ADD_RETURNED_SPACE, &udata) < 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINSERT, FAIL, "can't add section to file free space")
- node = NULL;
+ /* Add to the free space for the file */
+ if(H5FS_sect_add(f, dxpl_id, f->shared->fs_man[fs_type], (H5FS_section_info_t *)node, H5FS_ADD_RETURNED_SPACE, &udata) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINSERT, FAIL, "can't add section to file free space")
+ node = NULL;
#ifdef H5MF_ALLOC_DEBUG_MORE
HDfprintf(stderr, "%s: After H5FS_sect_add()\n", FUNC);
#endif /* H5MF_ALLOC_DEBUG_MORE */
+ } /* end if */
+ else {
+ htri_t merged; /* Whether node was merged */
+
+ /* Try to merge the section that is smaller than threshold */
+ if((merged = H5FS_sect_try_merge(f, dxpl_id, f->shared->fs_man[fs_type], (H5FS_section_info_t *)node, H5FS_ADD_RETURNED_SPACE, &udata)) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINSERT, FAIL, "can't merge section to file free space")
+ else if(merged == TRUE) /* successfully merged */
+ /* Indicate that the node was used */
+ node = NULL;
+ } /* end else */
done:
/* Release section node, if allocated and not added to section list or merged */
@@ -970,55 +997,147 @@ HDfprintf(stderr, "%s: Entering\n", FUNC);
if(H5MF_free_aggrs(f, dxpl_id) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTFREE, FAIL, "can't free aggregators")
- /* Iterate over all the free space types that have managers and get each free list's space */
- for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) {
+ /* Making free-space managers persistent for superblock version >= 2 */
+ if(f->shared->sblock->super_vers >= HDF5_SUPERBLOCK_VERSION_2
+ && f->shared->fs_strategy == H5F_FILE_SPACE_ALL_PERSIST) {
+ H5O_fsinfo_t fsinfo; /* Free space manager info message */
+ hbool_t update = FALSE; /* To update info for the message */
+
+ /* Check to remove free-space manager info message from superblock extension */
+ if(H5F_addr_defined(f->shared->sblock->ext_addr))
+ if(H5F_super_ext_remove_msg(f, dxpl_id, H5O_FSINFO_ID) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "error in removing message from superblock extension")
+
+ /* Free free-space manager header and/or section info header */
+ for(type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) {
+ H5FS_stat_t fs_stat; /* Information for free-space manager */
+
+ /* Check for free space manager of this type */
+ if(f->shared->fs_man[type]) {
+ /* Switch to "about to be deleted" state */
+ f->shared->fs_state[type] = H5F_FS_STATE_DELETING;
+
+ /* Query the free space manager's information */
+ if(H5FS_stat_info(f, f->shared->fs_man[type], &fs_stat) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't get free-space info")
+
+ /* Check if the free space manager has space in the file */
+ if(H5F_addr_defined(fs_stat.addr) || H5F_addr_defined(fs_stat.sect_addr)) {
+ /* Delete the free space manager in the file */
+ /* (will re-allocate later) */
+ if(H5FS_free(f, f->shared->fs_man[type], dxpl_id) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't release free-space headers")
+ f->shared->fs_addr[type] = HADDR_UNDEF;
+ } /* end if */
+ } /* end iif */
+ fsinfo.fs_addr[type-1] = HADDR_UNDEF;
+ } /* end for */
+
+ fsinfo.strategy = f->shared->fs_strategy;
+ fsinfo.threshold = f->shared->fs_threshold;
+
+ /* Write free-space manager info message to superblock extension object header */
+ /* Create the superblock extension object header in advance if needed */
+ if(H5F_super_ext_write_msg(f, dxpl_id, &fsinfo, H5O_FSINFO_ID, TRUE) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_WRITEERROR, FAIL, "error in writing message to superblock extension")
+
+ /* Re-allocate free-space manager header and/or section info header */
+ for(type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) {
+ H5FS_stat_t fs_stat; /* Information for free-space manager */
+
+ /* Check for active free space manager of this type */
+ if(f->shared->fs_man[type]) {
+ /* Re-query free space manager info for this type */
+ if(H5FS_stat_info(f, f->shared->fs_man[type], &fs_stat) < 0)
+ HGOTO_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't get free-space info")
+
+ /* Are there sections to persist? */
+ if(fs_stat.serial_sect_count) {
+ /* Allocate space for free-space manager header */
+ if(H5FS_alloc_hdr(f, f->shared->fs_man[type], &f->shared->fs_addr[type], dxpl_id) < 0)
+ HGOTO_ERROR(H5E_FSPACE, H5E_NOSPACE, FAIL, "can't allocated free-space header")
+
+ /* Allocate space for free-space maanger section info header */
+ if(H5FS_alloc_sect(f, f->shared->fs_man[type], dxpl_id) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate free-space section info")
+
+ HDassert(f->shared->fs_addr[type]);
+ fsinfo.fs_addr[type-1] = f->shared->fs_addr[type];
+ update = TRUE;
+ } /* end if */
+ } else if(H5F_addr_defined(f->shared->fs_addr[type])) {
+ fsinfo.fs_addr[type-1] = f->shared->fs_addr[type];
+ update = TRUE;
+ } /* end else-if */
+ } /* end for */
+
+ /* Update the free space manager info message in superblock extension object header */
+ if(update)
+ if(H5F_super_ext_write_msg(f, dxpl_id, &fsinfo, H5O_FSINFO_ID, FALSE) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_WRITEERROR, FAIL, "error in writing message to superblock extension")
+
+ /* Final close of free-space managers */
+ for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) {
+ if(f->shared->fs_man[type]) {
+ if(H5FS_close(f, dxpl_id, f->shared->fs_man[type]) < 0)
+ HGOTO_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't close free space manager")
+ f->shared->fs_man[type] = NULL;
+ f->shared->fs_state[type] = H5F_FS_STATE_CLOSED;
+ } /* end if */
+ f->shared->fs_addr[type] = HADDR_UNDEF;
+ } /* end for */
+ } /* end if */
+ else { /* super_vers can be 0, 1, 2 */
+ /* Iterate over all the free space types that have managers and get each free list's space */
+ for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) {
#ifdef H5MF_ALLOC_DEBUG_MORE
HDfprintf(stderr, "%s: Check 1.0 - f->shared->fs_man[%u] = %p, f->shared->fs_addr[%u] = %a\n", FUNC, (unsigned)type, f->shared->fs_man[type], (unsigned)type, f->shared->fs_addr[type]);
#endif /* H5MF_ALLOC_DEBUG_MORE */
- /* If the free space manager for this type is open, close it */
- if(f->shared->fs_man[type]) {
+ /* If the free space manager for this type is open, close it */
+ if(f->shared->fs_man[type]) {
#ifdef H5MF_ALLOC_DEBUG_MORE
HDfprintf(stderr, "%s: Before closing free space manager\n", FUNC);
#endif /* H5MF_ALLOC_DEBUG_MORE */
- if(H5FS_close(f, dxpl_id, f->shared->fs_man[type]) < 0)
- HGOTO_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release free space info")
- f->shared->fs_man[type] = NULL;
- f->shared->fs_state[type] = H5F_FS_STATE_CLOSED;
- } /* end if */
+ if(H5FS_close(f, dxpl_id, f->shared->fs_man[type]) < 0)
+ HGOTO_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release free space info")
+ f->shared->fs_man[type] = NULL;
+ f->shared->fs_state[type] = H5F_FS_STATE_CLOSED;
+ } /* end if */
#ifdef H5MF_ALLOC_DEBUG_MORE
HDfprintf(stderr, "%s: Check 2.0 - f->shared->fs_man[%u] = %p, f->shared->fs_addr[%u] = %a\n", FUNC, (unsigned)type, f->shared->fs_man[type], (unsigned)type, f->shared->fs_addr[type]);
#endif /* H5MF_ALLOC_DEBUG_MORE */
- /* If there is free space manager info for this type, delete it */
- /* (XXX: Make this optional when free space for a file can be persistant) */
- if(H5F_addr_defined(f->shared->fs_addr[type])) {
- haddr_t tmp_fs_addr; /* Temporary holder for free space manager address */
+ /* If there is free space manager info for this type, delete it */
+ if(H5F_addr_defined(f->shared->fs_addr[type])) {
+ haddr_t tmp_fs_addr; /* Temporary holder for free space manager address */
- /* Put address into temporary variable and reset it */
- /* (Avoids loopback in file space freeing routine) */
- tmp_fs_addr = f->shared->fs_addr[type];
- f->shared->fs_addr[type] = HADDR_UNDEF;
+ /* Put address into temporary variable and reset it */
+ /* (Avoids loopback in file space freeing routine) */
+ tmp_fs_addr = f->shared->fs_addr[type];
+ f->shared->fs_addr[type] = HADDR_UNDEF;
- /* Shift to "deleting" state, to make certain we don't track any
- * file space freed as a result of deleting the free space manager.
- */
- f->shared->fs_state[type] = H5F_FS_STATE_DELETING;
+ /* Shift to "deleting" state, to make certain we don't track any
+ * file space freed as a result of deleting the free space manager.
+ */
+ f->shared->fs_state[type] = H5F_FS_STATE_DELETING;
#ifdef H5MF_ALLOC_DEBUG_MORE
HDfprintf(stderr, "%s: Before deleting free space manager\n", FUNC);
#endif /* H5MF_ALLOC_DEBUG_MORE */
- /* Delete free space manager for this type */
- if(H5FS_delete(f, dxpl_id, tmp_fs_addr) < 0)
- HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "can't delete free space manager")
- /* Shift [back] to closed state */
- HDassert(f->shared->fs_state[type] == H5F_FS_STATE_DELETING);
- f->shared->fs_state[type] = H5F_FS_STATE_CLOSED;
+ /* Delete free space manager for this type */
+ if(H5FS_delete(f, dxpl_id, tmp_fs_addr) < 0)
+ HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "can't delete free space manager")
- /* Sanity check that the free space manager for this type wasn't started up again */
- HDassert(!H5F_addr_defined(f->shared->fs_addr[type]));
- } /* end if */
- } /* end for */
+ /* Shift [back] to closed state */
+ HDassert(f->shared->fs_state[type] == H5F_FS_STATE_DELETING);
+ f->shared->fs_state[type] = H5F_FS_STATE_CLOSED;
+
+ /* Sanity check that the free space manager for this type wasn't started up again */
+ HDassert(!H5F_addr_defined(f->shared->fs_addr[type]));
+ } /* end if */
+ } /* end for */
+ } /* end else */
/* Free the space in aggregators (again) */
/* (in case any free space information re-started them) */
@@ -1032,3 +1151,126 @@ HDfprintf(stderr, "%s: Leaving\n", FUNC);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5MF_close() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5MF_sects_cb()
+ *
+ * Purpose: Iterator callback for each free-space section
+ * Retrieve address and size into user data
+ *
+ * Return: Always succeed
+ *
+ * Programmer: Vailin Choi
+ * July 1st, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5MF_sects_cb(const H5FS_section_info_t *_sect, void *_udata)
+{
+ const H5MF_free_section_t *sect = (const H5MF_free_section_t *)_sect;
+ H5MF_sect_iter_ud_t *udata = (H5MF_sect_iter_ud_t *)_udata;
+
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5MF_sects_cb)
+
+ if(udata->sect_idx < udata->sect_count) {
+ udata->sects[udata->sect_idx].addr = sect->sect_info.addr;
+ udata->sects[udata->sect_idx].size = sect->sect_info.size;
+ udata->sect_idx++;
+ } /* end if */
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* H5MF_sects_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5MF_get_free_sections()
+ *
+ * Purpose: To iterate over one or all free-space managers for:
+ * # of sections
+ * section info as defined in H5F_sect_info_t
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Vailin Choi
+ * July 1st, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+ssize_t
+H5MF_get_free_sections(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, size_t nsects, H5F_sect_info_t *sect_info)
+{
+ size_t total_sects = 0; /* total number of sections */
+ H5MF_sect_iter_ud_t sect_udata; /* User data for callback */
+ H5FD_mem_t start_type, end_type; /* Memory types to iterate over */
+ H5FD_mem_t ty; /* Memory type for iteration */
+ ssize_t ret_value; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5MF_get_free_sections, FAIL)
+
+ /* check args */
+ HDassert(f);
+ HDassert(f->shared);
+ HDassert(f->shared->lf);
+
+ /* Determine start/end points for loop */
+ if(type == H5FD_MEM_DEFAULT) {
+ start_type = H5FD_MEM_SUPER;
+ end_type = H5FD_MEM_NTYPES;
+ } /* end if */
+ else {
+ start_type = end_type = type;
+ H5_INC_ENUM(H5FD_mem_t, end_type);
+ } /* end else */
+
+ /* Set up user data for section iteration */
+ sect_udata.sects = sect_info;
+ sect_udata.sect_count = nsects;
+ sect_udata.sect_idx = 0;
+
+ /* Iterate over memory types, retrieving the number of sections of each type */
+ for(ty = start_type; ty < end_type; H5_INC_ENUM(H5FD_mem_t, ty)) {
+ hbool_t fs_started = FALSE;
+
+ /* Open free space manager of this type, if it isn't already */
+ if(!f->shared->fs_man[ty] && H5F_addr_defined(f->shared->fs_addr[ty])) {
+ if(H5MF_alloc_open(f, dxpl_id, ty) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTOPENOBJ, FAIL, "can't initialize file free space")
+ HDassert(f->shared->fs_man[ty]);
+ fs_started = TRUE;
+ } /* end if */
+
+ /* Check if f there's free space sections of this type */
+ if(f->shared->fs_man[ty]) {
+ hsize_t hnums = 0; /* Total # of sections */
+ size_t nums; /* Total # of sections, cast to a size_t */
+
+ /* Query how many sections of this type */
+ if(H5FS_sect_stats(f->shared->fs_man[ty], NULL, &hnums) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't query free space stats")
+ H5_ASSIGN_OVERFLOW(nums, hnums, hsize_t, size_t);
+
+ /* Increment total # of sections */
+ total_sects += nums;
+
+ /* Check if we should retrieve the section info */
+ if(sect_info && nums > 0) {
+ /* Iterate over all the free space sections of this type, adding them to the user's section info */
+ if(H5FS_sect_iterate(f, dxpl_id, f->shared->fs_man[ty], H5MF_sects_cb, &sect_udata) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_BADITER, FAIL, "can't iterate over sections")
+ } /* end if */
+ } /* end if */
+
+ /* Close the free space manager of this type, if we started it here */
+ if(fs_started)
+ if(H5MF_alloc_close(f, dxpl_id, ty) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTCLOSEOBJ, FAIL, "can't close file free space")
+ } /* end for */
+
+ /* Set return value */
+ ret_value = (ssize_t)total_sects;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5MF_get_free_sections() */
+
diff --git a/src/H5MFaggr.c b/src/H5MFaggr.c
index aa982da..db13408 100644
--- a/src/H5MFaggr.c
+++ b/src/H5MFaggr.c
@@ -177,11 +177,11 @@ HDfprintf(stderr, "%s: type = %u, size = %Hu\n", FUNC, (unsigned)type, size);
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, HADDR_UNDEF, "Unable to get eoa")
/*
- * If the aggregation feature is enabled for this file, allocate "generic"
- * space and sub-allocate out of that, if possible. Otherwise just allocate
- * through H5FD_alloc()
+ * If the aggregation feature is enabled for this file and strategy is not H5F_FILE_SPACE_VFD,
+ * allocate "generic" space and sub-allocate out of that, if possible.
+ * Otherwise just allocate through H5FD_alloc().
*/
- if(f->shared->feature_flags & aggr->feature_flag) {
+ if((f->shared->feature_flags & aggr->feature_flag) && f->shared->fs_strategy != H5F_FILE_SPACE_VFD) {
haddr_t aggr_frag_addr = HADDR_UNDEF; /* Address of aggregrator fragment */
hsize_t aggr_frag_size = 0; /* Size of aggregator fragment */
hsize_t alignment; /* Alignment of this section */
diff --git a/src/H5MFdbg.c b/src/H5MFdbg.c
index ca87c83..31cff15 100644
--- a/src/H5MFdbg.c
+++ b/src/H5MFdbg.c
@@ -41,7 +41,6 @@
#include "H5Fpkg.h" /* File access */
#include "H5MFpkg.h" /* File memory management */
-#ifdef H5MF_ALLOC_DEBUG_DUMP
/****************/
/* Local Macros */
@@ -139,6 +138,67 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5MF_sects_debug_cb() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5MF_sects_debug
+ *
+ * Purpose: Iterate over free space sections for a file
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * January 31 2008
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5MF_sects_debug(H5F_t *f, hid_t dxpl_id, haddr_t fs_addr, FILE *stream, int indent, int fwidth)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+ H5FD_mem_t type; /* Memory type for iteration */
+
+ FUNC_ENTER_NOAPI(H5MF_sects_debug, FAIL)
+
+ /*
+ * Check arguments.
+ */
+ HDassert(f);
+ HDassert(stream);
+ HDassert(indent >= 0);
+ HDassert(fwidth >= 0);
+
+ for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type))
+ if(H5F_addr_eq(f->shared->fs_addr[type], fs_addr)) {
+ if(!f->shared->fs_man[type])
+ if(H5MF_alloc_open(f, dxpl_id, type) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize file free space")
+
+ if(f->shared->fs_man[type]) {
+ H5MF_debug_iter_ud_t udata; /* User data for callbacks */
+
+ /* Prepare user data for section iteration callback */
+ udata.fspace = f->shared->fs_man[type];
+ udata.stream = stream;
+ udata.indent = indent;
+ udata.fwidth = fwidth;
+
+ /* Iterate over all the free space sections */
+ if(H5FS_sect_iterate(f, dxpl_id, f->shared->fs_man[type], H5MF_sects_debug_cb, &udata) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_BADITER, FAIL, "can't iterate over heap's free space")
+
+ /* Close the free space information */
+ if(H5FS_close(f, dxpl_id, f->shared->fs_man[type]) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't release free space info")
+ } /* end if */
+ break;
+ }
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5MF_sects_debug() */
+
+#ifdef H5MF_ALLOC_DEBUG_DUMP
/*-------------------------------------------------------------------------
* Function: H5MF_sects_dump
diff --git a/src/H5MFprivate.h b/src/H5MFprivate.h
index 3f2a427..b471aa3 100644
--- a/src/H5MFprivate.h
+++ b/src/H5MFprivate.h
@@ -73,6 +73,8 @@ H5_DLL herr_t H5MF_try_extend(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type,
haddr_t addr, hsize_t size, hsize_t extra_requested);
H5_DLL htri_t H5MF_try_shrink(H5F_t *f, H5FD_mem_t alloc_type, hid_t dxpl_id,
haddr_t addr, hsize_t size);
+H5_DLL ssize_t H5MF_get_free_sections(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type,
+ size_t nsects, H5F_sect_info_t *sect_info);
/* File 'temporary' space allocation routines */
H5_DLL haddr_t H5MF_alloc_tmp(H5F_t *f, hsize_t size);
@@ -82,10 +84,8 @@ H5_DLL herr_t H5MF_free_aggrs(H5F_t *f, hid_t dxpl_id);
/* Debugging routines */
#ifdef H5MF_DEBUGGING
-#ifdef NOT_YET
H5_DLL herr_t H5MF_sects_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr,
FILE *stream, int indent, int fwidth);
-#endif /* NOT_YET */
#endif /* H5MF_DEBUGGING */
#endif /* end _H5MFprivate_H */
diff --git a/src/H5O.c b/src/H5O.c
index 93ded20..1d70f09 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -84,6 +84,7 @@ static herr_t H5O_obj_type_real(H5O_t *oh, H5O_type_t *obj_type);
static herr_t H5O_visit(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
H5_iter_order_t order, H5O_iterate_t op, void *op_data, hid_t lapl_id,
hid_t dxpl_id);
+static herr_t H5O_get_hdr_info_real(const H5O_t *oh, H5O_hdr_info_t *hdr);
/*********************/
@@ -124,20 +125,9 @@ const H5O_msg_class_t *const H5O_msg_class_g[] = {
H5O_MSG_DRVINFO, /*0x0014 Driver info settings */
H5O_MSG_AINFO, /*0x0015 Attribute information */
H5O_MSG_REFCOUNT, /*0x0016 Object's ref. count */
- H5O_MSG_UNKNOWN, /*0x0017 Placeholder for unknown message */
- H5O_MSG_STORAGE, /*0x0018 Placeholder for unknown message */
-};
-
-/* Header object ID to class mapping */
-/*
- * Initialize the object class info table. Begin with the most general types
- * and end with the most specific. For instance, any object that has a
- * datatype message is a datatype but only some of them are datasets.
- */
-const H5O_obj_class_t *const H5O_obj_class_g[] = {
- H5O_OBJ_DATATYPE, /* Datatype object (H5O_TYPE_NAMED_DATATYPE - 2) */
- H5O_OBJ_DATASET, /* Dataset object (H5O_TYPE_DATASET - 1) */
- H5O_OBJ_GROUP, /* Group object (H5O_TYPE_GROUP - 0) */
+ H5O_MSG_FSINFO, /*0x0017 Free-space manager info message */
+ H5O_MSG_STORAGE, /*0x0018 Data storage */
+ H5O_MSG_UNKNOWN, /*0x0019 Placeholder for unknown message */
};
/* Declare a free list to manage the H5O_t struct */
@@ -168,6 +158,18 @@ H5FL_EXTERN(H5_obj_t);
/* Local Variables */
/*******************/
+/* Header object ID to class mapping */
+/*
+ * Initialize the object class info table. Begin with the most general types
+ * and end with the most specific. For instance, any object that has a
+ * datatype message is a datatype but only some of them are datasets.
+ */
+static const H5O_obj_class_t *const H5O_obj_class_g[] = {
+ H5O_OBJ_DATATYPE, /* Datatype object (H5O_TYPE_NAMED_DATATYPE - 2) */
+ H5O_OBJ_DATASET, /* Dataset object (H5O_TYPE_DATASET - 1) */
+ H5O_OBJ_GROUP, /* Group object (H5O_TYPE_GROUP - 0) */
+};
+
/*-------------------------------------------------------------------------
@@ -2297,6 +2299,131 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5O_get_hdr_info
+ *
+ * Purpose: Retrieve the object header information for an object
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * September 22 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5O_get_hdr_info(const H5O_loc_t *oloc, hid_t dxpl_id, H5O_hdr_info_t *hdr)
+{
+ H5O_t *oh = NULL; /* Object header */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5O_get_hdr_info, FAIL)
+
+ /* Check args */
+ HDassert(oloc);
+ HDassert(hdr);
+
+ /* Reset the object header info structure */
+ HDmemset(hdr, 0, sizeof(*hdr));
+
+ /* 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")
+
+ /* Get the information for the object header */
+ if(H5O_get_hdr_info_real(oh, hdr) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object header info")
+
+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")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_get_hdr_info() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_get_hdr_info_real
+ *
+ * Purpose: Internal routine to retrieve the object header information for an object
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * September 22 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5O_get_hdr_info_real(const H5O_t *oh, H5O_hdr_info_t *hdr)
+{
+ const H5O_mesg_t *curr_msg; /* Pointer to current message being operated on */
+ const H5O_chunk_t *curr_chunk; /* Pointer to current message being operated on */
+ unsigned u; /* Local index variable */
+
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_get_hdr_info_real)
+
+ /* Check args */
+ HDassert(oh);
+ HDassert(hdr);
+
+ /* Set the version for the object header */
+ hdr->version = oh->version;
+
+ /* Set the number of messages & chunks */
+ hdr->nmesgs = oh->nmesgs;
+ hdr->nchunks = oh->nchunks;
+
+ /* Set the status flags */
+ hdr->flags = oh->flags;
+
+ /* Iterate over all the messages, accumulating message size & type information */
+ hdr->space.meta = H5O_SIZEOF_HDR(oh) + (H5O_SIZEOF_CHKHDR_OH(oh) * (oh->nchunks - 1));
+ hdr->space.mesg = 0;
+ hdr->space.free = 0;
+ hdr->mesg.present = 0;
+ hdr->mesg.shared = 0;
+ for(u = 0, curr_msg = &oh->mesg[0]; u < oh->nmesgs; u++, curr_msg++) {
+ uint64_t type_flag; /* Flag for message type */
+
+ /* Accumulate space usage information, based on the type of message */
+ if(H5O_NULL_ID == curr_msg->type->id)
+ hdr->space.free += H5O_SIZEOF_MSGHDR_OH(oh) + curr_msg->raw_size;
+ else if(H5O_CONT_ID == curr_msg->type->id)
+ hdr->space.meta += H5O_SIZEOF_MSGHDR_OH(oh) + curr_msg->raw_size;
+ else {
+ hdr->space.meta += H5O_SIZEOF_MSGHDR_OH(oh);
+ hdr->space.mesg += curr_msg->raw_size;
+ } /* end else */
+
+ /* Set flag to indicate presence of message type */
+ type_flag = ((uint64_t)1) << curr_msg->type->id;
+ hdr->mesg.present |= type_flag;
+
+ /* Set flag if the message is shared in some way */
+ if(curr_msg->flags & H5O_MSG_FLAG_SHARED) \
+ hdr->mesg.shared |= type_flag;
+ } /* end for */
+
+ /* Iterate over all the chunks, adding any gaps to the free space */
+ hdr->space.total = 0;
+ for(u = 0, curr_chunk = &oh->chunk[0]; u < oh->nchunks; u++, curr_chunk++) {
+ /* Accumulate the size of the header on disk */
+ hdr->space.total += curr_chunk->size;
+
+ /* If the chunk has a gap, add it to the free space */
+ hdr->space.free += curr_chunk->gap;
+ } /* end for */
+
+ /* Sanity check that all the bytes are accounted for */
+ HDassert(hdr->space.total == (hdr->space.free + hdr->space.meta + hdr->space.mesg));
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5O_get_hdr_info_real() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5O_get_info
*
* Purpose: Retrieve the information for an object
@@ -2310,12 +2437,11 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5O_get_info(H5O_loc_t *oloc, hid_t dxpl_id, hbool_t want_ih_info, H5O_info_t *oinfo)
+H5O_get_info(const H5O_loc_t *oloc, 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 */
H5O_t *oh = NULL; /* Object header */
- H5O_chunk_t *curr_chunk; /* Pointer to current message being operated on */
- H5O_mesg_t *curr_msg; /* Pointer to current message being operated on */
- unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5O_get_info, FAIL)
@@ -2337,20 +2463,12 @@ H5O_get_info(H5O_loc_t *oloc, hid_t dxpl_id, hbool_t want_ih_info, H5O_info_t *o
/* Set the object's address */
oinfo->addr = oloc->addr;
- /* Retrieve the type of the object */
- if(H5O_obj_type_real(oh, &oinfo->type) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to determine object type")
+ /* Get class for object */
+ if(NULL == (obj_class = H5O_obj_class_real(oh)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine object class")
- /* Retrieve btree and heap storage info, if requested */
- if(want_ih_info) {
- if(oinfo->type == H5O_TYPE_GROUP) {
- if(H5O_group_bh_info(oloc->file, dxpl_id, oh, &(oinfo->meta_size.obj)/*out*/) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve group btree & heap info")
- } else if(oinfo->type == H5O_TYPE_DATASET) {
- if(H5O_dset_bh_info(oloc->file, dxpl_id, oh, &(oinfo->meta_size.obj)/*out*/) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve chunked dataset btree info")
- }
- } /* end if */
+ /* Retrieve the type of the object */
+ oinfo->type = obj_class->type;
/* Set the object's reference count */
oinfo->rc = oh->nlink;
@@ -2396,66 +2514,29 @@ H5O_get_info(H5O_loc_t *oloc, hid_t dxpl_id, hbool_t want_ih_info, H5O_info_t *o
} /* end else */
} /* end else */
- /* Set the version for the object header */
- oinfo->hdr.version = oh->version;
-
- /* Set the number of messages & chunks */
- oinfo->hdr.nmesgs = oh->nmesgs;
- oinfo->hdr.nchunks = oh->nchunks;
-
- /* Set the status flags */
- oinfo->hdr.flags = oh->flags;
-
- /* Iterate over all the messages, accumulating message size & type information */
- oinfo->hdr.space.meta = H5O_SIZEOF_HDR(oh) + (H5O_SIZEOF_CHKHDR_OH(oh) * (oh->nchunks - 1));
- oinfo->hdr.space.mesg = 0;
- oinfo->hdr.space.free = 0;
- oinfo->hdr.mesg.present = 0;
- oinfo->hdr.mesg.shared = 0;
- for(u = 0, curr_msg = &oh->mesg[0]; u < oh->nmesgs; u++, curr_msg++) {
- uint64_t type_flag; /* Flag for message type */
-
- /* Accumulate space usage information, based on the type of message */
- if(H5O_NULL_ID == curr_msg->type->id)
- oinfo->hdr.space.free += H5O_SIZEOF_MSGHDR_OH(oh) + curr_msg->raw_size;
- else if(H5O_CONT_ID == curr_msg->type->id)
- oinfo->hdr.space.meta += H5O_SIZEOF_MSGHDR_OH(oh) + curr_msg->raw_size;
- else {
- oinfo->hdr.space.meta += H5O_SIZEOF_MSGHDR_OH(oh);
- oinfo->hdr.space.mesg += curr_msg->raw_size;
- } /* end else */
-
- /* Set flag to indicate presence of message type */
- type_flag = ((uint64_t)1) << curr_msg->type->id;
- oinfo->hdr.mesg.present |= type_flag;
-
- /* Set flag if the message is shared in some way */
- if(curr_msg->flags & H5O_MSG_FLAG_SHARED) \
- oinfo->hdr.mesg.shared |= type_flag;
- } /* end for */
+ /* Get the information for the object header */
+ if(H5O_get_hdr_info_real(oh, &oinfo->hdr) < 0)
+ 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)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't retrieve attribute count")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve attribute count")
/* Get B-tree & heap metadata storage size, if requested */
if(want_ih_info) {
- if((oinfo->num_attrs > 0) && (H5O_attr_bh_info(oloc->file, dxpl_id, oh, &oinfo->meta_size.attr/*out*/) < 0))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't retrieve attribute btree & heap info")
- } /* end if */
-
- /* Iterate over all the chunks, adding any gaps to the free space */
- oinfo->hdr.space.total = 0;
- for(u = 0, curr_chunk = &oh->chunk[0]; u < oh->nchunks; u++, curr_chunk++) {
- /* Accumulate the size of the header on disk */
- oinfo->hdr.space.total += curr_chunk->size;
-
- /* If the chunk has a gap, add it to the free space */
- oinfo->hdr.space.free += curr_chunk->gap;
- } /* end for */
+ /* 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)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object's btree & heap info")
+ } /* end if */
- /* Sanity check that all the bytes are accounted for */
- HDassert(oinfo->hdr.space.total == (oinfo->hdr.space.free + oinfo->hdr.space.meta + oinfo->hdr.space.mesg));
+ /* 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)
+ 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)
diff --git a/src/H5Oattribute.c b/src/H5Oattribute.c
index 253f615..c624ee1 100644
--- a/src/H5Oattribute.c
+++ b/src/H5Oattribute.c
@@ -1859,6 +1859,8 @@ herr_t
H5O_attr_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info)
{
H5HF_t *fheap = NULL; /* Fractal heap handle */
+ 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 */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5O_attr_bh_info, FAIL)
@@ -1876,30 +1878,37 @@ H5O_attr_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info)
if((ainfo_exists = H5A_get_ainfo(f, dxpl_id, oh, &ainfo)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message")
else if(ainfo_exists > 0) {
- /* Get storage size of creation order index, if it's used */
- if(H5F_addr_defined(ainfo.corder_bt2_addr))
- if(H5B2_iterate_size(f, dxpl_id, H5A_BT2_CORDER, ainfo.corder_bt2_addr, &(bh_info->index_size)) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree storage info")
+ /* Check if name index available */
+ if(H5F_addr_defined(ainfo.name_bt2_addr)) {
+ /* Open the name index v2 B-tree */
+ if(NULL == (bt2_name = H5B2_open(f, dxpl_id, ainfo.name_bt2_addr)))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index")
+
+ /* Get name index B-tree size */
+ if(H5B2_size(bt2_name, dxpl_id, &(bh_info->index_size)) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't retrieve B-tree storage info")
+ } /* end if */
+
+ /* Check if creation order index available */
+ if(H5F_addr_defined(ainfo.corder_bt2_addr)) {
+ /* Open the creation order index v2 B-tree */
+ if(NULL == (bt2_corder = H5B2_open(f, dxpl_id, ainfo.corder_bt2_addr)))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for creation order index")
- /* Get storage size of name index, if it's used */
- if(H5F_addr_defined(ainfo.name_bt2_addr))
- if(H5B2_iterate_size(f, dxpl_id, H5A_BT2_NAME, ainfo.name_bt2_addr, &(bh_info->index_size)) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree storage info")
+ /* Get creation order index B-tree size */
+ if(H5B2_size(bt2_corder, dxpl_id, &(bh_info->index_size)) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't retrieve B-tree storage info")
+ } /* end if */
/* Get storage size of fractal heap, if it's used */
if(H5F_addr_defined(ainfo.fheap_addr)) {
/* Open the fractal heap for attributes */
if(NULL == (fheap = H5HF_open(f, dxpl_id, ainfo.fheap_addr)))
- HGOTO_ERROR(H5E_HEAP, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap")
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap")
/* Get heap storage size */
if(H5HF_size(fheap, dxpl_id, &(bh_info->heap_size)) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree storage info")
-
- /* Release the fractal heap */
- if(H5HF_close(fheap, dxpl_id) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
- fheap = NULL;
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't retrieve B-tree storage info")
} /* end if */
} /* end else */
} /* end if */
@@ -1907,7 +1916,11 @@ H5O_attr_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info)
done:
/* Release resources */
if(fheap && H5HF_close(fheap, dxpl_id) < 0)
- HDONE_ERROR(H5E_HEAP, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
+ HDONE_ERROR(H5E_ATTR, H5E_CANTCLOSEOBJ, FAIL, "can't close fractal heap")
+ if(bt2_name && H5B2_close(bt2_name, dxpl_id) < 0)
+ HDONE_ERROR(H5E_ATTR, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for name index")
+ if(bt2_corder && H5B2_close(bt2_corder, dxpl_id) < 0)
+ HDONE_ERROR(H5E_ATTR, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for creation order index")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5O_attr_bh_info() */
diff --git a/src/H5Odtype.c b/src/H5Odtype.c
index a9812690..fc71d65 100644
--- a/src/H5Odtype.c
+++ b/src/H5Odtype.c
@@ -269,9 +269,9 @@ H5O_dtype_decode_helper(H5F_t *f, unsigned *ioflags/*in,out*/, const uint8_t **p
*/
dt->shared->u.compnd.nmembs = flags & 0xffff;
HDassert(dt->shared->u.compnd.nmembs > 0);
- dt->shared->u.compnd.packed = TRUE; /* Start off packed */
dt->shared->u.compnd.nalloc = dt->shared->u.compnd.nmembs;
dt->shared->u.compnd.memb = (H5T_cmemb_t *)H5MM_calloc(dt->shared->u.compnd.nalloc * sizeof(H5T_cmemb_t));
+ dt->shared->u.compnd.memb_size = 0;
if(NULL == dt->shared->u.compnd.memb)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
for(i = 0; i < dt->shared->u.compnd.nmembs; i++) {
@@ -385,6 +385,7 @@ H5O_dtype_decode_helper(H5F_t *f, unsigned *ioflags/*in,out*/, const uint8_t **p
/* Member size */
dt->shared->u.compnd.memb[i].size = temp_type->shared->size;
+ dt->shared->u.compnd.memb_size += temp_type->shared->size;
/* Set the field datatype (finally :-) */
dt->shared->u.compnd.memb[i].type = temp_type;
@@ -400,31 +401,11 @@ H5O_dtype_decode_helper(H5F_t *f, unsigned *ioflags/*in,out*/, const uint8_t **p
/* Update the maximum member position covered */
max_memb_pos = MAX(max_memb_pos, (dt->shared->u.compnd.memb[i].offset + dt->shared->u.compnd.memb[i].size));
-
- /* Check if the datatype stayed packed */
- if(dt->shared->u.compnd.packed) {
- /* Check if the member type is packed */
- if(H5T_is_packed(temp_type) > 0) {
- if(i == 0) {
- /* If the is the first member, the datatype is not packed
- * if the first member isn't at offset 0
- */
- if(dt->shared->u.compnd.memb[i].offset > 0)
- dt->shared->u.compnd.packed = FALSE;
- } /* end if */
- else {
- /* If the is not the first member, the datatype is not
- * packed if the new member isn't adjoining the previous member
- */
- if(dt->shared->u.compnd.memb[i].offset != (dt->shared->u.compnd.memb[i - 1].offset + dt->shared->u.compnd.memb[i - 1].size))
- dt->shared->u.compnd.packed = FALSE;
- } /* end else */
- } /* end if */
- else
- dt->shared->u.compnd.packed = FALSE;
- } /* end if */
} /* end for */
+ /* Check if the compound type is packed */
+ H5T_update_packed(dt);
+
/* Upgrade the compound if requested */
if(version < upgrade_to) {
version = upgrade_to;
diff --git a/src/H5Ofsinfo.c b/src/H5Ofsinfo.c
new file mode 100644
index 0000000..fb0151f
--- /dev/null
+++ b/src/H5Ofsinfo.c
@@ -0,0 +1,309 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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: H5Ofsinfo.c
+ * Feb 2009
+ * Vailin Choi
+ *
+ * Purpose: Free space manager info message.
+ *
+ *-------------------------------------------------------------------------
+ */
+
+#define H5O_PACKAGE /* suppress error about including H5Opkg */
+
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5FLprivate.h" /* Free lists */
+#include "H5Opkg.h" /* Object headers */
+
+/* PRIVATE PROTOTYPES */
+static void *H5O_fsinfo_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
+static herr_t H5O_fsinfo_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg);
+static void *H5O_fsinfo_copy(const void *_mesg, void *_dest);
+static size_t H5O_fsinfo_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg);
+static herr_t H5O_fsinfo_free(void *mesg);
+static herr_t H5O_fsinfo_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg,
+ FILE * stream, int indent, int fwidth);
+
+/* This message derives from H5O message class */
+const H5O_msg_class_t H5O_MSG_FSINFO[1] = {{
+ H5O_FSINFO_ID, /* message id number */
+ "fsinfo", /* message name for debugging */
+ sizeof(H5O_fsinfo_t), /* native message size */
+ 0, /* messages are sharable? */
+ H5O_fsinfo_decode, /* decode message */
+ H5O_fsinfo_encode, /* encode message */
+ H5O_fsinfo_copy, /* copy the native value */
+ H5O_fsinfo_size, /* size of free-space manager info message */
+ NULL, /* default reset method */
+ H5O_fsinfo_free, /* free method */
+ NULL, /* file delete method */
+ NULL, /* link method */
+ NULL, /* set share method */
+ NULL, /* can share method */
+ NULL, /* pre copy native value to file */
+ NULL, /* copy native value to file */
+ NULL, /* post copy native value to file */
+ NULL, /* get creation index */
+ NULL, /* set creation index */
+ H5O_fsinfo_debug /* debug the message */
+}};
+
+/* Current version of free-space manager info information */
+#define H5O_FSINFO_VERSION 0
+
+/* Declare a free list to manage the H5O_fsinfo_t struct */
+H5FL_DEFINE_STATIC(H5O_fsinfo_t);
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_fsinfo_decode
+ *
+ * Purpose: Decode a message and return a pointer to a newly allocated one.
+ *
+ * Return: Success: Ptr to new message in native form.
+ * Failure: NULL
+ *
+ * Programmer: Vailin Choi; Feb 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5O_fsinfo_decode(H5F_t *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh,
+ unsigned UNUSED mesg_flags, unsigned UNUSED *ioflags, const uint8_t *p)
+{
+ H5O_fsinfo_t *fsinfo = NULL; /* free-space manager info */
+ H5FD_mem_t type; /* Memory type for iteration */
+ void *ret_value; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5O_fsinfo_decode)
+
+ /* check args */
+ HDassert(f);
+ HDassert(p);
+
+ /* Version of message */
+ if(*p++ != H5O_FSINFO_VERSION)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad version number for message")
+
+ /* Allocate space for message */
+ if(NULL == (fsinfo = H5FL_CALLOC(H5O_fsinfo_t)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+
+ fsinfo->strategy = *p++; /* file space strategy */
+ H5F_DECODE_LENGTH(f, p, fsinfo->threshold); /* free space section size threshold */
+
+ /* Addresses of free space managers: only exist for H5F_FILE_SPACE_ALL_PERSIST */
+ if(fsinfo->strategy == H5F_FILE_SPACE_ALL_PERSIST) {
+ for(type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type))
+ H5F_addr_decode(f, &p, &(fsinfo->fs_addr[type-1]));
+ } /* end if */
+ else {
+ for(type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type))
+ fsinfo->fs_addr[type-1] = HADDR_UNDEF;
+ } /* end else */
+
+ /* Set return value */
+ ret_value = fsinfo;
+
+done:
+ if(ret_value == NULL && fsinfo != NULL)
+ fsinfo = H5FL_FREE(H5O_fsinfo_t, fsinfo);
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_fsinfo_decode() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_fsinfo_encode
+ *
+ * Purpose: Encodes a message.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Vailin Choi; Feb 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5O_fsinfo_encode(H5F_t *f, hbool_t UNUSED disable_shared, uint8_t *p, const void *_mesg)
+{
+ const H5O_fsinfo_t *fsinfo = (const H5O_fsinfo_t *)_mesg;
+ H5FD_mem_t type; /* Memory type for iteration */
+
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_fsinfo_encode)
+
+ /* check args */
+ HDassert(f);
+ HDassert(p);
+ HDassert(fsinfo);
+
+ *p++ = H5O_FSINFO_VERSION; /* message version */
+ *p++ = fsinfo->strategy; /* file space strategy */
+ H5F_ENCODE_LENGTH(f, p, fsinfo->threshold); /* free-space section size threshold */
+
+ /* Addresses of free space managers: only exist for H5F_FILE_SPACE_ALL_PERSIST */
+ if(fsinfo->strategy == H5F_FILE_SPACE_ALL_PERSIST) {
+ for(type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type))
+ H5F_addr_encode(f, &p, fsinfo->fs_addr[type-1]);
+ } /* end if */
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5O_fsinfo_encode() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_fsinfo_copy
+ *
+ * Purpose: Copies a message from _MESG to _DEST, allocating _DEST if
+ * necessary.
+ *
+ * Return: Success: Ptr to _DEST
+ * Failure: NULL
+ *
+ * Programmer: Vailin Choi; Feb 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5O_fsinfo_copy(const void *_mesg, void *_dest)
+{
+ const H5O_fsinfo_t *fsinfo = (const H5O_fsinfo_t *)_mesg;
+ H5O_fsinfo_t *dest = (H5O_fsinfo_t *) _dest;
+ void *ret_value; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5O_fsinfo_copy)
+
+ /* check args */
+ HDassert(fsinfo);
+ if(!dest && NULL == (dest = H5FL_CALLOC(H5O_fsinfo_t)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+
+ /* copy */
+ *dest = *fsinfo;
+
+ /* Set return value */
+ ret_value = dest;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_fsinfo_copy() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_fsinfo_size
+ *
+ * Purpose: Returns the size of the raw message in bytes not counting
+ * the message type or size fields, but only the data fields.
+ * This function doesn't take into account alignment.
+ *
+ * Return: Success: Message data size in bytes without alignment.
+ * Failure: zero
+ *
+ * Programmer: Vailin Choi; Feb 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static size_t
+H5O_fsinfo_size(const H5F_t *f, hbool_t UNUSED disable_shared, const void *_mesg)
+{
+ const H5O_fsinfo_t *fsinfo = (const H5O_fsinfo_t *)_mesg;
+ size_t fs_addr_size = 0;
+ size_t ret_value; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_fsinfo_size)
+
+
+ /* Addresses of free-space managers exist only for H5F_FILE_SPACE_ALL_PERSIST type */
+ if(H5F_FILE_SPACE_ALL_PERSIST == fsinfo->strategy)
+ fs_addr_size = (H5FD_MEM_NTYPES - 1) * H5F_SIZEOF_ADDR(f);
+
+ ret_value = 2 /* Version & strategy */
+ + H5F_SIZEOF_SIZE(f) /* Threshold */
+ + fs_addr_size; /* Addresses of free-space managers */
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_fsinfo_size() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_fsinfo_free
+ *
+ * Purpose: Free's the message
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Vailin Choi; Feb 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5O_fsinfo_free(void *mesg)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_fsinfo_free)
+
+ HDassert(mesg);
+
+ (void)H5FL_FREE(H5O_fsinfo_t, mesg);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5O_fsinfo_free() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_fsinfo_debug
+ *
+ * Purpose: Prints debugging info for a message.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Vailin Choi; Feb 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5O_fsinfo_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, FILE * stream,
+ int indent, int fwidth)
+{
+ const H5O_fsinfo_t *fsinfo = (const H5O_fsinfo_t *) _mesg;
+ H5FD_mem_t type; /* Memory type for iteration */
+
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_fsinfo_debug)
+
+ /* check args */
+ HDassert(f);
+ HDassert(fsinfo);
+ HDassert(stream);
+ HDassert(indent >= 0);
+ HDassert(fwidth >= 0);
+
+ HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
+ "File space strategy:", fsinfo->strategy);
+
+ HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth,
+ "Free space section threshold:", fsinfo->threshold);
+
+ if(fsinfo->strategy == H5F_FILE_SPACE_ALL_PERSIST) {
+ for(type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type))
+ HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
+ "Free space manager address:", fsinfo->fs_addr[type-1]);
+ } /* end if */
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5O_fsinfo_debug() */
+
diff --git a/src/H5Olayout.c b/src/H5Olayout.c
index ce0e539..330189c 100644
--- a/src/H5Olayout.c
+++ b/src/H5Olayout.c
@@ -856,7 +856,7 @@ H5O_layout_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst,
case H5D_CHUNKED:
if(H5D_chunk_is_space_alloc(&layout_src->storage)) {
/* Create chunked layout */
- if(H5D_chunk_copy(file_src, &layout_src->storage.u.chunk, &layout_src->u.chunk, file_dst, &layout_dst->storage.u.chunk, udata->src_space_extent, udata->src_dtype, udata->src_pline, cpy_info, dxpl_id) < 0)
+ if(H5D_chunk_copy(file_src, &layout_src->storage.u.chunk, &layout_src->u.chunk, file_dst, &layout_dst->storage.u.chunk, udata->src_space_extent, udata->src_dtype, udata->common.src_pline, cpy_info, dxpl_id) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "unable to copy chunked storage")
} /* end if */
break;
diff --git a/src/H5Olinfo.c b/src/H5Olinfo.c
index 5ba237a..ba5ec56 100644
--- a/src/H5Olinfo.c
+++ b/src/H5Olinfo.c
@@ -377,11 +377,12 @@ done:
*/
static void *
H5O_linfo_copy_file(H5F_t UNUSED *file_src, void *native_src, H5F_t *file_dst,
- hbool_t UNUSED *recompute_size, H5O_copy_t *cpy_info, void UNUSED *udata,
+ hbool_t UNUSED *recompute_size, H5O_copy_t *cpy_info, void *_udata,
hid_t dxpl_id)
{
H5O_linfo_t *linfo_src = (H5O_linfo_t *) native_src;
H5O_linfo_t *linfo_dst = NULL;
+ H5G_copy_file_ud_t *udata = (H5G_copy_file_ud_t *) _udata;
void *ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5O_linfo_copy_file)
@@ -411,7 +412,8 @@ H5O_linfo_copy_file(H5F_t UNUSED *file_src, void *native_src, H5F_t *file_dst,
* dense link storage components and use those - QAK)
*/
if(H5F_addr_defined(linfo_src->fheap_addr)) {
- if(H5G_dense_create(file_dst, dxpl_id, linfo_dst) < 0)
+ /* Create the dense link storage */
+ if(H5G_dense_create(file_dst, dxpl_id, linfo_dst, udata->common.src_pline) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "unable to create 'dense' form of new format group")
} /* end if */
} /* end else */
diff --git a/src/H5Opkg.h b/src/H5Opkg.h
index 90f3997..edb5d94 100644
--- a/src/H5Opkg.h
+++ b/src/H5Opkg.h
@@ -30,7 +30,7 @@
#define H5O_NMESGS 8 /*initial number of messages */
#define H5O_NCHUNKS 2 /*initial number of chunks */
#define H5O_MIN_SIZE 22 /* Min. obj header data size (must be big enough for a message prefix and a continuation message) */
-#define H5O_MSG_TYPES 25 /* # of types of messages */
+#define H5O_MSG_TYPES 26 /* # of types of messages */
#define H5O_MAX_CRT_ORDER_IDX 65535 /* Max. creation order index value */
/* Versions of object header structure */
@@ -320,6 +320,7 @@ typedef struct H5O_obj_class_t {
hid_t (*open)(const H5G_loc_t *, hid_t, hid_t, hbool_t ); /*open an object of this class */
void *(*create)(H5F_t *, void *, H5G_loc_t *, hid_t ); /*create an object of this class */
H5O_loc_t *(*get_oloc)(hid_t ); /*get the object header location for an object */
+ herr_t (*bh_info)(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info); /*get the index & heap info for an object */
} H5O_obj_class_t;
/* Node in skip list to map addresses from one file to another during object header copy */
@@ -337,9 +338,6 @@ H5_DLLVAR const H5AC_class_t H5AC_OHDR[1];
/* Header message ID to class mapping */
H5_DLLVAR const H5O_msg_class_t *const H5O_msg_class_g[H5O_MSG_TYPES];
-/* Header object ID to class mapping */
-H5_DLLVAR const H5O_obj_class_t *const H5O_obj_class_g[3];
-
/* Declare external the free list for H5O_t's */
H5FL_EXTERN(H5O_t);
@@ -451,12 +449,15 @@ H5_DLLVAR const H5O_msg_class_t H5O_MSG_AINFO[1];
/* Reference Count Message. (0x0016) */
H5_DLLVAR const H5O_msg_class_t H5O_MSG_REFCOUNT[1];
-/* Placeholder for unknown message. (0x0017) */
-H5_DLLVAR const H5O_msg_class_t H5O_MSG_UNKNOWN[1];
+/* Free-space Manager Info message. (0x0017) */
+H5_DLLVAR const H5O_msg_class_t H5O_MSG_FSINFO[1];
/* Data Storage Message. (0x0018) */
H5_DLLVAR const H5O_msg_class_t H5O_MSG_STORAGE[1];
+/* Placeholder for unknown message. (0x0019) */
+H5_DLLVAR const H5O_msg_class_t H5O_MSG_UNKNOWN[1];
+
/*
* Object header "object" types
@@ -500,10 +501,6 @@ H5_DLL herr_t H5O_msg_iterate_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *t
const H5O_mesg_operator_t *op, void *op_data, hid_t dxpl_id);
/* Collect storage info for btree and heap */
-H5_DLL herr_t H5O_group_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh,
- H5_ih_info_t *bh_info);
-H5_DLL herr_t H5O_dset_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh,
- H5_ih_info_t *bh_info);
H5_DLL herr_t H5O_attr_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh,
H5_ih_info_t *bh_info);
diff --git a/src/H5Opline.c b/src/H5Opline.c
index cc00996..0a50963 100644
--- a/src/H5Opline.c
+++ b/src/H5Opline.c
@@ -572,7 +572,7 @@ H5O_pline_pre_copy_file(H5F_t UNUSED *file_src, const void *mesg_src,
hbool_t UNUSED *deleted, const H5O_copy_t UNUSED *cpy_info, void *_udata)
{
const H5O_pline_t *pline_src = (const H5O_pline_t *)mesg_src; /* Source datatype */
- H5D_copy_file_ud_t *udata = (H5D_copy_file_ud_t *)_udata; /* Dataset copying user data */
+ H5O_copy_file_ud_common_t *udata = (H5O_copy_file_ud_common_t *)_udata; /* Object copying user data */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5O_pline_pre_copy_file)
@@ -580,7 +580,7 @@ H5O_pline_pre_copy_file(H5F_t UNUSED *file_src, const void *mesg_src,
/* check args */
HDassert(pline_src);
- /* If the user data is non-NULL, assume we are copying a dataset
+ /* If the user data is non-NULL, assume we are copying a dataset or group
* and make a copy of the filter pipeline for later in
* the object copying process.
*/
@@ -665,3 +665,30 @@ H5O_pline_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *mesg, FILE *s
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O_pline_debug() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_pline_set_latest_version
+ *
+ * Purpose: Set the encoding for a I/O filter pipeline to the latest version.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Tuesday, July 24, 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5O_pline_set_latest_version(H5O_pline_t *pline)
+{
+ FUNC_ENTER_NOAPI_NOFUNC(H5O_pline_set_latest_version)
+
+ /* Sanity check */
+ HDassert(pline);
+
+ /* Set encoding of I/O pipeline to latest version */
+ pline->version = H5O_PLINE_VERSION_LATEST;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5O_pline_set_latest_version() */
+
diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h
index 21362b0..db2dab8 100644
--- a/src/H5Oprivate.h
+++ b/src/H5Oprivate.h
@@ -88,6 +88,8 @@ typedef struct H5O_t H5O_t;
#define H5O_CRT_ATTR_MAX_COMPACT_NAME "max compact attr" /* Max. # of attributes to store compactly */
#define H5O_CRT_ATTR_MIN_DENSE_NAME "min dense attr" /* Min. # of attributes to store densely */
#define H5O_CRT_OHDR_FLAGS_NAME "object header flags" /* Object header flags */
+#define H5O_CRT_PIPELINE_NAME "pline" /* Filter pipeline */
+#define H5O_CRT_PIPELINE_DEF {{0, NULL, H5O_NULL_ID, {{0, HADDR_UNDEF}}}, H5O_PLINE_VERSION_1, 0, 0, NULL}
#ifdef H5O_ENABLE_BOGUS
#define H5O_BOGUS_MSG_FLAGS_NAME "bogus msg flags" /* Flags for 'bogus' message */
#define H5O_BOGUS_MSG_FLAGS_SIZE sizeof(uint8_t)
@@ -165,9 +167,10 @@ typedef struct H5O_copy_t {
#define H5O_DRVINFO_ID 0x0014 /* Driver info message. */
#define H5O_AINFO_ID 0x0015 /* Attribute info message. */
#define H5O_REFCOUNT_ID 0x0016 /* Reference count message. */
-#define H5O_UNKNOWN_ID 0x0017 /* Placeholder message ID for unknown message. */
- /* (this should never exist in a file) */
+#define H5O_FSINFO_ID 0x0017 /* Free-space manager info message. */
#define H5O_STORAGE_ID 0x0018 /* Data Storage message. */
+#define H5O_UNKNOWN_ID 0x0019 /* Placeholder message ID for unknown message. */
+ /* (this should never exist in a file) */
/* Shared object message types.
@@ -499,6 +502,20 @@ typedef struct H5O_ginfo_t {
* Filter pipeline message.
* (Data structure in memory)
*/
+
+/* The initial version of the format */
+#define H5O_PLINE_VERSION_1 1
+
+/* This version encodes the message fields more efficiently */
+/* (Drops the reserved bytes, doesn't align the name and doesn't encode the
+ * filter name at all if it's a filter provided by the library)
+ */
+#define H5O_PLINE_VERSION_2 2
+
+/* The latest version of the format. Look through the 'encode' and 'size'
+ * callbacks for places to change when updating this. */
+#define H5O_PLINE_VERSION_LATEST H5O_PLINE_VERSION_2
+
typedef struct H5O_pline_t {
H5O_shared_t sh_loc; /* Shared message info (must be first) */
@@ -603,6 +620,17 @@ typedef uint32_t H5O_refcount_t; /* Contains # of links to object, if >1
*/
typedef unsigned H5O_unknown_t; /* Original message type ID */
+/*
+ * Free space manager info Message.
+ * Contains file space management info and
+ * addresses of free space managers for file memory
+ * (Data structure in memory)
+ */
+typedef struct H5O_fsinfo_t {
+ H5F_file_space_type_t strategy; /* File space strategy */
+ hsize_t threshold; /* Free space section threshold */
+ haddr_t fs_addr[H5FD_MEM_NTYPES-1]; /* Addresses of free space managers */
+} H5O_fsinfo_t;
/* Typedef for "application" iteration operations */
typedef herr_t (*H5O_operator_t)(const void *mesg/*in*/, unsigned idx,
@@ -655,7 +683,8 @@ H5_DLL herr_t H5O_touch_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh,
H5_DLL herr_t H5O_bogus_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned mesg_flags);
#endif /* H5O_ENABLE_BOGUS */
H5_DLL herr_t H5O_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr);
-H5_DLL herr_t H5O_get_info(H5O_loc_t *oloc, hid_t dxpl_id, hbool_t want_ih_info,
+H5_DLL herr_t H5O_get_hdr_info(const H5O_loc_t *oloc, hid_t dxpl_id, H5O_hdr_info_t *hdr);
+H5_DLL herr_t H5O_get_info(const H5O_loc_t *oloc, hid_t dxpl_id, hbool_t want_ih_info,
H5O_info_t *oinfo);
H5_DLL herr_t H5O_obj_type(const H5O_loc_t *loc, H5O_type_t *obj_type, hid_t dxpl_id);
H5_DLL herr_t H5O_get_create_plist(const H5O_loc_t *loc, hid_t dxpl_id, struct H5P_genplist_t *oc_plist);
@@ -747,6 +776,9 @@ H5_DLL herr_t H5O_fill_set_latest_version(H5O_fill_t *fill);
H5_DLL herr_t H5O_link_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
void *_mesg);
+/* Filter pipeline operators */
+H5_DLL herr_t H5O_pline_set_latest_version(H5O_pline_t *pline);
+
/* Shared message operators */
H5_DLL herr_t H5O_set_shared(H5O_shared_t *dst, const H5O_shared_t *src);
diff --git a/src/H5Opublic.h b/src/H5Opublic.h
index ddf1a93..84fdecc 100644
--- a/src/H5Opublic.h
+++ b/src/H5Opublic.h
@@ -87,6 +87,24 @@ typedef enum H5O_type_t {
H5O_TYPE_NTYPES /* Number of different object types (must be last!) */
} H5O_type_t;
+/* Information struct for object header metadata (for H5Oget_info/H5Oget_info_by_name/H5Oget_info_by_idx) */
+typedef struct H5O_hdr_info_t {
+ unsigned version; /* Version number of header format in file */
+ unsigned nmesgs; /* Number of object header messages */
+ unsigned nchunks; /* Number of object header chunks */
+ unsigned flags; /* Object header status flags */
+ struct {
+ hsize_t total; /* Total space for storing object header in file */
+ hsize_t meta; /* Space within header for object header metadata information */
+ hsize_t mesg; /* Space within header for actual message information */
+ hsize_t free; /* Free space within object header */
+ } space;
+ struct {
+ uint64_t present; /* Flags to indicate presence of message type in header */
+ uint64_t shared; /* Flags to indicate message type is shared in header */
+ } mesg;
+} H5O_hdr_info_t;
+
/* Information struct for object (for H5Oget_info/H5Oget_info_by_name/H5Oget_info_by_idx) */
typedef struct H5O_info_t {
unsigned long fileno; /* File number that object is located in */
@@ -98,22 +116,7 @@ typedef struct H5O_info_t {
time_t ctime; /* Change time */
time_t btime; /* Birth time */
hsize_t num_attrs; /* # of attributes attached to object */
- struct {
- unsigned version; /* Version number of header format in file */
- unsigned nmesgs; /* Number of object header messages */
- unsigned nchunks; /* Number of object header chunks */
- unsigned flags; /* Object header status flags */
- struct {
- hsize_t total; /* Total space for storing object header in file */
- hsize_t meta; /* Space within header for object header metadata information */
- hsize_t mesg; /* Space within header for actual message information */
- hsize_t free; /* Free space within object header */
- } space;
- struct {
- uint64_t present; /* Flags to indicate presence of message type in header */
- uint64_t shared; /* Flags to indicate message type is shared in header */
- } mesg;
- } hdr;
+ H5O_hdr_info_t hdr; /* Object header information */
/* Extra metadata storage for obj & attributes */
struct {
H5_ih_info_t obj; /* v1/v2 B-tree & local/fractal heap for groups, B-tree for chunked datasets */
diff --git a/src/H5Ostorage.c b/src/H5Ostorage.c
index 0229677..f6891d7 100644
--- a/src/H5Ostorage.c
+++ b/src/H5Ostorage.c
@@ -569,7 +569,7 @@ H5O_storage_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst,
case H5D_CHUNKED:
if(H5D_chunk_is_space_alloc(storage_src)) {
/* Create chunked layout */
- if(H5D_chunk_copy(file_src, &storage_src->u.chunk, &udata->src_layout->u.chunk, file_dst, &storage_dst->u.chunk, udata->src_space_extent, udata->src_dtype, udata->src_pline, cpy_info, dxpl_id) < 0)
+ if(H5D_chunk_copy(file_src, &storage_src->u.chunk, &udata->src_layout->u.chunk, file_dst, &storage_dst->u.chunk, udata->src_space_extent, udata->src_dtype, udata->common.src_pline, cpy_info, dxpl_id) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "unable to copy chunked storage")
} /* end if */
break;
diff --git a/src/H5Otest.c b/src/H5Otest.c
index c2b30fa..45ade3a 100644
--- a/src/H5Otest.c
+++ b/src/H5Otest.c
@@ -158,6 +158,7 @@ htri_t
H5O_is_attr_empty_test(hid_t oid)
{
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 */
htri_t ainfo_exists = FALSE; /* Whether the attribute info exists in the file */
H5O_loc_t *oloc; /* Pointer to object's location */
@@ -192,9 +193,13 @@ H5O_is_attr_empty_test(hid_t oid)
/* Check for any messages in object header */
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)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index")
+
/* Retrieve # of records in name index */
- if(H5B2_get_nrec(oloc->file, H5AC_ind_dxpl_id, H5A_BT2_NAME, ainfo.name_bt2_addr, &nattrs) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "unable to retrieve # of records from name index")
+ if(H5B2_get_nrec(bt2_name, &nattrs) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTCOUNT, FAIL, "unable to retrieve # of records from name index")
} /* end if */
/* Verify that attribute count in object header is correct */
@@ -208,6 +213,9 @@ H5O_is_attr_empty_test(hid_t oid)
ret_value = (nattrs == 0) ? TRUE : FALSE;
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")
@@ -238,6 +246,7 @@ herr_t
H5O_num_attrs_test(hid_t oid, hsize_t *nattrs)
{
H5O_t *oh = NULL; /* Object header */
+ H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */
H5O_ainfo_t ainfo; /* Attribute information for object */
H5O_loc_t *oloc; /* Pointer to object's location */
hsize_t obj_nattrs; /* Number of attributes */
@@ -271,9 +280,13 @@ H5O_num_attrs_test(hid_t oid, hsize_t *nattrs)
/* Check for any messages in object header */
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)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index")
+
/* Retrieve # of records in name index */
- if(H5B2_get_nrec(oloc->file, H5AC_ind_dxpl_id, H5A_BT2_NAME, ainfo.name_bt2_addr, &obj_nattrs) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "unable to retrieve # of records from name index")
+ if(H5B2_get_nrec(bt2_name, &obj_nattrs) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTCOUNT, FAIL, "unable to retrieve # of records from name index")
} /* end if */
/* Verify that attribute count in object header is correct */
@@ -284,6 +297,9 @@ H5O_num_attrs_test(hid_t oid, hsize_t *nattrs)
*nattrs = obj_nattrs;
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")
@@ -316,6 +332,8 @@ herr_t
H5O_attr_dense_info_test(hid_t oid, hsize_t *name_count, hsize_t *corder_count)
{
H5O_t *oh = NULL; /* Object header */
+ 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 */
herr_t ret_value = SUCCEED; /* Return value */
@@ -344,20 +362,33 @@ H5O_attr_dense_info_test(hid_t oid, hsize_t *name_count, hsize_t *corder_count)
if(!H5F_addr_defined(ainfo.name_bt2_addr))
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)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index")
+
/* Retrieve # of records in name index */
- if(H5B2_get_nrec(oloc->file, H5AC_ind_dxpl_id, H5A_BT2_NAME, ainfo.name_bt2_addr, name_count) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "unable to retrieve # of records from name index")
+ if(H5B2_get_nrec(bt2_name, name_count) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTCOUNT, FAIL, "unable to retrieve # of records from name index")
/* 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)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for creation order index")
+
/* Retrieve # of records in creation order index */
- if(H5B2_get_nrec(oloc->file, H5AC_ind_dxpl_id, H5A_BT2_CORDER, ainfo.corder_bt2_addr, corder_count) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "unable to retrieve # of records from creation order index")
+ if(H5B2_get_nrec(bt2_corder, corder_count) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTCOUNT, FAIL, "unable to retrieve # of records from creation order index")
} /* end if */
else
*corder_count = 0;
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(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")
diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c
index d96f30a..17e1011 100644
--- a/src/H5Pdcpl.c
+++ b/src/H5Pdcpl.c
@@ -89,10 +89,6 @@
#define H5D_CRT_EXT_FILE_LIST_SIZE sizeof(H5O_efl_t)
#define H5D_CRT_EXT_FILE_LIST_DEF {HADDR_UNDEF, 0, 0, NULL}
#define H5D_CRT_EXT_FILE_LIST_CMP H5P_dcrt_ext_file_list_cmp
-/* Definitions for data filter pipeline */
-#define H5D_CRT_DATA_PIPELINE_SIZE sizeof(H5O_pline_t)
-#define H5D_CRT_DATA_PIPELINE_DEF {{0, NULL, H5O_NULL_ID, {{0, HADDR_UNDEF}}}, H5O_PLINE_VERSION_1, 0, 0, NULL}
-#define H5D_CRT_DATA_PIPELINE_CMP H5P_dcrt_data_pipeline_cmp
/******************/
@@ -123,7 +119,6 @@ static herr_t H5P_dcrt_close(hid_t dxpl_id, void *close_data);
/* Property callbacks */
static int H5P_dcrt_layout_cmp(const void *value1, const void *value2, size_t size);
static int H5P_dcrt_ext_file_list_cmp(const void *value1, const void *value2, size_t size);
-static int H5P_dcrt_data_pipeline_cmp(const void *value1, const void *value2, size_t size);
/*********************/
@@ -185,7 +180,6 @@ H5P_dcrt_reg_prop(H5P_genclass_t *pclass)
H5O_fill_t fill = H5D_CRT_FILL_VALUE_DEF; /* Default fill value */
unsigned alloc_time_state = H5D_CRT_ALLOC_TIME_STATE_DEF; /* Default allocation time state */
H5O_efl_t efl = H5D_CRT_EXT_FILE_LIST_DEF; /* Default external file list */
- H5O_pline_t pline = H5D_CRT_DATA_PIPELINE_DEF; /* Default I/O pipeline setting */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5P_dcrt_reg_prop)
@@ -206,10 +200,6 @@ H5P_dcrt_reg_prop(H5P_genclass_t *pclass)
if(H5P_register(pclass, H5D_CRT_EXT_FILE_LIST_NAME, H5D_CRT_EXT_FILE_LIST_SIZE, &efl, NULL, NULL, NULL, NULL, NULL, H5D_CRT_EXT_FILE_LIST_CMP, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
- /* Register the data pipeline property */
- if(H5P_register(pclass, H5D_CRT_DATA_PIPELINE_NAME, H5D_CRT_DATA_PIPELINE_SIZE, &pline, NULL, NULL, NULL, NULL, NULL, H5D_CRT_DATA_PIPELINE_CMP, NULL) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
-
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P_dcrt_reg_prop() */
@@ -240,7 +230,6 @@ H5P_dcrt_copy(hid_t dst_plist_id, hid_t src_plist_id, void UNUSED *copy_data)
{
H5O_fill_t src_fill, dst_fill; /* Source & destination fill values */
H5O_efl_t src_efl, dst_efl; /* Source & destination external file lists */
- H5O_pline_t src_pline, dst_pline; /* Source & destination I/O pipelines */
H5O_layout_t src_layout, dst_layout; /* Source & destination layout */
H5P_genplist_t *src_plist; /* Pointer to source property list */
H5P_genplist_t *dst_plist; /* Pointer to destination property list */
@@ -263,8 +252,6 @@ H5P_dcrt_copy(hid_t dst_plist_id, hid_t src_plist_id, void UNUSED *copy_data)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value")
if(H5P_get(src_plist, H5D_CRT_EXT_FILE_LIST_NAME, &src_efl) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external file list")
- if(H5P_get(src_plist, H5D_CRT_DATA_PIPELINE_NAME, &src_pline) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline")
/* Make copy of layout */
if(NULL == H5O_msg_copy(H5O_LAYOUT_ID, &src_layout, &dst_layout))
@@ -319,10 +306,6 @@ H5P_dcrt_copy(hid_t dst_plist_id, hid_t src_plist_id, void UNUSED *copy_data)
dst_efl.slot[i].name_offset = 0;
} /* end if */
- /* Make copy of data pipeline */
- if(NULL == H5O_msg_copy(H5O_PLINE_ID, &src_pline, &dst_pline))
- HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't copy data pipeline")
-
/* Set the layout, fill value, external file list, and data pipeline
* properties for the destination property list
*/
@@ -332,8 +315,6 @@ H5P_dcrt_copy(hid_t dst_plist_id, hid_t src_plist_id, void UNUSED *copy_data)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set fill value")
if(H5P_set(dst_plist, H5D_CRT_EXT_FILE_LIST_NAME, &dst_efl) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set external file list")
- if(H5P_set(dst_plist, H5D_CRT_DATA_PIPELINE_NAME, &dst_pline) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set pipeline")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -361,7 +342,6 @@ H5P_dcrt_close(hid_t dcpl_id, void UNUSED *close_data)
{
H5O_fill_t fill; /* Fill value */
H5O_efl_t efl; /* External file list */
- H5O_pline_t pline; /* I/O pipeline */
H5P_genplist_t *plist; /* Property list */
herr_t ret_value = SUCCEED; /* Return value */
@@ -377,17 +357,12 @@ H5P_dcrt_close(hid_t dcpl_id, void UNUSED *close_data)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value")
if(H5P_get(plist, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external file list")
- if(H5P_get(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline")
- /* Clean up any values set for the fill-value, external file-list and
- * data pipeline */
+ /* Clean up any values set for the fill-value and external file-list */
if(H5O_msg_reset(H5O_FILL_ID, &fill) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't release fill info")
if(H5O_msg_reset(H5O_EFL_ID, &efl) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't release external file list info")
- if(H5O_msg_reset(H5O_PLINE_ID, &pline) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't release pipeline info")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -606,92 +581,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5P_dcrt_data_pipeline_cmp
- *
- * Purpose: Callback routine which is called whenever the filter pipeline
- * property in the dataset creation property list is compared.
- *
- * Return: positive if VALUE1 is greater than VALUE2, negative if
- * VALUE2 is greater than VALUE1 and zero if VALUE1 and
- * VALUE2 are equal.
- *
- * Programmer: Quincey Koziol
- * Wednesday, January 7, 2004
- *
- *-------------------------------------------------------------------------
- */
-static int
-H5P_dcrt_data_pipeline_cmp(const void *_pline1, const void *_pline2, size_t UNUSED size)
-{
- const H5O_pline_t *pline1 = (const H5O_pline_t *)_pline1, /* Create local aliases for values */
- *pline2 = (const H5O_pline_t *)_pline2;
- int cmp_value; /* Value from comparison */
- herr_t ret_value = 0; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5P_dcrt_data_pipeline_cmp)
-
- /* Sanity check */
- HDassert(pline1);
- HDassert(pline2);
- HDassert(size == sizeof(H5O_pline_t));
-
- /* Check the number of allocated pipeline entries */
- if(pline1->nalloc < pline2->nalloc) HGOTO_DONE(-1);
- if(pline1->nalloc > pline2->nalloc) HGOTO_DONE(1);
-
- /* Check the number of used pipeline entries */
- if(pline1->nused < pline2->nused) HGOTO_DONE(-1);
- if(pline1->nused > pline2->nused) HGOTO_DONE(1);
-
- /* Check the filter entry information */
- if(pline1->filter == NULL && pline2->filter != NULL) HGOTO_DONE(-1);
- if(pline1->filter != NULL && pline2->filter == NULL) HGOTO_DONE(1);
- if(pline1->filter != NULL && pline1->nused > 0) {
- size_t u; /* Local index variable */
-
- /* Loop through all filters, comparing them */
- for(u = 0; u < pline1->nused; u++) {
- /* Check the ID of the filter */
- if(pline1->filter[u].id < pline2->filter[u].id) HGOTO_DONE(-1);
- if(pline1->filter[u].id > pline2->filter[u].id) HGOTO_DONE(1);
-
- /* Check the flags for the filter */
- if(pline1->filter[u].flags < pline2->filter[u].flags) HGOTO_DONE(-1);
- if(pline1->filter[u].flags > pline2->filter[u].flags) HGOTO_DONE(1);
-
- /* Check the name of the filter */
- if(pline1->filter[u].name == NULL && pline2->filter[u].name != NULL) HGOTO_DONE(-1);
- if(pline1->filter[u].name != NULL && pline2->filter[u].name == NULL) HGOTO_DONE(1);
- if(pline1->filter[u].name != NULL)
- if((cmp_value = HDstrcmp(pline1->filter[u].name, pline2->filter[u].name)) != 0)
- HGOTO_DONE(cmp_value);
-
- /* Check the number of parameters for the filter */
- if(pline1->filter[u].cd_nelmts < pline2->filter[u].cd_nelmts) HGOTO_DONE(-1);
- if(pline1->filter[u].cd_nelmts > pline2->filter[u].cd_nelmts) HGOTO_DONE(1);
-
- /* Check the filter parameter information */
- if(pline1->filter[u].cd_values == NULL && pline2->filter[u].cd_values != NULL) HGOTO_DONE(-1);
- if(pline1->filter[u].cd_values != NULL && pline2->filter[u].cd_values == NULL) HGOTO_DONE(1);
- if(pline1->filter[u].cd_values != NULL && pline1->filter[u].cd_nelmts > 0) {
- size_t v; /* Local index variable */
-
- /* Loop through all parameters, comparing them */
- for(v = 0; v < pline1->filter[u].cd_nelmts; v++) {
- /* Check each parameter for the filter */
- if(pline1->filter[u].cd_values[v] < pline2->filter[u].cd_values[v]) HGOTO_DONE(-1);
- if(pline1->filter[u].cd_values[v] > pline2->filter[u].cd_values[v]) HGOTO_DONE(1);
- } /* end for */
- } /* end if */
- } /* end for */
- } /* end if */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5P_dcrt_data_pipeline_cmp() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5P_set_layout
*
* Purpose: Sets the layout of raw data in the file.
@@ -1273,700 +1162,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5P_modify_filter
- *
- * Purpose: Modifies the specified FILTER in the
- * transient or permanent output filter pipeline
- * depending on whether PLIST is a dataset creation or dataset
- * transfer property list. The FLAGS argument specifies certain
- * general properties of the filter and is documented below.
- * The CD_VALUES is an array of CD_NELMTS integers which are
- * auxiliary data for the filter. The integer vlues will be
- * stored in the dataset object header as part of the filter
- * information.
- *
- * The FLAGS argument is a bit vector of the following fields:
- *
- * H5Z_FLAG_OPTIONAL(0x0001)
- * If this bit is set then the filter is optional. If the
- * filter fails during an H5Dwrite() operation then the filter
- * is just excluded from the pipeline for the chunk for which it
- * failed; the filter will not participate in the pipeline
- * during an H5Dread() of the chunk. If this bit is clear and
- * the filter fails then the entire I/O operation fails.
- * If this bit is set but encoding is disabled for a filter,
- * attempting to write will generate an error.
- *
- * Note: This function currently supports only the permanent filter
- * pipeline. That is, PLIST_ID must be a dataset creation
- * property list.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * Wednesday, October 17, 2007
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5P_modify_filter(H5P_genplist_t *plist, H5Z_filter_t filter, unsigned flags,
- size_t cd_nelmts, const unsigned cd_values[/*cd_nelmts*/])
-{
- H5O_pline_t pline;
- herr_t ret_value = SUCCEED; /* return value */
-
- FUNC_ENTER_NOAPI(H5P_modify_filter, FAIL)
-
- /* Get the pipeline property to append to */
- if(H5P_get(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline")
-
- /* Modify the filter parameters of the I/O pipeline */
- if(H5Z_modify(&pline, filter, flags, cd_nelmts, cd_values) < 0)
- HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add filter to pipeline")
-
- /* Put the I/O pipeline information back into the property list */
- if(H5P_set(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set pipeline")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5P_modify_filter() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5Pmodify_filter
- *
- * Purpose: Modifies the specified FILTER in the
- * transient or permanent output filter pipeline
- * depending on whether PLIST is a dataset creation or dataset
- * transfer property list. The FLAGS argument specifies certain
- * general properties of the filter and is documented below.
- * The CD_VALUES is an array of CD_NELMTS integers which are
- * auxiliary data for the filter. The integer vlues will be
- * stored in the dataset object header as part of the filter
- * information.
- *
- * The FLAGS argument is a bit vector of the following fields:
- *
- * H5Z_FLAG_OPTIONAL(0x0001)
- * If this bit is set then the filter is optional. If the
- * filter fails during an H5Dwrite() operation then the filter
- * is just excluded from the pipeline for the chunk for which it
- * failed; the filter will not participate in the pipeline
- * during an H5Dread() of the chunk. If this bit is clear and
- * the filter fails then the entire I/O operation fails.
- * If this bit is set but encoding is disabled for a filter,
- * attempting to write will generate an error.
- *
- * Note: This function currently supports only the permanent filter
- * pipeline. That is, PLIST_ID must be a dataset creation
- * property list.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * Friday, April 5, 2003
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Pmodify_filter(hid_t plist_id, H5Z_filter_t filter, unsigned int flags,
- size_t cd_nelmts, const unsigned int cd_values[/*cd_nelmts*/])
-{
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value = SUCCEED; /* return value */
-
- FUNC_ENTER_API(H5Pmodify_filter, FAIL)
- H5TRACE5("e", "iZfIuz*[a3]Iu", plist_id, filter, flags, cd_nelmts, cd_values);
-
- /* Check args */
- if (filter<0 || filter>H5Z_FILTER_MAX)
- HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid filter identifier")
- if (flags & ~((unsigned)H5Z_FLAG_DEFMASK))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid flags")
- if (cd_nelmts>0 && !cd_values)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no client data values supplied")
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
-
- /* Modify the filter parameters of the I/O pipeline */
- if(H5P_modify_filter(plist, filter, flags, cd_nelmts, cd_values) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't modify filter")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5Pmodify_filter() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5Pset_filter
- *
- * Purpose: Adds the specified FILTER and corresponding properties to the
- * end of the transient or permanent output filter pipeline
- * depending on whether PLIST is a dataset creation or dataset
- * transfer property list. The FLAGS argument specifies certain
- * general properties of the filter and is documented below.
- * The CD_VALUES is an array of CD_NELMTS integers which are
- * auxiliary data for the filter. The integer vlues will be
- * stored in the dataset object header as part of the filter
- * information.
- *
- * The FLAGS argument is a bit vector of the following fields:
- *
- * H5Z_FLAG_OPTIONAL(0x0001)
- * If this bit is set then the filter is optional. If the
- * filter fails during an H5Dwrite() operation then the filter
- * is just excluded from the pipeline for the chunk for which it
- * failed; the filter will not participate in the pipeline
- * during an H5Dread() of the chunk. If this bit is clear and
- * the filter fails then the entire I/O operation fails.
- * If this bit is set but encoding is disabled for a filter,
- * attempting to write will generate an error.
- *
- * Note: This function currently supports only the permanent filter
- * pipeline. That is, PLIST_ID must be a dataset creation
- * property list.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Robb Matzke
- * Wednesday, April 15, 1998
- *
- * Modifications:
- *
- * Raymond Lu
- * Tuesday, October 2, 2001
- * Changed the way to check parameter and set property for
- * generic property list.
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Pset_filter(hid_t plist_id, H5Z_filter_t filter, unsigned int flags,
- size_t cd_nelmts, const unsigned int cd_values[/*cd_nelmts*/])
-{
- H5O_pline_t pline;
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* return value */
-
- FUNC_ENTER_API(H5Pset_filter, FAIL)
- H5TRACE5("e", "iZfIuz*[a3]Iu", plist_id, filter, flags, cd_nelmts, cd_values);
-
- /* Check args */
- if (filter<0 || filter>H5Z_FILTER_MAX)
- HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid filter identifier")
- if (flags & ~((unsigned)H5Z_FLAG_DEFMASK))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid flags")
- if (cd_nelmts>0 && !cd_values)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no client data values supplied")
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
-
- /* Get the pipeline property to append to */
- if(H5P_get(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline")
-
- /* Add the filter to the I/O pipeline */
- if(H5Z_append(&pline, filter, flags, cd_nelmts, cd_values) < 0)
- HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add filter to pipeline")
-
- /* Put the I/O pipeline information back into the property list */
- if(H5P_set(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set pipeline")
-
-done:
- FUNC_LEAVE_API(ret_value)
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: H5Pget_nfilters
- *
- * Purpose: Returns the number of filters in the permanent or transient
- * pipeline depending on whether PLIST_ID is a dataset creation
- * or dataset transfer property list. In each pipeline the
- * filters are numbered from zero through N-1 where N is the
- * value returned by this function. During output to the file
- * the filters of a pipeline are applied in increasing order
- * (the inverse is true for input).
- *
- * Note: Only permanent filters are supported at this time.
- *
- * Return: Success: Number of filters or zero if there are none.
- *
- * Failure: Negative
- *
- * Programmer: Robb Matzke
- * Tuesday, August 4, 1998
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-int
-H5Pget_nfilters(hid_t plist_id)
-{
- H5O_pline_t pline;
- H5P_genplist_t *plist; /* Property list pointer */
- int ret_value; /* return value */
-
- FUNC_ENTER_API(H5Pget_nfilters, FAIL)
- H5TRACE1("Is", "i", plist_id);
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
-
- /* Get value */
- if(H5P_get(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline")
-
- /* Set return value */
- ret_value=(int)(pline.nused);
-
-done:
- FUNC_LEAVE_API(ret_value)
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: H5P_get_filter
- *
- * Purpose: Internal component of H5Pget_filter & H5Pget_filter_id
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * Monday, October 23, 2006
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5P_get_filter(const H5Z_filter_info_t *filter, unsigned int *flags/*out*/,
- size_t *cd_nelmts/*in_out*/, unsigned cd_values[]/*out*/,
- size_t namelen, char name[]/*out*/,
- unsigned *filter_config /*out*/)
-{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5P_get_filter)
-
- /* Check arguments */
- HDassert(filter);
-
- /* Filter flags */
- if(flags)
- *flags = filter->flags;
-
- /* Filter parameters */
- if(cd_values) {
- size_t i; /* Local index variable */
-
- for(i = 0; i < filter->cd_nelmts && i < *cd_nelmts; i++)
- cd_values[i] = filter->cd_values[i];
- } /* end if */
-
- /* Number of filter parameters */
- if(cd_nelmts)
- *cd_nelmts = filter->cd_nelmts;
-
- /* Filter name */
- if(namelen > 0 && name) {
- const char *s = filter->name;
-
- /* If there's no name on the filter, use the class's filter name */
- if(!s) {
- H5Z_class2_t *cls = H5Z_find(filter->id);
-
- if(cls)
- s = cls->name;
- } /* end if */
-
- /* Check for actual name */
- if(s) {
- HDstrncpy(name, s, namelen);
- name[namelen - 1] = '\0';
- } /* end if */
- else {
- /* Check for unknown library filter */
- /* (probably from a future version of the library) */
- if(filter->id < 256) {
- HDstrncpy(name, "Unknown library filter", namelen);
- name[namelen - 1] = '\0';
- } /* end if */
- else
- name[0] = '\0';
- } /* end if */
- } /* end if */
-
- /* Filter configuration (assume filter ID has already been checked) */
- if(filter_config)
- H5Zget_filter_info(filter->id, filter_config);
-
- FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5P_get_filter() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5Pget_filter2
- *
- * Purpose: This is the query counterpart of H5Pset_filter() and returns
- * information about a particular filter number in a permanent
- * or transient pipeline depending on whether PLIST_ID is a
- * dataset creation or transfer property list. On input,
- * CD_NELMTS indicates the number of entries in the CD_VALUES
- * array allocated by the caller while on exit it contains the
- * number of values defined by the filter. FILTER_CONFIG is a bit
- * field contaning encode/decode flags from H5Zpublic.h. The IDX
- * should be a value between zero and N-1 as described for
- * H5Pget_nfilters() and the function will return failure if the
- * filter number is out of range.
- *
- * Return: Success: Filter identification number.
- *
- * Failure: H5Z_FILTER_ERROR (Negative)
- *
- * Programmer: Robb Matzke
- * Wednesday, April 15, 1998
- *
- *-------------------------------------------------------------------------
- */
-H5Z_filter_t
-H5Pget_filter2(hid_t plist_id, unsigned idx, unsigned int *flags/*out*/,
- size_t *cd_nelmts/*in_out*/, unsigned cd_values[]/*out*/,
- size_t namelen, char name[]/*out*/,
- unsigned *filter_config /*out*/)
-{
- H5O_pline_t pline; /* Filter pipeline */
- const H5Z_filter_info_t *filter; /* Pointer to filter information */
- H5P_genplist_t *plist; /* Property list pointer */
- H5Z_filter_t ret_value; /* return value */
-
- FUNC_ENTER_API(H5Pget_filter2, H5Z_FILTER_ERROR)
- H5TRACE8("Zf", "iIux*zxzxx", plist_id, idx, flags, cd_nelmts, cd_values,
- namelen, name, filter_config);
-
- /* Check args */
- if(cd_nelmts || cd_values) {
- /*
- * It's likely that users forget to initialize this on input, so
- * we'll check that it has a reasonable value. The actual number
- * is unimportant because the H5O layer will detect when a message
- * is too large.
- */
- if(cd_nelmts && *cd_nelmts > 256)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5Z_FILTER_ERROR, "probable uninitialized *cd_nelmts argument")
- if(cd_nelmts && *cd_nelmts > 0 && !cd_values)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5Z_FILTER_ERROR, "client data values not supplied")
-
- /*
- * If cd_nelmts is null but cd_values is non-null then just ignore
- * cd_values
- */
- if(!cd_nelmts)
- cd_values = NULL;
- } /* end if */
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5Z_FILTER_ERROR, "can't find object for ID")
-
- /* Get pipeline info */
- if(H5P_get(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5Z_FILTER_ERROR, "can't get pipeline")
-
- /* Check more args */
- if(idx >= pline.nused)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5Z_FILTER_ERROR, "filter number is invalid")
-
- /* Set pointer to particular filter to query */
- filter = &pline.filter[idx];
-
- /* Get filter information */
- if(H5P_get_filter(filter, flags, cd_nelmts, cd_values, namelen, name, filter_config) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5Z_FILTER_ERROR, "can't get filter info")
-
- /* Set return value */
- ret_value = filter->id;
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5Pget_filter2() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5P_get_filter_by_id
- *
- * Purpose: This is an additional query counterpart of H5Pset_filter() and
- * returns information about a particular filter in a permanent
- * or transient pipeline depending on whether PLIST_ID is a
- * dataset creation or transfer property list. On input,
- * CD_NELMTS indicates the number of entries in the CD_VALUES
- * array allocated by the caller while on exit it contains the
- * number of values defined by the filter. FILTER_CONFIG is a bit
- * field contaning encode/decode flags from H5Zpublic.h. The ID
- * should be the filter ID to retrieve the parameters for. If the
- * filter is not set for the property list, an error will be returned.
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * Wednesday, October 17, 2007
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5P_get_filter_by_id(H5P_genplist_t *plist, H5Z_filter_t id, unsigned int *flags/*out*/,
- size_t *cd_nelmts/*in_out*/, unsigned cd_values[]/*out*/,
- size_t namelen, char name[]/*out*/, unsigned *filter_config)
-{
- H5O_pline_t pline; /* Filter pipeline */
- H5Z_filter_info_t *filter; /* Pointer to filter information */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(H5P_get_filter_by_id, FAIL)
-
- /* Get pipeline info */
- if(H5P_get(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline")
-
- /* Get pointer to filter in pipeline */
- if(NULL == (filter = H5Z_filter_info(&pline, id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "filter ID is invalid")
-
- /* Get filter information */
- if(H5P_get_filter(filter, flags, cd_nelmts, cd_values, namelen, name, filter_config) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5Z_FILTER_ERROR, "can't get filter info")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5P_get_filter_by_id() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5Pget_filter_by_id2
- *
- * Purpose: This is an additional query counterpart of H5Pset_filter() and
- * returns information about a particular filter in a permanent
- * or transient pipeline depending on whether PLIST_ID is a
- * dataset creation or transfer property list. On input,
- * CD_NELMTS indicates the number of entries in the CD_VALUES
- * array allocated by the caller while on exit it contains the
- * number of values defined by the filter. FILTER_CONFIG is a bit
- * field contaning encode/decode flags from H5Zpublic.h. The ID
- * should be the filter ID to retrieve the parameters for. If the
- * filter is not set for the property list, an error will be returned.
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * Friday, April 5, 2003
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Pget_filter_by_id2(hid_t plist_id, H5Z_filter_t id, unsigned int *flags/*out*/,
- size_t *cd_nelmts/*in_out*/, unsigned cd_values[]/*out*/,
- size_t namelen, char name[]/*out*/, unsigned *filter_config)
-{
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_API(H5Pget_filter_by_id2, FAIL)
- H5TRACE8("e", "iZfx*zxzx*Iu", plist_id, id, flags, cd_nelmts, cd_values,
- namelen, name, filter_config);
-
- /* Check args */
- if(cd_nelmts || cd_values) {
- /*
- * It's likely that users forget to initialize this on input, so
- * we'll check that it has a reasonable value. The actual number
- * is unimportant because the H5O layer will detect when a message
- * is too large.
- */
- if(cd_nelmts && *cd_nelmts > 256)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "probable uninitialized *cd_nelmts argument")
- if(cd_nelmts && *cd_nelmts > 0 && !cd_values)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "client data values not supplied")
-
- /*
- * If cd_nelmts is null but cd_values is non-null then just ignore
- * cd_values
- */
- if(!cd_nelmts)
- cd_values = NULL;
- } /* end if */
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
-
- /* Get filter info */
- if(H5P_get_filter_by_id(plist, id, flags, cd_nelmts, cd_values, namelen, name, filter_config) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5Z_FILTER_ERROR, "can't get filter info")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5Pget_filter_by_id2() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5Pall_filters_avail
- *
- * Purpose: This is a query routine to verify that all the filters set
- * in the dataset creation property list are available currently.
- *
- * Return: Success: TRUE if all filters available, FALSE if one or
- * more filters not currently available.
- * Failure: FAIL on error
- *
- * Programmer: Quincey Koziol
- * Tuesday, April 8, 2003
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-htri_t
-H5Pall_filters_avail(hid_t plist_id)
-{
- H5P_genplist_t *plist; /* Property list pointer */
- H5O_pline_t pline; /* Filter pipeline */
- htri_t ret_value; /* Return value */
-
- FUNC_ENTER_API(H5Pall_filters_avail, FAIL)
- H5TRACE1("t", "i", plist_id);
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
-
- /* Get pipeline info */
- if(H5P_get(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline")
-
- /* Check if all filters are available */
- if((ret_value = H5Z_all_filters_avail(&pline)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "can't check pipeline information")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5Pall_filters_avail() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5Premove_filter
- *
- * Purpose: Deletes a filter from the dataset creation property list;
- * deletes all filters if FILTER is H5Z_FILTER_NONE
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Pedro Vicente
- * January 26, 2004
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Premove_filter(hid_t plist_id, H5Z_filter_t filter)
-{
- H5P_genplist_t *plist; /* Property list pointer */
- H5O_pline_t pline; /* Filter pipeline */
- herr_t ret_value = SUCCEED; /* return value */
-
- FUNC_ENTER_API(H5Premove_filter, FAIL)
- H5TRACE2("e", "iZf", plist_id, filter);
-
- /* Get the property list structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
-
- /* Get pipeline info */
- if(H5P_get(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5Z_FILTER_ERROR, "can't get pipeline")
-
- /* Check if there are any filters */
- if (pline.filter) {
- /* Delete filter */
- if(H5Z_delete(&pline, filter) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5Z_FILTER_ERROR, "can't delete filter")
-
- /* Put the I/O pipeline information back into the property list */
- if(H5P_set(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set pipeline")
- } /* end if */
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5Premove_filter() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5Pset_deflate
- *
- * Purpose: Sets the compression method for a permanent or transient
- * filter pipeline (depending on whether PLIST_ID is a dataset
- * creation or transfer property list) to H5Z_FILTER_DEFLATE
- * and the compression level to LEVEL which should be a value
- * between zero and nine, inclusive. Lower compression levels
- * are faster but result in less compression. This is the same
- * algorithm as used by the GNU gzip program.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Robb Matzke
- * Wednesday, April 15, 1998
- *
- * Modifications:
- *
- * Raymond Lu
- * Tuesday, October 2, 2001
- * Changed the way to check parameter and set property for
- * generic property list.
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Pset_deflate(hid_t plist_id, unsigned level)
-{
- H5O_pline_t pline;
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* return value */
-
- FUNC_ENTER_API(H5Pset_deflate, FAIL)
- H5TRACE2("e", "iIu", plist_id, level);
-
- /* Check arguments */
- if(level>9)
- HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid deflate level")
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
-
- /* Add the filter */
- if(H5P_get(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline")
- if(H5Z_append(&pline, H5Z_FILTER_DEFLATE, H5Z_FLAG_OPTIONAL, (size_t)1, &level) < 0)
- HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add deflate filter to pipeline")
- if(H5P_set(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
- HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to set pipeline")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5Pset_deflate() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5Pset_szip
*
* Purpose: Sets the compression method for a permanent or transient
@@ -2033,11 +1228,11 @@ H5Pset_szip(hid_t plist_id, unsigned options_mask, unsigned pixels_per_block)
cd_values[1]=pixels_per_block;
/* Add the filter */
- if(H5P_get(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
+ if(H5P_get(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline")
if(H5Z_append(&pline, H5Z_FILTER_SZIP, H5Z_FLAG_OPTIONAL, (size_t)2, cd_values) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add szip filter to pipeline")
- if(H5P_set(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
+ if(H5P_set(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to set pipeline")
done:
@@ -2080,11 +1275,11 @@ H5Pset_shuffle(hid_t plist_id)
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Add the filter */
- if(H5P_get(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
+ if(H5P_get(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline")
if(H5Z_append(&pline, H5Z_FILTER_SHUFFLE, H5Z_FLAG_OPTIONAL, (size_t)0, NULL) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to shuffle the data")
- if(H5P_set(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
+ if(H5P_set(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to set pipeline")
done:
@@ -2126,11 +1321,11 @@ H5Pset_nbit(hid_t plist_id)
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Add the nbit filter */
- if(H5P_get(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
+ if(H5P_get(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline")
if(H5Z_append(&pline, H5Z_FILTER_NBIT, H5Z_FLAG_OPTIONAL, (size_t)0, NULL) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add nbit filter to pipeline")
- if(H5P_set(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
+ if(H5P_set(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to set pipeline")
done:
@@ -2205,11 +1400,11 @@ H5Pset_scaleoffset(hid_t plist_id, H5Z_SO_scale_type_t scale_type, int scale_fac
cd_values[1] = (unsigned)scale_factor;
/* Add the scaleoffset filter */
- if(H5P_get(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
+ if(H5P_get(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline")
if(H5Z_append(&pline, H5Z_FILTER_SCALEOFFSET, H5Z_FLAG_OPTIONAL, (size_t)2, cd_values) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add scaleoffset filter to pipeline")
- if(H5P_set(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
+ if(H5P_set(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to set pipeline")
done:
@@ -2218,48 +1413,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Pset_fletcher32
- *
- * Purpose: Sets Fletcher32 checksum of EDC for a dataset creation
- * property list.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Raymond Lu
- * Dec 19, 2002
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Pset_fletcher32(hid_t plist_id)
-{
- H5O_pline_t pline;
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* return value */
-
- FUNC_ENTER_API(H5Pset_fletcher32, FAIL)
- H5TRACE1("e", "i", plist_id);
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
-
- /* Add the Fletcher32 checksum as a filter */
- if(H5P_get(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline")
- if(H5Z_append(&pline, H5Z_FILTER_FLETCHER32, H5Z_FLAG_MANDATORY, (size_t)0, NULL) < 0)
- HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add fletcher32 filter to pipeline")
- if(H5P_set(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
- HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to set pipeline")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5Pset_fletcher32() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5Pset_fill_value
*
* Purpose: Set the fill value for a dataset creation property list. The
@@ -2831,158 +1984,3 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_fill_time() */
-#ifndef H5_NO_DEPRECATED_SYMBOLS
-
-/*-------------------------------------------------------------------------
- * Function: H5Pget_filter1
- *
- * Purpose: This is the query counterpart of H5Pset_filter() and returns
- * information about a particular filter number in a permanent
- * or transient pipeline depending on whether PLIST_ID is a
- * dataset creation or transfer property list. On input,
- * CD_NELMTS indicates the number of entries in the CD_VALUES
- * array allocated by the caller while on exit it contains the
- * number of values defined by the filter. The IDX
- * should be a value between zero and N-1 as described for
- * H5Pget_nfilters() and the function will return failure if the
- * filter number is out of range.
- *
- * Return: Success: Filter identification number.
- *
- * Failure: H5Z_FILTER_ERROR (Negative)
- *
- * Programmer: Robb Matzke
- * Wednesday, April 15, 1998
- *
- *-------------------------------------------------------------------------
- */
-H5Z_filter_t
-H5Pget_filter1(hid_t plist_id, unsigned idx, unsigned int *flags/*out*/,
- size_t *cd_nelmts/*in_out*/, unsigned cd_values[]/*out*/,
- size_t namelen, char name[]/*out*/)
-{
- H5O_pline_t pline; /* Filter pipeline */
- const H5Z_filter_info_t *filter; /* Pointer to filter information */
- H5P_genplist_t *plist; /* Property list pointer */
- H5Z_filter_t ret_value; /* return value */
-
- FUNC_ENTER_API(H5Pget_filter1, H5Z_FILTER_ERROR)
- H5TRACE7("Zf", "iIux*zxzx", plist_id, idx, flags, cd_nelmts, cd_values, namelen,
- name);
-
- /* Check args */
- if(cd_nelmts || cd_values) {
- /*
- * It's likely that users forget to initialize this on input, so
- * we'll check that it has a reasonable value. The actual number
- * is unimportant because the H5O layer will detect when a message
- * is too large.
- */
- if(cd_nelmts && *cd_nelmts > 256)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5Z_FILTER_ERROR, "probable uninitialized *cd_nelmts argument")
- if(cd_nelmts && *cd_nelmts > 0 && !cd_values)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5Z_FILTER_ERROR, "client data values not supplied")
-
- /*
- * If cd_nelmts is null but cd_values is non-null then just ignore
- * cd_values
- */
- if(!cd_nelmts)
- cd_values = NULL;
- } /* end if */
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5Z_FILTER_ERROR, "can't find object for ID")
-
- /* Get pipeline info */
- if(H5P_get(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5Z_FILTER_ERROR, "can't get pipeline")
-
- /* Check more args */
- if(idx >= pline.nused)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5Z_FILTER_ERROR, "filter number is invalid")
-
- /* Set pointer to particular filter to query */
- filter = &pline.filter[idx];
-
- /* Get filter information */
- if(H5P_get_filter(filter, flags, cd_nelmts, cd_values, namelen, name, NULL) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5Z_FILTER_ERROR, "can't get filter info")
-
- /* Set return value */
- ret_value = filter->id;
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5Pget_filter1() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5Pget_filter_by_id1
- *
- * Purpose: This is an additional query counterpart of H5Pset_filter() and
- * returns information about a particular filter in a permanent
- * or transient pipeline depending on whether PLIST_ID is a
- * dataset creation or transfer property list. On input,
- * CD_NELMTS indicates the number of entries in the CD_VALUES
- * array allocated by the caller while on exit it contains the
- * number of values defined by the filter. The ID
- * should be the filter ID to retrieve the parameters for. If the
- * filter is not set for the property list, an error will be returned.
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * Friday, April 5, 2003
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Pget_filter_by_id1(hid_t plist_id, H5Z_filter_t id, unsigned int *flags/*out*/,
- size_t *cd_nelmts/*in_out*/, unsigned cd_values[]/*out*/,
- size_t namelen, char name[]/*out*/)
-{
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_API(H5Pget_filter_by_id1, FAIL)
- H5TRACE7("e", "iZfx*zxzx", plist_id, id, flags, cd_nelmts, cd_values, namelen,
- name);
-
- /* Check args */
- if(cd_nelmts || cd_values) {
- /*
- * It's likely that users forget to initialize this on input, so
- * we'll check that it has a reasonable value. The actual number
- * is unimportant because the H5O layer will detect when a message
- * is too large.
- */
- if(cd_nelmts && *cd_nelmts > 256)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "probable uninitialized *cd_nelmts argument")
- if(cd_nelmts && *cd_nelmts > 0 && !cd_values)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "client data values not supplied")
-
- /*
- * If cd_nelmts is null but cd_values is non-null then just ignore
- * cd_values
- */
- if(!cd_nelmts)
- cd_values = NULL;
- } /* end if */
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
-
- /* Get filter info */
- if(H5P_get_filter_by_id(plist, id, flags, cd_nelmts, cd_values, namelen, name, NULL) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5Z_FILTER_ERROR, "can't get filter info")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5Pget_filter_by_id1() */
-
-#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
diff --git a/src/H5Pdeprec.c b/src/H5Pdeprec.c
index 208fcb2..5c72247 100644
--- a/src/H5Pdeprec.c
+++ b/src/H5Pdeprec.c
@@ -440,5 +440,59 @@ H5Pinsert1(hid_t plist_id, const char *name, size_t size, void *value,
done:
FUNC_LEAVE_API(ret_value);
} /* H5Pinsert1() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pget_version
+ *
+ * Purpose: Retrieves version information for various parts of a file.
+ *
+ * SUPER: The file super block.
+ * FREELIST: The global free list.
+ * STAB: The root symbol table entry.
+ * SHHDR: Shared object headers.
+ *
+ * Any (or even all) of the output arguments can be null
+ * pointers.
+ *
+ * Return: Success: Non-negative, version information is returned
+ * through the arguments.
+ *
+ * Failure: Negative
+ *
+ * Programmer: Robb Matzke
+ * Wednesday, January 7, 1998
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pget_version(hid_t plist_id, unsigned *super/*out*/, unsigned *freelist/*out*/,
+ unsigned *stab/*out*/, unsigned *shhdr/*out*/)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(H5Pget_version, FAIL)
+ H5TRACE5("e", "ixxxx", plist_id, super, freelist, stab, shhdr);
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+
+ /* Get values */
+ if(super)
+ if(H5P_get(plist, H5F_CRT_SUPER_VERS_NAME, super) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get superblock version")
+ if(freelist)
+ *freelist = HDF5_FREESPACE_VERSION; /* (hard-wired) */
+ if(stab)
+ *stab = HDF5_OBJECTDIR_VERSION; /* (hard-wired) */
+ if(shhdr)
+ *shhdr = HDF5_SHAREDHEADER_VERSION; /* (hard-wired) */
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Pget_version() */
+
#endif /* H5_NO_DEPRECATED_SYMBOLS */
diff --git a/src/H5Pdxpl.c b/src/H5Pdxpl.c
index efbdfe7..aab8b57 100644
--- a/src/H5Pdxpl.c
+++ b/src/H5Pdxpl.c
@@ -839,7 +839,7 @@ H5Pget_preserve(hid_t plist_id)
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Get value */
- if (H5P_get(plist,H5D_XFER_BKGR_BUF_NAME,&need_bkg)<0)
+ if (H5P_get(plist,H5D_XFER_BKGR_BUF_TYPE_NAME,&need_bkg)<0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value")
/* Set return value */
diff --git a/src/H5Pfcpl.c b/src/H5Pfcpl.c
index 406dbe1..cb3bccd 100644
--- a/src/H5Pfcpl.c
+++ b/src/H5Pfcpl.c
@@ -55,10 +55,10 @@
#define H5F_CRT_BTREE_RANK_SIZE sizeof(unsigned[H5B_NUM_BTREE_ID])
#define H5F_CRT_BTREE_RANK_DEF {HDF5_BTREE_SNODE_IK_DEF,HDF5_BTREE_CHUNK_IK_DEF}
/* Definitions for byte number in an address */
-#define H5F_CRT_ADDR_BYTE_NUM_SIZE sizeof(size_t)
+#define H5F_CRT_ADDR_BYTE_NUM_SIZE sizeof(uint8_t)
#define H5F_CRT_ADDR_BYTE_NUM_DEF H5F_OBJ_ADDR_SIZE
/* Definitions for byte number for object size */
-#define H5F_CRT_OBJ_BYTE_NUM_SIZE sizeof(size_t)
+#define H5F_CRT_OBJ_BYTE_NUM_SIZE sizeof(uint8_t)
#define H5F_CRT_OBJ_BYTE_NUM_DEF H5F_OBJ_SIZE_SIZE
/* Definitions for version number of the superblock */
#define H5F_CRT_SUPER_VERS_SIZE sizeof(unsigned)
@@ -75,6 +75,11 @@
#define H5F_CRT_SHMSG_LIST_MAX_DEF (50)
#define H5F_CRT_SHMSG_BTREE_MIN_SIZE sizeof(unsigned)
#define H5F_CRT_SHMSG_BTREE_MIN_DEF (40)
+/* Definitions for file space handling strategy */
+#define H5F_CRT_FILE_SPACE_STRATEGY_SIZE sizeof(unsigned)
+#define H5F_CRT_FILE_SPACE_STRATEGY_DEF H5F_FILE_SPACE_STRATEGY_DEF
+#define H5F_CRT_FREE_SPACE_THRESHOLD_SIZE sizeof(hsize_t)
+#define H5F_CRT_FREE_SPACE_THRESHOLD_DEF H5F_FREE_SPACE_THRESHOLD_DEF
/******************/
@@ -142,14 +147,16 @@ H5P_fcrt_reg_prop(H5P_genclass_t *pclass)
hsize_t userblock_size = H5F_CRT_USER_BLOCK_DEF; /* Default userblock size */
unsigned sym_leaf_k = H5F_CRT_SYM_LEAF_DEF; /* Default size for symbol table leaf nodes */
unsigned btree_k[H5B_NUM_BTREE_ID] = H5F_CRT_BTREE_RANK_DEF; /* Default 'K' values for B-trees in file */
- size_t sizeof_addr = H5F_CRT_ADDR_BYTE_NUM_DEF; /* Default size of addresses in the file */
- size_t sizeof_size = H5F_CRT_OBJ_BYTE_NUM_DEF; /* Default size of sizes in the file */
+ uint8_t sizeof_addr = H5F_CRT_ADDR_BYTE_NUM_DEF; /* Default size of addresses in the file */
+ uint8_t sizeof_size = H5F_CRT_OBJ_BYTE_NUM_DEF; /* Default size of sizes in the file */
unsigned superblock_ver = H5F_CRT_SUPER_VERS_DEF; /* Default superblock version # */
unsigned num_sohm_indexes = H5F_CRT_SHMSG_NINDEXES_DEF;
unsigned sohm_index_flags[H5O_SHMESG_MAX_NINDEXES] = H5F_CRT_SHMSG_INDEX_TYPES_DEF;
unsigned sohm_index_minsizes[H5O_SHMESG_MAX_NINDEXES] = H5F_CRT_SHMSG_INDEX_MINSIZE_DEF;
unsigned sohm_list_max = H5F_CRT_SHMSG_LIST_MAX_DEF;
unsigned sohm_btree_min = H5F_CRT_SHMSG_BTREE_MIN_DEF;
+ unsigned file_space_strategy = H5F_CRT_FILE_SPACE_STRATEGY_DEF;
+ hsize_t free_space_threshold = H5F_CRT_FREE_SPACE_THRESHOLD_DEF;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5P_fcrt_reg_prop)
@@ -192,65 +199,19 @@ H5P_fcrt_reg_prop(H5P_genclass_t *pclass)
if(H5P_register(pclass,H5F_CRT_SHMSG_BTREE_MIN_NAME, H5F_CRT_SHMSG_BTREE_MIN_SIZE, &sohm_btree_min,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+ /* Register the file space handling strategy */
+ if(H5P_register(pclass, H5F_CRT_FILE_SPACE_STRATEGY_NAME, H5F_CRT_FILE_SPACE_STRATEGY_SIZE, &file_space_strategy, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+
+ /* Register the free space section threshold */
+ if(H5P_register(pclass, H5F_CRT_FREE_SPACE_THRESHOLD_NAME, H5F_CRT_FREE_SPACE_THRESHOLD_SIZE, &free_space_threshold, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P_fcrt_reg_prop() */
/*-------------------------------------------------------------------------
- * Function: H5Pget_version
- *
- * Purpose: Retrieves version information for various parts of a file.
- *
- * SUPER: The file super block.
- * FREELIST: The global free list.
- * STAB: The root symbol table entry.
- * SHHDR: Shared object headers.
- *
- * Any (or even all) of the output arguments can be null
- * pointers.
- *
- * Return: Success: Non-negative, version information is returned
- * through the arguments.
- *
- * Failure: Negative
- *
- * Programmer: Robb Matzke
- * Wednesday, January 7, 1998
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Pget_version(hid_t plist_id, unsigned *super/*out*/, unsigned *freelist/*out*/,
- unsigned *stab/*out*/, unsigned *shhdr/*out*/)
-{
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_API(H5Pget_version, FAIL)
- H5TRACE5("e", "ixxxx", plist_id, super, freelist, stab, shhdr);
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
-
- /* Get values */
- if(super)
- if(H5P_get(plist, H5F_CRT_SUPER_VERS_NAME, super) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get superblock version")
- if(freelist)
- *freelist = HDF5_FREESPACE_VERSION; /* (hard-wired) */
- if(stab)
- *stab = HDF5_OBJECTDIR_VERSION; /* (hard-wired) */
- if(shhdr)
- *shhdr = HDF5_SHAREDHEADER_VERSION; /* (hard-wired) */
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5Pget_version() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5Pset_userblock
*
* Purpose: Sets the userblock size field of a file creation property
@@ -351,46 +312,48 @@ done:
* Programmer: Robb Matzke
* Tuesday, January 6, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_sizes(hid_t plist_id, size_t sizeof_addr, size_t sizeof_size)
{
H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* return value */
+ herr_t ret_value = SUCCEED; /* return value */
- FUNC_ENTER_API(H5Pset_sizes, FAIL);
+ FUNC_ENTER_API(H5Pset_sizes, FAIL)
H5TRACE3("e", "izz", plist_id, sizeof_addr, sizeof_size);
/* Check arguments */
- if (sizeof_addr) {
- if (sizeof_addr != 2 && sizeof_addr != 4 &&
- sizeof_addr != 8 && sizeof_addr != 16)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file haddr_t size is not valid");
- }
- if (sizeof_size) {
- if (sizeof_size != 2 && sizeof_size != 4 &&
- sizeof_size != 8 && sizeof_size != 16)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file size_t size is not valid");
- }
+ if(sizeof_addr) {
+ if(sizeof_addr != 2 && sizeof_addr != 4 && sizeof_addr != 8 && sizeof_addr != 16)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file haddr_t size is not valid")
+ } /* end if */
+ if(sizeof_size) {
+ if(sizeof_size != 2 && sizeof_size != 4 && sizeof_size != 8 && sizeof_size != 16)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file size_t size is not valid")
+ } /* end if */
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Set value */
- if (sizeof_addr)
- if(H5P_set(plist, H5F_CRT_ADDR_BYTE_NUM_NAME, &sizeof_addr) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set byte number for an address");
- if (sizeof_size)
- if(H5P_set(plist, H5F_CRT_OBJ_BYTE_NUM_NAME, &sizeof_size) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set byte number for object ");
+ if(sizeof_addr) {
+ uint8_t tmp_sizeof_addr = (uint8_t)sizeof_addr;
+
+ if(H5P_set(plist, H5F_CRT_ADDR_BYTE_NUM_NAME, &tmp_sizeof_addr) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set byte number for an address")
+ } /* end if */
+ if(sizeof_size) {
+ uint8_t tmp_sizeof_size = (uint8_t)sizeof_size;
+
+ if(H5P_set(plist, H5F_CRT_OBJ_BYTE_NUM_NAME, &tmp_sizeof_size) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set byte number for object ")
+ } /* end if */
done:
- FUNC_LEAVE_API(ret_value);
-}
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Pset_sizes() */
/*-------------------------------------------------------------------------
@@ -401,41 +364,45 @@ done:
* even both) SIZEOF_ADDR and SIZEOF_SIZE may be null pointers.
*
* Return: Success: Non-negative, sizes returned through arguments.
- *
* Failure: Negative
*
* Programmer: Robb Matzke
* Wednesday, January 7, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
-H5Pget_sizes(hid_t plist_id,
- size_t *sizeof_addr /*out */ , size_t *sizeof_size /*out */ )
+H5Pget_sizes(hid_t plist_id, size_t *sizeof_addr, size_t *sizeof_size)
{
H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* return value */
+ herr_t ret_value = SUCCEED; /* return value */
- FUNC_ENTER_API(H5Pget_sizes, FAIL);
- H5TRACE3("e", "ixx", plist_id, sizeof_addr, sizeof_size);
+ FUNC_ENTER_API(H5Pget_sizes, FAIL)
+ H5TRACE3("e", "i*z*z", plist_id, sizeof_addr, sizeof_size);
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Get values */
- if (sizeof_addr)
- if(H5P_get(plist, H5F_CRT_ADDR_BYTE_NUM_NAME, sizeof_addr) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get byte number for an address");
- if (sizeof_size)
- if(H5P_get(plist, H5F_CRT_OBJ_BYTE_NUM_NAME, sizeof_size) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get byte number for object ");
+ if(sizeof_addr) {
+ uint8_t tmp_sizeof_addr;
+
+ if(H5P_get(plist, H5F_CRT_ADDR_BYTE_NUM_NAME, &tmp_sizeof_addr) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get byte number for an address")
+ *sizeof_addr = tmp_sizeof_addr;
+ } /* end if */
+ if(sizeof_size) {
+ uint8_t tmp_sizeof_size;
+
+ if(H5P_get(plist, H5F_CRT_OBJ_BYTE_NUM_NAME, &tmp_sizeof_size) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get byte number for object ")
+ *sizeof_size = tmp_sizeof_size;
+ } /* end if */
done:
- FUNC_LEAVE_API(ret_value);
-}
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Pget_sizes() */
/*-------------------------------------------------------------------------
@@ -943,3 +910,88 @@ done:
FUNC_LEAVE_API(ret_value);
} /* end H5Pget_shared_mesg_phase_change() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pset_file_space
+ *
+ * Purpose: Sets the strategy that the library employs in managing file space.
+ * If strategy is zero, the property is not changed; the existing
+ * strategy is retained.
+ * Sets the threshold value that the file's free space
+ * manager(s) will use to track free space sections.
+ * If threshold is zero, the property is not changed; the existing
+ * threshold is retained.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Vailin Choi; June 10, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pset_file_space(hid_t plist_id, H5F_file_space_type_t strategy, hsize_t threshold)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(H5Pset_file_space, FAIL)
+ H5TRACE3("e", "iFfh", plist_id, strategy, threshold);
+
+ if((unsigned)strategy >= H5F_FILE_SPACE_NTYPES)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid strategy")
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+
+ /* Set value(s), if non-zero */
+ if(strategy)
+ if(H5P_set(plist, H5F_CRT_FILE_SPACE_STRATEGY_NAME, &strategy) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set file space strategy")
+ if(threshold)
+ if(H5P_set(plist, H5F_CRT_FREE_SPACE_THRESHOLD_NAME, &threshold) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set free-space threshold")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* H5Pset_file_space() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pget_file_space
+ *
+ * Purpose: Retrieves the strategy that the library uses in managing file space.
+ * Retrieves the threshold value that the file's free space
+ * managers use to track free space sections.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Vailin Choi; June 10, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pget_file_space(hid_t plist_id, H5F_file_space_type_t *strategy, hsize_t *threshold)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(H5Pget_file_space, FAIL)
+ H5TRACE3("e", "i*Ff*h", plist_id, strategy, threshold);
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+
+ /* Get value(s) */
+ if(strategy)
+ if(H5P_get(plist, H5F_CRT_FILE_SPACE_STRATEGY_NAME, strategy) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get file space strategy")
+ if(threshold)
+ if(H5P_get(plist, H5F_CRT_FREE_SPACE_THRESHOLD_NAME, threshold) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get free-space threshold")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* H5Pget_file_space() */
+
diff --git a/src/H5Pint.c b/src/H5Pint.c
index 364cab2..4da7f09 100644
--- a/src/H5Pint.c
+++ b/src/H5Pint.c
@@ -782,14 +782,22 @@ H5P_copy_plist(H5P_genplist_t *old_plist, hbool_t app_ref)
/* Save the property list ID in the property list struct, for use in the property class's 'close' callback */
new_plist->plist_id=new_plist_id;
- /* Call the class callback (if it exists) now that we have the property list ID */
- if(new_plist->pclass->copy_func!=NULL) {
- if((new_plist->pclass->copy_func)(new_plist_id,old_plist->plist_id,old_plist->pclass->copy_data) < 0) {
- /* Delete ID, ignore return value */
- H5I_remove(new_plist_id);
- HGOTO_ERROR (H5E_PLIST, H5E_CANTINIT, FAIL,"Can't initialize property");
+ /* Call the class callback (if it exists) now that we have the property list ID
+ * (up through chain of parent classes also)
+ */
+ tclass = new_plist->pclass;
+ while(NULL != tclass) {
+ if(NULL != tclass->copy_func) {
+ if((tclass->copy_func)(new_plist_id, old_plist->plist_id, old_plist->pclass->copy_data) < 0) {
+ /* Delete ID, ignore return value */
+ H5I_remove(new_plist_id);
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL,"Can't initialize property")
+ } /* end if */
} /* end if */
- } /* end if */
+
+ /* Go up to parent class */
+ tclass = tclass->parent;
+ } /* end while */
/* Set the class initialization flag */
new_plist->class_init=1;
@@ -1658,8 +1666,9 @@ done:
hid_t
H5P_create_id(H5P_genclass_t *pclass, hbool_t app_ref)
{
- H5P_genplist_t *plist=NULL; /* Property list created */
- hid_t plist_id=FAIL; /* Property list ID */
+ H5P_genclass_t *tclass; /* Temporary class pointer */
+ H5P_genplist_t *plist = NULL; /* Property list created */
+ hid_t plist_id = FAIL; /* Property list ID */
hid_t ret_value; /* return value */
FUNC_ENTER_NOAPI(H5P_create_id, FAIL);
@@ -1677,14 +1686,22 @@ H5P_create_id(H5P_genclass_t *pclass, hbool_t app_ref)
/* Save the property list ID in the property list struct, for use in the property class's 'close' callback */
plist->plist_id=plist_id;
- /* Call the class callback (if it exists) now that we have the property list ID */
- if(plist->pclass->create_func!=NULL) {
- if((plist->pclass->create_func)(plist_id,plist->pclass->create_data) < 0) {
- /* Delete ID, ignore return value */
- H5I_remove(plist_id);
- HGOTO_ERROR (H5E_PLIST, H5E_CANTINIT, FAIL,"Can't initialize property");
+ /* Call the class callback (if it exists) now that we have the property list ID
+ * (up through chain of parent classes also)
+ */
+ tclass = plist->pclass;
+ while(NULL != tclass) {
+ if(NULL != tclass->create_func) {
+ if((tclass->create_func)(plist_id, tclass->create_data) < 0) {
+ /* Delete ID, ignore return value */
+ H5I_remove(plist_id);
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL,"Can't initialize property")
+ } /* end if */
} /* end if */
- } /* end if */
+
+ /* Go up to parent class */
+ tclass = tclass->parent;
+ } /* end while */
/* Set the class initialization flag */
plist->class_init=1;
@@ -4058,10 +4075,20 @@ H5P_close(void *_plist)
assert(plist);
- /* Make call to property list class close callback, if needed */
- if(plist->class_init!=0 && plist->pclass->close_func!=NULL) {
- /* Call user's "close" callback function, ignoring return value */
- (plist->pclass->close_func)(plist->plist_id,plist->pclass->close_data);
+ /* Make call to property list class close callback, if needed
+ * (up through chain of parent classes also)
+ */
+ if(plist->class_init !=0) {
+ tclass = plist->pclass;
+ while(NULL != tclass) {
+ if(NULL != tclass->close_func) {
+ /* Call user's "close" callback function, ignoring return value */
+ (tclass->close_func)(plist->plist_id, tclass->close_data);
+ } /* end if */
+
+ /* Go up to parent class */
+ tclass = tclass->parent;
+ } /* end while */
} /* end if */
/* Create the skip list to hold names of properties already seen
diff --git a/src/H5Pocpl.c b/src/H5Pocpl.c
index a28eeb3..9f144f1 100755
--- a/src/H5Pocpl.c
+++ b/src/H5Pocpl.c
@@ -52,6 +52,9 @@
#define H5O_CRT_ATTR_MIN_DENSE_SIZE sizeof(unsigned)
/* Definitions for object header flags */
#define H5O_CRT_OHDR_FLAGS_SIZE sizeof(uint8_t)
+/* Definitions for filter pipeline */
+#define H5O_CRT_PIPELINE_SIZE sizeof(H5O_pline_t)
+#define H5O_CRT_PIPELINE_CMP H5P_ocrt_pipeline_cmp
/******************/
@@ -70,6 +73,11 @@
/* Property class callbacks */
static herr_t H5P_ocrt_reg_prop(H5P_genclass_t *pclass);
+static herr_t H5P_ocrt_copy(hid_t new_plist_t, hid_t old_plist_t, void *copy_data);
+static herr_t H5P_ocrt_close(hid_t dxpl_id, void *close_data);
+
+/* Property callbacks */
+static int H5P_ocrt_pipeline_cmp(const void *value1, const void *value2, size_t size);
/*********************/
@@ -85,9 +93,9 @@ const H5P_libclass_t H5P_CLS_OCRT[1] = {{
H5P_ocrt_reg_prop, /* Default property registration routine */
NULL, /* Class creation callback */
NULL, /* Class creation callback info */
- NULL, /* Class copy callback */
+ H5P_ocrt_copy, /* Class copy callback */
NULL, /* Class copy callback info */
- NULL, /* Class close callback */
+ H5P_ocrt_close, /* Class close callback */
NULL /* Class close callback info */
}};
@@ -121,7 +129,8 @@ H5P_ocrt_reg_prop(H5P_genclass_t *pclass)
{
unsigned attr_max_compact = H5O_CRT_ATTR_MAX_COMPACT_DEF; /* Default max. compact attribute storage settings */
unsigned attr_min_dense = H5O_CRT_ATTR_MIN_DENSE_DEF; /* Default min. dense attribute storage settings */
- uint8_t ohdr_flags = H5O_CRT_OHDR_FLAGS_DEF; /* Default object header flag settings */
+ uint8_t ohdr_flags = H5O_CRT_OHDR_FLAGS_DEF; /* Default object header flag settings */
+ H5O_pline_t pline = H5O_CRT_PIPELINE_DEF; /* Default I/O pipeline setting */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5P_ocrt_reg_prop)
@@ -141,12 +150,108 @@ H5P_ocrt_reg_prop(H5P_genclass_t *pclass)
&ohdr_flags, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+ /* Register the pipeline property */
+ if(H5P_register(pclass, H5O_CRT_PIPELINE_NAME, H5O_CRT_PIPELINE_SIZE,
+ &pline, NULL, NULL, NULL, NULL, NULL, H5O_CRT_PIPELINE_CMP, NULL) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P_ocrt_reg_prop() */
/*-------------------------------------------------------------------------
+ * Function: H5P_ocrt_copy
+ *
+ * Purpose: Callback routine which is called whenever any object
+ * creation property list is copied. This routine copies
+ * the properties from the old list to the new list.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Neil Fortner
+ * Monday, September 21, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+/* ARGSUSED */
+static herr_t
+H5P_ocrt_copy(hid_t dst_plist_id, hid_t src_plist_id, void UNUSED *copy_data)
+{
+ H5O_pline_t src_pline, dst_pline; /* Source & destination pipelines */
+ H5P_genplist_t *src_plist; /* Pointer to source property list */
+ H5P_genplist_t *dst_plist; /* Pointer to destination property list */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5P_ocrt_copy)
+
+ /* Verify property list IDs */
+ if(NULL == (dst_plist = (H5P_genplist_t *)H5I_object(dst_plist_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an object creation property list")
+ if(NULL == (src_plist = (H5P_genplist_t *)H5I_object(src_plist_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an object creation property list")
+
+ /* Get the link pipeline property from the old property list */
+ if(H5P_get(src_plist, H5O_CRT_PIPELINE_NAME, &src_pline) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline")
+
+ /* Make copy of link pipeline */
+ if(NULL == H5O_msg_copy(H5O_PLINE_ID, &src_pline, &dst_pline))
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't copy link pipeline")
+
+ /* Set the link pipeline property for the destination property list */
+ if(H5P_set(dst_plist, H5O_CRT_PIPELINE_NAME, &dst_pline) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set pipeline")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5P_ocrt_copy() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P_ocrt_close
+ *
+ * Purpose: Callback routine which is called whenever any object create
+ * property list is closed. This routine performs any generic
+ * cleanup needed on the properties the library put into the list.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Neil Fortner
+ * Monday, September 21, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+/* ARGSUSED */
+static herr_t
+H5P_ocrt_close(hid_t dcpl_id, void UNUSED *close_data)
+{
+ H5O_pline_t pline; /* I/O pipeline */
+ H5P_genplist_t *plist; /* Property list */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5P_ocrt_close)
+
+ /* Check arguments */
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(dcpl_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an object creation property list")
+
+ /* Get the link pipeline property from the old property list */
+ if(H5P_get(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline")
+
+ /* Clean up any values set for the link pipeline */
+ if(H5O_msg_reset(H5O_PLINE_ID, &pline) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "can't release pipeline info")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5P_ocrt_close() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5Pset_attr_phase_change
*
* Purpose: Sets the cutoff values for indexes storing attributes
@@ -437,3 +542,1043 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_obj_track_times() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5P_modify_filter
+ *
+ * Purpose: Modifies the specified FILTER in the
+ * transient or permanent output filter pipeline
+ * depending on whether PLIST is a dataset creation or dataset
+ * transfer property list. The FLAGS argument specifies certain
+ * general properties of the filter and is documented below.
+ * The CD_VALUES is an array of CD_NELMTS integers which are
+ * auxiliary data for the filter. The integer vlues will be
+ * stored in the dataset object header as part of the filter
+ * information.
+ *
+ * The FLAGS argument is a bit vector of the following fields:
+ *
+ * H5Z_FLAG_OPTIONAL(0x0001)
+ * If this bit is set then the filter is optional. If the
+ * filter fails during an H5Dwrite() operation then the filter
+ * is just excluded from the pipeline for the chunk for which it
+ * failed; the filter will not participate in the pipeline
+ * during an H5Dread() of the chunk. If this bit is clear and
+ * the filter fails then the entire I/O operation fails.
+ * If this bit is set but encoding is disabled for a filter,
+ * attempting to write will generate an error.
+ *
+ * Note: This function currently supports only the permanent filter
+ * pipeline. That is, PLIST_ID must be a dataset creation
+ * property list.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Wednesday, October 17, 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5P_modify_filter(H5P_genplist_t *plist, H5Z_filter_t filter, unsigned flags,
+ size_t cd_nelmts, const unsigned cd_values[/*cd_nelmts*/])
+{
+ H5O_pline_t pline;
+ herr_t ret_value = SUCCEED; /* return value */
+
+ FUNC_ENTER_NOAPI(H5P_modify_filter, FAIL)
+
+ /* Get the pipeline property to modify */
+ if(H5P_get(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline")
+
+ /* Modify the filter parameters of the I/O pipeline */
+ if(H5Z_modify(&pline, filter, flags, cd_nelmts, cd_values) < 0)
+ HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add filter to pipeline")
+
+ /* Put the I/O pipeline information back into the property list */
+ if(H5P_set(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set pipeline")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5P_modify_filter() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pmodify_filter
+ *
+ * Purpose: Modifies the specified FILTER in the
+ * transient or permanent output filter pipeline
+ * depending on whether PLIST is a dataset creation or dataset
+ * transfer property list. The FLAGS argument specifies certain
+ * general properties of the filter and is documented below.
+ * The CD_VALUES is an array of CD_NELMTS integers which are
+ * auxiliary data for the filter. The integer vlues will be
+ * stored in the dataset object header as part of the filter
+ * information.
+ *
+ * The FLAGS argument is a bit vector of the following fields:
+ *
+ * H5Z_FLAG_OPTIONAL(0x0001)
+ * If this bit is set then the filter is optional. If the
+ * filter fails during an H5Dwrite() operation then the filter
+ * is just excluded from the pipeline for the chunk for which it
+ * failed; the filter will not participate in the pipeline
+ * during an H5Dread() of the chunk. If this bit is clear and
+ * the filter fails then the entire I/O operation fails.
+ * If this bit is set but encoding is disabled for a filter,
+ * attempting to write will generate an error.
+ *
+ * Note: This function currently supports only the permanent filter
+ * pipeline. That is, PLIST_ID must be a dataset creation
+ * property list.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Friday, April 5, 2003
+ *
+ * Modifications:
+ *
+ * Neil Fortner
+ * Thursday, March 26, 2009
+ * Overloaded to accept gcpl's as well as dcpl's and moved to
+ * H5Pocpl.c
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pmodify_filter(hid_t plist_id, H5Z_filter_t filter, unsigned int flags,
+ size_t cd_nelmts, const unsigned int cd_values[/*cd_nelmts*/])
+{
+ H5P_genplist_t *plist; /* Property list */
+ herr_t ret_value = SUCCEED; /* return value */
+
+ FUNC_ENTER_API(H5Pmodify_filter, FAIL)
+ H5TRACE5("e", "iZfIuz*[a3]Iu", plist_id, filter, flags, cd_nelmts, cd_values);
+
+ /* Check args */
+ if (filter<0 || filter>H5Z_FILTER_MAX)
+ HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid filter identifier")
+ if (flags & ~((unsigned)H5Z_FLAG_DEFMASK))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid flags")
+ if (cd_nelmts>0 && !cd_values)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no client data values supplied")
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_CREATE)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+
+
+ /* Modify the filter parameters of the I/O pipeline */
+ if(H5P_modify_filter(plist, filter, flags, cd_nelmts, cd_values) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't modify filter")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Pmodify_filter() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pset_filter
+ *
+ * Purpose: Adds the specified FILTER and corresponding properties to the
+ * end of the data or link output filter pipeline
+ * depending on whether PLIST is a dataset creation or group
+ * creation property list. The FLAGS argument specifies certain
+ * general properties of the filter and is documented below.
+ * The CD_VALUES is an array of CD_NELMTS integers which are
+ * auxiliary data for the filter. The integer vlues will be
+ * stored in the dataset object header as part of the filter
+ * information.
+ *
+ * The FLAGS argument is a bit vector of the following fields:
+ *
+ * H5Z_FLAG_OPTIONAL(0x0001)
+ * If this bit is set then the filter is optional. If the
+ * filter fails during an H5Dwrite() operation then the filter
+ * is just excluded from the pipeline for the chunk for which it
+ * failed; the filter will not participate in the pipeline
+ * during an H5Dread() of the chunk. If this bit is clear and
+ * the filter fails then the entire I/O operation fails.
+ * If this bit is set but encoding is disabled for a filter,
+ * attempting to write will generate an error.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Robb Matzke
+ * Wednesday, April 15, 1998
+ *
+ * Modifications:
+ *
+ * Raymond Lu
+ * Tuesday, October 2, 2001
+ * Changed the way to check parameter and set property for
+ * generic property list.
+ *
+ * Neil Fortner
+ * Wednesday, May 20, 2009
+ * Overloaded to accept gcpl's as well as dcpl's and moved to
+ * H5Pocpl.c
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pset_filter(hid_t plist_id, H5Z_filter_t filter, unsigned int flags,
+ size_t cd_nelmts, const unsigned int cd_values[/*cd_nelmts*/])
+{
+ H5P_genplist_t *plist; /* Property list */
+ H5O_pline_t pline; /* Filter pipeline */
+ herr_t ret_value=SUCCEED; /* return value */
+
+ FUNC_ENTER_API(H5Pset_filter, FAIL)
+ H5TRACE5("e", "iZfIuz*[a3]Iu", plist_id, filter, flags, cd_nelmts, cd_values);
+
+ /* Check args */
+ if (filter<0 || filter>H5Z_FILTER_MAX)
+ HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid filter identifier")
+ if (flags & ~((unsigned)H5Z_FLAG_DEFMASK))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid flags")
+ if (cd_nelmts>0 && !cd_values)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no client data values supplied")
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_CREATE)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+
+ /* Get the pipeline property to append to */
+ if(H5P_get(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline")
+
+ /* Add the filter to the I/O pipeline */
+ if(H5Z_append(&pline, filter, flags, cd_nelmts, cd_values) < 0)
+ HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add filter to pipeline")
+
+ /* Put the I/O pipeline information back into the property list */
+ if(H5P_set(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set pipeline")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Pset_filter() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pget_nfilters
+ *
+ * Purpose: Returns the number of filters in the data or link
+ * pipeline depending on whether PLIST_ID is a dataset creation
+ * or group creation property list. In each pipeline the
+ * filters are numbered from zero through N-1 where N is the
+ * value returned by this function. During output to the file
+ * the filters of a pipeline are applied in increasing order
+ * (the inverse is true for input).
+ *
+ * Return: Success: Number of filters or zero if there are none.
+ *
+ * Failure: Negative
+ *
+ * Programmer: Robb Matzke
+ * Tuesday, August 4, 1998
+ *
+ * Modifications:
+ *
+ * Neil Fortner
+ * Wednesday, May 20, 2009
+ * Overloaded to accept gcpl's as well as dcpl's and moved to
+ * H5Pocpl.c
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+H5Pget_nfilters(hid_t plist_id)
+{
+ H5P_genplist_t *plist; /* Property list */
+ H5O_pline_t pline; /* Filter pipeline */
+ int ret_value; /* return value */
+
+ FUNC_ENTER_API(H5Pget_nfilters, FAIL)
+ H5TRACE1("Is", "i", plist_id);
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_CREATE)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+
+ /* Get the pipeline property to query */
+ if(H5P_get(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline")
+
+ /* Set return value */
+ ret_value=(int)(pline.nused);
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Pget_nfilters */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pget_filter2
+ *
+ * Purpose: This is the query counterpart of H5Pset_filter() and returns
+ * information about a particular filter number in a permanent
+ * or transient pipeline depending on whether PLIST_ID is a
+ * dataset creation or transfer property list. On input,
+ * CD_NELMTS indicates the number of entries in the CD_VALUES
+ * array allocated by the caller while on exit it contains the
+ * number of values defined by the filter. FILTER_CONFIG is a bit
+ * field contaning encode/decode flags from H5Zpublic.h. The IDX
+ * should be a value between zero and N-1 as described for
+ * H5Pget_nfilters() and the function will return failure if the
+ * filter number is out of range.
+ *
+ * Return: Success: Filter identification number.
+ *
+ * Failure: H5Z_FILTER_ERROR (Negative)
+ *
+ * Programmer: Robb Matzke
+ * Wednesday, April 15, 1998
+ *
+ * Modifications:
+ *
+ * Neil Fortner
+ * Wednesday, May 20, 2009
+ * Overloaded to accept gcpl's as well as dcpl's and moved to
+ * H5Pocpl.c
+ *
+ *-------------------------------------------------------------------------
+ */
+H5Z_filter_t
+H5Pget_filter2(hid_t plist_id, unsigned idx, unsigned int *flags/*out*/,
+ size_t *cd_nelmts/*in_out*/, unsigned cd_values[]/*out*/,
+ size_t namelen, char name[]/*out*/,
+ unsigned *filter_config /*out*/)
+{
+ H5P_genplist_t *plist; /* Property list */
+ H5O_pline_t pline; /* Filter pipeline */
+ const H5Z_filter_info_t *filter; /* Pointer to filter information */
+ H5Z_filter_t ret_value; /* return value */
+
+ FUNC_ENTER_API(H5Pget_filter2, H5Z_FILTER_ERROR)
+ H5TRACE8("Zf", "iIux*zxzxx", plist_id, idx, flags, cd_nelmts, cd_values,
+ namelen, name, filter_config);
+
+ /* Check args */
+ if(cd_nelmts || cd_values) {
+ /*
+ * It's likely that users forget to initialize this on input, so
+ * we'll check that it has a reasonable value. The actual number
+ * is unimportant because the H5O layer will detect when a message
+ * is too large.
+ */
+ if(cd_nelmts && *cd_nelmts > 256)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5Z_FILTER_ERROR, "probable uninitialized *cd_nelmts argument")
+ if(cd_nelmts && *cd_nelmts > 0 && !cd_values)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5Z_FILTER_ERROR, "client data values not supplied")
+
+ /*
+ * If cd_nelmts is null but cd_values is non-null then just ignore
+ * cd_values
+ */
+ if(!cd_nelmts)
+ cd_values = NULL;
+ } /* end if */
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_CREATE)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5Z_FILTER_ERROR, "can't find object for ID")
+
+ /* Get the pipeline property to query */
+ if(H5P_get(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5Z_FILTER_ERROR, "can't get pipeline")
+
+ /* Check index */
+ if(idx >= pline.nused)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5Z_FILTER_ERROR, "filter number is invalid")
+
+ /* Set pointer to particular filter to query */
+ filter = &pline.filter[idx];
+
+ /* Get filter information */
+ if(H5P_get_filter(filter, flags, cd_nelmts, cd_values, namelen, name, filter_config) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5Z_FILTER_ERROR, "can't get filter info")
+
+ /* Set return value */
+ ret_value = filter->id;
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Pget_filter2() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P_get_filter_by_id
+ *
+ * Purpose: This is an additional query counterpart of H5Pset_filter() and
+ * returns information about a particular filter in a permanent
+ * or transient pipeline depending on whether PLIST_ID is a
+ * dataset creation or transfer property list. On input,
+ * CD_NELMTS indicates the number of entries in the CD_VALUES
+ * array allocated by the caller while on exit it contains the
+ * number of values defined by the filter. FILTER_CONFIG is a bit
+ * field contaning encode/decode flags from H5Zpublic.h. The ID
+ * should be the filter ID to retrieve the parameters for. If the
+ * filter is not set for the property list, an error will be returned.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Wednesday, October 17, 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5P_get_filter_by_id(H5P_genplist_t *plist, H5Z_filter_t id, unsigned int *flags/*out*/,
+ size_t *cd_nelmts/*in_out*/, unsigned cd_values[]/*out*/,
+ size_t namelen, char name[]/*out*/, unsigned *filter_config)
+{
+ H5O_pline_t pline; /* Filter pipeline */
+ H5Z_filter_info_t *filter; /* Pointer to filter information */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5P_get_filter_by_id, FAIL)
+
+ /* Get pipeline info */
+ if(H5P_get(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline")
+
+ /* Get pointer to filter in pipeline */
+ if(NULL == (filter = H5Z_filter_info(&pline, id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "filter ID is invalid")
+
+ /* Get filter information */
+ if(H5P_get_filter(filter, flags, cd_nelmts, cd_values, namelen, name, filter_config) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get filter info")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5P_get_filter_by_id() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pget_filter_by_id2
+ *
+ * Purpose: This is an additional query counterpart of H5Pset_filter() and
+ * returns information about a particular filter in a permanent
+ * or transient pipeline depending on whether PLIST_ID is a
+ * dataset creation or transfer property list. On input,
+ * CD_NELMTS indicates the number of entries in the CD_VALUES
+ * array allocated by the caller while on exit it contains the
+ * number of values defined by the filter. FILTER_CONFIG is a bit
+ * field contaning encode/decode flags from H5Zpublic.h. The ID
+ * should be the filter ID to retrieve the parameters for. If the
+ * filter is not set for the property list, an error will be returned.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Friday, April 5, 2003
+ *
+ * Modifications:
+ *
+ * Neil Fortner
+ * Thursday, May 21, 2009
+ * Overloaded to accept gcpl's as well as dcpl's and moved to
+ * H5Pocpl.c
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pget_filter_by_id2(hid_t plist_id, H5Z_filter_t id, unsigned int *flags/*out*/,
+ size_t *cd_nelmts/*in_out*/, unsigned cd_values[]/*out*/,
+ size_t namelen, char name[]/*out*/, unsigned *filter_config)
+{
+ H5P_genplist_t *plist; /* Property list */
+ H5O_pline_t pline; /* Filter pipeline */
+ const H5Z_filter_info_t *filter; /* Pointer to filter information */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(H5Pget_filter_by_id2, FAIL)
+ H5TRACE8("e", "iZfx*zxzx*Iu", plist_id, id, flags, cd_nelmts, cd_values,
+ namelen, name, filter_config);
+
+ /* Check args */
+ if(cd_nelmts || cd_values) {
+ /*
+ * It's likely that users forget to initialize this on input, so
+ * we'll check that it has a reasonable value. The actual number
+ * is unimportant because the H5O layer will detect when a message
+ * is too large.
+ */
+ if(cd_nelmts && *cd_nelmts > 256)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "probable uninitialized *cd_nelmts argument")
+ if(cd_nelmts && *cd_nelmts > 0 && !cd_values)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "client data values not supplied")
+
+ /*
+ * If cd_nelmts is null but cd_values is non-null then just ignore
+ * cd_values
+ */
+ if(!cd_nelmts)
+ cd_values = NULL;
+ } /* end if */
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_CREATE)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+
+ /* Get the pipeline property to query */
+ if(H5P_get(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline")
+
+ /* Get pointer to filter in pipeline */
+ if(NULL == (filter = H5Z_filter_info(&pline, id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "filter ID is invalid")
+
+ /* Get filter information */
+ if(H5P_get_filter_by_id(plist, id, flags, cd_nelmts, cd_values, namelen,
+ name, filter_config) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get filter info")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Pget_filter_by_id2() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pall_filters_avail
+ *
+ * Purpose: This is a query routine to verify that all the filters set
+ * in the dataset creation property list are available currently.
+ *
+ * Return: Success: TRUE if all filters available, FALSE if one or
+ * more filters not currently available.
+ * Failure: FAIL on error
+ *
+ * Programmer: Quincey Koziol
+ * Tuesday, April 8, 2003
+ *
+ * Modifications:
+ *
+ * Neil Fortner
+ * Thursday, May 21, 2009
+ * Overloaded to accept gcpl's as well as dcpl's and moved to
+ * H5Pocpl.c
+ *
+ *-------------------------------------------------------------------------
+ */
+htri_t
+H5Pall_filters_avail(hid_t plist_id)
+{
+ H5P_genplist_t *plist; /* Property list */
+ H5O_pline_t pline; /* Filter pipeline */
+ htri_t ret_value; /* Return value */
+
+ FUNC_ENTER_API(H5Pall_filters_avail, FAIL)
+ H5TRACE1("t", "i", plist_id);
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_CREATE)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+
+ /* Get the pipeline property to query */
+ if(H5P_get(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline")
+
+ /* Check if all filters are available */
+ if((ret_value = H5Z_all_filters_avail(&pline)) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "can't check pipeline information")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Pall_filters_avail() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Premove_filter
+ *
+ * Purpose: Deletes a filter from the dataset creation property list;
+ * deletes all filters if FILTER is H5Z_FILTER_NONE
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Pedro Vicente
+ * January 26, 2004
+ *
+ * Modifications:
+ *
+ * Neil Fortner
+ * Thursday, May 21, 2009
+ * Overloaded to accept gcpl's as well as dcpl's and moved to
+ * H5Pocpl.c
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Premove_filter(hid_t plist_id, H5Z_filter_t filter)
+{
+ H5P_genplist_t *plist; /* Property list */
+ H5O_pline_t pline; /* Filter pipeline */
+ herr_t ret_value = SUCCEED; /* return value */
+
+ FUNC_ENTER_API(H5Premove_filter, FAIL)
+ H5TRACE2("e", "iZf", plist_id, filter);
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_CREATE)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+
+ /* Get the pipeline property to modify */
+ if(H5P_get(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline")
+
+ /* Check if there are any filters */
+ if (pline.filter) {
+ /* Delete filter */
+ if(H5Z_delete(&pline, filter) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't delete filter")
+
+ /* Put the I/O pipeline information back into the property list */
+ if(H5P_set(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set pipeline")
+ } /* end if */
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Premove_filter() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pset_deflate
+ *
+ * Purpose: Sets the compression method for a dataset or group link
+ * filter pipeline (depending on whether PLIST_ID is a dataset
+ * creation or group creation property list) to H5Z_FILTER_DEFLATE
+ * and the compression level to LEVEL which should be a value
+ * between zero and nine, inclusive. Lower compression levels
+ * are faster but result in less compression. This is the same
+ * algorithm as used by the GNU gzip program.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Robb Matzke
+ * Wednesday, April 15, 1998
+ *
+ * Modifications:
+ *
+ * Raymond Lu
+ * Tuesday, October 2, 2001
+ * Changed the way to check parameter and set property for
+ * generic property list.
+ *
+ * Neil Fortner
+ * Thursday, March 26, 2009
+ * Overloaded to accept gcpl's as well as dcpl's and moved to
+ * H5Pocpl.c
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pset_deflate(hid_t plist_id, unsigned level)
+{
+ H5P_genplist_t *plist; /* Property list */
+ H5O_pline_t pline; /* Filter pipeline */
+ herr_t ret_value = SUCCEED; /* return value */
+
+ FUNC_ENTER_API(H5Pset_deflate, FAIL)
+ H5TRACE2("e", "iIu", plist_id, level);
+
+ /* Check arguments */
+ if(level > 9)
+ HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid deflate level")
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_CREATE)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+
+ /* Get the pipeline property to append to */
+ if(H5P_get(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline")
+
+ /* Add the filter */
+ if(H5Z_append(&pline, H5Z_FILTER_DEFLATE, H5Z_FLAG_OPTIONAL, (size_t)1, &level) < 0)
+ HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add deflate filter to pipeline")
+
+ /* Put the I/O pipeline information back into the property list */
+ if(H5P_set(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set pipeline")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Pset_deflate() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pset_fletcher32
+ *
+ * Purpose: Sets Fletcher32 checksum of EDC for a dataset creation
+ * property list or group creation property list.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Raymond Lu
+ * Dec 19, 2002
+ *
+ * Modifications:
+ *
+ * Neil Fortner
+ * Wednesday, May 6, 2009
+ * Overloaded to accept gcpl's as well as dcpl's and moved to
+ * H5Pocpl.c
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pset_fletcher32(hid_t plist_id)
+{
+ H5P_genplist_t *plist; /* Property list */
+ H5O_pline_t pline; /* Filter pipeline */
+ herr_t ret_value=SUCCEED; /* return value */
+
+ FUNC_ENTER_API(H5Pset_fletcher32, FAIL)
+ H5TRACE1("e", "i", plist_id);
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_CREATE)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+
+ /* Get the pipeline property to append to */
+ if(H5P_get(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline")
+
+ /* Add the Fletcher32 checksum as a filter */
+ if(H5Z_append(&pline, H5Z_FILTER_FLETCHER32, H5Z_FLAG_MANDATORY, (size_t)0, NULL) < 0)
+ HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add fletcher32 filter to pipeline")
+
+ /* Put the I/O pipeline information back into the property list */
+ if(H5P_set(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set pipeline")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Pset_fletcher32() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P_get_filter
+ *
+ * Purpose: Internal component of H5Pget_filter & H5Pget_filter_id
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Monday, October 23, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5P_get_filter(const H5Z_filter_info_t *filter, unsigned int *flags/*out*/,
+ size_t *cd_nelmts/*in_out*/, unsigned cd_values[]/*out*/,
+ size_t namelen, char name[]/*out*/,
+ unsigned *filter_config /*out*/)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5P_get_filter)
+
+ /* Check arguments */
+ HDassert(filter);
+
+ /* Filter flags */
+ if(flags)
+ *flags = filter->flags;
+
+ /* Filter parameters */
+ if(cd_values) {
+ size_t i; /* Local index variable */
+
+ for(i = 0; i < filter->cd_nelmts && i < *cd_nelmts; i++)
+ cd_values[i] = filter->cd_values[i];
+ } /* end if */
+
+ /* Number of filter parameters */
+ if(cd_nelmts)
+ *cd_nelmts = filter->cd_nelmts;
+
+ /* Filter name */
+ if(namelen > 0 && name) {
+ const char *s = filter->name;
+
+ /* If there's no name on the filter, use the class's filter name */
+ if(!s) {
+ H5Z_class2_t *cls = H5Z_find(filter->id);
+
+ if(cls)
+ s = cls->name;
+ } /* end if */
+
+ /* Check for actual name */
+ if(s) {
+ HDstrncpy(name, s, namelen);
+ name[namelen - 1] = '\0';
+ } /* end if */
+ else {
+ /* Check for unknown library filter */
+ /* (probably from a future version of the library) */
+ if(filter->id < 256) {
+ HDstrncpy(name, "Unknown library filter", namelen);
+ name[namelen - 1] = '\0';
+ } /* end if */
+ else
+ name[0] = '\0';
+ } /* end if */
+ } /* end if */
+
+ /* Filter configuration (assume filter ID has already been checked) */
+ if(filter_config)
+ H5Zget_filter_info(filter->id, filter_config);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5P_get_filter() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P_ocrt_pipeline_cmp
+ *
+ * Purpose: Callback routine which is called whenever a filter pipeline
+ * property in a property list is compared.
+ *
+ * Return: positive if VALUE1 is greater than VALUE2, negative if
+ * VALUE2 is greater than VALUE1 and zero if VALUE1 and
+ * VALUE2 are equal.
+ *
+ * Programmer: Quincey Koziol
+ * Wednesday, January 7, 2004
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+H5P_ocrt_pipeline_cmp(const void *_pline1, const void *_pline2, size_t UNUSED size)
+{
+ const H5O_pline_t *pline1 = (const H5O_pline_t *)_pline1, /* Create local aliases for values */
+ *pline2 = (const H5O_pline_t *)_pline2;
+ int cmp_value; /* Value from comparison */
+ herr_t ret_value = 0; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOFUNC(H5P_ocrt_pipeline_cmp)
+
+ /* Sanity check */
+ HDassert(pline1);
+ HDassert(pline2);
+ HDassert(size == sizeof(H5O_pline_t));
+
+ /* Check the number of allocated pipeline entries */
+ if(pline1->nalloc < pline2->nalloc) HGOTO_DONE(-1);
+ if(pline1->nalloc > pline2->nalloc) HGOTO_DONE(1);
+
+ /* Check the number of used pipeline entries */
+ if(pline1->nused < pline2->nused) HGOTO_DONE(-1);
+ if(pline1->nused > pline2->nused) HGOTO_DONE(1);
+
+ /* Check the filter entry information */
+ if(pline1->filter == NULL && pline2->filter != NULL) HGOTO_DONE(-1);
+ if(pline1->filter != NULL && pline2->filter == NULL) HGOTO_DONE(1);
+ if(pline1->filter != NULL && pline1->nused > 0) {
+ size_t u; /* Local index variable */
+
+ /* Loop through all filters, comparing them */
+ for(u = 0; u < pline1->nused; u++) {
+ /* Check the ID of the filter */
+ if(pline1->filter[u].id < pline2->filter[u].id) HGOTO_DONE(-1);
+ if(pline1->filter[u].id > pline2->filter[u].id) HGOTO_DONE(1);
+
+ /* Check the flags for the filter */
+ if(pline1->filter[u].flags < pline2->filter[u].flags) HGOTO_DONE(-1);
+ if(pline1->filter[u].flags > pline2->filter[u].flags) HGOTO_DONE(1);
+
+ /* Check the name of the filter */
+ if(pline1->filter[u].name == NULL && pline2->filter[u].name != NULL) HGOTO_DONE(-1);
+ if(pline1->filter[u].name != NULL && pline2->filter[u].name == NULL) HGOTO_DONE(1);
+ if(pline1->filter[u].name != NULL)
+ if((cmp_value = HDstrcmp(pline1->filter[u].name, pline2->filter[u].name)) != 0)
+ HGOTO_DONE(cmp_value);
+
+ /* Check the number of parameters for the filter */
+ if(pline1->filter[u].cd_nelmts < pline2->filter[u].cd_nelmts) HGOTO_DONE(-1);
+ if(pline1->filter[u].cd_nelmts > pline2->filter[u].cd_nelmts) HGOTO_DONE(1);
+
+ /* Check the filter parameter information */
+ if(pline1->filter[u].cd_values == NULL && pline2->filter[u].cd_values != NULL) HGOTO_DONE(-1);
+ if(pline1->filter[u].cd_values != NULL && pline2->filter[u].cd_values == NULL) HGOTO_DONE(1);
+ if(pline1->filter[u].cd_values != NULL && pline1->filter[u].cd_nelmts > 0) {
+ size_t v; /* Local index variable */
+
+ /* Loop through all parameters, comparing them */
+ for(v = 0; v < pline1->filter[u].cd_nelmts; v++) {
+ /* Check each parameter for the filter */
+ if(pline1->filter[u].cd_values[v] < pline2->filter[u].cd_values[v]) HGOTO_DONE(-1);
+ if(pline1->filter[u].cd_values[v] > pline2->filter[u].cd_values[v]) HGOTO_DONE(1);
+ } /* end for */
+ } /* end if */
+ } /* end for */
+ } /* end if */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5P_ocrt_pipeline_cmp() */
+
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pget_filter1
+ *
+ * Purpose: This is the query counterpart of H5Pset_filter() and returns
+ * information about a particular filter number in a permanent
+ * or transient pipeline depending on whether PLIST_ID is a
+ * dataset creation or transfer property list. On input,
+ * CD_NELMTS indicates the number of entries in the CD_VALUES
+ * array allocated by the caller while on exit it contains the
+ * number of values defined by the filter. The IDX
+ * should be a value between zero and N-1 as described for
+ * H5Pget_nfilters() and the function will return failure if the
+ * filter number is out of range.
+ *
+ * Return: Success: Filter identification number.
+ *
+ * Failure: H5Z_FILTER_ERROR (Negative)
+ *
+ * Programmer: Robb Matzke
+ * Wednesday, April 15, 1998
+ *
+ *-------------------------------------------------------------------------
+ */
+H5Z_filter_t
+H5Pget_filter1(hid_t plist_id, unsigned idx, unsigned int *flags/*out*/,
+ size_t *cd_nelmts/*in_out*/, unsigned cd_values[]/*out*/,
+ size_t namelen, char name[]/*out*/)
+{
+ H5O_pline_t pline; /* Filter pipeline */
+ const H5Z_filter_info_t *filter; /* Pointer to filter information */
+ H5P_genplist_t *plist; /* Property list pointer */
+ H5Z_filter_t ret_value; /* return value */
+
+ FUNC_ENTER_API(H5Pget_filter1, H5Z_FILTER_ERROR)
+ H5TRACE7("Zf", "iIux*zxzx", plist_id, idx, flags, cd_nelmts, cd_values, namelen,
+ name);
+
+ /* Check args */
+ if(cd_nelmts || cd_values) {
+ /*
+ * It's likely that users forget to initialize this on input, so
+ * we'll check that it has a reasonable value. The actual number
+ * is unimportant because the H5O layer will detect when a message
+ * is too large.
+ */
+ if(cd_nelmts && *cd_nelmts > 256)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5Z_FILTER_ERROR, "probable uninitialized *cd_nelmts argument")
+ if(cd_nelmts && *cd_nelmts > 0 && !cd_values)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5Z_FILTER_ERROR, "client data values not supplied")
+
+ /*
+ * If cd_nelmts is null but cd_values is non-null then just ignore
+ * cd_values
+ */
+ if(!cd_nelmts)
+ cd_values = NULL;
+ } /* end if */
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_CREATE)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5Z_FILTER_ERROR, "can't find object for ID")
+
+ /* Get pipeline info */
+ if(H5P_get(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5Z_FILTER_ERROR, "can't get pipeline")
+
+ /* Check more args */
+ if(idx >= pline.nused)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5Z_FILTER_ERROR, "filter number is invalid")
+
+ /* Set pointer to particular filter to query */
+ filter = &pline.filter[idx];
+
+ /* Get filter information */
+ if(H5P_get_filter(filter, flags, cd_nelmts, cd_values, namelen, name, NULL) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5Z_FILTER_ERROR, "can't get filter info")
+
+ /* Set return value */
+ ret_value = filter->id;
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Pget_filter1() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pget_filter_by_id1
+ *
+ * Purpose: This is an additional query counterpart of H5Pset_filter() and
+ * returns information about a particular filter in a permanent
+ * or transient pipeline depending on whether PLIST_ID is a
+ * dataset creation or transfer property list. On input,
+ * CD_NELMTS indicates the number of entries in the CD_VALUES
+ * array allocated by the caller while on exit it contains the
+ * number of values defined by the filter. The ID
+ * should be the filter ID to retrieve the parameters for. If the
+ * filter is not set for the property list, an error will be returned.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Friday, April 5, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pget_filter_by_id1(hid_t plist_id, H5Z_filter_t id, unsigned int *flags/*out*/,
+ size_t *cd_nelmts/*in_out*/, unsigned cd_values[]/*out*/,
+ size_t namelen, char name[]/*out*/)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(H5Pget_filter_by_id1, FAIL)
+ H5TRACE7("e", "iZfx*zxzx", plist_id, id, flags, cd_nelmts, cd_values, namelen,
+ name);
+
+ /* Check args */
+ if(cd_nelmts || cd_values) {
+ /*
+ * It's likely that users forget to initialize this on input, so
+ * we'll check that it has a reasonable value. The actual number
+ * is unimportant because the H5O layer will detect when a message
+ * is too large.
+ */
+ if(cd_nelmts && *cd_nelmts > 256)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "probable uninitialized *cd_nelmts argument")
+ if(cd_nelmts && *cd_nelmts > 0 && !cd_values)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "client data values not supplied")
+
+ /*
+ * If cd_nelmts is null but cd_values is non-null then just ignore
+ * cd_values
+ */
+ if(!cd_nelmts)
+ cd_values = NULL;
+ } /* end if */
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_CREATE)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+
+ /* Get filter info */
+ if(H5P_get_filter_by_id(plist, id, flags, cd_nelmts, cd_values, namelen, name, NULL) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get filter info")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Pget_filter_by_id1() */
+
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+
diff --git a/src/H5Ppkg.h b/src/H5Ppkg.h
index 2959ddc..fd9c65a 100644
--- a/src/H5Ppkg.h
+++ b/src/H5Ppkg.h
@@ -178,6 +178,9 @@ H5_DLL char *H5P_get_class_path(H5P_genclass_t *pclass);
H5_DLL H5P_genclass_t *H5P_open_class_path(const char *path);
H5_DLL H5P_genclass_t *H5P_get_class_parent(const H5P_genclass_t *pclass);
H5_DLL herr_t H5P_close_class(void *_pclass);
+H5_DLL herr_t H5P_get_filter(const H5Z_filter_info_t *filter,
+ unsigned int *flags, size_t *cd_nelmts, unsigned cd_values[],
+ size_t namelen, char name[], unsigned *filter_config);
/* Testing functions */
#ifdef H5P_TESTING
diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h
index 885249d..0b37938 100644
--- a/src/H5Pprivate.h
+++ b/src/H5Pprivate.h
@@ -86,6 +86,11 @@ H5_DLL herr_t H5P_is_fill_value_defined(const H5O_fill_t *fill,
H5D_fill_value_t *status);
H5_DLL int H5P_fill_value_cmp(const void *value1, const void *value2,
size_t size);
+H5_DLL herr_t H5P_modify_filter(H5P_genplist_t *plist, H5Z_filter_t filter,
+ unsigned flags, size_t cd_nelmts, const unsigned cd_values[]);
+H5_DLL herr_t H5P_get_filter_by_id(H5P_genplist_t *plist, H5Z_filter_t id,
+ unsigned int *flags, size_t *cd_nelmts, unsigned cd_values[],
+ size_t namelen, char name[], unsigned *filter_config);
/* *SPECIAL* Don't make more of these! -QAK */
H5_DLL htri_t H5P_isa_class(hid_t plist_id, hid_t pclass_id);
@@ -98,12 +103,6 @@ H5_DLL void *H5P_peek_voidp(H5P_genplist_t *plist, const char *name);
H5_DLL size_t H5P_peek_size_t(H5P_genplist_t *plist, const char *name);
/* Private DCPL routines */
-H5_DLL herr_t H5P_modify_filter(H5P_genplist_t *plist, H5Z_filter_t filter,
- unsigned flags, size_t cd_nelmts, const unsigned cd_values[/*cd_nelmts*/]);
-H5_DLL herr_t H5P_get_filter_by_id(H5P_genplist_t *plist, H5Z_filter_t id,
- unsigned int *flags/*out*/, size_t *cd_nelmts/*in_out*/,
- unsigned cd_values[]/*out*/, size_t namelen, char name[]/*out*/,
- unsigned *filter_config);
H5_DLL herr_t H5P_fill_value_defined(H5P_genplist_t *plist,
H5D_fill_value_t *status);
H5_DLL herr_t H5P_get_fill_value(H5P_genplist_t *plist, const H5T_t *type,
diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h
index 495ba42..1c0bb61 100644
--- a/src/H5Ppublic.h
+++ b/src/H5Ppublic.h
@@ -206,11 +206,29 @@ H5_DLL herr_t H5Pset_attr_creation_order(hid_t plist_id, unsigned crt_order_flag
H5_DLL herr_t H5Pget_attr_creation_order(hid_t plist_id, unsigned *crt_order_flags);
H5_DLL herr_t H5Pset_obj_track_times(hid_t plist_id, hbool_t track_times);
H5_DLL herr_t H5Pget_obj_track_times(hid_t plist_id, hbool_t *track_times);
+H5_DLL herr_t H5Pmodify_filter(hid_t plist_id, H5Z_filter_t filter,
+ unsigned int flags, size_t cd_nelmts,
+ const unsigned int cd_values[/*cd_nelmts*/]);
+H5_DLL herr_t H5Pset_filter(hid_t plist_id, H5Z_filter_t filter,
+ unsigned int flags, size_t cd_nelmts,
+ const unsigned int c_values[]);
+H5_DLL int H5Pget_nfilters(hid_t plist_id);
+H5_DLL H5Z_filter_t H5Pget_filter2(hid_t plist_id, unsigned filter,
+ unsigned int *flags/*out*/,
+ size_t *cd_nelmts/*out*/,
+ unsigned cd_values[]/*out*/,
+ size_t namelen, char name[],
+ unsigned *filter_config /*out*/);
+H5_DLL herr_t H5Pget_filter_by_id2(hid_t plist_id, H5Z_filter_t id,
+ unsigned int *flags/*out*/, size_t *cd_nelmts/*out*/,
+ unsigned cd_values[]/*out*/, size_t namelen, char name[]/*out*/,
+ unsigned *filter_config/*out*/);
+H5_DLL htri_t H5Pall_filters_avail(hid_t plist_id);
+H5_DLL herr_t H5Premove_filter(hid_t plist_id, H5Z_filter_t filter);
+H5_DLL herr_t H5Pset_deflate(hid_t plist_id, unsigned aggression);
+H5_DLL herr_t H5Pset_fletcher32(hid_t plist_id);
/* File creation property list (FCPL) routines */
-H5_DLL herr_t H5Pget_version(hid_t plist_id, unsigned *boot/*out*/,
- unsigned *freelist/*out*/, unsigned *stab/*out*/,
- unsigned *shhdr/*out*/);
H5_DLL herr_t H5Pset_userblock(hid_t plist_id, hsize_t size);
H5_DLL herr_t H5Pget_userblock(hid_t plist_id, hsize_t *size);
H5_DLL herr_t H5Pset_sizes(hid_t plist_id, size_t sizeof_addr,
@@ -227,6 +245,8 @@ H5_DLL herr_t H5Pset_shared_mesg_index(hid_t plist_id, unsigned index_num, unsig
H5_DLL herr_t H5Pget_shared_mesg_index(hid_t plist_id, unsigned index_num, unsigned *mesg_type_flags, unsigned *min_mesg_size);
H5_DLL herr_t H5Pset_shared_mesg_phase_change(hid_t plist_id, unsigned max_list, unsigned min_btree);
H5_DLL herr_t H5Pget_shared_mesg_phase_change(hid_t plist_id, unsigned *max_list, unsigned *min_btree);
+H5_DLL herr_t H5Pset_file_space(hid_t plist_id, H5F_file_space_type_t strategy, hsize_t threshold);
+H5_DLL herr_t H5Pget_file_space(hid_t plist_id, H5F_file_space_type_t *strategy, hsize_t *threshold);
/* File access property list (FAPL) routines */
@@ -279,31 +299,10 @@ H5_DLL int H5Pget_external_count(hid_t plist_id);
H5_DLL herr_t H5Pget_external(hid_t plist_id, unsigned idx, size_t name_size,
char *name/*out*/, off_t *offset/*out*/,
hsize_t *size/*out*/);
-H5_DLL herr_t H5Pmodify_filter(hid_t plist_id, H5Z_filter_t filter,
- unsigned int flags, size_t cd_nelmts,
- const unsigned int cd_values[/*cd_nelmts*/]);
-H5_DLL herr_t H5Pset_filter(hid_t plist_id, H5Z_filter_t filter,
- unsigned int flags, size_t cd_nelmts,
- const unsigned int c_values[]);
-H5_DLL int H5Pget_nfilters(hid_t plist_id);
-H5_DLL H5Z_filter_t H5Pget_filter2(hid_t plist_id, unsigned filter,
- unsigned int *flags/*out*/,
- size_t *cd_nelmts/*out*/,
- unsigned cd_values[]/*out*/,
- size_t namelen, char name[],
- unsigned *filter_config /*out*/);
-H5_DLL herr_t H5Pget_filter_by_id2(hid_t plist_id, H5Z_filter_t id,
- unsigned int *flags/*out*/, size_t *cd_nelmts/*out*/,
- unsigned cd_values[]/*out*/, size_t namelen, char name[]/*out*/,
- unsigned *filter_config/*out*/);
-H5_DLL htri_t H5Pall_filters_avail(hid_t plist_id);
-H5_DLL herr_t H5Premove_filter(hid_t plist_id, H5Z_filter_t filter);
-H5_DLL herr_t H5Pset_deflate(hid_t plist_id, unsigned aggression);
H5_DLL herr_t H5Pset_szip(hid_t plist_id, unsigned options_mask, unsigned pixels_per_block);
H5_DLL herr_t H5Pset_shuffle(hid_t plist_id);
H5_DLL herr_t H5Pset_nbit(hid_t plist_id);
H5_DLL herr_t H5Pset_scaleoffset(hid_t plist_id, H5Z_SO_scale_type_t scale_type, int scale_factor);
-H5_DLL herr_t H5Pset_fletcher32(hid_t plist_id);
H5_DLL herr_t H5Pset_fill_value(hid_t plist_id, hid_t type_id,
const void *value);
H5_DLL herr_t H5Pget_fill_value(hid_t plist_id, hid_t type_id,
@@ -422,7 +421,9 @@ H5_DLL H5Z_filter_t H5Pget_filter1(hid_t plist_id, unsigned filter,
H5_DLL herr_t H5Pget_filter_by_id1(hid_t plist_id, H5Z_filter_t id,
unsigned int *flags/*out*/, size_t *cd_nelmts/*out*/,
unsigned cd_values[]/*out*/, size_t namelen, char name[]/*out*/);
-
+H5_DLL herr_t H5Pget_version(hid_t plist_id, unsigned *boot/*out*/,
+ unsigned *freelist/*out*/, unsigned *stab/*out*/,
+ unsigned *shhdr/*out*/);
#endif /* H5_NO_DEPRECATED_SYMBOLS */
#ifdef __cplusplus
diff --git a/src/H5SM.c b/src/H5SM.c
index fad639c..7a678cb 100755
--- a/src/H5SM.c
+++ b/src/H5SM.c
@@ -141,31 +141,31 @@ H5SM_init(H5F_t *f, H5P_genplist_t * fc_plist, const H5O_loc_t *ext_loc, hid_t d
/* Get information from fcpl */
if(H5P_get(fc_plist, H5F_CRT_SHMSG_NINDEXES_NAME, &num_indexes)<0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get number of indexes")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "can't get number of indexes")
if(H5P_get(fc_plist, H5F_CRT_SHMSG_INDEX_TYPES_NAME, &index_type_flags)<0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get SOHM type flags")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "can't get SOHM type flags")
if(H5P_get(fc_plist, H5F_CRT_SHMSG_LIST_MAX_NAME, &list_max)<0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get SOHM list maximum")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "can't get SOHM list maximum")
if(H5P_get(fc_plist, H5F_CRT_SHMSG_BTREE_MIN_NAME, &btree_min)<0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get SOHM btree minimum")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "can't get SOHM btree minimum")
if(H5P_get(fc_plist, H5F_CRT_SHMSG_INDEX_MINSIZE_NAME, &minsizes) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get SOHM message min sizes")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "can't get SOHM message min sizes")
/* Verify that values are valid */
if(num_indexes > H5O_SHMESG_MAX_NINDEXES)
- HGOTO_ERROR(H5E_PLIST, H5E_BADRANGE, FAIL, "number of indexes in property list is too large")
+ HGOTO_ERROR(H5E_SOHM, H5E_BADRANGE, FAIL, "number of indexes in property list is too large")
/* Check that type flags weren't duplicated anywhere */
type_flags_used = 0;
for(x = 0; x < num_indexes; ++x) {
if(index_type_flags[x] & type_flags_used)
- HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "the same shared message type flag is assigned to more than one index")
+ HGOTO_ERROR(H5E_SOHM, H5E_BADVALUE, FAIL, "the same shared message type flag is assigned to more than one index")
type_flags_used |= index_type_flags[x];
} /* end for */
/* Initialize master table */
if(NULL == (table = H5FL_MALLOC(H5SM_master_table_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for SOHM table")
+ HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, FAIL, "memory allocation failed for SOHM table")
/* Set version and number of indexes in table and in superblock.
* Right now we just use one byte to hold the number of indexes.
@@ -183,7 +183,7 @@ H5SM_init(H5F_t *f, H5P_genplist_t * fc_plist, const H5O_loc_t *ext_loc, hid_t d
/* Allocate the SOHM indexes as an array. */
if(NULL == (table->indexes = (H5SM_index_header_t *)H5FL_ARR_MALLOC(H5SM_index_header_t, (size_t)table->num_indexes)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for SOHM indexes")
+ HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, FAIL, "memory allocation failed for SOHM indexes")
/* Initialize all of the indexes, but don't allocate space for them to
* hold messages until we actually need to write to them.
@@ -206,13 +206,13 @@ H5SM_init(H5F_t *f, H5P_genplist_t * fc_plist, const H5O_loc_t *ext_loc, hid_t d
} /* end for */
/* Allocate space for the table on disk */
- table_size = (hsize_t) H5SM_TABLE_SIZE(f) + (hsize_t) (table->num_indexes * H5SM_INDEX_HEADER_SIZE(f));
+ table_size = H5SM_TABLE_SIZE(f) + (table->num_indexes * H5SM_INDEX_HEADER_SIZE(f));
if(HADDR_UNDEF == (table_addr = H5MF_alloc(f, H5FD_MEM_SOHM_TABLE, dxpl_id, table_size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for SOHM table")
+ HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, FAIL, "file allocation failed for SOHM table")
/* Cache the new table */
if(H5AC_set(f, dxpl_id, H5AC_SOHM_TABLE, table_addr, table, H5AC__NO_FLAGS_SET) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "can't add SOHM table to cache")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTINS, FAIL, "can't add SOHM table to cache")
/* Record the address of the master table in the file */
f->shared->sohm_addr = table_addr;
@@ -276,7 +276,7 @@ H5SM_type_to_flag(unsigned type_id, unsigned *type_flag)
break;
default:
- HGOTO_ERROR(H5E_OHDR, H5E_BADTYPE, FAIL, "unknown message type ID")
+ HGOTO_ERROR(H5E_SOHM, H5E_BADTYPE, FAIL, "unknown message type ID")
} /* end switch */
done:
@@ -311,7 +311,7 @@ H5SM_get_index(const H5SM_master_table_t *table, unsigned type_id)
/* Translate the H5O type_id into an H5SM type flag */
if(H5SM_type_to_flag(type_id, &type_flag) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't map message type to flag")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "can't map message type to flag")
/* Search the indexes until we find one that matches this flag or we've
* searched them all.
@@ -352,12 +352,12 @@ H5SM_type_shared(H5F_t *f, unsigned type_id, hid_t dxpl_id)
/* Translate the H5O type_id into an H5SM type flag */
if(H5SM_type_to_flag(type_id, &type_flag) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't map message type to flag")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "can't map message type to flag")
/* Look up the master SOHM table */
if(H5F_addr_defined(f->shared->sohm_addr)) {
if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, NULL, NULL, H5AC_READ)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table")
} /* end if */
else
/* No shared messages of any type */
@@ -373,7 +373,7 @@ H5SM_type_shared(H5F_t *f, unsigned type_id, hid_t dxpl_id)
done:
/* Release the master SOHM table */
if(table && H5AC_unprotect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, table, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table")
+ HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5SM_type_shared() */
@@ -407,7 +407,7 @@ H5SM_get_fheap_addr(H5F_t *f, hid_t dxpl_id, unsigned type_id, haddr_t *fheap_ad
/* Look up the master SOHM table */
if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, NULL, NULL, H5AC_READ)))
- HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table")
/* Look up index for message type */
if((index_num = H5SM_get_index(table, type_id)) < 0)
@@ -419,7 +419,7 @@ H5SM_get_fheap_addr(H5F_t *f, hid_t dxpl_id, unsigned type_id, haddr_t *fheap_ad
done:
/* Release the master SOHM table */
if(table && H5AC_unprotect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, table, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table")
+ HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5SM_get_fheap_addr() */
@@ -440,36 +440,50 @@ done:
static herr_t
H5SM_create_index(H5F_t *f, H5SM_index_header_t *header, hid_t dxpl_id)
{
- haddr_t list_addr=HADDR_UNDEF; /* Address of SOHM list */
- haddr_t tree_addr=HADDR_UNDEF; /* Address of SOHM B-tree */
- H5HF_create_t fheap_cparam; /* Fractal heap creation parameters */
- H5HF_t *fheap = NULL;
+ H5HF_create_t fheap_cparam; /* Fractal heap creation parameters */
+ H5HF_t *fheap = NULL; /* Fractal heap handle */
+ H5B2_t *bt2 = NULL; /* v2 B-tree handle for index */
herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI_NOINIT(H5SM_create_index)
+ /* Sanity check */
HDassert(header);
HDassert(header->index_addr == HADDR_UNDEF);
HDassert(header->btree_min <= header->list_max + 1);
/* In most cases, the index starts as a list */
if(header->list_max > 0) {
- header->index_type = H5SM_LIST;
+ haddr_t list_addr = HADDR_UNDEF; /* Address of SOHM list */
+ /* Create the list index */
if((list_addr = H5SM_create_list(f, header, dxpl_id)) == HADDR_UNDEF)
HGOTO_ERROR(H5E_SOHM, H5E_CANTCREATE, FAIL, "list creation failed for SOHM index")
+ /* Set the index type & address */
+ header->index_type = H5SM_LIST;
header->index_addr = list_addr;
} /* end if */
/* index is a B-tree */
else {
+ H5B2_create_t bt2_cparam; /* v2 B-tree creation parameters */
+ haddr_t tree_addr = HADDR_UNDEF; /* Address of SOHM B-tree */
+
+ /* Create the v2 B-tree index */
+ bt2_cparam.cls = H5SM_INDEX;
+ bt2_cparam.node_size = (size_t)H5SM_B2_NODE_SIZE;
+ bt2_cparam.rrec_size = (size_t)H5SM_SOHM_ENTRY_SIZE(f);
+ bt2_cparam.split_percent = H5SM_B2_SPLIT_PERCENT;
+ bt2_cparam.merge_percent = H5SM_B2_MERGE_PERCENT;
+ if(NULL == (bt2 = H5B2_create(f, dxpl_id, &bt2_cparam)))
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTCREATE, FAIL, "B-tree creation failed for SOHM index")
+
+ /* Retrieve the v2 B-tree's address in the file */
+ if(H5B2_get_addr(bt2, &tree_addr) < 0)
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "can't get v2 B-tree address for SOHM index")
+
+ /* Set the index type & address */
header->index_type = H5SM_BTREE;
-
- if(H5B2_create(f, dxpl_id, H5SM_INDEX, (size_t)H5SM_B2_NODE_SIZE,
- (size_t)H5SM_SOHM_ENTRY_SIZE(f), H5SM_B2_SPLIT_PERCENT,
- H5SM_B2_MERGE_PERCENT, &tree_addr) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTCREATE, FAIL, "B-tree creation failed for SOHM index")
-
header->index_addr = tree_addr;
} /* end else */
@@ -484,10 +498,10 @@ H5SM_create_index(H5F_t *f, H5SM_index_header_t *header, hid_t dxpl_id)
fheap_cparam.id_len = 0;
fheap_cparam.max_man_size = H5O_FHEAP_MAX_MAN_SIZE;
if(NULL == (fheap = H5HF_create(f, dxpl_id, &fheap_cparam)))
- HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "unable to create fractal heap")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTINIT, FAIL, "unable to create fractal heap")
if(H5HF_get_heap_addr(fheap, &(header->heap_addr)) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTGETSIZE, FAIL, "can't get fractal heap address")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTGETSIZE, FAIL, "can't get fractal heap address")
#ifndef NDEBUG
{
@@ -495,15 +509,17 @@ H5SM_create_index(H5F_t *f, H5SM_index_header_t *header, hid_t dxpl_id)
/* Sanity check ID length */
if(H5HF_get_id_len(fheap, &fheap_id_len) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTGETSIZE, FAIL, "can't get fractal heap ID length")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTGETSIZE, FAIL, "can't get fractal heap ID length")
HDassert(fheap_id_len == H5O_FHEAP_ID_LEN);
}
#endif /* NDEBUG */
done:
- /* Close the fractal heap if one has been created */
+ /* Release resources */
if(fheap && H5HF_close(fheap, dxpl_id) < 0)
- HDONE_ERROR(H5E_HEAP, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
+ HDONE_ERROR(H5E_SOHM, H5E_CANTCLOSEOBJ, FAIL, "can't close fractal heap")
+ if(bt2 && H5B2_close(bt2, dxpl_id) < 0)
+ HDONE_ERROR(H5E_SOHM, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for SOHM index")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5SM_create_index */
@@ -542,7 +558,7 @@ H5SM_delete_index(H5F_t *f, H5SM_index_header_t *header, hid_t dxpl_id,
/* Check the index list's status in the metadata cache */
if(H5AC_get_entry_status(f, header->index_addr, &index_status) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "unable to check metadata cache status for direct block")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "unable to check metadata cache status for direct block")
/* If the index list is in the cache, expunge it now */
if(index_status & H5AC_ES__IN_CACHE) {
@@ -552,15 +568,15 @@ H5SM_delete_index(H5F_t *f, H5SM_index_header_t *header, hid_t dxpl_id,
/* Evict the index list from the metadata cache */
if(H5AC_expunge_entry(f, dxpl_id, H5AC_SOHM_LIST, header->index_addr, H5AC__FREE_FILE_SPACE_FLAG) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTREMOVE, FAIL, "unable to remove list index from cache")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTREMOVE, FAIL, "unable to remove list index from cache")
} /* end if */
} /* end if */
else {
HDassert(header->index_type == H5SM_BTREE);
- /* Delete from the B-tree. */
- if(H5B2_delete(f, dxpl_id, H5SM_INDEX, header->index_addr, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to delete B-tree")
+ /* Delete the B-tree. */
+ if(H5B2_delete(f, dxpl_id, header->index_addr, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTDELETE, FAIL, "unable to delete B-tree")
/* Revert to list unless B-trees can have zero records */
if(header->btree_min > 0)
@@ -617,9 +633,9 @@ H5SM_create_list(H5F_t *f, H5SM_index_header_t *header, hid_t dxpl_id)
/* Allocate list in memory */
if((list = H5FL_MALLOC(H5SM_list_t)) == NULL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed for SOHM list")
+ HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed for SOHM list")
if((list->messages = (H5SM_sohm_t *)H5FL_ARR_MALLOC(H5SM_sohm_t, num_entries)) == NULL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed for SOHM list")
+ HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed for SOHM list")
/* Initialize messages in list */
HDmemset(list->messages, 0, sizeof(H5SM_sohm_t) * num_entries);
@@ -632,11 +648,11 @@ H5SM_create_list(H5F_t *f, H5SM_index_header_t *header, hid_t dxpl_id)
/* Allocate space for the list on disk */
size = H5SM_LIST_SIZE(f, num_entries);
if(HADDR_UNDEF == (addr = H5MF_alloc(f, H5FD_MEM_SOHM_INDEX, dxpl_id, size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed for SOHM list")
+ HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed for SOHM list")
/* Put the list into the cache */
if(H5AC_set(f, dxpl_id, H5AC_SOHM_LIST, addr, list, H5AC__NO_FLAGS_SET) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, HADDR_UNDEF, "can't add SOHM list to cache")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTINS, HADDR_UNDEF, "can't add SOHM list to cache")
/* Set return value */
ret_value = addr;
@@ -683,11 +699,13 @@ H5SM_convert_list_to_btree(H5F_t *f, H5SM_index_header_t *header,
{
H5SM_list_t *list; /* Pointer to the existing message list */
H5SM_mesg_key_t key; /* Key for inserting records in v2 B-tree */
+ H5B2_create_t bt2_cparam; /* v2 B-tree creation parameters */
+ H5B2_t *bt2 = NULL; /* v2 B-tree handle for index */
haddr_t tree_addr; /* New v2 B-tree's address */
size_t num_messages; /* Number of messages being tracked */
size_t x;
void * encoding_buf = NULL;
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5SM_convert_list_to_btree)
@@ -698,10 +716,17 @@ H5SM_convert_list_to_btree(H5F_t *f, H5SM_index_header_t *header,
list = *_list;
/* Create the new v2 B-tree for tracking the messages */
- if(H5B2_create(f, dxpl_id, H5SM_INDEX, (size_t)H5SM_B2_NODE_SIZE,
- (size_t)H5SM_SOHM_ENTRY_SIZE(f), H5SM_B2_SPLIT_PERCENT,
- H5SM_B2_MERGE_PERCENT, &tree_addr) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTCREATE, FAIL, "B-tree creation failed for SOHM index")
+ bt2_cparam.cls = H5SM_INDEX;
+ bt2_cparam.node_size = (size_t)H5SM_B2_NODE_SIZE;
+ bt2_cparam.rrec_size = (size_t)H5SM_SOHM_ENTRY_SIZE(f);
+ bt2_cparam.split_percent = H5SM_B2_SPLIT_PERCENT;
+ bt2_cparam.merge_percent = H5SM_B2_MERGE_PERCENT;
+ if(NULL == (bt2 = H5B2_create(f, dxpl_id, &bt2_cparam)))
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTCREATE, FAIL, "B-tree creation failed for SOHM index")
+
+ /* Retrieve the v2 B-tree's address in the file */
+ if(H5B2_get_addr(bt2, &tree_addr) < 0)
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "can't get v2 B-tree address for SOHM index")
/* Set up key values that all messages will use. Since these messages
* are in the heap, they have a heap ID and no encoding or type_id.
@@ -725,8 +750,8 @@ H5SM_convert_list_to_btree(H5F_t *f, H5SM_index_header_t *header,
key.encoding = encoding_buf;
/* Insert the message into the B-tree */
- if(H5B2_insert(f, dxpl_id, H5SM_INDEX, tree_addr, &key) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "couldn't add SOHM to B-tree")
+ if(H5B2_insert(bt2, dxpl_id, &key) < 0)
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTINSERT, FAIL, "couldn't add SOHM to B-tree")
/* Free buffer from H5SM_read_mesg */
if(encoding_buf)
@@ -736,7 +761,7 @@ H5SM_convert_list_to_btree(H5F_t *f, H5SM_index_header_t *header,
/* Unprotect list in cache and release heap */
if(H5AC_unprotect(f, dxpl_id, H5AC_SOHM_LIST, header->index_addr, list, H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "unable to release SOHM list")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to release SOHM list")
*_list = list = NULL;
/* Delete the old list index (but not its heap, which the new index is
@@ -752,7 +777,9 @@ H5SM_convert_list_to_btree(H5F_t *f, H5SM_index_header_t *header,
header->num_messages = num_messages;
done:
- /* Free the buffer, if it hasn't already been freed (because of error) */
+ /* Release resources */
+ if(bt2 && H5B2_close(bt2, dxpl_id) < 0)
+ HDONE_ERROR(H5E_SOHM, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for SOHM index")
if(encoding_buf)
encoding_buf = H5MM_xfree(encoding_buf);
@@ -801,13 +828,13 @@ H5SM_convert_btree_to_list(H5F_t * f, H5SM_index_header_t * header, hid_t dxpl_i
/* Delete the B-tree and have messages copy themselves to the
* list as they're deleted
*/
- if(H5B2_delete(f, dxpl_id, H5SM_INDEX, btree_addr, H5SM_btree_convert_to_list_op, list) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to delete B-tree")
+ if(H5B2_delete(f, dxpl_id, btree_addr, H5SM_btree_convert_to_list_op, list) < 0)
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTDELETE, FAIL, "unable to delete B-tree")
done:
/* Release the SOHM list from the cache */
if(list && H5AC_unprotect(f, dxpl_id, H5AC_SOHM_LIST, header->index_addr, list, H5AC__DIRTIED_FLAG) < 0)
- HDONE_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "unable to unprotect SOHM index")
+ HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to unprotect SOHM index")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5SM_convert_btree_to_list() */
@@ -912,7 +939,7 @@ H5SM_can_share(H5F_t *f, hid_t dxpl_id, H5SM_master_table_t *table,
/* If the message isn't big enough, don't bother sharing it */
if(0 == (mesg_size = H5O_msg_raw_size(f, type_id, TRUE, mesg)))
- HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, FAIL, "unable to get OH message size")
+ HGOTO_ERROR(H5E_SOHM, H5E_BADMESG, FAIL, "unable to get OH message size")
if(mesg_size < my_table->indexes[index_num].min_mesg_size)
HGOTO_DONE(FALSE)
@@ -923,7 +950,7 @@ H5SM_can_share(H5F_t *f, hid_t dxpl_id, H5SM_master_table_t *table,
done:
/* Release the master SOHM table, if we protected it */
if(my_table && my_table != table && H5AC_unprotect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, my_table, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_SOHM, H5E_CANTRELEASE, FAIL, "unable to close SOHM master table")
+ HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5SM_can_share() */
@@ -1005,7 +1032,7 @@ H5SM_try_share(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned type_id,
/* Look up the master SOHM table */
if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, NULL, NULL, H5AC_WRITE)))
- HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table")
/* "complex" sharing checks */
if((tri_ret = H5SM_can_share(f, dxpl_id, table, &index_num, type_id, mesg)) < 0)
@@ -1042,7 +1069,7 @@ H5SM_try_share(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned type_id,
done:
/* Release the master SOHM table */
if(table && H5AC_unprotect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, table, cache_flags) < 0)
- HDONE_ERROR(H5E_CACHE, H5E_CANTRELEASE, FAIL, "unable to close SOHM master table")
+ HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5SM_try_share() */
@@ -1086,7 +1113,7 @@ H5SM_incr_ref(void *record, void *_op_data, hbool_t *changed)
/* Put the message in the heap and record its new heap ID */
if(H5HF_insert(op_data->key->fheap, op_data->dxpl_id, op_data->key->encoding_size, op_data->key->encoding, &message->u.heap_loc.fheap_id) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTINSERT, FAIL, "unable to insert message into fractal heap")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTINSERT, FAIL, "unable to insert message into fractal heap")
message->location = H5SM_IN_HEAP;
message->u.heap_loc.ref_count = 2;
@@ -1142,6 +1169,7 @@ H5SM_write_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
H5O_shared_t shared; /* Shared H5O message */
hbool_t found = FALSE; /* Was the message in the index? */
H5HF_t *fheap = NULL; /* Fractal heap handle */
+ H5B2_t *bt2 = NULL; /* v2 B-tree handle for index */
size_t buf_size; /* Size of the encoded message */
void * encoding_buf = NULL; /* Buffer for encoded message */
size_t empty_pos = UFAIL; /* Empty entry in list */
@@ -1156,15 +1184,15 @@ H5SM_write_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
/* Encode the message to be written */
if((buf_size = H5O_msg_raw_size(f, type_id, TRUE, mesg)) == 0)
- HGOTO_ERROR(H5E_OHDR, H5E_BADSIZE, FAIL, "can't find message size")
+ HGOTO_ERROR(H5E_SOHM, H5E_BADSIZE, FAIL, "can't find message size")
if(NULL == (encoding_buf = H5MM_malloc(buf_size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate buffer for encoding")
+ HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, FAIL, "can't allocate buffer for encoding")
if(H5O_msg_encode(f, type_id, TRUE, (unsigned char *)encoding_buf, mesg) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "can't encode message to be shared")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTENCODE, FAIL, "can't encode message to be shared")
/* Open the fractal heap for this index */
if(NULL == (fheap = H5HF_open(f, dxpl_id, header->heap_addr)))
- HGOTO_ERROR(H5E_HEAP, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap")
/* Set up a key for the message to be written */
key.dxpl_id = dxpl_id;
@@ -1184,7 +1212,7 @@ H5SM_write_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
/* The index is a list; get it from the cache */
if(NULL == (list = (H5SM_list_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_LIST, header->index_addr, NULL, header, H5AC_WRITE)))
- HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, FAIL, "unable to load SOHM index")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM index")
/* See if the message is already in the index and get its location.
* Also record the first empty list position we find in case we need it
@@ -1198,7 +1226,7 @@ H5SM_write_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
if(list->messages[list_pos].location == H5SM_IN_OH) {
/* Put the message in the heap and record its new heap ID */
if(H5HF_insert(fheap, dxpl_id, key.encoding_size, key.encoding, &shared.u.heap_id) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTINSERT, FAIL, "unable to insert message into fractal heap")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTINSERT, FAIL, "unable to insert message into fractal heap")
list->messages[list_pos].location = H5SM_IN_HEAP;
list->messages[list_pos].u.heap_loc.fheap_id = shared.u.heap_id;
@@ -1221,6 +1249,11 @@ H5SM_write_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
HDassert(header->index_type == H5SM_BTREE);
+ /* Open the index v2 B-tree */
+ if(NULL == (bt2 = H5B2_open(f, dxpl_id, header->index_addr)))
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for SOHM index")
+
+ /* Set up callback info */
op_data.key = &key;
op_data.dxpl_id = dxpl_id;
@@ -1229,10 +1262,12 @@ H5SM_write_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
* return a heap ID, since a message with a reference count greater
* than 1 is always shared in the heap.
*/
- if(H5B2_modify(f, dxpl_id, H5SM_INDEX, header->index_addr, &key, H5SM_incr_ref, &op_data) >= 0) {
+ if(H5B2_modify(bt2, dxpl_id, &key, H5SM_incr_ref, &op_data) >= 0) {
shared.u.heap_id = op_data.fheap_id;
found = TRUE;
} /* end if */
+ else
+ H5E_clear_stack(NULL); /*ignore error*/
} /* end else */
if(found)
@@ -1307,8 +1342,14 @@ H5SM_write_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
else {
HDassert(header->index_type == H5SM_BTREE);
- if(H5B2_insert(f, dxpl_id, H5SM_INDEX, header->index_addr, &key) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "couldn't add SOHM to B-tree")
+ /* Open the index v2 B-tree, if it isn't already */
+ if(NULL == bt2) {
+ if(NULL == (bt2 = H5B2_open(f, dxpl_id, header->index_addr)))
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for SOHM index")
+ } /* end if */
+
+ if(H5B2_insert(bt2, dxpl_id, &key) < 0)
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTINSERT, FAIL, "couldn't add SOHM to B-tree")
} /* end else */
++(header->num_messages);
@@ -1321,16 +1362,18 @@ H5SM_write_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
/* Update the original message's shared component */
if(H5O_msg_set_share(type_id, &shared, mesg) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, FAIL, "unable to set sharing information")
+ HGOTO_ERROR(H5E_SOHM, H5E_BADMESG, FAIL, "unable to set sharing information")
done:
- /* Release the fractal heap if we opened it */
+ /* Release the fractal heap & v2 B-tree if we opened them */
if(fheap && H5HF_close(fheap, dxpl_id) < 0)
- HDONE_ERROR(H5E_HEAP, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
+ HDONE_ERROR(H5E_SOHM, H5E_CANTCLOSEOBJ, FAIL, "can't close fractal heap")
+ if(bt2 && H5B2_close(bt2, dxpl_id) < 0)
+ HDONE_ERROR(H5E_SOHM, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for SOHM index")
/* If we got a list out of the cache, release it (it is always dirty after writing a message) */
if(list && H5AC_unprotect(f, dxpl_id, H5AC_SOHM_LIST, header->index_addr, list, H5AC__DIRTIED_FLAG) < 0)
- HDONE_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM index")
+ HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM index")
if(encoding_buf)
encoding_buf = H5MM_xfree(encoding_buf);
@@ -1379,7 +1422,7 @@ H5SM_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, H5O_shared_t *sh_mesg)
/* Look up the master SOHM table */
if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, NULL, NULL, H5AC_WRITE)))
- HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table")
/* Find the correct index and try to delete from it */
if((index_num = H5SM_get_index(table, type_id)) < 0)
@@ -1394,7 +1437,7 @@ H5SM_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, H5O_shared_t *sh_mesg)
/* Release the master SOHM table */
if(H5AC_unprotect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, table, cache_flags) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTRELEASE, FAIL, "unable to close SOHM master table")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table")
table = NULL;
/* If buf was allocated, delete the message it holds. This message may
@@ -1403,16 +1446,16 @@ H5SM_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, H5O_shared_t *sh_mesg)
*/
if(mesg_buf) {
if(NULL == (native_mesg = H5O_msg_decode(f, dxpl_id, open_oh, type_id, (const unsigned char *)mesg_buf)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, FAIL, "can't decode shared message.")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTDECODE, FAIL, "can't decode shared message.")
if(H5O_msg_delete(f, dxpl_id, open_oh, type_id, native_mesg) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "can't delete shared message.")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTFREE, FAIL, "can't delete shared message.")
} /* end if */
done:
/* Release the master SOHM table (should only happen on error) */
if(table && H5AC_unprotect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, table, cache_flags) < 0)
- HDONE_ERROR(H5E_CACHE, H5E_CANTRELEASE, FAIL, "unable to close SOHM master table")
+ HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table")
/* Release any native message we decoded */
if(native_mesg)
@@ -1588,6 +1631,7 @@ H5SM_delete_from_index(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
H5SM_sohm_t message; /* Deleted message returned from index */
H5SM_sohm_t *message_ptr; /* Pointer to deleted message returned from index */
H5HF_t *fheap = NULL; /* Fractal heap that contains the message */
+ H5B2_t *bt2 = NULL; /* v2 B-tree handle for index */
size_t buf_size; /* Size of the encoded message (out) */
void *encoding_buf = NULL; /* The encoded message (out) */
unsigned type_id; /* Message type to operate on */
@@ -1607,7 +1651,7 @@ H5SM_delete_from_index(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
/* Open the heap for this type of message. */
if(NULL == (fheap = H5HF_open(f, dxpl_id, header->heap_addr)))
- HGOTO_ERROR(H5E_HEAP, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap")
/* Get the message size and encoded message for the message to be deleted,
* either from its OH or from the heap.
@@ -1626,7 +1670,7 @@ H5SM_delete_from_index(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
/* Get the encoded message */
if(H5SM_read_mesg(f, &key.message, fheap, open_oh, dxpl_id, &buf_size, &encoding_buf) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap")
/* Set up key for message to be deleted. */
key.file = f;
@@ -1658,9 +1702,14 @@ H5SM_delete_from_index(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
/* Index is a B-tree */
HDassert(header->index_type == H5SM_BTREE);
+ /* Open the index v2 B-tree */
+ if(NULL == (bt2 = H5B2_open(f, dxpl_id, header->index_addr)))
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for SOHM index")
+
/* If this returns failure, it means that the message wasn't found.
- * If it succeeds, a copy of the modified message will be returned. */
- if(H5B2_modify(f, dxpl_id, H5SM_INDEX, header->index_addr, &key, H5SM_decr_ref, &message) <0)
+ * If it succeeds, a copy of the modified message will be returned.
+ */
+ if(H5B2_modify(bt2, dxpl_id, &key, H5SM_decr_ref, &message) <0)
HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "message not in index")
/* Point to the message */
@@ -1682,8 +1731,14 @@ H5SM_delete_from_index(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
if(header->index_type == H5SM_LIST)
message_ptr->location = H5SM_NO_LOC;
else {
- if(H5B2_remove(f, dxpl_id, H5SM_INDEX, header->index_addr, &key, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTREMOVE, FAIL, "unable to delete message")
+ /* Open the index v2 B-tree, if it isn't already */
+ if(NULL == bt2) {
+ if(NULL == (bt2 = H5B2_open(f, dxpl_id, header->index_addr)))
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for SOHM index")
+ } /* end if */
+
+ if(H5B2_remove(bt2, dxpl_id, &key, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTREMOVE, FAIL, "unable to delete message from index")
} /* end else */
/* Remove the message from the heap if it was stored in the heap*/
@@ -1700,12 +1755,12 @@ H5SM_delete_from_index(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
/* Unprotect cache and release heap */
if(list && H5AC_unprotect(f, dxpl_id, H5AC_SOHM_LIST, header->index_addr, list, H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "unable to release SOHM list")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to release SOHM list")
list = NULL;
HDassert(fheap);
if(H5HF_close(fheap, dxpl_id) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTCLOSEOBJ, FAIL, "can't close fractal heap")
fheap = NULL;
/* Delete the index and its heap */
@@ -1724,11 +1779,13 @@ H5SM_delete_from_index(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
done:
/* Release the SOHM list */
if(list && H5AC_unprotect(f, dxpl_id, H5AC_SOHM_LIST, header->index_addr, list, H5AC__DIRTIED_FLAG) < 0)
- HDONE_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM index")
+ HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM index")
- /* Release the fractal heap if we opened it */
+ /* Release the fractal heap & v2 B-tree if we opened them */
if(fheap && H5HF_close(fheap, dxpl_id) < 0)
- HDONE_ERROR(H5E_HEAP, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
+ HDONE_ERROR(H5E_SOHM, H5E_CANTCLOSEOBJ, FAIL, "can't close fractal heap")
+ if(bt2 && H5B2_close(bt2, dxpl_id) < 0)
+ HDONE_ERROR(H5E_SOHM, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for SOHM index")
/* Free the message encoding, if we're not returning it in encoded_mesg
* or if there's been an error.
@@ -1771,7 +1828,7 @@ H5SM_get_info(const H5O_loc_t *ext_loc, H5P_genplist_t *fc_plist, hid_t dxpl_id)
/* Check for the extension having a 'shared message info' message */
if((status = H5O_msg_exists(ext_loc, H5O_SHMESG_ID, dxpl_id)) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to read object header")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "unable to read object header")
if(status) {
unsigned index_flags[H5O_SHMESG_MAX_NINDEXES]; /* Message flags for each index */
unsigned minsizes[H5O_SHMESG_MAX_NINDEXES]; /* Minimum message size for each index */
@@ -1781,7 +1838,7 @@ H5SM_get_info(const H5O_loc_t *ext_loc, H5P_genplist_t *fc_plist, hid_t dxpl_id)
/* Retrieve the 'shared message info' structure */
if(NULL == H5O_msg_read(ext_loc, H5O_SHMESG_ID, &sohm_table, dxpl_id))
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "shared message info message not present")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "shared message info message not present")
/* Portably initialize the arrays */
HDmemset(index_flags, 0, sizeof(index_flags));
@@ -1796,7 +1853,7 @@ H5SM_get_info(const H5O_loc_t *ext_loc, H5P_genplist_t *fc_plist, hid_t dxpl_id)
/* Read the rest of the SOHM table information from the cache */
if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, shared->sohm_addr, NULL, NULL, H5AC_READ)))
- HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table")
/* Get index conversion limits */
sohm_l2b = table->indexes[0].list_max;
@@ -1821,15 +1878,15 @@ H5SM_get_info(const H5O_loc_t *ext_loc, H5P_genplist_t *fc_plist, hid_t dxpl_id)
/* Set values in the property list */
if(H5P_set(fc_plist, H5F_CRT_SHMSG_NINDEXES_NAME, &shared->sohm_nindexes) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set number of SOHM indexes")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTSET, FAIL, "can't set number of SOHM indexes")
if(H5P_set(fc_plist, H5F_CRT_SHMSG_INDEX_TYPES_NAME, index_flags) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set type flags for indexes")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTSET, FAIL, "can't set type flags for indexes")
if(H5P_set(fc_plist, H5F_CRT_SHMSG_INDEX_MINSIZE_NAME, minsizes) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set type flags for indexes")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTSET, FAIL, "can't set type flags for indexes")
if(H5P_set(fc_plist, H5F_CRT_SHMSG_LIST_MAX_NAME, &sohm_l2b) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set SOHM cutoff in property list")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "can't set SOHM cutoff in property list")
if(H5P_set(fc_plist, H5F_CRT_SHMSG_BTREE_MIN_NAME, &sohm_b2l) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set SOHM cutoff in property list")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "can't set SOHM cutoff in property list")
} /* end if */
else {
/* No SOHM info in file */
@@ -1839,13 +1896,13 @@ H5SM_get_info(const H5O_loc_t *ext_loc, H5P_genplist_t *fc_plist, hid_t dxpl_id)
/* Shared object header messages are disabled */
if(H5P_set(fc_plist, H5F_CRT_SHMSG_NINDEXES_NAME, &shared->sohm_nindexes) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set number of SOHM indexes")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTSET, FAIL, "can't set number of SOHM indexes")
} /* end else */
done:
/* Release the master SOHM table if we took it out of the cache */
if(table && H5AC_unprotect(f, dxpl_id, H5AC_SOHM_TABLE, shared->sohm_addr, table, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_CACHE, H5E_CANTRELEASE, FAIL, "unable to close SOHM master table")
+ HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5SM_get_info() */
@@ -1882,7 +1939,7 @@ H5SM_message_encode(const H5F_t *f, uint8_t *raw, const void *_nrecord)
HDassert(message->location == H5SM_IN_OH);
*raw++ = 0; /* reserved (possible flags byte) */
- *raw++ = message->msg_type_id;
+ *raw++ = (uint8_t)message->msg_type_id;
UINT16ENCODE(raw, message->u.mesg_loc.index);
H5F_addr_encode(f, &raw, message->u.mesg_loc.oh_addr);
} /* end else */
@@ -2013,6 +2070,7 @@ H5SM_get_refcount(H5F_t *f, hid_t dxpl_id, unsigned type_id,
const H5O_shared_t *sh_mesg, hsize_t *ref_count)
{
H5HF_t *fheap = NULL; /* Fractal heap that contains shared messages */
+ H5B2_t *bt2 = NULL; /* v2 B-tree handle for index */
H5SM_master_table_t *table = NULL; /* SOHM master table */
H5SM_list_t *list = NULL; /* SOHM index list for message type (if in list form) */
H5SM_index_header_t *header=NULL; /* Index header for message type */
@@ -2032,7 +2090,7 @@ H5SM_get_refcount(H5F_t *f, hid_t dxpl_id, unsigned type_id,
/* Look up the master SOHM table */
if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, NULL, NULL, H5AC_READ)))
- HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table")
/* Find the correct index and find the message in it */
if((index_num = H5SM_get_index(table, type_id)) < 0)
@@ -2041,7 +2099,7 @@ H5SM_get_refcount(H5F_t *f, hid_t dxpl_id, unsigned type_id,
/* Open the heap for this message type */
if(NULL == (fheap = H5HF_open(f, dxpl_id, header->heap_addr)))
- HGOTO_ERROR(H5E_HEAP, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap")
/* Set up a SOHM message to correspond to the shared message passed in */
key.message.location = H5SM_IN_HEAP;
@@ -2050,7 +2108,7 @@ H5SM_get_refcount(H5F_t *f, hid_t dxpl_id, unsigned type_id,
/* Get the encoded message */
if(H5SM_read_mesg(f, &key.message, fheap, NULL, dxpl_id, &buf_size, &encoding_buf) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap")
/* Set up key for message to locate */
key.file = f;
@@ -2081,8 +2139,12 @@ H5SM_get_refcount(H5F_t *f, hid_t dxpl_id, unsigned type_id,
/* Index is a B-tree */
HDassert(header->index_type == H5SM_BTREE);
+ /* Open the index v2 B-tree */
+ if(NULL == (bt2 = H5B2_open(f, dxpl_id, header->index_addr)))
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for SOHM index")
+
/* Look up the message in the v2 B-tree */
- if((msg_exists = H5B2_find(f, dxpl_id, H5SM_INDEX, header->index_addr, &key, H5SM_get_refcount_bt2_cb, &message)) < 0)
+ if((msg_exists = H5B2_find(bt2, dxpl_id, &key, H5SM_get_refcount_bt2_cb, &message)) < 0)
HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "error finding message in index")
if(!msg_exists)
HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "message not in index")
@@ -2095,11 +2157,13 @@ H5SM_get_refcount(H5F_t *f, hid_t dxpl_id, unsigned type_id,
done:
/* Release resources */
if(list && H5AC_unprotect(f, dxpl_id, H5AC_SOHM_LIST, header->index_addr, list, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM index")
+ HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM index")
if(table && H5AC_unprotect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, table, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_CACHE, H5E_CANTRELEASE, FAIL, "unable to close SOHM master table")
+ HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table")
if(fheap && H5HF_close(fheap, dxpl_id) < 0)
- HDONE_ERROR(H5E_HEAP, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
+ HDONE_ERROR(H5E_SOHM, H5E_CANTCLOSEOBJ, FAIL, "can't close fractal heap")
+ if(bt2 && H5B2_close(bt2, dxpl_id) < 0)
+ HDONE_ERROR(H5E_SOHM, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for SOHM index")
if(encoding_buf)
encoding_buf = H5MM_xfree(encoding_buf);
@@ -2147,7 +2211,7 @@ H5SM_read_iter_op(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned sequence,
/* Check if the message is dirty & flush it to the object header if so */
if(mesg->dirty)
if(H5O_msg_flush(udata->file, oh, mesg) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, H5_ITER_ERROR, "unable to encode object header message")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTENCODE, H5_ITER_ERROR, "unable to encode object header message")
/* Get the message's encoded size */
udata->buf_size = mesg->raw_size;
@@ -2155,7 +2219,7 @@ H5SM_read_iter_op(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned sequence,
/* Allocate buffer to return the message in */
if(NULL == (udata->encoding_buf = H5MM_malloc(udata->buf_size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5_ITER_ERROR, "memory allocation failed")
+ HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, H5_ITER_ERROR, "memory allocation failed")
/* Copy the encoded message into the buffer to return */
HDmemcpy(udata->encoding_buf, mesg->raw, udata->buf_size);
@@ -2193,7 +2257,7 @@ H5SM_read_mesg_fh_cb(const void *obj, size_t obj_len, void *_udata)
/* Allocate a buffer to hold the message */
if(NULL == (udata->encoding_buf = H5MM_malloc(obj_len)))
- HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, FAIL, "memory allocation failed")
+ HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, FAIL, "memory allocation failed")
/* Copy the message from the heap */
HDmemcpy(udata->encoding_buf, obj, obj_len);
@@ -2252,18 +2316,18 @@ H5SM_read_mesg(H5F_t *f, const H5SM_sohm_t *mesg, H5HF_t *fheap,
/* Reset object location for operation */
if(H5O_loc_reset(&oloc) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "unable to initialize location")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTRESET, FAIL, "unable to initialize location")
if(NULL == open_oh || mesg->u.mesg_loc.oh_addr != H5O_OH_GET_ADDR(open_oh)) {
/* Open the object in the file */
oloc.file = f;
oloc.addr = mesg->u.mesg_loc.oh_addr;
if(H5O_open(&oloc) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to open object header")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTLOAD, FAIL, "unable to open object header")
/* 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_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTLOAD, FAIL, "unable to load object header")
} /* end if */
else
oh = open_oh;
@@ -2272,14 +2336,14 @@ H5SM_read_mesg(H5F_t *f, const H5SM_sohm_t *mesg, H5HF_t *fheap,
op.op_type = H5O_MESG_OP_LIB;
op.u.lib_op = H5SM_read_iter_op;
if((ret_value = H5O_msg_iterate_real(f, oh, type, &op, &udata, dxpl_id)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "unable to iterate over object header messages")
+ HGOTO_ERROR(H5E_SOHM, H5E_BADITER, FAIL, "unable to iterate over object header messages")
} /* end if */
else {
HDassert(mesg->location == H5SM_IN_HEAP);
/* Copy the message from the heap */
if(H5HF_op(fheap, dxpl_id, &(mesg->u.heap_loc.fheap_id), H5SM_read_mesg_fh_cb, &udata) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "can't read message from fractal heap.")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTLOAD, FAIL, "can't read message from fractal heap.")
} /* end else */
HDassert(udata.encoding_buf);
HDassert(udata.buf_size);
@@ -2292,10 +2356,9 @@ done:
/* Close the object header if we opened one and had an error */
if(oh && oh != open_oh) {
if(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")
-
+ HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
if(H5O_close(&oloc) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "unable to close object header")
+ HDONE_ERROR(H5E_SOHM, H5E_CANTCLOSEOBJ, FAIL, "unable to close object header")
} /* end if */
/* Release the encoding buffer on error */
@@ -2352,13 +2415,13 @@ H5SM_table_debug(H5F_t *f, hid_t dxpl_id, haddr_t table_addr,
/* Check arguments. Version must be 0, the only version implemented so far */
if(table_vers > HDF5_SHAREDHEADER_VERSION)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown shared message table version")
+ HGOTO_ERROR(H5E_SOHM, H5E_BADVALUE, FAIL, "unknown shared message table version")
if(num_indexes == 0 || num_indexes > H5O_SHMESG_MAX_NINDEXES)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "number of indexes must be between 1 and H5O_SHMESG_MAX_NINDEXES")
+ HGOTO_ERROR(H5E_SOHM, H5E_BADVALUE, FAIL, "number of indexes must be between 1 and H5O_SHMESG_MAX_NINDEXES")
/* Look up the master SOHM table */
if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, table_addr, NULL, NULL, H5AC_READ)))
- HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table")
HDfprintf(stream, "%*sShared Message Master Table...\n", indent, "");
for(x = 0; x < num_indexes; ++x) {
@@ -2386,7 +2449,7 @@ H5SM_table_debug(H5F_t *f, hid_t dxpl_id, haddr_t table_addr,
done:
if(table && H5AC_unprotect(f, dxpl_id, H5AC_SOHM_TABLE, table_addr, table, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_CACHE, H5E_CANTRELEASE, FAIL, "unable to close SOHM master table")
+ HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5SM_table_debug() */
@@ -2427,9 +2490,9 @@ H5SM_list_debug(H5F_t *f, hid_t dxpl_id, haddr_t list_addr,
/* Check arguments. Version must be 0, the only version implemented so far */
if(table_vers > H5SM_LIST_VERSION)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown shared message list version")
+ HGOTO_ERROR(H5E_SOHM, H5E_BADVALUE, FAIL, "unknown shared message list version")
if(num_messages == 0 || num_messages > H5O_SHMESG_MAX_LIST_SIZE)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "number of indexes must be between 1 and H5O_SHMESG_MAX_NINDEXES")
+ HGOTO_ERROR(H5E_SOHM, H5E_BADVALUE, FAIL, "number of indexes must be between 1 and H5O_SHMESG_MAX_NINDEXES")
/* Create a temporary header using the arguments. The cache needs this to load the list. */
HDmemset(&header, 0, sizeof(H5SM_index_header_t));
@@ -2439,7 +2502,7 @@ H5SM_list_debug(H5F_t *f, hid_t dxpl_id, haddr_t list_addr,
/* Get the list from the cache */
if(NULL == (list = (H5SM_list_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_LIST, list_addr, NULL, &header, H5AC_READ)))
- HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, FAIL, "unable to load SOHM index")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM index")
HDfprintf(stream, "%*sShared Message List Index...\n", indent, "");
for(x = 0; x < num_messages; ++x) {
@@ -2471,7 +2534,7 @@ H5SM_list_debug(H5F_t *f, hid_t dxpl_id, haddr_t list_addr,
done:
if(list && H5AC_unprotect(f, dxpl_id, H5AC_SOHM_LIST, list_addr, list, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM index")
+ HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM index")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5SM_list_debug() */
@@ -2494,10 +2557,11 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5SM_ih_size(H5F_t *f, hid_t dxpl_id, H5F_info_t *finfo)
+H5SM_ih_size(H5F_t *f, hid_t dxpl_id, hsize_t *hdr_size, H5_ih_info_t *ih_info)
{
H5SM_master_table_t *table = NULL; /* SOHM master table */
H5HF_t *fheap = NULL; /* Fractal heap handle */
+ H5B2_t *bt2 = NULL; /* v2 B-tree handle for index */
unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
@@ -2506,40 +2570,52 @@ H5SM_ih_size(H5F_t *f, hid_t dxpl_id, H5F_info_t *finfo)
/* Sanity check */
HDassert(f);
HDassert(H5F_addr_defined(f->shared->sohm_addr));
- HDassert(finfo);
+ HDassert(hdr_size);
+ HDassert(ih_info);
/* Look up the master SOHM table */
if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, NULL, NULL, H5AC_READ)))
- HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table")
/* Get SOHM header size */
- finfo->sohm.hdr_size = (hsize_t) H5SM_TABLE_SIZE(f) +
- (hsize_t)(table->num_indexes * H5SM_INDEX_HEADER_SIZE(f));
+ *hdr_size = H5SM_TABLE_SIZE(f) + (table->num_indexes * H5SM_INDEX_HEADER_SIZE(f));
/* Loop over all the indices for shared messages */
for(u = 0; u < table->num_indexes; u++) {
/* Get index storage size (for either B-tree or list) */
if(table->indexes[u].index_type == H5SM_BTREE) {
- if(H5F_addr_defined(table->indexes[u].index_addr))
- if(H5B2_iterate_size(f, dxpl_id, H5SM_INDEX, table->indexes[u].index_addr, &(finfo->sohm.msgs_info.index_size)) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree storage info")
+ if(H5F_addr_defined(table->indexes[u].index_addr)) {
+ /* Open the index v2 B-tree */
+ if(NULL == (bt2 = H5B2_open(f, dxpl_id, table->indexes[u].index_addr)))
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for SOHM index")
+
+ if(H5B2_size(bt2, dxpl_id, &(ih_info->index_size)) < 0)
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "can't retrieve B-tree storage info")
+
+ /* Close the v2 B-tree */
+ if(H5B2_close(bt2, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for SOHM index")
+ bt2 = NULL;
+ } /* end if */
} /* end if */
- else if(table->indexes[u].index_type == H5SM_LIST)
- finfo->sohm.msgs_info.index_size += H5SM_LIST_SIZE(f, table->indexes[u].list_max);
+ else {
+ HDassert(table->indexes[u].index_type == H5SM_LIST);
+ ih_info->index_size += H5SM_LIST_SIZE(f, table->indexes[u].list_max);
+ } /* end else */
/* Check for heap for this index */
if(H5F_addr_defined(table->indexes[u].heap_addr)) {
/* Open the fractal heap for this index */
if(NULL == (fheap = H5HF_open(f, dxpl_id, table->indexes[u].heap_addr)))
- HGOTO_ERROR(H5E_HEAP, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap")
/* Get heap storage size */
- if(H5HF_size(fheap, dxpl_id, &(finfo->sohm.msgs_info.heap_size)) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't retrieve fractal heap storage info")
+ if(H5HF_size(fheap, dxpl_id, &(ih_info->heap_size)) < 0)
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "can't retrieve fractal heap storage info")
- /* Release the fractal heap */
+ /* Close the fractal heap */
if(H5HF_close(fheap, dxpl_id) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTCLOSEOBJ, FAIL, "can't close fractal heap")
fheap = NULL;
} /* end if */
} /* end for */
@@ -2547,9 +2623,11 @@ H5SM_ih_size(H5F_t *f, hid_t dxpl_id, H5F_info_t *finfo)
done:
/* Release resources */
if(fheap && H5HF_close(fheap, dxpl_id) < 0)
- HDONE_ERROR(H5E_HEAP, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
+ HDONE_ERROR(H5E_SOHM, H5E_CANTCLOSEOBJ, FAIL, "can't close fractal heap")
+ if(bt2 && H5B2_close(bt2, dxpl_id) < 0)
+ HDONE_ERROR(H5E_SOHM, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for SOHM index")
if(table && H5AC_unprotect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, table, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_CACHE, H5E_CANTRELEASE, FAIL, "unable to close SOHM master table")
+ HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5SM_ih_size() */
diff --git a/src/H5SMbtree2.c b/src/H5SMbtree2.c
index 3ddd3f2..2be7745 100755
--- a/src/H5SMbtree2.c
+++ b/src/H5SMbtree2.c
@@ -63,6 +63,7 @@ static herr_t H5SM_btree_debug(FILE *stream, const H5F_t *f, hid_t dxpl_id,
/* v2 B-tree class for SOHM indexes*/
const H5B2_class_t H5SM_INDEX[1]={{ /* B-tree class information */
H5B2_SOHM_INDEX_ID, /* Type of B-tree */
+ "H5B2_SOHM_INDEX_ID", /* Name of B-tree class */
sizeof(H5SM_sohm_t), /* Size of native record */
H5SM_btree_store, /* Record storage callback */
H5SM_message_compare, /* Record comparison callback */
@@ -159,7 +160,7 @@ H5SM_compare_iter_op(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned sequence,
/* Check if the message is dirty & flush it to the object header if so */
if(mesg->dirty)
if(H5O_msg_flush(udata->key->file, oh, mesg) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, H5_ITER_ERROR, "unable to encode object header message")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTENCODE, H5_ITER_ERROR, "unable to encode object header message")
HDassert(udata->key->encoding_size <= mesg->raw_size);
udata->ret = HDmemcmp(udata->key->encoding, mesg->raw, udata->key->encoding_size);
diff --git a/src/H5SMcache.c b/src/H5SMcache.c
index e2aa732..9048b9f 100644
--- a/src/H5SMcache.c
+++ b/src/H5SMcache.c
@@ -138,7 +138,7 @@ H5SM_table_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *udata1
/* Allocate space for the master table in memory */
if(NULL == (table = H5FL_CALLOC(H5SM_master_table_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, NULL, "memory allocation failed")
/* Read number of indexes and version from file superblock */
table->num_indexes = f->shared->sohm_nindexes;
@@ -179,13 +179,13 @@ H5SM_table_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *udata1
/* 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)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for SOHM indexes")
+ HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, NULL, "memory allocation failed for SOHM indexes")
/* Read in the index headers */
for(x = 0; x < table->num_indexes; ++x) {
/* Verify correct version of index list */
if(H5SM_LIST_VERSION != *p++)
- HGOTO_ERROR(H5E_FILE, H5E_VERSION, NULL, "bad shared message list version number")
+ HGOTO_ERROR(H5E_SOHM, H5E_VERSION, NULL, "bad shared message list version number")
/* Type of the index (list or B-tree) */
table->indexes[x].index_type= (H5SM_index_type_t)*p++;
@@ -479,12 +479,12 @@ H5SM_list_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *udata1,
/* Allocate space for the SOHM list data structure */
if(NULL == (list = H5FL_MALLOC(H5SM_list_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, NULL, "memory allocation failed")
HDmemset(&list->cache_info, 0, sizeof(H5AC_info_t));
/* Allocate list in memory as an array*/
if((list->messages = (H5SM_sohm_t *)H5FL_ARR_MALLOC(H5SM_sohm_t, header->list_max)) == NULL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "file allocation failed for SOHM list")
+ HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, NULL, "file allocation failed for SOHM list")
list->header = header;
diff --git a/src/H5SMpkg.h b/src/H5SMpkg.h
index dc69b2b..093fb04 100755
--- a/src/H5SMpkg.h
+++ b/src/H5SMpkg.h
@@ -44,42 +44,42 @@
#define H5SM_SIZEOF_CHECKSUM 4
#define H5SM_HEAP_LOC_SIZE ( \
- 4 /* Reference count */ \
+ (unsigned)4 /* Reference count */ \
+ sizeof(H5O_fheap_id_t) /* size of heap ID on disk */ \
)
#define H5SM_OH_LOC_SIZE(f) ( \
- 1 /* reserved (possible flags?) */ \
- + 1 /* message type ID */ \
- + 2 /* creation index of message in OH */ \
+ (unsigned)1 /* reserved (possible flags?) */ \
+ + (unsigned)1 /* message type ID */ \
+ + (unsigned)2 /* creation index of message in OH */ \
+ H5F_SIZEOF_ADDR(f) /* address of OH */ \
)
#define H5SM_SOHM_ENTRY_SIZE(f) ( \
- 1 /* Message location */ \
- + 4 /* Hash value */ \
+ (unsigned)1 /* Message location */ \
+ + (unsigned)4 /* Hash value */ \
+ MAX(H5SM_HEAP_LOC_SIZE, H5SM_OH_LOC_SIZE(f)) /* Entry */ \
)
#define H5SM_TABLE_SIZE(f) ( \
- H5_SIZEOF_MAGIC /* Signature */ \
- + H5SM_SIZEOF_CHECKSUM /* Checksum */ \
+ (unsigned)H5_SIZEOF_MAGIC /* Signature */ \
+ + (unsigned)H5SM_SIZEOF_CHECKSUM /* Checksum */ \
)
#define H5SM_INDEX_HEADER_SIZE(f) ( \
- 1 /* Whether index is a list or B-tree */ \
- + 1 /* Version of index format */ \
- + 2 /* Type of messages stored in the index */ \
- + 4 /* Minimum size of messages to share */ \
- + (3 * 2) /* B-tree cutoff, list cutoff, # of shared messages */ \
+ (unsigned)1 /* Whether index is a list or B-tree */ \
+ + (unsigned)1 /* Version of index format */ \
+ + (unsigned)2 /* Type of messages stored in the index */ \
+ + (unsigned)4 /* Minimum size of messages to share */ \
+ + (unsigned)(3 * 2) /* B-tree cutoff, list cutoff, # of shared messages */ \
+ H5F_SIZEOF_ADDR(f) /* Location of list or B-tree */ \
+ H5F_SIZEOF_ADDR(f) /* Address of heap */ \
)
#define H5SM_LIST_SIZE(f, num_mesg) ( \
- H5_SIZEOF_MAGIC /* Signature */ \
+ (unsigned) H5_SIZEOF_MAGIC /* Signature */ \
+ (H5SM_SOHM_ENTRY_SIZE(f) * num_mesg) /* Message entries */ \
- + H5SM_SIZEOF_CHECKSUM /* Checksum */ \
+ + (unsigned)H5SM_SIZEOF_CHECKSUM /* Checksum */ \
)
#define H5SM_B2_NODE_SIZE 512
diff --git a/src/H5SMprivate.h b/src/H5SMprivate.h
index 1465357..46a43ad 100755
--- a/src/H5SMprivate.h
+++ b/src/H5SMprivate.h
@@ -56,7 +56,7 @@ H5_DLL herr_t H5SM_reconstitute(H5O_shared_t *sh_mesg, H5F_t *f,
unsigned msg_type_id, H5O_fheap_id_t heap_id);
H5_DLL herr_t H5SM_get_refcount(H5F_t *f, hid_t dxpl_id, unsigned type_id,
const H5O_shared_t *sh_mesg, hsize_t *ref_count);
-H5_DLL herr_t H5SM_ih_size(H5F_t *f, hid_t dxpl_id, H5F_info_t *bh_info);
+H5_DLL herr_t H5SM_ih_size(H5F_t *f, hid_t dxpl_id, hsize_t *hdr_size, H5_ih_info_t *ih_info);
/* Debugging routines */
diff --git a/src/H5SMtest.c b/src/H5SMtest.c
index 8412a89..582bc0e 100644
--- a/src/H5SMtest.c
+++ b/src/H5SMtest.c
@@ -95,7 +95,7 @@ H5SM_get_mesg_count_test(H5F_t *f, hid_t dxpl_id, unsigned type_id,
/* Look up the master SOHM table */
if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, NULL, NULL, H5AC_READ)))
- HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table")
/* Find the correct index for this message type */
if((index_num = H5SM_get_index(table, type_id)) < 0)
@@ -112,7 +112,7 @@ H5SM_get_mesg_count_test(H5F_t *f, hid_t dxpl_id, unsigned type_id,
done:
/* Release resources */
if(table && H5AC_unprotect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, table, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_CACHE, H5E_CANTRELEASE, FAIL, "unable to close SOHM master table")
+ HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5SM_get_mesg_count_test() */
diff --git a/src/H5T.c b/src/H5T.c
index 1e30f77..4041cd5 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -2976,8 +2976,8 @@ H5T_create(H5T_class_t type, size_t size)
dt->shared->type = type;
if(type==H5T_COMPOUND) {
- dt->shared->u.compnd.packed=TRUE; /* Start out packed */
- dt->shared->u.compnd.sorted=H5T_SORT_VALUE; /* Start out sorted by value */
+ dt->shared->u.compnd.packed=FALSE; /* Start out unpacked */
+ dt->shared->u.compnd.memb_size=0;
} /* end if */
else if(type==H5T_OPAQUE)
/* Initialize the tag in case it's not set later. A null tag will
@@ -3678,7 +3678,13 @@ H5T_set_size(H5T_t *dt, size_t size)
if(size<(max_offset+max_size))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "size shrinking will cut off last member ");
+
+ /* Compound must not have been packed previously */
+ /* We will check if resizing changed the packed state of
+ * this type at the end of this function */
+ HDassert(!dt->shared->u.compnd.packed);
}
+
break;
case H5T_STRING:
@@ -3754,6 +3760,10 @@ H5T_set_size(H5T_t *dt, size_t size)
dt->shared->u.atomic.prec = prec;
}
} /* end if */
+
+ /* Check if the new compound type is packed */
+ if(dt->shared->type == H5T_COMPOUND)
+ H5T_update_packed(dt);
}
done:
diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c
index f580c15..dea6bed 100644
--- a/src/H5Tcommit.c
+++ b/src/H5Tcommit.c
@@ -334,6 +334,10 @@ H5T_commit(H5F_t *file, H5T_t *type, hid_t tcpl_id, hid_t dxpl_id)
HDassert(type);
HDassert(tcpl_id != H5P_DEFAULT);
+ /* Check if we are allowed to write to this file */
+ if(0 == (H5F_INTENT(file) & H5F_ACC_RDWR))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "no write intent on file")
+
/*
* Check arguments. We cannot commit an immutable type because H5Tclose()
* normally fails on such types (try H5Tclose(H5T_NATIVE_INT)) but closing
diff --git a/src/H5Tcompound.c b/src/H5Tcompound.c
index 02d6bd1..db7a701b 100644
--- a/src/H5Tcompound.c
+++ b/src/H5Tcompound.c
@@ -45,11 +45,6 @@
/******************/
/* Local Typedefs */
/******************/
-/* "Key" (+ user data) for bsearch callback */
-typedef struct{
- size_t offset; /* Offset of member to be added */
- const H5T_cmemb_t *max_under; /* Member with maximum offset seen that is not above "offset" */
-} H5T_insert_compar_t;
/********************/
@@ -421,48 +416,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5T_insert_compar
- *
- * Purpose: Callback function for bsearch called from H5T_insert.
- * Reports whether obj has a lower of higher offset than
- * that stored in key. Also keeps track of the highest
- * offset seen that is not higher than that in key.
- *
- * Return: -1 if key < obj
- * 0 if key == obj
- * 1 if key > obj
- *
- * Programmer: Neil Fortner
- * Wednesday, January 7, 1998
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static int
-H5T_insert_compar(const void *_key, const void *_obj)
-{
- H5T_insert_compar_t *key = *(H5T_insert_compar_t * const *)_key; /* User data */
- const H5T_cmemb_t *memb = (const H5T_cmemb_t *)_obj; /* Compound member being examined */
- int ret_value; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_insert_compar)
-
- if(key->offset > memb->offset) {
- if(key->max_under == NULL || memb->offset > key->max_under->offset)
- key->max_under = memb;
- ret_value = 1;
- } /* end if */
- else if(key->offset < memb->offset)
- ret_value = -1;
- else
- ret_value = 0; /* Should not happen */
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5T_insert_compar() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5T_insert
*
* Purpose: Adds a new MEMBER to the compound datatype PARENT. The new
@@ -482,8 +435,6 @@ H5T_insert(H5T_t *parent, const char *name, size_t offset, const H5T_t *member)
{
unsigned idx; /* Index of member to insert */
size_t total_size;
- H5T_insert_compar_t key; /* Key for bsearch compare function */
- H5T_insert_compar_t *keyptr = &key; /* Pointer to key */
unsigned i; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
@@ -500,39 +451,20 @@ H5T_insert(H5T_t *parent, const char *name, size_t offset, const H5T_t *member)
if(!HDstrcmp(parent->shared->u.compnd.memb[i].name, name))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINSERT, FAIL, "member name is not unique")
+ /* Does the new member overlap any existing member ? */
total_size = member->shared->size;
+ for(i = 0; i < parent->shared->u.compnd.nmembs; i++)
+ if((offset <= parent->shared->u.compnd.memb[i].offset &&
+ (offset + total_size) > parent->shared->u.compnd.memb[i].offset) ||
+ (parent->shared->u.compnd.memb[i].offset <= offset &&
+ (parent->shared->u.compnd.memb[i].offset +
+ parent->shared->u.compnd.memb[i].size) > offset))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINSERT, FAIL, "member overlaps with another member")
/* Does the new member overlap the end of the compound type? */
if((offset + total_size) > parent->shared->size)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINSERT, FAIL, "member extends past end of compound type")
- if(parent->shared->u.compnd.sorted != H5T_SORT_VALUE)
- if(H5T_sort_value(parent, NULL) < 0)
- HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOMPARE, FAIL, "value sort failed")
-
- /* Find the position to insert the new member */
- if(parent->shared->u.compnd.nmembs == 0)
- idx = 0;
- else {
- /* Key value (including user data) for compar callback */
- key.offset = offset;
- key.max_under = NULL;
-
- /* Do a binary search on the offsets of the (now sorted) members. We do
- * not expect to find an exact match (if we do it is an error), rely on
- * the user data in the key to keep track of the closest member below
- * the new member. */
- if(NULL != HDbsearch(&keyptr, parent->shared->u.compnd.memb, parent->shared->u.compnd.nmembs,
- sizeof(parent->shared->u.compnd.memb[0]), H5T_insert_compar))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINSERT, FAIL, "member overlaps with another member")
- idx = (key.max_under == NULL) ? 0 : (unsigned) (key.max_under - parent->shared->u.compnd.memb + 1);
- } /* end else */
-
- /* Does the new member overlap any existing member ? */
- if((idx < parent->shared->u.compnd.nmembs && (offset + total_size) > parent->shared->u.compnd.memb[idx].offset) ||
- (idx && (parent->shared->u.compnd.memb[idx-1].offset + parent->shared->u.compnd.memb[idx-1].size) > offset))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINSERT, FAIL, "member overlaps with another member")
-
/* Increase member array if necessary */
if(parent->shared->u.compnd.nmembs >= parent->shared->u.compnd.nalloc) {
unsigned na = MAX(1, parent->shared->u.compnd.nalloc * 2);
@@ -544,68 +476,23 @@ H5T_insert(H5T_t *parent, const char *name, size_t offset, const H5T_t *member)
parent->shared->u.compnd.memb = x;
} /* end if */
- /* Determine if the compound datatype stays packed */
- if(parent->shared->u.compnd.packed) {
- /* Check if the member type is packed */
- if(H5T_is_packed(member) > 0) {
- if(idx == 0) {
- /* If the is the first member, the datatype is not packed
- * if the first member isn't at offset 0
- */
- if(offset > 0)
- parent->shared->u.compnd.packed = FALSE;
- } /* end if */
- else {
- /* If the is not the first member, the datatype is not
- * packed if the new member isn't adjoining the previous member
- */
- if(offset != (parent->shared->u.compnd.memb[idx - 1].offset + parent->shared->u.compnd.memb[idx - 1].size))
- parent->shared->u.compnd.packed = FALSE;
- } /* end else */
- } /* end if */
- else
- parent->shared->u.compnd.packed = FALSE;
- } /* end if */
- else
- /* Check if inserting this member causes the parent to become packed */
- /* First check if it completely closes a gap */
- /* No need to check if it's being appended to the end */
- if(idx != parent->shared->u.compnd.nmembs
- && (offset + total_size) == parent->shared->u.compnd.memb[idx].offset
- && (idx == 0 ? offset == 0 : (parent->shared->u.compnd.memb[idx-1].offset
- + parent->shared->u.compnd.memb[idx-1].size) == offset)
- && H5T_is_packed(member) > 0) {
-
- /* Start out packed */
- parent->shared->u.compnd.packed = TRUE;
-
- /* Check if the entire type is now packed */
- if((idx != 0 && parent->shared->u.compnd.memb[0].offset != 0)
- || !H5T_is_packed(parent->shared->u.compnd.memb[0].type))
- parent->shared->u.compnd.packed = FALSE;
- else
- for(i = 1; i < parent->shared->u.compnd.nmembs; i++)
- if((i != idx && parent->shared->u.compnd.memb[i].offset
- != (parent->shared->u.compnd.memb[i - 1].offset
- + parent->shared->u.compnd.memb[i - 1].size))
- || !H5T_is_packed(parent->shared->u.compnd.memb[i].type)) {
- parent->shared->u.compnd.packed = FALSE;
- break;
- } /* end if */
- } /* end if */
-
- /* Reshape the memb array to accomodate the new member */
- if(idx != parent->shared->u.compnd.nmembs)
- HDmemmove(&parent->shared->u.compnd.memb[idx+1], &parent->shared->u.compnd.memb[idx],
- (parent->shared->u.compnd.nmembs - idx) * sizeof(parent->shared->u.compnd.memb[0]));
-
- /* Add member to member array */
+ /* Add member to end of member array */
+ idx = parent->shared->u.compnd.nmembs;
parent->shared->u.compnd.memb[idx].name = H5MM_xstrdup(name);
parent->shared->u.compnd.memb[idx].offset = offset;
parent->shared->u.compnd.memb[idx].size = total_size;
parent->shared->u.compnd.memb[idx].type = H5T_copy(member, H5T_COPY_ALL);
+ parent->shared->u.compnd.sorted = H5T_SORT_NONE;
parent->shared->u.compnd.nmembs++;
+ parent->shared->u.compnd.memb_size+=total_size;
+
+ /* It should not be possible to get this far if the type is already packed
+ * - the new member would overlap something */
+ HDassert(!(parent->shared->u.compnd.packed));
+
+ /* Determine if the compound datatype becomes packed */
+ H5T_update_packed(parent);
/* Set the "force conversion" flag if the field's datatype indicates */
if(member->shared->force_conv == TRUE)
@@ -730,13 +617,55 @@ H5T_is_packed(const H5T_t *dt)
/* If this is a compound datatype, check if it is packed */
if(dt->shared->type == H5T_COMPOUND) {
- H5T_compnd_t *compnd = &(dt->shared->u.compnd); /* Convenience pointer to compound info */
- ret_value = (htri_t)(compnd->packed && compnd->nmembs > 0
- && compnd->memb[compnd->nmembs - 1].offset
- + compnd->memb[compnd->nmembs - 1].size
- == dt->shared->size);
+ ret_value = (htri_t)(dt->shared->u.compnd.packed);
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5T_is_packed() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5T_update_packed
+ *
+ * Purpose: Checks whether a datatype which is compound became packed
+ * after recent changes. This function does not assume that
+ * the status of the "packed" field is correct, and sets
+ * this field to the correct value.
+ *
+ * Return: void
+ *
+ * Programmer: Neil Fortner
+ * Monday, October 19, 2009
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+H5T_update_packed(const H5T_t *dt)
+{
+ unsigned i; /* Index */
+
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_update_packed)
+
+ HDassert(dt);
+ HDassert(dt->shared->type == H5T_COMPOUND);
+
+ /* First check if all space is used in the "top level" type */
+ if(dt->shared->size == dt->shared->u.compnd.memb_size) {
+ /* Set the packed flag to TRUE */
+ dt->shared->u.compnd.packed = TRUE;
+
+ /* Now check if all members are packed */
+ for(i = 0; i < dt->shared->u.compnd.nmembs; i++)
+ if(!H5T_is_packed(dt->shared->u.compnd.memb[i].type)) {
+ dt->shared->u.compnd.packed = FALSE;
+ break;
+ } /* end if */
+ } /* end if */
+ else
+ dt->shared->u.compnd.packed = FALSE;
+
+ FUNC_LEAVE_NOAPI_VOID
+} /* end H5T_update_packed() */
+
diff --git a/src/H5Tconv.c b/src/H5Tconv.c
index 08e7fa1..ab9e703 100644
--- a/src/H5Tconv.c
+++ b/src/H5Tconv.c
@@ -1935,51 +1935,48 @@ H5T_conv_struct_init(H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata, hid_t dxpl_id)
} /* end if */
} /* end for */
- /* Check if we need a background buffer */
- if(H5T_detect_class(src, H5T_COMPOUND) == TRUE || H5T_detect_class(dst, H5T_COMPOUND) == TRUE) {
- cdata->need_bkg = H5T_BKG_YES;
-
- if(src_nmembs < dst_nmembs) {
- priv->subset_info.subset = H5T_SUBSET_SRC;
- for(i = 0; i < src_nmembs; i++) {
- /* If any of source members doesn't have counterpart in the same
- * order or there's conversion between members, don't do the
- * optimization.
- */
- if(src2dst[i] != i || (src->shared->u.compnd.memb[i].offset != dst->shared->u.compnd.memb[i].offset) || (priv->memb_path[i])->is_noop == FALSE) {
- priv->subset_info.subset = H5T_SUBSET_FALSE;
- break;
- } /* end if */
- } /* end for */
- /* Compute the size of the data to be copied for each element. It
- * may be smaller than either src or dst if there is extra space at
- * the end of src.
- */
- if(priv->subset_info.subset == H5T_SUBSET_SRC)
- priv->subset_info.copy_size = src->shared->u.compnd.memb[src_nmembs-1].offset
- + src->shared->u.compnd.memb[src_nmembs-1].size;
- } else if(dst_nmembs < src_nmembs) {
- priv->subset_info.subset = H5T_SUBSET_DST;
- for(i = 0; i < dst_nmembs; i++) {
- /* If any of source members doesn't have counterpart in the same order or
- * there's conversion between members, don't do the optimization. */
- if(src2dst[i] != i || (src->shared->u.compnd.memb[i].offset != dst->shared->u.compnd.memb[i].offset) || (priv->memb_path[i])->is_noop == FALSE) {
- priv->subset_info.subset = H5T_SUBSET_FALSE;
- break;
- }
- } /* end for */
- /* Compute the size of the data to be copied for each element. It
- * may be smaller than either src or dst if there is extra space at
- * the end of dst.
- */
- if(priv->subset_info.subset == H5T_SUBSET_DST)
- priv->subset_info.copy_size = dst->shared->u.compnd.memb[dst_nmembs-1].offset
- + dst->shared->u.compnd.memb[dst_nmembs-1].size;
- } else /* If the numbers of source and dest members are equal and no conversion is needed,
- * the case should have been handled as noop earlier in H5Dio.c. */
- ;
+ /* The compound conversion functions need a background buffer */
+ cdata->need_bkg = H5T_BKG_YES;
- } /* end if */
+ if(src_nmembs < dst_nmembs) {
+ priv->subset_info.subset = H5T_SUBSET_SRC;
+ for(i = 0; i < src_nmembs; i++) {
+ /* If any of source members doesn't have counterpart in the same
+ * order or there's conversion between members, don't do the
+ * optimization.
+ */
+ if(src2dst[i] != i || (src->shared->u.compnd.memb[i].offset != dst->shared->u.compnd.memb[i].offset) || (priv->memb_path[i])->is_noop == FALSE) {
+ priv->subset_info.subset = H5T_SUBSET_FALSE;
+ break;
+ } /* end if */
+ } /* end for */
+ /* Compute the size of the data to be copied for each element. It
+ * may be smaller than either src or dst if there is extra space at
+ * the end of src.
+ */
+ if(priv->subset_info.subset == H5T_SUBSET_SRC)
+ priv->subset_info.copy_size = src->shared->u.compnd.memb[src_nmembs-1].offset
+ + src->shared->u.compnd.memb[src_nmembs-1].size;
+ } else if(dst_nmembs < src_nmembs) {
+ priv->subset_info.subset = H5T_SUBSET_DST;
+ for(i = 0; i < dst_nmembs; i++) {
+ /* If any of source members doesn't have counterpart in the same order or
+ * there's conversion between members, don't do the optimization. */
+ if(src2dst[i] != i || (src->shared->u.compnd.memb[i].offset != dst->shared->u.compnd.memb[i].offset) || (priv->memb_path[i])->is_noop == FALSE) {
+ priv->subset_info.subset = H5T_SUBSET_FALSE;
+ break;
+ }
+ } /* end for */
+ /* Compute the size of the data to be copied for each element. It
+ * may be smaller than either src or dst if there is extra space at
+ * the end of dst.
+ */
+ if(priv->subset_info.subset == H5T_SUBSET_DST)
+ priv->subset_info.copy_size = dst->shared->u.compnd.memb[dst_nmembs-1].offset
+ + dst->shared->u.compnd.memb[dst_nmembs-1].size;
+ } else /* If the numbers of source and dest members are equal and no conversion is needed,
+ * the case should have been handled as noop earlier in H5Dio.c. */
+ ;
cdata->recalc = FALSE;
diff --git a/src/H5Toh.c b/src/H5Toh.c
index 24fc0f1..886acc1 100644
--- a/src/H5Toh.c
+++ b/src/H5Toh.c
@@ -76,7 +76,8 @@ const H5O_obj_class_t H5O_OBJ_DATATYPE[1] = {{
H5O_dtype_isa, /* "isa" */
H5O_dtype_open, /* open an object of this class */
H5O_dtype_create, /* create an object of this class */
- H5O_dtype_get_oloc /* get an object header location for an object */
+ H5O_dtype_get_oloc, /* get an object header location for an object */
+ NULL /* get the index & heap info for an object */
}};
diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h
index 18bf7cf..45b0e7f 100644
--- a/src/H5Tpkg.h
+++ b/src/H5Tpkg.h
@@ -307,6 +307,7 @@ typedef struct H5T_compnd_t {
H5T_sort_t sorted; /*how are members sorted? */
hbool_t packed; /*are members packed together? */
H5T_cmemb_t *memb; /*array of struct members */
+ size_t memb_size; /*total of all member sizes */
} H5T_compnd_t;
/* An enumeration datatype */
@@ -1388,6 +1389,7 @@ H5_DLL herr_t H5T_insert(H5T_t *parent, const char *name, size_t offset,
const H5T_t *member);
H5_DLL size_t H5T_get_member_size(const H5T_t *dt, unsigned membno);
H5_DLL htri_t H5T_is_packed(const H5T_t *dt);
+H5_DLL void H5T_update_packed(const H5T_t *dt);
H5_DLL H5T_subset_info_t *H5T_conv_struct_subset(const H5T_cdata_t *cdata);
/* Enumerated type functions */
diff --git a/src/H5WB.c b/src/H5WB.c
index e53c70c..c3e3a6f 100644
--- a/src/H5WB.c
+++ b/src/H5WB.c
@@ -284,7 +284,7 @@ H5WB_unwrap(H5WB_t *wb)
} /* end if */
/* Release the buffer wrapper info */
- H5FL_FREE(H5WB_t, wb);
+ wb = H5FL_FREE(H5WB_t, wb);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5WB_unwrap() */
diff --git a/src/H5Z.c b/src/H5Z.c
index dc1ad80..c295df3 100644
--- a/src/H5Z.c
+++ b/src/H5Z.c
@@ -490,17 +490,103 @@ done:
* of passing in the dataset's dataspace, since the chunk
* dimensions are what the I/O filter will actually see
*
- * Modifications:
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5Z_prelude_callback(const H5O_pline_t *pline, hid_t dcpl_id, hid_t type_id,
+ hid_t space_id, H5Z_prelude_type_t prelude_type)
+{
+ H5Z_class2_t *fclass; /* Individual filter information */
+ size_t u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5Z_prelude_callback)
+
+ HDassert(pline->nused > 0);
+
+ /* Iterate over filters */
+ for(u = 0; u < pline->nused; u++) {
+ /* Get filter information */
+ if(NULL == (fclass = H5Z_find(pline->filter[u].id))) {
+ /* Ignore errors from optional filters */
+ if(pline->filter[u].flags & H5Z_FLAG_OPTIONAL)
+ H5E_clear_stack(NULL);
+ else
+ HGOTO_ERROR(H5E_PLINE, H5E_NOTFOUND, FAIL, "required filter was not located")
+ } /* end if */
+ else {
+ /* Make correct callback */
+ switch(prelude_type) {
+ case H5Z_PRELUDE_CAN_APPLY:
+ /* Check if filter is configured to be able to encode */
+ if(!fclass->encoder_present)
+ HGOTO_ERROR(H5E_PLINE, H5E_NOENCODER, FAIL, "Filter present but encoding is disabled.");
+
+
+ /* Check if there is a "can apply" callback */
+ if(fclass->can_apply) {
+ /* Make callback to filter's "can apply" function */
+ herr_t status = (fclass->can_apply)(dcpl_id, type_id, space_id);
+
+ /* Check return value */
+ if(status <= 0) {
+ /* Indicate filter can't apply to this combination of parameters */
+ if(status == 0)
+ HGOTO_ERROR(H5E_PLINE, H5E_CANAPPLY, FAIL, "filter parameters not appropriate")
+ /* Indicate error during filter callback */
+ else
+ HGOTO_ERROR(H5E_PLINE, H5E_CANAPPLY, FAIL, "error during user callback")
+ } /* end if */
+ } /* end if */
+ break;
+
+ case H5Z_PRELUDE_SET_LOCAL:
+ /* Check if there is a "set local" callback */
+ if(fclass->set_local) {
+ /* Make callback to filter's "set local" function */
+ if((fclass->set_local)(dcpl_id, type_id, space_id) < 0)
+ /* Indicate error during filter callback */
+ HGOTO_ERROR(H5E_PLINE, H5E_SETLOCAL, FAIL, "error during user callback")
+ } /* end if */
+ break;
+
+ default:
+ HDassert("invalid prelude type" && 0);
+ } /* end switch */
+ } /* end else */
+ } /* end for */
+
+done:
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5Z_prelude_callback() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Z_prepare_prelude_callback_dcpl
+ *
+ * Purpose: Prepares to make a dataset creation "prelude" callback
+ * for the "can_apply" or "set_local" routines.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Friday, April 4, 2003
+ *
+ * Notes:
+ * The chunk dimensions are used to create a dataspace, instead
+ * of passing in the dataset's dataspace, since the chunk
+ * dimensions are what the I/O filter will actually see
*
*-------------------------------------------------------------------------
*/
static herr_t
-H5Z_prelude_callback(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type_t prelude_type)
+H5Z_prepare_prelude_callback_dcpl(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type_t prelude_type)
{
hid_t space_id = -1; /* ID for dataspace describing chunk */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5Z_prelude_callback)
+ FUNC_ENTER_NOAPI_NOINIT(H5Z_prepare_prelude_callback_dcpl)
HDassert(H5I_GENPROP_LST == H5I_get_type(dcpl_id));
HDassert(H5I_DATATYPE == H5I_get_type(type_id));
@@ -520,10 +606,10 @@ H5Z_prelude_callback(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type_t prelude_ty
/* Check if the dataset is chunked */
if(H5D_CHUNKED == dcpl_layout.type) {
- H5O_pline_t dcpl_pline; /* Dataset's I/O pipeline information */
+ H5O_pline_t dcpl_pline; /* Object's I/O pipeline information */
/* Get I/O pipeline information */
- if(H5P_get(dc_plist, H5D_CRT_DATA_PIPELINE_NAME, &dcpl_pline) < 0)
+ if(H5P_get(dc_plist, H5O_CRT_PIPELINE_NAME, &dcpl_pline) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve pipeline filter")
/* Check if the chunks have filters */
@@ -544,59 +630,9 @@ H5Z_prelude_callback(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type_t prelude_ty
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID")
} /* end if */
- /* Iterate over filters */
- for(u = 0; u < dcpl_pline.nused; u++) {
- H5Z_class2_t *fclass; /* Individual filter information */
-
- /* Get filter information */
- if(NULL == (fclass = H5Z_find(dcpl_pline.filter[u].id))) {
- /* Ignore errors from optional filters */
- if(dcpl_pline.filter[u].flags & H5Z_FLAG_OPTIONAL)
- H5E_clear_stack(NULL);
- else
- HGOTO_ERROR(H5E_PLINE, H5E_NOTFOUND, FAIL, "required filter was not located")
- } /* end if */
- else {
- /* Make correct callback */
- switch(prelude_type) {
- case H5Z_PRELUDE_CAN_APPLY:
- /* Check if filter is configured to be able to encode */
- if(!fclass->encoder_present)
- HGOTO_ERROR(H5E_PLINE, H5E_NOENCODER, FAIL, "Filter present but encoding is disabled.");
-
-
- /* Check if there is a "can apply" callback */
- if(fclass->can_apply) {
- /* Make callback to filter's "can apply" function */
- herr_t status = (fclass->can_apply)(dcpl_id, type_id, space_id);
-
- /* Check return value */
- if(status <= 0) {
- /* Indicate filter can't apply to this combination of parameters */
- if(status == 0)
- HGOTO_ERROR(H5E_PLINE, H5E_CANAPPLY, FAIL, "filter parameters not appropriate")
- /* Indicate error during filter callback */
- else
- HGOTO_ERROR(H5E_PLINE, H5E_CANAPPLY, FAIL, "error during user callback")
- } /* end if */
- } /* end if */
- break;
-
- case H5Z_PRELUDE_SET_LOCAL:
- /* Check if there is a "set local" callback */
- if(fclass->set_local) {
- /* Make callback to filter's "set local" function */
- if((fclass->set_local)(dcpl_id, type_id, space_id) < 0)
- /* Indicate error during filter callback */
- HGOTO_ERROR(H5E_PLINE, H5E_SETLOCAL, FAIL, "error during user callback")
- } /* end if */
- break;
-
- default:
- HDassert("invalid prelude type" && 0);
- } /* end switch */
- } /* end else */
- } /* end for */
+ /* Make the callbacks */
+ if(H5Z_prelude_callback(&dcpl_pline, dcpl_id, type_id, space_id, prelude_type) < 0)
+ HGOTO_ERROR(H5E_PLINE, H5E_CANAPPLY, FAIL, "unable to apply filter")
} /* end if */
} /* end if */
} /* end if */
@@ -606,7 +642,7 @@ done:
HDONE_ERROR(H5E_PLINE, H5E_CANTRELEASE, FAIL, "unable to close dataspace")
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5Z_prelude_callback() */
+} /* end H5Z_prepare_prelude_callback_dcpl() */
/*-------------------------------------------------------------------------
@@ -635,11 +671,8 @@ H5Z_can_apply(hid_t dcpl_id, hid_t type_id)
FUNC_ENTER_NOAPI(H5Z_can_apply, FAIL)
- HDassert(H5I_GENPROP_LST == H5I_get_type(dcpl_id));
- HDassert(H5I_DATATYPE == H5I_get_type(type_id));
-
/* Make "can apply" callbacks for filters in pipeline */
- if(H5Z_prelude_callback(dcpl_id, type_id, H5Z_PRELUDE_CAN_APPLY) < 0)
+ if(H5Z_prepare_prelude_callback_dcpl(dcpl_id, type_id, H5Z_PRELUDE_CAN_APPLY) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_CANAPPLY, FAIL, "unable to apply filter")
done:
@@ -673,11 +706,8 @@ H5Z_set_local(hid_t dcpl_id, hid_t type_id)
FUNC_ENTER_NOAPI(H5Z_set_local, FAIL)
- HDassert(H5I_GENPROP_LST == H5I_get_type(dcpl_id));
- HDassert(H5I_DATATYPE == H5I_get_type(type_id));
-
/* Make "set local" callbacks for filters in pipeline */
- if(H5Z_prelude_callback(dcpl_id, type_id, H5Z_PRELUDE_SET_LOCAL) < 0)
+ if(H5Z_prepare_prelude_callback_dcpl(dcpl_id, type_id, H5Z_PRELUDE_SET_LOCAL) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_SETLOCAL, FAIL, "local filter parameters not set")
done:
@@ -686,6 +716,75 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5Z_can_apply_direct
+ *
+ * Purpose: Checks if all the filters defined in the pipeline can be
+ * applied to an opaque byte stream (currently only a group).
+ * The pipeline is assumed to have at least one filter.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Neil Fortner
+ * Tuesday, September 22, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Z_can_apply_direct(const H5O_pline_t *pline)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5Z_can_apply_direct, FAIL)
+
+ HDassert(pline->nused > 0);
+
+ /* Make "can apply" callbacks for filters in pipeline */
+ if(H5Z_prelude_callback(pline, -1, -1, -1, H5Z_PRELUDE_CAN_APPLY) < 0)
+ HGOTO_ERROR(H5E_PLINE, H5E_CANAPPLY, FAIL, "unable to apply filter")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5Z_can_apply_direct() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Z_set_local_direct
+ *
+ * Purpose: Makes callbacks to modify local settings for filters on a
+ * new opaque object. The pipeline is assumed to have at
+ * least one filter.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Neil Fortner
+ * Tuesday, September 22, 2009
+ *
+ * Notes:
+ * This callback will almost certainly not do anything
+ * useful, other than to make certain that the filter will
+ * accept opque data.
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Z_set_local_direct(const H5O_pline_t *pline)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5Z_set_local_direct, FAIL)
+
+ HDassert(pline->nused > 0);
+
+ /* Make "set local" callbacks for filters in pipeline */
+ if(H5Z_prelude_callback(pline, -1, -1, -1, H5Z_PRELUDE_SET_LOCAL) < 0)
+ HGOTO_ERROR(H5E_PLINE, H5E_SETLOCAL, FAIL, "local filter parameters not set")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5Z_set_local_direct() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5Z_modify
*
* Purpose: Modify filter parameters for specified pipeline.
@@ -1286,33 +1385,3 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Zget_filter_info() */
-
-/*-------------------------------------------------------------------------
- * Function: H5Z_set_latest_version
- *
- * Purpose: Set the encoding for a I/O filter pipeline to the latest version.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * Tuesday, July 24, 2007
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Z_set_latest_version(H5O_pline_t *pline)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(H5Z_set_latest_version, FAIL)
-
- /* Sanity check */
- HDassert(pline);
-
- /* Set encoding of I/O pipeline to latest version */
- pline->version = H5O_PLINE_VERSION_LATEST;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5Z_set_latest_version() */
-
diff --git a/src/H5Zpkg.h b/src/H5Zpkg.h
index ae33def..959ec28 100644
--- a/src/H5Zpkg.h
+++ b/src/H5Zpkg.h
@@ -24,20 +24,6 @@
#include "H5Zprivate.h" /* Filter functions */
-/* The initial version of the format */
-#define H5O_PLINE_VERSION_1 1
-
-/* This version encodes the message fields more efficiently */
-/* (Drops the reserved bytes, doesn't align the name and doesn't encode the
- * filter name at all if it's a filter provided by the library)
- */
-#define H5O_PLINE_VERSION_2 2
-
-/* The latest version of the format. Look through the 'encode' and 'size'
- * callbacks for places to change when updating this. */
-#define H5O_PLINE_VERSION_LATEST H5O_PLINE_VERSION_2
-
-
#ifdef H5_HAVE_FILTER_DEFLATE
/*
* Deflate filter
diff --git a/src/H5Zprivate.h b/src/H5Zprivate.h
index 3ce0a0c..c2d6f7e 100644
--- a/src/H5Zprivate.h
+++ b/src/H5Zprivate.h
@@ -87,11 +87,12 @@ H5_DLL herr_t H5Z_pipeline(const struct H5O_pline_t *pline,
H5_DLL H5Z_class2_t *H5Z_find(H5Z_filter_t id);
H5_DLL herr_t H5Z_can_apply(hid_t dcpl_id, hid_t type_id);
H5_DLL herr_t H5Z_set_local(hid_t dcpl_id, hid_t type_id);
+H5_DLL herr_t H5Z_can_apply_direct(const struct H5O_pline_t *pline);
+H5_DLL herr_t H5Z_set_local_direct(const struct H5O_pline_t *pline);
H5_DLL H5Z_filter_info_t *H5Z_filter_info(const struct H5O_pline_t *pline,
H5Z_filter_t filter);
H5_DLL htri_t H5Z_all_filters_avail(const struct H5O_pline_t *pline);
H5_DLL herr_t H5Z_delete(struct H5O_pline_t *pline, H5Z_filter_t filter);
-H5_DLL herr_t H5Z_set_latest_version(struct H5O_pline_t *pline);
/* Data Transform Functions */
typedef struct H5Z_data_xform_t H5Z_data_xform_t; /* Defined in H5Ztrans.c */
diff --git a/src/H5detect.c b/src/H5detect.c
index d5801ef..f76f159 100644
--- a/src/H5detect.c
+++ b/src/H5detect.c
@@ -823,7 +823,7 @@ done:\n\
if(dt != NULL) {\n\
if(dt->shared != NULL)\n\
H5FL_FREE(H5T_shared_t, dt->shared);\n\
- H5FL_FREE(H5T_t, dt);\n\
+ dt = H5FL_FREE(H5T_t, dt);\n\
} /* end if */\n\
} /* end if */\n\
\n\
diff --git a/src/H5private.h b/src/H5private.h
index 2c4576f..65800fc 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -460,6 +460,11 @@ typedef enum {
H5_COPY_DEEP /* Deep copy from source to destination, including duplicating fields pointed to */
} H5_copy_depth_t;
+/* Common object copying udata (right now only used for groups and datasets) */
+typedef struct H5O_copy_file_ud_common_t {
+ struct H5O_pline_t *src_pline; /* Copy of filter pipeline for object */
+} H5O_copy_file_ud_common_t;
+
/* Unique object "position" */
typedef struct {
unsigned long fileno; /* The unique identifier for the file of the object */
@@ -1743,10 +1748,14 @@ static herr_t H5_INTERFACE_INIT_FUNC(void);
#define FUNC_ENTER_COMMON_NOFUNC(func_name,asrt)
#endif /* NDEBUG */
-#define FUNC_ENTER_COMMON(func_name,asrt) \
- static const char FUNC[]=#func_name; \
+#define FUNC_ENTER_COMMON(func_name, asrt) \
+ static const char FUNC[] = #func_name; \
hbool_t err_occurred = FALSE; \
- FUNC_ENTER_COMMON_NOFUNC(func_name,asrt);
+ FUNC_ENTER_COMMON_NOFUNC(func_name, asrt);
+
+#define FUNC_ENTER_COMMON_NOERR(func_name, asrt) \
+ static const char FUNC[] = #func_name; \
+ FUNC_ENTER_COMMON_NOFUNC(func_name, asrt);
/* Threadsafety initialization code for API routines */
#define FUNC_ENTER_API_THREADSAFE \
@@ -1757,22 +1766,37 @@ static herr_t H5_INTERFACE_INIT_FUNC(void);
H5_API_UNSET_CANCEL \
H5_API_LOCK
-/* Threadsafety termination code for API routines */
-#define FUNC_LEAVE_API_THREADSAFE \
- H5_API_UNLOCK \
- H5_API_SET_CANCEL
-
/* Local variables for API routines */
#define FUNC_ENTER_API_VARS(func_name) \
MPE_LOG_VARS(func_name) \
H5TRACE_DECL
+#define FUNC_ENTER_API_COMMON(func_name) \
+ FUNC_ENTER_API_VARS(func_name) \
+ FUNC_ENTER_COMMON(func_name, H5_IS_API(#func_name)); \
+ FUNC_ENTER_API_THREADSAFE;
+
+#define FUNC_ENTER_API_INIT(func_name,err) \
+ /* Initialize the library */ \
+ if(!(H5_INIT_GLOBAL)) { \
+ H5_INIT_GLOBAL = TRUE; \
+ if(H5_init_library() < 0) \
+ HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, err, \
+ "library initialization failed") \
+ } \
+ \
+ /* Initialize the interface, if appropriate */ \
+ H5_INTERFACE_INIT(err) \
+ \
+ /* Push the name of this function on the function stack */ \
+ H5_PUSH_FUNC(#func_name) \
+ \
+ BEGIN_MPE_LOG(func_name)
+
/* Use this macro for all "normal" API functions */
#define FUNC_ENTER_API(func_name,err) {{ \
- FUNC_ENTER_API_VARS(func_name) \
- FUNC_ENTER_COMMON(func_name,H5_IS_API(#func_name)); \
- FUNC_ENTER_API_THREADSAFE; \
- FUNC_ENTER_API_COMMON(func_name,err); \
+ FUNC_ENTER_API_COMMON(func_name) \
+ FUNC_ENTER_API_INIT(func_name,err); \
/* Clear thread error stack entering public functions */ \
H5E_clear_stack(NULL); \
{
@@ -1782,10 +1806,8 @@ static herr_t H5_INTERFACE_INIT_FUNC(void);
* like H5Eprint and H5Ewalk.
*/
#define FUNC_ENTER_API_NOCLEAR(func_name,err) {{ \
- FUNC_ENTER_API_VARS(func_name) \
- FUNC_ENTER_COMMON(func_name,H5_IS_API(#func_name)); \
- FUNC_ENTER_API_THREADSAFE; \
- FUNC_ENTER_API_COMMON(func_name,err); \
+ FUNC_ENTER_API_COMMON(func_name) \
+ FUNC_ENTER_API_INIT(func_name,err); \
{
/*
@@ -1795,9 +1817,7 @@ static herr_t H5_INTERFACE_INIT_FUNC(void);
*
*/
#define FUNC_ENTER_API_NOINIT(func_name) {{ \
- FUNC_ENTER_API_VARS(func_name) \
- FUNC_ENTER_COMMON(func_name,H5_IS_API(#func_name)); \
- FUNC_ENTER_API_THREADSAFE; \
+ FUNC_ENTER_API_COMMON(func_name) \
H5_PUSH_FUNC(#func_name) \
BEGIN_MPE_LOG(func_name); \
{
@@ -1809,16 +1829,30 @@ static herr_t H5_INTERFACE_INIT_FUNC(void);
* are: H5close, H5check_version, etc.
*
*/
-#define FUNC_ENTER_API_NOINIT_NOFS(func_name) {{ \
+#define FUNC_ENTER_API_NOINIT_NOERR_NOFS(func_name) {{ \
FUNC_ENTER_API_VARS(func_name) \
- FUNC_ENTER_COMMON(func_name,H5_IS_API(#func_name)); \
- FUNC_ENTER_API_THREADSAFE; \
+ FUNC_ENTER_COMMON_NOERR(func_name, H5_IS_API(#func_name)); \
+ FUNC_ENTER_API_THREADSAFE; \
BEGIN_MPE_LOG(func_name); \
{
+/* Note: this macro only works when there's _no_ interface initialization routine for the module */
+#define FUNC_ENTER_NOAPI_INIT(func_name,err) \
+ /* Initialize the interface, if appropriate */ \
+ H5_INTERFACE_INIT(err) \
+ \
+ /* Push the name of this function on the function stack */ \
+ H5_PUSH_FUNC(#func_name)
+
/* Use this macro for all "normal" non-API functions */
#define FUNC_ENTER_NOAPI(func_name,err) { \
- FUNC_ENTER_COMMON(func_name,!H5_IS_API(#func_name)); \
+ FUNC_ENTER_COMMON(func_name, !H5_IS_API(#func_name)); \
+ FUNC_ENTER_NOAPI_INIT(func_name,err) \
+ {
+
+/* Use this macro for all non-API functions, which propagate errors, but don't issue them */
+#define FUNC_ENTER_NOAPI_NOERR(func_name,err) { \
+ FUNC_ENTER_COMMON_NOERR(func_name, !H5_IS_API(#func_name)); \
FUNC_ENTER_NOAPI_INIT(func_name,err) \
{
@@ -1836,8 +1870,22 @@ static herr_t H5_INTERFACE_INIT_FUNC(void);
* - functions which are called during library shutdown, since we don't
* want to re-initialize the library.
*/
-#define FUNC_ENTER_NOAPI_NOINIT(func_name) { \
- FUNC_ENTER_COMMON(func_name,!H5_IS_API(#func_name)); \
+#define FUNC_ENTER_NOAPI_NOINIT(func_name) { \
+ FUNC_ENTER_COMMON(func_name, !H5_IS_API(#func_name)); \
+ H5_PUSH_FUNC(#func_name) \
+ {
+
+/*
+ * Use this macro for non-API functions which fall into these categories:
+ * - static functions, since they must be called from a function in the
+ * interface, the library and interface must already be
+ * initialized.
+ * - functions which are called during library shutdown, since we don't
+ * want to re-initialize the library.
+ * - functions that propagate, but don't issue errors
+ */
+#define FUNC_ENTER_NOAPI_NOINIT_NOERR(func_name) { \
+ FUNC_ENTER_COMMON_NOERR(func_name, !H5_IS_API(#func_name)); \
H5_PUSH_FUNC(#func_name) \
{
@@ -1871,31 +1919,6 @@ static herr_t H5_INTERFACE_INIT_FUNC(void);
FUNC_ENTER_COMMON_NOFUNC(func_name,!H5_IS_API(#func_name)); \
{
-#define FUNC_ENTER_API_COMMON(func_name,err) \
- /* Initialize the library */ \
- if (!(H5_INIT_GLOBAL)) { \
- H5_INIT_GLOBAL = TRUE; \
- if (H5_init_library()<0) \
- HGOTO_ERROR (H5E_FUNC, H5E_CANTINIT, err, \
- "library initialization failed") \
- } \
- \
- /* Initialize the interface, if appropriate */ \
- H5_INTERFACE_INIT(err) \
- \
- /* Push the name of this function on the function stack */ \
- H5_PUSH_FUNC(#func_name) \
- \
- BEGIN_MPE_LOG(func_name)
-
-/* Note: this macro only works when there's _no_ interface initialization routine for the module */
-#define FUNC_ENTER_NOAPI_INIT(func_name,err) \
- /* Initialize the interface, if appropriate */ \
- H5_INTERFACE_INIT(err) \
- \
- /* Push the name of this function on the function stack */ \
- H5_PUSH_FUNC(#func_name)
-
/*-------------------------------------------------------------------------
* Purpose: Register function exit for code profiling. This should be
* the last statement executed by a function.
@@ -1912,6 +1935,11 @@ static herr_t H5_INTERFACE_INIT_FUNC(void);
*
*-------------------------------------------------------------------------
*/
+/* Threadsafety termination code for API routines */
+#define FUNC_LEAVE_API_THREADSAFE \
+ H5_API_UNLOCK \
+ H5_API_SET_CANCEL
+
#define FUNC_LEAVE_API(ret_value) \
FINISH_MPE_LOG; \
H5TRACE_RETURN(ret_value); \
@@ -1919,28 +1947,26 @@ static herr_t H5_INTERFACE_INIT_FUNC(void);
if(err_occurred) \
(void)H5E_dump_api_stack(TRUE); \
FUNC_LEAVE_API_THREADSAFE \
- return (ret_value); \
+ return(ret_value); \
} /*end scope from end of FUNC_ENTER*/ \
}} /*end scope from beginning of FUNC_ENTER*/
#define FUNC_LEAVE_API_NOFS(ret_value) \
FINISH_MPE_LOG; \
H5TRACE_RETURN(ret_value); \
- if(err_occurred) \
- (void)H5E_dump_api_stack(TRUE); \
FUNC_LEAVE_API_THREADSAFE \
- return (ret_value); \
+ return(ret_value); \
} /*end scope from end of FUNC_ENTER*/ \
}} /*end scope from beginning of FUNC_ENTER*/
#define FUNC_LEAVE_NOAPI(ret_value) \
- H5_POP_FUNC \
- return (ret_value); \
+ H5_POP_FUNC \
+ return(ret_value); \
} /*end scope from end of FUNC_ENTER*/ \
} /*end scope from beginning of FUNC_ENTER*/
#define FUNC_LEAVE_NOAPI_VOID \
- H5_POP_FUNC \
+ H5_POP_FUNC \
return; \
} /*end scope from end of FUNC_ENTER*/ \
} /*end scope from beginning of FUNC_ENTER*/
@@ -1951,7 +1977,7 @@ static herr_t H5_INTERFACE_INIT_FUNC(void);
* (so far, just the H5CS routines themselves)
*/
#define FUNC_LEAVE_NOAPI_NOFS(ret_value) \
- return (ret_value); \
+ return(ret_value); \
} /*end scope from end of FUNC_ENTER*/ \
} /*end scope from beginning of FUNC_ENTER*/
diff --git a/src/H5public.h b/src/H5public.h
index 2808b01..9422968 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 47 /* For tweaks, bug-fixes, or development */
+#define H5_VERS_RELEASE 51 /* 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.47-FA_a4" /* Full version string */
+#define H5_VERS_INFO "HDF5 library version: 1.9.51-FA_a4" /* Full version string */
#define H5check() H5check_version(H5_VERS_MAJOR,H5_VERS_MINOR, \
H5_VERS_RELEASE)
diff --git a/src/H5trace.c b/src/H5trace.c
index 5f1e128..b554b80 100644
--- a/src/H5trace.c
+++ b/src/H5trace.c
@@ -658,6 +658,81 @@ H5_trace (const double *returning, const char *func, const char *type, ...)
}
break;
+ case 'f':
+ if(ptr) {
+ if(vp)
+ fprintf(out, "0x%lx", (unsigned long)vp);
+ else
+ fprintf(out, "NULL");
+ } /* end if */
+ else {
+ H5F_file_space_type_t fs_type = va_arg(ap, H5F_file_space_type_t); /*lint !e64 Type mismatch not really occuring */
+
+ switch(fs_type) {
+ case H5F_FILE_SPACE_DEFAULT:
+ fprintf(out, "H5F_FILE_SPACE_DEFAULT");
+ break;
+ case H5F_FILE_SPACE_ALL_PERSIST:
+ fprintf(out, "H5F_FILE_SPACE_ALL_PERSIST");
+ break;
+ case H5F_FILE_SPACE_ALL:
+ fprintf(out, "H5F_FILE_SPACE_ALL");
+ break;
+ case H5F_FILE_SPACE_AGGR_VFD:
+ fprintf(out, "H5F_FILE_SPACE_AGGR_VFD");
+ break;
+ case H5F_FILE_SPACE_VFD:
+ fprintf(out, "H5F_FILE_SPACE_VFD");
+ break;
+ default:
+ fprintf(out, "%ld", (long)fs_type);
+ break;
+ } /* end switch */
+ } /* end else */
+ break;
+
+ case 'm':
+ if(ptr) {
+ if(vp)
+ fprintf(out, "0x%lx", (unsigned long)vp);
+ else
+ fprintf(out, "NULL");
+ } /* end if */
+ else {
+ H5F_mem_t mem_type = va_arg(ap, H5F_mem_t); /*lint !e64 Type mismatch not really occuring */
+
+ switch(mem_type) {
+ case H5FD_MEM_NOLIST:
+ fprintf(out, "H5FD_MEM_NOLIST");
+ break;
+ case H5FD_MEM_DEFAULT:
+ fprintf(out, "H5FD_MEM_DEFAULT");
+ break;
+ case H5FD_MEM_SUPER:
+ fprintf(out, "H5FD_MEM_SUPER");
+ break;
+ case H5FD_MEM_BTREE:
+ fprintf(out, "H5FD_MEM_BTREE");
+ break;
+ case H5FD_MEM_DRAW:
+ fprintf(out, "H5FD_MEM_DRAW");
+ break;
+ case H5FD_MEM_GHEAP:
+ fprintf(out, "H5FD_MEM_GHEAP");
+ break;
+ case H5FD_MEM_LHEAP:
+ fprintf(out, "H5FD_MEM_LHEAP");
+ break;
+ case H5FD_MEM_OHDR:
+ fprintf(out, "H5FD_MEM_OHDR");
+ break;
+ default:
+ fprintf(out, "%ld", (long)mem_type);
+ break;
+ } /* end switch */
+ } /* end else */
+ break;
+
case 's':
if(ptr) {
if(vp)
@@ -1379,7 +1454,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...)
/* This may generate recursive call to the library... -QAK */
if(NULL != (pclass = (H5P_genclass_t *)H5I_object(pclass_id)) &&
(class_name = H5P_get_class_name(pclass))!=NULL) {
- fprintf (out, class_name);
+ fprintf(out, "%s", class_name);
H5MM_xfree(class_name);
} /* end if */
else {
diff --git a/src/H5vers.txt b/src/H5vers.txt
index 18a88d9..89f7bc6 100644
--- a/src/H5vers.txt
+++ b/src/H5vers.txt
@@ -55,6 +55,7 @@ FUNCTION: H5Eprint; ; v10, v18
FUNCTION: H5Epush; ; v14, v18
FUNCTION: H5Eset_auto; ; v10, v18
FUNCTION: H5Ewalk; H5E_walk, H5E_error; v10, v18
+FUNCTION: H5Fget_info; H5F_info; v18, v110
FUNCTION: H5Gcreate; ; v10, v18
FUNCTION: H5Gopen; ; v10, v18
FUNCTION: H5Pget_filter; ; v10, v18
diff --git a/src/H5version.h b/src/H5version.h
index 58de2ab..296768e 100644
--- a/src/H5version.h
+++ b/src/H5version.h
@@ -21,9 +21,9 @@
#define _H5version_H
/* Issue error if contradicting macros have been defined. */
-#if defined(H5_USE_16_API) && defined(H5_NO_DEPRECATED_SYMBOLS)
+#if (defined(H5_USE_16_API) || defined(H5_USE_18_API)) && defined(H5_NO_DEPRECATED_SYMBOLS)
#error "Can't choose old API versions when deprecated APIs are disabled"
-#endif /* defined(H5_USE_16_API) && defined(H5_NO_DEPRECATED_SYMBOLS) */
+#endif /* (defined(H5_USE_16_API) || defined(H5_USE_18_API)) && defined(H5_NO_DEPRECATED_SYMBOLS) */
/* If a particular "global" version of the library's interfaces is chosen,
@@ -36,6 +36,11 @@
#define H5_USE_16_API 1
#endif /* H5_USE_16_API_DEFAULT && !H5_USE_16_API */
+#if defined(H5_USE_18_API_DEFAULT) && !defined(H5_USE_18_API)
+#define H5_USE_18_API 1
+#endif /* H5_USE_18_API_DEFAULT && !H5_USE_18_API */
+
+
#ifdef H5_USE_16_API
/*************/
@@ -140,6 +145,114 @@
#endif /* H5_USE_16_API */
+#ifdef H5_USE_18_API
+
+/*************/
+/* Functions */
+/*************/
+
+#if !defined(H5Acreate_vers)
+#define H5Acreate_vers 2
+#endif /* !defined(H5Acreate_vers) */
+
+#if !defined(H5Aiterate_vers)
+#define H5Aiterate_vers 2
+#endif /* !defined(H5Aiterate_vers) */
+
+#if !defined(H5Dcreate_vers)
+#define H5Dcreate_vers 2
+#endif /* !defined(H5Dcreate_vers) */
+
+#if !defined(H5Dopen_vers)
+#define H5Dopen_vers 2
+#endif /* !defined(H5Dopen_vers) */
+
+#if !defined(H5Eclear_vers)
+#define H5Eclear_vers 2
+#endif /* !defined(H5Eclear_vers) */
+
+#if !defined(H5Eget_auto_vers)
+#define H5Eget_auto_vers 2
+#endif /* !defined(H5Eget_auto_vers) */
+
+#if !defined(H5Eprint_vers)
+#define H5Eprint_vers 2
+#endif /* !defined(H5Eprint_vers) */
+
+#if !defined(H5Epush_vers)
+#define H5Epush_vers 2
+#endif /* !defined(H5Epush_vers) */
+
+#if !defined(H5Eset_auto_vers)
+#define H5Eset_auto_vers 2
+#endif /* !defined(H5Eset_auto_vers) */
+
+#if !defined(H5Ewalk_vers)
+#define H5Ewalk_vers 2
+#endif /* !defined(H5Ewalk_vers) */
+
+#if !defined(H5Fget_info_vers)
+#define H5Fget_info_vers 1
+#endif /* !defined(H5Fget_info_vers) */
+
+#if !defined(H5Gcreate_vers)
+#define H5Gcreate_vers 2
+#endif /* !defined(H5Gcreate_vers) */
+
+#if !defined(H5Gopen_vers)
+#define H5Gopen_vers 2
+#endif /* !defined(H5Gopen_vers) */
+
+#if !defined(H5Pget_filter_vers)
+#define H5Pget_filter_vers 2
+#endif /* !defined(H5Pget_filter_vers) */
+
+#if !defined(H5Pget_filter_by_id_vers)
+#define H5Pget_filter_by_id_vers 2
+#endif /* !defined(H5Pget_filter_by_id_vers) */
+
+#if !defined(H5Pinsert_vers)
+#define H5Pinsert_vers 2
+#endif /* !defined(H5Pinsert_vers) */
+
+#if !defined(H5Pregister_vers)
+#define H5Pregister_vers 2
+#endif /* !defined(H5Pregister_vers) */
+
+#if !defined(H5Rget_obj_type_vers)
+#define H5Rget_obj_type_vers 2
+#endif /* !defined(H5Rget_obj_type_vers) */
+
+#if !defined(H5Tarray_create_vers)
+#define H5Tarray_create_vers 2
+#endif /* !defined(H5Tarray_create_vers) */
+
+#if !defined(H5Tcommit_vers)
+#define H5Tcommit_vers 2
+#endif /* !defined(H5Tcommit_vers) */
+
+#if !defined(H5Tget_array_dims_vers)
+#define H5Tget_array_dims_vers 2
+#endif /* !defined(H5Tget_array_dims_vers) */
+
+#if !defined(H5Topen_vers)
+#define H5Topen_vers 2
+#endif /* !defined(H5Topen_vers) */
+
+/************/
+/* Typedefs */
+/************/
+
+#if !defined(H5E_auto_t_vers)
+#define H5E_auto_t_vers 2
+#endif /* !defined(H5E_auto_t_vers) */
+
+#if !defined(H5Z_class_t_vers)
+#define H5Z_class_t_vers 2
+#endif /* !defined(H5Z_class_t_vers) */
+
+#endif /* H5_USE_18_API */
+
/* Choose the correct version of each API symbol, defaulting to the latest
* version of each. The "best" name for API parameters/data structures
@@ -267,6 +380,19 @@
#error "H5Ewalk_vers set to invalid value"
#endif /* H5Ewalk_vers */
+#if !defined(H5Fget_info_vers) || H5Fget_info_vers == 2
+#ifndef H5Fget_info_vers
+#define H5Fget_info_vers 2
+#endif /* H5Fget_info_vers */
+#define H5Fget_info H5Fget_info2
+#define H5F_info_t H5F_info2_t
+#elif H5Fget_info_vers == 1
+#define H5Fget_info H5Fget_info1
+#define H5F_info_t H5F_info1_t
+#else /* H5Fget_info_vers */
+#error "H5Fget_info_vers set to invalid value"
+#endif /* H5Fget_info_vers */
+
#if !defined(H5Gcreate_vers) || H5Gcreate_vers == 2
#ifndef H5Gcreate_vers
#define H5Gcreate_vers 2
diff --git a/src/Makefile.am b/src/Makefile.am
index ce84332..58902fa 100755
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -27,13 +27,13 @@ include $(top_srcdir)/config/lt_vers.am
# a long time to compile it with any optimization on. H5detect is used
# to generate H5Tinit.c once. So, optimization is not critical.
noinst_PROGRAMS = H5detect
-H5detect_CFLAGS = -g
+H5detect_CFLAGS = -g $(AM_CFLAGS)
# Our main target, the HDF5 library
lib_LTLIBRARIES=libhdf5.la
# Add libtool numbers to the HDF5 library (from config/lt_vers.am)
-libhdf5_la_LDFLAGS= -version-info $(LT_VERS_INTERFACE):$(LT_VERS_REVISION):$(LT_VERS_AGE)
+libhdf5_la_LDFLAGS= -version-info $(LT_VERS_INTERFACE):$(LT_VERS_REVISION):$(LT_VERS_AGE) $(AM_LDFLAGS)
# H5Tinit.c is a generated file, and should be cleaned.
MOSTLYCLEANFILES=H5Tinit.c
@@ -44,7 +44,7 @@ DISTCLEANFILES=H5pubconf.h
libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \
H5A.c H5Abtree2.c H5Adense.c H5Adeprec.c H5Aint.c H5Atest.c \
H5AC.c H5B.c H5Bcache.c H5Bdbg.c \
- H5B2.c H5B2cache.c H5B2dbg.c H5B2int.c H5B2stat.c H5B2test.c \
+ H5B2.c H5B2cache.c H5B2dbg.c H5B2hdr.c H5B2int.c H5B2stat.c H5B2test.c \
H5C.c H5CS.c \
H5D.c H5Dbtree.c H5Dchunk.c H5Dcompact.c H5Dcontig.c H5Ddbg.c \
H5Ddeprec.c H5Dearray.c H5Defl.c H5Dfarray.c H5Dfill.c H5Dint.c \
@@ -53,7 +53,8 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \
H5E.c H5Edeprec.c H5Eint.c \
H5EA.c H5EAcache.c H5EAdbg.c H5EAdblkpage.c H5EAdblock.c H5EAhdr.c \
H5EAiblock.c H5EAint.c H5EAsblock.c H5EAstat.c H5EAtest.c \
- H5F.c H5Faccum.c H5Fdbg.c H5Ffake.c H5Fio.c H5Fmount.c H5Fmpi.c H5Fquery.c \
+ H5F.c H5Faccum.c H5Fdbg.c H5Fdeprec.c H5Ffake.c H5Fio.c H5Fmount.c \
+ H5Fmpi.c H5Fquery.c \
H5Fsfile.c H5Fsuper.c H5Fsuper_cache.c H5Ftest.c \
H5FA.c H5FAcache.c H5FAdbg.c H5FAdblock.c H5FAdblkpage.c H5FAhdr.c \
H5FAstat.c H5FAtest.c \
@@ -77,7 +78,7 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \
H5O.c H5Oainfo.c H5Oalloc.c H5Oattr.c \
H5Oattribute.c H5Obogus.c H5Obtreek.c H5Ocache.c \
H5Ocont.c H5Ocopy.c H5Odbg.c H5Odrvinfo.c H5Odtype.c H5Oefl.c \
- H5Ofill.c H5Oginfo.c \
+ H5Ofill.c H5Ofsinfo.c H5Oginfo.c \
H5Olayout.c \
H5Olinfo.c H5Olink.c H5Omessage.c H5Omtime.c \
H5Oname.c H5Onull.c H5Opline.c H5Orefcount.c \
@@ -130,7 +131,7 @@ settings_DATA=libhdf5.settings
H5Tinit.c: H5detect$(EXEEXT)
LD_LIBRARY_PATH="$$LD_LIBRARY_PATH`echo $(LDFLAGS) | \
sed -e 's/-L/:/g' -e 's/ //g'`" \
- $(RUNSERIAL) ./H5detect > H5Tinit.c || \
+ $(RUNSERIAL) ./H5detect$(EXEEXT) > H5Tinit.c || \
(test $$HDF5_Make_Ignore && echo "*** Error ignored") || \
($(RM) $@ ; exit 1)
diff --git a/src/Makefile.in b/src/Makefile.in
index 341baee..f56cab5 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -98,38 +98,39 @@ libhdf5_la_LIBADD =
am_libhdf5_la_OBJECTS = H5.lo H5checksum.lo H5dbg.lo H5system.lo \
H5timer.lo H5trace.lo H5A.lo H5Abtree2.lo H5Adense.lo \
H5Adeprec.lo H5Aint.lo H5Atest.lo H5AC.lo H5B.lo H5Bcache.lo \
- H5Bdbg.lo H5B2.lo H5B2cache.lo H5B2dbg.lo H5B2int.lo \
- H5B2stat.lo H5B2test.lo H5C.lo H5CS.lo H5D.lo H5Dbtree.lo \
- H5Dchunk.lo H5Dcompact.lo H5Dcontig.lo H5Ddbg.lo H5Ddeprec.lo \
- H5Dearray.lo H5Defl.lo H5Dfarray.lo H5Dfill.lo H5Dint.lo \
- H5Dio.lo H5Dlayout.lo H5Dmpio.lo H5Doh.lo H5Dproxy.lo \
- H5Dscatgath.lo H5Dselect.lo H5Dtest.lo H5E.lo H5Edeprec.lo \
- H5Eint.lo H5EA.lo H5EAcache.lo H5EAdbg.lo H5EAdblkpage.lo \
- H5EAdblock.lo H5EAhdr.lo H5EAiblock.lo H5EAint.lo \
- H5EAsblock.lo H5EAstat.lo H5EAtest.lo H5F.lo H5Faccum.lo \
- H5Fdbg.lo H5Ffake.lo H5Fio.lo H5Fmount.lo H5Fmpi.lo \
- H5Fquery.lo H5Fsfile.lo H5Fsuper.lo H5Fsuper_cache.lo \
- H5Ftest.lo H5FA.lo H5FAcache.lo H5FAdbg.lo H5FAdblock.lo \
- H5FAdblkpage.lo H5FAhdr.lo H5FAstat.lo H5FAtest.lo H5FD.lo \
- H5FDcore.lo H5FDdirect.lo H5FDfamily.lo H5FDint.lo H5FDlog.lo \
- H5FDmpi.lo H5FDmpio.lo H5FDmpiposix.lo H5FDmulti.lo \
- H5FDsec2.lo H5FDspace.lo H5FDstdio.lo H5FL.lo H5FO.lo H5FS.lo \
- H5FScache.lo H5FSdbg.lo H5FSsection.lo H5FSstat.lo H5FStest.lo \
- H5G.lo H5Gbtree2.lo H5Gcache.lo H5Gcompact.lo H5Gdense.lo \
- H5Gdeprec.lo H5Gent.lo H5Gint.lo H5Glink.lo H5Gloc.lo \
- H5Gname.lo H5Gnode.lo H5Gobj.lo H5Goh.lo H5Groot.lo H5Gstab.lo \
- H5Gtest.lo H5Gtraverse.lo H5HF.lo H5HFbtree2.lo H5HFcache.lo \
- H5HFdbg.lo H5HFdblock.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 H5Oginfo.lo \
- H5Olayout.lo H5Olinfo.lo H5Olink.lo H5Omessage.lo H5Omtime.lo \
- H5Oname.lo H5Onull.lo H5Opline.lo H5Orefcount.lo H5Osdspace.lo \
+ H5Bdbg.lo H5B2.lo H5B2cache.lo H5B2dbg.lo H5B2hdr.lo \
+ H5B2int.lo H5B2stat.lo H5B2test.lo H5C.lo H5CS.lo H5D.lo \
+ H5Dbtree.lo H5Dchunk.lo H5Dcompact.lo H5Dcontig.lo H5Ddbg.lo \
+ H5Ddeprec.lo H5Dearray.lo H5Defl.lo H5Dfarray.lo H5Dfill.lo \
+ H5Dint.lo H5Dio.lo H5Dlayout.lo H5Dmpio.lo H5Doh.lo \
+ H5Dproxy.lo H5Dscatgath.lo H5Dselect.lo H5Dtest.lo H5E.lo \
+ H5Edeprec.lo H5Eint.lo H5EA.lo H5EAcache.lo H5EAdbg.lo \
+ H5EAdblkpage.lo H5EAdblock.lo H5EAhdr.lo H5EAiblock.lo \
+ H5EAint.lo H5EAsblock.lo H5EAstat.lo H5EAtest.lo H5F.lo \
+ H5Faccum.lo H5Fdbg.lo H5Fdeprec.lo H5Ffake.lo H5Fio.lo \
+ H5Fmount.lo H5Fmpi.lo H5Fquery.lo H5Fsfile.lo H5Fsuper.lo \
+ H5Fsuper_cache.lo H5Ftest.lo H5FA.lo H5FAcache.lo H5FAdbg.lo \
+ H5FAdblock.lo H5FAdblkpage.lo H5FAhdr.lo H5FAstat.lo \
+ H5FAtest.lo H5FD.lo H5FDcore.lo H5FDdirect.lo H5FDfamily.lo \
+ H5FDint.lo H5FDlog.lo H5FDmpi.lo H5FDmpio.lo H5FDmpiposix.lo \
+ H5FDmulti.lo H5FDsec2.lo H5FDspace.lo H5FDstdio.lo H5FL.lo \
+ H5FO.lo H5FS.lo H5FScache.lo H5FSdbg.lo H5FSsection.lo \
+ H5FSstat.lo H5FStest.lo H5G.lo H5Gbtree2.lo H5Gcache.lo \
+ H5Gcompact.lo H5Gdense.lo H5Gdeprec.lo H5Gent.lo H5Gint.lo \
+ H5Glink.lo H5Gloc.lo H5Gname.lo H5Gnode.lo H5Gobj.lo H5Goh.lo \
+ H5Groot.lo H5Gstab.lo H5Gtest.lo H5Gtraverse.lo H5HF.lo \
+ H5HFbtree2.lo H5HFcache.lo H5HFdbg.lo H5HFdblock.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 \
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 \
@@ -182,6 +183,16 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = /home1/packages/automake/automake-1.9.6/bin/aclocal-1.9 -I /afs/ncsa/projects/hdf/packages/libtool_1.5.14/Linux_2.4/share/aclocal
ADD_PARALLEL_FILES = @ADD_PARALLEL_FILES@
AMTAR = @AMTAR@
+
+# H5_CFLAGS holds flags that should be used when building hdf5,
+# but which should not be exported to h5cc for building other programs.
+# AM_CFLAGS is an automake construct which should be used by Makefiles
+# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
+AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
+AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@
+AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
+AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@
+AM_LDFLAGS = @AM_LDFLAGS@
AM_MAKEFLAGS = @AM_MAKEFLAGS@
AR = @AR@
@@ -195,21 +206,18 @@ BYTESEX = @BYTESEX@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CC_VERSION = @CC_VERSION@
-
-# H5_CFLAGS holds flags that should be used as CFLAGS when building hdf5,
-# but which shouldn't be exported to h5cc for building other programs.
-CFLAGS = @CFLAGS@ @H5_CFLAGS@
+CFLAGS = @CFLAGS@
CLEARFILEBUF = @CLEARFILEBUF@
CODESTACK = @CODESTACK@
CONFIG_DATE = @CONFIG_DATE@
CONFIG_MODE = @CONFIG_MODE@
CONFIG_USER = @CONFIG_USER@
CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@ @H5_CPPFLAGS@
+CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@ @H5_CXXFLAGS@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_PKG = @DEBUG_PKG@
DEFAULT_API_VERSION = @DEFAULT_API_VERSION@
@@ -232,7 +240,7 @@ F9XMODEXT = @F9XMODEXT@
F9XMODFLAG = @F9XMODFLAG@
F9XSUFFIXFLAG = @F9XSUFFIXFLAG@
FC = @FC@
-FCFLAGS = @FCFLAGS@ @H5_FCFLAGS@
+FCFLAGS = @FCFLAGS@
FCFLAGS_f90 = @FCFLAGS_f90@
FCLIBS = @FCLIBS@
FGREP = @FGREP@
@@ -433,15 +441,15 @@ 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 = 37
+LT_VERS_REVISION = 41
LT_VERS_AGE = 0
-H5detect_CFLAGS = -g
+H5detect_CFLAGS = -g $(AM_CFLAGS)
# Our main target, the HDF5 library
lib_LTLIBRARIES = libhdf5.la
# Add libtool numbers to the HDF5 library (from config/lt_vers.am)
-libhdf5_la_LDFLAGS = -version-info $(LT_VERS_INTERFACE):$(LT_VERS_REVISION):$(LT_VERS_AGE)
+libhdf5_la_LDFLAGS = -version-info $(LT_VERS_INTERFACE):$(LT_VERS_REVISION):$(LT_VERS_AGE) $(AM_LDFLAGS)
# H5Tinit.c is a generated file, and should be cleaned.
MOSTLYCLEANFILES = H5Tinit.c
@@ -452,7 +460,7 @@ DISTCLEANFILES = H5pubconf.h
libhdf5_la_SOURCES = H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \
H5A.c H5Abtree2.c H5Adense.c H5Adeprec.c H5Aint.c H5Atest.c \
H5AC.c H5B.c H5Bcache.c H5Bdbg.c \
- H5B2.c H5B2cache.c H5B2dbg.c H5B2int.c H5B2stat.c H5B2test.c \
+ H5B2.c H5B2cache.c H5B2dbg.c H5B2hdr.c H5B2int.c H5B2stat.c H5B2test.c \
H5C.c H5CS.c \
H5D.c H5Dbtree.c H5Dchunk.c H5Dcompact.c H5Dcontig.c H5Ddbg.c \
H5Ddeprec.c H5Dearray.c H5Defl.c H5Dfarray.c H5Dfill.c H5Dint.c \
@@ -461,7 +469,8 @@ libhdf5_la_SOURCES = H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \
H5E.c H5Edeprec.c H5Eint.c \
H5EA.c H5EAcache.c H5EAdbg.c H5EAdblkpage.c H5EAdblock.c H5EAhdr.c \
H5EAiblock.c H5EAint.c H5EAsblock.c H5EAstat.c H5EAtest.c \
- H5F.c H5Faccum.c H5Fdbg.c H5Ffake.c H5Fio.c H5Fmount.c H5Fmpi.c H5Fquery.c \
+ H5F.c H5Faccum.c H5Fdbg.c H5Fdeprec.c H5Ffake.c H5Fio.c H5Fmount.c \
+ H5Fmpi.c H5Fquery.c \
H5Fsfile.c H5Fsuper.c H5Fsuper_cache.c H5Ftest.c \
H5FA.c H5FAcache.c H5FAdbg.c H5FAdblock.c H5FAdblkpage.c H5FAhdr.c \
H5FAstat.c H5FAtest.c \
@@ -485,7 +494,7 @@ libhdf5_la_SOURCES = H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \
H5O.c H5Oainfo.c H5Oalloc.c H5Oattr.c \
H5Oattribute.c H5Obogus.c H5Obtreek.c H5Ocache.c \
H5Ocont.c H5Ocopy.c H5Odbg.c H5Odrvinfo.c H5Odtype.c H5Oefl.c \
- H5Ofill.c H5Oginfo.c \
+ H5Ofill.c H5Ofsinfo.c H5Oginfo.c \
H5Olayout.c \
H5Olinfo.c H5Olink.c H5Omessage.c H5Omtime.c \
H5Oname.c H5Onull.c H5Opline.c H5Orefcount.c \
@@ -664,6 +673,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5B2.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5B2cache.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5B2dbg.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5B2hdr.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5B2int.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5B2stat.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5B2test.Plo@am__quote@
@@ -737,6 +747,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5FStest.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Faccum.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Fdbg.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Fdeprec.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Ffake.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Fio.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Fmount.Plo@am__quote@
@@ -812,6 +823,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Odtype.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Oefl.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Ofill.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Ofsinfo.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Oginfo.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Olayout.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Olinfo.Plo@am__quote@
@@ -1230,7 +1242,7 @@ help:
H5Tinit.c: H5detect$(EXEEXT)
LD_LIBRARY_PATH="$$LD_LIBRARY_PATH`echo $(LDFLAGS) | \
sed -e 's/-L/:/g' -e 's/ //g'`" \
- $(RUNSERIAL) ./H5detect > H5Tinit.c || \
+ $(RUNSERIAL) ./H5detect$(EXEEXT) > H5Tinit.c || \
(test $$HDF5_Make_Ignore && echo "*** Error ignored") || \
($(RM) $@ ; exit 1)
diff --git a/src/libhdf5.settings.in b/src/libhdf5.settings.in
index 51406de..a3032e5 100644
--- a/src/libhdf5.settings.in
+++ b/src/libhdf5.settings.in
@@ -17,15 +17,21 @@ Compiling Options:
------------------
Compilation Mode: @CONFIG_MODE@
C Compiler: @CC_VERSION@
- CFLAGS/H5_CFLAGS: @CFLAGS@/@H5_CFLAGS@
- CPPFLAGS/H5_CPPFLAGS: @CPPFLAGS@/@H5_CPPFLAGS@
+ CFLAGS: @CFLAGS@
+ H5_CFLAGS: @H5_CFLAGS@
+ AM_CFLAGS: @AM_CFLAGS@
+ CPPFLAGS: @CPPFLAGS@
+ H5_CPPFLAGS: @H5_CPPFLAGS@
+ AM_CPPFLAGS: @AM_CPPFLAGS@
Shared Libraries: @enable_shared@
Static Libraries: @enable_static@
Statically Linked Executables: @STATIC_EXEC@
- Extra libraries: @LDFLAGS@ @LIBS@
- Archiver: @AR@
- Ranlib: @RANLIB@
- Debugged Packages: @DEBUG_PKG@
+ LDFLAGS: @LDFLAGS@
+ AM_LDFLAGS: @AM_LDFLAGS@
+ Extra libraries: @LIBS@
+ Archiver: @AR@
+ Ranlib: @RANLIB@
+ Debugged Packages: @DEBUG_PKG@
API Tracing: @TRACE_API@
Languages:
@@ -33,9 +39,13 @@ Languages:
Fortran: @HDF_FORTRAN@
@BUILD_FORTRAN_CONDITIONAL_TRUE@ Fortran Compiler: @FC@
@BUILD_FORTRAN_CONDITIONAL_TRUE@ Fortran Flags: @FCFLAGS@
+@BUILD_FORTRAN_CONDITIONAL_TRUE@ H5 Fortran Flags: @H5_FCFLAGS@
+@BUILD_FORTRAN_CONDITIONAL_TRUE@ AM Fortran Flags: @AM_FCFLAGS@
C++: @HDF_CXX@
@BUILD_CXX_CONDITIONAL_TRUE@ C++ Compiler: @CXX@
@BUILD_CXX_CONDITIONAL_TRUE@ C++ Flags: @CXXFLAGS@
+@BUILD_CXX_CONDITIONAL_TRUE@ H5 C++ Flags: @H5_CXXFLAGS@
+@BUILD_CXX_CONDITIONAL_TRUE@ AM C++ Flags: @AM_CXXFLAGS@
Features:
---------
diff --git a/test/Makefile.am b/test/Makefile.am
index 48ce292..2d5d0b7 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -64,7 +64,7 @@ check_PROGRAMS=$(TEST_PROG) error_test err_compat tcheck_version testmeta
# so do not appear in this list.
BUILD_ALL_PROGS=gen_bad_ohdr gen_bogus gen_cross gen_deflate gen_filters gen_idx gen_new_array \
gen_new_fill gen_new_group gen_new_mtime gen_new_super gen_noencoder \
- gen_nullspace gen_udlinks space_overflow
+ gen_nullspace gen_udlinks space_overflow gen_filespace gen_specmetaread
if BUILD_ALL_CONDITIONAL
noinst_PROGRAMS=$(BUILD_ALL_PROGS)
@@ -105,29 +105,30 @@ flush2.chkexe_: flush1.chkexe_
# specifying a file prefix or low-level driver. Changing the file
# prefix or low-level driver with environment variables will influence
# the temporary file name in ways that the makefile is not aware of.
-CHECK_CLEANFILES+=cmpd_dset.h5 compact_dataset.h5 dataset.h5 dset_offset.h5 \
- max_compact_dataset.h5 simple.h5 set_local.h5 random_chunks.h5 \
- huge_chunks.h5 chunk_cache.h5 big_chunk.h5 chunk_fast.h5 \
- chunk_expand.h5 extend.h5 istore.h5 extlinks*.h5 frspace.h5 \
- links*.h5 sys_file1 tfile[1-4].h5 th5s[1-3].h5 lheap.h5 \
- fheap.h5 ohdr.h5 \
- stab.h5 extern_[1-3].h5 extern_[1-4][ab].raw gheap[0-4].h5 \
- dt_arith[1-2] links.h5 links[0-6]*.h5 extlinks[0-15].h5 tmp \
- big.data big[0-9][0-9][0-9][0-9][0-9].h5 \
- stdio.h5 sec2.h5 dtypes[1-8].h5 dt_arith[1-2].h5 tattr.h5 \
- tselect.h5 mtime.h5 unlink.h5 unicode.h5 coord.h5 \
- fillval_[0-9].h5 fillval.raw mount_[0-9].h5 testmeta.h5 ttime.h5 \
- trefer[1-3].h5 tvltypes.h5 tvlstr.h5 tvlstr2.h5 flush.h5 \
- enum1.h5 titerate.h5 ttsafe.h5 tarray1.h5 tgenprop.h5 \
- tmisc[0-9]*.h5 set_extent[1-5].h5 ext[12].bin \
- getname.h5 getname[1-3].h5 sec2_file.h5 direct_file.h5 \
- family_file000[0-3][0-9].h5 new_family_v16_000[0-3][0-9].h5 \
- multi_file-[rs].h5 core_file \
- new_move_[ab].h5 ntypes.h5 dangle.h5 error_test.h5 err_compat.h5 \
- dtransform.h5 test_filters.h5 get_file_name.h5 tstint[1-2].h5 \
- unlink_chunked.h5 btree2.h5 objcopy_src.h5 objcopy_dst.h5 \
- objcopy_ext.dat trefer1.h5 trefer2.h5 app_ref.h5 farray.h5 \
- earray.h5 swmr_data.h5
+CHECK_CLEANFILES+=cmpd_dset.h5 compact_dataset.h5 dataset.h5 \
+ dset_offset.h5 \
+ max_compact_dataset.h5 simple.h5 set_local.h5 random_chunks.h5 \
+ huge_chunks.h5 chunk_cache.h5 big_chunk.h5 chunk_fast.h5 \
+ chunk_expand.h5 \
+ extend.h5 istore.h5 extlinks*.h5 frspace.h5 links*.h5 \
+ sys_file1 tfile[1-4].h5 th5s[1-3].h5 lheap.h5 fheap.h5 ohdr.h5 \
+ stab.h5 extern_[1-3].h5 extern_[1-4][ab].raw gheap[0-4].h5 \
+ dt_arith[1-2] links.h5 links[0-6]*.h5 extlinks[0-15].h5 tmp \
+ big.data big[0-9][0-9][0-9][0-9][0-9].h5 \
+ stdio.h5 sec2.h5 dtypes[1-8].h5 dt_arith[1-2].h5 tattr.h5 \
+ tselect.h5 mtime.h5 unlink.h5 unicode.h5 coord.h5 \
+ fillval_[0-9].h5 fillval.raw mount_[0-9].h5 testmeta.h5 ttime.h5 \
+ trefer[1-3].h5 tvltypes.h5 tvlstr.h5 tvlstr2.h5 flush.h5 \
+ enum1.h5 titerate.h5 ttsafe.h5 tarray1.h5 tgenprop.h5 \
+ tmisc[0-9]*.h5 set_extent[1-5].h5 ext[12].bin \
+ getname.h5 getname[1-3].h5 sec2_file.h5 direct_file.h5 \
+ family_file000[0-3][0-9].h5 new_family_v16_000[0-3][0-9].h5 \
+ multi_file-[rs].h5 core_file \
+ new_move_[ab].h5 ntypes.h5 dangle.h5 error_test.h5 err_compat.h5 \
+ dtransform.h5 test_filters.h5 get_file_name.h5 tstint[1-2].h5 \
+ unlink_chunked.h5 btree2.h5 objcopy_src.h5 objcopy_dst.h5 \
+ objcopy_ext.dat trefer1.h5 trefer2.h5 app_ref.h5 farray.h5 \
+ earray.h5 swmr_data.h5
# Sources for testhdf5 executable
testhdf5_SOURCES=testhdf5.c tarray.c tattr.c tchecksum.c tconfig.c tfile.c \
@@ -136,6 +137,6 @@ testhdf5_SOURCES=testhdf5.c tarray.c tattr.c tchecksum.c tconfig.c tfile.c \
tvlstr.c tvltypes.c
# Temporary files.
-DISTCLEANFILES=testerror.sh
+DISTCLEANFILES=testerror.sh testlibinfo.sh testcheck_version.sh
include $(top_srcdir)/config/conclude.am
diff --git a/test/Makefile.in b/test/Makefile.in
index febdc45..c95c3c2 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -96,7 +96,8 @@ am__EXEEXT_2 = gen_bad_ohdr$(EXEEXT) gen_bogus$(EXEEXT) \
gen_new_group$(EXEEXT) gen_new_mtime$(EXEEXT) \
gen_new_super$(EXEEXT) gen_noencoder$(EXEEXT) \
gen_nullspace$(EXEEXT) gen_udlinks$(EXEEXT) \
- space_overflow$(EXEEXT)
+ space_overflow$(EXEEXT) gen_filespace$(EXEEXT) \
+ gen_specmetaread$(EXEEXT)
PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS)
app_ref_SOURCES = app_ref.c
app_ref_OBJECTS = app_ref.$(OBJEXT)
@@ -214,6 +215,10 @@ gen_deflate_SOURCES = gen_deflate.c
gen_deflate_OBJECTS = gen_deflate.$(OBJEXT)
gen_deflate_LDADD = $(LDADD)
gen_deflate_DEPENDENCIES = libh5test.la $(LIBHDF5)
+gen_filespace_SOURCES = gen_filespace.c
+gen_filespace_OBJECTS = gen_filespace.$(OBJEXT)
+gen_filespace_LDADD = $(LDADD)
+gen_filespace_DEPENDENCIES = libh5test.la $(LIBHDF5)
gen_filters_SOURCES = gen_filters.c
gen_filters_OBJECTS = gen_filters.$(OBJEXT)
gen_filters_LDADD = $(LDADD)
@@ -250,6 +255,10 @@ gen_nullspace_SOURCES = gen_nullspace.c
gen_nullspace_OBJECTS = gen_nullspace.$(OBJEXT)
gen_nullspace_LDADD = $(LDADD)
gen_nullspace_DEPENDENCIES = libh5test.la $(LIBHDF5)
+gen_specmetaread_SOURCES = gen_specmetaread.c
+gen_specmetaread_OBJECTS = gen_specmetaread.$(OBJEXT)
+gen_specmetaread_LDADD = $(LDADD)
+gen_specmetaread_DEPENDENCIES = libh5test.la $(LIBHDF5)
gen_udlinks_SOURCES = gen_udlinks.c
gen_udlinks_OBJECTS = gen_udlinks.$(OBJEXT)
gen_udlinks_LDADD = $(LDADD)
@@ -386,11 +395,12 @@ SOURCES = $(libh5test_la_SOURCES) app_ref.c big.c bittests.c btree2.c \
dt_arith.c dtransform.c dtypes.c earray.c enum.c err_compat.c \
error_test.c extend.c external.c farray.c fheap.c fillval.c \
flush1.c flush2.c freespace.c gen_bad_ohdr.c gen_bogus.c \
- gen_cross.c gen_deflate.c gen_filters.c gen_idx.c \
- gen_new_array.c gen_new_fill.c gen_new_group.c gen_new_mtime.c \
- gen_new_super.c gen_noencoder.c gen_nullspace.c gen_udlinks.c \
- getname.c gheap.c hyperslab.c istore.c lheap.c links.c mf.c \
- mount.c mtime.c ntypes.c objcopy.c ohdr.c pool.c reserved.c \
+ gen_cross.c gen_deflate.c gen_filespace.c gen_filters.c \
+ gen_idx.c gen_new_array.c gen_new_fill.c gen_new_group.c \
+ gen_new_mtime.c gen_new_super.c gen_noencoder.c \
+ gen_nullspace.c gen_specmetaread.c gen_udlinks.c getname.c \
+ gheap.c hyperslab.c istore.c lheap.c links.c mf.c mount.c \
+ mtime.c ntypes.c objcopy.c ohdr.c pool.c reserved.c \
set_extent.c space_overflow.c stab.c swmr_generator.c \
swmr_reader.c swmr_writer.c tcheck_version.c \
$(testhdf5_SOURCES) testmeta.c $(ttsafe_SOURCES) unlink.c \
@@ -400,13 +410,14 @@ DIST_SOURCES = $(libh5test_la_SOURCES) app_ref.c big.c bittests.c \
dsets.c dt_arith.c dtransform.c dtypes.c earray.c enum.c \
err_compat.c error_test.c extend.c external.c farray.c fheap.c \
fillval.c flush1.c flush2.c freespace.c gen_bad_ohdr.c \
- gen_bogus.c gen_cross.c gen_deflate.c gen_filters.c gen_idx.c \
- gen_new_array.c gen_new_fill.c gen_new_group.c gen_new_mtime.c \
- gen_new_super.c gen_noencoder.c gen_nullspace.c gen_udlinks.c \
- getname.c gheap.c hyperslab.c istore.c lheap.c links.c mf.c \
- mount.c mtime.c ntypes.c objcopy.c ohdr.c pool.c reserved.c \
- set_extent.c space_overflow.c stab.c swmr_generator.c \
- swmr_reader.c swmr_writer.c tcheck_version.c \
+ gen_bogus.c gen_cross.c gen_deflate.c gen_filespace.c \
+ gen_filters.c gen_idx.c gen_new_array.c gen_new_fill.c \
+ gen_new_group.c gen_new_mtime.c gen_new_super.c \
+ gen_noencoder.c gen_nullspace.c gen_specmetaread.c \
+ gen_udlinks.c getname.c gheap.c hyperslab.c istore.c lheap.c \
+ links.c mf.c mount.c mtime.c ntypes.c objcopy.c ohdr.c pool.c \
+ reserved.c set_extent.c space_overflow.c stab.c \
+ swmr_generator.c swmr_reader.c swmr_writer.c tcheck_version.c \
$(testhdf5_SOURCES) testmeta.c $(ttsafe_SOURCES) unlink.c \
vfd.c
ETAGS = etags
@@ -417,6 +428,16 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = /home1/packages/automake/automake-1.9.6/bin/aclocal-1.9 -I /afs/ncsa/projects/hdf/packages/libtool_1.5.14/Linux_2.4/share/aclocal
ADD_PARALLEL_FILES = @ADD_PARALLEL_FILES@
AMTAR = @AMTAR@
+
+# H5_CFLAGS holds flags that should be used when building hdf5,
+# but which should not be exported to h5cc for building other programs.
+# AM_CFLAGS is an automake construct which should be used by Makefiles
+# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
+AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
+AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@
+AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
+AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@
+AM_LDFLAGS = @AM_LDFLAGS@
AM_MAKEFLAGS = @AM_MAKEFLAGS@
AR = @AR@
@@ -430,21 +451,18 @@ BYTESEX = @BYTESEX@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CC_VERSION = @CC_VERSION@
-
-# H5_CFLAGS holds flags that should be used as CFLAGS when building hdf5,
-# but which shouldn't be exported to h5cc for building other programs.
-CFLAGS = @CFLAGS@ @H5_CFLAGS@
+CFLAGS = @CFLAGS@
CLEARFILEBUF = @CLEARFILEBUF@
CODESTACK = @CODESTACK@
CONFIG_DATE = @CONFIG_DATE@
CONFIG_MODE = @CONFIG_MODE@
CONFIG_USER = @CONFIG_USER@
CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@ @H5_CPPFLAGS@
+CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@ @H5_CXXFLAGS@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_PKG = @DEBUG_PKG@
DEFAULT_API_VERSION = @DEFAULT_API_VERSION@
@@ -467,7 +485,7 @@ F9XMODEXT = @F9XMODEXT@
F9XMODFLAG = @F9XMODFLAG@
F9XSUFFIXFLAG = @F9XSUFFIXFLAG@
FC = @FC@
-FCFLAGS = @FCFLAGS@ @H5_FCFLAGS@
+FCFLAGS = @FCFLAGS@
FCFLAGS_f90 = @FCFLAGS_f90@
FCLIBS = @FCLIBS@
FGREP = @FGREP@
@@ -724,7 +742,7 @@ TEST_PROG = testhdf5 lheap ohdr stab gheap cache cache_api \
# so do not appear in this list.
BUILD_ALL_PROGS = gen_bad_ohdr gen_bogus gen_cross gen_deflate gen_filters gen_idx gen_new_array \
gen_new_fill gen_new_group gen_new_mtime gen_new_super gen_noencoder \
- gen_nullspace gen_udlinks space_overflow
+ gen_nullspace gen_udlinks space_overflow gen_filespace gen_specmetaread
# The libh5test library provides common support code for the tests.
@@ -749,7 +767,7 @@ testhdf5_SOURCES = testhdf5.c tarray.c tattr.c tchecksum.c tconfig.c tfile.c \
# Temporary files.
-DISTCLEANFILES = testerror.sh
+DISTCLEANFILES = testerror.sh testlibinfo.sh testcheck_version.sh
# Automake needs to be taught how to build lib, progs, and tests targets.
# These will be filled in automatically for the most part (e.g.,
@@ -965,6 +983,9 @@ gen_cross$(EXEEXT): $(gen_cross_OBJECTS) $(gen_cross_DEPENDENCIES)
gen_deflate$(EXEEXT): $(gen_deflate_OBJECTS) $(gen_deflate_DEPENDENCIES)
@rm -f gen_deflate$(EXEEXT)
$(LINK) $(gen_deflate_OBJECTS) $(gen_deflate_LDADD) $(LIBS)
+gen_filespace$(EXEEXT): $(gen_filespace_OBJECTS) $(gen_filespace_DEPENDENCIES)
+ @rm -f gen_filespace$(EXEEXT)
+ $(LINK) $(gen_filespace_OBJECTS) $(gen_filespace_LDADD) $(LIBS)
gen_filters$(EXEEXT): $(gen_filters_OBJECTS) $(gen_filters_DEPENDENCIES)
@rm -f gen_filters$(EXEEXT)
$(LINK) $(gen_filters_OBJECTS) $(gen_filters_LDADD) $(LIBS)
@@ -992,6 +1013,9 @@ gen_noencoder$(EXEEXT): $(gen_noencoder_OBJECTS) $(gen_noencoder_DEPENDENCIES)
gen_nullspace$(EXEEXT): $(gen_nullspace_OBJECTS) $(gen_nullspace_DEPENDENCIES)
@rm -f gen_nullspace$(EXEEXT)
$(LINK) $(gen_nullspace_OBJECTS) $(gen_nullspace_LDADD) $(LIBS)
+gen_specmetaread$(EXEEXT): $(gen_specmetaread_OBJECTS) $(gen_specmetaread_DEPENDENCIES)
+ @rm -f gen_specmetaread$(EXEEXT)
+ $(LINK) $(gen_specmetaread_OBJECTS) $(gen_specmetaread_LDADD) $(LIBS)
gen_udlinks$(EXEEXT): $(gen_udlinks_OBJECTS) $(gen_udlinks_DEPENDENCIES)
@rm -f gen_udlinks$(EXEEXT)
$(LINK) $(gen_udlinks_OBJECTS) $(gen_udlinks_LDADD) $(LIBS)
@@ -1110,6 +1134,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gen_bogus.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gen_cross.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gen_deflate.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gen_filespace.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gen_filters.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gen_idx.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gen_new_array.Po@am__quote@
@@ -1119,6 +1144,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gen_new_super.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gen_noencoder.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gen_nullspace.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gen_specmetaread.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gen_udlinks.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getname.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gheap.Po@am__quote@
diff --git a/test/app_ref.c b/test/app_ref.c
index cb8be6a..611d255 100644
--- a/test/app_ref.c
+++ b/test/app_ref.c
@@ -85,8 +85,8 @@ Abrt_Handler (int UNUSED sig)
int i, n;
for (i=0; i<T_NUMCLASSES; i++) {
- fprintf (stderr, "%s ID reference count: %n", IDNAME[i], &n);
- fprintf (stderr, "%*d\n", (n < ERR_WIDTH) ? (ERR_WIDTH - n) : 0, rc[i]);
+ fprintf(stderr, "%s ID reference count: %n", IDNAME[i], &n);
+ fprintf(stderr, "%*d\n", (n < ERR_WIDTH) ? (ERR_WIDTH - n) : 0, rc[i]);
}
}
diff --git a/test/btree2.c b/test/btree2.c
index dc0caa5..6006dc8 100644
--- a/test/btree2.c
+++ b/test/btree2.c
@@ -42,6 +42,246 @@ const char *FILENAME[] = {
#define DELETE_MEDIUM 200
#define DELETE_LARGE 2000
+/* Testing parameters */
+typedef struct bt2_test_param_t {
+ hbool_t reopen_btree; /* Whether to re-open the B-tree during the test */
+} bt2_test_param_t;
+
+
+/*-------------------------------------------------------------------------
+ * Function: init_cparam
+ *
+ * Purpose: Initialize v2 B-tree creation parameter structure
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, October 29, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+init_cparam(H5B2_create_t *cparam)
+{
+ /* Wipe out background */
+ HDmemset(cparam, 0, sizeof(*cparam));
+
+ /* General parameters */
+ cparam->cls = H5B2_TEST;
+ cparam->node_size = (size_t)512;
+ cparam->rrec_size = (size_t)8;
+ cparam->split_percent = 100;
+ cparam->merge_percent = 40;
+
+ return(0);
+} /* init_cparam() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: create_file
+ *
+ * Purpose: Perform common "creation" operations on file
+ *
+ * Return: Success: 0
+ * Failure: 1
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, November 5, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+create_file(hid_t *file, H5F_t **f, hid_t fapl)
+{
+ char filename[1024]; /* Filename to use */
+
+ /* Set the filename to use for this test (dependent on fapl) */
+ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
+
+ /* Create the file to work on */
+ if((*file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+
+ /* Get a pointer to the internal file object */
+ if(NULL == (*f = (H5F_t *)H5I_object(*file)))
+ STACK_ERROR
+
+ /* Success */
+ return(0);
+
+error:
+ return(-1);
+} /* end create_file() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: create_btree
+ *
+ * Purpose: Perform common "create" operations on B-tree for testing
+ *
+ * Return: Success: 0
+ * Failure: 1
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, November 5, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+create_btree(H5F_t *f, hid_t dxpl, const H5B2_create_t *cparam,
+ H5B2_t **bt2, haddr_t *bt2_addr)
+{
+ /* Create the v2 B-tree & get its address */
+ if(NULL == (*bt2 = H5B2_create(f, dxpl, cparam)))
+ FAIL_STACK_ERROR
+ if(H5B2_get_addr(*bt2, bt2_addr/*out*/) < 0)
+ FAIL_STACK_ERROR
+ if(!H5F_addr_defined(*bt2_addr))
+ FAIL_STACK_ERROR
+
+ /* Success */
+ return(0);
+
+error:
+ return(-1);
+} /* end create_btree() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: reopen_btree
+ *
+ * Purpose: Perform common "re-open" operations on B-tree for testing
+ *
+ * Return: Success: 0
+ * Failure: 1
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, November 5, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+reopen_btree(H5F_t *f, hid_t dxpl, H5B2_t **bt2, haddr_t bt2_addr,
+ const bt2_test_param_t *tparam)
+{
+ /* Check for closing & re-opening the B-tree */
+ if(tparam->reopen_btree) {
+ /* Close (empty) v2 B-tree */
+ if(H5B2_close(*bt2, dxpl) < 0)
+ FAIL_STACK_ERROR
+
+ /* Re-open v2 B-tree */
+ if(NULL == (*bt2 = H5B2_open(f, dxpl, bt2_addr)))
+ FAIL_STACK_ERROR
+ } /* end if */
+
+ /* Success */
+ return(0);
+
+error:
+ return(-1);
+} /* end reopen_btree() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: check_stats
+ *
+ * Purpose: Check statistics about v1 B-tree
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, November 5, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+check_stats(H5B2_t *bt2, const H5B2_stat_t *expected)
+{
+ H5B2_stat_t actual; /* Actual stats retrieved about v2 B-tree */
+
+ /* Get current stats */
+ if(H5B2_stat_info(bt2, &actual) < 0)
+ FAIL_STACK_ERROR
+ if(actual.depth != expected->depth)
+ TEST_ERROR
+ if(actual.nrecords != expected->nrecords)
+ TEST_ERROR
+
+ /* Success */
+ return(0);
+
+error:
+ return(-1);
+} /* end check_stats() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: check_node_depth
+ *
+ * Purpose: Check the depth of the node containing a record
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, November 5, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+check_node_depth(H5B2_t *bt2, hid_t dxpl, hsize_t record, unsigned depth)
+{
+ int rec_depth; /* Depth of record in B-tree */
+
+ if((rec_depth = H5B2_get_node_depth_test(bt2, dxpl, &record)) < 0)
+ FAIL_STACK_ERROR
+ if((unsigned)rec_depth != depth)
+ TEST_ERROR
+
+ /* Success */
+ return(0);
+
+error:
+ return(-1);
+} /* end check_node_depth() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: check_node_info
+ *
+ * Purpose: Check the info of the node containing a record
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Quincey Koziol
+ * Friday, November 6, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+check_node_info(H5B2_t *bt2, hid_t dxpl, hsize_t record,
+ H5B2_node_info_test_t *ninfo)
+{
+ H5B2_node_info_test_t rec_ninfo; /* Node info for record in B-tree */
+
+ if(H5B2_get_node_info_test(bt2, dxpl, &record, &rec_ninfo) < 0)
+ FAIL_STACK_ERROR
+ if(rec_ninfo.depth != ninfo->depth)
+ TEST_ERROR
+ if(rec_ninfo.nrec != ninfo->nrec)
+ TEST_ERROR
+
+ /* Success */
+ return(0);
+
+error:
+ return(-1);
+} /* end check_node_depth() */
+
/*-------------------------------------------------------------------------
* Function: iter_cb
@@ -211,7 +451,6 @@ remove_cb(const void *_record, void *_op_data)
* Purpose: Basic tests for the B-tree v2 code
*
* Return: Success: 0
- *
* Failure: 1
*
* Programmer: Quincey Koziol
@@ -220,40 +459,45 @@ remove_cb(const void *_record, void *_op_data)
*-------------------------------------------------------------------------
*/
static unsigned
-test_insert_basic(hid_t fapl)
+test_insert_basic(hid_t fapl, const H5B2_create_t *cparam,
+ const bt2_test_param_t *tparam)
{
hid_t file = -1; /* File ID */
- char filename[1024]; /* Filename to use */
H5F_t *f = NULL; /* Internal file object pointer */
+ hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */
+ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
hsize_t record; /* Record to insert into tree */
hsize_t idx; /* Index within B-tree, for iterator */
- haddr_t bt2_addr; /* Address of B-tree created */
herr_t ret; /* Generic error return value */
- /* Set the filename to use for this test (dependent on fapl) */
- h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
+ /*
+ * Test v2 B-tree creation
+ */
+ TESTING("B-tree creation");
- /* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ /* Create the file for the test */
+ if(create_file(&file, &f, fapl) < 0)
TEST_ERROR
- /* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
- STACK_ERROR
+ /* Create the v2 B-tree & get its address */
+ if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0)
+ TEST_ERROR
+
+ PASSED();
/*
- * Test v2 B-tree creation
+ * Test queries/iterations on empty v2 B-tree
*/
- TESTING("B-tree creation");
- if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, 512, 8, 100, 40, &bt2_addr/*out*/) < 0)
- FAIL_STACK_ERROR
- if(!H5F_addr_defined(bt2_addr))
- FAIL_STACK_ERROR
- PASSED();
+ TESTING("B-tree iteration: empty B-tree");
+
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
+ TEST_ERROR
/* Attempt to iterate over a B-tree with no records */
idx = 0;
- if(H5B2_iterate(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, iter_cb, &idx) < 0)
+ if(H5B2_iterate(bt2, dxpl, iter_cb, &idx) < 0)
FAIL_STACK_ERROR
/* Make certain that the index hasn't changed */
if(idx != 0)
@@ -261,50 +505,57 @@ test_insert_basic(hid_t fapl)
/* Attempt to find record in B-tree with no records */
idx = 0;
- if(H5B2_find(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &idx, find_cb, NULL) != FALSE)
+ if(H5B2_find(bt2, dxpl, &idx, find_cb, NULL) != FALSE)
TEST_ERROR
/* Attempt to index record in B-tree with no records */
idx = 0;
H5E_BEGIN_TRY {
- ret = H5B2_index(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, H5_ITER_INC, (hsize_t)0, find_cb, NULL);
+ ret = H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)0, find_cb, NULL);
} H5E_END_TRY;
/* Should fail */
if(ret != FAIL)
TEST_ERROR
+ PASSED();
+
/*
- * Test inserting record into v2 B-tree
+ * Test inserting first record into v2 B-tree
*/
- TESTING("B-tree insert: several records");
+ TESTING("B-tree insert: first record");
+
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
+ TEST_ERROR
+
record = 42;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
/* Attempt to find non-existant record in B-tree with 1 record */
/* (Should not be found, but not fail) */
idx = 41;
- if(H5B2_find(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &idx, find_cb, &idx) != FALSE)
+ if(H5B2_find(bt2, dxpl, &idx, find_cb, &idx) != FALSE)
TEST_ERROR
/* Try again with NULL 'op' */
/* (Should not be found, but not fail) */
- if(H5B2_find(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &idx, NULL, NULL) != FALSE)
+ if(H5B2_find(bt2, dxpl, &idx, NULL, NULL) != FALSE)
TEST_ERROR
/* Attempt to find existant record in B-tree with 1 record */
idx = 42;
- if(H5B2_find(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &idx, find_cb, &idx) != TRUE)
+ if(H5B2_find(bt2, dxpl, &idx, find_cb, &idx) != TRUE)
TEST_ERROR
/* Try again with NULL 'op' */
- if(H5B2_find(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &idx, NULL, NULL) != TRUE)
+ if(H5B2_find(bt2, dxpl, &idx, NULL, NULL) != TRUE)
TEST_ERROR
/* Attempt to index non-existant record in B-tree with 1 record */
idx = 0;
H5E_BEGIN_TRY {
- ret = H5B2_index(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, H5_ITER_INC, (hsize_t)1, find_cb, NULL);
+ ret = H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)1, find_cb, NULL);
} H5E_END_TRY;
/* Should fail */
if(ret != FAIL)
@@ -312,45 +563,56 @@ test_insert_basic(hid_t fapl)
/* Attempt to index existing record in B-tree with 1 record */
idx = 42;
- if(H5B2_index(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, H5_ITER_INC, (hsize_t)0, find_cb, &idx)<0)
+ if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)0, find_cb, &idx) < 0)
+ TEST_ERROR
+
+ PASSED();
+
+ /*
+ * Test inserting more records into v2 B-tree
+ */
+ TESTING("B-tree insert: several records");
+
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/*
* Test inserting second record into v2 B-tree, before all other records
*/
record = 34;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
/*
* Test inserting third record into v2 B-tree, after all other records
*/
record = 56;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
/*
* Test inserting fourth record into v2 B-tree, in the middle of other records
*/
record = 38;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
/* Attempt to find non-existant record in level-0 B-tree with several records */
/* (Should not be found, but not fail) */
idx = 41;
- if(H5B2_find(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &idx, find_cb, &idx) != FALSE)
+ if(H5B2_find(bt2, dxpl, &idx, find_cb, &idx) != FALSE)
TEST_ERROR
/* Attempt to find existant record in level-0 B-tree with several record */
idx = 56;
- if(H5B2_find(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &idx, find_cb, &idx) != TRUE)
+ if(H5B2_find(bt2, dxpl, &idx, find_cb, &idx) != TRUE)
TEST_ERROR
/* Attempt to index non-existant record in B-tree with several records */
idx = 0;
H5E_BEGIN_TRY {
- ret = H5B2_index(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, H5_ITER_INC, (hsize_t)4, find_cb, NULL);
+ ret = H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)4, find_cb, NULL);
} H5E_END_TRY;
/* Should fail */
if(ret != FAIL)
@@ -358,29 +620,36 @@ test_insert_basic(hid_t fapl)
/* Attempt to index existing record in B-tree with several records */
idx = 34;
- if(H5B2_index(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, H5_ITER_INC, (hsize_t)0, find_cb, &idx)<0)
+ if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)0, find_cb, &idx) < 0)
TEST_ERROR
idx = 38;
- if(H5B2_index(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, H5_ITER_INC, (hsize_t)1, find_cb, &idx)<0)
+ if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)1, find_cb, &idx) < 0)
TEST_ERROR
idx = 42;
- if(H5B2_index(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, H5_ITER_INC, (hsize_t)2, find_cb, &idx)<0)
+ if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)2, find_cb, &idx) < 0)
TEST_ERROR
idx = 56;
- if(H5B2_index(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, H5_ITER_INC, (hsize_t)3, find_cb, &idx)<0)
+ if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)3, find_cb, &idx) < 0)
TEST_ERROR
- PASSED();
+ /* Close the v2 B-tree */
+ if(H5B2_close(bt2, dxpl) < 0)
+ FAIL_STACK_ERROR
+ bt2 = NULL;
/* Close the file */
- if(H5Fclose(file)<0)
+ if(H5Fclose(file) < 0)
TEST_ERROR
+ PASSED();
+
/* All tests passed */
return(0);
error:
H5E_BEGIN_TRY {
+ if(bt2)
+ H5B2_close(bt2, dxpl);
H5Fclose(file);
} H5E_END_TRY;
return(1);
@@ -396,7 +665,6 @@ error:
* left and right leaf nodes after the split
*
* Return: Success: 0
- *
* Failure: 1
*
* Programmer: Quincey Koziol
@@ -405,128 +673,120 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_insert_split_root(hid_t fapl)
+test_insert_split_root(hid_t fapl, const H5B2_create_t *cparam,
+ const bt2_test_param_t *tparam)
{
- hid_t file=-1;
- char filename[1024];
- H5F_t *f=NULL;
+ hid_t file = -1; /* File ID */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */
+ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
hsize_t record; /* Record to insert into tree */
hsize_t idx; /* Index within B-tree, for iterator */
- haddr_t bt2_addr; /* Address of B-tree created */
H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
- int rec_depth; /* Depth of record in B-tree */
unsigned u; /* Local index variable */
herr_t ret; /* Generic error return value */
- h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
-
- /* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- STACK_ERROR
-
- /* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
- STACK_ERROR
-
/*
* Test inserting enough records into v2 B-tree to split the root node
*/
TESTING("B-tree insert: split root");
- /*
- * Test v2 B-tree creation
- */
- if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, 512, 8, 100, 40, &bt2_addr/*out*/) < 0)
- FAIL_STACK_ERROR
+ /* Create the file for the test */
+ if(create_file(&file, &f, fapl) < 0)
+ TEST_ERROR
+
+ /* Create the v2 B-tree & get its address */
+ if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0)
+ TEST_ERROR
/* Insert records to fill root leaf node */
for(u = 0; u < (INSERT_SPLIT_ROOT_NREC - 1); u++) {
record = u + 2;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- if(H5B2_stat_info(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &bt2_stat) < 0)
- FAIL_STACK_ERROR
- if(bt2_stat.depth != 0)
+ bt2_stat.depth = 0;
+ bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC - 1);
+ if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
- if(bt2_stat.nrecords != (INSERT_SPLIT_ROOT_NREC - 1))
+ if(check_node_depth(bt2, dxpl, (hsize_t)33, (unsigned)0) < 0)
TEST_ERROR
- record = 33;
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 0)
+
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Insert record to split root leaf node */
record = INSERT_SPLIT_ROOT_NREC + 1;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
/* Check up on B-tree */
- if(H5B2_stat_info(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &bt2_stat) < 0)
- FAIL_STACK_ERROR
- if(bt2_stat.depth != 1)
+ bt2_stat.depth = 1;
+ bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC;
+ if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
- if(bt2_stat.nrecords != INSERT_SPLIT_ROOT_NREC)
+ if(check_node_depth(bt2, dxpl, (hsize_t)33, (unsigned)1) < 0)
TEST_ERROR
- record = 33;
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
+
/* Insert a couple more records, on the left side of the B-tree */
- record=0;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ record = 0;
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
- record=1;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ record = 1;
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
/* Check up on B-tree */
- if(H5B2_stat_info(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &bt2_stat) < 0)
- FAIL_STACK_ERROR
- if(bt2_stat.depth != 1)
+ bt2_stat.depth = 1;
+ bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC + 2);
+ if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
- if(bt2_stat.nrecords != (INSERT_SPLIT_ROOT_NREC + 2))
+ if(check_node_depth(bt2, dxpl, (hsize_t)33, (unsigned)1) < 0)
TEST_ERROR
- record = 33;
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
+
/* Iterate over B-tree to check records have been inserted correctly */
idx = 0;
- if(H5B2_iterate(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, iter_cb, &idx) < 0)
+ if(H5B2_iterate(bt2, dxpl, iter_cb, &idx) < 0)
FAIL_STACK_ERROR
/* Make certain that the index is correct */
- if(idx != (INSERT_SPLIT_ROOT_NREC+2))
+ if(idx != (INSERT_SPLIT_ROOT_NREC + 2))
TEST_ERROR
/* Attempt to find non-existant record in level-1 B-tree */
/* (Should not be found, but not fail) */
idx = INSERT_SPLIT_ROOT_NREC + 10;
- if(H5B2_find(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &idx, find_cb, &idx) != FALSE)
+ if(H5B2_find(bt2, dxpl, &idx, find_cb, &idx) != FALSE)
TEST_ERROR
/* Attempt to find existant record in root of level-1 B-tree */
idx = 33;
- if(H5B2_find(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &idx, find_cb, &idx) != TRUE)
+ if(H5B2_find(bt2, dxpl, &idx, find_cb, &idx) != TRUE)
FAIL_STACK_ERROR
/* Attempt to find existant record in leaf of level-1 B-tree */
idx = 56;
- if(H5B2_find(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &idx, find_cb, &idx) != TRUE)
+ if(H5B2_find(bt2, dxpl, &idx, find_cb, &idx) != TRUE)
FAIL_STACK_ERROR
/* Attempt to index non-existant record in level-1 B-tree */
idx = 0;
H5E_BEGIN_TRY {
- ret = H5B2_index(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, H5_ITER_INC, (hsize_t)(INSERT_SPLIT_ROOT_NREC+2), find_cb, NULL);
+ ret = H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)(INSERT_SPLIT_ROOT_NREC+2), find_cb, NULL);
} H5E_END_TRY;
/* Should fail */
if(ret != FAIL)
@@ -534,28 +794,35 @@ test_insert_split_root(hid_t fapl)
/* Attempt to index existing record in root of level-1 B-tree */
idx = 33;
- if(H5B2_index(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, H5_ITER_INC, (hsize_t)33, find_cb, &idx) < 0)
+ if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)33, find_cb, &idx) < 0)
FAIL_STACK_ERROR
/* Attempt to index existing record in left leaf of level-1 B-tree */
idx = 0;
- if(H5B2_index(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, H5_ITER_INC, (hsize_t)0, find_cb, &idx) < 0)
+ if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)0, find_cb, &idx) < 0)
FAIL_STACK_ERROR
/* Attempt to index existing record in right leaf of level-1 B-tree */
idx = 50;
- if(H5B2_index(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, H5_ITER_INC, (hsize_t)50, find_cb, &idx) < 0)
+ if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)50, find_cb, &idx) < 0)
FAIL_STACK_ERROR
- PASSED();
+ /* Close the v2 B-tree */
+ if(H5B2_close(bt2, dxpl) < 0)
+ FAIL_STACK_ERROR
+ bt2 = NULL;
if(H5Fclose(file) < 0)
TEST_ERROR
+ PASSED();
+
return 0;
error:
H5E_BEGIN_TRY {
+ if(bt2)
+ H5B2_close(bt2, dxpl);
H5Fclose(file);
} H5E_END_TRY;
return 1;
@@ -572,7 +839,6 @@ error:
* redistribution
*
* Return: Success: 0
- *
* Failure: 1
*
* Programmer: Quincey Koziol
@@ -581,77 +847,70 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_insert_level1_2leaf_redistrib(hid_t fapl)
+test_insert_level1_2leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam,
+ const bt2_test_param_t *tparam)
{
- hid_t file=-1;
- char filename[1024];
- H5F_t *f=NULL;
- hsize_t record; /* Record to insert into tree */
+ hid_t file = -1; /* File ID */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */
+ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
haddr_t bt2_addr; /* Address of B-tree created */
+ hsize_t record; /* Record to insert into tree */
H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
- int rec_depth; /* Depth of record in B-tree */
unsigned u; /* Local index variable */
- h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
-
- /* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- STACK_ERROR
-
- /* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
- STACK_ERROR
-
/*
* Test inserting many records into v2 B-tree
*/
TESTING("B-tree insert: redistribute 2 leaves in level 1 B-tree (l->r)");
- /*
- * Create v2 B-tree
- */
- if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, 512, 8, 100, 40, &bt2_addr/*out*/) < 0)
- FAIL_STACK_ERROR
+ /* Create the file for the test */
+ if(create_file(&file, &f, fapl) < 0)
+ TEST_ERROR
+
+ /* Create the v2 B-tree & get its address */
+ if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0)
+ TEST_ERROR
/* Insert enough records to force root to split into 2 leaves */
for(u = 0; u < INSERT_SPLIT_ROOT_NREC; u++) {
record = u + (INSERT_SPLIT_ROOT_NREC/2) + 1;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- if(H5B2_stat_info(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &bt2_stat) < 0)
- FAIL_STACK_ERROR
- if(bt2_stat.depth != 1)
+ bt2_stat.depth = 1;
+ bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC;
+ if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
- if(bt2_stat.nrecords != INSERT_SPLIT_ROOT_NREC)
+ if(check_node_depth(bt2, dxpl, (hsize_t)INSERT_SPLIT_ROOT_NREC, (unsigned)1) < 0)
TEST_ERROR
- record = INSERT_SPLIT_ROOT_NREC;
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
+
/* Force redistribution from left node into right node */
for(u = 0; u < (INSERT_SPLIT_ROOT_NREC / 2) + 1; u++) {
record = u;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- if(H5B2_stat_info(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &bt2_stat) < 0)
- FAIL_STACK_ERROR
- if(bt2_stat.depth != 1)
+ bt2_stat.depth = 1;
+ bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC + (INSERT_SPLIT_ROOT_NREC / 2) + 1);
+ if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
- if(bt2_stat.nrecords != (INSERT_SPLIT_ROOT_NREC + (INSERT_SPLIT_ROOT_NREC / 2) + 1))
+ if(check_node_depth(bt2, dxpl, (hsize_t)((INSERT_SPLIT_ROOT_NREC / 2) + (INSERT_SPLIT_ROOT_NREC / 4) + 1), (unsigned)1) < 0)
TEST_ERROR
- record = (INSERT_SPLIT_ROOT_NREC / 2) + (INSERT_SPLIT_ROOT_NREC / 4) + 1;
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
+
+ /* Close the v2 B-tree */
+ if(H5B2_close(bt2, dxpl) < 0)
FAIL_STACK_ERROR
- if(rec_depth != 1)
- TEST_ERROR
+ bt2 = NULL;
PASSED();
@@ -660,51 +919,48 @@ test_insert_level1_2leaf_redistrib(hid_t fapl)
*/
TESTING("B-tree insert: redistribute 2 leaves in level 1 B-tree (r->l)");
- /*
- * Create v2 B-tree
- */
- if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, 512, 8, 100, 40, &bt2_addr/*out*/) < 0)
- FAIL_STACK_ERROR
+ /* Create the v2 B-tree & get its address */
+ if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0)
+ TEST_ERROR
/* Insert enough records to force root to split into 2 leaves */
for(u = 0; u < INSERT_SPLIT_ROOT_NREC; u++) {
record = u;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- if(H5B2_stat_info(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &bt2_stat) < 0)
- FAIL_STACK_ERROR
- if(bt2_stat.depth != 1)
+ bt2_stat.depth = 1;
+ bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC;
+ if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
- if(bt2_stat.nrecords != INSERT_SPLIT_ROOT_NREC)
+ if(check_node_depth(bt2, dxpl, (hsize_t)(INSERT_SPLIT_ROOT_NREC / 2), (unsigned)1) < 0)
TEST_ERROR
- record = (INSERT_SPLIT_ROOT_NREC / 2);
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Force redistribution from left node into right node */
for(u = 0; u < (INSERT_SPLIT_ROOT_NREC / 2) + 1; u++) {
record = u + INSERT_SPLIT_ROOT_NREC;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- if(H5B2_stat_info(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &bt2_stat) < 0)
- FAIL_STACK_ERROR
- if(bt2_stat.depth != 1)
+ bt2_stat.depth = 1;
+ bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC + (INSERT_SPLIT_ROOT_NREC / 2) + 1;
+ if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
- if(bt2_stat.nrecords != (INSERT_SPLIT_ROOT_NREC + (INSERT_SPLIT_ROOT_NREC / 2) + 1))
+ if(check_node_depth(bt2, dxpl, (hsize_t)((INSERT_SPLIT_ROOT_NREC / 2) + (INSERT_SPLIT_ROOT_NREC / 4) + 1), (unsigned)1) < 0)
TEST_ERROR
- record = (INSERT_SPLIT_ROOT_NREC / 2) + (INSERT_SPLIT_ROOT_NREC / 4) + 1;
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
+
+ /* Close the v2 B-tree */
+ if(H5B2_close(bt2, dxpl) < 0)
FAIL_STACK_ERROR
- if(rec_depth != 1)
- TEST_ERROR
+ bt2 = NULL;
/* Close file */
if(H5Fclose(file) < 0)
@@ -716,6 +972,8 @@ test_insert_level1_2leaf_redistrib(hid_t fapl)
error:
H5E_BEGIN_TRY {
+ if(bt2)
+ H5B2_close(bt2, dxpl);
H5Fclose(file);
} H5E_END_TRY;
return 1;
@@ -732,7 +990,6 @@ error:
* split, adding another node to the B-tree
*
* Return: Success: 0
- *
* Failure: 1
*
* Programmer: Quincey Koziol
@@ -741,83 +998,75 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_insert_level1_side_split(hid_t fapl)
+test_insert_level1_side_split(hid_t fapl, const H5B2_create_t *cparam,
+ const bt2_test_param_t *tparam)
{
- hid_t file=-1;
- char filename[1024];
- H5F_t *f=NULL;
- hsize_t record; /* Record to insert into tree */
+ hid_t file = -1; /* File ID */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */
+ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
haddr_t bt2_addr; /* Address of B-tree created */
+ hsize_t record; /* Record to insert into tree */
H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
- int rec_depth; /* Depth of record in B-tree */
unsigned u; /* Local index variable */
- h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
-
- /* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- STACK_ERROR
-
- /* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
- STACK_ERROR
-
/*
* Test inserting many records into v2 B-tree
*/
TESTING("B-tree insert: split side leaf into 2 leaves in level 1 B-tree (l->r)");
- /*
- * Create v2 B-tree
- */
- if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, 512, 8, 100, 40, &bt2_addr/*out*/) < 0)
- FAIL_STACK_ERROR
+ /* Create the file for the test */
+ if(create_file(&file, &f, fapl) < 0)
+ TEST_ERROR
+
+ /* Create the v2 B-tree & get its address */
+ if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0)
+ TEST_ERROR
/* Insert enough records to force root to split into 2 leaves */
for(u = 0; u < INSERT_SPLIT_ROOT_NREC; u++) {
record = u + INSERT_SPLIT_ROOT_NREC;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- if(H5B2_stat_info(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &bt2_stat) < 0)
- FAIL_STACK_ERROR
- if(bt2_stat.depth != 1)
- TEST_ERROR
- if(bt2_stat.nrecords != INSERT_SPLIT_ROOT_NREC)
+ bt2_stat.depth = 1;
+ bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC;
+ if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = INSERT_SPLIT_ROOT_NREC + (INSERT_SPLIT_ROOT_NREC / 2);
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ TEST_ERROR
+
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Force left node to split */
for(u = 0; u < INSERT_SPLIT_ROOT_NREC; u++) {
record = u;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- if(H5B2_stat_info(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &bt2_stat) < 0)
- FAIL_STACK_ERROR
- if(bt2_stat.depth != 1)
- TEST_ERROR
- if(bt2_stat.nrecords != (2 * INSERT_SPLIT_ROOT_NREC))
+ bt2_stat.depth = 1;
+ bt2_stat.nrecords = 2 * INSERT_SPLIT_ROOT_NREC;
+ if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = 31;
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
record = 63;
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
+ /* Close the v2 B-tree */
+ if(H5B2_close(bt2, dxpl) < 0)
+ FAIL_STACK_ERROR
+ bt2 = NULL;
+
PASSED();
/*
@@ -825,56 +1074,51 @@ test_insert_level1_side_split(hid_t fapl)
*/
TESTING("B-tree insert: split side leaf into 2 leaves in level 1 B-tree (r->l)");
- /*
- * Create v2 B-tree
- */
- if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, 512, 8, 100, 40, &bt2_addr/*out*/) < 0)
- FAIL_STACK_ERROR
+ /* Create the v2 B-tree & get its address */
+ if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0)
+ TEST_ERROR
/* Insert enough records to force root to split into 2 leaves */
for(u = 0; u < INSERT_SPLIT_ROOT_NREC; u++) {
record = u;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- if(H5B2_stat_info(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &bt2_stat) < 0)
- FAIL_STACK_ERROR
- if(bt2_stat.depth != 1)
- TEST_ERROR
- if(bt2_stat.nrecords != INSERT_SPLIT_ROOT_NREC)
+ bt2_stat.depth = 1;
+ bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC;
+ if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = (INSERT_SPLIT_ROOT_NREC / 2);
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ TEST_ERROR
+
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Force right node to split */
for(u = 0; u < INSERT_SPLIT_ROOT_NREC; u++) {
record = u + INSERT_SPLIT_ROOT_NREC;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- if(H5B2_stat_info(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &bt2_stat) < 0)
- FAIL_STACK_ERROR
- if(bt2_stat.depth != 1)
+ bt2_stat.depth = 1;
+ bt2_stat.nrecords = 2 * INSERT_SPLIT_ROOT_NREC;
+ if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
- if(bt2_stat.nrecords != (2 * INSERT_SPLIT_ROOT_NREC))
+ if(check_node_depth(bt2, dxpl, (hsize_t)62, (unsigned)1) < 0)
TEST_ERROR
- record = 62;
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, (hsize_t)94, (unsigned)1) < 0)
TEST_ERROR
- record = 94;
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
+
+ /* Close the v2 B-tree */
+ if(H5B2_close(bt2, dxpl) < 0)
FAIL_STACK_ERROR
- if(rec_depth != 1)
- TEST_ERROR
+ bt2 = NULL;
/* Close file */
if(H5Fclose(file) < 0)
@@ -886,6 +1130,8 @@ test_insert_level1_side_split(hid_t fapl)
error:
H5E_BEGIN_TRY {
+ if(bt2)
+ H5B2_close(bt2, dxpl);
H5Fclose(file);
} H5E_END_TRY;
return 1;
@@ -912,118 +1158,110 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_insert_level1_3leaf_redistrib(hid_t fapl)
+test_insert_level1_3leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam,
+ const bt2_test_param_t *tparam)
{
- hid_t file=-1;
- char filename[1024];
- H5F_t *f=NULL;
- hsize_t record; /* Record to insert into tree */
+ hid_t file = -1; /* File ID */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */
+ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
haddr_t bt2_addr; /* Address of B-tree created */
+ hsize_t record; /* Record to insert into tree */
H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
- int rec_depth; /* Depth of record in B-tree */
hsize_t idx; /* Index within B-tree, for iterator */
unsigned u; /* Local index variable */
- h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
-
- /* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- STACK_ERROR
-
- /* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
- STACK_ERROR
-
/*
* Test inserting many records into v2 B-tree
*/
TESTING("B-tree insert: redistribute 3 leaves in level 1 B-tree");
- /*
- * Create v2 B-tree
- */
- if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, 512, 8, 100, 40, &bt2_addr/*out*/) < 0)
- FAIL_STACK_ERROR
+ /* Create the file for the test */
+ if(create_file(&file, &f, fapl) < 0)
+ TEST_ERROR
+
+ /* Create the v2 B-tree & get its address */
+ if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0)
+ TEST_ERROR
/* Insert enough records to force root to split into 2 leaves */
for(u = 0; u < INSERT_SPLIT_ROOT_NREC; u++) {
record = u + (INSERT_SPLIT_ROOT_NREC + (INSERT_SPLIT_ROOT_NREC / 2) + 1);
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- if(H5B2_stat_info(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &bt2_stat) < 0)
- FAIL_STACK_ERROR
- if(bt2_stat.depth != 1)
- TEST_ERROR
- if(bt2_stat.nrecords != INSERT_SPLIT_ROOT_NREC)
+ bt2_stat.depth = 1;
+ bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC;
+ if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = (2 * INSERT_SPLIT_ROOT_NREC);
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ TEST_ERROR
+
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Force left node to split */
for(u = 0; u < INSERT_SPLIT_ROOT_NREC; u++) {
record = u;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- if(H5B2_stat_info(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &bt2_stat) < 0)
- FAIL_STACK_ERROR
- if(bt2_stat.depth != 1)
- TEST_ERROR
- if(bt2_stat.nrecords != (2 * INSERT_SPLIT_ROOT_NREC))
+ bt2_stat.depth = 1;
+ bt2_stat.nrecords = 2 * INSERT_SPLIT_ROOT_NREC;
+ if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = (INSERT_SPLIT_ROOT_NREC / 2);
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
record = (INSERT_SPLIT_ROOT_NREC + (INSERT_SPLIT_ROOT_NREC / 2) + 1);
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ TEST_ERROR
+
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Insert records to force middle node to redistribute */
for(u = 0; u < ((INSERT_SPLIT_ROOT_NREC / 2) + 1); u++) {
record = u + INSERT_SPLIT_ROOT_NREC;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- if(H5B2_stat_info(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &bt2_stat) < 0)
- FAIL_STACK_ERROR
- if(bt2_stat.depth != 1)
+ bt2_stat.depth = 1;
+ bt2_stat.nrecords = (2 * INSERT_SPLIT_ROOT_NREC) + (INSERT_SPLIT_ROOT_NREC / 2) + 1;
+ if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
- if(bt2_stat.nrecords != ((2 * INSERT_SPLIT_ROOT_NREC) + (INSERT_SPLIT_ROOT_NREC / 2) + 1))
+ if(check_node_depth(bt2, dxpl, (hsize_t)52, (unsigned)1) < 0)
TEST_ERROR
- record = 52;
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, (hsize_t)105, (unsigned)1) < 0)
TEST_ERROR
- record = 105;
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Iterate over B-tree to check records have been inserted correctly */
idx = 0;
- if(H5B2_iterate(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, iter_cb, &idx) < 0)
+ if(H5B2_iterate(bt2, dxpl, iter_cb, &idx) < 0)
FAIL_STACK_ERROR
/* Make certain that the index is correct */
if(idx != ((INSERT_SPLIT_ROOT_NREC * 2) + (INSERT_SPLIT_ROOT_NREC / 2) + 1))
TEST_ERROR
+ /* Close the v2 B-tree */
+ if(H5B2_close(bt2, dxpl) < 0)
+ FAIL_STACK_ERROR
+ bt2 = NULL;
+
/* Close file */
if(H5Fclose(file) < 0)
FAIL_STACK_ERROR
@@ -1034,6 +1272,8 @@ test_insert_level1_3leaf_redistrib(hid_t fapl)
error:
H5E_BEGIN_TRY {
+ if(bt2)
+ H5B2_close(bt2, dxpl);
H5Fclose(file);
} H5E_END_TRY;
return 1;
@@ -1051,7 +1291,6 @@ error:
* add records until a 3 node split occurs
*
* Return: Success: 0
- *
* Failure: 1
*
* Programmer: Quincey Koziol
@@ -1060,98 +1299,89 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_insert_level1_middle_split(hid_t fapl)
+test_insert_level1_middle_split(hid_t fapl, const H5B2_create_t *cparam,
+ const bt2_test_param_t *tparam)
{
- hid_t file=-1;
- char filename[1024];
- H5F_t *f=NULL;
- hsize_t record; /* Record to insert into tree */
+ hid_t file = -1; /* File ID */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */
+ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
haddr_t bt2_addr; /* Address of B-tree created */
+ hsize_t record; /* Record to insert into tree */
H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
- int rec_depth; /* Depth of record in B-tree */
hsize_t idx; /* Index within B-tree, for iterator */
unsigned u; /* Local index variable */
- h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
-
- /* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- STACK_ERROR
-
- /* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
- STACK_ERROR
-
/*
* Test inserting many records into v2 B-tree
*/
TESTING("B-tree insert: split middle leaf into 2 leaves in level 1 B-tree");
- /*
- * Create v2 B-tree
- */
- if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, 512, 8, 100, 40, &bt2_addr/*out*/) < 0)
- FAIL_STACK_ERROR
+ /* Create the file for the test */
+ if(create_file(&file, &f, fapl) < 0)
+ TEST_ERROR
+
+ /* Create the v2 B-tree & get its address */
+ if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0)
+ TEST_ERROR
/* Insert enough records to force root to split into 2 leaves */
for(u = 0; u < INSERT_SPLIT_ROOT_NREC; u++) {
record = u + (INSERT_SPLIT_ROOT_NREC * 2);
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- if(H5B2_stat_info(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &bt2_stat) < 0)
- FAIL_STACK_ERROR
- if(bt2_stat.depth != 1)
- TEST_ERROR
- if(bt2_stat.nrecords != INSERT_SPLIT_ROOT_NREC)
+ bt2_stat.depth = 1;
+ bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC;
+ if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = (2 * INSERT_SPLIT_ROOT_NREC) + (INSERT_SPLIT_ROOT_NREC / 2);
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ TEST_ERROR
+
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Force split from left node into right node */
for(u = 0; u < (INSERT_SPLIT_ROOT_NREC * 2); u++) {
record = u;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- if(H5B2_stat_info(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &bt2_stat) < 0)
- FAIL_STACK_ERROR
- if(bt2_stat.depth != 1)
+ bt2_stat.depth = 1;
+ bt2_stat.nrecords = 3 * INSERT_SPLIT_ROOT_NREC;
+ if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
- if(bt2_stat.nrecords != (3 * INSERT_SPLIT_ROOT_NREC))
+ if(check_node_depth(bt2, dxpl, (hsize_t)62, (unsigned)1) < 0)
TEST_ERROR
- record = 62;
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, (hsize_t)94, (unsigned)1) < 0)
TEST_ERROR
- record = 94;
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, (hsize_t)126, (unsigned)1) < 0)
TEST_ERROR
- record = 126;
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Iterate over B-tree to check records have been inserted correctly */
idx = 0;
- if(H5B2_iterate(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, iter_cb, &idx) < 0)
+ if(H5B2_iterate(bt2, dxpl, iter_cb, &idx) < 0)
FAIL_STACK_ERROR
/* Make certain that the index is correct */
if(idx != (INSERT_SPLIT_ROOT_NREC * 3))
TEST_ERROR
+ /* Close the v2 B-tree */
+ if(H5B2_close(bt2, dxpl) < 0)
+ FAIL_STACK_ERROR
+ bt2 = NULL;
+
/* Close file */
if(H5Fclose(file) < 0)
STACK_ERROR
@@ -1162,6 +1392,8 @@ test_insert_level1_middle_split(hid_t fapl)
error:
H5E_BEGIN_TRY {
+ if(bt2)
+ H5B2_close(bt2, dxpl);
H5Fclose(file);
} H5E_END_TRY;
return 1;
@@ -1175,7 +1407,6 @@ error:
* records to make a level 2 B-tree
*
* Return: Success: 0
- *
* Failure: 1
*
* Programmer: Quincey Koziol
@@ -1184,85 +1415,81 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_insert_make_level2(hid_t fapl)
+test_insert_make_level2(hid_t fapl, const H5B2_create_t *cparam,
+ const bt2_test_param_t *tparam)
{
- hid_t file=-1;
- char filename[1024];
- H5F_t *f=NULL;
- hsize_t record; /* Record to insert into tree */
+ hid_t file = -1; /* File ID */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */
+ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
haddr_t bt2_addr; /* Address of B-tree created */
+ hsize_t record; /* Record to insert into tree */
H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
- int rec_depth; /* Depth of record in B-tree */
hsize_t idx; /* Index within B-tree, for iterator */
unsigned u; /* Local index variable */
herr_t ret; /* Generic error return value */
- h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
-
- /* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- STACK_ERROR
-
- /* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
- STACK_ERROR
-
/*
* Test inserting many records into v2 B-tree
*/
TESTING("B-tree insert: make level 2 B-tree");
- /*
- * Create v2 B-tree
- */
- if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, 512, 8, 100, 40, &bt2_addr/*out*/) < 0)
- FAIL_STACK_ERROR
+ /* Create the file for the test */
+ if(create_file(&file, &f, fapl) < 0)
+ TEST_ERROR
+
+ /* Create the v2 B-tree & get its address */
+ if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0)
+ TEST_ERROR
/* Insert enough records to force root to split into 2 internal nodes */
for(u = 0; u < (INSERT_SPLIT_ROOT_NREC * 9); u++) {
record = u + 2;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
for(; u < ((INSERT_SPLIT_ROOT_NREC * 29) + 1); u++) {
record = u + 4;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- if(H5B2_stat_info(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &bt2_stat) < 0)
- FAIL_STACK_ERROR
- if(bt2_stat.depth != 2)
+ bt2_stat.depth = 2;
+ bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC * 29) + 1;
+ if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
- if(bt2_stat.nrecords != ((INSERT_SPLIT_ROOT_NREC * 29) + 1))
+ if(check_node_depth(bt2, dxpl, (hsize_t)948, (unsigned)2) < 0)
TEST_ERROR
- record = 948;
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 2)
+
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Add some extra records to left-most leaf */
record = 0;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
record = 1;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
/* Add some extra records to middle leaf */
record = (INSERT_SPLIT_ROOT_NREC * 9) + 2;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
record = (INSERT_SPLIT_ROOT_NREC * 9) + 3;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
+ TEST_ERROR
+
/* Iterate over B-tree to check records have been inserted correctly */
idx = 0;
- if(H5B2_iterate(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, iter_cb, &idx) < 0)
+ if(H5B2_iterate(bt2, dxpl, iter_cb, &idx) < 0)
FAIL_STACK_ERROR
/* Make certain that the index is correct */
@@ -1272,49 +1499,40 @@ test_insert_make_level2(hid_t fapl)
/* Attempt to find non-existant record in level-2 B-tree */
/* (Should not be found, but not fail) */
idx = INSERT_SPLIT_ROOT_NREC * 30;
- if(H5B2_find(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &idx, find_cb, &idx) != FALSE)
+ if(H5B2_find(bt2, dxpl, &idx, find_cb, &idx) != FALSE)
TEST_ERROR
/* Attempt to find existant record in root of level-2 B-tree */
idx = 948;
- if(H5B2_find(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &idx, find_cb, &idx) != TRUE)
+ if(H5B2_find(bt2, dxpl, &idx, find_cb, &idx) != TRUE)
FAIL_STACK_ERROR
/* Check with B-tree */
- record = 948;
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 2)
+ if(check_node_depth(bt2, dxpl, (hsize_t)948, (unsigned)2) < 0)
TEST_ERROR
/* Attempt to find existant record in internal node of level-2 B-tree */
idx = 505;
- if(H5B2_find(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &idx, find_cb, &idx) != TRUE)
+ if(H5B2_find(bt2, dxpl, &idx, find_cb, &idx) != TRUE)
FAIL_STACK_ERROR
/* Check with B-tree */
- record = 505;
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, (hsize_t)505, (unsigned)1) < 0)
TEST_ERROR
/* Attempt to find existant record in leaf of level-2 B-tree */
idx = 555;
- if(H5B2_find(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &idx, find_cb, &idx) != TRUE)
+ if(H5B2_find(bt2, dxpl, &idx, find_cb, &idx) != TRUE)
FAIL_STACK_ERROR
/* Check with B-tree */
- record = 555;
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 0)
+ if(check_node_depth(bt2, dxpl, (hsize_t)555, (unsigned)0) < 0)
TEST_ERROR
/* Attempt to index non-existant record in level-2 B-tree */
idx = 0;
H5E_BEGIN_TRY {
- ret = H5B2_index(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, H5_ITER_INC, (hsize_t)(INSERT_SPLIT_ROOT_NREC * 30), find_cb, NULL);
+ ret = H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)(INSERT_SPLIT_ROOT_NREC * 30), find_cb, NULL);
} H5E_END_TRY;
/* Should fail */
if(ret != FAIL)
@@ -1322,19 +1540,24 @@ test_insert_make_level2(hid_t fapl)
/* Attempt to index existing record in root of level-2 B-tree */
idx = 948;
- if(H5B2_index(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, H5_ITER_INC, (hsize_t)948, find_cb, &idx) < 0)
+ if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)948, find_cb, &idx) < 0)
FAIL_STACK_ERROR
/* Attempt to index existing record in internal node of level-2 B-tree */
idx = 505;
- if(H5B2_index(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, H5_ITER_INC, (hsize_t)505, find_cb, &idx) < 0)
+ if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)505, find_cb, &idx) < 0)
FAIL_STACK_ERROR
/* Attempt to index existing record in leaf of level-2 B-tree */
idx = 555;
- if(H5B2_index(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, H5_ITER_INC, (hsize_t)555, find_cb, &idx) < 0)
+ if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)555, find_cb, &idx) < 0)
FAIL_STACK_ERROR
+ /* Close the v2 B-tree */
+ if(H5B2_close(bt2, dxpl) < 0)
+ FAIL_STACK_ERROR
+ bt2 = NULL;
+
/* Close file */
if(H5Fclose(file) < 0)
FAIL_STACK_ERROR
@@ -1345,6 +1568,8 @@ test_insert_make_level2(hid_t fapl)
error:
H5E_BEGIN_TRY {
+ if(bt2)
+ H5B2_close(bt2, dxpl);
H5Fclose(file);
} H5E_END_TRY;
return 1;
@@ -1368,128 +1593,96 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_insert_level2_leaf_redistrib(hid_t fapl)
+test_insert_level2_leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam,
+ const bt2_test_param_t *tparam)
{
- hid_t file=-1;
- char filename[1024];
- H5F_t *f=NULL;
- hsize_t record; /* Record to insert into tree */
+ hid_t file = -1; /* File ID */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */
+ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
haddr_t bt2_addr; /* Address of B-tree created */
+ hsize_t record; /* Record to insert into tree */
H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
- int rec_depth; /* Depth of record in B-tree */
hsize_t idx; /* Index within B-tree, for iterator */
unsigned u; /* Local index variable */
- h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
-
- /* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- STACK_ERROR
-
- /* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
- STACK_ERROR
-
/*
* Test inserting many records into v2 B-tree
*/
TESTING("B-tree insert: redistrib right-most leaf in level 2 B-tree");
- /*
- * Create v2 B-tree
- */
- if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, 512, 8, 100, 40, &bt2_addr/*out*/) < 0)
- FAIL_STACK_ERROR
+ /* Create the file for the test */
+ if(create_file(&file, &f, fapl) < 0)
+ TEST_ERROR
+
+ /* Create the v2 B-tree & get its address */
+ if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0)
+ TEST_ERROR
/* Insert enough records to force root to split into 2 internal nodes */
/* And fill rightmost leaf */
for(u = 0; u < (INSERT_SPLIT_ROOT_NREC * 8); u++) {
record = u + (INSERT_SPLIT_ROOT_NREC / 2) + 1;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
for(; u < ((INSERT_SPLIT_ROOT_NREC * 29) + (INSERT_SPLIT_ROOT_NREC / 2)); u++) {
record = u + INSERT_SPLIT_ROOT_NREC + 1;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- if(H5B2_stat_info(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &bt2_stat) < 0)
- FAIL_STACK_ERROR
- if(bt2_stat.depth != 2)
+ bt2_stat.depth = 2;
+ bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC * 29) + (INSERT_SPLIT_ROOT_NREC / 2);
+ if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
- if(bt2_stat.nrecords != ((INSERT_SPLIT_ROOT_NREC * 29) + (INSERT_SPLIT_ROOT_NREC / 2)))
+ if(check_node_depth(bt2, dxpl, (hsize_t)1008, (unsigned)2) < 0)
TEST_ERROR
- record = 1008; /* Record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 2)
+ if(check_node_depth(bt2, dxpl, (hsize_t)1859, (unsigned)1) < 0)
TEST_ERROR
- record = 1859; /* Right-most record in right internal node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, (hsize_t)1921, (unsigned)0) < 0)
TEST_ERROR
- record = 1921; /* Right-most record in right-most leaf */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 0)
+
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Insert record to force redistribution of rightmost leaf */
record = u + INSERT_SPLIT_ROOT_NREC + 1;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
/* Check up on B-tree */
- if(H5B2_stat_info(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &bt2_stat) < 0)
- FAIL_STACK_ERROR
- if(bt2_stat.depth != 2)
+ bt2_stat.depth = 2;
+ bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC * 29) + (INSERT_SPLIT_ROOT_NREC / 2) + 1;
+ if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
- if(bt2_stat.nrecords != ((INSERT_SPLIT_ROOT_NREC * 29) + (INSERT_SPLIT_ROOT_NREC / 2) + 1))
+ if(check_node_depth(bt2, dxpl, (hsize_t)1008, (unsigned)2) < 0)
TEST_ERROR
- record = 1008; /* Record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 2)
+ if(check_node_depth(bt2, dxpl, (hsize_t)1875, (unsigned)1) < 0)
TEST_ERROR
- record = 1875; /* Right-most record in right internal node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
- TEST_ERROR
- record = 1922; /* Right-most record in right-most leaf */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 0)
+ if(check_node_depth(bt2, dxpl, (hsize_t)1922, (unsigned)0) < 0)
TEST_ERROR
PASSED();
TESTING("B-tree insert: redistrib left-most leaf in level 2 B-tree");
- /* Check up on B-tree */
- if(H5B2_stat_info(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &bt2_stat) < 0)
- FAIL_STACK_ERROR
- if(bt2_stat.depth != 2)
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
- if(bt2_stat.nrecords != ((INSERT_SPLIT_ROOT_NREC * 29) + (INSERT_SPLIT_ROOT_NREC / 2) + 1))
+
+ /* Check up on B-tree */
+ bt2_stat.depth = 2;
+ bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC * 29) + (INSERT_SPLIT_ROOT_NREC / 2) + 1;
+ if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
- record = 1008; /* Record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 2)
+ if(check_node_depth(bt2, dxpl, (hsize_t)1008, (unsigned)2) < 0)
TEST_ERROR
- record = 94; /* Left-most record in left internal node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, (hsize_t)94, (unsigned)1) < 0)
TEST_ERROR
- record = 32; /* Left-most record in left-most leaf */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 0)
+ if(check_node_depth(bt2, dxpl, (hsize_t)32, (unsigned)0) < 0)
TEST_ERROR
/* Add more records to left-most leaf, to force a 2->1 split and then a
@@ -1497,109 +1690,83 @@ test_insert_level2_leaf_redistrib(hid_t fapl)
*/
for(u = 0; u < (INSERT_SPLIT_ROOT_NREC / 2) + 1; u++) {
record = u;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- if(H5B2_stat_info(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &bt2_stat) < 0)
- FAIL_STACK_ERROR
- if(bt2_stat.depth != 2)
+ bt2_stat.depth = 2;
+ bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC * 30) + 1;
+ if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
- if(bt2_stat.nrecords != ((INSERT_SPLIT_ROOT_NREC * 30) + 1))
+ if(check_node_depth(bt2, dxpl, (hsize_t)1008, (unsigned)2) < 0)
TEST_ERROR
- record = 1008; /* Record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 2)
+ if(check_node_depth(bt2, dxpl, (hsize_t)47, (unsigned)1) < 0)
TEST_ERROR
- record = 47; /* Left-most record in left internal node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
- TEST_ERROR
- record = 0;
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 0)
+ if(check_node_depth(bt2, dxpl, (hsize_t)0, (unsigned)0) < 0)
TEST_ERROR
PASSED();
TESTING("B-tree insert: redistrib middle leaf in level 2 B-tree");
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
+ TEST_ERROR
+
/* Check up on B-tree */
- if(H5B2_stat_info(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &bt2_stat) < 0)
- FAIL_STACK_ERROR
- if(bt2_stat.depth != 2)
+ bt2_stat.depth = 2;
+ bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC * 30) + 1;
+ if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
- if(bt2_stat.nrecords != ((INSERT_SPLIT_ROOT_NREC * 30) + 1))
+ if(check_node_depth(bt2, dxpl, (hsize_t)1008, (unsigned)2) < 0) /* Record in root node */
TEST_ERROR
- record = 1008; /* Record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 2)
+ if(check_node_depth(bt2, dxpl, (hsize_t)535, (unsigned)1) < 0) /* Record in middle node before insertion point */
TEST_ERROR
- record = 535; /* Record in middle node before insertion point */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
- TEST_ERROR
- record = 630; /* Record in middle node after insertion point */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, (hsize_t)630, (unsigned)1) < 0) /* Record in middle node after insertion point */
TEST_ERROR
- record = 568; /* Record in leaf node just after insertion point */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 0)
+ if(check_node_depth(bt2, dxpl, (hsize_t)568, (unsigned)0) < 0) /* Record in leaf node just after insertion point */
TEST_ERROR
/* Add more records to middle leaf, to force a split and a 3 node redistribution on middle leaf */
for(u = 0; u < (INSERT_SPLIT_ROOT_NREC / 2) + 1; u++) {
record = u + (INSERT_SPLIT_ROOT_NREC * 8) + (INSERT_SPLIT_ROOT_NREC / 2) + 1;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- if(H5B2_stat_info(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &bt2_stat) < 0)
- FAIL_STACK_ERROR
- if(bt2_stat.depth != 2)
+ bt2_stat.depth = 2;
+ bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC * 30) + (INSERT_SPLIT_ROOT_NREC / 2) + 2;
+ if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
- if(bt2_stat.nrecords != ((INSERT_SPLIT_ROOT_NREC * 30) + (INSERT_SPLIT_ROOT_NREC / 2) + 2))
+ if(check_node_depth(bt2, dxpl, (hsize_t)1008, (unsigned)2) < 0) /* Record in root node */
TEST_ERROR
- record = 1008; /* Record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 2)
+ if(check_node_depth(bt2, dxpl, (hsize_t)524, (unsigned)1) < 0) /* Record in middle node before insertion point */
TEST_ERROR
- record = 524; /* Record in middle node before insertion point */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, (hsize_t)577, (unsigned)1) < 0) /* Record in middle node after insertion point */
TEST_ERROR
- record = 577; /* Record in middle node after insertion point */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, (hsize_t)568, (unsigned)0) < 0) /* Record in leaf node just after insertion point */
TEST_ERROR
- record = 568; /* Record in leaf node just after insertion point */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 0)
+
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Iterate over B-tree to check records have been inserted correctly */
idx = 0;
- if(H5B2_iterate(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, iter_cb, &idx) < 0)
+ if(H5B2_iterate(bt2, dxpl, iter_cb, &idx) < 0)
FAIL_STACK_ERROR
/* Make certain that the index is correct */
if(idx != ((INSERT_SPLIT_ROOT_NREC * 30) + (INSERT_SPLIT_ROOT_NREC / 2) + 2))
TEST_ERROR
+ /* Close the v2 B-tree */
+ if(H5B2_close(bt2, dxpl) < 0)
+ FAIL_STACK_ERROR
+ bt2 = NULL;
+
/* Close file */
if(H5Fclose(file) < 0)
STACK_ERROR
@@ -1610,6 +1777,8 @@ test_insert_level2_leaf_redistrib(hid_t fapl)
error:
H5E_BEGIN_TRY {
+ if(bt2)
+ H5B2_close(bt2, dxpl);
H5Fclose(file);
} H5E_END_TRY;
return 1;
@@ -1633,248 +1802,204 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_insert_level2_leaf_split(hid_t fapl)
+test_insert_level2_leaf_split(hid_t fapl, const H5B2_create_t *cparam,
+ const bt2_test_param_t *tparam)
{
- hid_t file=-1;
- char filename[1024];
- H5F_t *f=NULL;
- hsize_t record; /* Record to insert into tree */
+ hid_t file = -1; /* File ID */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */
+ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
haddr_t bt2_addr; /* Address of B-tree created */
+ hsize_t record; /* Record to insert into tree */
H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
- int rec_depth; /* Depth of record in B-tree */
hsize_t idx; /* Index within B-tree, for iterator */
unsigned u; /* Local index variable */
- h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
-
- /* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- STACK_ERROR
-
- /* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
- STACK_ERROR
-
/*
* Test inserting many records into v2 B-tree
*/
TESTING("B-tree insert: split right-most leaf in level 2 B-tree");
- /*
- * Create v2 B-tree
- */
- if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, 512, 8, 100, 40, &bt2_addr/*out*/) < 0)
- FAIL_STACK_ERROR
+ /* Create the file for the test */
+ if(create_file(&file, &f, fapl) < 0)
+ TEST_ERROR
+
+ /* Create the v2 B-tree & get its address */
+ if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0)
+ TEST_ERROR
/* Insert enough records to force root to split into 2 internal nodes */
for(u = 0; u < (INSERT_SPLIT_ROOT_NREC * 8); u++) {
record = u + 1;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
for(; u < ((INSERT_SPLIT_ROOT_NREC * 29) + (INSERT_SPLIT_ROOT_NREC / 2)); u++) {
record = u + 2;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- if(H5B2_stat_info(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &bt2_stat) < 0)
- FAIL_STACK_ERROR
- if(bt2_stat.depth != 2)
- TEST_ERROR
- if(bt2_stat.nrecords != ((INSERT_SPLIT_ROOT_NREC * 29) + (INSERT_SPLIT_ROOT_NREC / 2)))
+ bt2_stat.depth = 2;
+ bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC * 29) + (INSERT_SPLIT_ROOT_NREC / 2);
+ if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = 946; /* Record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 2)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
TEST_ERROR
record = 1797; /* Right-most record in right internal node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
record = 1859; /* Right-most record in right-most leaf */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 0)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0)
+ TEST_ERROR
+
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Insert enough records to force right-most leaf to split */
for(u = 0; u < ((INSERT_SPLIT_ROOT_NREC / 2) + 1); u++) {
record = u + (INSERT_SPLIT_ROOT_NREC * 29) + (INSERT_SPLIT_ROOT_NREC / 2) + 2;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- if(H5B2_stat_info(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &bt2_stat) < 0)
- FAIL_STACK_ERROR
- if(bt2_stat.depth != 2)
- TEST_ERROR
- if(bt2_stat.nrecords != (INSERT_SPLIT_ROOT_NREC * 30))
+ bt2_stat.depth = 2;
+ bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC * 30;
+ if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = 946; /* Record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 2)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
TEST_ERROR
record = 1828; /* Next-to-right-most record in right-most internal node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
record = 1860; /* Right-most record in right-most internal node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
record = 1891; /* Right-most record in right-most leaf */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 0)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0)
TEST_ERROR
PASSED();
TESTING("B-tree insert: split left-most leaf in level 2 B-tree");
- /* Check up on B-tree */
- if(H5B2_stat_info(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &bt2_stat) < 0)
- FAIL_STACK_ERROR
- if(bt2_stat.depth != 2)
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
- if(bt2_stat.nrecords != (INSERT_SPLIT_ROOT_NREC * 30))
+
+ /* Check up on B-tree */
+ bt2_stat.depth = 2;
+ bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC * 30;
+ if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = 946; /* Record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 2)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
TEST_ERROR
record = 63; /* Left-most record in left-most internal node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
record = 1; /* Left-most record in left-most leaf */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 0)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0)
TEST_ERROR
/* Add another record to left-most leaf, to force a 1->2 node split on left leaf */
record = 0;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
/* Check up on B-tree */
- if(H5B2_stat_info(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &bt2_stat) < 0)
- FAIL_STACK_ERROR
- if(bt2_stat.depth != 2)
- TEST_ERROR
- if(bt2_stat.nrecords != ((INSERT_SPLIT_ROOT_NREC * 30) + 1))
+ bt2_stat.depth = 2;
+ bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC * 30) + 1;
+ if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = 946; /* Record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 2)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
TEST_ERROR
- record = 63; /* Next-to-left-most record in left internal node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ record = 63; /* Left-most record in left-most internal node */
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
record = 32; /* Left-most record in left internal node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
record = 0; /* Left-most record in left-most leaf */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 0)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0)
TEST_ERROR
PASSED();
TESTING("B-tree insert: split middle leaf in level 2 B-tree");
- /* Check up on B-tree */
- if(H5B2_stat_info(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &bt2_stat) < 0)
- FAIL_STACK_ERROR
- if(bt2_stat.depth != 2)
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
- if(bt2_stat.nrecords != ((INSERT_SPLIT_ROOT_NREC * 30) + 1))
+
+ /* Check up on B-tree */
+ bt2_stat.depth = 2;
+ bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC * 30) + 1;
+ if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = 946; /* Record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 2)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
TEST_ERROR
record = 504; /* Record in internal node just before insertion point */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
record = 568; /* Record in internal node just after insertion point */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
record = 506; /* Record in leaf node just after insertion point */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 0)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0)
TEST_ERROR
/* Add another record to middle leaf, to force a node split on middle leaf */
record = (INSERT_SPLIT_ROOT_NREC * 8) + 1;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
/* Check up on B-tree */
- if(H5B2_stat_info(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &bt2_stat) < 0)
- FAIL_STACK_ERROR
- if(bt2_stat.depth != 2)
- TEST_ERROR
- if(bt2_stat.nrecords != ((INSERT_SPLIT_ROOT_NREC * 30) + 2))
+ bt2_stat.depth = 2;
+ bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC * 30) + 2;
+ if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = 946; /* Record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 2)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
TEST_ERROR
record = 504; /* Left-most record of split in left internal node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
record = 537; /* Middle record of split in left internal node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
record = 568; /* Right-most record of split in left internal node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
record = 506; /* Record in leaf node just after insertion point */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 0)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0)
+ TEST_ERROR
+
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Iterate over B-tree to check records have been inserted correctly */
idx = 0;
- if(H5B2_iterate(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, iter_cb, &idx) < 0)
+ if(H5B2_iterate(bt2, dxpl, iter_cb, &idx) < 0)
FAIL_STACK_ERROR
/* Make certain that the index is correct */
if(idx != ((INSERT_SPLIT_ROOT_NREC * 30) + 2))
TEST_ERROR
+ /* Close the v2 B-tree */
+ if(H5B2_close(bt2, dxpl) < 0)
+ FAIL_STACK_ERROR
+ bt2 = NULL;
+
/* Close file */
if(H5Fclose(file) < 0)
FAIL_STACK_ERROR
@@ -1885,6 +2010,8 @@ test_insert_level2_leaf_split(hid_t fapl)
error:
H5E_BEGIN_TRY {
+ if(bt2)
+ H5B2_close(bt2, dxpl);
H5Fclose(file);
} H5E_END_TRY;
return 1;
@@ -1909,165 +2036,142 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_insert_level2_2internal_redistrib(hid_t fapl)
+test_insert_level2_2internal_redistrib(hid_t fapl, const H5B2_create_t *cparam,
+ const bt2_test_param_t *tparam)
{
- hid_t file=-1;
- char filename[1024];
- H5F_t *f=NULL;
- hsize_t record; /* Record to insert into tree */
+ hid_t file = -1; /* File ID */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */
+ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
haddr_t bt2_addr; /* Address of B-tree created */
+ hsize_t record; /* Record to insert into tree */
H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
- int rec_depth; /* Depth of record in B-tree */
hsize_t idx; /* Index within B-tree, for iterator */
unsigned u; /* Local index variable */
- h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
-
- /* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- STACK_ERROR
-
- /* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
- STACK_ERROR
-
/*
* Test inserting many records into v2 B-tree
*/
TESTING("B-tree insert: redist. 2 internal (r->l) in level 2 B-tree");
- /*
- * Create v2 B-tree
- */
- if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, 512, 8, 100, 40, &bt2_addr/*out*/) < 0)
- FAIL_STACK_ERROR
+ /* Create the file for the test */
+ if(create_file(&file, &f, fapl) < 0)
+ TEST_ERROR
+
+ /* Create the v2 B-tree & get its address */
+ if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0)
+ TEST_ERROR
/* Insert enough records to force root to split into 2 internal nodes */
/* And fill up right internal node, to just before to redistribute it */
for(u = 0; u < (INSERT_SPLIT_ROOT_NREC * 44); u++) {
record = u + (INSERT_SPLIT_ROOT_NREC * 6) - 4;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- if(H5B2_stat_info(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &bt2_stat) < 0)
- FAIL_STACK_ERROR
- if(bt2_stat.depth != 2)
- TEST_ERROR
- if(bt2_stat.nrecords != (INSERT_SPLIT_ROOT_NREC * 44))
+ bt2_stat.depth = 2;
+ bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC * 44;
+ if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = 1318; /* Record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 2)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
TEST_ERROR
record = 3114; /* Right-most record in right internal node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
record = 3145; /* Right-most record in right leaf node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 0)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0)
+ TEST_ERROR
+
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Insert record to redistribute right-most internal node */
record = u + (INSERT_SPLIT_ROOT_NREC * 6) - 4;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
/* Check up on B-tree */
- if(H5B2_stat_info(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &bt2_stat) < 0)
- FAIL_STACK_ERROR
- if(bt2_stat.depth != 2)
- TEST_ERROR
- if(bt2_stat.nrecords != ((INSERT_SPLIT_ROOT_NREC * 44) + 1))
+ bt2_stat.depth = 2;
+ bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC * 44 + 1;
+ if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = 1822; /* Record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 2)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
TEST_ERROR
record = 3114; /* Right-most record in right internal node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
record = 3146; /* Right-most record in right leaf node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 0)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0)
TEST_ERROR
PASSED();
TESTING("B-tree insert: redist. 2 internal (l->r) in level 2 B-tree");
- /* Check up on B-tree */
- if(H5B2_stat_info(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &bt2_stat) < 0)
- FAIL_STACK_ERROR
- if(bt2_stat.depth != 2)
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
- if(bt2_stat.nrecords != ((INSERT_SPLIT_ROOT_NREC * 44) + 1))
+
+ /* Check up on B-tree */
+ bt2_stat.depth = 2;
+ bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC * 44 + 1;
+ if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = 1822; /* Record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 2)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
TEST_ERROR
record = 436; /* Left-most record in left internal node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
record = 374; /* Left-most record in left leaf node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 0)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0)
TEST_ERROR
/* Force left-most internal node to redistribute */
for(u = 0; u < ((INSERT_SPLIT_ROOT_NREC * 6) - 4); u++) {
record = u;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- if(H5B2_stat_info(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &bt2_stat) < 0)
- FAIL_STACK_ERROR
- if(bt2_stat.depth != 2)
- TEST_ERROR
- if(bt2_stat.nrecords != ((INSERT_SPLIT_ROOT_NREC * 50) - 3))
+ bt2_stat.depth = 2;
+ bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC * 50) - 3;
+ if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = 1570; /* Record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 2)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
TEST_ERROR
record = 61; /* Left-most record in left internal node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
record = 0; /* Left-most record in left leaf node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 0)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0)
TEST_ERROR
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
+ TEST_ERROR
/* Iterate over B-tree to check records have been inserted correctly */
idx = 0;
- if(H5B2_iterate(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, iter_cb, &idx) < 0)
+ if(H5B2_iterate(bt2, dxpl, iter_cb, &idx) < 0)
FAIL_STACK_ERROR
/* Make certain that the index is correct */
if(idx != ((INSERT_SPLIT_ROOT_NREC * 50) - 3))
TEST_ERROR
+ /* Close the v2 B-tree */
+ if(H5B2_close(bt2, dxpl) < 0)
+ FAIL_STACK_ERROR
+ bt2 = NULL;
+
/* Close file */
if(H5Fclose(file) < 0)
TEST_ERROR
@@ -2078,6 +2182,8 @@ test_insert_level2_2internal_redistrib(hid_t fapl)
error:
H5E_BEGIN_TRY {
+ if(bt2)
+ H5B2_close(bt2, dxpl);
H5Fclose(file);
} H5E_END_TRY;
return 1;
@@ -2102,174 +2208,148 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_insert_level2_2internal_split(hid_t fapl)
+test_insert_level2_2internal_split(hid_t fapl, const H5B2_create_t *cparam,
+ const bt2_test_param_t *tparam)
{
- hid_t file=-1;
- char filename[1024];
- H5F_t *f=NULL;
- hsize_t record; /* Record to insert into tree */
+ hid_t file = -1; /* File ID */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */
+ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
haddr_t bt2_addr; /* Address of B-tree created */
+ hsize_t record; /* Record to insert into tree */
H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
- int rec_depth; /* Depth of record in B-tree */
hsize_t idx; /* Index within B-tree, for iterator */
unsigned u; /* Local index variable */
- h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
-
- /* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- STACK_ERROR
-
- /* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
- STACK_ERROR
-
/*
* Test inserting many records into v2 B-tree
*/
TESTING("B-tree insert: split side internal node to 2 in level 2 B-tree (r->l)");
- /*
- * Create v2 B-tree
- */
- if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, 512, 8, 100, 40, &bt2_addr/*out*/) < 0)
- FAIL_STACK_ERROR
+ /* Create the file for the test */
+ if(create_file(&file, &f, fapl) < 0)
+ TEST_ERROR
+
+ /* Create the v2 B-tree & get its address */
+ if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0)
+ TEST_ERROR
/* Insert enough records to force root to split into 2 internal nodes */
/* (And fill up two child internal nodes) */
for(u = 0; u < (INSERT_SPLIT_ROOT_NREC * 59); u++) {
record = u + (INSERT_SPLIT_ROOT_NREC * 14) - (INSERT_SPLIT_ROOT_NREC / 4) + 3;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- if(H5B2_stat_info(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &bt2_stat) < 0)
- FAIL_STACK_ERROR
- if(bt2_stat.depth != 2)
- TEST_ERROR
- if(bt2_stat.nrecords != (INSERT_SPLIT_ROOT_NREC * 59))
+ bt2_stat.depth = 2;
+ bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC * 59;
+ if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = 2759; /* Record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 2)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
TEST_ERROR
record = 4555; /* Right-most record in right internal node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
record = 4586; /* Right-most record in right leaf node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 0)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0)
+ TEST_ERROR
+
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Insert record to split right-most internal node */
record = u + (INSERT_SPLIT_ROOT_NREC * 14) - (INSERT_SPLIT_ROOT_NREC / 4) + 3;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
/* Check up on B-tree */
- if(H5B2_stat_info(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &bt2_stat) < 0)
- FAIL_STACK_ERROR
- if(bt2_stat.depth != 2)
- TEST_ERROR
- if(bt2_stat.nrecords != ((INSERT_SPLIT_ROOT_NREC * 59) + 1))
+ bt2_stat.depth = 2;
+ bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC * 59) + 1;
+ if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = 2759; /* Left record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 2)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
TEST_ERROR
record = 3704; /* Right record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 2)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
TEST_ERROR
record = 4555; /* Right-most record in right internal node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
record = 4387; /* Right-most record in right leaf node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 0)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0)
TEST_ERROR
PASSED();
TESTING("B-tree insert: split side internal node to 2 in level 2 B-tree (l->2)");
- /* Check up on B-tree */
- if(H5B2_stat_info(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &bt2_stat) < 0)
- FAIL_STACK_ERROR
- if(bt2_stat.depth != 2)
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
- if(bt2_stat.nrecords != ((INSERT_SPLIT_ROOT_NREC * 59) + 1))
+
+ /* Check up on B-tree */
+ bt2_stat.depth = 2;
+ bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC * 59) + 1;
+ if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = 2759; /* Left record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 2)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
TEST_ERROR
record = 932; /* Left-most record in left internal node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
record = 870; /* Left-most record in left leaf node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 0)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0)
TEST_ERROR
/* Force left-most internal node to split */
for(u = 0; u < ((INSERT_SPLIT_ROOT_NREC * 14) - (INSERT_SPLIT_ROOT_NREC / 4) + 3); u++) {
record = u;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- if(H5B2_stat_info(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &bt2_stat) < 0)
- FAIL_STACK_ERROR
- if(bt2_stat.depth != 2)
- TEST_ERROR
- if(bt2_stat.nrecords != ((INSERT_SPLIT_ROOT_NREC * 73) - (INSERT_SPLIT_ROOT_NREC / 4) + 4))
+ bt2_stat.depth = 2;
+ bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC * 73) - (INSERT_SPLIT_ROOT_NREC / 4) + 4;
+ if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = 870; /* Left record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 2)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
TEST_ERROR
record = 1814; /* Next-to-left-most record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 2)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
TEST_ERROR
record = 61; /* Left-most record in left internal node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
record = 0; /* Left-most record in left leaf node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 0)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0)
+ TEST_ERROR
+
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Iterate over B-tree to check records have been inserted correctly */
idx = 0;
- if(H5B2_iterate(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, iter_cb, &idx) < 0)
+ if(H5B2_iterate(bt2, dxpl, iter_cb, &idx) < 0)
FAIL_STACK_ERROR
/* Make certain that the index is correct */
if(idx != ((INSERT_SPLIT_ROOT_NREC * 73) - (INSERT_SPLIT_ROOT_NREC / 4) + 4))
TEST_ERROR
+ /* Close the v2 B-tree */
+ if(H5B2_close(bt2, dxpl) < 0)
+ FAIL_STACK_ERROR
+ bt2 = NULL;
+
/* Close file */
if(H5Fclose(file) < 0)
STACK_ERROR
@@ -2280,6 +2360,8 @@ test_insert_level2_2internal_split(hid_t fapl)
error:
H5E_BEGIN_TRY {
+ if(bt2)
+ H5B2_close(bt2, dxpl);
H5Fclose(file);
} H5E_END_TRY;
return 1;
@@ -2305,173 +2387,147 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_insert_level2_3internal_redistrib(hid_t fapl)
+test_insert_level2_3internal_redistrib(hid_t fapl, const H5B2_create_t *cparam,
+ const bt2_test_param_t *tparam)
{
- hid_t file=-1;
- char filename[1024];
- H5F_t *f=NULL;
- hsize_t record; /* Record to insert into tree */
+ hid_t file = -1; /* File ID */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */
+ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
haddr_t bt2_addr; /* Address of B-tree created */
+ hsize_t record; /* Record to insert into tree */
H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
- int rec_depth; /* Depth of record in B-tree */
hsize_t idx; /* Index within B-tree, for iterator */
unsigned u; /* Local index variable */
- h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
-
- /* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- STACK_ERROR
-
- /* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
- STACK_ERROR
-
/*
* Test inserting many records into v2 B-tree
*/
TESTING("B-tree insert: redistrib 3 internals in level 2 B-tree");
- /*
- * Create v2 B-tree
- */
- if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, 512, 8, 100, 40, &bt2_addr/*out*/) < 0)
- FAIL_STACK_ERROR
+ /* Create the file for the test */
+ if(create_file(&file, &f, fapl) < 0)
+ TEST_ERROR
+
+ /* Create the v2 B-tree & get its address */
+ if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0)
+ TEST_ERROR
/* Insert enough records to force root to split into 3 internal nodes */
for(u = 0; u < (INSERT_SPLIT_ROOT_NREC * 36); u++) {
record = u;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
for(; u < ((INSERT_SPLIT_ROOT_NREC * 59) + 1); u++) {
record = u + (INSERT_SPLIT_ROOT_NREC * 13) + ((3 * INSERT_SPLIT_ROOT_NREC) / 4) + 3;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- if(H5B2_stat_info(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &bt2_stat) < 0)
- FAIL_STACK_ERROR
- if(bt2_stat.depth != 2)
- TEST_ERROR
- if(bt2_stat.nrecords != ((INSERT_SPLIT_ROOT_NREC * 59) + 1))
+ bt2_stat.depth = 2;
+ bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC * 59) + 1;
+ if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = 1889; /* Left record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 2)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
TEST_ERROR
record = 3703; /* Right record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 2)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
TEST_ERROR
record = 2267; /* Record to left of insertion point in middle internal node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
record = 3199; /* Record to right of insertion point in middle internal node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
record = 3137; /* Record just above insertion point in leaf node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 0)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0)
+ TEST_ERROR
+
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Insert records to fill up middle internal node */
for(u = 0; u < ((INSERT_SPLIT_ROOT_NREC * 13) + ((3 * INSERT_SPLIT_ROOT_NREC) / 4) + 2); u++) {
record = u + (INSERT_SPLIT_ROOT_NREC * 36);
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- if(H5B2_stat_info(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &bt2_stat) < 0)
- FAIL_STACK_ERROR
- if(bt2_stat.depth != 2)
- TEST_ERROR
- if(bt2_stat.nrecords != ((INSERT_SPLIT_ROOT_NREC * 72) + ((3 * INSERT_SPLIT_ROOT_NREC) / 4) + 3))
+ bt2_stat.depth = 2;
+ bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC * 72) + ((3 * INSERT_SPLIT_ROOT_NREC) / 4) + 3;
+ if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = 1889; /* Left record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 2)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
TEST_ERROR
record = 3703; /* Right record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 2)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
TEST_ERROR
record = 3104; /* Record to left of insertion point in middle internal node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
record = 3137; /* Record to right of insertion point in middle internal node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
record = 3135; /* Record just above insertion point in leaf node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 0)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0)
+ TEST_ERROR
+
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Insert another record, forcing the middle internal node to redistribute */
record = u + (INSERT_SPLIT_ROOT_NREC * 36);
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
/* Check up on B-tree */
- if(H5B2_stat_info(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &bt2_stat) < 0)
- FAIL_STACK_ERROR
- if(bt2_stat.depth != 2)
- TEST_ERROR
- if(bt2_stat.nrecords != ((INSERT_SPLIT_ROOT_NREC * 72) + ((3 * INSERT_SPLIT_ROOT_NREC) / 4) + 4))
+ bt2_stat.depth = 2;
+ bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC * 72) + ((3 * INSERT_SPLIT_ROOT_NREC) / 4) + 4;
+ if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = 1574; /* Left record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 2)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
TEST_ERROR
record = 3104; /* Right record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 2)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
TEST_ERROR
#ifdef NONE
record = 2862; /* Record to left of insertion point in right internal node (now) */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
#endif /* NONE */
record = 3137; /* Record to right of insertion point in right internal node (now) */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
record = 3135; /* Record just above insertion point in leaf node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 0)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0)
+ TEST_ERROR
+
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Iterate over B-tree to check records have been inserted correctly */
idx = 0;
- if(H5B2_iterate(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, iter_cb, &idx) < 0)
+ if(H5B2_iterate(bt2, dxpl, iter_cb, &idx) < 0)
FAIL_STACK_ERROR
/* Make certain that the index is correct */
if(idx != ((INSERT_SPLIT_ROOT_NREC * 72) + ((3 * INSERT_SPLIT_ROOT_NREC) / 4) + 4))
TEST_ERROR
+ /* Close the v2 B-tree */
+ if(H5B2_close(bt2, dxpl) < 0)
+ FAIL_STACK_ERROR
+ bt2 = NULL;
+
/* Close file */
if(H5Fclose(file) < 0)
STACK_ERROR
@@ -2482,6 +2538,8 @@ test_insert_level2_3internal_redistrib(hid_t fapl)
error:
H5E_BEGIN_TRY {
+ if(bt2)
+ H5B2_close(bt2, dxpl);
H5Fclose(file);
} H5E_END_TRY;
return 1;
@@ -2507,179 +2565,151 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_insert_level2_3internal_split(hid_t fapl)
+test_insert_level2_3internal_split(hid_t fapl, const H5B2_create_t *cparam,
+ const bt2_test_param_t *tparam)
{
- hid_t file=-1;
- char filename[1024];
- H5F_t *f=NULL;
- hsize_t record; /* Record to insert into tree */
+ hid_t file = -1; /* File ID */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */
+ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
haddr_t bt2_addr; /* Address of B-tree created */
+ hsize_t record; /* Record to insert into tree */
H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
- int rec_depth; /* Depth of record in B-tree */
hsize_t idx; /* Index within B-tree, for iterator */
unsigned u; /* Local index variable */
- h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
-
- /* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- STACK_ERROR
-
- /* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
- STACK_ERROR
-
/*
* Test inserting many records into v2 B-tree
*/
TESTING("B-tree insert: split 3 internals to 4 in level 2 B-tree");
- /*
- * Create v2 B-tree
- */
- if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, 512, 8, 100, 40, &bt2_addr/*out*/) < 0)
- FAIL_STACK_ERROR
+ /* Create the file for the test */
+ if(create_file(&file, &f, fapl) < 0)
+ TEST_ERROR
+
+ /* Create the v2 B-tree & get its address */
+ if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0)
+ TEST_ERROR
/* Insert enough records to force root to split into 3 internal nodes */
/* (and fill right internal node) */
for(u = 0; u < (INSERT_SPLIT_ROOT_NREC * 31); u++) {
record = u;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
for(; u < (INSERT_SPLIT_ROOT_NREC * 74); u++) {
record = u + ((INSERT_SPLIT_ROOT_NREC * 13) + ((3 * INSERT_SPLIT_ROOT_NREC) / 4) + 3);
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
- /* Check up on B-tree */
- if(H5B2_stat_info(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &bt2_stat) < 0)
- FAIL_STACK_ERROR
- if(bt2_stat.depth != 2)
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
- if(bt2_stat.nrecords != (INSERT_SPLIT_ROOT_NREC * 74))
+
+ /* Check up on B-tree */
+ bt2_stat.depth = 2;
+ bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC * 74;
+ if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = 1889; /* Left record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 2)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
TEST_ERROR
record = 3703; /* Right record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 2)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
TEST_ERROR
record = 1952; /* Record to left of insertion point in middle internal node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
record = 2884; /* Record to right of insertion point in middle internal node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
record = 2822; /* Record just after insertion point in leaf node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 0)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0)
TEST_ERROR
/* Insert records to fill up middle internal node */
for(u = 0; u < ((INSERT_SPLIT_ROOT_NREC * 13) + ((3 * INSERT_SPLIT_ROOT_NREC) / 4) + 2); u++) {
record = u + (INSERT_SPLIT_ROOT_NREC * 31);
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- if(H5B2_stat_info(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &bt2_stat) < 0)
- FAIL_STACK_ERROR
- if(bt2_stat.depth != 2)
- TEST_ERROR
- if(bt2_stat.nrecords != ((INSERT_SPLIT_ROOT_NREC * 87) + ((3 * INSERT_SPLIT_ROOT_NREC) / 4) + 2))
+ bt2_stat.depth = 2;
+ bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC * 87) + ((3 * INSERT_SPLIT_ROOT_NREC) / 4) + 2;
+ if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = 1889; /* Left record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 2)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
TEST_ERROR
record = 3703; /* Right record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 2)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
TEST_ERROR
record = 2789; /* Record to left of insertion point in middle internal node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
record = 2822; /* Record to right of insertion point in middle internal node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
record = 2823; /* Record just above insertion point in leaf node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 0)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0)
+ TEST_ERROR
+
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Insert record to split middle internal node */
record = u + (INSERT_SPLIT_ROOT_NREC * 31);
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
/* Check up on B-tree */
- if(H5B2_stat_info(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &bt2_stat) < 0)
- FAIL_STACK_ERROR
- if(bt2_stat.depth != 2)
- TEST_ERROR
- if(bt2_stat.nrecords != ((INSERT_SPLIT_ROOT_NREC * 87) + ((3 * INSERT_SPLIT_ROOT_NREC) / 4) + 3))
+ bt2_stat.depth = 2;
+ bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC * 87) + ((3 * INSERT_SPLIT_ROOT_NREC) / 4) + 3;
+ if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = 1889; /* Left record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 2)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
TEST_ERROR
record = 2789; /* Middle record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 2)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
TEST_ERROR
record = 3703; /* Right record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 2)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
TEST_ERROR
#ifdef NONE
record = 3049; /* Record to left of insertion point in middle internal node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
#endif /* NONE */
record = 2822; /* Record to right of insertion point in middle internal node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
- record = 2823; /* Record just after insertion point in leaf node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 0)
+ record = 2823; /* Record just above insertion point in leaf node */
+ if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0)
+ TEST_ERROR
+
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
/* Iterate over B-tree to check records have been inserted correctly */
idx = 0;
- if(H5B2_iterate(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, iter_cb, &idx) < 0)
+ if(H5B2_iterate(bt2, dxpl, iter_cb, &idx) < 0)
FAIL_STACK_ERROR
/* Make certain that the index is correct */
if(idx != ((INSERT_SPLIT_ROOT_NREC * 87) + ((3 * INSERT_SPLIT_ROOT_NREC) / 4) + 3))
TEST_ERROR
+ /* Close the v2 B-tree */
+ if(H5B2_close(bt2, dxpl) < 0)
+ FAIL_STACK_ERROR
+ bt2 = NULL;
+
/* Close file */
if(H5Fclose(file) < 0)
FAIL_STACK_ERROR
@@ -2690,6 +2720,8 @@ test_insert_level2_3internal_split(hid_t fapl)
error:
H5E_BEGIN_TRY {
+ if(bt2)
+ H5B2_close(bt2, dxpl);
H5Fclose(file);
} H5E_END_TRY;
return 1;
@@ -2712,13 +2744,16 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_insert_lots(hid_t fapl)
+test_insert_lots(hid_t fapl, const H5B2_create_t *cparam,
+ const bt2_test_param_t *tparam)
{
- hid_t file=-1;
- char filename[1024];
- H5F_t *f=NULL;
- hsize_t record; /* Record to insert into tree */
+ hid_t file = -1; /* File ID */
+ char filename[1024]; /* Filename to use */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */
+ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
haddr_t bt2_addr; /* Address of B-tree created */
+ hsize_t record; /* Record to insert into tree */
hsize_t idx; /* Index within B-tree, for iterator */
time_t curr_time; /* Current time, for seeding random number generator */
hsize_t *records; /* Record #'s for random insertion */
@@ -2743,22 +2778,23 @@ HDfprintf(stderr,"curr_time=%lu\n",(unsigned long)curr_time);
TESTING("B-tree insert: create random level 4 B-tree");
/* Allocate space for the records */
- if((records = (hsize_t *)HDmalloc(sizeof(hsize_t) * INSERT_MANY)) == NULL)
+ if(NULL == (records = (hsize_t *)HDmalloc(sizeof(hsize_t) * INSERT_MANY)))
TEST_ERROR
/* Initialize record #'s */
- for(u=0; u<INSERT_MANY; u++)
+ for(u = 0; u < INSERT_MANY; u++)
records[u] = u;
/* Shuffle record #'s */
- for(u=0; u<INSERT_MANY; u++) {
+ for(u = 0; u < INSERT_MANY; u++) {
swap_idx = ((unsigned)HDrandom() % (INSERT_MANY - u)) + u;
temp_rec = records[u];
records[u] = records[swap_idx];
records[swap_idx] = temp_rec;
} /* end for */
- h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
+ /* Set the filename to use for this test (dependent on fapl) */
+ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the file to work on */
if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
@@ -2766,29 +2802,30 @@ HDfprintf(stderr,"curr_time=%lu\n",(unsigned long)curr_time);
/* Get a pointer to the internal file object */
if(NULL == (f = (H5F_t *)H5I_object(file)))
- FAIL_STACK_ERROR
+ STACK_ERROR
- /*
- * Create v2 B-tree
- */
- if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, 512, 8, 100, 40, &bt2_addr/*out*/) < 0)
- FAIL_STACK_ERROR
+ /* Create the v2 B-tree & get its address */
+ if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0)
+ TEST_ERROR
/* Insert random records */
for(u = 0; u < INSERT_MANY; u++) {
record = records[u];
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- if(H5B2_stat_info(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &bt2_stat) < 0)
- FAIL_STACK_ERROR
- if(bt2_stat.depth != 4)
- TEST_ERROR
- if(bt2_stat.nrecords != INSERT_MANY)
+ bt2_stat.depth = 4;
+ bt2_stat.nrecords = INSERT_MANY;
+ if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
+ /* Close the v2 B-tree */
+ if(H5B2_close(bt2, dxpl) < 0)
+ FAIL_STACK_ERROR
+ bt2 = NULL;
+
/* Close file */
if(H5Fclose(file) < 0)
STACK_ERROR
@@ -2801,17 +2838,19 @@ HDfprintf(stderr,"curr_time=%lu\n",(unsigned long)curr_time);
if(NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
- /* Check up on B-tree after re-open */
- if(H5B2_stat_info(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &bt2_stat) < 0)
+ /* Re-open v2 B-tree */
+ if(NULL == (bt2 = H5B2_open(f, dxpl, bt2_addr)))
FAIL_STACK_ERROR
- if(bt2_stat.depth != 4)
- TEST_ERROR
- if(bt2_stat.nrecords != INSERT_MANY)
+
+ /* Check up on B-tree after re-open */
+ bt2_stat.depth = 4;
+ bt2_stat.nrecords = INSERT_MANY;
+ if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
/* Iterate over B-tree to check records have been inserted correctly */
idx = 0;
- if(H5B2_iterate(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, iter_cb, &idx) < 0)
+ if(H5B2_iterate(bt2, dxpl, iter_cb, &idx) < 0)
FAIL_STACK_ERROR
/* Make certain that the index is correct */
@@ -2821,7 +2860,7 @@ HDfprintf(stderr,"curr_time=%lu\n",(unsigned long)curr_time);
/* Attempt to find non-existant record in level-4 B-tree */
/* (Should not be found, but not fail) */
idx = INSERT_MANY * 2;
- if(H5B2_find(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &idx, find_cb, &idx) != FALSE)
+ if(H5B2_find(bt2, dxpl, &idx, find_cb, &idx) != FALSE)
TEST_ERROR
/* Find random records */
@@ -2830,19 +2869,19 @@ HDfprintf(stderr,"curr_time=%lu\n",(unsigned long)curr_time);
idx = (hsize_t)(HDrandom()%INSERT_MANY);
/* Attempt to find existant record in root of level-4 B-tree */
- if(H5B2_find(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &idx, find_cb, &idx) != TRUE)
+ if(H5B2_find(bt2, dxpl, &idx, find_cb, &idx) != TRUE)
FAIL_STACK_ERROR
} /* end for */
/* Attempt to index non-existant record in level-4 B-tree, in increasing & decreasing order */
H5E_BEGIN_TRY {
- ret = H5B2_index(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, H5_ITER_INC, (hsize_t)(INSERT_MANY*3), find_cb, NULL);
+ ret = H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)(INSERT_MANY*3), find_cb, NULL);
} H5E_END_TRY;
/* Should fail */
if(ret != FAIL)
TEST_ERROR
H5E_BEGIN_TRY {
- ret = H5B2_index(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, H5_ITER_DEC, (hsize_t)(INSERT_MANY*3), find_cb, NULL);
+ ret = H5B2_index(bt2, dxpl, H5_ITER_DEC, (hsize_t)(INSERT_MANY*3), find_cb, NULL);
} H5E_END_TRY;
/* Should fail */
if(ret != FAIL)
@@ -2855,12 +2894,12 @@ HDfprintf(stderr,"curr_time=%lu\n",(unsigned long)curr_time);
/* Attempt to find existant record in root of level-4 B-tree */
/* (in increasing order) */
- if(H5B2_index(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, H5_ITER_INC, idx, find_cb, &idx) < 0)
+ if(H5B2_index(bt2, dxpl, H5_ITER_INC, idx, find_cb, &idx) < 0)
FAIL_STACK_ERROR
/* Attempt to find existant record in root of level-4 B-tree */
/* (in decreasing order) */
- if(H5B2_index(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, H5_ITER_DEC, idx, find_dec_cb, &idx) < 0)
+ if(H5B2_index(bt2, dxpl, H5_ITER_DEC, idx, find_dec_cb, &idx) < 0)
FAIL_STACK_ERROR
} /* end for */
@@ -2868,22 +2907,31 @@ HDfprintf(stderr,"curr_time=%lu\n",(unsigned long)curr_time);
TESTING("B-tree insert: attempt duplicate record in level 4 B-tree");
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
+ TEST_ERROR
+
record = INSERT_MANY / 2;
H5E_BEGIN_TRY {
- ret = H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record);
+ ret = H5B2_insert(bt2, dxpl, &record);
} H5E_END_TRY;
/* Should fail */
if(ret != FAIL)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
if(nrec != INSERT_MANY)
TEST_ERROR
+ /* Close the v2 B-tree */
+ if(H5B2_close(bt2, dxpl) < 0)
+ FAIL_STACK_ERROR
+ bt2 = NULL;
+
/* Close file */
if(H5Fclose(file) < 0)
TEST_ERROR
@@ -2896,6 +2944,8 @@ HDfprintf(stderr,"curr_time=%lu\n",(unsigned long)curr_time);
error:
H5E_BEGIN_TRY {
+ if(bt2)
+ H5B2_close(bt2, dxpl);
H5Fclose(file);
} H5E_END_TRY;
HDfree(records);
@@ -2909,7 +2959,6 @@ error:
* Purpose: Basic tests for the B-tree v2 code
*
* Return: Success: 0
- *
* Failure: 1
*
* Programmer: Quincey Koziol
@@ -2918,39 +2967,33 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_remove_basic(hid_t fapl)
+test_remove_basic(hid_t fapl, const H5B2_create_t *cparam,
+ const bt2_test_param_t *tparam)
{
- hid_t file=-1;
- char filename[1024];
- H5F_t *f=NULL;
+ hid_t file = -1; /* File ID */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */
+ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
hsize_t record; /* Record to insert into tree */
hsize_t rrecord; /* Record to remove from tree */
hsize_t nrec; /* Number of records in B-tree */
- haddr_t bt2_addr; /* Address of B-tree created */
haddr_t root_addr; /* Address of root of B-tree created */
herr_t ret; /* Generic error return value */
- h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
-
- /* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- STACK_ERROR
-
- /* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
- STACK_ERROR
-
/* Record removal tests */
TESTING("B-tree remove: record from empty B-tree");
- /*
- * Test v2 B-tree creation
- */
- if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, 512, 8, 100, 40, &bt2_addr/*out*/) < 0)
- FAIL_STACK_ERROR
+ /* Create the file for the test */
+ if(create_file(&file, &f, fapl) < 0)
+ TEST_ERROR
+
+ /* Create the v2 B-tree & get its address */
+ if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0)
+ TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
@@ -2960,7 +3003,7 @@ test_remove_basic(hid_t fapl)
/* Attempt to remove a record from a B-tree with no records */
record = 0;
H5E_BEGIN_TRY {
- ret = H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, NULL, NULL);
+ ret = H5B2_remove(bt2, dxpl, &record, NULL, NULL);
} H5E_END_TRY;
/* Should fail */
if(ret != FAIL)
@@ -2970,13 +3013,17 @@ test_remove_basic(hid_t fapl)
TESTING("B-tree remove: non-existant record from 1 record B-tree");
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
+ TEST_ERROR
+
/* Insert one record into B-tree */
record = 42;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
@@ -2984,7 +3031,7 @@ test_remove_basic(hid_t fapl)
TEST_ERROR
/* Query the address of the root node in the B-tree */
- if(H5B2_get_root_addr_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &root_addr) < 0)
+ if(H5B2_get_root_addr_test(bt2, &root_addr) < 0)
FAIL_STACK_ERROR
/* Make certain that the address of the root node is defined */
@@ -2994,7 +3041,7 @@ test_remove_basic(hid_t fapl)
/* Attempt to remove a non-existant record from a B-tree with 1 record */
record = 0;
H5E_BEGIN_TRY {
- ret = H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, NULL, NULL);
+ ret = H5B2_remove(bt2, dxpl, &record, NULL, NULL);
} H5E_END_TRY;
/* Should fail */
if(ret != FAIL)
@@ -3004,9 +3051,14 @@ test_remove_basic(hid_t fapl)
/* Attempt to remove a record from a B-tree with 1 record */
TESTING("B-tree remove: existant record from 1 record B-tree");
+
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
+ TEST_ERROR
+
record = 42;
rrecord = 0;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord) < 0)
+ if(H5B2_remove(bt2, dxpl, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
@@ -3014,7 +3066,7 @@ test_remove_basic(hid_t fapl)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
@@ -3022,7 +3074,7 @@ test_remove_basic(hid_t fapl)
TEST_ERROR
/* Query the address of the root node in the B-tree */
- if(H5B2_get_root_addr_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &root_addr) < 0)
+ if(H5B2_get_root_addr_test(bt2, &root_addr) < 0)
FAIL_STACK_ERROR
/* Make certain that the root node has been freed */
@@ -3034,22 +3086,26 @@ test_remove_basic(hid_t fapl)
/* Attempt to insert records into B-tree which had records removed */
TESTING("B-tree remove: adding records to B-tree after removal");
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
+ TEST_ERROR
+
/* Insert several records into B-tree again */
- record=42;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ record = 42;
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
- record=34;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ record = 34;
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
- record=56;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ record = 56;
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
- record=38;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ record = 38;
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
@@ -3060,9 +3116,14 @@ test_remove_basic(hid_t fapl)
/* Attempt to remove a non-existant record from a level-0 B-tree with mult. record */
TESTING("B-tree remove: non-existant record from level-0 B-tree");
+
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
+ TEST_ERROR
+
record = 0;
H5E_BEGIN_TRY {
- ret = H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, NULL, NULL);
+ ret = H5B2_remove(bt2, dxpl, &record, NULL, NULL);
} H5E_END_TRY;
/* Should fail */
if(ret != FAIL)
@@ -3072,9 +3133,14 @@ test_remove_basic(hid_t fapl)
/* Attempt to remove a record from a level-0 B-tree with mult. record */
TESTING("B-tree remove: mult. existant records from level-0 B-tree");
+
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
+ TEST_ERROR
+
record = 42;
rrecord = 0;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord) < 0)
+ if(H5B2_remove(bt2, dxpl, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
@@ -3082,7 +3148,7 @@ test_remove_basic(hid_t fapl)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
@@ -3090,7 +3156,7 @@ test_remove_basic(hid_t fapl)
TEST_ERROR
/* Query the address of the root node in the B-tree */
- if(H5B2_get_root_addr_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &root_addr) < 0)
+ if(H5B2_get_root_addr_test(bt2, &root_addr) < 0)
FAIL_STACK_ERROR
/* Make certain that the root node has not been freed */
@@ -3099,7 +3165,7 @@ test_remove_basic(hid_t fapl)
record = 34;
rrecord = 0;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord) < 0)
+ if(H5B2_remove(bt2, dxpl, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
@@ -3107,7 +3173,7 @@ test_remove_basic(hid_t fapl)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
@@ -3115,7 +3181,7 @@ test_remove_basic(hid_t fapl)
TEST_ERROR
/* Query the address of the root node in the B-tree */
- if(H5B2_get_root_addr_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &root_addr) < 0)
+ if(H5B2_get_root_addr_test(bt2, &root_addr) < 0)
FAIL_STACK_ERROR
/* Make certain that the root node has not been freed */
@@ -3124,7 +3190,7 @@ test_remove_basic(hid_t fapl)
record = 56;
rrecord = 0;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord) < 0)
+ if(H5B2_remove(bt2, dxpl, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
@@ -3132,7 +3198,7 @@ test_remove_basic(hid_t fapl)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
@@ -3140,7 +3206,7 @@ test_remove_basic(hid_t fapl)
TEST_ERROR
/* Query the address of the root node in the B-tree */
- if(H5B2_get_root_addr_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &root_addr) < 0)
+ if(H5B2_get_root_addr_test(bt2, &root_addr) < 0)
FAIL_STACK_ERROR
/* Make certain that the root node has not been freed */
@@ -3149,7 +3215,7 @@ test_remove_basic(hid_t fapl)
record = 38;
rrecord = 0;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord) < 0)
+ if(H5B2_remove(bt2, dxpl, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
@@ -3157,7 +3223,7 @@ test_remove_basic(hid_t fapl)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
@@ -3165,13 +3231,18 @@ test_remove_basic(hid_t fapl)
TEST_ERROR
/* Query the address of the root node in the B-tree */
- if(H5B2_get_root_addr_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &root_addr) < 0)
+ if(H5B2_get_root_addr_test(bt2, &root_addr) < 0)
FAIL_STACK_ERROR
/* Make certain that the root node has been freed */
if(H5F_addr_defined(root_addr))
TEST_ERROR
+ /* Close the v2 B-tree */
+ if(H5B2_close(bt2, dxpl) < 0)
+ FAIL_STACK_ERROR
+ bt2 = NULL;
+
/* Close file */
if(H5Fclose(file) < 0)
FAIL_STACK_ERROR
@@ -3182,6 +3253,8 @@ test_remove_basic(hid_t fapl)
error:
H5E_BEGIN_TRY {
+ if(bt2)
+ H5B2_close(bt2, dxpl);
H5Fclose(file);
} H5E_END_TRY;
return 1;
@@ -3194,7 +3267,6 @@ error:
* Purpose: Basic tests for the B-tree v2 code
*
* Return: Success: 0
- *
* Failure: 1
*
* Programmer: Quincey Koziol
@@ -3203,48 +3275,41 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_remove_level1_noredistrib(hid_t fapl)
+test_remove_level1_noredistrib(hid_t fapl, const H5B2_create_t *cparam,
+ const bt2_test_param_t *tparam)
{
- hid_t file=-1;
- char filename[1024];
- H5F_t *f=NULL;
+ hid_t file = -1; /* File ID */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */
+ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
hsize_t record; /* Record to insert into tree */
hsize_t rrecord; /* Record to remove from tree */
hsize_t nrec; /* Number of records in B-tree */
- haddr_t bt2_addr; /* Address of B-tree created */
haddr_t root_addr; /* Address of root of B-tree created */
- int rec_depth; /* Depth of record in B-tree */
unsigned u; /* Local index variable */
herr_t ret; /* Generic error return value */
- h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
-
- /* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- STACK_ERROR
-
- /* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
- STACK_ERROR
-
/* B-tree record removal tests */
TESTING("B-tree remove: non-existant record from level-1 B-tree");
- /*
- * Test v2 B-tree creation
- */
- if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, 512, 8, 100, 40, &bt2_addr/*out*/) < 0)
- FAIL_STACK_ERROR
+ /* Create the file for the test */
+ if(create_file(&file, &f, fapl) < 0)
+ TEST_ERROR
+
+ /* Create the v2 B-tree & get its address */
+ if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0)
+ TEST_ERROR
/* Create level-1 B-tree with 3 leaves */
for(u = 0; u < (INSERT_SPLIT_ROOT_NREC * 2); u++) {
record = u;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
@@ -3252,7 +3317,7 @@ test_remove_level1_noredistrib(hid_t fapl)
TEST_ERROR
/* Query the address of the root node in the B-tree */
- if(H5B2_get_root_addr_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &root_addr) < 0)
+ if(H5B2_get_root_addr_test(bt2, &root_addr) < 0)
FAIL_STACK_ERROR
/* Make certain that the address of the root node is defined */
@@ -3262,14 +3327,14 @@ test_remove_level1_noredistrib(hid_t fapl)
/* Attempt to remove a non-existant record from a B-tree with 1 record */
record = (INSERT_SPLIT_ROOT_NREC * 2) + 1;
H5E_BEGIN_TRY {
- ret = H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, NULL, NULL);
+ ret = H5B2_remove(bt2, dxpl, &record, NULL, NULL);
} H5E_END_TRY;
/* Should fail */
if(ret != FAIL)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
@@ -3280,23 +3345,24 @@ test_remove_level1_noredistrib(hid_t fapl)
/* Attempt to remove a record from right leaf of a level-1 B-tree with noredistribution */
TESTING("B-tree remove: record from right leaf of level-1 B-tree");
+
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
+ TEST_ERROR
+
+ /* Check up on B-tree */
record = 62; /* Left record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
record = 94; /* Right record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
record = (INSERT_SPLIT_ROOT_NREC * 2) - 2;
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 0)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0)
TEST_ERROR
+
rrecord = 0;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord) < 0)
+ if(H5B2_remove(bt2, dxpl, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
@@ -3305,18 +3371,14 @@ test_remove_level1_noredistrib(hid_t fapl)
/* Make certain that the leaf nodes didn't redistribute */
record = 62; /* Left record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
record = 94; /* Right record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
@@ -3327,13 +3389,18 @@ test_remove_level1_noredistrib(hid_t fapl)
/* Attempt to remove a record from left leaf of a level-1 B-tree with noredistribution */
TESTING("B-tree remove: record from left leaf of level-1 B-tree");
+
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
+ TEST_ERROR
+
+ /* Check up on B-tree */
record = 0;
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 0)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0)
TEST_ERROR
+
rrecord = 1;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord) < 0)
+ if(H5B2_remove(bt2, dxpl, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
@@ -3342,18 +3409,14 @@ test_remove_level1_noredistrib(hid_t fapl)
/* Make certain that the leaf nodes didn't redistribute */
record = 62; /* Left record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
record = 94; /* Right record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
@@ -3364,13 +3427,18 @@ test_remove_level1_noredistrib(hid_t fapl)
/* Attempt to remove a record from middle leaf of a level-1 B-tree with noredistribution */
TESTING("B-tree remove: record from middle leaf of level-1 B-tree");
+
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
+ TEST_ERROR
+
+ /* Check up on B-tree */
record = INSERT_SPLIT_ROOT_NREC;
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 0)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0)
TEST_ERROR
+
rrecord = 0;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord) < 0)
+ if(H5B2_remove(bt2, dxpl, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
@@ -3379,32 +3447,37 @@ test_remove_level1_noredistrib(hid_t fapl)
/* Make certain that the leaf nodes didn't redistribute */
record = 62; /* Left record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
record = 94; /* Right record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
if(nrec != ((INSERT_SPLIT_ROOT_NREC * 2) - 3))
TEST_ERROR
- PASSED();
+ /* Close the v2 B-tree */
+ if(H5B2_close(bt2, dxpl) < 0)
+ FAIL_STACK_ERROR
+ bt2 = NULL;
- if (H5Fclose(file)<0) TEST_ERROR
+ /* Close file */
+ if(H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
+
+ PASSED();
return 0;
error:
H5E_BEGIN_TRY {
+ if(bt2)
+ H5B2_close(bt2, dxpl);
H5Fclose(file);
} H5E_END_TRY;
return 1;
@@ -3417,7 +3490,6 @@ error:
* Purpose: Basic tests for the B-tree v2 code
*
* Return: Success: 0
- *
* Failure: 1
*
* Programmer: Quincey Koziol
@@ -3426,59 +3498,48 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_remove_level1_redistrib(hid_t fapl)
+test_remove_level1_redistrib(hid_t fapl, const H5B2_create_t *cparam,
+ const bt2_test_param_t *tparam)
{
- hid_t file=-1;
- char filename[1024];
- H5F_t *f=NULL;
+ hid_t file = -1; /* File ID */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */
+ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
hsize_t record; /* Record to insert into tree */
hsize_t rrecord; /* Record to remove from tree */
hsize_t nrec; /* Number of records in B-tree */
- haddr_t bt2_addr; /* Address of B-tree created */
haddr_t root_addr; /* Address of root of B-tree created */
- int rec_depth; /* Depth of record in B-tree */
unsigned u; /* Local index variable */
- h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
-
- /* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- STACK_ERROR
-
- /* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
- STACK_ERROR
-
/* More complex record removals */
TESTING("B-tree remove: redistribute 2 leaves in level-1 B-tree (r->l)");
- /*
- * Test v2 B-tree creation
- */
- if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, 512, 8, 100, 40, &bt2_addr/*out*/) < 0)
- FAIL_STACK_ERROR
+ /* Create the file for the test */
+ if(create_file(&file, &f, fapl) < 0)
+ TEST_ERROR
+
+ /* Create the v2 B-tree & get its address */
+ if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0)
+ TEST_ERROR
/* Create level-1 B-tree with 3 leaves */
for(u = 0; u < (INSERT_SPLIT_ROOT_NREC * 2); u++) {
record = u;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check record values in root of B-tree */
record = 62; /* Left record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
record = 94; /* Right record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
@@ -3486,18 +3547,22 @@ test_remove_level1_redistrib(hid_t fapl)
TEST_ERROR
/* Query the address of the root node in the B-tree */
- if(H5B2_get_root_addr_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &root_addr) < 0)
+ if(H5B2_get_root_addr_test(bt2, &root_addr) < 0)
FAIL_STACK_ERROR
/* Make certain that the address of the root node is defined */
if(!H5F_addr_defined(root_addr))
TEST_ERROR
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
+ TEST_ERROR
+
/* Attempt to remove enough records from right leaf of a level-1 B-tree to force redistribution */
for(u = 0; u < 8; u++) {
record = (INSERT_SPLIT_ROOT_NREC * 2) - (u + 1);
rrecord = HSIZET_MAX;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord) < 0)
+ if(H5B2_remove(bt2, dxpl, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
@@ -3505,7 +3570,7 @@ test_remove_level1_redistrib(hid_t fapl)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
@@ -3515,24 +3580,25 @@ test_remove_level1_redistrib(hid_t fapl)
/* Check record values in root of B-tree */
record = 62; /* Left record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
record = 90; /* Right record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
PASSED();
/* Attempt to remove enough records from left leaf of a level-1 B-tree to force redistribution */
TESTING("B-tree remove: redistribute 2 leaves in level-1 B-tree (l->r)");
+
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
+ TEST_ERROR
+
for(u = 0; u < 39; u++) {
record = u;
rrecord = HSIZET_MAX;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord) < 0)
+ if(H5B2_remove(bt2, dxpl, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
@@ -3540,7 +3606,7 @@ test_remove_level1_redistrib(hid_t fapl)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
@@ -3550,24 +3616,25 @@ test_remove_level1_redistrib(hid_t fapl)
/* Check record values in root of B-tree */
record = 64; /* Left record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
record = 90; /* Right record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
PASSED();
/* Attempt to remove enough records from middle leaf of a level-1 B-tree to force redistribution */
TESTING("B-tree remove: redistribute 3 leaves in level-1 B-tree");
+
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
+ TEST_ERROR
+
for(u = 0; u < 2; u++) {
record = INSERT_SPLIT_ROOT_NREC + 2 + u;
rrecord = HSIZET_MAX;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord) < 0)
+ if(H5B2_remove(bt2, dxpl, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
@@ -3575,7 +3642,7 @@ test_remove_level1_redistrib(hid_t fapl)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
@@ -3585,16 +3652,17 @@ test_remove_level1_redistrib(hid_t fapl)
/* Check record values in root of B-tree */
record = 64; /* Left record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
record = 91; /* Right record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
+ /* Close the v2 B-tree */
+ if(H5B2_close(bt2, dxpl) < 0)
+ FAIL_STACK_ERROR
+ bt2 = NULL;
+
/* Close file */
if(H5Fclose(file) < 0)
TEST_ERROR
@@ -3605,6 +3673,8 @@ test_remove_level1_redistrib(hid_t fapl)
error:
H5E_BEGIN_TRY {
+ if(bt2)
+ H5B2_close(bt2, dxpl);
H5Fclose(file);
} H5E_END_TRY;
return 1;
@@ -3617,7 +3687,6 @@ error:
* Purpose: Basic tests for the B-tree v2 code
*
* Return: Success: 0
- *
* Failure: 1
*
* Programmer: Quincey Koziol
@@ -3626,61 +3695,50 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_remove_level1_2leaf_merge(hid_t fapl)
+test_remove_level1_2leaf_merge(hid_t fapl, const H5B2_create_t *cparam,
+ const bt2_test_param_t *tparam)
{
- hid_t file=-1;
- char filename[1024];
- H5F_t *f=NULL;
+ hid_t file = -1; /* File ID */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */
+ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
hsize_t record; /* Record to insert into tree */
hsize_t rrecord; /* Record to remove from tree */
hsize_t nrec; /* Number of records in B-tree */
- haddr_t bt2_addr; /* Address of B-tree created */
haddr_t root_addr; /* Address of root of B-tree created */
H5B2_node_info_test_t ninfo; /* B-tree node info */
- int rec_depth; /* Depth of record in B-tree */
unsigned u; /* Local index variable */
- h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
-
- /* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- STACK_ERROR
-
- /* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
- STACK_ERROR
-
TESTING("B-tree remove: merge 2 leaves to 1 in level-1 B-tree (r->l)");
- /*
- * Test v2 B-tree creation
- */
- if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, 512, 8, 100, 40, &bt2_addr/*out*/) < 0)
- FAIL_STACK_ERROR
+ /* Create the file for the test */
+ if(create_file(&file, &f, fapl) < 0)
+ TEST_ERROR
+
+ /* Create the v2 B-tree & get its address */
+ if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0)
+ TEST_ERROR
/* Create level-1 B-tree with 3 leaves */
for(u = 0; u < (INSERT_SPLIT_ROOT_NREC * 2); u++) {
record = u;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check record values in root of B-tree */
record = 62; /* Left record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
+ ninfo.depth = 1;
+ ninfo.nrec = 2;
record = 94; /* Right record in root node */
- if(H5B2_get_node_info_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, &ninfo) < 0)
- FAIL_STACK_ERROR
- if(ninfo.depth != 1)
- TEST_ERROR
- if(ninfo.nrec != 2)
+ if(check_node_info(bt2, dxpl, record, &ninfo) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
@@ -3688,18 +3746,22 @@ test_remove_level1_2leaf_merge(hid_t fapl)
TEST_ERROR
/* Query the address of the root node in the B-tree */
- if(H5B2_get_root_addr_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &root_addr) < 0)
+ if(H5B2_get_root_addr_test(bt2, &root_addr) < 0)
FAIL_STACK_ERROR
/* Make certain that the address of the root node is defined */
if(!H5F_addr_defined(root_addr))
TEST_ERROR
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
+ TEST_ERROR
+
/* Attempt to remove enough records from right leaf of a level-1 B-tree to force redistribution */
for(u = 0; u < (INSERT_SPLIT_ROOT_NREC / 4); u++) {
record = (INSERT_SPLIT_ROOT_NREC * 2) - (u + 1);
rrecord = HSIZET_MAX;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord) < 0)
+ if(H5B2_remove(bt2, dxpl, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
@@ -3707,7 +3769,7 @@ test_remove_level1_2leaf_merge(hid_t fapl)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
@@ -3716,12 +3778,10 @@ test_remove_level1_2leaf_merge(hid_t fapl)
} /* end for */
/* Check record values in root of B-tree */
+ ninfo.depth = 1;
+ ninfo.nrec = 1;
record = 62; /* Left record in root node */
- if(H5B2_get_node_info_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, &ninfo) < 0)
- FAIL_STACK_ERROR
- if(ninfo.depth != 1)
- TEST_ERROR
- if(ninfo.nrec != 1)
+ if(check_node_info(bt2, dxpl, record, &ninfo) < 0)
TEST_ERROR
PASSED();
@@ -3729,32 +3789,32 @@ test_remove_level1_2leaf_merge(hid_t fapl)
/* Attempt to remove enough records from left leaf of a level-1 B-tree to force redistribution */
TESTING("B-tree remove: merge 2 leaves to 1 in level-1 B-tree (l->r)");
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
+ TEST_ERROR
+
/* Fill B-tree back up */
for(u = 0; u < (INSERT_SPLIT_ROOT_NREC / 4); u++) {
record = (INSERT_SPLIT_ROOT_NREC * 2) - (u + 1);
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check record values in root of B-tree */
record = 62; /* Left record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
+ ninfo.depth = 1;
+ ninfo.nrec = 2;
record = 94; /* Right record in root node */
- if(H5B2_get_node_info_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, &ninfo) < 0)
- FAIL_STACK_ERROR
- if(ninfo.depth != 1)
- TEST_ERROR
- if(ninfo.nrec != 2)
+ if(check_node_info(bt2, dxpl, record, &ninfo) < 0)
TEST_ERROR
/* Remove records */
for(u = 0; u < ((3 * INSERT_SPLIT_ROOT_NREC) / 4) - 1; u++) {
record = u;
rrecord = HSIZET_MAX;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord) < 0)
+ if(H5B2_remove(bt2, dxpl, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
@@ -3762,7 +3822,7 @@ test_remove_level1_2leaf_merge(hid_t fapl)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
@@ -3771,14 +3831,17 @@ test_remove_level1_2leaf_merge(hid_t fapl)
} /* end for */
/* Check record values in root of B-tree */
+ ninfo.depth = 1;
+ ninfo.nrec = 1;
record = 94; /* Left record in root node */
- if(H5B2_get_node_info_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, &ninfo) < 0)
- FAIL_STACK_ERROR
- if(ninfo.depth != 1)
- TEST_ERROR
- if(ninfo.nrec != 1)
+ if(check_node_info(bt2, dxpl, record, &ninfo) < 0)
TEST_ERROR
+ /* Close the v2 B-tree */
+ if(H5B2_close(bt2, dxpl) < 0)
+ FAIL_STACK_ERROR
+ bt2 = NULL;
+
/* Close file */
if(H5Fclose(file) < 0)
TEST_ERROR
@@ -3789,6 +3852,8 @@ test_remove_level1_2leaf_merge(hid_t fapl)
error:
H5E_BEGIN_TRY {
+ if(bt2)
+ H5B2_close(bt2, dxpl);
H5Fclose(file);
} H5E_END_TRY;
return 1;
@@ -3801,7 +3866,6 @@ error:
* Purpose: Basic tests for the B-tree v2 code
*
* Return: Success: 0
- *
* Failure: 1
*
* Programmer: Quincey Koziol
@@ -3810,61 +3874,50 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_remove_level1_3leaf_merge(hid_t fapl)
+test_remove_level1_3leaf_merge(hid_t fapl, const H5B2_create_t *cparam,
+ const bt2_test_param_t *tparam)
{
- hid_t file=-1;
- char filename[1024];
- H5F_t *f=NULL;
+ hid_t file = -1; /* File ID */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */
+ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
hsize_t record; /* Record to insert into tree */
hsize_t rrecord; /* Record to remove from tree */
hsize_t nrec; /* Number of records in B-tree */
- haddr_t bt2_addr; /* Address of B-tree created */
haddr_t root_addr; /* Address of root of B-tree created */
- int rec_depth; /* Depth of record in B-tree */
H5B2_node_info_test_t ninfo; /* B-tree node info */
unsigned u; /* Local index variable */
- h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
-
- /* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- STACK_ERROR
-
- /* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
- STACK_ERROR
-
TESTING("B-tree remove: merge 3 leaves to 2 in level-1 B-tree");
- /*
- * v2 B-tree creation
- */
- if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, 512, 8, 100, 40, &bt2_addr/*out*/) < 0)
- FAIL_STACK_ERROR
+ /* Create the file for the test */
+ if(create_file(&file, &f, fapl) < 0)
+ TEST_ERROR
+
+ /* Create the v2 B-tree & get its address */
+ if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0)
+ TEST_ERROR
/* Create level-1 B-tree with 3 leaves */
for(u = 0; u < (INSERT_SPLIT_ROOT_NREC * 2); u++) {
record = u;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check record values in root of B-tree */
record = 62; /* Left record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
+ ninfo.depth = 1;
+ ninfo.nrec = 2;
record = 94; /* Right record in root node */
- if(H5B2_get_node_info_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, &ninfo) < 0)
- FAIL_STACK_ERROR
- if(ninfo.depth != 1)
- TEST_ERROR
- if(ninfo.nrec != 2)
+ if(check_node_info(bt2, dxpl, record, &ninfo) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
@@ -3872,18 +3925,22 @@ test_remove_level1_3leaf_merge(hid_t fapl)
TEST_ERROR
/* Query the address of the root node in the B-tree */
- if(H5B2_get_root_addr_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &root_addr) < 0)
+ if(H5B2_get_root_addr_test(bt2, &root_addr) < 0)
FAIL_STACK_ERROR
/* Make certain that the address of the root node is defined */
if(!H5F_addr_defined(root_addr))
TEST_ERROR
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
+ TEST_ERROR
+
/* Attempt to remove enough records from middle leaf of a level-1 B-tree to force merge */
for(u = 0; u < ((5 * INSERT_SPLIT_ROOT_NREC) / 6) - 1; u++) {
record = ((3 * INSERT_SPLIT_ROOT_NREC) / 2) - (u + 1);
rrecord = HSIZET_MAX;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord) < 0)
+ if(H5B2_remove(bt2, dxpl, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
@@ -3891,7 +3948,7 @@ test_remove_level1_3leaf_merge(hid_t fapl)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
@@ -3899,14 +3956,18 @@ test_remove_level1_3leaf_merge(hid_t fapl)
TEST_ERROR
} /* end for */
+ /* Check record values in root of B-tree */
+ ninfo.depth = 1;
+ ninfo.nrec = 1;
record = 37; /* Only record in root node */
- if(H5B2_get_node_info_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, &ninfo) < 0)
- FAIL_STACK_ERROR
- if(ninfo.depth != 1)
- TEST_ERROR
- if(ninfo.nrec != 1)
+ if(check_node_info(bt2, dxpl, record, &ninfo) < 0)
TEST_ERROR
+ /* Close the v2 B-tree */
+ if(H5B2_close(bt2, dxpl) < 0)
+ FAIL_STACK_ERROR
+ bt2 = NULL;
+
/* Close file */
if(H5Fclose(file) < 0)
TEST_ERROR
@@ -3917,6 +3978,8 @@ test_remove_level1_3leaf_merge(hid_t fapl)
error:
H5E_BEGIN_TRY {
+ if(bt2)
+ H5B2_close(bt2, dxpl);
H5Fclose(file);
} H5E_END_TRY;
return 1;
@@ -3929,7 +3992,6 @@ error:
* Purpose: Basic tests for the B-tree v2 code
*
* Return: Success: 0
- *
* Failure: 1
*
* Programmer: Quincey Koziol
@@ -3938,71 +4000,56 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_remove_level1_promote(hid_t fapl)
+test_remove_level1_promote(hid_t fapl, const H5B2_create_t *cparam,
+ const bt2_test_param_t *tparam)
{
- hid_t file=-1;
- char filename[1024];
- H5F_t *f=NULL;
+ hid_t file = -1; /* File ID */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */
+ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
hsize_t record; /* Record to insert into tree */
hsize_t rrecord; /* Record to remove from tree */
hsize_t nrec; /* Number of records in B-tree */
- haddr_t bt2_addr; /* Address of B-tree created */
haddr_t root_addr; /* Address of root of B-tree created */
- int rec_depth; /* Depth of record in B-tree */
H5B2_node_info_test_t ninfo; /* B-tree node info */
unsigned u; /* Local index variable */
- h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
-
- /* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- STACK_ERROR
-
- /* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
- STACK_ERROR
-
TESTING("B-tree remove: promote from right leaf of level-1 B-tree");
- /*
- * v2 B-tree creation
- */
- if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, 512, 8, 100, 40, &bt2_addr/*out*/) < 0)
- FAIL_STACK_ERROR
+ /* Create the file for the test */
+ if(create_file(&file, &f, fapl) < 0)
+ TEST_ERROR
+
+ /* Create the v2 B-tree & get its address */
+ if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0)
+ TEST_ERROR
/* Create level-1 B-tree with 5 leaves */
for(u = 0; u < (INSERT_SPLIT_ROOT_NREC * 4); u++) {
record = u;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check record values in root of B-tree */
record = 62; /* Left-most record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
record = 125; /* Center-Left record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
record = 188; /* Center-Right record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
+ ninfo.depth = 1;
+ ninfo.nrec = 4;
record = 220; /* Right-most record in root node */
- if(H5B2_get_node_info_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, &ninfo) < 0)
- FAIL_STACK_ERROR
- if(ninfo.depth != 1)
- TEST_ERROR
- if(ninfo.nrec != 4)
+ if(check_node_info(bt2, dxpl, record, &ninfo) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
@@ -4010,17 +4057,21 @@ test_remove_level1_promote(hid_t fapl)
TEST_ERROR
/* Query the address of the root node in the B-tree */
- if(H5B2_get_root_addr_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &root_addr) < 0)
+ if(H5B2_get_root_addr_test(bt2, &root_addr) < 0)
FAIL_STACK_ERROR
/* Make certain that the address of the root node is defined */
if(!H5F_addr_defined(root_addr))
TEST_ERROR
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
+ TEST_ERROR
+
/* Attempt to remove record from root node of a level-1 B-tree to force promotion from right leaf */
record = 220;
rrecord = HSIZET_MAX;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord) < 0)
+ if(H5B2_remove(bt2, dxpl, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
@@ -4029,30 +4080,22 @@ test_remove_level1_promote(hid_t fapl)
/* Check record values in root of B-tree */
record = 62; /* Left-most record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
record = 125; /* Center-Left record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
record = 188; /* Center-Right record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
+ ninfo.depth = 1;
+ ninfo.nrec = 4;
record = 221; /* Right-most record in root node */
- if(H5B2_get_node_info_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, &ninfo) < 0)
- FAIL_STACK_ERROR
- if(ninfo.depth != 1)
- TEST_ERROR
- if(ninfo.nrec != 4)
+ if(check_node_info(bt2, dxpl, record, &ninfo) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
@@ -4067,9 +4110,14 @@ test_remove_level1_promote(hid_t fapl)
* to promote a record from the node with more children. - QAK)
*/
TESTING("B-tree remove: promote from left leaf of level-1 B-tree");
+
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
+ TEST_ERROR
+
record = 62;
rrecord = HSIZET_MAX;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord) < 0)
+ if(H5B2_remove(bt2, dxpl, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
@@ -4078,30 +4126,22 @@ test_remove_level1_promote(hid_t fapl)
/* Check record values in root of B-tree */
record = 63; /* Left-most record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
record = 125; /* Center-Left record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
record = 188; /* Center-Right record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
+ ninfo.depth = 1;
+ ninfo.nrec = 4;
record = 221; /* Right-most record in root node */
- if(H5B2_get_node_info_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, &ninfo) < 0)
- FAIL_STACK_ERROR
- if(ninfo.depth != 1)
- TEST_ERROR
- if(ninfo.nrec != 4)
+ if(check_node_info(bt2, dxpl, record, &ninfo) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
@@ -4112,9 +4152,14 @@ test_remove_level1_promote(hid_t fapl)
/* Attempt to remove record from root node of a level-1 B-tree to force promotion from middle leaf */
TESTING("B-tree remove: promote from middle leaf of level-1 B-tree");
+
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
+ TEST_ERROR
+
record = 125;
rrecord = HSIZET_MAX;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord) < 0)
+ if(H5B2_remove(bt2, dxpl, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
@@ -4123,44 +4168,45 @@ test_remove_level1_promote(hid_t fapl)
/* Check record values in root of B-tree */
record = 63; /* Left-most record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
record = 126; /* Center-Left record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
record = 188; /* Center-Right record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
+ ninfo.depth = 1;
+ ninfo.nrec = 4;
record = 221; /* Right-most record in root node */
- if(H5B2_get_node_info_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, &ninfo) < 0)
- FAIL_STACK_ERROR
- if(ninfo.depth != 1)
- TEST_ERROR
- if(ninfo.nrec != 4)
+ if(check_node_info(bt2, dxpl, record, &ninfo) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
if(nrec != (INSERT_SPLIT_ROOT_NREC * 4) - 3)
TEST_ERROR
- PASSED();
+ /* Close the v2 B-tree */
+ if(H5B2_close(bt2, dxpl) < 0)
+ FAIL_STACK_ERROR
+ bt2 = NULL;
- if (H5Fclose(file)<0) TEST_ERROR
+ /* Close file */
+ if(H5Fclose(file) < 0)
+ TEST_ERROR
+
+ PASSED();
return 0;
error:
H5E_BEGIN_TRY {
+ if(bt2)
+ H5B2_close(bt2, dxpl);
H5Fclose(file);
} H5E_END_TRY;
return 1;
@@ -4173,7 +4219,6 @@ error:
* Purpose: Basic tests for the B-tree v2 code
*
* Return: Success: 0
- *
* Failure: 1
*
* Programmer: Quincey Koziol
@@ -4182,61 +4227,50 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_remove_level1_promote_2leaf_redistrib(hid_t fapl)
+test_remove_level1_promote_2leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam,
+ const bt2_test_param_t *tparam)
{
- hid_t file=-1;
- char filename[1024];
- H5F_t *f=NULL;
+ hid_t file = -1; /* File ID */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */
+ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
hsize_t record; /* Record to insert into tree */
hsize_t rrecord; /* Record to remove from tree */
hsize_t nrec; /* Number of records in B-tree */
- haddr_t bt2_addr; /* Address of B-tree created */
haddr_t root_addr; /* Address of root of B-tree created */
- int rec_depth; /* Depth of record in B-tree */
H5B2_node_info_test_t ninfo; /* B-tree node info */
unsigned u; /* Local index variable */
- h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
-
- /* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- STACK_ERROR
-
- /* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
- STACK_ERROR
-
TESTING("B-tree remove: promote from leaf of level-1 B-tree w/2 node redistrib");
- /*
- * v2 B-tree creation
- */
- if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, 512, 8, 100, 40, &bt2_addr/*out*/) < 0)
- FAIL_STACK_ERROR
+ /* Create the file for the test */
+ if(create_file(&file, &f, fapl) < 0)
+ TEST_ERROR
+
+ /* Create the v2 B-tree & get its address */
+ if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0)
+ TEST_ERROR
/* Create level-1 B-tree with 3 leaves */
for(u = 0; u < (INSERT_SPLIT_ROOT_NREC * 2); u++) {
record = u;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check record values in root of B-tree */
- record = 62; /* Left record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ record = 62; /* Left-most record in root node */
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
+ ninfo.depth = 1;
+ ninfo.nrec = 2;
record = 94; /* Right record in root node */
- if(H5B2_get_node_info_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, &ninfo) < 0)
- FAIL_STACK_ERROR
- if(ninfo.depth != 1)
- TEST_ERROR
- if(ninfo.nrec != 2)
+ if(check_node_info(bt2, dxpl, record, &ninfo) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
@@ -4244,20 +4278,24 @@ test_remove_level1_promote_2leaf_redistrib(hid_t fapl)
TEST_ERROR
/* Query the address of the root node in the B-tree */
- if(H5B2_get_root_addr_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &root_addr) < 0)
+ if(H5B2_get_root_addr_test(bt2, &root_addr) < 0)
FAIL_STACK_ERROR
/* Make certain that the address of the root node is defined */
if(!H5F_addr_defined(root_addr))
TEST_ERROR
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
+ TEST_ERROR
+
/* Attempt to remove record from root node of a level-1 B-tree to force promotion from right leaf */
/* Remove records from right leaf until its ready to redistribute */
for(u = 0; u < 7; u++) {
record = (INSERT_SPLIT_ROOT_NREC * 2) - (u + 1);
rrecord = HSIZET_MAX;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord) < 0)
+ if(H5B2_remove(bt2, dxpl, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
@@ -4265,7 +4303,7 @@ test_remove_level1_promote_2leaf_redistrib(hid_t fapl)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
@@ -4275,7 +4313,7 @@ test_remove_level1_promote_2leaf_redistrib(hid_t fapl)
record = 94;
rrecord = HSIZET_MAX;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord) < 0)
+ if(H5B2_remove(bt2, dxpl, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
@@ -4283,27 +4321,28 @@ test_remove_level1_promote_2leaf_redistrib(hid_t fapl)
TEST_ERROR
/* Check record values in root of B-tree */
- record = 62; /* Left record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ record = 62; /* Left-most record in root node */
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
+ ninfo.depth = 1;
+ ninfo.nrec = 2;
record = 90; /* Right record in root node */
- if(H5B2_get_node_info_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, &ninfo) < 0)
- FAIL_STACK_ERROR
- if(ninfo.depth != 1)
- TEST_ERROR
- if(ninfo.nrec != 2)
+ if(check_node_info(bt2, dxpl, record, &ninfo) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
if(nrec != (INSERT_SPLIT_ROOT_NREC * 2) - 8)
TEST_ERROR
+ /* Close the v2 B-tree */
+ if(H5B2_close(bt2, dxpl) < 0)
+ FAIL_STACK_ERROR
+ bt2 = NULL;
+
/* Close file */
if(H5Fclose(file) < 0)
TEST_ERROR
@@ -4314,6 +4353,8 @@ test_remove_level1_promote_2leaf_redistrib(hid_t fapl)
error:
H5E_BEGIN_TRY {
+ if(bt2)
+ H5B2_close(bt2, dxpl);
H5Fclose(file);
} H5E_END_TRY;
return 1;
@@ -4326,7 +4367,6 @@ error:
* Purpose: Basic tests for the B-tree v2 code
*
* Return: Success: 0
- *
* Failure: 1
*
* Programmer: Quincey Koziol
@@ -4335,61 +4375,50 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_remove_level1_promote_3leaf_redistrib(hid_t fapl)
+test_remove_level1_promote_3leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam,
+ const bt2_test_param_t *tparam)
{
- hid_t file=-1;
- char filename[1024];
- H5F_t *f=NULL;
+ hid_t file = -1; /* File ID */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */
+ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
hsize_t record; /* Record to insert into tree */
hsize_t rrecord; /* Record to remove from tree */
hsize_t nrec; /* Number of records in B-tree */
- haddr_t bt2_addr; /* Address of B-tree created */
haddr_t root_addr; /* Address of root of B-tree created */
- int rec_depth; /* Depth of record in B-tree */
H5B2_node_info_test_t ninfo; /* B-tree node info */
unsigned u; /* Local index variable */
- h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
-
- /* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- STACK_ERROR
-
- /* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
- STACK_ERROR
-
TESTING("B-tree remove: promote from leaf of level-1 B-tree w/3 node redistrib");
- /*
- * v2 B-tree creation
- */
- if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, 512, 8, 100, 40, &bt2_addr/*out*/) < 0)
- FAIL_STACK_ERROR
+ /* Create the file for the test */
+ if(create_file(&file, &f, fapl) < 0)
+ TEST_ERROR
+
+ /* Create the v2 B-tree & get its address */
+ if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0)
+ TEST_ERROR
/* Create level-1 B-tree with 3 leaves */
for(u = 0; u < (INSERT_SPLIT_ROOT_NREC * 2); u++) {
record = u;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check record values in root of B-tree */
- record = 62; /* Left record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ record = 62; /* Left-most record in root node */
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
+ ninfo.depth = 1;
+ ninfo.nrec = 2;
record = 94; /* Right record in root node */
- if(H5B2_get_node_info_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, &ninfo) < 0)
- FAIL_STACK_ERROR
- if(ninfo.depth != 1)
- TEST_ERROR
- if(ninfo.nrec != 2)
+ if(check_node_info(bt2, dxpl, record, &ninfo) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
@@ -4397,20 +4426,24 @@ test_remove_level1_promote_3leaf_redistrib(hid_t fapl)
TEST_ERROR
/* Query the address of the root node in the B-tree */
- if(H5B2_get_root_addr_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &root_addr) < 0)
+ if(H5B2_get_root_addr_test(bt2, &root_addr) < 0)
FAIL_STACK_ERROR
/* Make certain that the address of the root node is defined */
if(!H5F_addr_defined(root_addr))
TEST_ERROR
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
+ TEST_ERROR
+
/* Attempt to remove record from root node of a level-1 B-tree to force promotion from middle leaf */
/* Remove records from right leaf until its ready to redistribute */
for(u = 0; u < 7; u++) {
record = 63 + u;
rrecord = HSIZET_MAX;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord) < 0)
+ if(H5B2_remove(bt2, dxpl, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
@@ -4418,7 +4451,7 @@ test_remove_level1_promote_3leaf_redistrib(hid_t fapl)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
@@ -4428,7 +4461,7 @@ test_remove_level1_promote_3leaf_redistrib(hid_t fapl)
record = 62;
rrecord = HSIZET_MAX;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord) < 0)
+ if(H5B2_remove(bt2, dxpl, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
@@ -4437,26 +4470,27 @@ test_remove_level1_promote_3leaf_redistrib(hid_t fapl)
/* Check record values in root of B-tree */
record = 39; /* Left record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
+ ninfo.depth = 1;
+ ninfo.nrec = 2;
record = 86; /* Right record in root node */
- if(H5B2_get_node_info_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, &ninfo) < 0)
- FAIL_STACK_ERROR
- if(ninfo.depth != 1)
- TEST_ERROR
- if(ninfo.nrec != 2)
+ if(check_node_info(bt2, dxpl, record, &ninfo) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
if(nrec != (INSERT_SPLIT_ROOT_NREC * 2) - 8)
TEST_ERROR
+ /* Close the v2 B-tree */
+ if(H5B2_close(bt2, dxpl) < 0)
+ FAIL_STACK_ERROR
+ bt2 = NULL;
+
/* Close file */
if(H5Fclose(file) < 0)
TEST_ERROR
@@ -4467,6 +4501,8 @@ test_remove_level1_promote_3leaf_redistrib(hid_t fapl)
error:
H5E_BEGIN_TRY {
+ if(bt2)
+ H5B2_close(bt2, dxpl);
H5Fclose(file);
} H5E_END_TRY;
return 1;
@@ -4479,7 +4515,6 @@ error:
* Purpose: Basic tests for the B-tree v2 code
*
* Return: Success: 0
- *
* Failure: 1
*
* Programmer: Quincey Koziol
@@ -4488,61 +4523,50 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_remove_level1_promote_2leaf_merge(hid_t fapl)
+test_remove_level1_promote_2leaf_merge(hid_t fapl, const H5B2_create_t *cparam,
+ const bt2_test_param_t *tparam)
{
- hid_t file=-1;
- char filename[1024];
- H5F_t *f=NULL;
+ hid_t file = -1; /* File ID */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */
+ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
hsize_t record; /* Record to insert into tree */
hsize_t rrecord; /* Record to remove from tree */
hsize_t nrec; /* Number of records in B-tree */
- haddr_t bt2_addr; /* Address of B-tree created */
haddr_t root_addr; /* Address of root of B-tree created */
- int rec_depth; /* Depth of record in B-tree */
H5B2_node_info_test_t ninfo; /* B-tree node info */
unsigned u; /* Local index variable */
- h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
-
- /* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- STACK_ERROR
-
- /* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
- STACK_ERROR
-
TESTING("B-tree remove: promote from leaf of level-1 B-tree w/2->1 merge");
- /*
- * v2 B-tree creation
- */
- if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, 512, 8, 100, 40, &bt2_addr/*out*/) < 0)
- FAIL_STACK_ERROR
+ /* Create the file for the test */
+ if(create_file(&file, &f, fapl) < 0)
+ TEST_ERROR
+
+ /* Create the v2 B-tree & get its address */
+ if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0)
+ TEST_ERROR
/* Create level-1 B-tree with 3 leaves */
for(u = 0; u < (INSERT_SPLIT_ROOT_NREC * 2); u++) {
record = u;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check record values in root of B-tree */
- record = 62; /* Left record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ record = 62; /* Left-most record in root node */
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
+ ninfo.depth = 1;
+ ninfo.nrec = 2;
record = 94; /* Right record in root node */
- if(H5B2_get_node_info_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, &ninfo) < 0)
- FAIL_STACK_ERROR
- if(ninfo.depth != 1)
- TEST_ERROR
- if(ninfo.nrec != 2)
+ if(check_node_info(bt2, dxpl, record, &ninfo) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
@@ -4550,20 +4574,24 @@ test_remove_level1_promote_2leaf_merge(hid_t fapl)
TEST_ERROR
/* Query the address of the root node in the B-tree */
- if(H5B2_get_root_addr_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &root_addr) < 0)
+ if(H5B2_get_root_addr_test(bt2, &root_addr) < 0)
FAIL_STACK_ERROR
/* Make certain that the address of the root node is defined */
if(!H5F_addr_defined(root_addr))
TEST_ERROR
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
+ TEST_ERROR
+
/* Attempt to remove record from root node of a level-1 B-tree to force promotion from right leaf */
/* Remove records from right leaf until its ready to merge */
for(u = 0; u < 14; u++) {
record = (INSERT_SPLIT_ROOT_NREC * 2) - (u + 1);
rrecord = HSIZET_MAX;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord) < 0)
+ if(H5B2_remove(bt2, dxpl, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
@@ -4571,7 +4599,7 @@ test_remove_level1_promote_2leaf_merge(hid_t fapl)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
@@ -4581,7 +4609,7 @@ test_remove_level1_promote_2leaf_merge(hid_t fapl)
record = 87;
rrecord = HSIZET_MAX;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord) < 0)
+ if(H5B2_remove(bt2, dxpl, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
@@ -4589,22 +4617,25 @@ test_remove_level1_promote_2leaf_merge(hid_t fapl)
TEST_ERROR
/* Check record values in root of B-tree */
+ ninfo.depth = 1;
+ ninfo.nrec = 1;
record = 62; /* Middle record in root node */
- if(H5B2_get_node_info_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, &ninfo) < 0)
- FAIL_STACK_ERROR
- if(ninfo.depth != 1)
- TEST_ERROR
- if(ninfo.nrec != 1)
+ if(check_node_info(bt2, dxpl, record, &ninfo) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
if(nrec != (INSERT_SPLIT_ROOT_NREC * 2) - 15)
TEST_ERROR
+ /* Close the v2 B-tree */
+ if(H5B2_close(bt2, dxpl) < 0)
+ FAIL_STACK_ERROR
+ bt2 = NULL;
+
/* Close file */
if(H5Fclose(file) < 0)
TEST_ERROR
@@ -4615,6 +4646,8 @@ test_remove_level1_promote_2leaf_merge(hid_t fapl)
error:
H5E_BEGIN_TRY {
+ if(bt2)
+ H5B2_close(bt2, dxpl);
H5Fclose(file);
} H5E_END_TRY;
return 1;
@@ -4627,7 +4660,6 @@ error:
* Purpose: Basic tests for the B-tree v2 code
*
* Return: Success: 0
- *
* Failure: 1
*
* Programmer: Quincey Koziol
@@ -4636,61 +4668,50 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_remove_level1_promote_3leaf_merge(hid_t fapl)
+test_remove_level1_promote_3leaf_merge(hid_t fapl, const H5B2_create_t *cparam,
+ const bt2_test_param_t *tparam)
{
- hid_t file=-1;
- char filename[1024];
- H5F_t *f=NULL;
+ hid_t file = -1; /* File ID */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */
+ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
hsize_t record; /* Record to insert into tree */
hsize_t rrecord; /* Record to remove from tree */
hsize_t nrec; /* Number of records in B-tree */
- haddr_t bt2_addr; /* Address of B-tree created */
haddr_t root_addr; /* Address of root of B-tree created */
- int rec_depth; /* Depth of record in B-tree */
H5B2_node_info_test_t ninfo; /* B-tree node info */
unsigned u; /* Local index variable */
- h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
-
- /* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- STACK_ERROR
-
- /* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
- STACK_ERROR
-
TESTING("B-tree remove: promote from leaf of level-1 B-tree w/3->2 merge");
- /*
- * v2 B-tree creation
- */
- if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, 512, 8, 100, 40, &bt2_addr/*out*/) < 0)
- FAIL_STACK_ERROR
+ /* Create the file for the test */
+ if(create_file(&file, &f, fapl) < 0)
+ TEST_ERROR
+
+ /* Create the v2 B-tree & get its address */
+ if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0)
+ TEST_ERROR
/* Create level-2 B-tree with 3 leaves */
for(u = 0; u < (INSERT_SPLIT_ROOT_NREC * 2); u++) {
record = u;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check record values in root of B-tree */
- record = 62; /* Left record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 1)
+ record = 62; /* Left-most record in root node */
+ if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
TEST_ERROR
+ ninfo.depth = 1;
+ ninfo.nrec = 2;
record = 94; /* Right record in root node */
- if(H5B2_get_node_info_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, &ninfo) < 0)
- FAIL_STACK_ERROR
- if(ninfo.depth != 1)
- TEST_ERROR
- if(ninfo.nrec != 2)
+ if(check_node_info(bt2, dxpl, record, &ninfo) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
@@ -4698,20 +4719,24 @@ test_remove_level1_promote_3leaf_merge(hid_t fapl)
TEST_ERROR
/* Query the address of the root node in the B-tree */
- if(H5B2_get_root_addr_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &root_addr) < 0)
+ if(H5B2_get_root_addr_test(bt2, &root_addr) < 0)
FAIL_STACK_ERROR
/* Make certain that the address of the root node is defined */
if(!H5F_addr_defined(root_addr))
TEST_ERROR
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
+ TEST_ERROR
+
/* Attempt to remove record from root node of a level-1 B-tree to force promotion from middle leaf */
/* Remove records from middle leaf until it's ready to merge */
for(u = 0; u < 50; u++) {
record = ((3 * INSERT_SPLIT_ROOT_NREC) / 2) - (u + 1);
rrecord = HSIZET_MAX;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord) < 0)
+ if(H5B2_remove(bt2, dxpl, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
@@ -4719,7 +4744,7 @@ test_remove_level1_promote_3leaf_merge(hid_t fapl)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
@@ -4729,7 +4754,7 @@ test_remove_level1_promote_3leaf_merge(hid_t fapl)
record = 25;
rrecord = HSIZET_MAX;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord) < 0)
+ if(H5B2_remove(bt2, dxpl, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
@@ -4737,22 +4762,25 @@ test_remove_level1_promote_3leaf_merge(hid_t fapl)
TEST_ERROR
/* Check record values in root of B-tree */
+ ninfo.depth = 1;
+ ninfo.nrec = 1;
record = 37; /* Right record in root node */
- if(H5B2_get_node_info_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, &ninfo) < 0)
- FAIL_STACK_ERROR
- if(ninfo.depth != 1)
- TEST_ERROR
- if(ninfo.nrec != 1)
+ if(check_node_info(bt2, dxpl, record, &ninfo) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
if(nrec != (INSERT_SPLIT_ROOT_NREC * 2) - 51)
TEST_ERROR
+ /* Close the v2 B-tree */
+ if(H5B2_close(bt2, dxpl) < 0)
+ FAIL_STACK_ERROR
+ bt2 = NULL;
+
/* Close file */
if(H5Fclose(file) < 0)
TEST_ERROR
@@ -4763,6 +4791,8 @@ test_remove_level1_promote_3leaf_merge(hid_t fapl)
error:
H5E_BEGIN_TRY {
+ if(bt2)
+ H5B2_close(bt2, dxpl);
H5Fclose(file);
} H5E_END_TRY;
return 1;
@@ -4775,7 +4805,6 @@ error:
* Purpose: Basic tests for the B-tree v2 code
*
* Return: Success: 0
- *
* Failure: 1
*
* Programmer: Quincey Koziol
@@ -4784,55 +4813,47 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_remove_level1_collapse(hid_t fapl)
+test_remove_level1_collapse(hid_t fapl, const H5B2_create_t *cparam,
+ const bt2_test_param_t *tparam)
{
- hid_t file=-1;
- char filename[1024];
- H5F_t *f=NULL;
+ hid_t file = -1; /* File ID */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */
+ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
hsize_t record; /* Record to insert into tree */
hsize_t rrecord; /* Record to remove from tree */
hsize_t nrec; /* Number of records in B-tree */
- haddr_t bt2_addr; /* Address of B-tree created */
haddr_t root_addr; /* Address of root of B-tree created */
H5B2_node_info_test_t ninfo; /* B-tree node info */
unsigned u; /* Local index variable */
- h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
-
- /* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- STACK_ERROR
-
- /* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
- STACK_ERROR
-
TESTING("B-tree remove: collapse level-1 B-tree back to level-0");
- /*
- * v2 B-tree creation
- */
- if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, 512, 8, 100, 40, &bt2_addr/*out*/) < 0)
- FAIL_STACK_ERROR
+ /* Create the file for the test */
+ if(create_file(&file, &f, fapl) < 0)
+ TEST_ERROR
+
+ /* Create the v2 B-tree & get its address */
+ if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0)
+ TEST_ERROR
/* Create level-1 B-tree with 2 leaves */
for(u = 0; u < INSERT_SPLIT_ROOT_NREC; u++) {
record = u;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check record values in root of B-tree */
+ ninfo.depth = 1;
+ ninfo.nrec = 1;
record = 31; /* Middle record in root node */
- if(H5B2_get_node_info_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, &ninfo) < 0)
- FAIL_STACK_ERROR
- if(ninfo.depth != 1)
- TEST_ERROR
- if(ninfo.nrec != 1)
+ if(check_node_info(bt2, dxpl, record, &ninfo) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
@@ -4840,18 +4861,22 @@ test_remove_level1_collapse(hid_t fapl)
TEST_ERROR
/* Query the address of the root node in the B-tree */
- if(H5B2_get_root_addr_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &root_addr) < 0)
+ if(H5B2_get_root_addr_test(bt2, &root_addr) < 0)
FAIL_STACK_ERROR
/* Make certain that the address of the root node is defined */
if(!H5F_addr_defined(root_addr))
TEST_ERROR
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
+ TEST_ERROR
+
/* Attempt to remove records from B-tree to force a single leaf for the B-tree */
for(u = 0; u < 14; u++) {
record = INSERT_SPLIT_ROOT_NREC - (u + 1);
rrecord = HSIZET_MAX;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord) < 0)
+ if(H5B2_remove(bt2, dxpl, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
@@ -4859,7 +4884,7 @@ test_remove_level1_collapse(hid_t fapl)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
@@ -4868,16 +4893,14 @@ test_remove_level1_collapse(hid_t fapl)
} /* end for */
/* Check record values in root of B-tree */
+ ninfo.depth = 0;
+ ninfo.nrec = INSERT_SPLIT_ROOT_NREC - u;
record = 31; /* Middle record in root node */
- if(H5B2_get_node_info_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, &ninfo) < 0)
- FAIL_STACK_ERROR
- if(ninfo.depth != 0)
- TEST_ERROR
- if(ninfo.nrec != (INSERT_SPLIT_ROOT_NREC - u))
+ if(check_node_info(bt2, dxpl, record, &ninfo) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
@@ -4885,13 +4908,18 @@ test_remove_level1_collapse(hid_t fapl)
TEST_ERROR
/* Query the address of the root node in the B-tree */
- if(H5B2_get_root_addr_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &root_addr) < 0)
+ if(H5B2_get_root_addr_test(bt2, &root_addr) < 0)
FAIL_STACK_ERROR
/* Make certain that the address of the root node is defined */
if(!H5F_addr_defined(root_addr))
TEST_ERROR
+ /* Close the v2 B-tree */
+ if(H5B2_close(bt2, dxpl) < 0)
+ FAIL_STACK_ERROR
+ bt2 = NULL;
+
/* Close file */
if(H5Fclose(file) < 0)
TEST_ERROR
@@ -4902,6 +4930,8 @@ test_remove_level1_collapse(hid_t fapl)
error:
H5E_BEGIN_TRY {
+ if(bt2)
+ H5B2_close(bt2, dxpl);
H5Fclose(file);
} H5E_END_TRY;
return 1;
@@ -4914,7 +4944,6 @@ error:
* Purpose: Basic tests for the B-tree v2 code
*
* Return: Success: 0
- *
* Failure: 1
*
* Programmer: Quincey Koziol
@@ -4923,61 +4952,50 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_remove_level2_promote(hid_t fapl)
+test_remove_level2_promote(hid_t fapl, const H5B2_create_t *cparam,
+ const bt2_test_param_t *tparam)
{
- hid_t file=-1;
- char filename[1024];
- H5F_t *f=NULL;
+ hid_t file = -1; /* File ID */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */
+ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
hsize_t record; /* Record to insert into tree */
hsize_t rrecord; /* Record to remove from tree */
hsize_t nrec; /* Number of records in B-tree */
- haddr_t bt2_addr; /* Address of B-tree created */
haddr_t root_addr; /* Address of root of B-tree created */
- int rec_depth; /* Depth of record in B-tree */
H5B2_node_info_test_t ninfo; /* B-tree node info */
unsigned u; /* Local index variable */
- h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
-
- /* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- STACK_ERROR
-
- /* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
- STACK_ERROR
-
TESTING("B-tree remove: promote from right internal of level-2 B-tree");
- /*
- * v2 B-tree creation
- */
- if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, 512, 8, 100, 40, &bt2_addr/*out*/) < 0)
- FAIL_STACK_ERROR
+ /* Create the file for the test */
+ if(create_file(&file, &f, fapl) < 0)
+ TEST_ERROR
+
+ /* Create the v2 B-tree & get its address */
+ if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0)
+ TEST_ERROR
/* Create level-2 B-tree with 3 internal nodes */
for(u = 0; u < ((INSERT_SPLIT_ROOT_NREC * 59) + 1); u++) {
record = u;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check record values in root of B-tree */
record = 1889; /* Left record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 2)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
TEST_ERROR
+ ninfo.depth = 2;
+ ninfo.nrec = 2;
record = 2834; /* Right record in root node */
- if(H5B2_get_node_info_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, &ninfo) < 0)
- FAIL_STACK_ERROR
- if(ninfo.depth != 2)
- TEST_ERROR
- if(ninfo.nrec != 2)
+ if(check_node_info(bt2, dxpl, record, &ninfo) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
@@ -4985,26 +5003,28 @@ test_remove_level2_promote(hid_t fapl)
TEST_ERROR
/* Query the address of the root node in the B-tree */
- if(H5B2_get_root_addr_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &root_addr) < 0)
+ if(H5B2_get_root_addr_test(bt2, &root_addr) < 0)
FAIL_STACK_ERROR
/* Make certain that the address of the root node is defined */
if(!H5F_addr_defined(root_addr))
TEST_ERROR
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
+ TEST_ERROR
+
/* Check information about record in right internal node */
+ ninfo.depth = 1;
+ ninfo.nrec = 14;
record = 2960; /* Record in right internal node */
- if(H5B2_get_node_info_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, &ninfo) < 0)
- FAIL_STACK_ERROR
- if(ninfo.depth != 1)
- TEST_ERROR
- if(ninfo.nrec != 14)
+ if(check_node_info(bt2, dxpl, record, &ninfo) < 0)
TEST_ERROR
/* Attempt to remove record from right internal node of a level-2 B-tree to force promotion */
record = 2960;
rrecord = HSIZET_MAX;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord) < 0)
+ if(H5B2_remove(bt2, dxpl, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
@@ -5012,16 +5032,14 @@ test_remove_level2_promote(hid_t fapl)
TEST_ERROR
/* Check information about record promoted into right internal node */
+ ninfo.depth = 1;
+ ninfo.nrec = 14;
record = 2961; /* Record in right internal node */
- if(H5B2_get_node_info_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, &ninfo) < 0)
- FAIL_STACK_ERROR
- if(ninfo.depth != 1)
- TEST_ERROR
- if(ninfo.nrec != 14)
+ if(check_node_info(bt2, dxpl, record, &ninfo) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
@@ -5033,18 +5051,20 @@ test_remove_level2_promote(hid_t fapl)
/* Attempt to remove record from left internal node of a level-2 B-tree to force promotion */
TESTING("B-tree remove: promote from left internal of level-2 B-tree");
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
+ TEST_ERROR
+
/* Check information about record in left internal node */
+ ninfo.depth = 1;
+ ninfo.nrec = 29;
record = 1133; /* Record in left internal node */
- if(H5B2_get_node_info_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, &ninfo) < 0)
- FAIL_STACK_ERROR
- if(ninfo.depth != 1)
- TEST_ERROR
- if(ninfo.nrec != 29)
+ if(check_node_info(bt2, dxpl, record, &ninfo) < 0)
TEST_ERROR
record = 1133;
rrecord = HSIZET_MAX;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord) < 0)
+ if(H5B2_remove(bt2, dxpl, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
@@ -5052,16 +5072,14 @@ test_remove_level2_promote(hid_t fapl)
TEST_ERROR
/* Check information about record in left internal node */
+ ninfo.depth = 1;
+ ninfo.nrec = 29;
record = 1134; /* Record in left internal node */
- if(H5B2_get_node_info_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, &ninfo) < 0)
- FAIL_STACK_ERROR
- if(ninfo.depth != 1)
- TEST_ERROR
- if(ninfo.nrec != 29)
+ if(check_node_info(bt2, dxpl, record, &ninfo) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
@@ -5073,18 +5091,20 @@ test_remove_level2_promote(hid_t fapl)
/* Attempt to remove record from middle internal node of a level-2 B-tree to force promotion */
TESTING("B-tree remove: promote from middle internal of level-2 B-tree");
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
+ TEST_ERROR
+
/* Check information about record in middle internal node */
+ ninfo.depth = 1;
+ ninfo.nrec = 14;
record = 2267; /* Record in middle internal node */
- if(H5B2_get_node_info_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, &ninfo) < 0)
- FAIL_STACK_ERROR
- if(ninfo.depth != 1)
- TEST_ERROR
- if(ninfo.nrec != 14)
+ if(check_node_info(bt2, dxpl, record, &ninfo) < 0)
TEST_ERROR
record = 2267;
rrecord = HSIZET_MAX;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord) < 0)
+ if(H5B2_remove(bt2, dxpl, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
@@ -5092,16 +5112,14 @@ test_remove_level2_promote(hid_t fapl)
TEST_ERROR
/* Check information about record in middle internal node */
+ ninfo.depth = 1;
+ ninfo.nrec = 14;
record = 2268; /* Record in middle internal node */
- if(H5B2_get_node_info_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, &ninfo) < 0)
- FAIL_STACK_ERROR
- if(ninfo.depth != 1)
- TEST_ERROR
- if(ninfo.nrec != 14)
+ if(check_node_info(bt2, dxpl, record, &ninfo) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
@@ -5113,18 +5131,20 @@ test_remove_level2_promote(hid_t fapl)
/* Attempt to remove record from root node of a level-2 B-tree to force promotion */
TESTING("B-tree remove: promote record from root of level-2 B-tree");
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
+ TEST_ERROR
+
/* Check information about record in root node */
+ ninfo.depth = 2;
+ ninfo.nrec = 2;
record = 1889; /* Left record in root node */
- if(H5B2_get_node_info_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, &ninfo) < 0)
- FAIL_STACK_ERROR
- if(ninfo.depth != 2)
- TEST_ERROR
- if(ninfo.nrec != 2)
+ if(check_node_info(bt2, dxpl, record, &ninfo) < 0)
TEST_ERROR
record = 1889;
rrecord = HSIZET_MAX;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord) < 0)
+ if(H5B2_remove(bt2, dxpl, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
@@ -5132,34 +5152,34 @@ test_remove_level2_promote(hid_t fapl)
TEST_ERROR
/* Check information about record in root node */
+ ninfo.depth = 2;
+ ninfo.nrec = 2;
record = 1890; /* Left record in root node */
- if(H5B2_get_node_info_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, &ninfo) < 0)
- FAIL_STACK_ERROR
- if(ninfo.depth != 2)
- TEST_ERROR
- if(ninfo.nrec != 2)
+ if(check_node_info(bt2, dxpl, record, &ninfo) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
if(nrec != (INSERT_SPLIT_ROOT_NREC * 59) - 3)
TEST_ERROR
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
+ TEST_ERROR
+
/* Check information about record in root node */
+ ninfo.depth = 2;
+ ninfo.nrec = 2;
record = 2834; /* Right record in root node */
- if(H5B2_get_node_info_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, &ninfo) < 0)
- FAIL_STACK_ERROR
- if(ninfo.depth != 2)
- TEST_ERROR
- if(ninfo.nrec != 2)
+ if(check_node_info(bt2, dxpl, record, &ninfo) < 0)
TEST_ERROR
record = 2834;
rrecord = HSIZET_MAX;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord) < 0)
+ if(H5B2_remove(bt2, dxpl, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
@@ -5167,22 +5187,25 @@ test_remove_level2_promote(hid_t fapl)
TEST_ERROR
/* Check information about record in root node */
+ ninfo.depth = 2;
+ ninfo.nrec = 2;
record = 2835; /* Right record in root node */
- if(H5B2_get_node_info_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, &ninfo) < 0)
- FAIL_STACK_ERROR
- if(ninfo.depth != 2)
- TEST_ERROR
- if(ninfo.nrec != 2)
+ if(check_node_info(bt2, dxpl, record, &ninfo) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
if(nrec != (INSERT_SPLIT_ROOT_NREC * 59) - 4)
TEST_ERROR
+ /* Close the v2 B-tree */
+ if(H5B2_close(bt2, dxpl) < 0)
+ FAIL_STACK_ERROR
+ bt2 = NULL;
+
/* Close file */
if(H5Fclose(file) < 0)
TEST_ERROR
@@ -5193,6 +5216,8 @@ test_remove_level2_promote(hid_t fapl)
error:
H5E_BEGIN_TRY {
+ if(bt2)
+ H5B2_close(bt2, dxpl);
H5Fclose(file);
} H5E_END_TRY;
return 1;
@@ -5205,7 +5230,6 @@ error:
* Purpose: Basic tests for the B-tree v2 code
*
* Return: Success: 0
- *
* Failure: 1
*
* Programmer: Quincey Koziol
@@ -5214,61 +5238,50 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_remove_level2_promote_2internal_redistrib(hid_t fapl)
+test_remove_level2_promote_2internal_redistrib(hid_t fapl, const H5B2_create_t *cparam,
+ const bt2_test_param_t *tparam)
{
- hid_t file=-1;
- char filename[1024];
- H5F_t *f=NULL;
+ hid_t file = -1; /* File ID */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */
+ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
hsize_t record; /* Record to insert into tree */
hsize_t rrecord; /* Record to remove from tree */
hsize_t nrec; /* Number of records in B-tree */
- haddr_t bt2_addr; /* Address of B-tree created */
haddr_t root_addr; /* Address of root of B-tree created */
- int rec_depth; /* Depth of record in B-tree */
H5B2_node_info_test_t ninfo; /* B-tree node info */
unsigned u; /* Local index variable */
- h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
-
- /* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- STACK_ERROR
-
- /* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
- STACK_ERROR
-
TESTING("B-tree remove: promote from right internal of level-2 B-tree w/redistrib");
- /*
- * v2 B-tree creation
- */
- if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, 512, 8, 100, 40, &bt2_addr/*out*/) < 0)
- FAIL_STACK_ERROR
+ /* Create the file for the test */
+ if(create_file(&file, &f, fapl) < 0)
+ TEST_ERROR
+
+ /* Create the v2 B-tree & get its address */
+ if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0)
+ TEST_ERROR
/* Create level-2 B-tree with 3 internal nodes */
for(u = 0; u < ((INSERT_SPLIT_ROOT_NREC * 59) + 1); u++) {
record = u;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check record values in root of B-tree */
record = 1889; /* Left record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 2)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
TEST_ERROR
+ ninfo.depth = 2;
+ ninfo.nrec = 2;
record = 2834; /* Right record in root node */
- if(H5B2_get_node_info_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, &ninfo) < 0)
- FAIL_STACK_ERROR
- if(ninfo.depth != 2)
- TEST_ERROR
- if(ninfo.nrec != 2)
+ if(check_node_info(bt2, dxpl, record, &ninfo) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
@@ -5276,26 +5289,29 @@ test_remove_level2_promote_2internal_redistrib(hid_t fapl)
TEST_ERROR
/* Query the address of the root node in the B-tree */
- if(H5B2_get_root_addr_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &root_addr) < 0)
+ if(H5B2_get_root_addr_test(bt2, &root_addr) < 0)
FAIL_STACK_ERROR
/* Make certain that the address of the root node is defined */
if(!H5F_addr_defined(root_addr))
TEST_ERROR
- record = 3685; /* Right-most record in root node */
- if(H5B2_get_node_info_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, &ninfo) < 0)
- FAIL_STACK_ERROR
- if(ninfo.depth != 1)
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
- if(ninfo.nrec != 14)
+
+ /* Check status of B-tree */
+ ninfo.depth = 1;
+ ninfo.nrec = 14;
+ record = 3685; /* Right-most record in root node */
+ if(check_node_info(bt2, dxpl, record, &ninfo) < 0)
TEST_ERROR
/* Attempt to remove record from right internal node of a level-2 B-tree to force promotion w/redistribution */
for(u = 0; u < 8; u++) {
record = ((INSERT_SPLIT_ROOT_NREC * 59) + 1) - (u + 1);
rrecord = HSIZET_MAX;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord) < 0)
+ if(H5B2_remove(bt2, dxpl, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
@@ -5303,7 +5319,7 @@ test_remove_level2_promote_2internal_redistrib(hid_t fapl)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
@@ -5313,29 +5329,33 @@ test_remove_level2_promote_2internal_redistrib(hid_t fapl)
record = 3685;
rrecord = HSIZET_MAX;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord) < 0)
+ if(H5B2_remove(bt2, dxpl, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
if(rrecord != 3685)
TEST_ERROR
+ /* Check status of B-tree */
+ ninfo.depth = 1;
+ ninfo.nrec = 14;
record = 3681; /* Right-most record in root node */
- if(H5B2_get_node_info_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, &ninfo) < 0)
- FAIL_STACK_ERROR
- if(ninfo.depth != 1)
- TEST_ERROR
- if(ninfo.nrec != 14)
+ if(check_node_info(bt2, dxpl, record, &ninfo) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
if(nrec != (INSERT_SPLIT_ROOT_NREC * 59) - 8)
TEST_ERROR
+ /* Close the v2 B-tree */
+ if(H5B2_close(bt2, dxpl) < 0)
+ FAIL_STACK_ERROR
+ bt2 = NULL;
+
/* Close file */
if(H5Fclose(file) < 0)
TEST_ERROR
@@ -5346,6 +5366,8 @@ test_remove_level2_promote_2internal_redistrib(hid_t fapl)
error:
H5E_BEGIN_TRY {
+ if(bt2)
+ H5B2_close(bt2, dxpl);
H5Fclose(file);
} H5E_END_TRY;
return 1;
@@ -5358,7 +5380,6 @@ error:
* Purpose: Basic tests for the B-tree v2 code
*
* Return: Success: 0
- *
* Failure: 1
*
* Programmer: Quincey Koziol
@@ -5367,61 +5388,50 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_remove_level2_promote_3internal_redistrib(hid_t fapl)
+test_remove_level2_promote_3internal_redistrib(hid_t fapl, const H5B2_create_t *cparam,
+ const bt2_test_param_t *tparam)
{
- hid_t file=-1;
- char filename[1024];
- H5F_t *f=NULL;
+ hid_t file = -1; /* File ID */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */
+ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
hsize_t record; /* Record to insert into tree */
hsize_t rrecord; /* Record to remove from tree */
hsize_t nrec; /* Number of records in B-tree */
- haddr_t bt2_addr; /* Address of B-tree created */
haddr_t root_addr; /* Address of root of B-tree created */
- int rec_depth; /* Depth of record in B-tree */
H5B2_node_info_test_t ninfo; /* B-tree node info */
unsigned u; /* Local index variable */
- h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
-
- /* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- STACK_ERROR
-
- /* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
- STACK_ERROR
-
TESTING("B-tree remove: promote from left internal of level-2 B-tree w/redistrib");
- /*
- * v2 B-tree creation
- */
- if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, 512, 8, 100, 40, &bt2_addr/*out*/) < 0)
- FAIL_STACK_ERROR
+ /* Create the file for the test */
+ if(create_file(&file, &f, fapl) < 0)
+ TEST_ERROR
+
+ /* Create the v2 B-tree & get its address */
+ if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0)
+ TEST_ERROR
/* Create level-2 B-tree with 3 internal nodes */
for(u = 0; u < ((INSERT_SPLIT_ROOT_NREC * 59) + 1); u++) {
record = u;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check record values in root of B-tree */
record = 1889; /* Left record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 2)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
TEST_ERROR
+ ninfo.depth = 2;
+ ninfo.nrec = 2;
record = 2834; /* Right record in root node */
- if(H5B2_get_node_info_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, &ninfo) < 0)
- FAIL_STACK_ERROR
- if(ninfo.depth != 2)
- TEST_ERROR
- if(ninfo.nrec != 2)
+ if(check_node_info(bt2, dxpl, record, &ninfo) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
@@ -5429,26 +5439,29 @@ test_remove_level2_promote_3internal_redistrib(hid_t fapl)
TEST_ERROR
/* Query the address of the root node in the B-tree */
- if(H5B2_get_root_addr_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &root_addr) < 0)
+ if(H5B2_get_root_addr_test(bt2, &root_addr) < 0)
FAIL_STACK_ERROR
/* Make certain that the address of the root node is defined */
if(!H5F_addr_defined(root_addr))
TEST_ERROR
- record = 62; /* Left-most record in left node */
- if(H5B2_get_node_info_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, &ninfo) < 0)
- FAIL_STACK_ERROR
- if(ninfo.depth != 1)
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
- if(ninfo.nrec != 29)
+
+ /* Check status of B-tree */
+ ninfo.depth = 1;
+ ninfo.nrec = 29;
+ record = 62; /* Left-most record in left node */
+ if(check_node_info(bt2, dxpl, record, &ninfo) < 0)
TEST_ERROR
/* Attempt to remove record from left internal node of a level-2 B-tree to force promotion w/redistribution */
for(u = 0; u < 38; u++) {
record = 63 + u;
rrecord = HSIZET_MAX;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord) < 0)
+ if(H5B2_remove(bt2, dxpl, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
@@ -5456,7 +5469,7 @@ test_remove_level2_promote_3internal_redistrib(hid_t fapl)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
@@ -5466,29 +5479,33 @@ test_remove_level2_promote_3internal_redistrib(hid_t fapl)
record = 62;
rrecord = HSIZET_MAX;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord) < 0)
+ if(H5B2_remove(bt2, dxpl, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
if(rrecord != 62)
TEST_ERROR
+ /* Check status of B-tree */
+ ninfo.depth = 1;
+ ninfo.nrec = 29;
record = 49; /* Left-most record in left node */
- if(H5B2_get_node_info_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, &ninfo) < 0)
- FAIL_STACK_ERROR
- if(ninfo.depth != 1)
- TEST_ERROR
- if(ninfo.nrec != 29)
+ if(check_node_info(bt2, dxpl, record, &ninfo) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
if(nrec != (INSERT_SPLIT_ROOT_NREC * 59) - 38)
TEST_ERROR
+ /* Close the v2 B-tree */
+ if(H5B2_close(bt2, dxpl) < 0)
+ FAIL_STACK_ERROR
+ bt2 = NULL;
+
/* Close file */
if(H5Fclose(file) < 0)
TEST_ERROR
@@ -5499,6 +5516,8 @@ test_remove_level2_promote_3internal_redistrib(hid_t fapl)
error:
H5E_BEGIN_TRY {
+ if(bt2)
+ H5B2_close(bt2, dxpl);
H5Fclose(file);
} H5E_END_TRY;
return 1;
@@ -5511,7 +5530,6 @@ error:
* Purpose: Basic tests for the B-tree v2 code
*
* Return: Success: 0
- *
* Failure: 1
*
* Programmer: Quincey Koziol
@@ -5520,61 +5538,50 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_remove_level2_promote_2internal_merge(hid_t fapl)
+test_remove_level2_promote_2internal_merge(hid_t fapl, const H5B2_create_t *cparam,
+ const bt2_test_param_t *tparam)
{
- hid_t file=-1;
- char filename[1024];
- H5F_t *f=NULL;
+ hid_t file = -1; /* File ID */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */
+ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
hsize_t record; /* Record to insert into tree */
hsize_t rrecord; /* Record to remove from tree */
hsize_t nrec; /* Number of records in B-tree */
- haddr_t bt2_addr; /* Address of B-tree created */
haddr_t root_addr; /* Address of root of B-tree created */
- int rec_depth; /* Depth of record in B-tree */
H5B2_node_info_test_t ninfo; /* B-tree node info */
unsigned u; /* Local index variable */
- h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
-
- /* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- STACK_ERROR
-
- /* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
- STACK_ERROR
-
TESTING("B-tree remove: promote from right internal of level-2 B-tree w/merge");
- /*
- * v2 B-tree creation
- */
- if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, 512, 8, 100, 40, &bt2_addr/*out*/) < 0)
- FAIL_STACK_ERROR
+ /* Create the file for the test */
+ if(create_file(&file, &f, fapl) < 0)
+ TEST_ERROR
+
+ /* Create the v2 B-tree & get its address */
+ if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0)
+ TEST_ERROR
/* Create level-2 B-tree with 3 internal nodes */
for(u = 0; u < ((INSERT_SPLIT_ROOT_NREC * 59) + 1); u++) {
record = u;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check record values in root of B-tree */
record = 1889; /* Left record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 2)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
TEST_ERROR
+ ninfo.depth = 2;
+ ninfo.nrec = 2;
record = 2834; /* Right record in root node */
- if(H5B2_get_node_info_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, &ninfo) < 0)
- FAIL_STACK_ERROR
- if(ninfo.depth != 2)
- TEST_ERROR
- if(ninfo.nrec != 2)
+ if(check_node_info(bt2, dxpl, record, &ninfo) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
@@ -5582,27 +5589,29 @@ test_remove_level2_promote_2internal_merge(hid_t fapl)
TEST_ERROR
/* Query the address of the root node in the B-tree */
- if(H5B2_get_root_addr_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &root_addr) < 0)
+ if(H5B2_get_root_addr_test(bt2, &root_addr) < 0)
FAIL_STACK_ERROR
/* Make certain that the address of the root node is defined */
if(!H5F_addr_defined(root_addr))
TEST_ERROR
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
+ TEST_ERROR
+
/* Check information about record in right internal node */
+ ninfo.depth = 1;
+ ninfo.nrec = 14;
record = 3685; /* Right-most record in right internal node */
- if(H5B2_get_node_info_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, &ninfo) < 0)
- FAIL_STACK_ERROR
- if(ninfo.depth != 1)
- TEST_ERROR
- if(ninfo.nrec != 14)
+ if(check_node_info(bt2, dxpl, record, &ninfo) < 0)
TEST_ERROR
/* Attempt to remove record from right internal node of a level-2 B-tree to force promotion w/redistribution */
for(u = 0; u < 15; u++) {
record = ((INSERT_SPLIT_ROOT_NREC * 59) + 1) - (u + 1);
rrecord = HSIZET_MAX;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord) < 0)
+ if(H5B2_remove(bt2, dxpl, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
@@ -5610,7 +5619,7 @@ test_remove_level2_promote_2internal_merge(hid_t fapl)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
@@ -5621,7 +5630,7 @@ test_remove_level2_promote_2internal_merge(hid_t fapl)
/* Force merge by promoting current right-most record */
record = 3678;
rrecord = HSIZET_MAX;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord) < 0)
+ if(H5B2_remove(bt2, dxpl, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
@@ -5629,22 +5638,25 @@ test_remove_level2_promote_2internal_merge(hid_t fapl)
TEST_ERROR
/* Check information about record in right internal node */
+ ninfo.depth = 1;
+ ninfo.nrec = 13;
record = 3653; /* Right-most record in right internal node (now) */
- if(H5B2_get_node_info_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, &ninfo) < 0)
- FAIL_STACK_ERROR
- if(ninfo.depth != 1)
- TEST_ERROR
- if(ninfo.nrec != 13)
+ if(check_node_info(bt2, dxpl, record, &ninfo) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
if(nrec != (INSERT_SPLIT_ROOT_NREC * 59) - 15)
TEST_ERROR
+ /* Close the v2 B-tree */
+ if(H5B2_close(bt2, dxpl) < 0)
+ FAIL_STACK_ERROR
+ bt2 = NULL;
+
/* Close file */
if(H5Fclose(file) < 0)
TEST_ERROR
@@ -5655,6 +5667,8 @@ test_remove_level2_promote_2internal_merge(hid_t fapl)
error:
H5E_BEGIN_TRY {
+ if(bt2)
+ H5B2_close(bt2, dxpl);
H5Fclose(file);
} H5E_END_TRY;
return 1;
@@ -5667,7 +5681,6 @@ error:
* Purpose: Basic tests for the B-tree v2 code
*
* Return: Success: 0
- *
* Failure: 1
*
* Programmer: Quincey Koziol
@@ -5676,61 +5689,50 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_remove_level2_promote_3internal_merge(hid_t fapl)
+test_remove_level2_promote_3internal_merge(hid_t fapl, const H5B2_create_t *cparam,
+ const bt2_test_param_t *tparam)
{
- hid_t file=-1;
- char filename[1024];
- H5F_t *f=NULL;
+ hid_t file = -1; /* File ID */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */
+ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
hsize_t record; /* Record to insert into tree */
hsize_t rrecord; /* Record to remove from tree */
hsize_t nrec; /* Number of records in B-tree */
- haddr_t bt2_addr; /* Address of B-tree created */
haddr_t root_addr; /* Address of root of B-tree created */
- int rec_depth; /* Depth of record in B-tree */
H5B2_node_info_test_t ninfo; /* B-tree node info */
unsigned u; /* Local index variable */
- h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
-
- /* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- STACK_ERROR
-
- /* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
- STACK_ERROR
-
TESTING("B-tree remove: promote from middle internal of level-2 B-tree w/merge");
- /*
- * v2 B-tree creation
- */
- if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, 512, 8, 100, 40, &bt2_addr/*out*/) < 0)
- FAIL_STACK_ERROR
+ /* Create the file for the test */
+ if(create_file(&file, &f, fapl) < 0)
+ TEST_ERROR
+
+ /* Create the v2 B-tree & get its address */
+ if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0)
+ TEST_ERROR
/* Create level-2 B-tree with 3 internal nodes */
for(u = 0; u < ((INSERT_SPLIT_ROOT_NREC * 59) + 1); u++) {
record = u;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check record values in root of B-tree */
record = 1889; /* Left record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 2)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
TEST_ERROR
+ ninfo.depth = 2;
+ ninfo.nrec = 2;
record = 2834; /* Right record in root node */
- if(H5B2_get_node_info_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, &ninfo) < 0)
- FAIL_STACK_ERROR
- if(ninfo.depth != 2)
- TEST_ERROR
- if(ninfo.nrec != 2)
+ if(check_node_info(bt2, dxpl, record, &ninfo) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
@@ -5738,27 +5740,29 @@ test_remove_level2_promote_3internal_merge(hid_t fapl)
TEST_ERROR
/* Query the address of the root node in the B-tree */
- if(H5B2_get_root_addr_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &root_addr) < 0)
+ if(H5B2_get_root_addr_test(bt2, &root_addr) < 0)
FAIL_STACK_ERROR
/* Make certain that the address of the root node is defined */
if(!H5F_addr_defined(root_addr))
TEST_ERROR
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
+ TEST_ERROR
+
/* Check information about record in left internal node */
+ ninfo.depth = 1;
+ ninfo.nrec = 29;
record = 62; /* Left-most record in left internal node */
- if(H5B2_get_node_info_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, &ninfo) < 0)
- FAIL_STACK_ERROR
- if(ninfo.depth != 1)
- TEST_ERROR
- if(ninfo.nrec != 29)
+ if(check_node_info(bt2, dxpl, record, &ninfo) < 0)
TEST_ERROR
/* Attempt to remove record from left internal node of a level-2 B-tree to force promotion w/redistribution */
for(u = 0; u < 112; u++) {
record = 48 + u;
rrecord = HSIZET_MAX;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord) < 0)
+ if(H5B2_remove(bt2, dxpl, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
@@ -5766,7 +5770,7 @@ test_remove_level2_promote_3internal_merge(hid_t fapl)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
@@ -5777,7 +5781,7 @@ test_remove_level2_promote_3internal_merge(hid_t fapl)
/* Force merge of left-most internal nodes by promotion */
record = 25;
rrecord = HSIZET_MAX;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord) < 0)
+ if(H5B2_remove(bt2, dxpl, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
@@ -5785,22 +5789,25 @@ test_remove_level2_promote_3internal_merge(hid_t fapl)
TEST_ERROR
/* Check information about record in left internal node */
+ ninfo.depth = 1;
+ ninfo.nrec = 28;
record = 37; /* Left-most record in left internal node (now) */
- if(H5B2_get_node_info_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, &ninfo) < 0)
- FAIL_STACK_ERROR
- if(ninfo.depth != 1)
- TEST_ERROR
- if(ninfo.nrec != 28)
+ if(check_node_info(bt2, dxpl, record, &ninfo) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
if(nrec != (INSERT_SPLIT_ROOT_NREC * 59) - 112)
TEST_ERROR
+ /* Close the v2 B-tree */
+ if(H5B2_close(bt2, dxpl) < 0)
+ FAIL_STACK_ERROR
+ bt2 = NULL;
+
/* Close file */
if(H5Fclose(file) < 0)
TEST_ERROR
@@ -5811,6 +5818,8 @@ test_remove_level2_promote_3internal_merge(hid_t fapl)
error:
H5E_BEGIN_TRY {
+ if(bt2)
+ H5B2_close(bt2, dxpl);
H5Fclose(file);
} H5E_END_TRY;
return 1;
@@ -5823,7 +5832,6 @@ error:
* Purpose: Basic tests for the B-tree v2 code
*
* Return: Success: 0
- *
* Failure: 1
*
* Programmer: Quincey Koziol
@@ -5832,61 +5840,50 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_remove_level2_2internal_merge_left(hid_t fapl)
+test_remove_level2_2internal_merge_left(hid_t fapl, const H5B2_create_t *cparam,
+ const bt2_test_param_t *tparam)
{
- hid_t file=-1;
- char filename[1024];
- H5F_t *f=NULL;
+ hid_t file = -1; /* File ID */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */
+ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
hsize_t record; /* Record to insert into tree */
hsize_t rrecord; /* Record to remove from tree */
hsize_t nrec; /* Number of records in B-tree */
- haddr_t bt2_addr; /* Address of B-tree created */
haddr_t root_addr; /* Address of root of B-tree created */
- int rec_depth; /* Depth of record in B-tree */
H5B2_node_info_test_t ninfo; /* B-tree node info */
unsigned u; /* Local index variable */
- h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
-
- /* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- STACK_ERROR
-
- /* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
- STACK_ERROR
-
TESTING("B-tree remove: merge 2 internal nodes to 1 in level-2 B-tree (l->r)");
- /*
- * v2 B-tree creation
- */
- if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, 512, 8, 100, 40, &bt2_addr/*out*/) < 0)
- FAIL_STACK_ERROR
+ /* Create the file for the test */
+ if(create_file(&file, &f, fapl) < 0)
+ TEST_ERROR
+
+ /* Create the v2 B-tree & get its address */
+ if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0)
+ TEST_ERROR
/* Create level-2 B-tree with 3 internal nodes */
for(u = 0; u < ((INSERT_SPLIT_ROOT_NREC * 59) + 1); u++) {
record = u;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check record values in root of B-tree */
record = 1889; /* Left record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 2)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
TEST_ERROR
+ ninfo.depth = 2;
+ ninfo.nrec = 2;
record = 2834; /* Right record in root node */
- if(H5B2_get_node_info_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, &ninfo) < 0)
- FAIL_STACK_ERROR
- if(ninfo.depth != 2)
- TEST_ERROR
- if(ninfo.nrec != 2)
+ if(check_node_info(bt2, dxpl, record, &ninfo) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
@@ -5894,18 +5891,22 @@ test_remove_level2_2internal_merge_left(hid_t fapl)
TEST_ERROR
/* Query the address of the root node in the B-tree */
- if(H5B2_get_root_addr_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &root_addr) < 0)
+ if(H5B2_get_root_addr_test(bt2, &root_addr) < 0)
FAIL_STACK_ERROR
/* Make certain that the address of the root node is defined */
if(!H5F_addr_defined(root_addr))
TEST_ERROR
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
+ TEST_ERROR
+
/* Attempt to remove records from a level-2 B-tree to force 2 internal nodes to merge */
for(u = 0; u < ((INSERT_SPLIT_ROOT_NREC * 21) + 15); u++) {
record = u;
rrecord = HSIZET_MAX;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord) < 0)
+ if(H5B2_remove(bt2, dxpl, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
@@ -5913,7 +5914,7 @@ test_remove_level2_2internal_merge_left(hid_t fapl)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
@@ -5921,14 +5922,18 @@ test_remove_level2_2internal_merge_left(hid_t fapl)
TEST_ERROR
} /* end for */
+ /* Check status of B-tree */
+ ninfo.depth = 2;
+ ninfo.nrec = 1;
record = 2834; /* Middle record in root node */
- if(H5B2_get_node_info_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, &ninfo) < 0)
- FAIL_STACK_ERROR
- if(ninfo.depth != 2)
- TEST_ERROR
- if(ninfo.nrec != 1)
+ if(check_node_info(bt2, dxpl, record, &ninfo) < 0)
TEST_ERROR
+ /* Close the v2 B-tree */
+ if(H5B2_close(bt2, dxpl) < 0)
+ FAIL_STACK_ERROR
+ bt2 = NULL;
+
/* Close file */
if(H5Fclose(file) < 0)
TEST_ERROR
@@ -5939,6 +5944,8 @@ test_remove_level2_2internal_merge_left(hid_t fapl)
error:
H5E_BEGIN_TRY {
+ if(bt2)
+ H5B2_close(bt2, dxpl);
H5Fclose(file);
} H5E_END_TRY;
return 1;
@@ -5951,7 +5958,6 @@ error:
* Purpose: Basic tests for the B-tree v2 code
*
* Return: Success: 0
- *
* Failure: 1
*
* Programmer: Quincey Koziol
@@ -5960,61 +5966,50 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_remove_level2_2internal_merge_right(hid_t fapl)
+test_remove_level2_2internal_merge_right(hid_t fapl, const H5B2_create_t *cparam,
+ const bt2_test_param_t *tparam)
{
- hid_t file=-1;
- char filename[1024];
- H5F_t *f=NULL;
+ hid_t file = -1; /* File ID */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */
+ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
hsize_t record; /* Record to insert into tree */
hsize_t rrecord; /* Record to remove from tree */
hsize_t nrec; /* Number of records in B-tree */
- haddr_t bt2_addr; /* Address of B-tree created */
haddr_t root_addr; /* Address of root of B-tree created */
- int rec_depth; /* Depth of record in B-tree */
H5B2_node_info_test_t ninfo; /* B-tree node info */
unsigned u; /* Local index variable */
- h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
-
- /* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- STACK_ERROR
-
- /* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
- STACK_ERROR
-
TESTING("B-tree remove: merge 2 internal nodes to 1 in level-2 B-tree (r->l)");
- /*
- * v2 B-tree creation
- */
- if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, 512, 8, 100, 40, &bt2_addr/*out*/) < 0)
- FAIL_STACK_ERROR
+ /* Create the file for the test */
+ if(create_file(&file, &f, fapl) < 0)
+ TEST_ERROR
+
+ /* Create the v2 B-tree & get its address */
+ if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0)
+ TEST_ERROR
/* Create level-2 B-tree with 3 internal nodes */
for(u = 0; u < ((INSERT_SPLIT_ROOT_NREC * 59) + 1); u++) {
record = u;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check record values in root of B-tree */
record = 1889; /* Left record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 2)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
TEST_ERROR
+ ninfo.depth = 2;
+ ninfo.nrec = 2;
record = 2834; /* Right record in root node */
- if(H5B2_get_node_info_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, &ninfo) < 0)
- FAIL_STACK_ERROR
- if(ninfo.depth != 2)
- TEST_ERROR
- if(ninfo.nrec != 2)
+ if(check_node_info(bt2, dxpl, record, &ninfo) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
@@ -6022,18 +6017,22 @@ test_remove_level2_2internal_merge_right(hid_t fapl)
TEST_ERROR
/* Query the address of the root node in the B-tree */
- if(H5B2_get_root_addr_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &root_addr) < 0)
+ if(H5B2_get_root_addr_test(bt2, &root_addr) < 0)
FAIL_STACK_ERROR
/* Make certain that the address of the root node is defined */
if(!H5F_addr_defined(root_addr))
TEST_ERROR
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
+ TEST_ERROR
+
/* Attempt to remove records from a level-2 B-tree to force 2 internal nodes to merge */
for(u = 0; u < ((INSERT_SPLIT_ROOT_NREC * 5) + 17); u++) {
record = ((INSERT_SPLIT_ROOT_NREC * 59) + 1) - (u + 1);
rrecord = HSIZET_MAX;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord) < 0)
+ if(H5B2_remove(bt2, dxpl, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
@@ -6041,7 +6040,7 @@ test_remove_level2_2internal_merge_right(hid_t fapl)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
@@ -6049,14 +6048,18 @@ test_remove_level2_2internal_merge_right(hid_t fapl)
TEST_ERROR
} /* end for */
+ /* Check status of B-tree */
+ ninfo.depth = 2;
+ ninfo.nrec = 1;
record = 1889; /* Middle record in root node */
- if(H5B2_get_node_info_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, &ninfo) < 0)
- FAIL_STACK_ERROR
- if(ninfo.depth != 2)
- TEST_ERROR
- if(ninfo.nrec != 1)
+ if(check_node_info(bt2, dxpl, record, &ninfo) < 0)
TEST_ERROR
+ /* Close the v2 B-tree */
+ if(H5B2_close(bt2, dxpl) < 0)
+ FAIL_STACK_ERROR
+ bt2 = NULL;
+
/* Close file */
if(H5Fclose(file) < 0)
TEST_ERROR
@@ -6067,6 +6070,8 @@ test_remove_level2_2internal_merge_right(hid_t fapl)
error:
H5E_BEGIN_TRY {
+ if(bt2)
+ H5B2_close(bt2, dxpl);
H5Fclose(file);
} H5E_END_TRY;
return 1;
@@ -6079,7 +6084,6 @@ error:
* Purpose: Basic tests for the B-tree v2 code
*
* Return: Success: 0
- *
* Failure: 1
*
* Programmer: Quincey Koziol
@@ -6088,61 +6092,50 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_remove_level2_3internal_merge(hid_t fapl)
+test_remove_level2_3internal_merge(hid_t fapl, const H5B2_create_t *cparam,
+ const bt2_test_param_t *tparam)
{
- hid_t file=-1;
- char filename[1024];
- H5F_t *f=NULL;
+ hid_t file = -1; /* File ID */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */
+ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
hsize_t record; /* Record to insert into tree */
hsize_t rrecord; /* Record to remove from tree */
hsize_t nrec; /* Number of records in B-tree */
- haddr_t bt2_addr; /* Address of B-tree created */
haddr_t root_addr; /* Address of root of B-tree created */
- int rec_depth; /* Depth of record in B-tree */
H5B2_node_info_test_t ninfo; /* B-tree node info */
unsigned u; /* Local index variable */
- h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
-
- /* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- STACK_ERROR
-
- /* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
- STACK_ERROR
-
TESTING("B-tree remove: merge 3 internal nodes to 2 in level-2 B-tree");
- /*
- * v2 B-tree creation
- */
- if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, 512, 8, 100, 40, &bt2_addr/*out*/) < 0)
- FAIL_STACK_ERROR
+ /* Create the file for the test */
+ if(create_file(&file, &f, fapl) < 0)
+ TEST_ERROR
+
+ /* Create the v2 B-tree & get its address */
+ if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0)
+ TEST_ERROR
/* Create level-2 B-tree with 3 internal nodes */
for(u = 0; u < ((INSERT_SPLIT_ROOT_NREC * 59) + 1); u++) {
record = u;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check record values in root of B-tree */
record = 1889; /* Left record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 2)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
TEST_ERROR
+ ninfo.depth = 2;
+ ninfo.nrec = 2;
record = 2834; /* Right record in root node */
- if(H5B2_get_node_info_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, &ninfo) < 0)
- FAIL_STACK_ERROR
- if(ninfo.depth != 2)
- TEST_ERROR
- if(ninfo.nrec != 2)
+ if(check_node_info(bt2, dxpl, record, &ninfo) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
@@ -6150,18 +6143,22 @@ test_remove_level2_3internal_merge(hid_t fapl)
TEST_ERROR
/* Query the address of the root node in the B-tree */
- if(H5B2_get_root_addr_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &root_addr) < 0)
+ if(H5B2_get_root_addr_test(bt2, &root_addr) < 0)
FAIL_STACK_ERROR
/* Make certain that the address of the root node is defined */
if(!H5F_addr_defined(root_addr))
TEST_ERROR
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
+ TEST_ERROR
+
/* Attempt to remove record from middle internal node of a level-2 B-tree to force promotion w/redistribution */
for(u = 0; u < ((INSERT_SPLIT_ROOT_NREC * 23) + 15); u++) {
record = (INSERT_SPLIT_ROOT_NREC * 20) + u;
rrecord = HSIZET_MAX;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord) < 0)
+ if(H5B2_remove(bt2, dxpl, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
@@ -6169,7 +6166,7 @@ test_remove_level2_3internal_merge(hid_t fapl)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
@@ -6177,14 +6174,18 @@ test_remove_level2_3internal_merge(hid_t fapl)
TEST_ERROR
} /* end for */
+ /* Check status of B-tree */
+ ninfo.depth = 2;
+ ninfo.nrec = 1;
record = 1196; /* Right record in root node */
- if(H5B2_get_node_info_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, &ninfo) < 0)
- FAIL_STACK_ERROR
- if(ninfo.depth != 2)
- TEST_ERROR
- if(ninfo.nrec != 1)
+ if(check_node_info(bt2, dxpl, record, &ninfo) < 0)
TEST_ERROR
+ /* Close the v2 B-tree */
+ if(H5B2_close(bt2, dxpl) < 0)
+ FAIL_STACK_ERROR
+ bt2 = NULL;
+
/* Close file */
if(H5Fclose(file) < 0)
TEST_ERROR
@@ -6195,6 +6196,8 @@ test_remove_level2_3internal_merge(hid_t fapl)
error:
H5E_BEGIN_TRY {
+ if(bt2)
+ H5B2_close(bt2, dxpl);
H5Fclose(file);
} H5E_END_TRY;
return 1;
@@ -6207,7 +6210,6 @@ error:
* Purpose: Basic tests for the B-tree v2 code
*
* Return: Success: 0
- *
* Failure: 1
*
* Programmer: Quincey Koziol
@@ -6216,62 +6218,51 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_remove_level2_collapse_right(hid_t fapl)
+test_remove_level2_collapse_right(hid_t fapl, const H5B2_create_t *cparam,
+ const bt2_test_param_t *tparam)
{
- hid_t file=-1;
- char filename[1024];
- H5F_t *f=NULL;
+ hid_t file = -1; /* File ID */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */
+ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
hsize_t record; /* Record to insert into tree */
hsize_t rrecord; /* Record to remove from tree */
hsize_t nrec; /* Number of records in B-tree */
- haddr_t bt2_addr; /* Address of B-tree created */
haddr_t root_addr; /* Address of root of B-tree created */
- int rec_depth; /* Depth of record in B-tree */
H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
H5B2_node_info_test_t ninfo; /* B-tree node info */
unsigned u; /* Local index variable */
- h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
-
- /* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- STACK_ERROR
-
- /* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
- STACK_ERROR
-
TESTING("B-tree remove: collapse level-2 B-tree back to level-1 (r->l)");
- /*
- * v2 B-tree creation
- */
- if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, 512, 8, 100, 40, &bt2_addr/*out*/) < 0)
- FAIL_STACK_ERROR
+ /* Create the file for the test */
+ if(create_file(&file, &f, fapl) < 0)
+ TEST_ERROR
+
+ /* Create the v2 B-tree & get its address */
+ if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0)
+ TEST_ERROR
/* Create level-2 B-tree with 3 internal nodes */
for(u = 0; u < ((INSERT_SPLIT_ROOT_NREC * 59) + 1); u++) {
record = u;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check record values in root of B-tree */
record = 1889; /* Left record in root node */
- if((rec_depth = H5B2_get_node_depth_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)) < 0)
- FAIL_STACK_ERROR
- if(rec_depth != 2)
+ if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
TEST_ERROR
+ ninfo.depth = 2;
+ ninfo.nrec = 2;
record = 2834; /* Right record in root node */
- if(H5B2_get_node_info_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, &ninfo) < 0)
- FAIL_STACK_ERROR
- if(ninfo.depth != 2)
- TEST_ERROR
- if(ninfo.nrec != 2)
+ if(check_node_info(bt2, dxpl, record, &ninfo) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
@@ -6279,18 +6270,22 @@ test_remove_level2_collapse_right(hid_t fapl)
TEST_ERROR
/* Query the address of the root node in the B-tree */
- if(H5B2_get_root_addr_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &root_addr) < 0)
+ if(H5B2_get_root_addr_test(bt2, &root_addr) < 0)
FAIL_STACK_ERROR
/* Make certain that the address of the root node is defined */
if(!H5F_addr_defined(root_addr))
TEST_ERROR
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
+ TEST_ERROR
+
/* Attempt to remove records from a level-2 B-tree to force back to level-1 */
for(u = 0; u < (INSERT_SPLIT_ROOT_NREC * 34) + 17; u++) {
record = ((INSERT_SPLIT_ROOT_NREC * 59) + 1) - (u + 1);
rrecord = HSIZET_MAX;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord) < 0)
+ if(H5B2_remove(bt2, dxpl, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
@@ -6298,7 +6293,7 @@ test_remove_level2_collapse_right(hid_t fapl)
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
@@ -6307,11 +6302,16 @@ test_remove_level2_collapse_right(hid_t fapl)
} /* end for */
/* Check up on B-tree */
- if(H5B2_stat_info(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &bt2_stat) < 0)
+ if(H5B2_stat_info(bt2, &bt2_stat) < 0)
FAIL_STACK_ERROR
if(bt2_stat.depth != 1)
TEST_ERROR
+ /* Close the v2 B-tree */
+ if(H5B2_close(bt2, dxpl) < 0)
+ FAIL_STACK_ERROR
+ bt2 = NULL;
+
/* Close file */
if(H5Fclose(file) < 0)
TEST_ERROR
@@ -6322,6 +6322,8 @@ test_remove_level2_collapse_right(hid_t fapl)
error:
H5E_BEGIN_TRY {
+ if(bt2)
+ H5B2_close(bt2, dxpl);
H5Fclose(file);
} H5E_END_TRY;
return 1;
@@ -6342,11 +6344,13 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-gen_l4_btree2(const char *filename, hid_t fapl, haddr_t *bt2_addr,
- const hsize_t *records)
+gen_l4_btree2(const char *filename, hid_t fapl, const H5B2_create_t *cparam,
+ haddr_t *bt2_addr, const hsize_t *records)
{
- hid_t file = -1;
- H5F_t *f = NULL;
+ hid_t file = -1; /* File ID */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */
+ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
hsize_t record; /* Record to insert into tree */
unsigned u; /* Local index variable */
H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
@@ -6359,25 +6363,28 @@ gen_l4_btree2(const char *filename, hid_t fapl, haddr_t *bt2_addr,
if(NULL == (f = (H5F_t *)H5I_object(file)))
STACK_ERROR
- /*
- * Create v2 B-tree
- */
- if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, 512, 8, 100, 40, bt2_addr/*out*/) < 0)
- FAIL_STACK_ERROR
+ /* Create the v2 B-tree & get its address */
+ if(create_btree(f, dxpl, cparam, &bt2, bt2_addr) < 0)
+ TEST_ERROR
/* Insert random records */
for(u = 0; u < INSERT_MANY; u++) {
record = records[u];
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, *bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- if(H5B2_stat_info(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, *bt2_addr, &bt2_stat) < 0)
+ if(H5B2_stat_info(bt2, &bt2_stat) < 0)
FAIL_STACK_ERROR
if(bt2_stat.depth != 4)
TEST_ERROR
+ /* Close the v2 B-tree */
+ if(H5B2_close(bt2, dxpl) < 0)
+ FAIL_STACK_ERROR
+ bt2 = NULL;
+
/* Close file */
if(H5Fclose(file) < 0)
STACK_ERROR
@@ -6386,6 +6393,8 @@ gen_l4_btree2(const char *filename, hid_t fapl, haddr_t *bt2_addr,
error:
H5E_BEGIN_TRY {
+ if(bt2)
+ H5B2_close(bt2, dxpl);
H5Fclose(file);
} H5E_END_TRY;
@@ -6409,17 +6418,19 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_remove_lots(const char *env_h5_drvr, hid_t fapl)
+test_remove_lots(const char *env_h5_drvr, hid_t fapl, const H5B2_create_t *cparam)
{
- hid_t file = -1;
- char filename[1024];
- H5F_t *f = NULL;
+ hid_t file = -1; /* File ID */
+ char filename[1024]; /* Filename to use */
+ H5F_t *f = NULL; /* Internal file object pointer */
int fd = -1; /* File descriptor */
h5_stat_t sb; /* Stat buffer for file */
void *file_data = NULL; /* Copy of file data */
+ hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */
+ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
hsize_t record; /* Record to insert into tree */
hsize_t rrecord; /* Record to remove from tree */
- haddr_t bt2_addr; /* Address of B-tree created */
haddr_t root_addr; /* Address of root of B-tree created */
time_t curr_time; /* Current time, for seeding random number generator */
hsize_t *records; /* Record #'s for random insertion */
@@ -6462,7 +6473,7 @@ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time);
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
/* Generate the v2 B-tree to test */
- if(gen_l4_btree2(filename, fapl, &bt2_addr, records))
+ if(gen_l4_btree2(filename, fapl, cparam, &bt2_addr, records))
TEST_ERROR
/* Check for VFD which stores data in multiple files */
@@ -6514,11 +6525,15 @@ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time);
records[swap_idx] = temp_rec;
} /* end for */
+ /* Re-open v2 B-tree */
+ if(NULL == (bt2 = H5B2_open(f, dxpl, bt2_addr)))
+ FAIL_STACK_ERROR
+
/* Remove all records */
for(u = 0; u < INSERT_MANY; u++) {
record = records[u];
rrecord = HSIZET_MAX;
- if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, remove_cb, &rrecord) < 0)
+ if(H5B2_remove(bt2, dxpl, &record, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
@@ -6526,7 +6541,7 @@ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time);
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
@@ -6535,13 +6550,18 @@ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time);
} /* end for */
/* Query the address of the root node in the B-tree */
- if(H5B2_get_root_addr_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &root_addr) < 0)
+ if(H5B2_get_root_addr_test(bt2, &root_addr) < 0)
FAIL_STACK_ERROR
/* Make certain that the address of the root node is defined */
if(H5F_addr_defined(root_addr))
TEST_ERROR
+ /* Close the v2 B-tree */
+ if(H5B2_close(bt2, dxpl) < 0)
+ FAIL_STACK_ERROR
+ bt2 = NULL;
+
/* Close file */
if(H5Fclose(file) < 0)
STACK_ERROR
@@ -6569,7 +6589,7 @@ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time);
} /* end if */
else {
/* Re-generate the v2 B-tree to test */
- if(gen_l4_btree2(filename, fapl, &bt2_addr, records))
+ if(gen_l4_btree2(filename, fapl, cparam, &bt2_addr, records))
TEST_ERROR
} /* end else */
@@ -6585,6 +6605,10 @@ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time);
if(NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
+ /* Re-open v2 B-tree */
+ if(NULL == (bt2 = H5B2_open(f, dxpl, bt2_addr)))
+ FAIL_STACK_ERROR
+
/* Remove all records */
for(u = 0; u < INSERT_MANY; u++) {
/* Pick a record index to remove from randomly */
@@ -6592,7 +6616,7 @@ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time);
rrecord = HSIZET_MAX;
/* Remove random record */
- if(H5B2_remove_by_idx(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, H5_ITER_INC, (hsize_t)rem_idx, remove_cb, &rrecord) < 0)
+ if(H5B2_remove_by_idx(bt2, dxpl, H5_ITER_INC, (hsize_t)rem_idx, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
@@ -6600,7 +6624,7 @@ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time);
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
@@ -6609,13 +6633,18 @@ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time);
} /* end for */
/* Query the address of the root node in the B-tree */
- if(H5B2_get_root_addr_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &root_addr) < 0)
+ if(H5B2_get_root_addr_test(bt2, &root_addr) < 0)
FAIL_STACK_ERROR
/* Make certain that the address of the root node is defined */
if(H5F_addr_defined(root_addr))
TEST_ERROR
+ /* Close the v2 B-tree */
+ if(H5B2_close(bt2, dxpl) < 0)
+ FAIL_STACK_ERROR
+ bt2 = NULL;
+
/* Close file */
if(H5Fclose(file) < 0)
STACK_ERROR
@@ -6643,7 +6672,7 @@ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time);
} /* end if */
else {
/* Re-generate the v2 B-tree to test */
- if(gen_l4_btree2(filename, fapl, &bt2_addr, records))
+ if(gen_l4_btree2(filename, fapl, cparam, &bt2_addr, records))
TEST_ERROR
} /* end else */
@@ -6660,11 +6689,15 @@ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time);
if(NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
+ /* Re-open v2 B-tree */
+ if(NULL == (bt2 = H5B2_open(f, dxpl, bt2_addr)))
+ FAIL_STACK_ERROR
+
/* Remove all records */
for(u = 0; u < INSERT_MANY; u++) {
/* Remove first record */
rrecord = HSIZET_MAX;
- if(H5B2_remove_by_idx(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, H5_ITER_INC, (hsize_t)0, remove_cb, &rrecord) < 0)
+ if(H5B2_remove_by_idx(bt2, dxpl, H5_ITER_INC, (hsize_t)0, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
@@ -6672,7 +6705,7 @@ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time);
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
@@ -6681,13 +6714,18 @@ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time);
} /* end for */
/* Query the address of the root node in the B-tree */
- if(H5B2_get_root_addr_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &root_addr) < 0)
+ if(H5B2_get_root_addr_test(bt2, &root_addr) < 0)
FAIL_STACK_ERROR
/* Make certain that the address of the root node is defined */
if(H5F_addr_defined(root_addr))
TEST_ERROR
+ /* Close the v2 B-tree */
+ if(H5B2_close(bt2, dxpl) < 0)
+ FAIL_STACK_ERROR
+ bt2 = NULL;
+
/* Close file */
if(H5Fclose(file) < 0)
STACK_ERROR
@@ -6715,7 +6753,7 @@ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time);
} /* end if */
else {
/* Re-generate the v2 B-tree to test */
- if(gen_l4_btree2(filename, fapl, &bt2_addr, records))
+ if(gen_l4_btree2(filename, fapl, cparam, &bt2_addr, records))
TEST_ERROR
} /* end else */
@@ -6732,11 +6770,15 @@ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time);
if(NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
+ /* Re-open v2 B-tree */
+ if(NULL == (bt2 = H5B2_open(f, dxpl, bt2_addr)))
+ FAIL_STACK_ERROR
+
/* Remove all records */
for(u = 0; u < INSERT_MANY; u++) {
/* Remove last record */
rrecord = HSIZET_MAX;
- if(H5B2_remove_by_idx(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, H5_ITER_DEC, (hsize_t)0, remove_cb, &rrecord) < 0)
+ if(H5B2_remove_by_idx(bt2, dxpl, H5_ITER_DEC, (hsize_t)0, remove_cb, &rrecord) < 0)
FAIL_STACK_ERROR
/* Make certain that the record value is correct */
@@ -6744,7 +6786,7 @@ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time);
TEST_ERROR
/* Query the number of records in the B-tree */
- if(H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec) < 0)
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
FAIL_STACK_ERROR
/* Make certain that the # of records is correct */
@@ -6753,13 +6795,18 @@ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time);
} /* end for */
/* Query the address of the root node in the B-tree */
- if(H5B2_get_root_addr_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &root_addr) < 0)
+ if(H5B2_get_root_addr_test(bt2, &root_addr) < 0)
FAIL_STACK_ERROR
/* Make certain that the address of the root node is defined */
if(H5F_addr_defined(root_addr))
TEST_ERROR
+ /* Close the v2 B-tree */
+ if(H5B2_close(bt2, dxpl) < 0)
+ FAIL_STACK_ERROR
+ bt2 = NULL;
+
/* Close file */
if(H5Fclose(file) < 0)
STACK_ERROR
@@ -6775,6 +6822,8 @@ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time);
error:
H5E_BEGIN_TRY {
+ if(bt2)
+ H5B2_close(bt2, dxpl);
H5Fclose(file);
} H5E_END_TRY;
@@ -6796,7 +6845,6 @@ error:
* code to find nearest neighbors to a given value in a B-tree.
*
* Return: Success: 0
- *
* Failure: 1
*
* Programmer: Quincey Koziol
@@ -6805,13 +6853,15 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_find_neighbor(hid_t fapl)
+test_find_neighbor(hid_t fapl, const H5B2_create_t *cparam,
+ const bt2_test_param_t *tparam)
{
- hid_t file=-1;
- char filename[1024];
- H5F_t *f=NULL;
- hsize_t record; /* Record to insert into tree */
+ hid_t file = -1; /* File ID */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */
+ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
haddr_t bt2_addr; /* Address of B-tree created */
+ hsize_t record; /* Record to insert into tree */
hsize_t search; /* Search value */
hsize_t *records; /* Record #'s for random insertion */
unsigned u; /* Local index variable */
@@ -6819,106 +6869,96 @@ test_find_neighbor(hid_t fapl)
herr_t ret; /* Generic error return value */
/* Allocate space for the records */
- if((records = (hsize_t *)HDmalloc(sizeof(hsize_t)*FIND_NEIGHBOR))==NULL)
+ if(NULL == (records = (hsize_t *)HDmalloc(sizeof(hsize_t) * FIND_NEIGHBOR)))
TEST_ERROR
/* Initialize record #'s */
for(u = 0; u < FIND_NEIGHBOR; u++)
records[u] = u * 2;
- h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
-
/*
* Test nearest neighbor for '<' cases
*/
TESTING("B-tree find: nearest neighbor less than a value");
- /* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- STACK_ERROR
-
- /* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
- STACK_ERROR
+ /* Create the file for the test */
+ if(create_file(&file, &f, fapl) < 0)
+ TEST_ERROR
- /*
- * Create v2 B-tree
- */
- if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, 512, 8, 100, 40, &bt2_addr/*out*/) < 0)
- FAIL_STACK_ERROR
+ /* Create the v2 B-tree & get its address */
+ if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0)
+ TEST_ERROR
/* Insert records */
for(u = 0; u < FIND_NEIGHBOR; u++) {
record = records[u];
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Attempt to find record B-tree less than a value */
search = 0;
H5E_BEGIN_TRY {
- ret = H5B2_neighbor(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, H5B2_COMPARE_LESS, &search, neighbor_cb, &record);
+ ret = H5B2_neighbor(bt2, dxpl, H5B2_COMPARE_LESS, &search, neighbor_cb, &record);
} H5E_END_TRY;
/* Should fail */
if(ret != FAIL)
TEST_ERROR
search = 1;
- if(H5B2_neighbor(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, H5B2_COMPARE_LESS, &search, neighbor_cb, &record) < 0)
+ if(H5B2_neighbor(bt2, dxpl, H5B2_COMPARE_LESS, &search, neighbor_cb, &record) < 0)
FAIL_STACK_ERROR
if(record != 0)
TEST_ERROR
search = 2;
- if(H5B2_neighbor(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, H5B2_COMPARE_LESS, &search, neighbor_cb, &record) < 0)
+ if(H5B2_neighbor(bt2, dxpl, H5B2_COMPARE_LESS, &search, neighbor_cb, &record) < 0)
FAIL_STACK_ERROR
if(record != 0)
TEST_ERROR
search = 3;
- if(H5B2_neighbor(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, H5B2_COMPARE_LESS, &search, neighbor_cb, &record) < 0)
+ if(H5B2_neighbor(bt2, dxpl, H5B2_COMPARE_LESS, &search, neighbor_cb, &record) < 0)
FAIL_STACK_ERROR
if(record != 2)
TEST_ERROR
search = 4;
- if(H5B2_neighbor(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, H5B2_COMPARE_LESS, &search, neighbor_cb, &record) < 0)
+ if(H5B2_neighbor(bt2, dxpl, H5B2_COMPARE_LESS, &search, neighbor_cb, &record) < 0)
FAIL_STACK_ERROR
if(record != 2)
TEST_ERROR
+ /* Check status of B-tree */
+ ninfo.depth = 1;
+ ninfo.nrec = 14;
record = 250; /* Record in left internal node */
- if(H5B2_get_node_info_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, &ninfo) < 0)
- FAIL_STACK_ERROR
- if(ninfo.depth != 1)
- TEST_ERROR
- if(ninfo.nrec != 14)
+ if(check_node_info(bt2, dxpl, record, &ninfo) < 0)
TEST_ERROR
/* Neighbor is in internal node */
search = 251;
- if(H5B2_neighbor(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, H5B2_COMPARE_LESS, &search, neighbor_cb, &record) < 0)
+ if(H5B2_neighbor(bt2, dxpl, H5B2_COMPARE_LESS, &search, neighbor_cb, &record) < 0)
FAIL_STACK_ERROR
if(record != 250)
TEST_ERROR
+ /* Check status of B-tree */
+ ninfo.depth = 2;
+ ninfo.nrec = 1;
record = 1888; /* Record in root node */
- if(H5B2_get_node_info_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, &ninfo) < 0)
- FAIL_STACK_ERROR
- if(ninfo.depth != 2)
- TEST_ERROR
- if(ninfo.nrec != 1)
+ if(check_node_info(bt2, dxpl, record, &ninfo) < 0)
TEST_ERROR
/* Neighbor is in root node */
search = 1889;
- if(H5B2_neighbor(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, H5B2_COMPARE_LESS, &search, neighbor_cb, &record) < 0)
+ if(H5B2_neighbor(bt2, dxpl, H5B2_COMPARE_LESS, &search, neighbor_cb, &record) < 0)
FAIL_STACK_ERROR
if(record != 1888)
TEST_ERROR
search = (FIND_NEIGHBOR * 2) + 1;
- if(H5B2_neighbor(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, H5B2_COMPARE_LESS, &search, neighbor_cb, &record) < 0)
+ if(H5B2_neighbor(bt2, dxpl, H5B2_COMPARE_LESS, &search, neighbor_cb, &record) < 0)
FAIL_STACK_ERROR
if(record != ((FIND_NEIGHBOR - 1) * 2))
TEST_ERROR
@@ -6930,67 +6970,75 @@ test_find_neighbor(hid_t fapl)
*/
TESTING("B-tree find: nearest neighbor greater than a value");
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
+ TEST_ERROR
+
/* Attempt to find record B-tree less than a value */
search = (FIND_NEIGHBOR * 2) + 1;
H5E_BEGIN_TRY {
- ret = H5B2_neighbor(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, H5B2_COMPARE_GREATER, &search, neighbor_cb, &record);
+ ret = H5B2_neighbor(bt2, dxpl, H5B2_COMPARE_GREATER, &search, neighbor_cb, &record);
} H5E_END_TRY;
/* Should fail */
if(ret != FAIL)
TEST_ERROR
search = 0;
- if(H5B2_neighbor(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, H5B2_COMPARE_GREATER, &search, neighbor_cb, &record) < 0)
+ if(H5B2_neighbor(bt2, dxpl, H5B2_COMPARE_GREATER, &search, neighbor_cb, &record) < 0)
FAIL_STACK_ERROR
if(record != 2)
TEST_ERROR
search = 1;
- if(H5B2_neighbor(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, H5B2_COMPARE_GREATER, &search, neighbor_cb, &record) < 0)
+ if(H5B2_neighbor(bt2, dxpl, H5B2_COMPARE_GREATER, &search, neighbor_cb, &record) < 0)
FAIL_STACK_ERROR
if(record != 2)
TEST_ERROR
search = 2;
- if(H5B2_neighbor(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, H5B2_COMPARE_GREATER, &search, neighbor_cb, &record) < 0)
+ if(H5B2_neighbor(bt2, dxpl, H5B2_COMPARE_GREATER, &search, neighbor_cb, &record) < 0)
FAIL_STACK_ERROR
if(record != 4)
TEST_ERROR
search = 3;
- if(H5B2_neighbor(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, H5B2_COMPARE_GREATER, &search, neighbor_cb, &record) < 0)
+ if(H5B2_neighbor(bt2, dxpl, H5B2_COMPARE_GREATER, &search, neighbor_cb, &record) < 0)
FAIL_STACK_ERROR
if(record != 4)
TEST_ERROR
+ /* Check status of B-tree */
+ ninfo.depth = 1;
+ ninfo.nrec = 16;
record = 2896; /* Record in right internal node */
- if(H5B2_get_node_info_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, &ninfo) < 0)
- FAIL_STACK_ERROR
- if(ninfo.depth != 1)
- TEST_ERROR
- if(ninfo.nrec != 16)
+ if(check_node_info(bt2, dxpl, record, &ninfo) < 0)
TEST_ERROR
/* Neighbor is in internal node */
search = 2895;
- if(H5B2_neighbor(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, H5B2_COMPARE_GREATER, &search, neighbor_cb, &record) < 0)
+ if(H5B2_neighbor(bt2, dxpl, H5B2_COMPARE_GREATER, &search, neighbor_cb, &record) < 0)
FAIL_STACK_ERROR
if(record != 2896)
TEST_ERROR
/* Neighbor is in root node */
search = 1887;
- if(H5B2_neighbor(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, H5B2_COMPARE_GREATER, &search, neighbor_cb, &record) < 0)
+ if(H5B2_neighbor(bt2, dxpl, H5B2_COMPARE_GREATER, &search, neighbor_cb, &record) < 0)
FAIL_STACK_ERROR
if(record != 1888)
TEST_ERROR
search = ((FIND_NEIGHBOR - 1) * 2) - 1;
- if(H5B2_neighbor(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, H5B2_COMPARE_GREATER, &search, neighbor_cb, &record) < 0)
+ if(H5B2_neighbor(bt2, dxpl, H5B2_COMPARE_GREATER, &search, neighbor_cb, &record) < 0)
FAIL_STACK_ERROR
if(record != ((FIND_NEIGHBOR - 1) * 2))
TEST_ERROR
+ /* Close the v2 B-tree */
+ if(H5B2_close(bt2, dxpl) < 0)
+ FAIL_STACK_ERROR
+ bt2 = NULL;
+
/* Close file */
if(H5Fclose(file) < 0)
STACK_ERROR
@@ -7003,6 +7051,8 @@ test_find_neighbor(hid_t fapl)
error:
H5E_BEGIN_TRY {
+ if(bt2)
+ H5B2_close(bt2, dxpl);
H5Fclose(file);
} H5E_END_TRY;
HDfree(records);
@@ -7017,7 +7067,6 @@ error:
* code to delete a B-tree from a file
*
* Return: Success: 0
- *
* Failure: 1
*
* Programmer: Quincey Koziol
@@ -7026,15 +7075,17 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_delete(hid_t fapl)
+test_delete(hid_t fapl, const H5B2_create_t *cparam)
{
- hid_t file=-1;
- char filename[1024];
- H5F_t *f=NULL;
+ hid_t file = -1; /* File ID */
+ char filename[1024]; /* Filename to use */
+ H5F_t *f = NULL; /* Internal file object pointer */
h5_stat_size_t empty_size; /* Size of an empty file */
h5_stat_size_t file_size; /* Size of each file created */
- hsize_t record; /* Record to insert into tree */
+ hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */
+ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
haddr_t bt2_addr; /* Address of B-tree created */
+ hsize_t record; /* Record to insert into tree */
H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
unsigned u; /* Local index variable */
@@ -7065,16 +7116,19 @@ test_delete(hid_t fapl)
if(NULL == (f = (H5F_t *)H5I_object(file)))
STACK_ERROR
- /*
- * Create v2 B-tree
- */
- if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, 512, 8, 100, 40, &bt2_addr/*out*/) < 0)
+ /* Create the v2 B-tree & get its address */
+ if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0)
+ TEST_ERROR
+
+ /* Close the v2 B-tree */
+ if(H5B2_close(bt2, dxpl) < 0)
FAIL_STACK_ERROR
+ bt2 = NULL;
/*
* Delete v2 B-tree
*/
- if(H5B2_delete(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, NULL, NULL) < 0)
+ if(H5B2_delete(f, dxpl, bt2_addr, NULL, NULL) < 0)
FAIL_STACK_ERROR
/* Close the file */
@@ -7102,29 +7156,32 @@ test_delete(hid_t fapl)
if(NULL == (f = (H5F_t *)H5I_object(file)))
STACK_ERROR
- /*
- * Create v2 B-tree
- */
- if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, 512, 8, 100, 40, &bt2_addr/*out*/) < 0)
- FAIL_STACK_ERROR
+ /* Create the v2 B-tree & get its address */
+ if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0)
+ TEST_ERROR
/* Insert records */
for(u = 0; u < DELETE_SMALL; u++) {
record = u;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- if(H5B2_stat_info(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &bt2_stat) < 0)
+ if(H5B2_stat_info(bt2, &bt2_stat) < 0)
FAIL_STACK_ERROR
if(bt2_stat.depth != 0)
TEST_ERROR
+ /* Close the v2 B-tree */
+ if(H5B2_close(bt2, dxpl) < 0)
+ FAIL_STACK_ERROR
+ bt2 = NULL;
+
/*
* Delete v2 B-tree
*/
- if(H5B2_delete(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, NULL, NULL) < 0)
+ if(H5B2_delete(f, H5P_DATASET_XFER_DEFAULT, bt2_addr, NULL, NULL) < 0)
FAIL_STACK_ERROR
/* Close file */
@@ -7152,29 +7209,32 @@ test_delete(hid_t fapl)
if(NULL == (f = (H5F_t *)H5I_object(file)))
STACK_ERROR
- /*
- * Create v2 B-tree
- */
- if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, 512, 8, 100, 40, &bt2_addr/*out*/) < 0)
- FAIL_STACK_ERROR
+ /* Create the v2 B-tree & get its address */
+ if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0)
+ TEST_ERROR
/* Insert records */
for(u = 0; u < DELETE_MEDIUM; u++) {
record = u;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- if(H5B2_stat_info(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &bt2_stat) < 0)
+ if(H5B2_stat_info(bt2, &bt2_stat) < 0)
FAIL_STACK_ERROR
if(bt2_stat.depth != 1)
TEST_ERROR
+ /* Close the v2 B-tree */
+ if(H5B2_close(bt2, dxpl) < 0)
+ FAIL_STACK_ERROR
+ bt2 = NULL;
+
/*
* Delete v2 B-tree
*/
- if(H5B2_delete(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, NULL, NULL) < 0)
+ if(H5B2_delete(f, dxpl, bt2_addr, NULL, NULL) < 0)
FAIL_STACK_ERROR
/* Close file */
@@ -7202,29 +7262,32 @@ test_delete(hid_t fapl)
if(NULL == (f = (H5F_t *)H5I_object(file)))
STACK_ERROR
- /*
- * Create v2 B-tree
- */
- if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, 512, 8, 100, 40, &bt2_addr/*out*/) < 0)
- FAIL_STACK_ERROR
+ /* Create the v2 B-tree & get its address */
+ if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0)
+ TEST_ERROR
/* Insert records */
for(u = 0; u < DELETE_LARGE; u++) {
record = u;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- if(H5B2_stat_info(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &bt2_stat) < 0)
+ if(H5B2_stat_info(bt2, &bt2_stat) < 0)
FAIL_STACK_ERROR
if(bt2_stat.depth != 2)
TEST_ERROR
+ /* Close the v2 B-tree */
+ if(H5B2_close(bt2, dxpl) < 0)
+ FAIL_STACK_ERROR
+ bt2 = NULL;
+
/*
* Delete v2 B-tree
*/
- if(H5B2_delete(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, NULL, NULL) < 0)
+ if(H5B2_delete(f, dxpl, bt2_addr, NULL, NULL) < 0)
FAIL_STACK_ERROR
/* Close file */
@@ -7245,6 +7308,8 @@ test_delete(hid_t fapl)
error:
H5E_BEGIN_TRY {
+ if(bt2)
+ H5B2_close(bt2, dxpl);
H5Fclose(file);
} H5E_END_TRY;
return 1;
@@ -7258,7 +7323,6 @@ error:
* code to modify an existing record in the B-tree
*
* Return: Success: 0
- *
* Failure: 1
*
* Programmer: Quincey Koziol
@@ -7267,13 +7331,15 @@ error:
*-------------------------------------------------------------------------
*/
static unsigned
-test_modify(hid_t fapl)
+test_modify(hid_t fapl, const H5B2_create_t *cparam,
+ const bt2_test_param_t *tparam)
{
- hid_t file=-1;
- char filename[1024];
- H5F_t *f=NULL;
- hsize_t record; /* Record to insert into tree */
+ hid_t file = -1; /* File ID */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */
+ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
haddr_t bt2_addr; /* Address of B-tree created */
+ hsize_t record; /* Record to insert into tree */
hsize_t modify; /* Modified value */
hsize_t found; /* Found value */
H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
@@ -7281,36 +7347,28 @@ test_modify(hid_t fapl)
unsigned u; /* Local index variable */
herr_t ret; /* Generic error return value */
- h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
-
/*
* Test modifying records
*/
TESTING("B-tree modify: attempt to modify non-existant record");
- /* Create the file to work on */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- STACK_ERROR
-
- /* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5I_object(file)))
- STACK_ERROR
+ /* Create the file for the test */
+ if(create_file(&file, &f, fapl) < 0)
+ TEST_ERROR
- /*
- * Create v2 B-tree
- */
- if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, 512, 8, 100, 40, &bt2_addr/*out*/) < 0)
- FAIL_STACK_ERROR
+ /* Create the v2 B-tree & get its address */
+ if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0)
+ TEST_ERROR
/* Create level-2 B-tree with 3 internal nodes */
for(u = 0; u < ((INSERT_SPLIT_ROOT_NREC * 59) + 1); u++) {
record = u * 5;
- if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0)
+ if(H5B2_insert(bt2, dxpl, &record) < 0)
FAIL_STACK_ERROR
} /* end for */
/* Check up on B-tree */
- if(H5B2_stat_info(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &bt2_stat) < 0)
+ if(H5B2_stat_info(bt2, &bt2_stat) < 0)
FAIL_STACK_ERROR
if(bt2_stat.depth != 2)
TEST_ERROR
@@ -7319,7 +7377,7 @@ test_modify(hid_t fapl)
record = 3;
modify = 4;
H5E_BEGIN_TRY {
- ret = H5B2_modify(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, modify_cb, &modify);
+ ret = H5B2_modify(bt2, dxpl, &record, modify_cb, &modify);
} H5E_END_TRY;
/* Should fail */
if(ret != FAIL)
@@ -7329,32 +7387,34 @@ test_modify(hid_t fapl)
TESTING("B-tree modify: modify record in leaf node");
- record = 4330; /* Record in leaf node */
- if(H5B2_get_node_info_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, &ninfo) < 0)
- FAIL_STACK_ERROR
- if(ninfo.depth != 0)
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
- if(ninfo.nrec != 62)
+
+ /* Check status of B-tree */
+ ninfo.depth = 0;
+ ninfo.nrec = 62;
+ record = 4330; /* Record in leaf node */
+ if(check_node_info(bt2, dxpl, record, &ninfo) < 0)
TEST_ERROR
/* Attempt to modify a record in a leaf node */
record = 4330;
modify = 4331;
- if(H5B2_modify(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, modify_cb, &modify) < 0)
+ if(H5B2_modify(bt2, dxpl, &record, modify_cb, &modify) < 0)
FAIL_STACK_ERROR
+ /* Check status of B-tree */
+ ninfo.depth = 0;
+ ninfo.nrec = 62;
record = 4331; /* Record in leaf node */
- if(H5B2_get_node_info_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, &ninfo) < 0)
- FAIL_STACK_ERROR
- if(ninfo.depth != 0)
- TEST_ERROR
- if(ninfo.nrec != 62)
+ if(check_node_info(bt2, dxpl, record, &ninfo) < 0)
TEST_ERROR
/* Attempt to find modified record */
record = 4331;
found = 4331;
- if(H5B2_find(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, find_cb, &found) != TRUE)
+ if(H5B2_find(bt2, dxpl, &record, find_cb, &found) != TRUE)
FAIL_STACK_ERROR
if(found != 4331)
TEST_ERROR
@@ -7363,7 +7423,7 @@ test_modify(hid_t fapl)
record = 4330;
found = HSIZET_MAX;
H5E_BEGIN_TRY {
- ret = H5B2_modify(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, modify_cb, &modify);
+ ret = H5B2_modify(bt2, dxpl, &record, modify_cb, &modify);
} H5E_END_TRY;
/* Should fail */
if(ret != FAIL)
@@ -7373,32 +7433,34 @@ test_modify(hid_t fapl)
TESTING("B-tree modify: modify record in internal node");
- record = 5350; /* Record in internal node */
- if(H5B2_get_node_info_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, &ninfo) < 0)
- FAIL_STACK_ERROR
- if(ninfo.depth != 1)
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
- if(ninfo.nrec != 29)
+
+ /* Check status of B-tree */
+ ninfo.depth = 1;
+ ninfo.nrec = 29;
+ record = 5350; /* Record in internal node */
+ if(check_node_info(bt2, dxpl, record, &ninfo) < 0)
TEST_ERROR
/* Attempt to modify a record in an internal node */
record = 5350;
modify = 5352;
- if(H5B2_modify(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, modify_cb, &modify) < 0)
+ if(H5B2_modify(bt2, dxpl, &record, modify_cb, &modify) < 0)
FAIL_STACK_ERROR
+ /* Check status of B-tree */
+ ninfo.depth = 1;
+ ninfo.nrec = 29;
record = 5352; /* Record in internal node */
- if(H5B2_get_node_info_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, &ninfo) < 0)
- FAIL_STACK_ERROR
- if(ninfo.depth != 1)
- TEST_ERROR
- if(ninfo.nrec != 29)
+ if(check_node_info(bt2, dxpl, record, &ninfo) < 0)
TEST_ERROR
/* Attempt to find modified record */
record = 5352;
found = 5352;
- if(H5B2_find(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, find_cb, &found) != TRUE)
+ if(H5B2_find(bt2, dxpl, &record, find_cb, &found) != TRUE)
STACK_ERROR
if(found != 5352)
TEST_ERROR
@@ -7407,7 +7469,7 @@ test_modify(hid_t fapl)
record = 5350;
found = 5350;
H5E_BEGIN_TRY {
- ret = H5B2_modify(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, modify_cb, &modify);
+ ret = H5B2_modify(bt2, dxpl, &record, modify_cb, &modify);
} H5E_END_TRY;
/* Should fail */
if(ret != FAIL)
@@ -7417,32 +7479,34 @@ test_modify(hid_t fapl)
TESTING("B-tree modify: modify record in root node");
- record = 9445; /* Record in root node */
- if(H5B2_get_node_info_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, &ninfo) < 0)
- FAIL_STACK_ERROR
- if(ninfo.depth != 2)
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
TEST_ERROR
- if(ninfo.nrec != 2)
+
+ /* Check status of B-tree */
+ ninfo.depth = 2;
+ ninfo.nrec = 2;
+ record = 9445; /* Record in root node */
+ if(check_node_info(bt2, dxpl, record, &ninfo) < 0)
TEST_ERROR
/* Attempt to modify a record in a root node */
record = 9445;
modify = 9448;
- if(H5B2_modify(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, modify_cb, &modify) < 0)
+ if(H5B2_modify(bt2, dxpl, &record, modify_cb, &modify) < 0)
FAIL_STACK_ERROR
+ /* Check status of B-tree */
+ ninfo.depth = 2;
+ ninfo.nrec = 2;
record = 9448; /* Record in root node */
- if(H5B2_get_node_info_test(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, &ninfo) < 0)
- FAIL_STACK_ERROR
- if(ninfo.depth != 2)
- TEST_ERROR
- if(ninfo.nrec != 2)
+ if(check_node_info(bt2, dxpl, record, &ninfo) < 0)
TEST_ERROR
/* Attempt to find modified record */
record = 9448;
found = 9448;
- if(H5B2_find(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, find_cb, &found) != TRUE)
+ if(H5B2_find(bt2, dxpl, &record, find_cb, &found) != TRUE)
STACK_ERROR
if(found != 9448)
TEST_ERROR
@@ -7451,12 +7515,17 @@ test_modify(hid_t fapl)
record = 9445;
found = 9445;
H5E_BEGIN_TRY {
- ret = H5B2_modify(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record, modify_cb, &modify);
+ ret = H5B2_modify(bt2, dxpl, &record, modify_cb, &modify);
} H5E_END_TRY;
/* Should fail */
if(ret != FAIL)
TEST_ERROR
+ /* Close the v2 B-tree */
+ if(H5B2_close(bt2, dxpl) < 0)
+ FAIL_STACK_ERROR
+ bt2 = NULL;
+
/* Close file */
if(H5Fclose(file) < 0)
TEST_ERROR
@@ -7467,6 +7536,8 @@ test_modify(hid_t fapl)
error:
H5E_BEGIN_TRY {
+ if(bt2)
+ H5B2_close(bt2, dxpl);
H5Fclose(file);
} H5E_END_TRY;
return 1;
@@ -7490,8 +7561,11 @@ error:
int
main(void)
{
+ H5B2_create_t cparam; /* Creation parameters for v2 B-tree */
+ bt2_test_param_t tparam; /* Test parameters for v2 B-tree */
hid_t fapl = -1; /* File access property list for data files */
unsigned nerrors = 0; /* Cumulative error count */
+ hbool_t reopen; /* Whether to reopen B-tree during tests */
int ExpressMode;
const char *envval = NULL;
@@ -7503,64 +7577,80 @@ main(void)
h5_reset();
fapl = h5_fileaccess();
ExpressMode = GetTestExpress();
- if (ExpressMode > 1)
+ if(ExpressMode > 1)
printf("***Express test mode on. Some tests may be skipped\n");
- /* Test B-tree record insertion */
- /* Iteration, find & index routines tested in these routines as well */
- nerrors += test_insert_basic(fapl);
- nerrors += test_insert_split_root(fapl);
- nerrors += test_insert_level1_2leaf_redistrib(fapl);
- nerrors += test_insert_level1_side_split(fapl);
- nerrors += test_insert_level1_3leaf_redistrib(fapl);
- nerrors += test_insert_level1_middle_split(fapl);
- nerrors += test_insert_make_level2(fapl);
- nerrors += test_insert_level2_leaf_redistrib(fapl);
- nerrors += test_insert_level2_leaf_split(fapl);
- nerrors += test_insert_level2_2internal_redistrib(fapl);
- nerrors += test_insert_level2_2internal_split(fapl);
- nerrors += test_insert_level2_3internal_redistrib(fapl);
- nerrors += test_insert_level2_3internal_split(fapl);
- if (ExpressMode > 1)
- printf("***Express test mode on. test_insert_lots skipped\n");
- else
- nerrors += test_insert_lots(fapl);
-
- /* Test B-tree record removal */
- /* Querying the number of records routine also tested in these routines as well */
- nerrors += test_remove_basic(fapl);
- nerrors += test_remove_level1_noredistrib(fapl);
- nerrors += test_remove_level1_redistrib(fapl);
- nerrors += test_remove_level1_2leaf_merge(fapl);
- nerrors += test_remove_level1_3leaf_merge(fapl);
- nerrors += test_remove_level1_promote(fapl);
- nerrors += test_remove_level1_promote_2leaf_redistrib(fapl);
- nerrors += test_remove_level1_promote_3leaf_redistrib(fapl);
- nerrors += test_remove_level1_promote_2leaf_merge(fapl);
- nerrors += test_remove_level1_promote_3leaf_merge(fapl);
- nerrors += test_remove_level1_collapse(fapl);
- nerrors += test_remove_level2_promote(fapl);
- nerrors += test_remove_level2_promote_2internal_redistrib(fapl);
- nerrors += test_remove_level2_promote_3internal_redistrib(fapl);
- nerrors += test_remove_level2_promote_2internal_merge(fapl);
- nerrors += test_remove_level2_promote_3internal_merge(fapl);
- nerrors += test_remove_level2_2internal_merge_left(fapl);
- nerrors += test_remove_level2_2internal_merge_right(fapl);
- nerrors += test_remove_level2_3internal_merge(fapl);
- nerrors += test_remove_level2_collapse_right(fapl);
- if (ExpressMode > 1)
- printf("***Express test mode on. test_remove_lots skipped\n");
- else
- nerrors += test_remove_lots(envval, fapl);
-
- /* Test more complex B-tree queries */
- nerrors += test_find_neighbor(fapl);
-
- /* Test deleting B-trees */
- nerrors += test_delete(fapl);
-
- /* Test modifying B-tree records */
- nerrors += test_modify(fapl);
+ /* Initialize v2 B-tree creation parameters */
+ init_cparam(&cparam);
+
+
+ /* Loop over re-opening B-tree during tests */
+ for(reopen = FALSE; reopen <= TRUE; reopen++) {
+ if(reopen) {
+ fprintf(stdout, "Testing with reopening B-tree:\n");
+ tparam.reopen_btree = TRUE;
+ } /* end if */
+ else {
+ fprintf(stdout, "Testing without reopening B-tree:\n");
+ tparam.reopen_btree = FALSE;
+ } /* end else */
+
+ /* Test B-tree record insertion */
+ /* Iteration, find & index routines tested in these routines as well */
+ nerrors += test_insert_basic(fapl, &cparam, &tparam);
+ nerrors += test_insert_split_root(fapl, &cparam, &tparam);
+ nerrors += test_insert_level1_2leaf_redistrib(fapl, &cparam, &tparam);
+ nerrors += test_insert_level1_side_split(fapl, &cparam, &tparam);
+ nerrors += test_insert_level1_3leaf_redistrib(fapl, &cparam, &tparam);
+ nerrors += test_insert_level1_middle_split(fapl, &cparam, &tparam);
+ nerrors += test_insert_make_level2(fapl, &cparam, &tparam);
+ nerrors += test_insert_level2_leaf_redistrib(fapl, &cparam, &tparam);
+ nerrors += test_insert_level2_leaf_split(fapl, &cparam, &tparam);
+ nerrors += test_insert_level2_2internal_redistrib(fapl, &cparam, &tparam);
+ nerrors += test_insert_level2_2internal_split(fapl, &cparam, &tparam);
+ nerrors += test_insert_level2_3internal_redistrib(fapl, &cparam, &tparam);
+ nerrors += test_insert_level2_3internal_split(fapl, &cparam, &tparam);
+ if(ExpressMode > 1)
+ printf("***Express test mode on. test_insert_lots skipped\n");
+ else
+ nerrors += test_insert_lots(fapl, &cparam, &tparam);
+
+ /* Test B-tree record removal */
+ /* Querying the number of records routine also tested in these routines as well */
+ nerrors += test_remove_basic(fapl, &cparam, &tparam);
+ nerrors += test_remove_level1_noredistrib(fapl, &cparam, &tparam);
+ nerrors += test_remove_level1_redistrib(fapl, &cparam, &tparam);
+ nerrors += test_remove_level1_2leaf_merge(fapl, &cparam, &tparam);
+ nerrors += test_remove_level1_3leaf_merge(fapl, &cparam, &tparam);
+ nerrors += test_remove_level1_promote(fapl, &cparam, &tparam);
+ nerrors += test_remove_level1_promote_2leaf_redistrib(fapl, &cparam, &tparam);
+ nerrors += test_remove_level1_promote_3leaf_redistrib(fapl, &cparam, &tparam);
+ nerrors += test_remove_level1_promote_2leaf_merge(fapl, &cparam, &tparam);
+ nerrors += test_remove_level1_promote_3leaf_merge(fapl, &cparam, &tparam);
+ nerrors += test_remove_level1_collapse(fapl, &cparam, &tparam);
+ nerrors += test_remove_level2_promote(fapl, &cparam, &tparam);
+ nerrors += test_remove_level2_promote_2internal_redistrib(fapl, &cparam, &tparam);
+ nerrors += test_remove_level2_promote_3internal_redistrib(fapl, &cparam, &tparam);
+ nerrors += test_remove_level2_promote_2internal_merge(fapl, &cparam, &tparam);
+ nerrors += test_remove_level2_promote_3internal_merge(fapl, &cparam, &tparam);
+ nerrors += test_remove_level2_2internal_merge_left(fapl, &cparam, &tparam);
+ nerrors += test_remove_level2_2internal_merge_right(fapl, &cparam, &tparam);
+ nerrors += test_remove_level2_3internal_merge(fapl, &cparam, &tparam);
+ nerrors += test_remove_level2_collapse_right(fapl, &cparam, &tparam);
+ if(ExpressMode > 1)
+ printf("***Express test mode on. test_remove_lots skipped\n");
+ else
+ nerrors += test_remove_lots(envval, fapl, &cparam);
+
+ /* Test more complex B-tree queries */
+ nerrors += test_find_neighbor(fapl, &cparam, &tparam);
+
+ /* Test deleting B-trees */
+ nerrors += test_delete(fapl, &cparam);
+
+ /* Test modifying B-tree records */
+ nerrors += test_modify(fapl, &cparam, &tparam);
+ } /* end for */
if(nerrors)
goto error;
diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c
index 53c63d7..b154f51 100644
--- a/test/cmpd_dset.c
+++ b/test/cmpd_dset.c
@@ -199,6 +199,7 @@ test_compound (char *filename, hid_t fapl)
hsize_t f_offset[2]; /*offset of hyperslab in file */
hsize_t h_size[2]; /*size of hyperslab */
hsize_t memb_size[1] = {4};
+ int ret_code;
/* Create the file */
if ((file = H5Fcreate (filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) {
@@ -209,8 +210,19 @@ test_compound (char *filename, hid_t fapl)
if ((space = H5Screate_simple (2, dim, NULL)) < 0) goto error;
/* Create xfer properties to preserve initialized data */
- if ((PRESERVE = H5Pcreate (H5P_DATASET_XFER)) < 0) goto error;
- if (H5Pset_preserve (PRESERVE, 1) < 0) goto error;
+ /* Also verify H5Pset_preserve is initially 0 and then is set to 1. */
+ if ((PRESERVE = H5Pcreate (H5P_DATASET_XFER))<0) goto error;
+ if ((ret_code=H5Pget_preserve (PRESERVE)) != 0){
+ printf("Preserve status of dataset transfer property list should be"
+ " 0 (FALSE), got %d\n", ret_code);
+ goto error;
+ }
+ if (H5Pset_preserve (PRESERVE, 1)<0) goto error;
+ if ((ret_code=H5Pget_preserve (PRESERVE)) != 1){
+ printf("Preserve status of dataset transfer property list should be"
+ " 1 (TRUE), got %d\n", ret_code);
+ goto error;
+ }
/*
*######################################################################
@@ -1738,7 +1750,8 @@ error:
* Function: test_pack_ooo
*
* Purpose: Test inserting fields into a compound out of offset order.
- * Verifies that the compound
+ * Verifies that the compound is correctly marked as packed
+ * or non-packed.
*
* Return: Success: 0
*
@@ -1760,6 +1773,8 @@ test_pack_ooo(void)
unsigned num_free; /* Number of free slots in order */
unsigned sub_cmpd_order; /* Order to insert the inner compound */
char name[6]; /* Member name */
+ unsigned extra_space; /* Whether to add extra space to the end of
+ * the compound */
unsigned i, j; /* Indices */
HDsrand((unsigned) time(NULL));
@@ -1787,171 +1802,353 @@ test_pack_ooo(void)
/* Generate order to insert inner compound type */
sub_cmpd_order = HDrand() % PACK_NMEMBS;
- TESTING("random member insertion with empty compound subtype");
+ for(extra_space=0; extra_space<2; extra_space ++) {
+ if(extra_space)
+ puts("With extra space at the end of compound...");
+ else
+ puts("Without extra space at the end of compound...");
- /* Create inner compound type. It will be empty for the first run */
- if((sub_cmpd = H5Tcreate(H5T_COMPOUND, 4)) < 0) PACK_OOO_ERROR
+ TESTING("random member insertion with empty compound subtype");
- /* Create main compound type, with extra space at the end */
- if((cmpd = H5Tcreate(H5T_COMPOUND, (4 * PACK_NMEMBS) + 1)) < 0) PACK_OOO_ERROR
+ /* Create inner compound type. It will be empty for the first run */
+ if((sub_cmpd = H5Tcreate(H5T_COMPOUND, 4)) < 0) PACK_OOO_ERROR
- /* Insert the compound members in the random order previously generated */
- for(i=0; i<PACK_NMEMBS; i++) {
- sprintf(name, "%05d", i);
- if(i == sub_cmpd_order) {
- if(H5Tinsert(cmpd, name, 4 * order[i], sub_cmpd) < 0) PACK_OOO_ERROR
- } else
- if(H5Tinsert(cmpd, name, 4 * order[i], H5T_STD_I32BE) < 0) PACK_OOO_ERROR
- } /* end for */
+ /* Create main compound type, with extra space at the end */
+ if((cmpd = H5Tcreate(H5T_COMPOUND, (4 * PACK_NMEMBS) + extra_space)) < 0) PACK_OOO_ERROR
- /* Verify that the compound is not packed */
- if(NULL == (dt = (H5T_t *) H5I_object_verify(cmpd, H5I_DATATYPE))) PACK_OOO_ERROR
- if(dt->shared->u.compnd.packed) PACK_OOO_ERROR
+ /* Insert the compound members in the random order previously generated */
+ for(i=0; i<PACK_NMEMBS; i++) {
+ sprintf(name, "%05d", i);
+ if(i == sub_cmpd_order) {
+ if(H5Tinsert(cmpd, name, 4 * order[i], sub_cmpd) < 0) PACK_OOO_ERROR
+ } else
+ if(H5Tinsert(cmpd, name, 4 * order[i], H5T_STD_I32BE) < 0) PACK_OOO_ERROR
+ } /* end for */
- /* Close the main compound */
- if(H5Tclose(cmpd) < 0) PACK_OOO_ERROR
+ /* Verify that the compound is not packed */
+ if(NULL == (dt = (H5T_t *) H5I_object_verify(cmpd, H5I_DATATYPE))) PACK_OOO_ERROR
+ if(dt->shared->u.compnd.packed) PACK_OOO_ERROR
- PASSED();
+ /* Close the main compound */
+ if(H5Tclose(cmpd) < 0) PACK_OOO_ERROR
- TESTING("random member insertion with full compound subtype");
+ PASSED();
- /* Complete the inner compound type */
- if(H5Tinsert(sub_cmpd, "int", 0, H5T_STD_I32LE) < 0) PACK_OOO_ERROR
+ TESTING("random member insertion with full compound subtype");
- /* Recreate main compound type */
- if((cmpd = H5Tcreate(H5T_COMPOUND, (4 * PACK_NMEMBS) + 1)) < 0) PACK_OOO_ERROR
+ /* Complete the inner compound type */
+ if(H5Tinsert(sub_cmpd, "int", 0, H5T_STD_I32LE) < 0) PACK_OOO_ERROR
- /* Insert the compound members in the random order previously generated */
- for(i=0; i<PACK_NMEMBS; i++) {
- sprintf(name, "%05d", i);
- if(i == sub_cmpd_order) {
- if(H5Tinsert(cmpd, name, 4 * order[i], sub_cmpd) < 0) PACK_OOO_ERROR
- } else
- if(H5Tinsert(cmpd, name, 4 * order[i], H5T_STD_I32BE) < 0) PACK_OOO_ERROR
- } /* end for */
+ /* Recreate main compound type */
+ if((cmpd = H5Tcreate(H5T_COMPOUND, (4 * PACK_NMEMBS) + extra_space)) < 0) PACK_OOO_ERROR
- /* Verify that the compound is packed */
- if(NULL == (dt = (H5T_t *) H5I_object_verify(cmpd, H5I_DATATYPE))) PACK_OOO_ERROR
- if(!dt->shared->u.compnd.packed) PACK_OOO_ERROR
+ /* Insert the compound members in the random order previously generated */
+ for(i=0; i<PACK_NMEMBS; i++) {
+ sprintf(name, "%05d", i);
+ if(i == sub_cmpd_order) {
+ if(H5Tinsert(cmpd, name, 4 * order[i], sub_cmpd) < 0) PACK_OOO_ERROR
+ } else
+ if(H5Tinsert(cmpd, name, 4 * order[i], H5T_STD_I32BE) < 0) PACK_OOO_ERROR
+ } /* end for */
- /* Close */
- if(H5Tclose(cmpd) < 0) PACK_OOO_ERROR
- if(H5Tclose(sub_cmpd) < 0) PACK_OOO_ERROR
+ /* Verify that the compound is not packed */
+ if(NULL == (dt = (H5T_t *) H5I_object_verify(cmpd, H5I_DATATYPE))) PACK_OOO_ERROR
+ if(dt->shared->u.compnd.packed != !extra_space) PACK_OOO_ERROR
- PASSED();
+ /* Close */
+ if(H5Tclose(cmpd) < 0) PACK_OOO_ERROR
+ if(H5Tclose(sub_cmpd) < 0) PACK_OOO_ERROR
- TESTING("reverse member insertion with empty compound subtype");
+ PASSED();
- /* Create inner compound type. It will be empty for the first run */
- if((sub_cmpd = H5Tcreate(H5T_COMPOUND, 4)) < 0) PACK_OOO_ERROR
+ TESTING("reverse member insertion with empty compound subtype");
- /* Create main compound type, with extra space at the end */
- if((cmpd = H5Tcreate(H5T_COMPOUND, (4 * PACK_NMEMBS) + 1)) < 0) PACK_OOO_ERROR
+ /* Create inner compound type. It will be empty for the first run */
+ if((sub_cmpd = H5Tcreate(H5T_COMPOUND, 4)) < 0) PACK_OOO_ERROR
- /* Insert the compound members in reverse order, with compound last */
- for(i=0; i<PACK_NMEMBS; i++) {
- sprintf(name, "%05d", i);
- if(i == PACK_NMEMBS - 1) {
- if(H5Tinsert(cmpd, name, 4 * (PACK_NMEMBS - i - 1), sub_cmpd) < 0) PACK_OOO_ERROR
- } else
- if(H5Tinsert(cmpd, name, 4 * (PACK_NMEMBS - i - 1), H5T_STD_I32BE) < 0) PACK_OOO_ERROR
- } /* end for */
+ /* Create main compound type, with extra space at the end */
+ if((cmpd = H5Tcreate(H5T_COMPOUND, (4 * PACK_NMEMBS) + extra_space)) < 0) PACK_OOO_ERROR
- /* Verify that the compound is not packed */
- if(NULL == (dt = (H5T_t *) H5I_object_verify(cmpd, H5I_DATATYPE))) PACK_OOO_ERROR
- if(dt->shared->u.compnd.packed) PACK_OOO_ERROR
+ /* Insert the compound members in reverse order, with compound last */
+ for(i=0; i<PACK_NMEMBS; i++) {
+ sprintf(name, "%05d", i);
+ if(i == PACK_NMEMBS - 1) {
+ if(H5Tinsert(cmpd, name, 4 * (PACK_NMEMBS - i - 1), sub_cmpd) < 0) PACK_OOO_ERROR
+ } else
+ if(H5Tinsert(cmpd, name, 4 * (PACK_NMEMBS - i - 1), H5T_STD_I32BE) < 0) PACK_OOO_ERROR
+ } /* end for */
- /* Close the main compound */
- if(H5Tclose(cmpd) < 0) PACK_OOO_ERROR
+ /* Verify that the compound is not packed */
+ if(NULL == (dt = (H5T_t *) H5I_object_verify(cmpd, H5I_DATATYPE))) PACK_OOO_ERROR
+ if(dt->shared->u.compnd.packed) PACK_OOO_ERROR
- PASSED();
+ /* Close the main compound */
+ if(H5Tclose(cmpd) < 0) PACK_OOO_ERROR
- TESTING("reverse member insertion with full compound subtype");
+ PASSED();
- /* Complete the inner compound type */
- if(H5Tinsert(sub_cmpd, "int", 0, H5T_STD_I32LE) < 0) PACK_OOO_ERROR
+ TESTING("reverse member insertion with full compound subtype");
- /* Recreate main compound type */
- if((cmpd = H5Tcreate(H5T_COMPOUND, (4 * PACK_NMEMBS) + 1)) < 0) PACK_OOO_ERROR
+ /* Complete the inner compound type */
+ if(H5Tinsert(sub_cmpd, "int", 0, H5T_STD_I32LE) < 0) PACK_OOO_ERROR
- /* Insert the compound members in reverse order, with compound last */
- for(i=0; i<PACK_NMEMBS; i++) {
- sprintf(name, "%05d", i);
- if(i == PACK_NMEMBS - 1) {
- if(H5Tinsert(cmpd, name, 4 * (PACK_NMEMBS - i - 1), sub_cmpd) < 0) PACK_OOO_ERROR
- } else
- if(H5Tinsert(cmpd, name, 4 * (PACK_NMEMBS - i - 1), H5T_STD_I32BE) < 0) PACK_OOO_ERROR
- } /* end for */
+ /* Recreate main compound type */
+ if((cmpd = H5Tcreate(H5T_COMPOUND, (4 * PACK_NMEMBS) + extra_space)) < 0) PACK_OOO_ERROR
- /* Verify that the compound is packed */
- if(NULL == (dt = (H5T_t *) H5I_object_verify(cmpd, H5I_DATATYPE))) PACK_OOO_ERROR
- if(!dt->shared->u.compnd.packed) PACK_OOO_ERROR
+ /* Insert the compound members in reverse order, with compound last */
+ for(i=0; i<PACK_NMEMBS; i++) {
+ sprintf(name, "%05d", i);
+ if(i == PACK_NMEMBS - 1) {
+ if(H5Tinsert(cmpd, name, 4 * (PACK_NMEMBS - i - 1), sub_cmpd) < 0) PACK_OOO_ERROR
+ } else
+ if(H5Tinsert(cmpd, name, 4 * (PACK_NMEMBS - i - 1), H5T_STD_I32BE) < 0) PACK_OOO_ERROR
+ } /* end for */
- /* Close */
- if(H5Tclose(cmpd) < 0) PACK_OOO_ERROR
- if(H5Tclose(sub_cmpd) < 0) PACK_OOO_ERROR
+ /* Verify that the compound is packed */
+ if(NULL == (dt = (H5T_t *) H5I_object_verify(cmpd, H5I_DATATYPE))) PACK_OOO_ERROR
+ if(dt->shared->u.compnd.packed != !extra_space) PACK_OOO_ERROR
- PASSED();
+ /* Close */
+ if(H5Tclose(cmpd) < 0) PACK_OOO_ERROR
+ if(H5Tclose(sub_cmpd) < 0) PACK_OOO_ERROR
- TESTING("forward member insertion with empty compound subtype");
+ PASSED();
- /* Create inner compound type. It will be empty for the first run */
- if((sub_cmpd = H5Tcreate(H5T_COMPOUND, 4)) < 0) PACK_OOO_ERROR
+ TESTING("forward member insertion with empty compound subtype");
- /* Create main compound type, with extra space at the end */
- if((cmpd = H5Tcreate(H5T_COMPOUND, (4 * PACK_NMEMBS) + 1)) < 0) PACK_OOO_ERROR
+ /* Create inner compound type. It will be empty for the first run */
+ if((sub_cmpd = H5Tcreate(H5T_COMPOUND, 4)) < 0) PACK_OOO_ERROR
- /* Insert the compound members in forward order, with compound first */
- for(i=0; i<PACK_NMEMBS; i++) {
- sprintf(name, "%05d", i);
- if(i == 0) {
- if(H5Tinsert(cmpd, name, 4 * i, sub_cmpd) < 0) PACK_OOO_ERROR
- } else
- if(H5Tinsert(cmpd, name, 4 * i, H5T_STD_I32BE) < 0) PACK_OOO_ERROR
+ /* Create main compound type, with extra space at the end */
+ if((cmpd = H5Tcreate(H5T_COMPOUND, (4 * PACK_NMEMBS) + extra_space)) < 0) PACK_OOO_ERROR
+
+ /* Insert the compound members in forward order, with compound first */
+ for(i=0; i<PACK_NMEMBS; i++) {
+ sprintf(name, "%05d", i);
+ if(i == 0) {
+ if(H5Tinsert(cmpd, name, 4 * i, sub_cmpd) < 0) PACK_OOO_ERROR
+ } else
+ if(H5Tinsert(cmpd, name, 4 * i, H5T_STD_I32BE) < 0) PACK_OOO_ERROR
+ } /* end for */
+
+ /* Verify that the compound is not packed */
+ if(NULL == (dt = (H5T_t *) H5I_object_verify(cmpd, H5I_DATATYPE))) PACK_OOO_ERROR
+ if(dt->shared->u.compnd.packed) PACK_OOO_ERROR
+
+ /* Close the main compound */
+ if(H5Tclose(cmpd) < 0) PACK_OOO_ERROR
+
+ PASSED();
+
+ TESTING("forward member insertion with full compound subtype");
+
+ /* Complete the inner compound type */
+ if(H5Tinsert(sub_cmpd, "int", 0, H5T_STD_I32LE) < 0) PACK_OOO_ERROR
+
+ /* Recreate main compound type */
+ if((cmpd = H5Tcreate(H5T_COMPOUND, (4 * PACK_NMEMBS) + extra_space)) < 0) PACK_OOO_ERROR
+
+ /* Insert the compound members in forward order */
+ for(i=0; i<PACK_NMEMBS; i++) {
+ sprintf(name, "%05d", i);
+ if(i == 0) {
+ if(H5Tinsert(cmpd, name, 4 * i, sub_cmpd) < 0) PACK_OOO_ERROR
+ } else
+ if(H5Tinsert(cmpd, name, 4 * i, H5T_STD_I32BE) < 0) PACK_OOO_ERROR
+ } /* end for */
+
+ /* Verify that the compound is packed */
+ if(NULL == (dt = (H5T_t *) H5I_object_verify(cmpd, H5I_DATATYPE))) PACK_OOO_ERROR
+ if(dt->shared->u.compnd.packed != !extra_space) PACK_OOO_ERROR
+
+ /* Close */
+ if(H5Tclose(cmpd) < 0) PACK_OOO_ERROR
+ if(H5Tclose(sub_cmpd) < 0) PACK_OOO_ERROR
+
+ PASSED();
} /* end for */
+ return 0;
+
+error:
+ puts("*** DATASET TESTS FAILED ***");
+ return 1;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_ooo_order
+ *
+ * Purpose: Test inserting fields into a compound out of offset order.
+ * Verifies that the order of compound members is the same as
+ * the order in which they were inserted. While this is
+ * explicitly not guaranteed by the documentation, the H5TB
+ * API currently makes this assumption.
+ *
+ * Return: Success: 0
+ *
+ * Failure: 1
+ *
+ * Programmer: Neil Fortner
+ * Monday, 19 October 2009
+ *
+ * Modifications:
+ *-------------------------------------------------------------------------
+ */
+static int
+test_ooo_order(char *filename)
+{
+ hid_t file; /* File ID */
+ hid_t dtype, dtype_tmp; /* Datatype IDs */
+ H5T_t *dt; /* Datatype pointer */
+
+ TESTING("that compound member insertion order is preserved")
+
+ /* Create the file */
+ if ((file = H5Fcreate (filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+
+ /* Create the compound */
+ if((dtype = H5Tcreate(H5T_COMPOUND, 20)) < 0) TEST_ERROR
+ if(H5Tinsert(dtype, "A", 8, H5T_STD_I32LE) < 0) TEST_ERROR
+ if(H5Tinsert(dtype, "B", 12, H5T_STD_I32LE) < 0) TEST_ERROR
+ if(H5Tinsert(dtype, "C", 0, H5T_STD_I32LE) < 0) TEST_ERROR
+ if(H5Tinsert(dtype, "D", 16, H5T_STD_I32LE) < 0) TEST_ERROR
+
/* Verify that the compound is not packed */
- if(NULL == (dt = (H5T_t *) H5I_object_verify(cmpd, H5I_DATATYPE))) PACK_OOO_ERROR
- if(dt->shared->u.compnd.packed) PACK_OOO_ERROR
+ if(NULL == (dt = (H5T_t *) H5I_object_verify(dtype, H5I_DATATYPE)))
+ TEST_ERROR
+ if(dt->shared->u.compnd.packed) TEST_ERROR
- /* Close the main compound */
- if(H5Tclose(cmpd) < 0) PACK_OOO_ERROR
+ /* Verify that the order is the same as the insertion order */
+ if(H5Tget_member_offset(dtype, 0) != 8) TEST_ERROR
+ if(H5Tget_member_offset(dtype, 1) != 12) TEST_ERROR
+ if(H5Tget_member_offset(dtype, 2) != 0) TEST_ERROR
+ if(H5Tget_member_offset(dtype, 3) != 16) TEST_ERROR
- PASSED();
+ /* Commit the datatype */
+ if(H5Tcommit2(file, "dtype", dtype, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
- TESTING("forward member insertion with full compound subtype");
+ /* Close and reopen the file */
+ if(H5Tclose(dtype)) TEST_ERROR
+ if(H5Fclose(file)) TEST_ERROR
+ if((file = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) TEST_ERROR
- /* Complete the inner compound type */
- if(H5Tinsert(sub_cmpd, "int", 0, H5T_STD_I32LE) < 0) PACK_OOO_ERROR
+ /* Open the type */
+ if((dtype_tmp = H5Topen2(file, "dtype", H5P_DEFAULT)) < 0) TEST_ERROR
- /* Recreate main compound type */
- if((cmpd = H5Tcreate(H5T_COMPOUND, (4 * PACK_NMEMBS) + 1)) < 0) PACK_OOO_ERROR
+ /* Verify that the compound is not packed */
+ if(NULL == (dt = (H5T_t *) H5I_object_verify(dtype_tmp, H5I_DATATYPE)))
+ TEST_ERROR
+ if(dt->shared->u.compnd.packed) TEST_ERROR
- /* Insert the compound members in forward order */
- for(i=0; i<PACK_NMEMBS; i++) {
- sprintf(name, "%05d", i);
- if(i == 0) {
- if(H5Tinsert(cmpd, name, 4 * i, sub_cmpd) < 0) PACK_OOO_ERROR
- } else
- if(H5Tinsert(cmpd, name, 4 * i, H5T_STD_I32BE) < 0) PACK_OOO_ERROR
- } /* end for */
+ /* Verify that the order is the same as the insertion order */
+ if(H5Tget_member_offset(dtype_tmp, 0) != 8) TEST_ERROR
+ if(H5Tget_member_offset(dtype_tmp, 1) != 12) TEST_ERROR
+ if(H5Tget_member_offset(dtype_tmp, 2) != 0) TEST_ERROR
+ if(H5Tget_member_offset(dtype_tmp, 3) != 16) TEST_ERROR
+
+ /* Copy the datatype */
+ if((dtype = H5Tcopy(dtype_tmp)) < 0) TEST_ERROR
+
+ /* Verify that the compound is not packed */
+ if(NULL == (dt = (H5T_t *) H5I_object_verify(dtype, H5I_DATATYPE)))
+ TEST_ERROR
+ if(dt->shared->u.compnd.packed) TEST_ERROR
+
+ /* Verify that the order is the same as the insertion order */
+ if(H5Tget_member_offset(dtype, 0) != 8) TEST_ERROR
+ if(H5Tget_member_offset(dtype, 1) != 12) TEST_ERROR
+ if(H5Tget_member_offset(dtype, 2) != 0) TEST_ERROR
+ if(H5Tget_member_offset(dtype, 3) != 16) TEST_ERROR
+
+ /* Insert the last member */
+ if(H5Tinsert(dtype, "E", 4, H5T_STD_I32LE) < 0) TEST_ERROR
/* Verify that the compound is packed */
- if(NULL == (dt = (H5T_t *) H5I_object_verify(cmpd, H5I_DATATYPE))) PACK_OOO_ERROR
- if(!dt->shared->u.compnd.packed) PACK_OOO_ERROR
+ if(NULL == (dt = (H5T_t *) H5I_object_verify(dtype, H5I_DATATYPE)))
+ TEST_ERROR
+ if(!dt->shared->u.compnd.packed) TEST_ERROR
+
+ /* Verify that the order is the same as the insertion order */
+ if(H5Tget_member_offset(dtype, 0) != 8) TEST_ERROR
+ if(H5Tget_member_offset(dtype, 1) != 12) TEST_ERROR
+ if(H5Tget_member_offset(dtype, 2) != 0) TEST_ERROR
+ if(H5Tget_member_offset(dtype, 3) != 16) TEST_ERROR
+ if(H5Tget_member_offset(dtype, 4) != 4) TEST_ERROR
+
+ /* Commit the modified datatype */
+ if(H5Tcommit2(file, "dtype2", dtype, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+
+ /* Close and reopen the file */
+ if(H5Tclose(dtype_tmp)) TEST_ERROR
+ if(H5Tclose(dtype)) TEST_ERROR
+ if(H5Fclose(file)) TEST_ERROR
+ if((file = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) TEST_ERROR
+
+ /* Open the type, and verify status */
+ if((dtype_tmp = H5Topen2(file, "dtype2", H5P_DEFAULT)) < 0) TEST_ERROR
+ if(NULL == (dt = (H5T_t *) H5I_object_verify(dtype_tmp, H5I_DATATYPE)))
+ TEST_ERROR
+ if(!dt->shared->u.compnd.packed) TEST_ERROR
+ if(H5Tget_member_offset(dtype_tmp, 0) != 8) TEST_ERROR
+ if(H5Tget_member_offset(dtype_tmp, 1) != 12) TEST_ERROR
+ if(H5Tget_member_offset(dtype_tmp, 2) != 0) TEST_ERROR
+ if(H5Tget_member_offset(dtype_tmp, 3) != 16) TEST_ERROR
+ if(H5Tget_member_offset(dtype_tmp, 4) != 4) TEST_ERROR
+
+ /* Copy the datatype, and verify status */
+ if((dtype = H5Tcopy(dtype_tmp)) < 0) TEST_ERROR
+ if(NULL == (dt = (H5T_t *) H5I_object_verify(dtype, H5I_DATATYPE)))
+ TEST_ERROR
+ if(!dt->shared->u.compnd.packed) TEST_ERROR
+ if(H5Tget_member_offset(dtype, 0) != 8) TEST_ERROR
+ if(H5Tget_member_offset(dtype, 1) != 12) TEST_ERROR
+ if(H5Tget_member_offset(dtype, 2) != 0) TEST_ERROR
+ if(H5Tget_member_offset(dtype, 3) != 16) TEST_ERROR
+ if(H5Tget_member_offset(dtype, 4) != 4) TEST_ERROR
+
+ /* Expand the type, and verify that it became unpacked */
+ if(H5Tset_size(dtype, 21) < 0) TEST_ERROR
+ if(NULL == (dt = (H5T_t *) H5I_object_verify(dtype, H5I_DATATYPE)))
+ TEST_ERROR
+ if(dt->shared->u.compnd.packed) TEST_ERROR
+ if(H5Tget_member_offset(dtype, 0) != 8) TEST_ERROR
+ if(H5Tget_member_offset(dtype, 1) != 12) TEST_ERROR
+ if(H5Tget_member_offset(dtype, 2) != 0) TEST_ERROR
+ if(H5Tget_member_offset(dtype, 3) != 16) TEST_ERROR
+ if(H5Tget_member_offset(dtype, 4) != 4) TEST_ERROR
+
+ /* Shrink the type, and verify that it became packed */
+ if(H5Tset_size(dtype, 20) < 0) TEST_ERROR
+ if(NULL == (dt = (H5T_t *) H5I_object_verify(dtype, H5I_DATATYPE)))
+ TEST_ERROR
+ if(!dt->shared->u.compnd.packed) TEST_ERROR
+ if(H5Tget_member_offset(dtype, 0) != 8) TEST_ERROR
+ if(H5Tget_member_offset(dtype, 1) != 12) TEST_ERROR
+ if(H5Tget_member_offset(dtype, 2) != 0) TEST_ERROR
+ if(H5Tget_member_offset(dtype, 3) != 16) TEST_ERROR
+ if(H5Tget_member_offset(dtype, 4) != 4) TEST_ERROR
/* Close */
- if(H5Tclose(cmpd) < 0) PACK_OOO_ERROR
- if(H5Tclose(sub_cmpd) < 0) PACK_OOO_ERROR
+ if(H5Tclose(dtype_tmp)) TEST_ERROR
+ if(H5Tclose(dtype)) TEST_ERROR
+ if(H5Fclose(file)) TEST_ERROR
PASSED();
-
return 0;
error:
+ H5E_BEGIN_TRY {
+ H5Tclose(dtype_tmp);
+ H5Tclose(dtype);
+ H5Fclose(file);
+ } H5E_END_TRY
puts("*** DATASET TESTS FAILED ***");
return 1;
-}
+} /* test_ooo_order */
/*-------------------------------------------------------------------------
@@ -2007,6 +2204,9 @@ main (int argc, char *argv[])
puts("Testing that compound types can be packed out of order:");
nerrors += test_pack_ooo();
+ puts("Testing compound member ordering:");
+ nerrors += test_ooo_order(fname);
+
if (nerrors) {
printf("***** %u FAILURE%s! *****\n",
nerrors, 1==nerrors?"":"S");
diff --git a/test/dsets.c b/test/dsets.c
index 2066860..07ee0d0 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -42,6 +42,7 @@
#define H5Z_PACKAGE
#include "H5Zpkg.h"
+
const char *FILENAME[] = {
"dataset", /* 0 */
"compact_dataset", /* 1 */
@@ -157,6 +158,7 @@ const char *FILENAME[] = {
/* Names for noencoder test */
#ifdef H5_HAVE_FILTER_SZIP
#define NOENCODER_FILENAME "noencoder.h5"
+#define NOENCODER_COPY_FILENAME "noencoder.h5.copy"
#define NOENCODER_TEST_DATASET "noencoder_tdset.h5"
#define NOENCODER_SZIP_DATASET "noencoder_szip_dset.h5"
#define NOENCODER_SZIP_SHUFF_FLETCH_DATASET "noencoder_szip_shuffle_fletcher_dset.h5"
@@ -1724,6 +1726,8 @@ error:
* Monday, June 7, 2004
*
* Modifications:
+ * Make copy of data file since the test writes to the file.
+ * Larry Knox, October 14, 2009
*
*-------------------------------------------------------------------------
*/
@@ -1741,20 +1745,14 @@ test_filter_noencoder(const char *dset_name)
int test_ints[10] = { 12 };
int read_buf[10];
int i;
- char * srcdir = HDgetenv("srcdir"); /* The source directory */
- char testfile[512]=""; /* Buffer to hold name of test file */
-
- /*
- * Create the name of the file to open (in case we are using the --srcdir
- * option and the file is in a different directory from this test).
- */
- if(srcdir && ((HDstrlen(srcdir) + HDstrlen(NOENCODER_FILENAME) + 1) < sizeof(testfile))) {
- HDstrcpy(testfile, srcdir);
- HDstrcat(testfile, "/");
- }
- HDstrcat(testfile, NOENCODER_FILENAME);
-
- file_id = H5Fopen(testfile, H5F_ACC_RDWR, H5P_DEFAULT);
+
+ /* Make a local copy of the file since this test writes to the data file
+ from svn. */
+ if (h5_make_local_copy(NOENCODER_FILENAME, NOENCODER_COPY_FILENAME) < 0)
+ goto error;
+
+ /* Open file */
+ file_id = H5Fopen(NOENCODER_COPY_FILENAME, H5F_ACC_RDWR, H5P_DEFAULT);
if(file_id < 0) goto error;
dset_id = H5Dopen2(file_id, dset_name, H5P_DEFAULT);
@@ -1836,6 +1834,7 @@ error:
H5Pclose(dcpl_id);
if(file_id != -1)
H5Fclose(file_id);
+
return -1;
}
#endif /* H5_HAVE_FILTER_SZIP */
@@ -8322,6 +8321,10 @@ main(void)
if(nerrors)
goto error;
printf("All dataset tests passed.\n");
+#ifdef H5_HAVE_FILTER_SZIP
+ if (GetTestCleanup())
+ HDremove(NOENCODER_COPY_FILENAME);
+#endif /* H5_HAVE_FILTER_SZIP */
h5_cleanup(FILENAME, fapl);
return 0;
diff --git a/test/dtypes.c b/test/dtypes.c
index 545a098..2619f1b 100644
--- a/test/dtypes.c
+++ b/test/dtypes.c
@@ -3707,10 +3707,41 @@ test_named (hid_t fapl)
if(H5Tclose(t3) < 0) goto error;
if(H5Dclose(dset) < 0) goto error;
- /* Clean up */
+ /* Close */
if(H5Tclose(type) < 0) goto error;
if(H5Sclose(space) < 0) goto error;
if(H5Fclose(file) < 0) goto error;
+
+ /* Reopen file with read only access */
+ if ((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ goto error;
+
+ /* Verify that H5Tcommit2 returns an error */
+ if((type = H5Tcopy(H5T_NATIVE_INT)) < 0) goto error;
+ H5E_BEGIN_TRY {
+ status = H5Tcommit2(file, "test_named_3 (should not exist)", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ } H5E_END_TRY;
+ if(status >= 0) {
+ H5_FAILED();
+ HDputs (" Types should not be committable to a read-only file!");
+ goto error;
+ }
+
+ /* Verify that H5Tcommit_anon returns an error */
+ if((type = H5Tcopy(H5T_NATIVE_INT)) < 0) goto error;
+ H5E_BEGIN_TRY {
+ status = H5Tcommit_anon(file, type, H5P_DEFAULT, H5P_DEFAULT);
+ } H5E_END_TRY;
+ if(status >= 0) {
+ H5_FAILED();
+ HDputs (" Types should not be committable to a read-only file!");
+ goto error;
+ }
+
+ /* Close */
+ if(H5Tclose(type) < 0) goto error;
+ if(H5Fclose(file) < 0) goto error;
+
PASSED();
return 0;
@@ -6242,10 +6273,29 @@ test_deprec(hid_t fapl)
if(!status)
FAIL_PUTS_ERROR(" Opened named types should be named types!")
- /* Clean up */
+ /* Close */
if(H5Tclose(type) < 0) FAIL_STACK_ERROR
if(H5Fclose(file) < 0) FAIL_STACK_ERROR
+ /* Reopen file with read only access */
+ if ((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ goto error;
+
+ /* Verify that H5Tcommit2 returns an error */
+ if((type = H5Tcopy(H5T_NATIVE_INT)) < 0) goto error;
+ H5E_BEGIN_TRY {
+ status = H5Tcommit1(file, "test_named_3 (should not exist)", type);
+ } H5E_END_TRY;
+ if(status >= 0) {
+ H5_FAILED();
+ HDputs (" Types should not be committable to a read-only file!");
+ goto error;
+ }
+
+ /* Close */
+ if(H5Tclose(type) < 0) goto error;
+ if(H5Fclose(file) < 0) goto error;
+
PASSED();
return 0;
diff --git a/test/earray.c b/test/earray.c
index fe5cb99..c1584f9 100644
--- a/test/earray.c
+++ b/test/earray.c
@@ -423,8 +423,7 @@ error:
*/
static int
reopen_file(hid_t *file, H5F_t **f, hid_t fapl, hid_t dxpl,
- H5EA_t **ea, haddr_t ea_addr, const H5EA_class_t *ea_cls,
- const earray_test_param_t *tparam)
+ H5EA_t **ea, haddr_t ea_addr, const earray_test_param_t *tparam)
{
/* Check for closing & re-opening the array */
/* (actually will close & re-open the file as well) */
@@ -452,7 +451,7 @@ reopen_file(hid_t *file, H5F_t **f, hid_t fapl, hid_t dxpl,
/* Re-open array, if given */
if(ea) {
- if(NULL == (*ea = H5EA_open(*f, dxpl, ea_addr, ea_cls, NULL)))
+ if(NULL == (*ea = H5EA_open(*f, dxpl, ea_addr, NULL)))
FAIL_STACK_ERROR
} /* end if */
} /* end if */
@@ -577,7 +576,7 @@ HDsystem("cp earray.h5 earray.h5.save");
#endif /* QAK */
/* Delete array */
- if(H5EA_delete(f, H5P_DATASET_XFER_DEFAULT, ea_addr) < 0)
+ if(H5EA_delete(f, H5P_DATASET_XFER_DEFAULT, ea_addr, NULL) < 0)
FAIL_STACK_ERROR
/* Close the file */
@@ -1055,11 +1054,11 @@ test_reopen(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam)
FAIL_STACK_ERROR
/* Check for closing & re-opening the file */
- if(reopen_file(&file, &f, fapl, H5P_DATASET_XFER_DEFAULT, NULL, HADDR_UNDEF, NULL, tparam) < 0)
+ if(reopen_file(&file, &f, fapl, H5P_DATASET_XFER_DEFAULT, NULL, HADDR_UNDEF, tparam) < 0)
TEST_ERROR
/* Re-open the array */
- if(NULL == (ea = H5EA_open(f, H5P_DATASET_XFER_DEFAULT, ea_addr, cparam->cls, NULL)))
+ if(NULL == (ea = H5EA_open(f, H5P_DATASET_XFER_DEFAULT, ea_addr, NULL)))
FAIL_STACK_ERROR
/* Verify the creation parameters */
@@ -1124,7 +1123,7 @@ test_open_twice(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam)
TEST_ERROR
/* Open the array again, through the first file handle */
- if(NULL == (ea2 = H5EA_open(f, H5P_DATASET_XFER_DEFAULT, ea_addr, cparam->cls, NULL)))
+ if(NULL == (ea2 = H5EA_open(f, H5P_DATASET_XFER_DEFAULT, ea_addr, NULL)))
FAIL_STACK_ERROR
/* Verify the creation parameters */
@@ -1139,7 +1138,7 @@ test_open_twice(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam)
ea2 = NULL;
/* Check for closing & re-opening the file */
- if(reopen_file(&file, &f, fapl, H5P_DATASET_XFER_DEFAULT, &ea, ea_addr, cparam->cls, tparam) < 0)
+ if(reopen_file(&file, &f, fapl, H5P_DATASET_XFER_DEFAULT, &ea, ea_addr, tparam) < 0)
TEST_ERROR
/* Re-open the file */
@@ -1151,7 +1150,7 @@ test_open_twice(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam)
FAIL_STACK_ERROR
/* Open the extensible array through the second file handle */
- if(NULL == (ea2 = H5EA_open(f2, H5P_DATASET_XFER_DEFAULT, ea_addr, cparam->cls, NULL)))
+ if(NULL == (ea2 = H5EA_open(f2, H5P_DATASET_XFER_DEFAULT, ea_addr, NULL)))
FAIL_STACK_ERROR
/* Verify the creation parameters */
@@ -1230,11 +1229,11 @@ test_delete_open(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam)
TEST_ERROR
/* Open the array again */
- if(NULL == (ea2 = H5EA_open(f, H5P_DATASET_XFER_DEFAULT, ea_addr, cparam->cls, NULL)))
+ if(NULL == (ea2 = H5EA_open(f, H5P_DATASET_XFER_DEFAULT, ea_addr, NULL)))
FAIL_STACK_ERROR
/* Request that the array be deleted */
- if(H5EA_delete(f, H5P_DATASET_XFER_DEFAULT, ea_addr) < 0)
+ if(H5EA_delete(f, H5P_DATASET_XFER_DEFAULT, ea_addr, NULL) < 0)
FAIL_STACK_ERROR
/* Verify the creation parameters */
@@ -1250,7 +1249,7 @@ test_delete_open(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam)
/* Try re-opening the array again (should fail, as array will be deleted) */
H5E_BEGIN_TRY {
- ea2 = H5EA_open(f, H5P_DATASET_XFER_DEFAULT, ea_addr, cparam->cls, NULL);
+ ea2 = H5EA_open(f, H5P_DATASET_XFER_DEFAULT, ea_addr, NULL);
} H5E_END_TRY;
if(ea2) {
/* Close opened array */
@@ -1266,12 +1265,12 @@ test_delete_open(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam)
ea = NULL;
/* Check for closing & re-opening the file */
- if(reopen_file(&file, &f, fapl, H5P_DATASET_XFER_DEFAULT, NULL, HADDR_UNDEF, NULL, tparam) < 0)
+ if(reopen_file(&file, &f, fapl, H5P_DATASET_XFER_DEFAULT, NULL, HADDR_UNDEF, tparam) < 0)
TEST_ERROR
/* Try re-opening the array again (should fail, as array is now deleted) */
H5E_BEGIN_TRY {
- ea = H5EA_open(f, H5P_DATASET_XFER_DEFAULT, ea_addr, cparam->cls, NULL);
+ ea = H5EA_open(f, H5P_DATASET_XFER_DEFAULT, ea_addr, NULL);
} H5E_END_TRY;
if(ea) {
/* Close opened array */
@@ -2472,7 +2471,7 @@ test_set_elmts(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam,
TEST_ERROR
/* Check for closing & re-opening the file */
- if(reopen_file(&file, &f, fapl, H5P_DATASET_XFER_DEFAULT, &ea, ea_addr, cparam->cls, tparam) < 0)
+ if(reopen_file(&file, &f, fapl, H5P_DATASET_XFER_DEFAULT, &ea, ea_addr, tparam) < 0)
TEST_ERROR
/* Verify high-water # of elements written */
@@ -2646,7 +2645,7 @@ test_skip_elmts(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam,
TEST_ERROR
/* Check for closing & re-opening the file */
- if(reopen_file(&file, &f, fapl, H5P_DATASET_XFER_DEFAULT, &ea, ea_addr, cparam->cls, tparam) < 0)
+ if(reopen_file(&file, &f, fapl, H5P_DATASET_XFER_DEFAULT, &ea, ea_addr, tparam) < 0)
TEST_ERROR
/* Verify high-water # of elements written */
diff --git a/test/farray.c b/test/farray.c
index c7a2796..b949263 100644
--- a/test/farray.c
+++ b/test/farray.c
@@ -263,8 +263,7 @@ set_fa_state(const H5FA_create_t *cparam, farray_state_t *state)
*/
static int
reopen_file(hid_t *file, H5F_t **f, hid_t fapl, hid_t dxpl,
- H5FA_t **fa, haddr_t fa_addr, const H5FA_class_t *fa_cls,
- const farray_test_param_t *tparam)
+ H5FA_t **fa, haddr_t fa_addr, const farray_test_param_t *tparam)
{
/* Check for closing & re-opening the array */
/* (actually will close & re-open the file as well) */
@@ -292,7 +291,7 @@ reopen_file(hid_t *file, H5F_t **f, hid_t fapl, hid_t dxpl,
/* Re-open array, if given */
if(fa) {
- if(NULL == (*fa = H5FA_open(*f, dxpl, fa_addr, fa_cls, NULL)))
+ if(NULL == (*fa = H5FA_open(*f, dxpl, fa_addr, NULL)))
FAIL_STACK_ERROR
} /* end if */
} /* end if */
@@ -317,12 +316,12 @@ error:
*/
static int
create_array(H5F_t *f, hid_t dxpl, const H5FA_create_t *cparam,
- H5FA_t **fa, haddr_t *fa_addr, void *cb)
+ H5FA_t **fa, haddr_t *fa_addr)
{
farray_state_t state; /* State of extensible array */
/* Create array */
- if(NULL == (*fa = H5FA_create(f, dxpl, cparam, cb)))
+ if(NULL == (*fa = H5FA_create(f, dxpl, cparam, NULL)))
FAIL_STACK_ERROR
/* Check status of array */
@@ -397,7 +396,7 @@ finish(hid_t file, hid_t fapl, H5F_t *f, H5FA_t *fa, haddr_t fa_addr)
FAIL_STACK_ERROR
/* Delete array */
- if(H5FA_delete(f, H5P_DATASET_XFER_DEFAULT, fa_addr) < 0)
+ if(H5FA_delete(f, H5P_DATASET_XFER_DEFAULT, fa_addr, NULL) < 0)
FAIL_STACK_ERROR
/* Close the file */
@@ -509,7 +508,7 @@ test_create(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t UNUSED *tpara
TESTING("fixed array creation");
/* Create array */
- if(create_array(f, H5P_DATASET_XFER_DEFAULT, cparam, &fa, &fa_addr, NULL) < 0)
+ if(create_array(f, H5P_DATASET_XFER_DEFAULT, cparam, &fa, &fa_addr) < 0)
TEST_ERROR
PASSED()
@@ -569,7 +568,7 @@ test_reopen(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam)
TESTING("create, close & reopen fixed array");
/* Create array */
- if(create_array(f, H5P_DATASET_XFER_DEFAULT, cparam, &fa, &fa_addr, NULL) < 0)
+ if(create_array(f, H5P_DATASET_XFER_DEFAULT, cparam, &fa, &fa_addr) < 0)
TEST_ERROR
/* Close the fixed array */
@@ -577,11 +576,11 @@ test_reopen(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam)
FAIL_STACK_ERROR
/* Check for closing & re-opening the file */
- if(reopen_file(&file, &f, fapl, H5P_DATASET_XFER_DEFAULT, NULL, HADDR_UNDEF, NULL, tparam) < 0)
+ if(reopen_file(&file, &f, fapl, H5P_DATASET_XFER_DEFAULT, NULL, HADDR_UNDEF, tparam) < 0)
TEST_ERROR
/* Re-open the array */
- if(NULL == (fa = H5FA_open(f, H5P_DATASET_XFER_DEFAULT, fa_addr, cparam->cls, NULL)))
+ if(NULL == (fa = H5FA_open(f, H5P_DATASET_XFER_DEFAULT, fa_addr, NULL)))
FAIL_STACK_ERROR
/* Verify the creation parameters */
@@ -639,11 +638,11 @@ test_open_twice(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam)
TESTING("open fixed array twice");
/* Create array */
- if(create_array(f, H5P_DATASET_XFER_DEFAULT, cparam, &fa, &fa_addr, NULL) < 0)
+ if(create_array(f, H5P_DATASET_XFER_DEFAULT, cparam, &fa, &fa_addr) < 0)
TEST_ERROR
/* Open the array again, through the first file handle */
- if(NULL == (fa2 = H5FA_open(f, H5P_DATASET_XFER_DEFAULT, fa_addr, cparam->cls, NULL)))
+ if(NULL == (fa2 = H5FA_open(f, H5P_DATASET_XFER_DEFAULT, fa_addr, NULL)))
FAIL_STACK_ERROR
/* Verify the creation parameters */
@@ -658,7 +657,7 @@ test_open_twice(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam)
fa2 = NULL;
/* Check for closing & re-opening the file */
- if(reopen_file(&file, &f, fapl, H5P_DATASET_XFER_DEFAULT, &fa, fa_addr, cparam->cls, tparam) < 0)
+ if(reopen_file(&file, &f, fapl, H5P_DATASET_XFER_DEFAULT, &fa, fa_addr, tparam) < 0)
TEST_ERROR
/* Re-open the file */
@@ -670,7 +669,8 @@ test_open_twice(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam)
FAIL_STACK_ERROR
/* Open the fixed array through the second file handle */
- if(NULL == (fa2 = H5FA_open(f2, H5P_DATASET_XFER_DEFAULT, fa_addr, cparam->cls, NULL))) FAIL_STACK_ERROR
+ if(NULL == (fa2 = H5FA_open(f2, H5P_DATASET_XFER_DEFAULT, fa_addr, NULL)))
+ FAIL_STACK_ERROR
/* Verify the creation parameters */
if(verify_cparam(fa, cparam) < 0)
@@ -741,15 +741,15 @@ test_delete_open(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam)
TESTING("deleting open fixed array");
/* Create array */
- if(create_array(f, H5P_DATASET_XFER_DEFAULT, cparam, &fa, &fa_addr, NULL) < 0)
+ if(create_array(f, H5P_DATASET_XFER_DEFAULT, cparam, &fa, &fa_addr) < 0)
TEST_ERROR
/* Open the array again */
- if(NULL == (fa2 = H5FA_open(f, H5P_DATASET_XFER_DEFAULT, fa_addr, cparam->cls, NULL)))
+ if(NULL == (fa2 = H5FA_open(f, H5P_DATASET_XFER_DEFAULT, fa_addr, NULL)))
FAIL_STACK_ERROR
/* Request that the array be deleted */
- if(H5FA_delete(f, H5P_DATASET_XFER_DEFAULT, fa_addr) < 0)
+ if(H5FA_delete(f, H5P_DATASET_XFER_DEFAULT, fa_addr, NULL) < 0)
FAIL_STACK_ERROR
/* Verify the creation parameters */
@@ -765,7 +765,7 @@ test_delete_open(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam)
/* Try re-opening the array again (should fail, as array will be deleted) */
H5E_BEGIN_TRY {
- fa2 = H5FA_open(f, H5P_DATASET_XFER_DEFAULT, fa_addr, cparam->cls, NULL);
+ fa2 = H5FA_open(f, H5P_DATASET_XFER_DEFAULT, fa_addr, NULL);
} H5E_END_TRY;
if(fa2) {
/* Close opened array */
@@ -781,12 +781,12 @@ test_delete_open(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam)
fa = NULL;
/* Check for closing & re-opening the file */
- if(reopen_file(&file, &f, fapl, H5P_DATASET_XFER_DEFAULT, NULL, HADDR_UNDEF, NULL, tparam) < 0)
+ if(reopen_file(&file, &f, fapl, H5P_DATASET_XFER_DEFAULT, NULL, HADDR_UNDEF, tparam) < 0)
TEST_ERROR
/* Try re-opening the array again (should fail, as array is now deleted) */
H5E_BEGIN_TRY {
- fa = H5FA_open(f, H5P_DATASET_XFER_DEFAULT, fa_addr, cparam->cls, NULL);
+ fa = H5FA_open(f, H5P_DATASET_XFER_DEFAULT, fa_addr, NULL);
} H5E_END_TRY;
if(fa) {
/* Close opened array */
@@ -1185,7 +1185,7 @@ static const farray_iter_t fa_iter_cyc = {
*-------------------------------------------------------------------------
*/
static int
-check_elmt(farray_test_param_t *tparam, void *_relmt, void *_welmt)
+check_elmt(void *_relmt, void *_welmt)
{
uint64_t *relmt = (uint64_t *)_relmt;
uint64_t *welmt = (uint64_t *)_welmt;
@@ -1245,7 +1245,7 @@ test_set_elmts(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam,
TEST_ERROR
/* Create array */
- if(create_array(f, H5P_DATASET_XFER_DEFAULT, cparam, &fa, &fa_addr, NULL) < 0)
+ if(create_array(f, H5P_DATASET_XFER_DEFAULT, cparam, &fa, &fa_addr) < 0)
TEST_ERROR
/* Verify the creation parameters */
@@ -1253,7 +1253,7 @@ test_set_elmts(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam,
TEST_ERROR
/* Check for closing & re-opening the file */
- if(reopen_file(&file, &f, fapl, H5P_DATASET_XFER_DEFAULT, &fa, fa_addr, cparam->cls, tparam) < 0)
+ if(reopen_file(&file, &f, fapl, H5P_DATASET_XFER_DEFAULT, &fa, fa_addr, tparam) < 0)
TEST_ERROR
if(H5FA_get_nelmts(fa, &fa_nelmts) < 0)
@@ -1289,7 +1289,7 @@ test_set_elmts(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam,
FAIL_STACK_ERROR
/* Verify that the retrieved is correct */
- if(check_elmt(tparam, &relmt, NULL))
+ if(check_elmt(&relmt, NULL))
TEST_ERROR
} /* end for */
@@ -1316,7 +1316,7 @@ test_set_elmts(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam,
FAIL_STACK_ERROR
/* Verify that the retrieved element is correct */
- if(check_elmt(tparam, &relmt, NULL))
+ if(check_elmt(&relmt, NULL))
TEST_ERROR
/* Set element of array */
@@ -1330,7 +1330,7 @@ test_set_elmts(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam,
FAIL_STACK_ERROR
/* Verify that the retrieved element is correct */
- if(check_elmt(tparam, &relmt, &welmt))
+ if(check_elmt(&relmt, &welmt))
TEST_ERROR
} /* end for */
@@ -1400,7 +1400,7 @@ test_skip_elmts(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam,
TEST_ERROR
/* Create array */
- if(create_array(f, H5P_DATASET_XFER_DEFAULT, cparam, &fa, &fa_addr, NULL) < 0)
+ if(create_array(f, H5P_DATASET_XFER_DEFAULT, cparam, &fa, &fa_addr) < 0)
TEST_ERROR
/* Verify the creation parameters */
@@ -1408,7 +1408,7 @@ test_skip_elmts(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam,
TEST_ERROR
/* Check for closing & re-opening the file */
- if(reopen_file(&file, &f, fapl, H5P_DATASET_XFER_DEFAULT, &fa, fa_addr, cparam->cls, tparam) < 0)
+ if(reopen_file(&file, &f, fapl, H5P_DATASET_XFER_DEFAULT, &fa, fa_addr, tparam) < 0)
TEST_ERROR
if(H5FA_get_nelmts(fa, &fa_nelmts) < 0)
@@ -1434,7 +1434,7 @@ test_skip_elmts(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam,
FAIL_STACK_ERROR
/* Verify that the retrieved is correct */
- if(check_elmt(tparam, &relmt, NULL))
+ if(check_elmt(&relmt, NULL))
TEST_ERROR
/* Set element of array */
@@ -1454,7 +1454,7 @@ test_skip_elmts(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam,
FAIL_STACK_ERROR
/* Verify that the retrieved is correct */
- if(check_elmt(tparam, &relmt, &welmt))
+ if(check_elmt(&relmt, &welmt))
TEST_ERROR
if(check_rest) {
@@ -1466,7 +1466,7 @@ test_skip_elmts(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam,
FAIL_STACK_ERROR
/* Verify that the retrieved is correct */
- if(check_elmt(tparam, &relmt, NULL))
+ if(check_elmt(&relmt, NULL))
TEST_ERROR
} /* end for */
} /* end if */
diff --git a/test/fheap.c b/test/fheap.c
index f45f856..26bcaec 100644
--- a/test/fheap.c
+++ b/test/fheap.c
@@ -2769,8 +2769,6 @@ test_filtered_create(hid_t fapl, H5HF_create_t *cparam)
if(!H5F_addr_defined(fh_addr))
TEST_ERROR
-/* XXX: Check heap's I/O filter settings? */
-
/* Close the fractal heap */
if(H5HF_close(fh, dxpl) < 0)
FAIL_STACK_ERROR
@@ -2799,8 +2797,6 @@ test_filtered_create(hid_t fapl, H5HF_create_t *cparam)
if(H5HF_cmp_cparam_test(&tmp_cparam, &test_cparam))
FAIL_STACK_ERROR
-/* XXX: Check heap's I/O filter settings? */
-
/* Close the fractal heap */
if(H5HF_close(fh, H5P_DATASET_XFER_DEFAULT) < 0)
FAIL_STACK_ERROR
diff --git a/test/filespace_1_6.h5 b/test/filespace_1_6.h5
new file mode 100644
index 0000000..5afc718
--- /dev/null
+++ b/test/filespace_1_6.h5
Binary files differ
diff --git a/test/filespace_1_8.h5 b/test/filespace_1_8.h5
new file mode 100644
index 0000000..85138b0
--- /dev/null
+++ b/test/filespace_1_8.h5
Binary files differ
diff --git a/test/gen_filespace.c b/test/gen_filespace.c
new file mode 100644
index 0000000..e9dee1c
--- /dev/null
+++ b/test/gen_filespace.c
@@ -0,0 +1,81 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include "hdf5.h"
+
+#define NELMTS(X) (sizeof(X)/sizeof(X[0])) /* # of elements */
+#define TEST_THRESHOLD2 2 /* Free space section threshold */
+
+const char *FILENAMES[] = {
+ "filespace_persist.h5", /* H5F_FILE_SPACE_ALL_PERSIST */
+ "filespace_default.h5", /* H5F_FILE_SPACE_ALL */
+ "filespace_aggr_vfd.h5", /* H5F_FILE_SPACE_AGGR_VFD */
+ "filespace_vfd.h5", /* H5F_FILE_SPACE_VFD */
+ "filespace_threshold.h5" /* H5F_FILE_SPACE_ALL, non-default threshold */
+};
+
+#define DATASET "dset"
+#define NUM_ELMTS 100
+
+/*
+ * Compile and run this program in file-space branch to generate
+ * HDF5 files with different kinds of file space strategies
+ * Move the HDF5 files to the 1.6 and 1.8 branch for compatibility
+ * testing:test_filespace_compatible() will use the files
+ */
+static void gen_file(void)
+{
+ hid_t fid;
+ hid_t fcpl;
+ hid_t dataset, space;
+ hsize_t dim[1];
+ int data[NUM_ELMTS];
+ unsigned i, j; /* Local index variable */
+ H5F_file_space_type_t fs_type; /* File space handling strategy */
+
+ for(j = 0, fs_type = H5F_FILE_SPACE_ALL_PERSIST; j < NELMTS(FILENAMES); j++, (H5F_file_space_type_t)(fs_type)++) {
+ /* Get a copy of the default file creation property */
+ fcpl = H5Pcreate(H5P_FILE_CREATE);
+
+ if(fs_type == H5F_FILE_SPACE_NTYPES) /* last file */
+ /* Set default strategy but non-default threshold */
+ H5Pset_file_space(fcpl, H5F_FILE_SPACE_ALL, (hsize_t)TEST_THRESHOLD2);
+ else
+ /* Set specified file space strategy and free space section threshold */
+ H5Pset_file_space(fcpl, fs_type, (hsize_t)0);
+
+ /* Create the file with the file space info */
+ fid = H5Fcreate(FILENAMES[j], H5F_ACC_TRUNC, fcpl, H5P_DEFAULT);
+
+ dim[0] = NUM_ELMTS;
+ space = H5Screate_simple(1, dim, NULL);
+ dataset = H5Dcreate2(fid, DATASET, H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ for(i = 0; i < NUM_ELMTS; i++)
+ data[i] = i;
+
+ H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data);
+ H5Dclose(dataset);
+ H5Sclose(space);
+ H5Fclose(fid);
+ }
+}
+
+int main(void)
+{
+ gen_file();
+
+ return 0;
+}
diff --git a/test/gen_specmetaread.c b/test/gen_specmetaread.c
new file mode 100644
index 0000000..f489119
--- /dev/null
+++ b/test/gen_specmetaread.c
@@ -0,0 +1,96 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Programmer: Quincey Koziol <koziol@hdfgroup.org>
+ * Thursday, October 8, 2009
+ *
+ * Purpose: Create a file with a dataset who's raw data immediately follows
+ * its object header, so that when the dataset is unlinked from its parent
+ * group, a speculative read of the object header would get the raw data
+ * into the metadata accumulator, "polluting" it.
+ * To build the test file, this program MUST be compiled and linked with
+ * the library on the trunk as of when this file is checked in.
+ */
+
+#include "hdf5.h"
+#include <assert.h>
+
+#define FILENAME "specmetaread.h5"
+#define DIM 10
+
+int
+main(void)
+{
+ hid_t fid;
+ hid_t fapl;
+ hid_t did;
+ hid_t space;
+ hsize_t dim[1] = {DIM};
+ unsigned data[DIM];
+ unsigned u;
+ herr_t ret; /* Generic return value */
+
+ /* Initialize the data */
+ for(u = 0; u < DIM; u++)
+ data[u] = u;
+
+ /* Create a FAPL with the metadata and small data aggregators turned off */
+ fapl = H5Pcreate(H5P_FILE_ACCESS);
+ assert(fapl > 0);
+ ret = H5Pset_meta_block_size(fapl, (hsize_t)0);
+ assert(ret >= 0);
+ ret = H5Pset_small_data_block_size(fapl, (hsize_t)0);
+ assert(ret >= 0);
+
+ /* Create file */
+ fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
+ assert(fid > 0);
+
+ /* Close FAPL */
+ ret = H5Pclose(fapl);
+ assert(ret >= 0);
+
+ /* Create dataspace */
+ space = H5Screate_simple(1, dim, NULL);
+ assert(space > 0);
+
+ /* Create dataset #1 */
+ did = H5Dcreate2(fid, "dset1", H5T_NATIVE_UINT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ assert(did > 0);
+ ret = H5Dwrite(did, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data);
+ assert(ret >= 0);
+ ret = H5Dclose(did);
+ assert(ret >= 0);
+
+ /* Create dataset #2 */
+ did = H5Dcreate2(fid, "dset2", H5T_NATIVE_UINT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ assert(did > 0);
+ ret = H5Dwrite(did, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data);
+ assert(ret >= 0);
+ ret = H5Dclose(did);
+ assert(ret >= 0);
+
+ /* Close dataspace */
+ ret = H5Sclose(space);
+ assert(ret >= 0);
+
+ /* Close file */
+ ret = H5Fclose(fid);
+ assert(ret >= 0);
+
+ return 0;
+}
+
diff --git a/test/gheap.c b/test/gheap.c
index 6dbd8a3..b2c9090 100644
--- a/test/gheap.c
+++ b/test/gheap.c
@@ -30,11 +30,27 @@
#include "H5Iprivate.h"
#include "H5Pprivate.h"
+/* Macros for printing error messages in loops. These print up to
+ * GHEAP_REPEATED_ERR_LIM errors, and suppress the rest */
+#define GHEAP_REPEATED_ERR_LIM 20
+
+#define GHEAP_REPEATED_ERR(MSG) \
+{ \
+ nerrors++; \
+ if(nerrors <= GHEAP_REPEATED_ERR_LIM) { \
+ H5_FAILED(); \
+ puts(MSG); \
+ if(nerrors == GHEAP_REPEATED_ERR_LIM) \
+ puts(" Suppressing further errors..."); \
+ } /* end if */ \
+} /* end GHEAP_REPEATED_ERR */
+
const char *FILENAME[] = {
"gheap1",
"gheap2",
"gheap3",
"gheap4",
+ "gheapooo",
NULL
};
@@ -385,6 +401,120 @@ test_4 (hid_t fapl)
/*-------------------------------------------------------------------------
+ * Function: test_ooo_indices
+ *
+ * Purpose: Tests that indices can be stored out of order. This can
+ * happen when the indices "wrap around" due to many
+ * insertions and deletions (for example, from rewriting a
+ * VL dataset).
+ *
+ * Return: Success: 0
+ *
+ * Failure: number of errors
+ *
+ * Programmer: Neil Fortner
+ * Monday, October 26, 2009
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+test_ooo_indices(hid_t fapl)
+{
+ hid_t file = -1;
+ H5F_t *f = NULL;
+ unsigned i, j;
+ H5HG_t *obj = NULL;
+ herr_t status;
+ int nerrors=0;
+ char filename[1024];
+
+ TESTING("out of order indices");
+
+ if(NULL == (obj = (H5HG_t *)HDmalloc(2000 * sizeof(*obj))))
+ goto error;
+
+ /* Open a clean file */
+ h5_fixname(FILENAME[4], fapl, filename, sizeof filename);
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ goto error;
+ if(NULL == (f = (H5F_t *)H5I_object(file))) {
+ H5_FAILED();
+ puts(" Unable to create file");
+ goto error;
+ } /* end if */
+
+ /* Alternately insert 1000 entries and remove the previous group of 1000
+ * entries, until the indices wrap around */
+ for(i=0; i<66; i++) {
+ /* Insert 1000 entries. The index into the obj array will alternate up
+ * and down by 1000 so the previous set of insertions is preserved and
+ * can be deleted. */
+ for(j=1000*((~i&1)); j<1000*((~i&1)+1); j++) {
+ H5Eclear2(H5E_DEFAULT);
+ status = H5HG_insert(f, H5P_DATASET_XFER_DEFAULT, sizeof(j), &j, &obj[j]);
+ if (status<0)
+ GHEAP_REPEATED_ERR(" Unable to insert object into global heap")
+
+ /* Check that the index is as expected */
+ if(obj[j].idx != ((1000 * i) + j - (1000 * ((~i & 1)))) % ((1u << 16) - 1) + 1)
+ GHEAP_REPEATED_ERR(" Unexpected global heap index");
+ } /* end for */
+
+ /* Remove the previous 1000 entries */
+ if(i>0)
+ for(j=1000*(i&1); j<1000*((i&1)+1); j++) {
+ H5Eclear2(H5E_DEFAULT);
+ status = H5HG_remove(f, H5P_DATASET_XFER_DEFAULT, &obj[j]);
+ if (status<0)
+ GHEAP_REPEATED_ERR(" Unable to remove object from global heap");
+ } /* end for */
+ } /* end for */
+
+ /* The indices should have "wrapped around" on the last iteration */
+ HDassert(obj[534].idx == 65535);
+ HDassert(obj[535].idx == 1);
+
+ /* Reopen the file */
+ if (H5Fclose(file)<0) goto error;
+ if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ goto error;
+ if(NULL == (f = (H5F_t *)H5I_object(file))) {
+ H5_FAILED();
+ puts(" Unable to open file");
+ goto error;
+ } /* end if */
+
+ /* Read the objects to make sure the heap is still readable */
+ for(i=0; i<1000; i++) {
+ if(NULL == H5HG_read(f, H5P_DATASET_XFER_DEFAULT, &obj[i], &j, NULL))
+ goto error;
+ if(i != j) {
+ H5_FAILED();
+ puts(" Incorrect read value");
+ goto error;
+ } /* end if */
+ } /* end for */
+
+ if (H5Fclose(file)<0) goto error;
+ if (nerrors) goto error;
+ HDfree(obj);
+ obj = NULL;
+ PASSED();
+ return 0;
+
+ error:
+ H5E_BEGIN_TRY {
+ H5Fclose(file);
+ } H5E_END_TRY;
+ if(obj)
+ HDfree(obj);
+ return MAX(1, nerrors);
+} /* end test_ooo_indices */
+
+
+/*-------------------------------------------------------------------------
* Function: main
*
* Purpose: Tests global heap.
@@ -413,6 +543,7 @@ main (void)
nerrors += test_2(fapl);
nerrors += test_3(fapl);
nerrors += test_4(fapl);
+ nerrors += test_ooo_indices(fapl);
if (nerrors) goto error;
puts("All global heap tests passed.");
diff --git a/test/h5test.c b/test/h5test.c
index 360f1d9..a5b50d3 100644
--- a/test/h5test.c
+++ b/test/h5test.c
@@ -64,18 +64,16 @@
* is about the best guess.
*/
#ifndef HDF5_PARAPREFIX
-#ifdef __PUMAGON__
-/* For the PFS of TFLOPS */
-#define HDF5_PARAPREFIX "pfs:/pfs_grande/multi/tmp_1"
-#else
#define HDF5_PARAPREFIX ""
#endif
-#endif
char *paraprefix = NULL; /* for command line option para-prefix */
#ifdef H5_HAVE_PARALLEL
MPI_Info h5_io_info_g=MPI_INFO_NULL;/* MPI INFO object for IO */
#endif
+#define FILENAME_BUF_SIZE 1024
+#define READ_BUF_SIZE 4096
+
/*
* These are the letters that are appended to the file name when generating
* names for the split and multi drivers. They are:
@@ -1093,3 +1091,55 @@ getenv_all(MPI_Comm comm, int root, const char* name)
#endif
+/*-------------------------------------------------------------------------
+ * Function: h5_make_local_copy
+ *
+ * Purpose: Make copy of file. Some tests write to data files under that
+ * are under version control. Those tests should make a copy of
+ * the versioned file and write to the copy. This function
+ * prepends srcdir to the name of the file to be copied and uses
+ * the name of the copy as is.
+ *
+ * Return: Success: 0
+ *
+ * Failure: -1
+ *
+ * Programmer: Larry Knox
+ * Monday, October 13, 2009
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+h5_make_local_copy(char *origfilename, char *local_copy_name)
+{
+ char filename[FILENAME_BUF_SIZE] = "";
+ int fd_old = (-1), fd_new = (-1); /* File descriptors for copying data */
+ ssize_t nread; /* Number of bytes read in */
+ char buf[READ_BUF_SIZE]; /* Buffer for copying data */
+ char * srcdir = HDgetenv("srcdir"); /* The source directory */
+
+ if(srcdir && ((HDstrlen(srcdir) +
+ HDstrlen(origfilename) + 6) < FILENAME_BUF_SIZE)) {
+ HDstrcpy(filename, srcdir);
+ HDstrcat(filename, "/");
+ }
+ HDstrcat(filename, origfilename);
+
+ /* Copy old file into temporary file */
+ if((fd_old = HDopen(filename, O_RDONLY, 0666)) < 0) return -1;
+ if((fd_new = HDopen(local_copy_name, O_RDWR|O_CREAT|O_TRUNC, 0666))
+ < 0) return -1;
+
+ /* Copy data */
+ while((nread = HDread(fd_old, buf, (size_t)READ_BUF_SIZE)) > 0)
+ HDwrite(fd_new, buf, (size_t)nread);
+
+ /* Close files */
+ if(HDclose(fd_old) < 0) return -1;
+ if(HDclose(fd_new) < 0) return -1;
+
+ return 0;
+}
+
diff --git a/test/h5test.h b/test/h5test.h
index e3b3596..315b504 100644
--- a/test/h5test.h
+++ b/test/h5test.h
@@ -152,6 +152,7 @@ H5TEST_DLL void h5_reset(void);
H5TEST_DLL void h5_show_hostname(void);
H5TEST_DLL h5_stat_size_t h5_get_file_size(const char *filename, hid_t fapl);
H5TEST_DLL int print_func(const char *format, ...);
+H5TEST_DLL int h5_make_local_copy(char *origfilename, char *local_copy_name);
/* Routines for operating on the list of tests (for the "all in one" tests) */
H5TEST_DLL void TestUsage(void);
diff --git a/test/links.c b/test/links.c
index 7c32238..60607c9 100644
--- a/test/links.c
+++ b/test/links.c
@@ -141,7 +141,7 @@ const char *FILENAME[] = {
#define FAMILY_SIZE 1024
#define CORE_INCREMENT 1024
-#define NUM400 400
+#define NUM40 40
/* do not do check_all_closed() for "ext*" files and "tmp/ext*" */
#define EXTSTOP 12
@@ -176,6 +176,8 @@ const char *FILENAME[] = {
#define H5L_DIM1 100
#define H5L_DIM2 100
+#define FILTER_FILESIZE_MAX_FRACTION .9
+
/* Creation order macros */
#define CORDER_GROUP_NAME "corder_group"
#define CORDER_SOFT_GROUP_NAME "corder_soft_group"
@@ -1792,6 +1794,30 @@ external_link_root(hid_t fapl, hbool_t new_format)
goto error;
}
+ /* Create external link to object in first file */
+ /* (add a few extra '/'s to make certain library normalizes external link object names) */
+ if(H5Lcreate_external(filename1, "///", fid, "ext_link2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* Check information for external link */
+ if(H5Lget_info(fid, "ext_link", &linfo, H5P_DEFAULT) < 0) goto error;
+ if(H5L_TYPE_EXTERNAL != linfo.type) {
+ H5_FAILED();
+ puts(" Unexpected object type - should have been an external link");
+ goto error;
+ }
+ if(H5Lget_val(fid, "ext_link", objname, sizeof(objname), H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lunpack_elink_val(objname, linfo.u.val_size, NULL, &file, &path) < 0) TEST_ERROR
+ if(HDstrcmp(file, filename1)) {
+ H5_FAILED();
+ puts(" External link file name incorrect");
+ goto error;
+ }
+ if(HDstrcmp(path, "/")) {
+ H5_FAILED();
+ puts(" External link path incorrect");
+ goto error;
+ }
+
/* Close and re-open file to ensure that data is written to disk */
if(H5Fclose(fid) < 0) TEST_ERROR
if((fid = H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
@@ -3409,8 +3435,8 @@ external_link_reltar(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[26], fapl, filename2, sizeof filename2);
/* Create the target file */
- if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* closing for target file */
if(H5Gclose(gid) < 0) TEST_ERROR
@@ -3418,25 +3444,17 @@ external_link_reltar(hid_t fapl, hbool_t new_format)
/* Create the main file */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create external link to target file */
- if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_external(filename2, "///A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Open object through external link */
- H5E_BEGIN_TRY {
- gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT);
- } H5E_END_TRY;
-
- /*
- * Should be able to find the target file from:
- * main file's current working directory + pathname of external linked targetfile
- */
- if (gid < 0) {
+ if((gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT)) < 0) {
H5_FAILED();
puts(" Should have found the file in tmp directory.");
goto error;
- }
+ } /* end if */
/* closing for main file */
if(H5Gclose(gid) < 0) TEST_ERROR
@@ -3793,7 +3811,7 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format)
cwdpath[NAME_BUF_SIZE];
hid_t core_fapl, space, dset, did, dapl_id, dcpl;
hsize_t dims[2];
- int points[NUM400][NUM400];
+ int points[NUM40][NUM40];
h5_stat_size_t filesize, new_filesize;
int i, j, n;
@@ -3827,8 +3845,8 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format)
if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, core_fapl)) < 0) TEST_ERROR
if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- dims[0] = NUM400;
- dims[1] = NUM400;
+ dims[0] = NUM40;
+ dims[1] = NUM40;
if((space = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR
/* Create dataset creation property list */
@@ -3874,8 +3892,8 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format)
}
/* Initialize the dataset */
- for(i = n = 0; i < NUM400; i++)
- for(j = 0; j < NUM400; j++)
+ for(i = n = 0; i < NUM40; i++)
+ for(j = 0; j < NUM40; j++)
points[i][j] = n++;
/* Write the data to the dataset */
@@ -5299,7 +5317,8 @@ external_link_query(hid_t fapl, hbool_t new_format)
if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create external link */
- if(H5Lcreate_external(filename2, "/dst", fid, "src", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ /* (add a few extra '/'s to make certain library normalizes external link object names) */
+ if(H5Lcreate_external(filename2, "///dst//", fid, "src", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Get size of buffer for external link */
if(H5Lget_info(fid, "src", &li, H5P_DEFAULT) < 0) TEST_ERROR
@@ -8520,6 +8539,386 @@ error:
/*-------------------------------------------------------------------------
+ * Function: link_filters
+ *
+ * Purpose: Tests adding filters to group link storage. Also tests
+ * copying these groups.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Neil Fortner
+ * Tuesday, June 16, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static enum {
+ LFS_INIT,
+ LFS_CAN_APPLY_CALLED,
+ LFS_SET_LOCAL_CALLED,
+ LFS_ENCODED,
+ LFS_DECODED
+} link_filter_state;
+
+static herr_t link_filter_can_apply(hid_t dcpl_id, hid_t type_id, hid_t space_id)
+{
+ if(dcpl_id >= 0 || type_id >= 0 || space_id >= 0)
+ return -1;
+
+ if(link_filter_state >= LFS_ENCODED)
+ return 1;
+
+ if(link_filter_state != LFS_INIT)
+ return -1;
+
+ link_filter_state = LFS_CAN_APPLY_CALLED;
+
+ return 1;
+} /* end link_fitler_can_apply */
+
+static herr_t link_filter_set_local(hid_t dcpl_id, hid_t type_id, hid_t space_id)
+{
+ if(dcpl_id >= 0 || type_id >= 0 || space_id >= 0)
+ return -1;
+
+ if(link_filter_state >= LFS_ENCODED)
+ return 0;
+
+ if(link_filter_state != LFS_CAN_APPLY_CALLED)
+ return -1;
+
+ link_filter_state = LFS_SET_LOCAL_CALLED;
+
+ return 0;
+} /* end link_filter_set_local */
+
+static size_t link_filter_filter(unsigned int flags, size_t cd_nelmts,
+ const unsigned int cd_values[], size_t nbytes, size_t UNUSED *buf_size,
+ void UNUSED **buf)
+{
+ if(flags & H5Z_FLAG_OPTIONAL || cd_nelmts != 1 || cd_values[0] != 2112)
+ return 0;
+
+ if(link_filter_state == LFS_DECODED)
+ return nbytes;
+
+ if(flags & H5Z_FLAG_REVERSE) {
+ if(link_filter_state != LFS_ENCODED)
+ return 0;
+ link_filter_state = LFS_DECODED;
+ } else {
+ if(link_filter_state < LFS_SET_LOCAL_CALLED)
+ return 0;
+ link_filter_state = LFS_ENCODED;
+ } /* end else */
+
+ return nbytes;
+} /* end link_filter_filter */
+
+static int
+link_filters(hid_t fapl, hbool_t new_format)
+{
+ hid_t fid = -1, fcpl = -1;
+ hid_t gid1 = -1, gid2 = -1, gcpl1 = -1, gcpl2 = -1;
+ hid_t lcpl = -1;
+ size_t cd_nelmts = 1;
+ unsigned cd_value = 2112;
+ unsigned cd_value_out;
+ unsigned flags_out;
+ unsigned filter_config_out;
+ int nfilters = 0;
+ H5Z_class2_t filter_class;
+ char name_out[24];
+ char filename[NAME_BUF_SIZE];
+ htri_t tri_ret;
+ herr_t status;
+
+ /* This test actually always uses the new group format for the main group.
+ * The new format flag affects the version of object header messages,
+ * etc., which are important for this test. */
+ if(new_format)
+ TESTING("group link filters (w/new group format)")
+ else
+ TESTING("group link filters")
+
+ /* Initialize link filter state global */
+ link_filter_state = LFS_INIT;
+
+ /* Set up filename and create file*/
+ h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
+
+ if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+
+ /* Create gcpl, force use of dense storage */
+ if((gcpl1 = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR
+ if(H5Pset_link_phase_change(gcpl1, 2, 2) < 0) TEST_ERROR
+
+ /* Add deflate and checksum filters, if available */
+ if((tri_ret = H5Zfilter_avail(H5Z_FILTER_DEFLATE)) < 0) TEST_ERROR
+ if(tri_ret) {
+ if(H5Pset_deflate(gcpl1, 6) < 0) TEST_ERROR
+ nfilters++;
+ } /* end if */
+ if((tri_ret = H5Zfilter_avail(H5Z_FILTER_FLETCHER32)) < 0) TEST_ERROR
+ if(tri_ret) {
+ if(H5Pset_fletcher32(gcpl1) < 0) TEST_ERROR
+ nfilters++;
+ } /* end if */
+
+ /* Register and add custom filter */
+ filter_class.version = H5Z_CLASS_T_VERS;
+ filter_class.id = H5Z_FILTER_RESERVED + 42;
+ filter_class.encoder_present = TRUE;
+ filter_class.decoder_present = TRUE;
+ filter_class.name = "custom_link_filter";
+ filter_class.can_apply = link_filter_can_apply;
+ filter_class.set_local = link_filter_set_local;
+ filter_class.filter = link_filter_filter;
+ if(H5Zregister(&filter_class) < 0) TEST_ERROR
+ if(H5Pset_filter(gcpl1, H5Z_FILTER_RESERVED + 42, 0, (size_t)1, &cd_value) < 0)
+ TEST_ERROR
+ nfilters++;
+
+ /* Test various other filter functions for use on gcpl's */
+ if(H5Pget_nfilters(gcpl1) != nfilters) TEST_ERROR
+ if(H5Pall_filters_avail(gcpl1) != TRUE) TEST_ERROR
+
+ /* Create a group using this filter, add some soft links to it */
+ if((gid1 = H5Gcreate2(fid, "group1", H5P_DEFAULT, gcpl1, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if(H5Lcreate_soft("/", gid1, "link1", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if(H5Lcreate_soft("/", gid1, "link2", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if(H5Lcreate_soft("/", gid1, "link3", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+
+ /* Close file and group */
+ if(H5Gclose(gid1) < 0) TEST_ERROR
+ if(H5Fclose(fid) < 0) TEST_ERROR
+
+ /* Verify the filter has been applied */
+ if(link_filter_state != LFS_ENCODED) TEST_ERROR
+
+ /* Reopen file and group */
+ if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
+ if((gid1 = H5Gopen2(fid, "group1", H5P_DEFAULT)) < 0) TEST_ERROR
+
+ /* Retrieve gcpl, verify number of filters */
+ if((gcpl2 = H5Gget_create_plist(gid1)) < 0) TEST_ERROR
+ if(H5Pget_nfilters(gcpl2) != nfilters) TEST_ERROR
+ if(H5Pclose(gcpl2) < 0) TEST_ERROR
+
+ /* Now try copying gcpl1, and verify number of filters */
+ if((gcpl2 = H5Pcopy(gcpl1)) < 0) TEST_ERROR
+ if(H5Pget_nfilters(gcpl2) != nfilters) TEST_ERROR
+ if(H5Pclose(gcpl2) < 0) TEST_ERROR
+
+ /* Add another soft link */
+ if(H5Lcreate_soft("/", gid1, "link4", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+
+ /* Copy the group */
+ if(H5Ocopy(fid, "group1", fid, "group2", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if((gid2 = H5Gopen2(fid, "group2", H5P_DEFAULT)) <0) TEST_ERROR
+
+ /* Verify that all links have been copied */
+ if(H5Lexists(gid2, "link1", H5P_DEFAULT) != TRUE) TEST_ERROR
+ if(H5Lexists(gid2, "link2", H5P_DEFAULT) != TRUE) TEST_ERROR
+ if(H5Lexists(gid2, "link3", H5P_DEFAULT) != TRUE) TEST_ERROR
+ if(H5Lexists(gid2, "link4", H5P_DEFAULT) != TRUE) TEST_ERROR
+
+ /* Retrieve gcpl, verify number of filters */
+ if((gcpl2 = H5Gget_create_plist(gid2)) < 0) TEST_ERROR
+ if(H5Pget_nfilters(gcpl2) != nfilters) TEST_ERROR
+
+ /* Delete 3 links to force the group back into compact mode */
+ if(H5Ldelete(gid1, "link2", H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Ldelete(gid1, "link3", H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Ldelete(gid1, "link4", H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* Close file and groups */
+ if(H5Gclose(gid1) < 0) TEST_ERROR
+ if(H5Gclose(gid2) < 0) TEST_ERROR
+ if(H5Fclose(fid) < 0) TEST_ERROR
+
+ /* Reset link filter state */
+ link_filter_state = LFS_INIT;
+
+ /* Reopen file and group, add 2 links */
+ if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
+ if((gid1 = H5Gopen2(fid, "group1", H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Lcreate_soft("/", gid1, "link2", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if(H5Lcreate_soft("/", gid1, "link3", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+
+ /* Close file and group */
+ if(H5Gclose(gid1) < 0) TEST_ERROR
+ if(H5Fclose(fid) < 0) TEST_ERROR
+
+ /* Verify that the filter was reapplied */
+ if(link_filter_state != LFS_ENCODED) TEST_ERROR
+
+ /* Test H5Pget_filter_by_id2 and H5Pget_filter2 */
+ if(H5Pget_filter_by_id2(gcpl2, H5Z_FILTER_RESERVED + 42, &flags_out,
+ &cd_nelmts, &cd_value_out, (size_t)24, name_out, &filter_config_out) < 0)
+ TEST_ERROR
+ if(flags_out != 0 || cd_value_out != cd_value
+ || HDstrcmp(filter_class.name, name_out)
+ || filter_config_out != (H5Z_FILTER_CONFIG_ENCODE_ENABLED
+ | H5Z_FILTER_CONFIG_DECODE_ENABLED))
+ TEST_ERROR
+ if(H5Pget_filter2(gcpl2, nfilters - 1, &flags_out, &cd_nelmts,
+ &cd_value_out, (size_t)24, name_out, &filter_config_out) < 0)
+ TEST_ERROR
+ if(flags_out != 0 || cd_value_out != cd_value
+ || HDstrcmp(filter_class.name, name_out)
+ || filter_config_out != (H5Z_FILTER_CONFIG_ENCODE_ENABLED
+ | H5Z_FILTER_CONFIG_DECODE_ENABLED))
+ TEST_ERROR
+
+ /* Test H5Pmodify_filter */
+ cd_value++;
+ if(H5Pmodify_filter(gcpl2, H5Z_FILTER_RESERVED + 42, 0, (size_t)1, &cd_value) < 0)
+ TEST_ERROR
+ if(H5Pget_filter_by_id2(gcpl2, H5Z_FILTER_RESERVED + 42, &flags_out,
+ &cd_nelmts, &cd_value_out, (size_t)24, name_out, &filter_config_out) < 0)
+ TEST_ERROR
+ if(flags_out != 0 || cd_value_out != cd_value
+ || HDstrcmp(filter_class.name, name_out)
+ || filter_config_out != (H5Z_FILTER_CONFIG_ENCODE_ENABLED
+ | H5Z_FILTER_CONFIG_DECODE_ENABLED))
+ TEST_ERROR
+
+ /* Test H5Premove_filter */
+ if(H5Premove_filter(gcpl2, H5Z_FILTER_RESERVED + 42) < 0) TEST_ERROR
+ H5E_BEGIN_TRY {
+ status = H5Pget_filter_by_id2(gcpl2, H5Z_FILTER_RESERVED + 42,
+ &flags_out, &cd_nelmts, &cd_value_out, (size_t)24, name_out,
+ &filter_config_out);
+ } H5E_END_TRY
+ if(status >= 0) TEST_ERROR
+
+ /* Close remaining ids */
+ if(H5Pclose(gcpl1) < 0) TEST_ERROR
+ if(H5Pclose(gcpl2) < 0) TEST_ERROR
+
+ /* Now create an object in the compressed group, creating intermediate
+ * groups, to verify that the filter pipeline is inherited for the groups
+ * that are created along the way */
+ /* Reopen file */
+ if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
+
+ /* Create lcpl, setting the "create intermediate groups" flag */
+ if((lcpl = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR
+ if(H5Pset_create_intermediate_group(lcpl, (unsigned)TRUE) < 0) TEST_ERROR
+
+ /* Create new group, with missing intermediate groups, in compressed group */
+ if((gid1 = H5Gcreate2(fid, "group1/group2/group3/group4", lcpl, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+
+ /* Close LCPL ID */
+ if(H5Pclose(lcpl) < 0) TEST_ERROR
+
+ /* Verify that new group doesn't have filters */
+ if((gcpl1 = H5Gget_create_plist(gid1)) < 0) TEST_ERROR
+ if(H5Pget_nfilters(gcpl1) != 0) TEST_ERROR
+
+ /* Close group & GCPL IDs */
+ if(H5Pclose(gcpl1) < 0) TEST_ERROR
+ if(H5Gclose(gid1) < 0) TEST_ERROR
+
+ /* Open intermediate groups that were created and verify that they have filters */
+ if((gid1 = H5Gopen2(fid, "group1/group2", H5P_DEFAULT)) < 0) TEST_ERROR
+ if((gcpl1 = H5Gget_create_plist(gid1)) < 0) TEST_ERROR
+ if(H5Pget_nfilters(gcpl1) != nfilters) TEST_ERROR
+ if(H5Pclose(gcpl1) < 0) TEST_ERROR
+ if(H5Gclose(gid1) < 0) TEST_ERROR
+ if((gid1 = H5Gopen2(fid, "group1/group2/group3", H5P_DEFAULT)) < 0) TEST_ERROR
+ if((gcpl1 = H5Gget_create_plist(gid1)) < 0) TEST_ERROR
+ if(H5Pget_nfilters(gcpl1) != nfilters) TEST_ERROR
+ if(H5Pclose(gcpl1) < 0) TEST_ERROR
+ if(H5Gclose(gid1) < 0) TEST_ERROR
+
+ /* Close file */
+ if(H5Fclose(fid) < 0) TEST_ERROR
+
+
+ /* Now create the same file with and without deflate, and verify that the
+ * file size is smaller with deflate */
+ /* But only if the deflate filter is available */
+ if((tri_ret = H5Zfilter_avail(H5Z_FILTER_DEFLATE)) < 0) TEST_ERROR
+ if(tri_ret) {
+ h5_stat_size_t filesize_filtered;
+ h5_stat_size_t filesize_unfiltered;
+
+ /* Create gcpl, force use of dense storage */
+ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) TEST_ERROR
+ if(H5Pset_link_phase_change(fcpl, 2, 2) < 0) TEST_ERROR
+
+ /* Create file */
+ if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ TEST_ERROR
+
+ /* Create links in file */
+ if(H5Lcreate_soft("/", fid, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if(H5Lcreate_soft("/", fid, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if(H5Lcreate_soft("/", fid, "cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+
+ /* Close file, get file size */
+ if(H5Fclose(fid) < 0) TEST_ERROR
+ filesize_unfiltered = h5_get_file_size(filename, fapl);
+
+ /* Set deflate fitler */
+ if(H5Pset_deflate(fcpl, 6) < 0) TEST_ERROR
+
+ /* Recreate the same file with the deflate filter */
+ if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ TEST_ERROR
+ if(H5Lcreate_soft("/", fid, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if(H5Lcreate_soft("/", fid, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if(H5Lcreate_soft("/", fid, "cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+
+ /* Close file, get file size */
+ if(H5Fclose(fid) < 0) TEST_ERROR
+ filesize_filtered = h5_get_file_size(filename, fapl);
+
+ /* Check that the file size is smaller with the filter */
+ if((double)filesize_filtered
+ > (filesize_unfiltered * FILTER_FILESIZE_MAX_FRACTION))
+ TEST_ERROR
+
+ /* Close */
+ if(H5Pclose(fcpl) < 0) TEST_ERROR
+ } /* end if */
+
+ PASSED();
+ return 0;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Gclose(gid1);
+ H5Gclose(gid2);
+ H5Fclose(fid);
+ H5Pclose(lcpl);
+ H5Pclose(gcpl1);
+ H5Pclose(gcpl2);
+ H5Pclose(fcpl);
+ } H5E_END_TRY;
+ return -1;
+} /* end link_filters() */
+
+
+/*-------------------------------------------------------------------------
* Function: corder_create_empty
*
* Purpose: Create an empty group with creation order indices
@@ -12971,7 +13370,6 @@ main(void)
my_fapl = fapl;
/* General tests... (on both old & new format groups */
-
nerrors += mklinks(my_fapl, new_format) < 0 ? 1 : 0;
nerrors += cklinks(my_fapl, new_format) < 0 ? 1 : 0;
nerrors += new_links(my_fapl, new_format) < 0 ? 1 : 0;
@@ -13025,7 +13423,6 @@ main(void)
nerrors += external_set_elink_fapl3(new_format) < 0 ? 1 : 0;
nerrors += external_set_elink_acc_flags(my_fapl, new_format) < 0 ? 1 : 0;
nerrors += external_set_elink_cb(my_fapl, new_format) < 0 ? 1 : 0;
-
#ifdef H5_HAVE_WINDOW_PATH
nerrors += external_link_win1(my_fapl, new_format) < 0 ? 1 : 0;
nerrors += external_link_win2(my_fapl, new_format) < 0 ? 1 : 0;
@@ -13037,6 +13434,7 @@ main(void)
nerrors += external_link_win8(my_fapl, new_format) < 0 ? 1 : 0;
nerrors += external_link_win9(my_fapl, new_format) < 0 ? 1 : 0;
#endif
+
/* These tests assume that external links are a form of UD links,
* so assume that everything that passed for external links
* above has already been tested for UD links.
@@ -13045,7 +13443,6 @@ main(void)
nerrors += ud_hard_links(fapl2) < 0 ? 1 : 0; /* requires new format groups */
nerrors += ud_link_reregister(fapl2) < 0 ? 1 : 0; /* requires new format groups */
} /* end if */
-
nerrors += ud_callbacks(my_fapl, new_format) < 0 ? 1 : 0;
nerrors += ud_link_errors(my_fapl, new_format) < 0 ? 1 : 0;
nerrors += lapl_udata(my_fapl, new_format) < 0 ? 1 : 0;
@@ -13058,6 +13455,7 @@ main(void)
nerrors += obj_visit(my_fapl, new_format) < 0 ? 1 : 0;
nerrors += obj_visit_by_name(my_fapl, new_format) < 0 ? 1 : 0;
nerrors += obj_visit_stop(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += link_filters(my_fapl, new_format) < 0 ? 1 : 0;
/* Keep this test last, it's testing files that are used above */
/* do not do this for files used by external link tests */
diff --git a/test/mf.c b/test/mf.c
index 3c88501..ca89b79 100644
--- a/test/mf.c
+++ b/test/mf.c
@@ -19,6 +19,7 @@
* test_mf_fs_*() tests for file memory that interact with the free-space manager
* test_mf_aggr_*() tests for file memory that interact with the aggregators
* test_mf_align_*() tests for file memory with alignment setting
+ * test_filespace_*() tests for file space management
*/
#include "h5test.h"
@@ -39,7 +40,14 @@
#define FILENAME_LEN 1024
+#define TEST_BLOCK_SIZE1 1
+#define TEST_BLOCK_SIZE2 2
+#define TEST_BLOCK_SIZE3 3
+#define TEST_BLOCK_SIZE4 4
#define TEST_BLOCK_SIZE5 5
+#define TEST_BLOCK_SIZE6 6
+#define TEST_BLOCK_SIZE7 7
+#define TEST_BLOCK_SIZE8 8
#define TEST_BLOCK_SIZE20 20
#define TEST_BLOCK_SIZE30 30
#define TEST_BLOCK_SIZE40 40
@@ -60,6 +68,12 @@
#define TEST_ALIGN1024 1024
#define TEST_ALIGN4096 4096
+#define TEST_THRESHOLD10 10
+#define TEST_THRESHOLD3 3
+
+#define CORE_INCREMENT 1024
+#define FAMILY_SIZE 1024
+
const char *FILENAME[] = {
"mf",
NULL
@@ -105,6 +119,11 @@ static unsigned test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t
static unsigned test_mf_align_alloc4(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl);
static unsigned test_mf_align_alloc5(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl);
static unsigned test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl);
+static unsigned test_mf_fs_persist(hid_t fapl_new, hid_t fcpl);
+static unsigned test_mf_fs_gone(hid_t fapl_new, hid_t fcpl);
+static unsigned test_mf_fs_split(hid_t fapl_new, hid_t fcpl);
+static unsigned test_mf_fs_multi(hid_t fapl, hid_t fcpl);
+static unsigned test_mf_fs_drivers(hid_t fapl);
/*
* Verify statistics for the free-space manager
@@ -5846,6 +5865,1345 @@ error:
} /* test_mf_align_alloc6() */
+/*
+ * Verify that the file's free-space manager persists where there are free sections in the manager
+ */
+static unsigned
+test_mf_fs_persist(hid_t fapl_new, hid_t fcpl)
+{
+ hid_t file = -1; /* File ID */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ H5FD_mem_t type; /* File allocation type */
+ H5FS_stat_t fs_stat; /* Information for free-space manager */
+ haddr_t addr1, addr2, addr3, addr4, addr5, addr6; /* File address for H5FD_MEM_SUPER */
+ haddr_t tmp_addr; /* Temporary variable for address */
+
+ TESTING("file's free-space manager is persistent");
+
+ /* Set the filename to use for this test (dependent on fapl) */
+ h5_fixname(FILENAME[0], fapl_new, filename, sizeof(filename));
+
+ /* Create the file to work on */
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl_new)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Get a pointer to the internal file object */
+ if(NULL == (f = (H5F_t *)H5I_object(file)))
+ FAIL_STACK_ERROR
+
+ /* Allocate 6 blocks */
+ type = H5FD_MEM_SUPER;
+ if(HADDR_UNDEF == (addr1 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE1)))
+ FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (addr2 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE2)))
+ FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (addr3 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE3)))
+ FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (addr4 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE4)))
+ FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (addr5 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE5)))
+ FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (addr6 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE6)))
+ FAIL_STACK_ERROR
+
+ /* Put block #1, #3, #5 to H5FD_MEM_SUPER free-space manager */
+ if(H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr1, (hsize_t)TEST_BLOCK_SIZE1) < 0)
+ FAIL_STACK_ERROR
+ if(H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr3, (hsize_t)TEST_BLOCK_SIZE3) < 0)
+ FAIL_STACK_ERROR
+ if(H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr5, (hsize_t)TEST_BLOCK_SIZE5) < 0)
+ FAIL_STACK_ERROR
+
+ if(H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
+
+ /* Re-open the file */
+ if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Get a pointer to the internal file object */
+ if(NULL == (f = (H5F_t *)H5I_object(file)))
+ FAIL_STACK_ERROR
+
+ /* Verify that H5FD_MEM_SUPER free-space manager is there */
+ if(!H5F_addr_defined(f->shared->fs_addr[type]))
+ TEST_ERROR
+
+ /* Start up H5FD_MEM_SUPER free-space manager */
+ if(H5MF_alloc_open(f, H5P_DATASET_XFER_DEFAULT, type) < 0)
+ FAIL_STACK_ERROR
+
+ /* Get info for free-space manager */
+ if(H5FS_stat_info(f, f->shared->fs_man[type], &fs_stat) < 0)
+ FAIL_STACK_ERROR
+
+ /* Verify free-space info */
+ if(fs_stat.tot_space < (TEST_BLOCK_SIZE1+TEST_BLOCK_SIZE3+TEST_BLOCK_SIZE5))
+ TEST_ERROR
+
+ if(fs_stat.serial_sect_count < 3)
+ TEST_ERROR
+
+ /* Retrieve block #3 from H5FD_MEM_SUPER free-space manager */
+ if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE3)))
+ FAIL_STACK_ERROR
+ if(tmp_addr != addr3)
+ TEST_ERROR
+
+ /* Retrieve block #1 from H5FD_MEM_SUPER free-space manager */
+ if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE1)))
+ FAIL_STACK_ERROR
+ if(tmp_addr != addr1)
+ TEST_ERROR
+
+ if(H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
+
+ /* Re-open the file */
+ if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Get a pointer to the internal file object */
+ if(NULL == (f = (H5F_t *)H5I_object(file)))
+ FAIL_STACK_ERROR
+
+ /* Verify that H5FD_MEM_SUPER free-space manager is there */
+ if(!H5F_addr_defined(f->shared->fs_addr[type]))
+ TEST_ERROR
+
+ /* Retrieve block #5 from H5FD_MEM_SUPER free-space manager */
+ if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE5)))
+ FAIL_STACK_ERROR
+ if(tmp_addr != addr5)
+ TEST_ERROR
+
+ if(H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
+
+ PASSED()
+
+ return(0);
+
+error:
+ H5E_BEGIN_TRY {
+ H5Fclose(file);
+ } H5E_END_TRY;
+ return(1);
+} /* test_mf_fs_persist() */
+
+/*
+ * Verify that the free-space manager goes away
+ */
+static unsigned
+test_mf_fs_gone(hid_t fapl_new, hid_t fcpl)
+{
+ hid_t file = -1; /* File ID */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ H5FD_mem_t type; /* File allocation type */
+ H5FS_stat_t fs_stat; /* Information for free-space manager */
+ haddr_t addr1, addr2, addr3, addr4; /* File address for H5FD_MEM_SUPER */
+
+ TESTING("file's free-space manager is going away");
+
+ /* Set the filename to use for this test (dependent on fapl) */
+ h5_fixname(FILENAME[0], fapl_new, filename, sizeof(filename));
+
+ /* Create the file to work on */
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl_new)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Get a pointer to the internal file object */
+ if(NULL == (f = (H5F_t *)H5I_object(file)))
+ FAIL_STACK_ERROR
+
+ /* Allocate 4 blocks */
+ type = H5FD_MEM_SUPER;
+ if(HADDR_UNDEF == (addr1 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE1)))
+ FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (addr2 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE2)))
+ FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (addr3 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE3)))
+ FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (addr4 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE4)))
+ FAIL_STACK_ERROR
+
+ /* Put block #1, #3 to H5FD_MEM_SUPER free-space manager */
+ if(H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr1, (hsize_t)TEST_BLOCK_SIZE1) < 0)
+ FAIL_STACK_ERROR
+ if(H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr3, (hsize_t)TEST_BLOCK_SIZE3) < 0)
+ FAIL_STACK_ERROR
+
+ /* Retrieve block #1, #3 from H5FD_MEM_SUPER free-space manager */
+ if(HADDR_UNDEF == (addr3 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE3)))
+ FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (addr1 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE1)))
+ FAIL_STACK_ERROR
+
+ if(H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
+
+ /* Re-open the file */
+ if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Get a pointer to the internal file object */
+ if(NULL == (f = (H5F_t *)H5I_object(file)))
+ FAIL_STACK_ERROR
+
+ /* Verify that the H5FD_MEM_SUPER free-space manager is not there */
+ if(H5F_addr_defined(f->shared->fs_addr[type]))
+ TEST_ERROR
+
+ /* Put block #3 to H5FD_MEM_SUPER free-space manager */
+ if(H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr3, (hsize_t)TEST_BLOCK_SIZE3) < 0)
+ FAIL_STACK_ERROR
+
+ if(H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
+
+ /* Re-open the file */
+ if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Get a pointer to the internal file object */
+ if(NULL == (f = (H5F_t *)H5I_object(file)))
+ FAIL_STACK_ERROR
+
+ /* Verify that H5FD_MEM_SUPER free-space manager is there */
+ if(!H5F_addr_defined(f->shared->fs_addr[type]))
+ TEST_ERROR
+
+ /* Start up H5FD_MEM_SUPER free-space manager */
+ if(H5MF_alloc_open(f, H5P_DATASET_XFER_DEFAULT, type) < 0)
+ FAIL_STACK_ERROR
+
+ /* Get info for H5FD_MEM_SUPER free-space manager */
+ if(H5FS_stat_info(f, f->shared->fs_man[type], &fs_stat) < 0)
+ FAIL_STACK_ERROR
+
+ /* Verify free-space info */
+ if(!H5F_addr_defined(fs_stat.addr) || !H5F_addr_defined(fs_stat.sect_addr))
+ TEST_ERROR
+ if(fs_stat.tot_space < TEST_BLOCK_SIZE3)
+ TEST_ERROR
+
+ /* Put block #4 to H5FD_MEM_SUPER free-space manager */
+ if(H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr4, (hsize_t)TEST_BLOCK_SIZE4) < 0)
+ FAIL_STACK_ERROR
+
+ /* The H5FD_MEM_SUPER free-space manager will go away at H5MF_close() */
+ if(H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
+
+ /* Re-open the file */
+ if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Get a pointer to the internal file object */
+ if(NULL == (f = (H5F_t *)H5I_object(file)))
+ FAIL_STACK_ERROR
+
+ /* Verify that the H5FD_MEM_SUPER free-space manager is not there */
+ if(H5F_addr_defined(f->shared->fs_addr[type]))
+ TEST_ERROR
+
+ if(H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
+
+ PASSED()
+
+ return(0);
+
+error:
+ H5E_BEGIN_TRY {
+ H5Fclose(file);
+ } H5E_END_TRY;
+ return(1);
+} /* test_mf_fs_gone() */
+
+
+/*
+ * Verify that the file's free-space manager(s) are persistent for a split-file
+ */
+static unsigned
+test_mf_fs_split(hid_t fapl_new, hid_t fcpl)
+{
+ hid_t file = -1; /* File ID */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ H5FD_mem_t type, stype, btype; /* File allocation type */
+ H5FS_stat_t fs_stat; /* Information for free-space manager */
+ haddr_t addr1, addr2, addr3, addr4; /* File address for H5FD_MEM_SUPER */
+ haddr_t saddr1, saddr2, saddr3, saddr4; /* File address for H5FD_MEM_DRAW */
+ haddr_t baddr5, baddr6, baddr7, baddr8; /* File address for H5FD_MEM_BTREE */
+ haddr_t tmp_addr; /* temporary variable for address */
+
+ TESTING("file's free-space managers are persistent for split-file");
+
+ /* Set the filename to use for this test (dependent on fapl) */
+ h5_fixname(FILENAME[0], fapl_new, filename, sizeof(filename));
+
+ /* Create the file to work on */
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl_new)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Get a pointer to the internal file object */
+ if(NULL == (f = (H5F_t *)H5I_object(file)))
+ FAIL_STACK_ERROR
+
+ /* Allocate 4 blocks of type H5FD_MEM_SUPER */
+ type = H5FD_MEM_SUPER;
+ if(HADDR_UNDEF == (addr1 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE1)))
+ FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (addr2 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE2)))
+ FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (addr3 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE3)))
+ FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (addr4 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE4)))
+ FAIL_STACK_ERROR
+
+ /* Put block #1, #3 into H5FD_MEM_SUPER free-space manager */
+ if(H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr1, (hsize_t)TEST_BLOCK_SIZE1) < 0)
+ FAIL_STACK_ERROR
+ if(H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr3, (hsize_t)TEST_BLOCK_SIZE3) < 0)
+ FAIL_STACK_ERROR
+
+ /* Allocate 4 blocks of type H5FD_MEM_DRAW */
+ stype = H5FD_MEM_DRAW;
+ if(HADDR_UNDEF == (saddr1 = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE1)))
+ FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (saddr2 = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE2)))
+ FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (saddr3 = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE3)))
+ FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (saddr4 = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE4)))
+ FAIL_STACK_ERROR
+
+ /* Put block #1, #3 into H5FD_MEM_DRAW free-space manager */
+ if(H5MF_xfree(f, stype, H5P_DATASET_XFER_DEFAULT, saddr1, (hsize_t)TEST_BLOCK_SIZE1) < 0)
+ FAIL_STACK_ERROR
+ if(H5MF_xfree(f, stype, H5P_DATASET_XFER_DEFAULT, saddr3, (hsize_t)TEST_BLOCK_SIZE3) < 0)
+ FAIL_STACK_ERROR
+
+ if(H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
+
+ /* Re-open the file */
+ if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Get a pointer to the internal file object */
+ if(NULL == (f = (H5F_t *)H5I_object(file)))
+ FAIL_STACK_ERROR
+
+ /* Verify that the H5FD_MEM_SUPER free-space manager is there */
+ if(!H5F_addr_defined(f->shared->fs_addr[type]))
+ TEST_ERROR
+
+ /* Start up H5FD_MEM_SUPER free-space manager */
+ if(H5MF_alloc_open(f, H5P_DATASET_XFER_DEFAULT, type) < 0)
+ FAIL_STACK_ERROR
+
+ /* Get free-space info */
+ if(H5FS_stat_info(f, f->shared->fs_man[type], &fs_stat) < 0)
+ FAIL_STACK_ERROR
+
+ /* Verify free-space info */
+ if(fs_stat.tot_space < (TEST_BLOCK_SIZE1+TEST_BLOCK_SIZE3))
+ TEST_ERROR
+ if(fs_stat.serial_sect_count < 2)
+ TEST_ERROR
+
+ /* Retrieve block #1 from H5FD_MEM_SUPER free-space manager; block #2 still in free-space */
+ if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE1)))
+ FAIL_STACK_ERROR
+ if(tmp_addr != addr1)
+ TEST_ERROR
+
+ /* Verify that the free-space manager for H5FD_MEM_DRAW is there */
+ if(!H5F_addr_defined(f->shared->fs_addr[stype]))
+ TEST_ERROR
+
+ /* Start up H5FD_MEM_DRAW free-space manager */
+ if(H5MF_alloc_open(f, H5P_DATASET_XFER_DEFAULT, stype) < 0)
+ FAIL_STACK_ERROR
+
+ /* Get free-space info */
+ if(H5FS_stat_info(f, f->shared->fs_man[stype], &fs_stat) < 0)
+ FAIL_STACK_ERROR
+
+ /* Verify free-space info */
+ if(fs_stat.tot_space < (TEST_BLOCK_SIZE1+TEST_BLOCK_SIZE3))
+ TEST_ERROR
+ if(fs_stat.serial_sect_count < 2)
+ TEST_ERROR
+
+ /* Retrieve blocks #1 from H5FD_MEM_DRAW free-space manager */
+ if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE1)))
+ FAIL_STACK_ERROR
+ if(tmp_addr != saddr1)
+ TEST_ERROR
+
+ /* Retrieve blocks #3 from H5FD_MEM_DRAW free-space manager */
+ if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE3)))
+ FAIL_STACK_ERROR
+ if(tmp_addr != saddr3)
+ TEST_ERROR
+ /* H5FD_MEM_DRAW free-space manager is going away at closing */
+ /* works for this one because the freeing of sect_addr is to H5FD_MEM_SUPER fs, not against itself */
+
+ /* Allocate 4 blocks of type H5FD_MEM_BTREE */
+ btype = H5FD_MEM_BTREE;
+ if(HADDR_UNDEF == (baddr5 = H5MF_alloc(f, btype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE5)))
+ FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (baddr6 = H5MF_alloc(f, btype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE6)))
+ FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (baddr7 = H5MF_alloc(f, btype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE7)))
+ FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (baddr8 = H5MF_alloc(f, btype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE8)))
+ FAIL_STACK_ERROR
+
+ /* Put block #5 & #7 into H5FD_MEM_BTREE free-space manager */
+ if(H5MF_xfree(f, btype, H5P_DATASET_XFER_DEFAULT, baddr5, (hsize_t)TEST_BLOCK_SIZE5) < 0)
+ FAIL_STACK_ERROR
+ if(H5MF_xfree(f, btype, H5P_DATASET_XFER_DEFAULT, baddr7, (hsize_t)TEST_BLOCK_SIZE7) < 0)
+ FAIL_STACK_ERROR
+
+ if(H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
+
+ /* Re-open the file */
+ if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Get a pointer to the internal file object */
+ if(NULL == (f = (H5F_t *)H5I_object(file)))
+ FAIL_STACK_ERROR
+
+ /* Verify that the free-space manager for H5FD_MEM_DRAW is not there */
+ if(H5F_addr_defined(f->shared->fs_addr[stype]))
+ TEST_ERROR
+
+ /* Verify that the free-space manager for H5FD_MEM_SUPER is there */
+ if(!H5F_addr_defined(f->shared->fs_addr[type]))
+ TEST_ERROR
+
+ /* Start up H5FD_MEM_SUPER free-space manager */
+ if(H5MF_alloc_open(f, H5P_DATASET_XFER_DEFAULT, type) < 0)
+ FAIL_STACK_ERROR
+
+ /* Get free-space info */
+ if(H5FS_stat_info(f, f->shared->fs_man[type], &fs_stat) < 0)
+ FAIL_STACK_ERROR
+
+ /* Verify free-space info */
+ if(fs_stat.tot_space < (TEST_BLOCK_SIZE3+TEST_BLOCK_SIZE5+TEST_BLOCK_SIZE7))
+ TEST_ERROR
+
+ /* Retrieve block #3 from H5FD_MEM_SUPER free-space manager */
+ if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE3)))
+ FAIL_STACK_ERROR
+ if(tmp_addr != addr3)
+ TEST_ERROR
+
+ /* Retrieve block #7 from H5FD_MEM_BTREE free-space manager */
+ if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, btype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE7)))
+ FAIL_STACK_ERROR
+ if(tmp_addr != baddr7)
+ TEST_ERROR
+
+ /* There should still be block #5 of H5FD_MEM_BTREE in H5FD_MEM_BTREE free-space manager */
+ if(H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
+
+ /* Re-open the file */
+ if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Get a pointer to the internal file object */
+ if(NULL == (f = (H5F_t *)H5I_object(file)))
+ FAIL_STACK_ERROR
+
+ /* Verify that the H5FD_MEM_SUPER free-space manager is there */
+ if(!H5F_addr_defined(f->shared->fs_addr[type]))
+ TEST_ERROR
+
+ /* Start up H5FD_MEM_SUPER free-space manager */
+ if(H5MF_alloc_open(f, H5P_DATASET_XFER_DEFAULT, type) < 0)
+ FAIL_STACK_ERROR
+
+ /* Get free-space info */
+ if(H5FS_stat_info(f, f->shared->fs_man[type], &fs_stat) < 0)
+ FAIL_STACK_ERROR
+
+ /* Verify free-space info */
+ if(fs_stat.tot_space < TEST_BLOCK_SIZE5)
+ TEST_ERROR
+
+ if(H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
+
+ PASSED()
+
+ return(0);
+
+error:
+ H5E_BEGIN_TRY {
+ H5Fclose(file);
+ } H5E_END_TRY;
+ return(1);
+} /* test_mf_fs_split() */
+
+/*
+ * Verify that the file's free-space manager(s) are persistent for a multi-file
+ */
+static unsigned
+test_mf_fs_multi(hid_t fapl_new, hid_t fcpl)
+{
+ hid_t file = -1; /* File ID */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ H5FD_mem_t type, stype, btype, gtype; /* File allocation type */
+ H5FS_stat_t fs_stat; /* Information for free-space manager */
+ haddr_t addr1, addr2, addr3, addr4; /* File allocation type */
+ haddr_t saddr1, saddr2, saddr3, saddr4; /* File address for H5FD_MEM_SUPER */
+ haddr_t baddr1, baddr2, baddr3, baddr4; /* File address for H5FD_MEM_DRAW */
+ haddr_t gaddr1, gaddr2; /* File address for H5FD_MEM_GHEAP */
+ haddr_t tmp_addr; /* Temporary variable for address */
+ H5FS_section_info_t *node; /* Free space section node */
+ htri_t node_found = FALSE; /* Indicate section is in free-space */
+
+ TESTING("file's free-space managers are persistent for multi-file");
+
+ /* Set the filename to use for this test (dependent on fapl) */
+ h5_fixname(FILENAME[0], fapl_new, filename, sizeof(filename));
+
+ /* Create the file to work on */
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl_new)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Get a pointer to the internal file object */
+ if(NULL == (f = (H5F_t *)H5I_object(file)))
+ FAIL_STACK_ERROR
+
+ /* Allocate 4 blocks of type H5FD_MEM_SUPER */
+ type = H5FD_MEM_SUPER;
+ if(HADDR_UNDEF == (addr1 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE1)))
+ FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (addr2 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE2)))
+ FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (addr3 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE3)))
+ FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (addr4 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE4)))
+ FAIL_STACK_ERROR
+
+ /* Put block #1, #3 into H5FD_MEM_SUPER free-space manager */
+ if(H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr1, (hsize_t)TEST_BLOCK_SIZE1) < 0)
+ FAIL_STACK_ERROR
+ if(H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr3, (hsize_t)TEST_BLOCK_SIZE3) < 0)
+ FAIL_STACK_ERROR
+
+ /* Allocate 4 blocks of type H5FD_MEM_DRAW */
+ stype = H5FD_MEM_DRAW;
+ if(HADDR_UNDEF == (saddr1 = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE1)))
+ FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (saddr2 = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE2)))
+ FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (saddr3 = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE3)))
+ FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (saddr4 = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE4)))
+ FAIL_STACK_ERROR
+
+ /* Put block #1, #3 into H5FD_MEM_DRAW free-space manager */
+ if(H5MF_xfree(f, stype, H5P_DATASET_XFER_DEFAULT, saddr1, (hsize_t)TEST_BLOCK_SIZE1) < 0)
+ FAIL_STACK_ERROR
+ if(H5MF_xfree(f, stype, H5P_DATASET_XFER_DEFAULT, saddr3, (hsize_t)TEST_BLOCK_SIZE3) < 0)
+ FAIL_STACK_ERROR
+
+ if(H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
+
+ /* Re-open the file */
+ if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Get a pointer to the internal file object */
+ if(NULL == (f = (H5F_t *)H5I_object(file)))
+ FAIL_STACK_ERROR
+
+ /* Verify that the H5FD_MEM_SUPER free-space manager is there */
+ if(!H5F_addr_defined(f->shared->fs_addr[type]))
+ TEST_ERROR
+
+ /* Start up H5FD_MEM_SUPER free-space manager */
+ if(H5MF_alloc_open(f, H5P_DATASET_XFER_DEFAULT, type) < 0)
+ FAIL_STACK_ERROR
+
+ /* Get free-space info */
+ if(H5FS_stat_info(f, f->shared->fs_man[type], &fs_stat) < 0)
+ FAIL_STACK_ERROR
+
+ /* Verify free-space info */
+ if(fs_stat.tot_space < (TEST_BLOCK_SIZE1+TEST_BLOCK_SIZE3))
+ TEST_ERROR
+ if(fs_stat.serial_sect_count < 2)
+ TEST_ERROR
+
+ /* Retrieve block #1 from H5FD_MEM_SUPER free-space manager; block #2 still in free-space */
+ if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE1)))
+ FAIL_STACK_ERROR
+ if(tmp_addr != addr1)
+ TEST_ERROR
+
+ /* Verify that the free-space manager for H5FD_MEM_DRAW is there */
+ if(!H5F_addr_defined(f->shared->fs_addr[stype]))
+ TEST_ERROR
+
+ /* Start up H5FD_MEM_DRAW free-space manager */
+ if(H5MF_alloc_open(f, H5P_DATASET_XFER_DEFAULT, stype) < 0)
+ FAIL_STACK_ERROR
+
+ /* Get free-space info */
+ if(H5FS_stat_info(f, f->shared->fs_man[stype], &fs_stat) < 0)
+ FAIL_STACK_ERROR
+
+ /* Verify free-space info */
+ if(fs_stat.tot_space < (TEST_BLOCK_SIZE1+TEST_BLOCK_SIZE3))
+ TEST_ERROR
+ if(fs_stat.serial_sect_count < 2)
+ TEST_ERROR
+
+ /* Retrieve blocks #1 from H5FD_MEM_DRAW free-space manager */
+ if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE1)))
+ FAIL_STACK_ERROR
+ if(tmp_addr != saddr1)
+ TEST_ERROR
+
+ /* Retrieve blocks #3 from H5FD_MEM_DRAW free-space manager */
+ if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE3)))
+ FAIL_STACK_ERROR
+ if(tmp_addr != saddr3)
+ TEST_ERROR
+
+ /* Allocate 4 blocks of type H5FD_MEM_BTREE */
+ btype = H5FD_MEM_BTREE;
+ if(HADDR_UNDEF == (baddr1 = H5MF_alloc(f, btype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE1)))
+ FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (baddr2 = H5MF_alloc(f, btype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE2)))
+ FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (baddr3 = H5MF_alloc(f, btype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE3)))
+ FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (baddr4 = H5MF_alloc(f, btype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE4)))
+ FAIL_STACK_ERROR
+
+ /* Put block #1 & #3 into H5FD_MEM_BTREE free-space manager */
+ if(H5MF_xfree(f, btype, H5P_DATASET_XFER_DEFAULT, baddr1, (hsize_t)TEST_BLOCK_SIZE1) < 0)
+ FAIL_STACK_ERROR
+ if(H5MF_xfree(f, btype, H5P_DATASET_XFER_DEFAULT, baddr3, (hsize_t)TEST_BLOCK_SIZE3) < 0)
+ FAIL_STACK_ERROR
+
+ if(H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
+
+ /* Re-open the file */
+ if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Get a pointer to the internal file object */
+ if(NULL == (f = (H5F_t *)H5I_object(file)))
+ FAIL_STACK_ERROR
+
+ /* Verify that the free-space manager for H5FD_MEM_SUPER is there */
+ if(!H5F_addr_defined(f->shared->fs_addr[type]))
+ TEST_ERROR
+
+ /* Start up H5FD_MEM_SUPER free-space manager */
+ if(H5MF_alloc_open(f, H5P_DATASET_XFER_DEFAULT, type) < 0)
+ FAIL_STACK_ERROR
+
+ /* Get free-space info */
+ if(H5FS_stat_info(f, f->shared->fs_man[type], &fs_stat) < 0)
+ FAIL_STACK_ERROR
+
+ /* Verify free-space info */
+ if(fs_stat.tot_space < TEST_BLOCK_SIZE3)
+ TEST_ERROR
+
+ /* Retrieve block #3 from H5FD_MEM_SUPER free-space manager */
+ if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE3)))
+ FAIL_STACK_ERROR
+ if(tmp_addr != addr3)
+ TEST_ERROR
+
+ /* Verify that the free-space manager for H5FD_MEM_DRAW is not there */
+ if(H5F_addr_defined(f->shared->fs_addr[stype]))
+ TEST_ERROR
+
+ /* Verify that the free-space manager for H5FD_MEM_BTREE is there */
+ if(!H5F_addr_defined(f->shared->fs_addr[btype]))
+ TEST_ERROR
+
+ /* Start up H5FD_MEM_BTREE free-space manager */
+ if(H5MF_alloc_open(f, H5P_DATASET_XFER_DEFAULT, btype) < 0)
+ FAIL_STACK_ERROR
+
+ /* Get free-space info */
+ if(H5FS_stat_info(f, f->shared->fs_man[btype], &fs_stat) < 0)
+ FAIL_STACK_ERROR
+
+ /* Verify free-space info */
+ if(fs_stat.tot_space < (TEST_BLOCK_SIZE1+TEST_BLOCK_SIZE3))
+ TEST_ERROR
+ if(fs_stat.serial_sect_count < 2)
+ TEST_ERROR
+
+ /* Allocate 2 blocks of type H5FD_MEM_GHEAP */
+ gtype = H5FD_MEM_GHEAP;
+ if(HADDR_UNDEF == (gaddr2 = H5MF_alloc(f, gtype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE2)))
+ FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (gaddr1 = H5MF_alloc(f, gtype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE1)))
+ FAIL_STACK_ERROR
+
+ /* Put block #2 into H5FD_MEM_GHEAP free-space manager */
+ if(H5MF_xfree(f, gtype, H5P_DATASET_XFER_DEFAULT, gaddr2, (hsize_t)TEST_BLOCK_SIZE2) < 0)
+ FAIL_STACK_ERROR
+
+ if(H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
+
+ /* Re-open the file */
+ if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Get a pointer to the internal file object */
+ if(NULL == (f = (H5F_t *)H5I_object(file)))
+ FAIL_STACK_ERROR
+
+ /* If H5FD_MEM_SUPER is there, should not find block #1 & #3 */
+ if(H5F_addr_defined(f->shared->fs_addr[type])) {
+ /* Start up H5FD_MEM_SUPER free-space manager */
+ if(H5MF_alloc_open(f, H5P_DATASET_XFER_DEFAULT, type) < 0)
+ FAIL_STACK_ERROR
+
+ if((node_found = H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type],
+ (hsize_t)TEST_BLOCK_SIZE1, (H5FS_section_info_t **)&node)) < 0)
+ FAIL_STACK_ERROR
+ if(node_found) TEST_ERROR
+
+ if((node_found = H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type],
+ (hsize_t)TEST_BLOCK_SIZE3, (H5FS_section_info_t **)&node)) < 0)
+ FAIL_STACK_ERROR
+ if(node_found) TEST_ERROR
+ }
+
+ /* Verify that the H5FD_MEM_GHEAP free-space manager is there */
+ if(!H5F_addr_defined(f->shared->fs_addr[gtype]))
+ TEST_ERROR
+
+ /* Start up H5FD_MEM_GHEAP free-space manager */
+ if(H5MF_alloc_open(f, H5P_DATASET_XFER_DEFAULT, gtype) < 0)
+ FAIL_STACK_ERROR
+
+ /* Get free-space info */
+ if(H5FS_stat_info(f, f->shared->fs_man[gtype], &fs_stat) < 0)
+ FAIL_STACK_ERROR
+
+ /* Verify free-space info */
+ if(fs_stat.tot_space < TEST_BLOCK_SIZE2)
+ TEST_ERROR
+
+ if(H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
+
+ PASSED()
+
+ return(0);
+
+error:
+ H5E_BEGIN_TRY {
+ H5Fclose(file);
+ } H5E_END_TRY;
+ return(1);
+} /* test_mf_fs_multi() */
+
+#define MULTI_SETUP(memb_map, memb_fapl, memb_name, memb_addr, sv) { \
+ H5FD_mem_t mt; \
+ HDmemset(memb_map, 0, sizeof memb_map); \
+ HDmemset(memb_fapl, 0, sizeof memb_fapl); \
+ HDmemset(memb_name, 0, sizeof memb_name); \
+ HDmemset(memb_addr, 0, sizeof memb_addr); \
+ HDmemset(sv, 0, sizeof sv); \
+ for (mt = 0; mt < H5FD_MEM_NTYPES; mt++) { \
+ memb_map[mt] = H5FD_MEM_SUPER; \
+ memb_fapl[mt] = H5P_DEFAULT; \
+ } \
+ memb_map[H5FD_MEM_BTREE] = H5FD_MEM_BTREE; \
+ memb_map[H5FD_MEM_DRAW] = H5FD_MEM_DRAW; \
+ memb_map[H5FD_MEM_GHEAP] = H5FD_MEM_GHEAP; \
+ memb_map[H5FD_MEM_LHEAP] = H5FD_MEM_LHEAP; \
+ sprintf(sv[H5FD_MEM_SUPER], "%%s-%c.h5", 's'); \
+ memb_name[H5FD_MEM_SUPER] = sv[H5FD_MEM_SUPER]; \
+ memb_addr[H5FD_MEM_SUPER] = 0; \
+ sprintf(sv[H5FD_MEM_BTREE], "%%s-%c.h5", 'b'); \
+ memb_name[H5FD_MEM_BTREE] = sv[H5FD_MEM_BTREE]; \
+ memb_addr[H5FD_MEM_BTREE] = HADDR_MAX/6; \
+ sprintf(sv[H5FD_MEM_DRAW], "%%s-%c.h5", 'r'); \
+ memb_name[H5FD_MEM_DRAW] = sv[H5FD_MEM_DRAW]; \
+ memb_addr[H5FD_MEM_DRAW] = HADDR_MAX/3; \
+ sprintf(sv[H5FD_MEM_GHEAP], "%%s-%c.h5", 'g'); \
+ memb_name[H5FD_MEM_GHEAP] = sv[H5FD_MEM_GHEAP]; \
+ memb_addr[H5FD_MEM_GHEAP] = HADDR_MAX/2; \
+ sprintf(sv[H5FD_MEM_LHEAP], "%%s-%c.h5", 'l'); \
+ memb_name[H5FD_MEM_LHEAP] = sv[H5FD_MEM_LHEAP]; \
+ memb_addr[H5FD_MEM_LHEAP] = HADDR_MAX*2/3; \
+ sprintf(sv[H5FD_MEM_OHDR], "%%s-%c.h5", 'o'); \
+ memb_name[H5FD_MEM_OHDR] = sv[H5FD_MEM_OHDR]; \
+ memb_addr[H5FD_MEM_OHDR] = HADDR_MAX*5/6; \
+}
+
+/*
+ * Tests to verify that file's free-space managers are persistent or going away
+ * for different drivers.
+ */
+static unsigned
+test_mf_fs_drivers(hid_t fapl)
+{
+ hid_t fcpl; /* file creation property list */
+ hid_t fapl_new; /* copy of file access property list */
+ hid_t fapl2; /* copy of file access property list */
+ hbool_t new_format; /* To use new library format or not */
+ unsigned ret = 0; /* return value */
+
+ H5FD_mem_t memb_map[H5FD_MEM_NTYPES]; /* Memory usage map */
+ hid_t memb_fapl[H5FD_MEM_NTYPES]; /* Member access properties */
+ char sv[H5FD_MEM_NTYPES][500]; /* Name generators */
+ const char *memb_name[H5FD_MEM_NTYPES]; /* Name generators */
+ haddr_t memb_addr[H5FD_MEM_NTYPES]; /* Member starting address */
+
+ /* Create a non-standard file-creation template */
+ fcpl = H5Pcreate(H5P_FILE_CREATE);
+ if(H5Pset_file_space(fcpl, H5F_FILE_SPACE_ALL_PERSIST, (hsize_t)0) < 0)
+ TEST_ERROR
+
+ /* Copy the file access property list */
+ if((fapl2 = H5Pcopy(fapl)) < 0) TEST_ERROR
+
+ /* Set the "use the latest version of the format" bounds for creating objects in the file */
+ if(H5Pset_libver_bounds(fapl2, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ TEST_ERROR
+
+ /* Test with old and new format */
+ for(new_format = FALSE; new_format <= TRUE; new_format++) {
+
+ if(new_format)
+ HDputs("Testing the following tests for free-space managers with new library format...");
+ else
+ HDputs("Testing the following tests for free-space managers with old library format...");
+
+ /* SEC2 */
+ HDputs("Testing free-space manager(s) with sec2 driver");
+
+ if((fapl_new = H5Pcopy(new_format ? fapl2 : fapl)) < 0) TEST_ERROR
+
+ if(H5Pset_fapl_sec2(fapl_new) < 0)
+ FAIL_STACK_ERROR
+
+ ret += test_mf_fs_gone(fapl_new, fcpl);
+ ret += test_mf_fs_persist(fapl_new, fcpl);
+
+ h5_cleanup(FILENAME, fapl_new);
+
+
+ /* STDIO */
+ HDputs("Testing free-space managers with stdio driver");
+
+ if((fapl_new = H5Pcopy(new_format?fapl2:fapl)) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pset_fapl_stdio(fapl_new) < 0)
+ FAIL_STACK_ERROR
+
+ ret += test_mf_fs_gone(fapl_new, fcpl);
+ ret += test_mf_fs_persist(fapl_new, fcpl);
+
+ h5_cleanup(FILENAME, fapl_new);
+
+ /* CORE */
+ HDputs("Testing free-space managers with core driver");
+
+ /* create fapl to be a "core" file */
+ if((fapl_new = H5Pcopy(new_format?fapl2:fapl)) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pset_fapl_core(fapl_new, (size_t)CORE_INCREMENT, TRUE) < 0)
+ FAIL_STACK_ERROR
+
+ ret += test_mf_fs_gone(fapl_new, fcpl);
+ ret += test_mf_fs_persist(fapl_new, fcpl);
+
+ h5_cleanup(FILENAME, fapl_new);
+
+ /* FAMILY */
+ HDputs("Testing free-space managers with family driver");
+
+ if((fapl_new = H5Pcopy(new_format?fapl2:fapl)) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pset_fapl_family(fapl_new, (hsize_t)FAMILY_SIZE, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+
+ ret += test_mf_fs_persist(fapl_new, fcpl);
+
+ h5_cleanup(FILENAME, fapl_new);
+
+ /* SPLIT */
+ HDputs("Testing free-space managers with split driver");
+
+ if((fapl_new = H5Pcopy(new_format?fapl2:fapl)) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pset_fapl_split(fapl_new, "-m.h5", H5P_DEFAULT, "-r.h5", H5P_DEFAULT)<0)
+ FAIL_STACK_ERROR
+
+ ret += test_mf_fs_persist(fapl_new, fcpl);
+ ret += test_mf_fs_split(fapl_new, fcpl);
+
+ h5_cleanup(FILENAME, fapl_new);
+
+ /* MULTI */
+ HDputs("Testing free-space managers with multi driver");
+
+ MULTI_SETUP(memb_map, memb_fapl, memb_name, memb_addr, sv)
+
+ if((fapl_new = H5Pcopy(new_format?fapl2:fapl)) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pset_fapl_multi(fapl_new, memb_map, memb_fapl, memb_name, memb_addr, TRUE) < 0)
+ TEST_ERROR;
+
+ ret += test_mf_fs_multi(fapl_new, fcpl);
+
+ h5_cleanup(FILENAME, fapl_new);
+
+ } /* end for new_format */
+
+ if (H5Pclose(fcpl) < 0)
+ FAIL_STACK_ERROR
+ if (H5Pclose(fapl2) < 0)
+ FAIL_STACK_ERROR
+
+ return(ret);
+
+error:
+ return(1);
+} /* test_mf_fs_drivers() */
+
+
+/*
+ * Verify that file space management performs according to the
+ * file space strategy and free space threshold as specified.
+ */
+static unsigned
+test_filespace_strategy_threshold(hid_t fapl_new)
+{
+ hid_t file = -1; /* File ID */
+ hid_t fcpl; /* File creation property list template */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ H5FD_mem_t type; /* File allocation type */
+ haddr_t addr1, addr2, addr3, addr4, addr5, addr6; /* File address for H5FD_MEM_SUPER */
+ haddr_t tmp_addr; /* Temporary variable for address */
+ H5F_file_space_type_t fs_type; /* File space handling strategy */
+ hsize_t fs_threshold; /* Free space section threshold */
+ hsize_t tot_space, saved_tot_space; /* Total amount of free space */
+ hsize_t tot_sect_count, saved_tot_sect_count; /* # of free-space sections */
+
+ TESTING("file space strategy and threshold");
+
+ /* Set the filename to use for this test (dependent on fapl) */
+ h5_fixname(FILENAME[0], fapl_new, filename, sizeof(filename));
+
+ for(fs_threshold = 0; fs_threshold <= TEST_THRESHOLD10; fs_threshold++) {
+
+ for(fs_type = H5F_FILE_SPACE_ALL_PERSIST; fs_type < H5F_FILE_SPACE_NTYPES; H5_INC_ENUM(H5F_file_space_type_t, fs_type)) {
+
+ /* Create file-creation template */
+ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Set default file space information */
+ if(H5Pset_file_space(fcpl, fs_type, fs_threshold) < 0)
+ FAIL_STACK_ERROR
+
+ /* Create the file to work on */
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl_new)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Get a pointer to the internal file object */
+ if(NULL == (f = (H5F_t *)H5I_object(file)))
+ FAIL_STACK_ERROR
+
+ /* Allocate 6 blocks */
+ type = H5FD_MEM_SUPER;
+ if(HADDR_UNDEF == (addr1 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE1)))
+ FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (addr2 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE2)))
+ FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (addr3 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE3)))
+ FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (addr4 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE4)))
+ FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (addr5 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE5)))
+ FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (addr6 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE6)))
+ FAIL_STACK_ERROR
+
+ /* Put block #1, #3, #5 to H5FD_MEM_SUPER free-space manager */
+ if(H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr1, (hsize_t)TEST_BLOCK_SIZE1) < 0)
+ FAIL_STACK_ERROR
+ if(H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr3, (hsize_t)TEST_BLOCK_SIZE3) < 0)
+ FAIL_STACK_ERROR
+ if(H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr5, (hsize_t)TEST_BLOCK_SIZE5) < 0)
+ FAIL_STACK_ERROR
+
+ /* Retrieve the total amount of free space and # of free-space sections */
+ if(f->shared->fs_man[type] &&
+ H5FS_sect_stats(f->shared->fs_man[type], &saved_tot_space, &saved_tot_sect_count) < 0)
+ FAIL_STACK_ERROR
+
+ /* H5F_FILE_SPACE_AGGR_VFD and H5F_FILE_SPACE_VFD: should not have free-space manager */
+ if(fs_type > H5F_FILE_SPACE_ALL && f->shared->fs_man[type])
+ TEST_ERROR
+
+ /* Close the file */
+ if(H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
+
+ /* Re-open the file */
+ if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Get a pointer to the internal file object */
+ if(NULL == (f = (H5F_t *)H5I_object(file)))
+ FAIL_STACK_ERROR
+
+ switch(fs_type) {
+ case H5F_FILE_SPACE_ALL_PERSIST:
+ if(fs_threshold <= TEST_BLOCK_SIZE5) {
+ if(!H5F_addr_defined(f->shared->fs_addr[type]))
+ TEST_ERROR
+
+ /* Open the free-space manager */
+ if(H5MF_alloc_open(f, H5P_DATASET_XFER_DEFAULT, type) < 0)
+ FAIL_STACK_ERROR
+
+ /* Retrieve the total amount of free space and # of free-space sections */
+ if(H5FS_sect_stats(f->shared->fs_man[type], &tot_space, &tot_sect_count) < 0)
+ FAIL_STACK_ERROR
+
+ /* Verify that tot_space should be >= saved_tot_space */
+ /* Verify that tot_sect_count should be >= saved_tot_sect_count */
+ if(tot_space < saved_tot_space || tot_sect_count < saved_tot_sect_count)
+ TEST_ERROR
+
+ /* Retrieve block #5 from H5FD_MEM_SUPER free-space manager */
+ if(HADDR_UNDEF ==
+ (tmp_addr = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE5)))
+ FAIL_STACK_ERROR
+
+ /* Should be the same as before */
+ if(tmp_addr != addr5)
+ TEST_ERROR
+ } else if(H5F_addr_defined(f->shared->fs_addr[type]))
+ TEST_ERROR
+ break;
+
+ case H5F_FILE_SPACE_ALL:
+ case H5F_FILE_SPACE_AGGR_VFD:
+ case H5F_FILE_SPACE_VFD:
+ if(H5F_addr_defined(f->shared->fs_addr[type]))
+ TEST_ERROR
+ break;
+
+ default:
+ break;
+ } /* end switch */
+
+ /* Closing */
+ if(H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pclose(fcpl) < 0)
+ FAIL_STACK_ERROR
+
+ } /* end for fs_type */
+ } /* end for fs_threshold */
+
+ PASSED()
+
+ return(0);
+
+error:
+ H5E_BEGIN_TRY {
+ H5Fclose(file);
+ } H5E_END_TRY;
+ return(1);
+} /* test_filespace_strategy_threshold() */
+
+/*
+ * Verify section is merged/shrunk away for
+ * H5F_FILE_SPACE_ALL_PERSIST and H5F_FILE_SPACE_ALL strategy.
+ */
+static unsigned
+test_filespace_gone(hid_t fapl_new)
+{
+ hid_t file = -1; /* File ID */
+ hid_t fcpl; /* File creation propertly list template */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ H5FD_mem_t type; /* File allocation type */
+ haddr_t addr1, addr2, addr3, addr4, addr5, addr6; /* File address for H5FD_MEM_SUPER */
+ H5F_file_space_type_t fs_type; /* File space handling strategy */
+ hsize_t fs_threshold; /* Free space section threshold */
+ frspace_state_t state; /* State of free space manager */
+
+ TESTING("file space merge/shrink for section size < threshold");
+
+ /* Set the filename to use for this test (dependent on fapl) */
+ h5_fixname(FILENAME[0], fapl_new, filename, sizeof(filename));
+
+ /* Set free-space threshold */
+ fs_threshold = TEST_THRESHOLD3;
+
+ for(fs_type = H5F_FILE_SPACE_ALL_PERSIST; fs_type <= H5F_FILE_SPACE_ALL; H5_INC_ENUM(H5F_file_space_type_t, fs_type)) {
+ /* Create file-creation template */
+ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Set default file space information */
+ if(H5Pset_file_space(fcpl, fs_type, fs_threshold) < 0)
+ FAIL_STACK_ERROR
+
+ /* Create the file to work on */
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl_new)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Get a pointer to the internal file object */
+ if(NULL == (f = (H5F_t *)H5I_object(file)))
+ FAIL_STACK_ERROR
+
+ /* Allocate 6 blocks */
+ type = H5FD_MEM_SUPER;
+ if(HADDR_UNDEF == (addr1 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE1)))
+ FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (addr2 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE2)))
+ FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (addr3 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE3)))
+ FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (addr4 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE4)))
+ FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (addr5 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE5)))
+ FAIL_STACK_ERROR
+ if(HADDR_UNDEF == (addr6 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE6)))
+ FAIL_STACK_ERROR
+
+ /* Put block #3, #5 to H5FD_MEM_SUPER free-space manager */
+ if(H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr3, (hsize_t)TEST_BLOCK_SIZE3) < 0)
+ FAIL_STACK_ERROR
+ if(H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr5, (hsize_t)TEST_BLOCK_SIZE5) < 0)
+ FAIL_STACK_ERROR
+
+ HDmemset(&state, 0, sizeof(frspace_state_t));
+ state.tot_space += TEST_BLOCK_SIZE3 + TEST_BLOCK_SIZE5;
+ state.tot_sect_count += 2;
+ state.serial_sect_count += 2;
+
+ if(check_stats(f, f->shared->fs_man[type], &state))
+ TEST_ERROR
+
+ /* section #2 is less than threshold but is merged into section #3 */
+ if(H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr2, (hsize_t)TEST_BLOCK_SIZE2) < 0)
+ FAIL_STACK_ERROR
+
+ state.tot_space += TEST_BLOCK_SIZE2;
+ if(check_stats(f, f->shared->fs_man[type], &state))
+ TEST_ERROR
+
+ if(H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr4, (hsize_t)TEST_BLOCK_SIZE4) < 0)
+ FAIL_STACK_ERROR
+
+ if(H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr6, (hsize_t)TEST_BLOCK_SIZE6) < 0)
+ FAIL_STACK_ERROR
+
+ /* all sections should be shrunk away except section #1 */
+ HDmemset(&state, 0, sizeof(frspace_state_t));
+ if(check_stats(f, f->shared->fs_man[type], &state))
+ TEST_ERROR
+
+ /* section #1 is less than threshold but is shrunk away */
+ if(H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr1, (hsize_t)TEST_BLOCK_SIZE1) < 0)
+ FAIL_STACK_ERROR
+
+ /* free-space manager should be empty */
+ HDmemset(&state, 0, sizeof(frspace_state_t));
+ if(check_stats(f, f->shared->fs_man[type], &state))
+ TEST_ERROR
+
+ if(H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
+
+ /* Re-open the file */
+ if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Get a pointer to the internal file object */
+ if(NULL == (f = (H5F_t *)H5I_object(file)))
+ FAIL_STACK_ERROR
+
+ /* free-space manager should be empty */
+ if(H5F_addr_defined(f->shared->fs_addr[type]))
+ TEST_ERROR
+
+ if(H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
+
+ if(H5Pclose(fcpl) < 0)
+ FAIL_STACK_ERROR
+
+ } /* end for fs_type */
+
+ PASSED()
+
+ return(0);
+
+error:
+ H5E_BEGIN_TRY {
+ H5Fclose(file);
+ } H5E_END_TRY;
+ return(1);
+} /* test_filespace_gone() */
+
+/*
+ * Tests to verify file space management for different drivers.
+ */
+static unsigned
+test_filespace_drivers(hid_t fapl)
+{
+ hid_t fapl_new; /* copy of file access property list */
+ hid_t fapl2; /* copy of file access property list */
+ hbool_t new_format; /* Using library new format or not */
+ unsigned ret = 0; /* return value */
+
+ H5FD_mem_t memb_map[H5FD_MEM_NTYPES]; /* Memory usage map */
+ hid_t memb_fapl[H5FD_MEM_NTYPES]; /* Member access properties */
+ char sv[H5FD_MEM_NTYPES][500]; /* Name generators */
+ const char *memb_name[H5FD_MEM_NTYPES]; /* Name generators */
+ haddr_t memb_addr[H5FD_MEM_NTYPES]; /* Member starting address */
+
+ /* Copy the file access property list */
+ if((fapl2 = H5Pcopy(fapl)) < 0) TEST_ERROR
+
+ /* Set the "use the latest version of the format" bounds for creating objects in the file */
+ if(H5Pset_libver_bounds(fapl2, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ TEST_ERROR
+
+ /* Test with old and new format */
+ for(new_format = FALSE; new_format <= TRUE; new_format++) {
+
+ if(new_format)
+ HDputs("Testing the following tests for file space management with new library format...");
+ else
+ HDputs("Testing the following tests for file space management with old library format...");
+
+ /* SEC2 */
+ HDputs("Testing file space management with sec2 driver");
+
+ if((fapl_new = H5Pcopy(new_format?fapl2:fapl)) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pset_fapl_sec2(fapl_new) < 0)
+ FAIL_STACK_ERROR
+
+ ret += test_filespace_strategy_threshold(fapl_new);
+ ret += test_filespace_gone(fapl_new);
+
+ h5_cleanup(FILENAME, fapl_new);
+
+ /* STDIO */
+ HDputs("Testing file space management with stdio driver");
+
+ if((fapl_new = H5Pcopy(new_format?fapl2:fapl)) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pset_fapl_stdio(fapl_new) < 0)
+ FAIL_STACK_ERROR
+
+ ret += test_filespace_strategy_threshold(fapl_new);
+ ret += test_filespace_gone(fapl_new);
+
+ h5_cleanup(FILENAME, fapl_new);
+
+ /* CORE */
+ HDputs("Testing file space management with core driver");
+
+ /* create fapl to be a "core" file */
+ if((fapl_new = H5Pcopy(new_format?fapl2:fapl)) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pset_fapl_core(fapl_new, (size_t)CORE_INCREMENT, TRUE) < 0)
+ FAIL_STACK_ERROR
+
+ ret += test_filespace_strategy_threshold(fapl_new);
+ ret += test_filespace_gone(fapl_new);
+
+ h5_cleanup(FILENAME, fapl_new);
+
+ /* FAMILY */
+ HDputs("Testing file space managers with family driver");
+
+ if((fapl_new = H5Pcopy(new_format?fapl2:fapl)) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pset_fapl_family(fapl_new, (hsize_t)FAMILY_SIZE, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+
+ ret += test_filespace_strategy_threshold(fapl_new);
+ ret += test_filespace_gone(fapl_new);
+
+ h5_cleanup(FILENAME, fapl_new);
+
+
+ /* SPLIT */
+ HDputs("Testing file space managers with split driver");
+
+ if((fapl_new = H5Pcopy(new_format?fapl2:fapl)) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pset_fapl_split(fapl_new, "-m.h5", H5P_DEFAULT, "-r.h5", H5P_DEFAULT)<0)
+ FAIL_STACK_ERROR
+
+ ret += test_filespace_strategy_threshold(fapl_new);
+ ret += test_filespace_gone(fapl_new);
+
+ h5_cleanup(FILENAME, fapl_new);
+
+ /* MULTI */
+ HDputs("Testing file space managers with multi driver");
+
+ MULTI_SETUP(memb_map, memb_fapl, memb_name, memb_addr, sv)
+
+ if((fapl_new = H5Pcopy(new_format?fapl2:fapl)) < 0)
+ TEST_ERROR
+ if(H5Pset_fapl_multi(fapl_new, memb_map, memb_fapl, memb_name, memb_addr, TRUE) < 0)
+ TEST_ERROR;
+
+ ret += test_filespace_strategy_threshold(fapl_new);
+ ret += test_filespace_gone(fapl_new);
+
+ h5_cleanup(FILENAME, fapl_new);
+
+ } /* end for new_format */
+
+ if (H5Pclose(fapl2) < 0)
+ FAIL_STACK_ERROR
+
+ return(ret);
+
+error:
+ return(1);
+} /* test_filespace_drivers() */
+
int
main(void)
{
@@ -5930,6 +7288,12 @@ main(void)
nerrors += test_mf_align_alloc6(env_h5_drvr, fapl, new_fapl);
} /* end if */
+ /* tests to verify that file's free-space managers are persistent */
+ nerrors += test_mf_fs_drivers(fapl);
+
+ /* tests for file space management */
+ nerrors += test_filespace_drivers(fapl);
+
if (H5Pclose(new_fapl) < 0)
FAIL_STACK_ERROR
h5_cleanup(FILENAME, fapl);
@@ -5947,3 +7311,4 @@ error:
} H5E_END_TRY;
return (1);
} /* main() */
+
diff --git a/test/objcopy.c b/test/objcopy.c
index 29c98b5..9d67d3e 100755
--- a/test/objcopy.c
+++ b/test/objcopy.c
@@ -88,6 +88,7 @@ const char *FILENAME[] = {
#define NAME_DATASET_MULTI_OHDR2 "dataset_multi_ohdr2"
#define NAME_DATASET_VL "dataset_vl"
#define NAME_DATASET_VL_VL "dataset_vl_vl"
+#define NAME_DATASET_CMPD_VL "dataset_cmpd_vl"
#define NAME_DATASET_SUB_SUB "/g0/g00/g000/dataset_simple"
#define NAME_GROUP_UNCOPIED "/uncopied"
#define NAME_GROUP_EMPTY "/empty"
@@ -850,8 +851,82 @@ compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts,
/* Check size of each element */
if((elmt_size = H5Tget_size(tid)) == 0) TEST_ERROR
- /* Check for vlen datatype */
- if(H5Tdetect_class(tid, H5T_VLEN) == TRUE) {
+ /* If the type is a compound containing a vlen, loop over all elements for
+ * each compound member. Compounds containing reference are not supported
+ * yet. */
+ if((H5Tget_class(tid) == H5T_COMPOUND)
+ && (H5Tdetect_class(tid, H5T_VLEN) == TRUE)) {
+ hid_t memb_id; /* Member id */
+ const uint8_t *memb1; /* Pointer to current member */
+ const uint8_t *memb2; /* Pointer to current member */
+ int nmembs; /* Number of members */
+ size_t memb_off; /* Member offset */
+ size_t memb_size; /* Member size */
+ unsigned memb_idx; /* Member index */
+ size_t elmt; /* Current element */
+
+ /* Get number of members in compound */
+ if((nmembs = H5Tget_nmembers(tid)) < 0) TEST_ERROR
+
+ /* Loop over members */
+ for(memb_idx=0; memb_idx<(unsigned)nmembs; memb_idx++) {
+ /* Get member offset. Note that we cannot check for an error here.
+ */
+ memb_off = H5Tget_member_offset(tid, memb_idx);
+
+ /* Get member id */
+ if((memb_id = H5Tget_member_type(tid, memb_idx)) < 0) TEST_ERROR
+
+ /* Get member size */
+ if((memb_size = H5Tget_size(memb_id)) == 0) TEST_ERROR
+
+ /* Set up pointers to member in the first element */
+ memb1 = (const uint8_t *)buf1 + memb_off;
+ memb2 = (const uint8_t *)buf2 + memb_off;
+
+ /* Check if this member contains (or is) a vlen */
+ if(H5Tget_class(memb_id) == H5T_VLEN) {
+ hid_t base_id; /* vlen base type id */
+
+ /* Get base type of vlen datatype */
+ if((base_id = H5Tget_super(memb_id)) < 0) TEST_ERROR
+
+ /* Iterate over all elements, recursively calling this function
+ * for each */
+ for(elmt=0; elmt<nelmts; elmt++) {
+ /* Check vlen lengths */
+ if(((const hvl_t *)memb1)->len
+ != ((const hvl_t *)memb2)->len)
+ TEST_ERROR
+
+ /* Check vlen data */
+ if(!compare_data(parent1, parent2, pid, base_id,
+ ((const hvl_t *)memb1)->len,
+ ((const hvl_t *)memb1)->p,
+ ((const hvl_t *)memb2)->p, obj_owner))
+ TEST_ERROR
+
+ /* Update member pointers */
+ memb1 += elmt_size;
+ memb2 += elmt_size;
+ } /* end for */
+ } else {
+ /* vlens cannot currently be nested below the top layer of a
+ * compound */
+ HDassert(H5Tdetect_class(memb_id, H5T_VLEN) == FALSE);
+
+ /* Iterate over all elements, calling memcmp() for each */
+ for(elmt=0; elmt<nelmts; elmt++) {
+ if(HDmemcmp(memb1, memb2, memb_size))
+ TEST_ERROR
+
+ /* Update member pointers */
+ memb1 += elmt_size;
+ memb2 += elmt_size;
+ } /* end for */
+ } /* end else */
+ } /* end for */
+ } else if(H5Tdetect_class(tid, H5T_VLEN) == TRUE) {
const hvl_t *vl_buf1, *vl_buf2; /* Aliases for buffers to compare */
hid_t base_tid; /* Base type of vlen datatype */
size_t u; /* Local index variable */
@@ -878,7 +953,7 @@ compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts,
else if(H5Tdetect_class(tid, H5T_REFERENCE) == TRUE) {
size_t u; /* Local index variable */
- /* Check for "simple" vlen datatype */
+ /* Check for "simple" reference datatype */
if(H5Tget_class(tid) != H5T_REFERENCE) TEST_ERROR
/* Check for object or region reference */
@@ -7212,6 +7287,443 @@ error:
return 1;
} /* end test_copy_dataset_compressed_vl_vl */
+/*
+ * Common data structure for the copy_dataset_*_cmpd_vl tests.
+ */
+typedef struct cmpd_vl_t {
+ int a;
+ hvl_t b;
+ double c;
+} cmpd_vl_t;
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_copy_dataset_contig_cmpd_vl
+ *
+ * Purpose: Create a contiguous dataset w/VLEN datatype contained in
+ * a compound in SRC file and copy it to DST file
+ *
+ * Return: Success: 0
+ * Failure: number of errors
+ *
+ * Programmer: Neil Fortner
+ * Tuseday, September 29, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+test_copy_dataset_contig_cmpd_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl)
+{
+ hid_t fid_src = -1, fid_dst = -1; /* File IDs */
+ hid_t tid = -1, tid2; /* Datatype IDs */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t did = -1, did2 = -1; /* Dataset IDs */
+ unsigned int i, j; /* Local index variables */
+ hsize_t dim1d[1]; /* Dataset dimensions */
+ cmpd_vl_t buf[DIM_SIZE_1]; /* Buffer for writing data */
+ char src_filename[NAME_BUF_SIZE];
+ char dst_filename[NAME_BUF_SIZE];
+
+ TESTING("H5Ocopy(): contiguous dataset with compound VLEN datatype");
+
+ /* set initial data values */
+ for(i = 0; i < DIM_SIZE_1; i++) {
+ buf[i].a = i * (i - 1);
+ buf[i].b.len = i+1;
+ buf[i].b.p = (int *)HDmalloc(buf[i].b.len * sizeof(int));
+ for(j = 0; j < buf[i].b.len; j++)
+ ((int *)buf[i].b.p)[j] = (int)(i * 10 + j);
+ buf[i].c = 1. / (i + 1.);
+ } /* end for */
+
+ /* Initialize the filenames */
+ h5_fixname(FILENAME[0], fapl, src_filename, sizeof src_filename);
+ h5_fixname(FILENAME[1], fapl, dst_filename, sizeof dst_filename);
+
+ /* Reset file address checking info */
+ addr_reset();
+
+ /* create source file */
+ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, fapl)) < 0) TEST_ERROR
+
+ /* Set dataspace dimensions */
+ dim1d[0]=DIM_SIZE_1;
+
+ /* create dataspace */
+ if((sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
+
+ /* create datatype */
+ if((tid2 = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR
+ if((tid = H5Tcreate(H5T_COMPOUND, sizeof(cmpd_vl_t))) < 0) TEST_ERROR
+ if(H5Tinsert(tid, "a", HOFFSET(cmpd_vl_t, a), H5T_NATIVE_INT) < 0) TEST_ERROR
+ if(H5Tinsert(tid, "b", HOFFSET(cmpd_vl_t, b), tid2) < 0) TEST_ERROR
+ if(H5Tinsert(tid, "c", HOFFSET(cmpd_vl_t, c), H5T_NATIVE_DOUBLE) < 0) TEST_ERROR
+
+ /* create dataset at SRC file */
+ if((did = H5Dcreate2(fid_src, NAME_DATASET_CMPD_VL, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+
+ /* write data into file */
+ if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+
+ /* close the dataset */
+ if(H5Dclose(did) < 0) TEST_ERROR
+
+ /* close the SRC file */
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
+
+
+ /* open the source file with read-only */
+ if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+
+ /* create destination file */
+ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, fapl)) < 0) TEST_ERROR
+
+ /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
+ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+
+ /* copy the dataset from SRC to DST */
+ if(H5Ocopy(fid_src, NAME_DATASET_CMPD_VL, fid_dst, NAME_DATASET_CMPD_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* open the dataset for copy */
+ if((did = H5Dopen2(fid_src, NAME_DATASET_CMPD_VL, H5P_DEFAULT)) < 0) TEST_ERROR
+
+ /* open the destination dataset */
+ if((did2 = H5Dopen2(fid_dst, NAME_DATASET_CMPD_VL, H5P_DEFAULT)) < 0) TEST_ERROR
+
+ /* Check if the datasets are equal */
+ if(compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
+
+ /* close the destination dataset */
+ if(H5Dclose(did2) < 0) TEST_ERROR
+
+ /* close the source dataset */
+ if(H5Dclose(did) < 0) TEST_ERROR
+
+ /* close the SRC file */
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
+
+ /* close the DST file */
+ if(H5Fclose(fid_dst) < 0) TEST_ERROR
+
+
+ /* Reclaim vlen buffer */
+ if(H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR
+
+ /* close datatype */
+ if(H5Tclose(tid2) < 0) TEST_ERROR
+ if(H5Tclose(tid) < 0) TEST_ERROR
+
+ /* close dataspace */
+ if(H5Sclose(sid) < 0) TEST_ERROR
+
+ PASSED();
+ return 0;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Dclose(did2);
+ H5Dclose(did);
+ H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf);
+ H5Tclose(tid2);
+ H5Tclose(tid);
+ H5Sclose(sid);
+ H5Fclose(fid_dst);
+ H5Fclose(fid_src);
+ } H5E_END_TRY;
+ return 1;
+} /* end test_copy_dataset_contig_cmpd_vl */
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_copy_dataset_chunked_cmpd_vl
+ *
+ * Purpose: Create a chunked dataset w/VLEN datatype contained in a
+ * compound in SRC file and copy it to DST file
+ *
+ * Return: Success: 0
+ * Failure: number of errors
+ *
+ * Programmer: Neil Fortner
+ * Wednesdat, September 30 , 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+test_copy_dataset_chunked_cmpd_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl)
+{
+ hid_t fid_src = -1, fid_dst = -1; /* File IDs */
+ hid_t tid = -1, tid2 = -1; /* Datatype IDs */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t pid = -1; /* Dataset creation property list ID */
+ hid_t did = -1, did2 = -1; /* Dataset IDs */
+ unsigned int i, j; /* Local index variables */
+ hsize_t dim1d[1]; /* Dataset dimensions */
+ hsize_t chunk_dim1d[1] = {CHUNK_SIZE_1}; /* Chunk dimensions */
+ cmpd_vl_t buf[DIM_SIZE_1]; /* Buffer for writing data */
+ char src_filename[NAME_BUF_SIZE];
+ char dst_filename[NAME_BUF_SIZE];
+
+ TESTING("H5Ocopy(): chunked dataset with compound VLEN datatype");
+
+ /* set initial data values */
+ for(i = 0; i < DIM_SIZE_1; i++) {
+ buf[i].a = i * (i - 1);
+ buf[i].b.len = i+1;
+ buf[i].b.p = (int *)HDmalloc(buf[i].b.len * sizeof(int));
+ for(j = 0; j < buf[i].b.len; j++)
+ ((int *)buf[i].b.p)[j] = (int)(i * 10 + j);
+ buf[i].c = 1. / (i + 1.);
+ } /* end for */
+
+ /* Initialize the filenames */
+ h5_fixname(FILENAME[0], fapl, src_filename, sizeof src_filename);
+ h5_fixname(FILENAME[1], fapl, dst_filename, sizeof dst_filename);
+
+ /* Reset file address checking info */
+ addr_reset();
+
+ /* create source file */
+ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, fapl)) < 0) TEST_ERROR
+
+ /* Set dataspace dimensions */
+ dim1d[0]=DIM_SIZE_1;
+
+ /* create dataspace */
+ if((sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
+
+ /* create datatype */
+ if((tid2 = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR
+ if((tid = H5Tcreate(H5T_COMPOUND, sizeof(cmpd_vl_t))) < 0) TEST_ERROR
+ if(H5Tinsert(tid, "a", HOFFSET(cmpd_vl_t, a), H5T_NATIVE_INT) < 0) TEST_ERROR
+ if(H5Tinsert(tid, "b", HOFFSET(cmpd_vl_t, b), tid2) < 0) TEST_ERROR
+ if(H5Tinsert(tid, "c", HOFFSET(cmpd_vl_t, c), H5T_NATIVE_DOUBLE) < 0) TEST_ERROR
+
+ /* create and set chunk plist */
+ if((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
+ if(H5Pset_chunk(pid, 1, chunk_dim1d) < 0) TEST_ERROR
+
+ /* create dataset at SRC file */
+ if((did = H5Dcreate2(fid_src, NAME_DATASET_CMPD_VL, tid, sid, H5P_DEFAULT, pid, H5P_DEFAULT)) < 0) TEST_ERROR
+
+ /* close chunk plist */
+ if(H5Pclose(pid) < 0) TEST_ERROR
+
+ /* write data into file */
+ if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+
+ /* close the dataset */
+ if(H5Dclose(did) < 0) TEST_ERROR
+
+ /* close the SRC file */
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
+
+
+ /* open the source file with read-only */
+ if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+
+ /* create destination file */
+ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, fapl)) < 0) TEST_ERROR
+
+ /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
+ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+
+ /* copy the dataset from SRC to DST */
+ if(H5Ocopy(fid_src, NAME_DATASET_CMPD_VL, fid_dst, NAME_DATASET_CMPD_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* open the dataset for copy */
+ if((did = H5Dopen2(fid_src, NAME_DATASET_CMPD_VL, H5P_DEFAULT)) < 0) TEST_ERROR
+
+ /* open the destination dataset */
+ if((did2 = H5Dopen2(fid_dst, NAME_DATASET_CMPD_VL, H5P_DEFAULT)) < 0) TEST_ERROR
+
+ /* Check if the datasets are equal */
+ if(compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
+
+ /* close the destination dataset */
+ if(H5Dclose(did2) < 0) TEST_ERROR
+
+ /* close the source dataset */
+ if(H5Dclose(did) < 0) TEST_ERROR
+
+ /* close the SRC file */
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
+
+ /* close the DST file */
+ if(H5Fclose(fid_dst) < 0) TEST_ERROR
+
+
+ /* Reclaim vlen buffer */
+ if(H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR
+
+ /* close datatype */
+ if(H5Tclose(tid2) < 0) TEST_ERROR
+ if(H5Tclose(tid) < 0) TEST_ERROR
+
+ /* close dataspace */
+ if(H5Sclose(sid) < 0) TEST_ERROR
+
+ PASSED();
+ return 0;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Dclose(did2);
+ H5Dclose(did);
+ H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf);
+ H5Tclose(tid2);
+ H5Tclose(tid);
+ H5Sclose(sid);
+ H5Fclose(fid_dst);
+ H5Fclose(fid_src);
+ } H5E_END_TRY;
+ return 1;
+} /* end test_copy_dataset_chunked_cmpd_vl */
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_copy_dataset_compact_cmpd_vl
+ *
+ * Purpose: Create a compact dataset w/VLEN datatype contained in a
+ * compound in SRC file and copy it to DST file
+ *
+ * Return: Success: 0
+ * Failure: number of errors
+ *
+ * Programmer: Peter Cao
+ * Sunday, December 11, 2005
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+test_copy_dataset_compact_cmpd_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl)
+{
+ hid_t fid_src = -1, fid_dst = -1; /* File IDs */
+ hid_t tid = -1, tid2 = -1; /* Datatype IDs */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t pid = -1; /* Dataset creation property list ID */
+ hid_t did = -1, did2 = -1; /* Dataset IDs */
+ unsigned int i, j; /* Local index variables */
+ hsize_t dim1d[1]; /* Dataset dimensions */
+ cmpd_vl_t buf[DIM_SIZE_1]; /* Buffer for writing data */
+ char src_filename[NAME_BUF_SIZE];
+ char dst_filename[NAME_BUF_SIZE];
+
+ TESTING("H5Ocopy(): compact dataset with compound VLEN datatype");
+
+ /* set initial data values */
+ for(i = 0; i < DIM_SIZE_1; i++) {
+ buf[i].a = i * (i - 1);
+ buf[i].b.len = i+1;
+ buf[i].b.p = (int *)HDmalloc(buf[i].b.len * sizeof(int));
+ for(j = 0; j < buf[i].b.len; j++)
+ ((int *)buf[i].b.p)[j] = (int)(i * 10 + j);
+ buf[i].c = 1. / (i + 1.);
+ } /* end for */
+
+ /* Initialize the filenames */
+ h5_fixname(FILENAME[0], fapl, src_filename, sizeof src_filename);
+ h5_fixname(FILENAME[1], fapl, dst_filename, sizeof dst_filename);
+
+ /* Reset file address checking info */
+ addr_reset();
+
+ /* create source file */
+ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, fapl)) < 0) TEST_ERROR
+
+ /* Set dataspace dimensions */
+ dim1d[0]=DIM_SIZE_1;
+
+ /* create dataspace */
+ if((sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
+
+ /* create datatype */
+ if((tid2 = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR
+ if((tid = H5Tcreate(H5T_COMPOUND, sizeof(cmpd_vl_t))) < 0) TEST_ERROR
+ if(H5Tinsert(tid, "a", HOFFSET(cmpd_vl_t, a), H5T_NATIVE_INT) < 0) TEST_ERROR
+ if(H5Tinsert(tid, "b", HOFFSET(cmpd_vl_t, b), tid2) < 0) TEST_ERROR
+ if(H5Tinsert(tid, "c", HOFFSET(cmpd_vl_t, c), H5T_NATIVE_DOUBLE) < 0) TEST_ERROR
+
+ /* create and set compact plist */
+ if((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
+ if(H5Pset_layout(pid, H5D_COMPACT) < 0) TEST_ERROR
+
+ /* create dataset at SRC file */
+ if((did = H5Dcreate2(fid_src, NAME_DATASET_CMPD_VL, tid, sid, H5P_DEFAULT, pid, H5P_DEFAULT)) < 0) TEST_ERROR
+
+ /* write data into file */
+ if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+
+ /* close compact plist */
+ if(H5Pclose(pid) < 0) TEST_ERROR
+
+ /* close the dataset */
+ if(H5Dclose(did) < 0) TEST_ERROR
+
+ /* close the SRC file */
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
+
+
+ /* open the source file with read-only */
+ if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+
+ /* create destination file */
+ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, fapl)) < 0) TEST_ERROR
+
+ /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
+ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+
+ /* copy the dataset from SRC to DST */
+ if(H5Ocopy(fid_src, NAME_DATASET_CMPD_VL, fid_dst, NAME_DATASET_CMPD_VL, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* open the dataset for copy */
+ if((did = H5Dopen2(fid_src, NAME_DATASET_CMPD_VL, H5P_DEFAULT)) < 0) TEST_ERROR
+
+ /* open the destination dataset */
+ if((did2 = H5Dopen2(fid_dst, NAME_DATASET_CMPD_VL, H5P_DEFAULT)) < 0) TEST_ERROR
+
+ /* Check if the datasets are equal */
+ if(compare_datasets(did, did2, H5P_DEFAULT, buf) != TRUE) TEST_ERROR
+
+ /* close the destination dataset */
+ if(H5Dclose(did2) < 0) TEST_ERROR
+
+ /* close the source dataset */
+ if(H5Dclose(did) < 0) TEST_ERROR
+
+ /* close the SRC file */
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
+
+ /* close the DST file */
+ if(H5Fclose(fid_dst) < 0) TEST_ERROR
+
+
+ /* Reclaim vlen buffer */
+ if(H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR
+
+ /* close datatype */
+ if(H5Tclose(tid2) < 0) TEST_ERROR
+ if(H5Tclose(tid) < 0) TEST_ERROR
+
+ /* close dataspace */
+ if(H5Sclose(sid) < 0) TEST_ERROR
+
+ PASSED();
+ return 0;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Dclose(did2);
+ H5Dclose(did);
+ H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf);
+ H5Tclose(tid2);
+ H5Tclose(tid);
+ H5Sclose(sid);
+ H5Fclose(fid_dst);
+ H5Fclose(fid_src);
+ } H5E_END_TRY;
+ return 1;
+} /* end test_copy_dataset_compact_cmpd_vl */
+
/*-------------------------------------------------------------------------
* Function: test_copy_option
@@ -7629,6 +8141,9 @@ main(void)
nerrors += test_copy_dataset_contig_vl_vl(fcpl_src, fcpl_dst, my_fapl);
nerrors += test_copy_dataset_chunked_vl_vl(fcpl_src, fcpl_dst, my_fapl);
nerrors += test_copy_dataset_compressed_vl_vl(fcpl_src, fcpl_dst, my_fapl);
+ nerrors += test_copy_dataset_contig_cmpd_vl(fcpl_src, fcpl_dst, my_fapl);
+ nerrors += test_copy_dataset_chunked_cmpd_vl(fcpl_src, fcpl_dst, my_fapl);
+ nerrors += test_copy_dataset_compact_cmpd_vl(fcpl_src, fcpl_dst, my_fapl);
nerrors += test_copy_same_file_named_datatype(fcpl_src, my_fapl);
nerrors += test_copy_old_layout(fcpl_dst, my_fapl);
diff --git a/test/ohdr.c b/test/ohdr.c
index df5f63b..16ffc7c 100644
--- a/test/ohdr.c
+++ b/test/ohdr.c
@@ -57,7 +57,7 @@ test_cont(char *filename, hid_t fapl)
{
hid_t file=-1;
H5F_t *f = NULL;
- H5O_info_t oinfo;
+ H5O_hdr_info_t hdr_info;
H5O_loc_t oh_locA, oh_locB;
time_t time_new;
const char *short_name = "T";
@@ -105,18 +105,18 @@ test_cont(char *filename, hid_t fapl)
if(H5AC_expunge_entry(f, H5P_DATASET_XFER_DEFAULT, H5AC_OHDR, oh_locA.addr, H5AC__NO_FLAGS_SET) < 0)
FAIL_STACK_ERROR
- if(H5O_get_info(&oh_locA, H5P_DATASET_XFER_DEFAULT, FALSE, &oinfo) < 0)
+ if(H5O_get_hdr_info(&oh_locA, H5P_DATASET_XFER_DEFAULT, &hdr_info) < 0)
FAIL_STACK_ERROR
- nchunks = oinfo.hdr.nchunks;
+ nchunks = hdr_info.nchunks;
/* remove the 1st H5O_NAME_ID message */
if(H5O_msg_remove(&oh_locA, H5O_NAME_ID, 0, FALSE, H5P_DATASET_XFER_DEFAULT) < 0)
FAIL_STACK_ERROR
- if(H5O_get_info(&oh_locA, H5P_DATASET_XFER_DEFAULT, FALSE, &oinfo) < 0)
+ if(H5O_get_hdr_info(&oh_locA, H5P_DATASET_XFER_DEFAULT, &hdr_info) < 0)
FAIL_STACK_ERROR
- if (oinfo.hdr.nchunks >= nchunks)
+ if(hdr_info.nchunks >= nchunks)
TEST_ERROR
if(H5O_close(&oh_locA) < 0)
@@ -164,7 +164,7 @@ main(void)
hid_t dset=-1;
H5F_t *f=NULL;
char filename[1024];
- H5O_info_t oinfo; /* Object info */
+ H5O_hdr_info_t hdr_info; /* Object info */
H5O_loc_t oh_loc;
time_t time_new, ro;
int i;
@@ -240,9 +240,9 @@ main(void)
TEST_ERROR
/* Make certain that chunk #0 in the object header can be encoded with a 1-byte size */
- if(H5O_get_info(&oh_loc, H5P_DATASET_XFER_DEFAULT, FALSE, &oinfo) < 0)
+ if(H5O_get_hdr_info(&oh_loc, H5P_DATASET_XFER_DEFAULT, &hdr_info) < 0)
FAIL_STACK_ERROR
- if(oinfo.hdr.space.total >=256)
+ if(hdr_info.space.total >=256)
TEST_ERROR
PASSED();
@@ -267,9 +267,9 @@ main(void)
FAIL_STACK_ERROR
/* Make certain that chunk #0 in the object header will be encoded with a 2-byte size */
- if(H5O_get_info(&oh_loc, H5P_DATASET_XFER_DEFAULT, FALSE, &oinfo) < 0)
+ if(H5O_get_hdr_info(&oh_loc, H5P_DATASET_XFER_DEFAULT, &hdr_info) < 0)
FAIL_STACK_ERROR
- if(oinfo.hdr.space.total < 256)
+ if(hdr_info.space.total < 256)
TEST_ERROR
PASSED();
diff --git a/test/specmetaread.h5 b/test/specmetaread.h5
new file mode 100644
index 0000000..50b0e69
--- /dev/null
+++ b/test/specmetaread.h5
Binary files differ
diff --git a/test/stab.c b/test/stab.c
index 319046e..c2655a8 100644
--- a/test/stab.c
+++ b/test/stab.c
@@ -59,6 +59,7 @@ const char *FILENAME[] = {
* for version 1.6. To get this data file, simply compile gen_old_group.c with
* the HDF5 library in that branch and run it. */
#define FILE_OLD_GROUPS "group_old.h5"
+#define FILE_OLD_GROUPS_COPY "group_old.h5.copy"
/* Definitions for 'no_compact' test */
#define NO_COMPACT_TOP_GROUP "top"
@@ -665,45 +666,22 @@ error:
static int
read_old(void)
{
- int fd_old = (-1), fd_new = (-1); /* File descriptors for copying data */
hid_t fid = (-1); /* File ID */
hid_t gid = (-1); /* Group ID */
hid_t gid2 = (-1); /* Group ID */
- char buf[READ_OLD_BUFSIZE]; /* Buffer for copying data */
- ssize_t nread; /* Number of bytes read in */
char objname[NAME_BUF_SIZE]; /* Object name */
unsigned u; /* Local index variable */
- char *srcdir = HDgetenv("srcdir"); /* where the src code is located */
- char filename[512] = ""; /* old test file name */
- char filename2[NAME_BUF_SIZE]; /* copy of old test file */
TESTING("reading old groups");
- /* Generate correct name for test file by prepending the source path */
- if(srcdir && ((HDstrlen(srcdir) + HDstrlen(FILE_OLD_GROUPS) + 1) < sizeof(filename))) {
- HDstrcpy(filename, srcdir);
- HDstrcat(filename, "/");
- }
- HDstrcat(filename, FILE_OLD_GROUPS);
-
- /* Create filename */
- h5_fixname(FILENAME[0], H5P_DEFAULT, filename2, sizeof(filename2));
-
- /* Copy old file into temporary file */
- if((fd_old = HDopen(filename, O_RDONLY, 0666)) < 0) TEST_ERROR
- if((fd_new = HDopen(filename2, O_RDWR|O_CREAT|O_TRUNC, 0666)) < 0) TEST_ERROR
-
- /* Copy data */
- while((nread = HDread(fd_old, buf, (size_t)READ_OLD_BUFSIZE)) > 0)
- HDwrite(fd_new, buf, (size_t)nread);
-
- /* Close files */
- if(HDclose(fd_old) < 0) TEST_ERROR
- if(HDclose(fd_new) < 0) TEST_ERROR
+ /* Make a copy of the data file from svn. */
+ if(h5_make_local_copy(FILE_OLD_GROUPS, FILE_OLD_GROUPS_COPY) < 0) TEST_ERROR
+ /* Open copied file */
+ if((fid = H5Fopen(FILE_OLD_GROUPS_COPY, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) TEST_ERROR
/* Open copied file */
- if((fid = H5Fopen(filename2, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) TEST_ERROR
+ 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
@@ -1106,46 +1084,13 @@ error:
static int
corrupt_stab_msg(void)
{
- char testfile[512]=""; /* Character buffer for corrected test file name */
- char *srcdir = HDgetenv("srcdir"); /* Pointer to the directory the source code is located within */
- FILE *tmp_fp, *old_fp; /* Pointers to temp & old files */
- void *copy_buf; /* Pointer to buffer for copying data */
- size_t written; /* Amount of data written to new file */
- size_t read_in; /* Amount of data read in from old file */
hid_t fid = (-1); /* File ID */
hid_t did = (-1); /* Dataset ID */
TESTING("corrupt symbol table message");
- /* Generate the correct name for the test file, by prepending the source path */
- if(srcdir && ((HDstrlen(srcdir) + HDstrlen(CORRUPT_STAB_FILE) + 1) < sizeof(testfile))) {
- HDstrcpy(testfile, srcdir);
- HDstrcat(testfile, "/");
- }
- HDstrcat(testfile, CORRUPT_STAB_FILE);
-
- /* Open the temporary file */
- if(NULL == (tmp_fp = HDfopen(CORRUPT_STAB_TMP_FILE,"wb"))) TEST_ERROR
-
- /* Open the old file */
- if(NULL == (old_fp = fopen(testfile,"rb"))) TEST_ERROR
-
- /* Allocate space for the copy buffer */
- if(NULL == (copy_buf = HDmalloc((size_t)CORRUPT_STAB_COPY_BUF_SIZE))) TEST_ERROR
-
- /* Copy data from the old file to the new file */
- while((read_in = HDfread(copy_buf, (size_t)1, (size_t)CORRUPT_STAB_COPY_BUF_SIZE, old_fp)) > 0)
- /* Write the data to the new file */
- if(read_in != (written = HDfwrite(copy_buf, (size_t)1, read_in, tmp_fp))) TEST_ERROR
-
- /* Close the old file */
- if(HDfclose(old_fp)) TEST_ERROR
-
- /* Close the new file */
- if(HDfclose(tmp_fp)) TEST_ERROR
-
- /* Free the copy buffer */
- free(copy_buf);
+ /* Make a copy of the data file from svn. */
+ if(h5_make_local_copy(CORRUPT_STAB_FILE, CORRUPT_STAB_TMP_FILE) < 0) TEST_ERROR
#ifndef H5_STRICT_FORMAT_CHECKS
/* Open temp file through HDF5 library */
@@ -1186,8 +1131,6 @@ corrupt_stab_msg(void)
if(H5Fclose(fid) < 0) TEST_ERROR
#endif /* H5_STRICT_FORMAT_CHECKS */
- /* Remove temporary file */
- if(HDremove(CORRUPT_STAB_TMP_FILE)) TEST_ERROR
PASSED();
@@ -1198,7 +1141,6 @@ error:
H5Dclose(did);
H5Fclose(fid);
} H5E_END_TRY;
- HDremove(CORRUPT_STAB_TMP_FILE);
return 1;
} /* end old_api() */
@@ -1266,6 +1208,10 @@ main(void)
puts("All symbol table tests passed.");
/* Cleanup */
+ if (GetTestCleanup()) {
+ HDremove(FILE_OLD_GROUPS_COPY);
+ HDremove(CORRUPT_STAB_TMP_FILE);
+ }
h5_cleanup(FILENAME, fapl);
return 0;
diff --git a/test/tcheck_version.c b/test/tcheck_version.c
index 7a34b26..91d98ef 100644
--- a/test/tcheck_version.c
+++ b/test/tcheck_version.c
@@ -25,14 +25,19 @@
*
* Programmer: Albert Cheng
* September 20, 2009
+ * Modifications:
+ * Added abort signal intercept. AKC - 2009/10/16 -
*/
-
-#include <stdlib.h>
-#include "hdf5.h"
+#include "h5test.h"
#define progname "tcheck_version"
+/* prototypes */
+void showhelp(void);
+void parse(int ac, char **av);
+void abort_intercept (int UNUSED sig);
+
/* global variables */
unsigned major = H5_VERS_MAJOR;
unsigned minor = H5_VERS_MINOR;
@@ -90,10 +95,27 @@ parse(int ac, char **av)
}
}
+/* Handler for SIGABRT - catch the abort signal supposedly from check_version()
+ * and exit(6). Would have used 134 is the return code in Unix systems
+ * but some systems (e.g., poe in AIX interprets exit(134) the same as
+ * if the process has really been interrupted by the abort signal and prints
+ * extra messages that confuse test script that is looking for matching output.
+ * This handles the abort signal instead letting it interrupt the OS because
+ * some systems may produce extra messages and/or produce core dump.
+ * This tries to eliminate those side effects.
+ */
+void
+abort_intercept (int UNUSED sig)
+{
+ HDexit(6);
+}
+
int
main(int ac, char **av)
{
parse(ac, av);
+ HDsignal(SIGABRT, &abort_intercept);
H5check_version(major, minor, release);
+ HDsignal(SIGABRT, SIG_DFL);
return 0;
}
diff --git a/test/tconfig.c b/test/tconfig.c
index 355191d..47eed64 100644
--- a/test/tconfig.c
+++ b/test/tconfig.c
@@ -47,6 +47,7 @@
/* local routine prototypes */
void test_config_ctypes(void);
+void test_exit_definitions(void);
/*-------------------------------------------------------------------------
@@ -69,6 +70,7 @@ test_configure(void)
/* Output message about test being performed */
MESSAGE(5, ("Testing configure definitions\n"));
test_config_ctypes();
+ test_exit_definitions();
}
@@ -202,3 +204,31 @@ test_config_ctypes(void)
#endif
}
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_exit_definitions
+ *
+ * Purpose: test the exit macros values
+ *
+ * Return: none (error is fed back via global variable num_errs)
+ *
+ * Programmer: Albert Cheng
+ * October 12, 2009
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+test_exit_definitions(void)
+{
+ /* Verify the EXIT_SUCCESS and EXIT_FAILURE are 0 and 1 respectively. */
+ /* This should be true for POSIX compliant systems. */
+ if (EXIT_SUCCESS != 0) \
+ TestErrPrintf("Error: EXIT_SUCCESS is %d, should be %d\n", \
+ EXIT_SUCCESS, 0);
+ if (EXIT_FAILURE != 1) \
+ TestErrPrintf("Error: EXIT_FAILURE is %d, should be %d\n", \
+ EXIT_FAILURE, 1);
+}
diff --git a/test/testcheck_version.sh.in b/test/testcheck_version.sh.in
index 593a466..6e80654 100644
--- a/test/testcheck_version.sh.in
+++ b/test/testcheck_version.sh.in
@@ -27,6 +27,7 @@ Static_exec=@STATIC_EXEC@
CMP='cmp -s'
DIFF='diff -c'
+RM='rm -f'
# Function definitions
#
@@ -116,9 +117,9 @@ TESTING() {
TEST_NAME=tcheck_version # The test name
TEST_BIN=`pwd`/$TEST_NAME # The path of the test binary
- expect=expected_out
- actual=actual_out
- actual_err=actual_err_out
+ expect=${TEST_NAME}_expect.out
+ actual=${TEST_NAME}_actual.out
+ actual_err=${TEST_NAME}_actual.err
arguments=
h5DisableVersion="$1"
@@ -136,7 +137,7 @@ TESTING() {
if [ "$wrongversionnumbers" = none ]; then
# OK: No warning, exit 0
cp /dev/null $expect
- expected_code=0
+ expect_code=0
else
arguments=-t"$wrongversionnumbers"
# calculate mismatched version numbers by listing.
@@ -152,16 +153,16 @@ TESTING() {
1)
# W2/OK: Different Warning, exit 0.
WarnMesg2 > $expect
- expected_code=0
+ expect_code=0
;;
[2-9]|[1-9][0-9]*)
# OK: No warning, exit 0
cp /dev/null $expect
- expected_code=0
+ expect_code=0
;;
*) # W/A: Warning, abort and exit non-0.
WarnMesg > $expect
- expected_code=134 # Signal Abort exit code (128+6)
+ expect_code=6 # Signal Abort exit code (128+6)
;;
esac
fi
@@ -174,9 +175,9 @@ TESTING() {
ret_code=$?
cat $actual_err >> $actual
- if [ \( $expected_code -ne $ret_code \) ]; then
+ if [ \( $expect_code -ne $ret_code \) ]; then
echo "*FAILED*"
- echo " Expected exit code ($expected_code) differs from actual code ($ret_code)"
+ echo " Expected exit code ($expect_code) differs from actual code ($ret_code)"
nerrors="`expr $nerrors + 1`"
elif $CMP $expect $actual; then
echo " PASSED"
@@ -187,9 +188,11 @@ TESTING() {
test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /'
fi
- # Clean up output file
+ # Clean up output file.
+ # Also clean the core file generated by H5check_version's abort.
if test -z "$HDF5_NOCLEANUP"; then
- rm -f $expected_out $actual_out $actual_err
+ $RM $expect $actual $actual_err
+ $RM core
fi
}
@@ -221,7 +224,15 @@ h5versmajor=`grep '#define H5_VERS_MAJOR' $srcdir/../src/H5public.h | cut -f2`
h5versminor=`grep '#define H5_VERS_MINOR' $srcdir/../src/H5public.h | cut -f2`
h5versrelease=`grep '#define H5_VERS_RELEASE' $srcdir/../src/H5public.h | cut -f2`
DEBUGPRINT $h5versmajor.$h5versminor.$h5versrelease
-
+case "$h5versmajor$h5versminor$h5versrelease" in
+ [0-9]*) # good. noop.
+ ;;
+ *)
+ echo "Illegal library version numbers($h5versmajor.$h5versminor.$h5versrelease)"
+ echo "Test aborted"
+ exit 1
+ ;;
+esac
# Three Categories of tests:
# Normal: where the version numbers all matched (wrong_version == none).
diff --git a/test/tfile.c b/test/tfile.c
index 7755e7b..d1cb25d 100644
--- a/test/tfile.c
+++ b/test/tfile.c
@@ -98,6 +98,35 @@
#define USERBLOCK_SIZE ((hsize_t) 512)
+/* Declarations for test_filespace_*() */
+#define FILENAME_LEN 1024 /* length of file name */
+#define CORE_INCREMENT 1024 /* core file */
+#define FAMILY_SIZE 1024 /* family file */
+#define DSETNAME "dset" /* Name of dataset */
+#define NELMTS(X) (sizeof(X)/sizeof(X[0])) /* # of elements */
+#define READ_OLD_BUFSIZE 1024 /* Buffer for holding file data */
+#define FILE5 "tfile5.h5" /* Test file */
+#define TEST_THRESHOLD10 10 /* Free space section threshold */
+
+const char *OLD_FILENAME[] = { /* Files created under 1.6 branch and 1.8 branch */
+ "filespace_1_6.h5", /* 1.6 HDF5 file */
+ "filespace_1_8.h5" /* 1.8 HDF5 file */
+};
+const char *FILESPACE_NAME[] = {
+ "tfilespace",
+ NULL
+};
+
+const char *FILENAME[] = {
+ "sec2_tfile",
+ "split_tfile",
+ "stdio_tfile",
+ "core_tfile",
+ "family_tfile",
+ NULL
+};
+
+
static void
create_objects(hid_t, hid_t, hid_t *, hid_t *, hid_t *, hid_t *);
static void
@@ -2504,6 +2533,534 @@ test_userblock_alignment(void)
/****************************************************************
**
+** test_free_sections():
+** This routine does the actual work of checking information for
+** free space sections available in a file in various situations.
+**
+*****************************************************************/
+static void
+test_free_sections(hid_t fapl, char *fname)
+{
+ hid_t file; /* File ID */
+ hid_t fcpl; /* File creation property list template */
+ hssize_t free_space; /* Amount of free space in file */
+ hid_t dspace; /* Dataspace ID */
+ hid_t dset; /* Dataset ID */
+ hid_t dcpl; /* Dataset creation property list */
+ unsigned u; /* Local index variable */
+ char name[32]; /* Dataset name */
+ hssize_t nsects; /* # of free-space sections */
+ hssize_t saved_nsects; /* saved copy for the # of free-space sections */
+ int i; /* local index variable */
+ hsize_t total; /* sum of the free-space section sizes */
+ hsize_t last_size; /* size of last free-space section */
+ H5F_sect_info_t *sect_info; /* array to hold the free-space information */
+ H5F_sect_info_t *saved_sect_info; /* array to hold the free-space information */
+ herr_t ret; /* return value */
+
+ /* Create file-creation template */
+ fcpl = H5Pcreate(H5P_FILE_CREATE);
+ CHECK(fcpl, FAIL, "H5Pcreate");
+
+ /* Set file space strategy and free space section threshold */
+ ret = H5Pset_file_space(fcpl, H5F_FILE_SPACE_ALL_PERSIST, (hsize_t)0);
+ CHECK(ret, FAIL, "H5Pget_file_space");
+
+ /* Create the file */
+ file = H5Fcreate(fname, H5F_ACC_TRUNC, fcpl, fapl);
+ CHECK(file, FAIL, "H5Fcreate");
+
+ /* Create dataspace for datasets */
+ dspace = H5Screate(H5S_SCALAR);
+ CHECK(dspace, FAIL, "H5Screate");
+
+ /* Create a dataset creation property list */
+ dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ CHECK(dcpl, FAIL, "H5Pcreate");
+
+ /* Set the space allocation time to early */
+ ret = H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY);
+ CHECK(ret, FAIL, "H5Pset_alloc_time");
+
+ /* Create datasets in file */
+ for(u = 0; u < 10; u++) {
+ sprintf(name, "Dataset %u", u);
+ dset = H5Dcreate2(file, name, H5T_STD_U32LE, dspace, H5P_DEFAULT, dcpl, H5P_DEFAULT);
+ CHECK(dset, FAIL, "H5Dcreate2");
+
+ ret = H5Dclose(dset);
+ CHECK(ret, FAIL, "H5Dclose");
+ } /* end for */
+
+ /* Close dataspace */
+ ret = H5Sclose(dspace);
+ CHECK(ret, FAIL, "H5Sclose");
+
+ /* Close dataset creation property list */
+ ret = H5Pclose(dcpl);
+ CHECK(ret, FAIL, "H5Pclose");
+
+ /* Delete odd-numbered datasets in file */
+ for(u = 0; u < 10; u++) {
+ sprintf(name, "Dataset %u", u);
+ if(u % 2) {
+ ret = H5Ldelete(file, name, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Ldelete");
+ } /* end if */
+ } /* end for */
+
+ /* Close file */
+ ret = H5Fclose(file);
+ CHECK(ret, FAIL, "H5Fclose");
+
+ /* Re-open the file with read-only permission */
+ file = H5Fopen(fname, H5F_ACC_RDONLY, fapl);
+ CHECK_I(file, "H5Fopen");
+
+ /* Get the amount of free space in the file */
+ free_space = H5Fget_freespace(file);
+ CHECK(free_space, FAIL, "H5Fget_freespace");
+
+ /* Get the # of free-space sections in the file */
+ saved_nsects = H5Fget_free_sections(file, H5FD_MEM_DEFAULT, (size_t)0, NULL);
+ CHECK(saved_nsects, FAIL, "H5Fget_free_sections");
+
+ /* Allocate storage for the free space section information */
+ saved_sect_info = (H5F_sect_info_t *)HDcalloc((size_t)saved_nsects, sizeof(H5F_sect_info_t));
+ CHECK(saved_sect_info, NULL, "HDcalloc");
+
+ /* Should return failure when nsects is 0 with a nonnull sect_info */
+ nsects = H5Fget_free_sections(file, H5FD_MEM_DEFAULT, (size_t)0, saved_sect_info);
+ VERIFY(nsects, FAIL, "H5Fget_free_sections");
+
+ /* Verify the correct # of free-space sections */
+ nsects = H5Fget_free_sections(file, H5FD_MEM_DEFAULT, (size_t)saved_nsects, saved_sect_info);
+ VERIFY(nsects, saved_nsects, "H5Fget_free_sections");
+
+ /* Verify the amount of free-space is correct */
+ total = 0;
+ for(i = 0; i < nsects; i++)
+ total += saved_sect_info[i].size;
+ VERIFY(free_space, total, "H5Fget_free_sections");
+
+ /* save the last section's size */
+ last_size = saved_sect_info[nsects-1].size;
+
+ /* Allocate storage for -1 free space section information */
+ sect_info = (H5F_sect_info_t *)HDcalloc((size_t)(saved_nsects - 1), sizeof(H5F_sect_info_t));
+ CHECK(sect_info, NULL, "HDcalloc");
+
+ /* Retrieve free space info for -1 sections */
+ nsects = H5Fget_free_sections(file, H5FD_MEM_DEFAULT, (size_t)(saved_nsects - 1), sect_info);
+ VERIFY(nsects, saved_nsects, "H5Fget_free_sections");
+
+ /* Verify the amount of free-space is correct */
+ total = 0;
+ for(i = 0; i < (saved_nsects - 1); i++) {
+ VERIFY(sect_info[i].addr, saved_sect_info[i].addr, "H5Fget_free_sections");
+ VERIFY(sect_info[i].size, saved_sect_info[i].size, "H5Fget_free_sections");
+ total += sect_info[i].size;
+ }
+
+ VERIFY(((hsize_t)free_space - last_size), total, "H5Fget_free_sections");
+ HDfree(sect_info);
+
+ /* Allocate storage for +1 free space section information */
+ sect_info = (H5F_sect_info_t *)HDcalloc((size_t)(saved_nsects + 1), sizeof(H5F_sect_info_t));
+ CHECK(sect_info, NULL, "HDcalloc");
+
+ /* Retrieve free-space info for +1 sections */
+ nsects = H5Fget_free_sections(file, H5FD_MEM_DEFAULT, (size_t)(saved_nsects + 1), sect_info);
+ VERIFY(nsects, saved_nsects, "H5Fget_free_sections");
+
+ /* Verify free-space info is correct */
+ total = 0;
+ for(i = 0; i < nsects; i++) {
+ VERIFY(sect_info[i].addr, saved_sect_info[i].addr, "H5Fget_free_sections");
+ VERIFY(sect_info[i].size, saved_sect_info[i].size, "H5Fget_free_sections");
+ total += sect_info[i].size;
+ }
+
+ VERIFY(sect_info[nsects].addr, 0, "H5Fget_free_sections");
+ VERIFY(sect_info[nsects].size, 0, "H5Fget_free_sections");
+ VERIFY(free_space, total, "H5Fget_free_sections");
+ HDfree(sect_info);
+
+ /* Verify that there is no free-space section for this type */
+ nsects = H5Fget_free_sections(file, H5FD_MEM_BTREE, (size_t)0, NULL);
+ VERIFY(nsects, 0, "H5Fget_free_sections");
+
+ /* Close file */
+ ret = H5Fclose(file);
+ CHECK(ret, FAIL, "H5Fclose");
+
+ ret = H5Pclose(fcpl);
+ CHECK(fcpl, FAIL, "H5Pclose");
+
+ HDfree(saved_sect_info);
+
+} /* end test_free_sections() */
+
+/****************************************************************
+**
+** test_filespace_sects():
+** This test checks free space section info for
+** files created with sec2 and split drivers.
+**
+*****************************************************************/
+static void
+test_filespace_sects(void)
+{
+ hid_t fapl_sec2; /* File access property id with sec2 driver */
+ hid_t fapl_split; /* File access property id with split driver */
+ hid_t fapl_core; /* File access property id with core driver */
+ hid_t fapl_stdio; /* File access property id with stdio driver */
+ hid_t fapl_family; /* File access property id with family driver */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ herr_t ret; /* Return value */
+
+ /* SEC2 */
+ MESSAGE(5, ("Testing File free space information for a sec2 file\n"));
+
+ fapl_sec2 = H5Pcreate(H5P_FILE_ACCESS);
+
+ ret = H5Pset_fapl_sec2(fapl_sec2);
+ CHECK(ret, FAIL, "H5Pset_fapl_sec2");
+
+ /* Set the filename to use for this test (dependent on fapl) */
+ h5_fixname(FILENAME[0], fapl_sec2, filename, sizeof(filename));
+
+ /* perform free space information test for file with sec2 driver */
+ test_free_sections(fapl_sec2, filename);
+
+ /* close fapl_sec2 and remove the file */
+ h5_cleanup(FILENAME, fapl_sec2);
+
+
+ /* SPLIT */
+ MESSAGE(5, ("Testing File free space information for a split file\n"));
+
+ fapl_split = H5Pcreate(H5P_FILE_ACCESS);
+ CHECK(fapl_split, FAIL, "h5_fileaccess");
+
+ ret = H5Pset_fapl_split(fapl_split, "-m.h5", H5P_DEFAULT, "-r.h5", H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Pset_fapl_split");
+
+ /* Set the filename to use for this test (dependent on fapl) */
+ h5_fixname(FILENAME[1], fapl_split, filename, sizeof(filename));
+
+ /* perform free space information test for file with split driver */
+ test_free_sections(fapl_split, filename);
+
+ /* close fapl and remove the file */
+ h5_cleanup(FILENAME, fapl_split);
+
+
+ /* STDIO */
+ MESSAGE(5, ("Testing File free space information for a stdio file\n"));
+
+ fapl_stdio = H5Pcreate(H5P_FILE_ACCESS);
+ CHECK(fapl_stdio, FAIL, "h5_fileaccess");
+
+ ret = H5Pset_fapl_stdio(fapl_stdio);
+ CHECK(ret, FAIL, "H5Pset_fapl_split");
+
+ /* Set the filename to use for this test (dependent on fapl) */
+ h5_fixname(FILENAME[2], fapl_stdio, filename, sizeof(filename));
+
+ /* perform free space information test for file with stdio driver */
+ test_free_sections(fapl_stdio, filename);
+
+ /* close fapl and remove the file */
+ h5_cleanup(FILENAME, fapl_split);
+
+ /* CORE */
+ MESSAGE(5, ("Testing File free space information for a core file\n"));
+
+ fapl_core = H5Pcreate(H5P_FILE_ACCESS);
+ CHECK(fapl_core, FAIL, "h5_fileaccess");
+
+ ret = H5Pset_fapl_core(fapl_core, (size_t)CORE_INCREMENT, TRUE);
+ CHECK(ret, FAIL, "H5Pset_fapl_core");
+
+ /* Set the filename to use for this test (dependent on fapl) */
+ h5_fixname(FILENAME[3], fapl_core, filename, sizeof(filename));
+
+ /* perform free space information test for file with core driver */
+ test_free_sections(fapl_core, filename);
+
+ /* close fapl_ and remove the file */
+ h5_cleanup(FILENAME, fapl_core);
+
+
+ /* FAMILY */
+ MESSAGE(5, ("Testing File free space information for a family file\n"));
+
+ fapl_family = H5Pcreate(H5P_FILE_ACCESS);
+ CHECK(fapl_family, FAIL, "h5_fileaccess");
+
+ ret = H5Pset_fapl_family(fapl_family, (hsize_t)FAMILY_SIZE, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Pset_fapl_family");
+
+ /* Set the filename to use for this test (dependent on fapl) */
+ h5_fixname(FILENAME[4], fapl_family, filename, sizeof(filename));
+
+ /* perform free space information test for file with family driver */
+ test_free_sections(fapl_family, filename);
+
+ /* close fapl and remove the file */
+ h5_cleanup(FILENAME, fapl_family);
+
+} /* end test_filespace_sects() */
+
+/****************************************************************
+**
+** test_filespace_info():
+** Verify that the public routines H5Pget/set_file_space()
+** retrieve and set the file space strategy and free space
+** section threshold as specified.
+**
+****************************************************************/
+static void
+test_filespace_info(void)
+{
+ hid_t fid1, fid2; /* HDF5 File IDs */
+ hid_t fapl, new_fapl; /* File access property */
+ hid_t fcpl, fcpl1, fcpl2; /* File creation property */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_file_space_type_t strategy, fs_type, def_type; /* File space handling strategy */
+ hsize_t threshold, fs_size, def_size; /* Free space section threshold */
+ hbool_t new_format; /* new format or old format */
+ herr_t ret; /* return value */
+
+ /* Output message about test being performed */
+ MESSAGE(5, ("Testing File Space Management public routines: H5Pget/set_file_space()\n"));
+
+ fapl = h5_fileaccess();
+ h5_fixname(FILESPACE_NAME[0], fapl, filename, sizeof filename);
+
+ new_fapl = H5Pcopy(fapl);
+ CHECK(new_fapl, FAIL, "H5Pcopy");
+
+ /* Set the "use the latest version of the format" bounds */
+ ret = H5Pset_libver_bounds(new_fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST);
+ CHECK(ret, FAIL, "H5Pset_libver_bounds");
+
+ /* Create file-creation template */
+ fcpl = H5Pcreate(H5P_FILE_CREATE);
+ CHECK(fcpl, FAIL, "H5Pcreate");
+
+ /* Get default file space information */
+ ret = H5Pget_file_space(fcpl, &def_type, &def_size);
+ CHECK(ret, FAIL, "H5Pget_file_space");
+
+ /* Test with old & new format groups */
+ for(new_format = FALSE; new_format <= TRUE; new_format++) {
+ hid_t my_fapl;
+
+ /* Set the FAPL for the type of format */
+ if(new_format) {
+ MESSAGE(5, ("Testing with new group format\n"));
+ my_fapl = new_fapl;
+ } /* end if */
+ else {
+ MESSAGE(5, ("Testing with old group format\n"));
+ my_fapl = fapl;
+ } /* end else */
+
+ /* Test with different sized free space section threshold */
+ for(fs_size = 0; fs_size <= TEST_THRESHOLD10; fs_size++) {
+
+ /* Test with different file space handling strategies */
+ for(fs_type = 0; fs_type < H5F_FILE_SPACE_NTYPES; H5_INC_ENUM(H5F_file_space_type_t, fs_type)) {
+
+ /* Get a copy of the default file creation property */
+ fcpl1 = H5Pcopy(fcpl);
+ CHECK(fcpl1, FAIL, "H5Pcopy");
+
+ /* Set file space strategy and free space section threshold */
+ ret = H5Pset_file_space(fcpl1, fs_type, fs_size);
+ CHECK(ret, FAIL, "H5Pget_file_space");
+
+ /* Get the file space info from the creation property */
+ ret = H5Pget_file_space(fcpl1, &strategy, &threshold);
+ CHECK(ret, FAIL, "H5Pget_file_space");
+
+ /* A 0 value for strategy retains existing strategy in use */
+ VERIFY(strategy, (H5F_file_space_type_t)(fs_type ? fs_type : def_type), "H5Pget_file_space");
+ /* A 0 value for threshold retains existing threshold in use */
+ VERIFY(threshold, (hsize_t)(fs_size ? fs_size : def_size), "H5Pget_file_space");
+
+ /* Create the file with the specified file space info */
+ fid1 = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl1, my_fapl);
+ CHECK(ret, FAIL, "H5Fcreate");
+
+ /* Close the file */
+ ret = H5Fclose(fid1);
+ CHECK(ret, FAIL, "H5Fclose");
+
+ /* Re-open the file */
+ fid2 = H5Fopen(filename, H5F_ACC_RDWR, my_fapl);
+ CHECK(ret, FAIL, "H5Fopen");
+
+ /* Get the file's creation property */
+ fcpl2 = H5Fget_create_plist(fid2);
+ CHECK(fcpl2, FAIL, "H5Fget_create_plist");
+
+ strategy = threshold = 0;
+
+ /* Get the file space info from the creation property list */
+ ret = H5Pget_file_space(fcpl2, &strategy, &threshold);
+ CHECK(ret, FAIL, "H5Pget_file_space");
+
+ VERIFY(strategy, (H5F_file_space_type_t)(fs_type ? fs_type : def_type), "H5Pget_file_space");
+ VERIFY(threshold, (hsize_t)(fs_size ? fs_size : def_size), "H5Pget_file_space");
+
+ /* Close the file */
+ ret = H5Fclose(fid2);
+ CHECK(ret, FAIL, "H5Fclose");
+
+ /* Release file-creation template */
+ ret = H5Pclose(fcpl1);
+ CHECK(ret, FAIL, "H5Pclose");
+ ret = H5Pclose(fcpl2);
+ CHECK(ret, FAIL, "H5Pclose");
+ } /* end for file space strategy type */
+ } /* end for free space threshold */
+
+ h5_cleanup(FILESPACE_NAME, my_fapl);
+
+ } /* end for new/old format */
+
+ /* Close the file creation property list */
+ ret = H5Pclose(fcpl);
+ CHECK(ret, FAIL, "H5Pclose");
+} /* test_filespace_info() */
+
+/****************************************************************
+**
+** test_filespace_compatible():
+** Verify that the branch with file space management enhancement
+** can open, read and modify 1.6 HDF5 file and 1.8 HDF5 file.
+** Also verify the correct file space strategy/threshold in use
+** and the amount of free space.
+**
+****************************************************************/
+static void
+test_filespace_compatible(void)
+{
+ int fd_old = (-1), fd_new = (-1); /* File descriptors for copying data */
+ hid_t fid; /* File id */
+ hid_t fcpl; /* File creation property list template */
+ hid_t did; /* Dataset id */
+ int check[100]; /* Temporary buffer for verifying dataset data */
+ int rdbuf[100]; /* Temporary buffer for reading in dataset data */
+ uint8_t buf[READ_OLD_BUFSIZE]; /* temporary buffer for reading */
+ ssize_t nread; /* Number of bytes read in */
+ char *srcdir = HDgetenv("srcdir"); /* where the src code is located */
+ unsigned i, j; /* Local index variable */
+ hssize_t free_space; /* Amount of free space in the file */
+ hsize_t threshold; /* Free space section threshold */
+ H5F_file_space_type_t strategy; /* File space handling strategy */
+ herr_t ret; /* Return value */
+
+ /* Output message about test being performed */
+ MESSAGE(5, ("Testing File space compatibility for 1.6 and 1.8 files\n"));
+
+ for(j = 0; j < NELMTS(OLD_FILENAME); j++) {
+ char filename[FILENAME_LEN] = ""; /* old test file name */
+
+ /* Generate correct name for test file by prepending the source path */
+ if(srcdir && ((HDstrlen(srcdir) + HDstrlen(OLD_FILENAME[j]) + 1) < sizeof(filename))) {
+ HDstrcpy(filename, srcdir);
+ HDstrcat(filename, "/");
+ }
+ HDstrcat(filename, OLD_FILENAME[j]);
+
+ /* Copy old file into test file */
+ fd_old = HDopen(filename, O_RDONLY, 0666);
+ CHECK(fd_old, FAIL, "HDopen");
+ fd_new = HDopen(FILE5, O_RDWR|O_CREAT|O_TRUNC, 0666);
+ CHECK(fd_new, FAIL, "HDopen");
+
+ /* Copy data */
+ while((nread = HDread(fd_old, buf, (size_t)READ_OLD_BUFSIZE)) > 0)
+ HDwrite(fd_new, buf, (size_t)nread);
+
+ /* Close the files */
+ ret = HDclose(fd_old);
+ CHECK(ret, FAIL, "HDclose");
+ ret = HDclose(fd_new);
+ CHECK(ret, FAIL, "HDclose");
+
+ /* Open the test file */
+ fid = H5Fopen(FILE5, H5F_ACC_RDWR, H5P_DEFAULT);
+ CHECK(fid, FAIL, "H5Fopen");
+
+ /* There should not be any free space in the file */
+ free_space = H5Fget_freespace(fid);
+ CHECK(free_space, FAIL, "H5Fget_freespace");
+ VERIFY(free_space, (hssize_t)0, "H5Fget_freespace");
+
+ /* Get the file's file creation property list */
+ /* Retrieve the file space handling stretegy and threshold */
+ fcpl = H5Fget_create_plist(fid);
+ CHECK(fcpl, FAIL, "H5Fget_create_plist");
+ ret = H5Pget_file_space(fcpl, &strategy, &threshold);
+ CHECK(ret, FAIL, "H5Pget_file_space");
+
+ /* File space handling strategy should be H5F_FILE_SPACE_ALL = 2 */
+ /* Free space section threshold should be 1 */
+ VERIFY(strategy, 2, "H5Pget_file_space");
+ VERIFY(threshold, 1, "H5Pget_file_space");
+
+ /* Generate raw data */
+ for(i = 0; i < 100; i++)
+ check[i] = (int)i;
+
+ /* Open and read the dataset */
+ did = H5Dopen2(fid, DSETNAME, H5P_DEFAULT);
+ CHECK(did, FAIL, "H5Dopen");
+ ret = H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdbuf);
+ CHECK(ret, FAIL, "H5Dread");
+
+ /* Verify the data read is correct */
+ for(i = 0; i < 100; i++)
+ VERIFY(rdbuf[i], check[i], "test_compatible");
+
+ /* Close the dataset */
+ ret = H5Dclose(did);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ /* Remove the dataset */
+ ret = H5Ldelete(fid, DSETNAME, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Ldelete");
+
+ /* Close the file */
+ ret = H5Fclose(fid);
+ CHECK(ret, FAIL, "H5Fclose");
+
+ /* Re-Open the file */
+ fid = H5Fopen(FILE5, H5F_ACC_RDONLY, H5P_DEFAULT);
+ CHECK(fid, FAIL, "H5Fopen");
+
+ /* The dataset should not be there */
+ did = H5Dopen2(fid, DSETNAME, H5P_DEFAULT);
+ VERIFY(did, FAIL, "H5Dopen");
+
+ /* There should not be any free space in the file */
+ free_space = H5Fget_freespace(fid);
+ CHECK(free_space, FAIL, "H5Fget_freespace");
+ VERIFY(free_space, (hssize_t)0, "H5Fget_freespace");
+
+ /* Close the file */
+ ret = H5Fclose(fid);
+ CHECK(ret, FAIL, "H5Fclose");
+ } /* end for */
+} /* test_filespace_compatible */
+
+/****************************************************************
+**
** test_swmr_write(): low-level file test routine.
** This test checks that the H5F_ACC_SWMR_WRITE access flag is
** working properly.
@@ -2700,6 +3257,147 @@ test_swmr_read(void)
/****************************************************************
**
+** test_deprec():
+** Test deprecated functionality.
+**
+****************************************************************/
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+static void
+test_deprec(void)
+{
+ hid_t file; /* File IDs for old & new files */
+ hid_t fcpl; /* File creation property list */
+ unsigned super; /* Superblock version # */
+ unsigned freelist; /* Free list version # */
+ unsigned stab; /* Symbol table entry version # */
+ unsigned shhdr; /* Shared object header version # */
+ H5F_info1_t finfo; /* global information about file */
+ herr_t ret; /* Generic return value */
+
+ /* Output message about test being performed */
+ MESSAGE(5, ("Testing deprecated routines\n"));
+
+ /* Creating a file with the default file creation property list should
+ * create a version 0 superblock
+ */
+
+ /* Create file with default file creation property list */
+ file= H5Fcreate(FILE1, H5F_ACC_TRUNC , H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(file, FAIL, "H5Fcreate");
+
+ /* Get the file's version information */
+ ret = H5Fget_info1(file, &finfo);
+ CHECK(ret, FAIL, "H5Fget_info1");
+ VERIFY(finfo.super_ext_size, 0,"H5Fget_info1");
+ VERIFY(finfo.sohm.hdr_size, 0,"H5Fget_info1");
+ VERIFY(finfo.sohm.msgs_info.index_size, 0,"H5Fget_info1");
+ VERIFY(finfo.sohm.msgs_info.heap_size, 0,"H5Fget_info1");
+
+ /* Get the file's dataset creation property list */
+ fcpl = H5Fget_create_plist(file);
+ CHECK(fcpl, FAIL, "H5Fget_create_plist");
+
+ /* Get the file's version information */
+ ret=H5Pget_version(fcpl, &super, &freelist, &stab, &shhdr);
+ CHECK(ret, FAIL, "H5Pget_version");
+ VERIFY(super,0,"H5Pget_version");
+ VERIFY(freelist,0,"H5Pget_version");
+ VERIFY(stab,0,"H5Pget_version");
+ VERIFY(shhdr,0,"H5Pget_version");
+
+ /* Close FCPL */
+ ret=H5Pclose(fcpl);
+ CHECK(ret, FAIL, "H5Pclose");
+
+ /* Close file */
+ ret=H5Fclose(file);
+ CHECK(ret, FAIL, "H5Fclose");
+
+
+ /* Create a file creation property list */
+ fcpl = H5Pcreate(H5P_FILE_CREATE);
+ CHECK(fcpl, FAIL, "H5Pcreate");
+
+ /* Set a property in the FCPL that will push the superblock version up */
+ ret = H5Pset_file_space(fcpl, H5F_FILE_SPACE_VFD, (hsize_t)0);
+ CHECK(ret, FAIL, "H5Pset_file_space");
+
+ /* Creating a file with the non-default file creation property list should
+ * create a version 2 superblock
+ */
+
+ /* Create file with custom file creation property list */
+ file= H5Fcreate(FILE1, H5F_ACC_TRUNC , fcpl, H5P_DEFAULT);
+ CHECK(file, FAIL, "H5Fcreate");
+
+ /* Close FCPL */
+ ret=H5Pclose(fcpl);
+ CHECK(ret, FAIL, "H5Pclose");
+
+ /* Get the file's version information */
+ ret = H5Fget_info1(file, &finfo);
+ CHECK(ret, FAIL, "H5Fget_info1");
+ VERIFY(finfo.super_ext_size, 40,"H5Fget_info1");
+ VERIFY(finfo.sohm.hdr_size, 0,"H5Fget_info1");
+ VERIFY(finfo.sohm.msgs_info.index_size, 0,"H5Fget_info1");
+ VERIFY(finfo.sohm.msgs_info.heap_size, 0,"H5Fget_info1");
+
+ /* Get the file's dataset creation property list */
+ fcpl = H5Fget_create_plist(file);
+ CHECK(fcpl, FAIL, "H5Fget_create_plist");
+
+ /* Get the file's version information */
+ ret=H5Pget_version(fcpl, &super, &freelist, &stab, &shhdr);
+ CHECK(ret, FAIL, "H5Pget_version");
+ VERIFY(super,2,"H5Pget_version");
+ VERIFY(freelist,0,"H5Pget_version");
+ VERIFY(stab,0,"H5Pget_version");
+ VERIFY(shhdr,0,"H5Pget_version");
+
+ /* Close FCPL */
+ ret=H5Pclose(fcpl);
+ CHECK(ret, FAIL, "H5Pclose");
+
+ /* Close file */
+ ret=H5Fclose(file);
+ CHECK(ret, FAIL, "H5Fclose");
+
+ /* Re-open the file */
+ file = H5Fopen(FILE1, H5F_ACC_RDONLY, H5P_DEFAULT);
+ CHECK(file, FAIL, "H5Fcreate");
+
+ /* Get the file's version information */
+ ret = H5Fget_info1(file, &finfo);
+ CHECK(ret, FAIL, "H5Fget_info1");
+ VERIFY(finfo.super_ext_size, 40,"H5Fget_info1");
+ VERIFY(finfo.sohm.hdr_size, 0,"H5Fget_info1");
+ VERIFY(finfo.sohm.msgs_info.index_size, 0,"H5Fget_info1");
+ VERIFY(finfo.sohm.msgs_info.heap_size, 0,"H5Fget_info1");
+
+ /* Get the file's creation property list */
+ fcpl = H5Fget_create_plist(file);
+ CHECK(fcpl, FAIL, "H5Fget_create_plist");
+
+ /* Get the file's version information */
+ ret=H5Pget_version(fcpl, &super, &freelist, &stab, &shhdr);
+ CHECK(ret, FAIL, "H5Pget_version");
+ VERIFY(super,2,"H5Pget_version");
+ VERIFY(freelist,0,"H5Pget_version");
+ VERIFY(stab,0,"H5Pget_version");
+ VERIFY(shhdr,0,"H5Pget_version");
+
+ /* Close FCPL */
+ ret=H5Pclose(fcpl);
+ CHECK(ret, FAIL, "H5Pclose");
+
+ /* Close file */
+ ret=H5Fclose(file);
+ CHECK(ret, FAIL, "H5Fclose");
+} /* test_deprec */
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+
+/****************************************************************
+**
** test_file(): Main low-level file I/O test routine.
**
****************************************************************/
@@ -2733,8 +3431,14 @@ test_file(void)
test_cached_stab_info(); /* Tests that files are created with cached stab info in the superblock */
test_rw_noupdate(); /* Test to ensure that RW permissions don't write the file unless dirtied */
test_userblock_alignment(); /* Tests that files created with a userblock and alignment interact properly */
+ test_filespace_sects(); /* Test file free space section information */
+ test_filespace_info(); /* Test file creation public routines:H5Pget/set_file_space */
+ test_filespace_compatible();/* Test compatibility for file space management */
test_swmr_write(); /* Tests for SWMR write access flag */
test_swmr_read(); /* Tests for SWMR read access flag */
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+ test_deprec(); /* Test deprecated routines */
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
} /* test_file() */
@@ -2760,5 +3464,6 @@ cleanup_file(void)
HDremove(FILE2);
HDremove(FILE3);
HDremove(FILE4);
+ HDremove(FILE5);
}
diff --git a/test/tgenprop.c b/test/tgenprop.c
index f87d4ec..8fb2e23 100644
--- a/test/tgenprop.c
+++ b/test/tgenprop.c
@@ -367,11 +367,11 @@ test_genprop_class_iter(void)
/****************************************************************
**
-** test_genprop_cls_cb1(): Property List callback for test_genprop_class_callback
+** test_genprop_cls_*_cb1(): Property List callbacks for test_genprop_class_callback
**
****************************************************************/
static herr_t
-test_genprop_cls_cb1(hid_t list_id, void *create_data)
+test_genprop_cls_crt_cb1(hid_t list_id, void *create_data)
{
struct { /* Struct for iterations */
int count;
@@ -385,18 +385,33 @@ test_genprop_cls_cb1(hid_t list_id, void *create_data)
}
static herr_t
-test_genprop_cls_cb2(hid_t new_list_id, hid_t UNUSED old_list_id, void *create_data)
+test_genprop_cls_cpy_cb1(hid_t new_list_id, hid_t UNUSED old_list_id, void *copy_data)
{
struct { /* Struct for iterations */
int count;
hid_t id;
- } *count_struct=create_data;
+ } *count_struct=copy_data;
count_struct->count++;
count_struct->id=new_list_id;
return(SUCCEED);
}
+
+static herr_t
+test_genprop_cls_cls_cb1(hid_t list_id, void *create_data)
+{
+ struct { /* Struct for iterations */
+ int count;
+ hid_t id;
+ } *count_struct=create_data;
+
+ count_struct->count++;
+ count_struct->id=list_id;
+
+ return(SUCCEED);
+}
+
/****************************************************************
**
** test_genprop_class_callback(): Test basic generic property list code.
@@ -407,20 +422,22 @@ static void
test_genprop_class_callback(void)
{
hid_t cid1; /* Generic Property class ID */
+ hid_t cid2; /* Generic Property class ID */
hid_t lid1; /* Generic Property list ID */
hid_t lid2; /* Generic Property list ID */
+ hid_t lid3; /* Generic Property list ID */
size_t nprops; /* Number of properties in class */
struct { /* Struct for callbacks */
int count;
hid_t id;
- } crt_cb_struct, cls_cb_struct;
+ } crt_cb_struct, cpy_cb_struct, cls_cb_struct;
herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Basic Generic Property List Class Callback Functionality\n"));
/* Create a new generic class, derived from the root of the class hierarchy */
- cid1 = H5Pcreate_class(H5P_ROOT,CLASS1_NAME,test_genprop_cls_cb1,&crt_cb_struct,NULL, NULL,test_genprop_cls_cb1,&cls_cb_struct);
+ cid1 = H5Pcreate_class(H5P_ROOT, CLASS1_NAME, test_genprop_cls_crt_cb1, &crt_cb_struct, test_genprop_cls_cpy_cb1, &cpy_cb_struct, test_genprop_cls_cls_cb1, &cls_cb_struct);
CHECK_I(cid1, "H5Pcreate_class");
/* Insert first property into class (with no callbacks) */
@@ -435,18 +452,16 @@ test_genprop_class_callback(void)
ret = H5Pregister2(cid1, PROP3_NAME, PROP3_SIZE, PROP3_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
CHECK_I(ret, "H5Pregister2");
- /* Insert fourth property into class (with no callbacks) */
- ret = H5Pregister2(cid1, PROP4_NAME, PROP4_SIZE, PROP4_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
- CHECK_I(ret, "H5Pregister2");
-
/* Check the number of properties in class */
ret = H5Pget_nprops(cid1,&nprops);
CHECK_I(ret, "H5Pget_nprops");
- VERIFY(nprops, 4, "H5Pget_nprops");
+ VERIFY(nprops, 3, "H5Pget_nprops");
/* Initialize class callback structs */
crt_cb_struct.count=0;
crt_cb_struct.id=(-1);
+ cpy_cb_struct.count=0;
+ cpy_cb_struct.id=(-1);
cls_cb_struct.count=0;
cls_cb_struct.id=(-1);
@@ -461,7 +476,7 @@ test_genprop_class_callback(void)
/* Check the number of properties in list */
ret = H5Pget_nprops(lid1,&nprops);
CHECK_I(ret, "H5Pget_nprops");
- VERIFY(nprops, 4, "H5Pget_nprops");
+ VERIFY(nprops, 3, "H5Pget_nprops");
/* Create another property list from the class */
lid2 = H5Pcreate(cid1);
@@ -474,7 +489,20 @@ test_genprop_class_callback(void)
/* Check the number of properties in list */
ret = H5Pget_nprops(lid2,&nprops);
CHECK_I(ret, "H5Pget_nprops");
- VERIFY(nprops, 4, "H5Pget_nprops");
+ VERIFY(nprops, 3, "H5Pget_nprops");
+
+ /* Create another property list by copying an existing list */
+ lid3 = H5Pcopy(lid1);
+ CHECK_I(lid3, "H5Pcopy");
+
+ /* Verify that the copy callback occurred */
+ VERIFY(cpy_cb_struct.count, 1, "H5Pcopy");
+ VERIFY(cpy_cb_struct.id, lid3, "H5Pcopy");
+
+ /* Check the number of properties in list */
+ ret = H5Pget_nprops(lid3, &nprops);
+ CHECK_I(ret, "H5Pget_nprops");
+ VERIFY(nprops, 3, "H5Pget_nprops");
/* Close first list */
ret = H5Pclose(lid1);
@@ -492,9 +520,75 @@ test_genprop_class_callback(void)
VERIFY(cls_cb_struct.count, 2, "H5Pclose");
VERIFY(cls_cb_struct.id, lid2, "H5Pclose");
- /* Close class */
+ /* Close third list */
+ ret = H5Pclose(lid3);
+ CHECK_I(ret, "H5Pclose");
+
+ /* Verify that the close callback occurred */
+ VERIFY(cls_cb_struct.count, 3, "H5Pclose");
+ VERIFY(cls_cb_struct.id, lid3, "H5Pclose");
+
+ /* Create another new generic class, derived from first class */
+ cid2 = H5Pcreate_class(cid1, CLASS2_NAME, test_genprop_cls_crt_cb1, &crt_cb_struct, test_genprop_cls_cpy_cb1, &cpy_cb_struct, test_genprop_cls_cls_cb1, &cls_cb_struct);
+ CHECK_I(cid2, "H5Pcreate_class");
+
+ /* Insert fourth property into class (with no callbacks) */
+ ret = H5Pregister2(cid2, PROP4_NAME, PROP4_SIZE, PROP4_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+ CHECK_I(ret, "H5Pregister2");
+
+ /* Check the number of properties in class */
+ /* (only reports the number of properties in 2nd class) */
+ ret = H5Pget_nprops(cid2, &nprops);
+ CHECK_I(ret, "H5Pget_nprops");
+ VERIFY(nprops, 1, "H5Pget_nprops");
+
+ /* Create a property list from the 2nd class */
+ lid1 = H5Pcreate(cid2);
+ CHECK_I(lid1, "H5Pcreate");
+
+ /* Verify that both of the creation callbacks occurred */
+ VERIFY(crt_cb_struct.count, 4, "H5Pcreate");
+ VERIFY(crt_cb_struct.id, lid1, "H5Pcreate");
+
+ /* Check the number of properties in list */
+ ret = H5Pget_nprops(lid1, &nprops);
+ CHECK_I(ret, "H5Pget_nprops");
+ VERIFY(nprops, 4, "H5Pget_nprops");
+
+ /* Create another property list by copying existing list */
+ lid2 = H5Pcopy(lid1);
+ CHECK_I(lid2, "H5Pcopy");
+
+ /* Verify that both of the copy callbacks occurred */
+ VERIFY(cpy_cb_struct.count, 3, "H5Pcopy");
+ VERIFY(cpy_cb_struct.id, lid2, "H5Pcopy");
+
+ /* Check the number of properties in list */
+ ret = H5Pget_nprops(lid2, &nprops);
+ CHECK_I(ret, "H5Pget_nprops");
+ VERIFY(nprops, 4, "H5Pget_nprops");
+
+ /* Close first list */
+ ret = H5Pclose(lid1);
+ CHECK_I(ret, "H5Pclose");
+
+ /* Verify that both of the close callbacks occurred */
+ VERIFY(cls_cb_struct.count, 5, "H5Pclose");
+ VERIFY(cls_cb_struct.id, lid1, "H5Pclose");
+
+ /* Close second list */
+ ret = H5Pclose(lid2);
+ CHECK_I(ret, "H5Pclose");
+
+ /* Verify that both of the close callbacks occurred */
+ VERIFY(cls_cb_struct.count, 7, "H5Pclose");
+ VERIFY(cls_cb_struct.id, lid2, "H5Pclose");
+
+ /* Close classes */
ret = H5Pclose_class(cid1);
CHECK_I(ret, "H5Pclose_class");
+ ret = H5Pclose_class(cid2);
+ CHECK_I(ret, "H5Pclose_class");
} /* end test_genprop_class_callback() */
/****************************************************************
@@ -895,6 +989,25 @@ prop_cb_info prop3_cb_info; /* Callback statistics for property #3 */
/****************************************************************
**
+** test_genprop_cls_cpy_cb2(): Property Class callback for test_genprop_list_callback
+**
+****************************************************************/
+static herr_t
+test_genprop_cls_cpy_cb2(hid_t new_list_id, hid_t UNUSED old_list_id, void *create_data)
+{
+ struct { /* Struct for iterations */
+ int count;
+ hid_t id;
+ } *count_struct=create_data;
+
+ count_struct->count++;
+ count_struct->id=new_list_id;
+
+ return(SUCCEED);
+}
+
+/****************************************************************
+**
** test_genprop_prop_crt_cb1(): Property creation callback for test_genprop_list_callback
**
****************************************************************/
@@ -1063,7 +1176,7 @@ test_genprop_list_callback(void)
MESSAGE(5, ("Testing Basic Generic Property List Property Callback Functionality\n"));
/* Create a new generic class, derived from the root of the class hierarchy */
- cid1 = H5Pcreate_class(H5P_ROOT,CLASS1_NAME, NULL, NULL,test_genprop_cls_cb2,&cop_cb_struct,NULL, NULL);
+ cid1 = H5Pcreate_class(H5P_ROOT,CLASS1_NAME, NULL, NULL,test_genprop_cls_cpy_cb2,&cop_cb_struct,NULL, NULL);
CHECK_I(cid1, "H5Pcreate_class");
/* Insert first property into class (with callbacks) */
@@ -1365,7 +1478,7 @@ test_genprop_class_addprop(void)
CHECK_I(cid, "H5Pcreate_class");
/* Check existence of an original property */
- ret = H5Pexist(cid,H5D_CRT_DATA_PIPELINE_NAME);
+ ret = H5Pexist(cid,H5O_CRT_PIPELINE_NAME);
VERIFY(ret, 0, "H5Pexist");
/* Insert first property into class (with no callbacks) */
@@ -1377,7 +1490,7 @@ test_genprop_class_addprop(void)
CHECK(pid, FAIL, "H5Pcreate");
/* Check existence of an original property */
- ret = H5Pexist(pid, H5D_CRT_DATA_PIPELINE_NAME);
+ ret = H5Pexist(pid, H5O_CRT_PIPELINE_NAME);
VERIFY(ret, 1, "H5Pexist");
/* Check existence of added property */
diff --git a/test/tmisc.c b/test/tmisc.c
index b646a69..450743c 100644
--- a/test/tmisc.c
+++ b/test/tmisc.c
@@ -305,6 +305,11 @@ unsigned m13_rdata[MISC13_DIM1][MISC13_DIM2]; /* Data read from dataset
#define MISC28_SIZE 10
#define MISC28_NSLOTS 10000
+/* Definitions for misc. test #29 */
+#define MISC29_ORIG_FILE "specmetaread.h5"
+#define MISC29_COPY_FILE "tmisc29.h5"
+#define MISC29_DSETNAME "dset2"
+
/****************************************************************
**
** test_misc1(): test unlinking a dataset from a group and immediately
@@ -1797,11 +1802,10 @@ test_misc11(void)
unsigned sym_ik; /* Symbol table B-tree initial 'K' value */
unsigned istore_ik; /* Indexed storage B-tree initial 'K' value */
unsigned sym_lk; /* Symbol table B-tree leaf 'K' value */
- unsigned super; /* Superblock version # */
- unsigned freelist; /* Free list version # */
- unsigned stab; /* Symbol table entry version # */
- unsigned shhdr; /* Shared object header version # */
unsigned nindexes; /* Shared message number of indexes */
+ H5F_info2_t finfo; /* global information about file */
+ H5F_file_space_type_t strategy; /* File/free space strategy */
+ hsize_t threshold; /* Free-space section threshold */
herr_t ret; /* Generic return value */
/* Output message about test being performed */
@@ -1815,21 +1819,12 @@ test_misc11(void)
file= H5Fcreate(MISC11_FILE, H5F_ACC_TRUNC , H5P_DEFAULT, H5P_DEFAULT);
CHECK(file, FAIL, "H5Fcreate");
- /* Get the file's dataset creation property list */
- fcpl = H5Fget_create_plist(file);
- CHECK(fcpl, FAIL, "H5Fget_create_plist");
-
/* Get the file's version information */
- ret=H5Pget_version(fcpl, &super, &freelist, &stab, &shhdr);
- CHECK(ret, FAIL, "H5Pget_version");
- VERIFY(super,0,"H5Pget_version");
- VERIFY(freelist,0,"H5Pget_version");
- VERIFY(stab,0,"H5Pget_version");
- VERIFY(shhdr,0,"H5Pget_version");
-
- /* Close FCPL */
- ret=H5Pclose(fcpl);
- CHECK(ret, FAIL, "H5Pclose");
+ ret = H5Fget_info2(file, &finfo);
+ CHECK(ret, FAIL, "H5Fget_info2");
+ VERIFY(finfo.super.version, 0,"H5Fget_info2");
+ VERIFY(finfo.free.version, 0,"H5Fget_info2");
+ VERIFY(finfo.sohm.version, 0,"H5Fget_info2");
/* Close file */
ret=H5Fclose(file);
@@ -1856,6 +1851,9 @@ test_misc11(void)
ret=H5Pset_shared_mesg_nindexes(fcpl,MISC11_NINDEXES);
CHECK(ret, FAIL, "H5Pset_shared_mesg");
+ ret = H5Pset_file_space(fcpl, H5F_FILE_SPACE_VFD, (hsize_t)0);
+ CHECK(ret, FAIL, "H5Pset_file_space");
+
/* Creating a file with the non-default file creation property list should
* create a version 1 superblock
*/
@@ -1868,21 +1866,12 @@ test_misc11(void)
ret=H5Pclose(fcpl);
CHECK(ret, FAIL, "H5Pclose");
- /* Get the file's dataset creation property list */
- fcpl = H5Fget_create_plist(file);
- CHECK(fcpl, FAIL, "H5Fget_create_plist");
-
/* Get the file's version information */
- ret=H5Pget_version(fcpl, &super, &freelist, &stab, &shhdr);
- CHECK(ret, FAIL, "H5Pget_version");
- VERIFY(super,2,"H5Pget_version");
- VERIFY(freelist,0,"H5Pget_version");
- VERIFY(stab,0,"H5Pget_version");
- VERIFY(shhdr,0,"H5Pget_version");
-
- /* Close FCPL */
- ret=H5Pclose(fcpl);
- CHECK(ret, FAIL, "H5Pclose");
+ ret = H5Fget_info2(file, &finfo);
+ CHECK(ret, FAIL, "H5Fget_info2");
+ VERIFY(finfo.super.version, 2,"H5Fget_info2");
+ VERIFY(finfo.free.version, 0,"H5Fget_info2");
+ VERIFY(finfo.sohm.version, 0,"H5Fget_info2");
/* Close file */
ret=H5Fclose(file);
@@ -1892,17 +1881,16 @@ test_misc11(void)
file = H5Fopen(MISC11_FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
CHECK(file, FAIL, "H5Fcreate");
- /* Get the file's dataset creation property list */
+ /* Get the file's creation property list */
fcpl = H5Fget_create_plist(file);
CHECK(fcpl, FAIL, "H5Fget_create_plist");
/* Get the file's version information */
- ret=H5Pget_version(fcpl, &super, &freelist, &stab, &shhdr);
- CHECK(ret, FAIL, "H5Pget_version");
- VERIFY(super,2,"H5Pget_version");
- VERIFY(freelist,0,"H5Pget_version");
- VERIFY(stab,0,"H5Pget_version");
- VERIFY(shhdr,0,"H5Pget_version");
+ ret = H5Fget_info2(file, &finfo);
+ CHECK(ret, FAIL, "H5Fget_info2");
+ VERIFY(finfo.super.version, 2,"H5Fget_info2");
+ VERIFY(finfo.free.version, 0,"H5Fget_info2");
+ VERIFY(finfo.sohm.version, 0,"H5Fget_info2");
/* Retrieve all the property values & check them */
ret=H5Pget_userblock(fcpl,&userblock);
@@ -1927,6 +1915,11 @@ test_misc11(void)
CHECK(ret, FAIL, "H5Pget_shared_mesg_nindexes");
VERIFY(nindexes, MISC11_NINDEXES, "H5Pget_shared_mesg_nindexes");
+ ret = H5Pget_file_space(fcpl, &strategy, &threshold);
+ CHECK(ret, FAIL, "H5Pget_file_space");
+ VERIFY(strategy, 4, "H5Pget_file_space");
+ VERIFY(threshold, 1, "H5Pget_file_space");
+
/* Close file */
ret=H5Fclose(file);
CHECK(ret, FAIL, "H5Fclose");
@@ -5118,6 +5111,39 @@ test_misc28(void)
CHECK_I(ret, "H5Pclose");
} /* end test_misc28() */
+
+/****************************************************************
+**
+** test_misc29(): Ensure that speculative metadata reads don't
+** get raw data into the metadata accumulator.
+**
+****************************************************************/
+static void
+test_misc29(void)
+{
+ hid_t fid; /* File ID */
+ herr_t ret; /* Generic return value */
+
+ /* Output message about test being performed */
+ MESSAGE(5, ("Speculative metadata reads\n"));
+
+ /* Make a copy of the data file from svn. */
+ ret = h5_make_local_copy(MISC29_ORIG_FILE, MISC29_COPY_FILE);
+ CHECK(ret, -1, "h5_make_local_copy");
+
+ /* Open the copied file */
+ fid = H5Fopen(MISC29_COPY_FILE, H5F_ACC_RDWR, H5P_DEFAULT);
+ CHECK(fid, FAIL, "H5Fopen");
+
+ /* Delete the last dataset */
+ ret = H5Ldelete(fid, MISC29_DSETNAME, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Ldelete");
+
+ /* Close the file */
+ ret = H5Fclose(fid);
+ CHECK(ret, FAIL, "H5Fclose");
+} /* end test_misc29() */
+
/****************************************************************
**
** test_misc(): Main misc. test routine.
@@ -5161,7 +5187,7 @@ test_misc(void)
test_misc26(); /* Test closing property lists with long filter pipelines */
test_misc27(); /* Test opening file with object that has bad # of object header messages */
test_misc28(); /* Test that chunks are cached appropriately */
-
+ test_misc29(); /* Test that speculative metadata reads are handled correctly */
} /* test_misc() */
@@ -5216,5 +5242,6 @@ cleanup_misc(void)
HDremove(MISC25C_FILE);
HDremove(MISC26_FILE);
HDremove(MISC28_FILE);
+ HDremove(MISC29_COPY_FILE);
}
diff --git a/test/tunicode.c b/test/tunicode.c
index 767928e..efbf80e 100644
--- a/test/tunicode.c
+++ b/test/tunicode.c
@@ -779,13 +779,12 @@ void dump_string(const char * string)
unsigned int length;
unsigned int x;
- printf("The string was:\n");
- printf(string);
+ printf("The string was:\n %s", string);
printf("Or in hex:\n");
length = strlen(string);
- for(x=0; x<length; x++)
+ for(x=0; x<length; x++)
printf("%x ", string[x] & (0x000000FF));
printf("\n");
diff --git a/test/vfd.c b/test/vfd.c
index c1de28d..f5a29c5 100644
--- a/test/vfd.c
+++ b/test/vfd.c
@@ -28,7 +28,6 @@
#define FAMILY_SIZE2 (5*KB)
#define MULTI_SIZE 128
#define CORE_INCREMENT (4*KB)
-#define FILE_COPY_BUF_SIZE 4096
/*Macros for Direct VFD*/
#define MBOUNDARY 512
@@ -809,11 +808,7 @@ test_family_compat(void)
char filename[1024];
char pathname[1024], pathname_individual[1024];
char newname[1024], newname_individual[1024];
- char *srcdir = getenv("srcdir"); /*where the src code is located*/
FILE *tmp_fp, *old_fp; /* Pointers to temp & old files */
- void *copy_buf; /* Pointer to buffer for copying data */
- size_t written; /* Amount of data written to new file */
- size_t read_in; /* Amount of data read in from old file */
int counter = 0;
TESTING("FAMILY file driver backward compatibility");
@@ -828,45 +823,24 @@ test_family_compat(void)
h5_fixname(FILENAME[3], fapl, newname, sizeof newname);
pathname[0] = '\0';
- /* Generate correct name for test file by prepending the source path */
- if(srcdir && ((HDstrlen(srcdir) + HDstrlen(filename) + 1) < sizeof(pathname))) {
- HDstrcpy(pathname, srcdir);
- HDstrcat(pathname, "/");
- }
HDstrcat(pathname, filename);
/* The following code makes the copies of the family files in the source directory.
* Since we're going to open the files with write mode, this protects the original
* files.
*/
- if(NULL == (copy_buf = HDmalloc((size_t)FILE_COPY_BUF_SIZE))) TEST_ERROR
-
sprintf(newname_individual, newname, counter);
sprintf(pathname_individual, pathname, counter);
- /* Open the original files until no more left. Copy the content into the new files. */
- while((old_fp = HDfopen(pathname_individual,"rb"))) {
- /* Open the new file */
- if(NULL == (tmp_fp = fopen(newname_individual,"wb"))) TEST_ERROR
-
- /* Copy data from the old file to the new file */
- while((read_in = HDfread(copy_buf, (size_t)1, (size_t)FILE_COPY_BUF_SIZE, old_fp)) > 0)
- /* Write the data to the new file */
- if(read_in != (written = HDfwrite(copy_buf, (size_t)1, read_in, tmp_fp))) TEST_ERROR
-
- /* Close the old file */
- if(HDfclose(old_fp)) TEST_ERROR
-
- /* Close the new file */
- if(HDfclose(tmp_fp)) TEST_ERROR
-
+ while (h5_make_local_copy(pathname_individual, newname_individual) >= 0) {
counter++;
sprintf(newname_individual, newname, counter);
sprintf(pathname_individual, pathname, counter);
}
- /* Free the copy buffer */
- free(copy_buf);
+ if ((NULL != (old_fp = HDfopen(pathname_individual,"rb"))) &&
+ (NULL != (tmp_fp = HDfopen(newname_individual,"wb"))))
+ TEST_ERROR;
/* Make sure we can open the file. Use the read and write mode to flush the
* superblock. */
diff --git a/testpar/Makefile.am b/testpar/Makefile.am
index 27d8652..3c39989 100644
--- a/testpar/Makefile.am
+++ b/testpar/Makefile.am
@@ -40,7 +40,8 @@ LDADD = $(LIBH5TEST) $(LIBHDF5)
# Temporary files
# MPItest.h5 is from t_mpi
# Para*.h5 are from testphdf
-CHECK_CLEANFILES+=MPItest.h5 Para*.h5 CacheTestDummy.h5
-DISTCLEANFILES=go Makefile testph5.sh
+# go is used for debugging. See testphdf5.c.
+CHECK_CLEANFILES+=MPItest.h5 Para*.h5 CacheTestDummy.h5 go
+DISTCLEANFILES=testph5.sh
include $(top_srcdir)/config/conclude.am
diff --git a/testpar/Makefile.in b/testpar/Makefile.in
index 59714c4..c06e6d4 100644
--- a/testpar/Makefile.in
+++ b/testpar/Makefile.in
@@ -120,6 +120,16 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = /home1/packages/automake/automake-1.9.6/bin/aclocal-1.9 -I /afs/ncsa/projects/hdf/packages/libtool_1.5.14/Linux_2.4/share/aclocal
ADD_PARALLEL_FILES = @ADD_PARALLEL_FILES@
AMTAR = @AMTAR@
+
+# H5_CFLAGS holds flags that should be used when building hdf5,
+# but which should not be exported to h5cc for building other programs.
+# AM_CFLAGS is an automake construct which should be used by Makefiles
+# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
+AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
+AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@
+AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
+AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@
+AM_LDFLAGS = @AM_LDFLAGS@
AM_MAKEFLAGS = @AM_MAKEFLAGS@
AR = @AR@
@@ -133,21 +143,18 @@ BYTESEX = @BYTESEX@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CC_VERSION = @CC_VERSION@
-
-# H5_CFLAGS holds flags that should be used as CFLAGS when building hdf5,
-# but which shouldn't be exported to h5cc for building other programs.
-CFLAGS = @CFLAGS@ @H5_CFLAGS@
+CFLAGS = @CFLAGS@
CLEARFILEBUF = @CLEARFILEBUF@
CODESTACK = @CODESTACK@
CONFIG_DATE = @CONFIG_DATE@
CONFIG_MODE = @CONFIG_MODE@
CONFIG_USER = @CONFIG_USER@
CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@ @H5_CPPFLAGS@
+CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@ @H5_CXXFLAGS@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_PKG = @DEBUG_PKG@
DEFAULT_API_VERSION = @DEFAULT_API_VERSION@
@@ -170,7 +177,7 @@ F9XMODEXT = @F9XMODEXT@
F9XMODFLAG = @F9XMODFLAG@
F9XSUFFIXFLAG = @F9XSUFFIXFLAG@
FC = @FC@
-FCFLAGS = @FCFLAGS@ @H5_FCFLAGS@
+FCFLAGS = @FCFLAGS@
FCFLAGS_f90 = @FCFLAGS_f90@
FCLIBS = @FCLIBS@
FGREP = @FGREP@
@@ -370,8 +377,9 @@ TRACE = perl $(top_srcdir)/bin/trace
# Temporary files
# MPItest.h5 is from t_mpi
# Para*.h5 are from testphdf
+# go is used for debugging. See testphdf5.c.
CHECK_CLEANFILES = *.chkexe *.chklog *.clog MPItest.h5 Para*.h5 \
- CacheTestDummy.h5
+ CacheTestDummy.h5 go
INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/test
# Test programs and scripts. These are our main targets.
@@ -385,7 +393,7 @@ testphdf5_SOURCES = testphdf5.c t_dset.c t_file.c t_mdset.c t_ph5basic.c \
# The tests all depend on the hdf5 library and the test library
LDADD = $(LIBH5TEST) $(LIBHDF5)
-DISTCLEANFILES = go Makefile testph5.sh
+DISTCLEANFILES = testph5.sh
# Automake needs to be taught how to build lib, progs, and tests targets.
# These will be filled in automatically for the most part (e.g.,
diff --git a/testpar/t_mpi.c b/testpar/t_mpi.c
index 09283e6..9033e70 100644
--- a/testpar/t_mpi.c
+++ b/testpar/t_mpi.c
@@ -849,7 +849,7 @@ static int test_mpio_derived_dtype(char *filename) {
printf("Complicated derived datatype is NOT working at this platform\n");
printf("Go back to hdf5/config and find the corresponding\n");
printf("configure-specific file (for example, powerpc-ibm-aix5.x) and add\n");
- printf("hdf5_mpi_complex_derived_datatype_works=${hdf5_mpi_complex_derived_datatype-works='no'}\n");
+ printf("hdf5_cv_mpi_complex_derived_datatype_works=${hdf5_cv_mpi_complex_derived_datatype-works='no'}\n");
printf(" at the end of the file.\n");
printf(" Please report to hdfhelp@ncsa.uiuc.edu about this problem.\n");
}
@@ -862,7 +862,7 @@ static int test_mpio_derived_dtype(char *filename) {
printf("Complicated derived datatype is WORKING at this platform\n");
printf(" Go back to hdf5/config and find the corresponding \n");
printf(" configure-specific file (for example, powerpc-ibm-aix5.x) and delete the line\n");
- printf("hdf5_mpi_complex_derived_datatype_works=${hdf5_mpi_complex_derived_datatype-works='no'}\n");
+ printf("hdf5_cv_mpi_complex_derived_datatype_works=${hdf5_cv_mpi_complex_derived_datatype-works='no'}\n");
printf(" at the end of the file.\n");
printf("Please report to hdfhelp@ncsa.uiuc.edu about this problem.\n");
}
@@ -1018,7 +1018,7 @@ test_mpio_special_collective(char *filename)
printf("special collective IO is NOT working at this platform\n");
printf("Go back to hdf5/config and find the corresponding\n");
printf("configure-specific file (for example, powerpc-ibm-aix5.x) and add\n");
- printf("hdf5_mpi_special_collective_io_works=${hdf5_mpi_special_collective_io_works='no'}\n");
+ printf("hdf5_cv_mpi_special_collective_io_works=${hdf5_cv_mpi_special_collective_io_works='no'}\n");
printf(" at the end of the file.\n");
printf(" Please report to hdfhelp@ncsa.uiuc.edu about this problem.\n");
}
@@ -1031,7 +1031,7 @@ test_mpio_special_collective(char *filename)
printf("special collective IO is WORKING at this platform\n");
printf(" Go back to hdf5/config and find the corresponding \n");
printf(" configure-specific file (for example, powerpc-ibm-aix5.x) and delete the line\n");
- printf("hdf5_mpi_special_collective_io_works=${hdf5_mpi_special_collective_io_works='no'}\n");
+ printf("hdf5_cv_mpi_special_collective_io_works=${hdf5_cv_mpi_special_collective_io_works='no'}\n");
printf(" at the end of the file.\n");
printf("Please report to hdfhelp@ncsa.uiuc.edu about this problem.\n");
}
diff --git a/tools/Makefile.in b/tools/Makefile.in
index 3675e3a..e482ea2 100644
--- a/tools/Makefile.in
+++ b/tools/Makefile.in
@@ -111,6 +111,16 @@ am__relativize = \
ACLOCAL = /home1/packages/automake/automake-1.9.6/bin/aclocal-1.9 -I /afs/ncsa/projects/hdf/packages/libtool_1.5.14/Linux_2.4/share/aclocal
ADD_PARALLEL_FILES = @ADD_PARALLEL_FILES@
AMTAR = @AMTAR@
+
+# H5_CFLAGS holds flags that should be used when building hdf5,
+# but which should not be exported to h5cc for building other programs.
+# AM_CFLAGS is an automake construct which should be used by Makefiles
+# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
+AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
+AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@
+AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
+AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@
+AM_LDFLAGS = @AM_LDFLAGS@
AM_MAKEFLAGS = @AM_MAKEFLAGS@
AR = @AR@
@@ -124,21 +134,18 @@ BYTESEX = @BYTESEX@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CC_VERSION = @CC_VERSION@
-
-# H5_CFLAGS holds flags that should be used as CFLAGS when building hdf5,
-# but which shouldn't be exported to h5cc for building other programs.
-CFLAGS = @CFLAGS@ @H5_CFLAGS@
+CFLAGS = @CFLAGS@
CLEARFILEBUF = @CLEARFILEBUF@
CODESTACK = @CODESTACK@
CONFIG_DATE = @CONFIG_DATE@
CONFIG_MODE = @CONFIG_MODE@
CONFIG_USER = @CONFIG_USER@
CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@ @H5_CPPFLAGS@
+CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@ @H5_CXXFLAGS@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_PKG = @DEBUG_PKG@
DEFAULT_API_VERSION = @DEFAULT_API_VERSION@
@@ -161,7 +168,7 @@ F9XMODEXT = @F9XMODEXT@
F9XMODFLAG = @F9XMODFLAG@
F9XSUFFIXFLAG = @F9XSUFFIXFLAG@
FC = @FC@
-FCFLAGS = @FCFLAGS@ @H5_FCFLAGS@
+FCFLAGS = @FCFLAGS@
FCFLAGS_f90 = @FCFLAGS_f90@
FCLIBS = @FCLIBS@
FGREP = @FGREP@
diff --git a/tools/h5copy/Makefile.am b/tools/h5copy/Makefile.am
index 1848972..dd0c5c3 100644
--- a/tools/h5copy/Makefile.am
+++ b/tools/h5copy/Makefile.am
@@ -34,7 +34,7 @@ bin_PROGRAMS=h5copy
check_PROGRAMS=$(TEST_PROG)
# Add h5copy specific linker flags here
-h5copy_LDFLAGS = $(LT_STATIC_EXEC)
+h5copy_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
# source file for the test file generator
h5copygentest_SOURCES=h5copygentest.c
diff --git a/tools/h5copy/Makefile.in b/tools/h5copy/Makefile.in
index b582057..d2a8e0d 100644
--- a/tools/h5copy/Makefile.in
+++ b/tools/h5copy/Makefile.in
@@ -103,6 +103,16 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = /home1/packages/automake/automake-1.9.6/bin/aclocal-1.9 -I /afs/ncsa/projects/hdf/packages/libtool_1.5.14/Linux_2.4/share/aclocal
ADD_PARALLEL_FILES = @ADD_PARALLEL_FILES@
AMTAR = @AMTAR@
+
+# H5_CFLAGS holds flags that should be used when building hdf5,
+# but which should not be exported to h5cc for building other programs.
+# AM_CFLAGS is an automake construct which should be used by Makefiles
+# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
+AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
+AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@
+AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
+AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@
+AM_LDFLAGS = @AM_LDFLAGS@
AM_MAKEFLAGS = @AM_MAKEFLAGS@
AR = @AR@
@@ -116,21 +126,18 @@ BYTESEX = @BYTESEX@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CC_VERSION = @CC_VERSION@
-
-# H5_CFLAGS holds flags that should be used as CFLAGS when building hdf5,
-# but which shouldn't be exported to h5cc for building other programs.
-CFLAGS = @CFLAGS@ @H5_CFLAGS@
+CFLAGS = @CFLAGS@
CLEARFILEBUF = @CLEARFILEBUF@
CODESTACK = @CODESTACK@
CONFIG_DATE = @CONFIG_DATE@
CONFIG_MODE = @CONFIG_MODE@
CONFIG_USER = @CONFIG_USER@
CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@ @H5_CPPFLAGS@
+CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@ @H5_CXXFLAGS@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_PKG = @DEBUG_PKG@
DEFAULT_API_VERSION = @DEFAULT_API_VERSION@
@@ -153,7 +160,7 @@ F9XMODEXT = @F9XMODEXT@
F9XMODFLAG = @F9XMODFLAG@
F9XSUFFIXFLAG = @F9XSUFFIXFLAG@
FC = @FC@
-FCFLAGS = @FCFLAGS@ @H5_FCFLAGS@
+FCFLAGS = @FCFLAGS@
FCFLAGS_f90 = @FCFLAGS_f90@
FCLIBS = @FCLIBS@
FGREP = @FGREP@
@@ -364,7 +371,7 @@ check_SCRIPTS = $(TEST_SCRIPT)
SCRIPT_DEPEND = h5copy$(EXEEXT)
# Add h5copy specific linker flags here
-h5copy_LDFLAGS = $(LT_STATIC_EXEC)
+h5copy_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
# source file for the test file generator
h5copygentest_SOURCES = h5copygentest.c
diff --git a/tools/h5copy/h5copy.c b/tools/h5copy/h5copy.c
index e487f2e..f2a41ae 100644
--- a/tools/h5copy/h5copy.c
+++ b/tools/h5copy/h5copy.c
@@ -210,7 +210,7 @@ main (int argc, const char *argv[])
/* Check for no command line parameters */
if(argc == 1) {
usage();
- leave(EXIT_SUCCESS);
+ leave(EXIT_FAILURE);
} /* end if */
/* parse command line options */
diff --git a/tools/h5copy/testh5copy.sh b/tools/h5copy/testh5copy.sh
index 046440d..b513938 100644
--- a/tools/h5copy/testh5copy.sh
+++ b/tools/h5copy/testh5copy.sh
@@ -166,11 +166,7 @@ TOOLTEST_FAIL()
H5DIFFTEST()
{
VERIFY $@
- if [ "`uname -s`" = "TFLOPS O/S" ]; then
- $RUNSERIAL $H5DIFF_BIN -q $@
- else
- $RUNSERIAL $H5DIFF_BIN -q "$@"
- fi
+ $RUNSERIAL $H5DIFF_BIN -q "$@"
RET=$?
if [ $RET != 0 ] ; then
echo "*FAILED*"
@@ -185,11 +181,7 @@ H5DIFFTEST()
H5DIFFTEST_FAIL()
{
VERIFY $@
- if [ "`uname -s`" = "TFLOPS O/S" ]; then
- $RUNSERIAL $H5DIFF_BIN -q $@
- else
- $RUNSERIAL $H5DIFF_BIN -q "$@"
- fi
+ $RUNSERIAL $H5DIFF_BIN -q "$@"
RET=$?
if [ $RET != 1 ] ; then
diff --git a/tools/h5diff/Makefile.am b/tools/h5diff/Makefile.am
index b56284b..0b8816f 100644
--- a/tools/h5diff/Makefile.am
+++ b/tools/h5diff/Makefile.am
@@ -34,7 +34,7 @@ endif
bin_PROGRAMS=h5diff $(H5PDIFF)
# Add h5diff specific linker flags here
-h5diff_LDFLAGS = $(LT_STATIC_EXEC)
+h5diff_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
# Test programs and scripts
TEST_PROG=h5diffgentest
diff --git a/tools/h5diff/Makefile.in b/tools/h5diff/Makefile.in
index 91add70..04a64da 100644
--- a/tools/h5diff/Makefile.in
+++ b/tools/h5diff/Makefile.in
@@ -110,6 +110,16 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = /home1/packages/automake/automake-1.9.6/bin/aclocal-1.9 -I /afs/ncsa/projects/hdf/packages/libtool_1.5.14/Linux_2.4/share/aclocal
ADD_PARALLEL_FILES = @ADD_PARALLEL_FILES@
AMTAR = @AMTAR@
+
+# H5_CFLAGS holds flags that should be used when building hdf5,
+# but which should not be exported to h5cc for building other programs.
+# AM_CFLAGS is an automake construct which should be used by Makefiles
+# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
+AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
+AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@
+AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
+AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@
+AM_LDFLAGS = @AM_LDFLAGS@
AM_MAKEFLAGS = @AM_MAKEFLAGS@
AR = @AR@
@@ -123,21 +133,18 @@ BYTESEX = @BYTESEX@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CC_VERSION = @CC_VERSION@
-
-# H5_CFLAGS holds flags that should be used as CFLAGS when building hdf5,
-# but which shouldn't be exported to h5cc for building other programs.
-CFLAGS = @CFLAGS@ @H5_CFLAGS@
+CFLAGS = @CFLAGS@
CLEARFILEBUF = @CLEARFILEBUF@
CODESTACK = @CODESTACK@
CONFIG_DATE = @CONFIG_DATE@
CONFIG_MODE = @CONFIG_MODE@
CONFIG_USER = @CONFIG_USER@
CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@ @H5_CPPFLAGS@
+CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@ @H5_CXXFLAGS@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_PKG = @DEBUG_PKG@
DEFAULT_API_VERSION = @DEFAULT_API_VERSION@
@@ -160,7 +167,7 @@ F9XMODEXT = @F9XMODEXT@
F9XMODFLAG = @F9XMODFLAG@
F9XSUFFIXFLAG = @F9XSUFFIXFLAG@
FC = @FC@
-FCFLAGS = @FCFLAGS@ @H5_FCFLAGS@
+FCFLAGS = @FCFLAGS@
FCFLAGS_f90 = @FCFLAGS_f90@
FCLIBS = @FCLIBS@
FGREP = @FGREP@
@@ -371,7 +378,7 @@ INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/tools/lib
@BUILD_PARALLEL_CONDITIONAL_TRUE@TEST_SCRIPT_PARA = $(srcdir)/testph5diff.sh
# Add h5diff specific linker flags here
-h5diff_LDFLAGS = $(LT_STATIC_EXEC)
+h5diff_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
# Test programs and scripts
TEST_PROG = h5diffgentest
diff --git a/tools/h5diff/testh5diff.sh b/tools/h5diff/testh5diff.sh
index 22c6f3f..f316d7c 100755
--- a/tools/h5diff/testh5diff.sh
+++ b/tools/h5diff/testh5diff.sh
@@ -83,8 +83,9 @@ test -d ./testfiles || mkdir ./testfiles
# -h print help page
while [ $# -gt 0 ]; do
case "$1" in
- -p) # run ph5diff tests
- H5DIFF_BIN=`pwd`/ph5diff
+ -p) # reset the tool name and bin to run ph5diff tests
+ H5DIFF=ph5diff # The tool name
+ H5DIFF_BIN=`pwd`/$H5DIFF
pmode=yes
shift
;;
@@ -204,19 +205,12 @@ TOOLTEST() {
fi
# Run test.
- # Tflops interprets "$@" as "" when no parameter is given (e.g., the
- # case of missing file name). Changed it to use $@ till Tflops fixes it.
- #TESTING $H5DIFF $@
(
#echo "#############################"
#echo "Expected output for '$H5DIFF $@'"
#echo "#############################"
#cd $srcdir/testfiles
- if [ "`uname -s`" = "TFLOPS O/S" ]; then
- eval $RUNCMD $H5DIFF_BIN $@
- else
- eval $RUNCMD $H5DIFF_BIN "$@"
- fi
+ eval $RUNCMD $H5DIFF_BIN "$@"
) >$actual 2>$actual_err
# save actual and actual_err in case they are needed later.
cp $actual $actual_sav
diff --git a/tools/h5dump/Makefile.am b/tools/h5dump/Makefile.am
index 992586b..81e38d1 100644
--- a/tools/h5dump/Makefile.am
+++ b/tools/h5dump/Makefile.am
@@ -35,7 +35,7 @@ SCRIPT_DEPEND=h5dump$(EXEEXT)
bin_PROGRAMS=h5dump
# Add h5dump specific linker flags here
-h5dump_LDFLAGS = $(LT_STATIC_EXEC)
+h5dump_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
# All the programs depend on the hdf5 and h5tools libraries
LDADD=$(LIBH5TOOLS) $(LIBHDF5)
diff --git a/tools/h5dump/Makefile.in b/tools/h5dump/Makefile.in
index be8cf96..8ca6684 100644
--- a/tools/h5dump/Makefile.in
+++ b/tools/h5dump/Makefile.in
@@ -108,6 +108,16 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = /home1/packages/automake/automake-1.9.6/bin/aclocal-1.9 -I /afs/ncsa/projects/hdf/packages/libtool_1.5.14/Linux_2.4/share/aclocal
ADD_PARALLEL_FILES = @ADD_PARALLEL_FILES@
AMTAR = @AMTAR@
+
+# H5_CFLAGS holds flags that should be used when building hdf5,
+# but which should not be exported to h5cc for building other programs.
+# AM_CFLAGS is an automake construct which should be used by Makefiles
+# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
+AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
+AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@
+AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
+AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@
+AM_LDFLAGS = @AM_LDFLAGS@
AM_MAKEFLAGS = @AM_MAKEFLAGS@
AR = @AR@
@@ -121,21 +131,18 @@ BYTESEX = @BYTESEX@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CC_VERSION = @CC_VERSION@
-
-# H5_CFLAGS holds flags that should be used as CFLAGS when building hdf5,
-# but which shouldn't be exported to h5cc for building other programs.
-CFLAGS = @CFLAGS@ @H5_CFLAGS@
+CFLAGS = @CFLAGS@
CLEARFILEBUF = @CLEARFILEBUF@
CODESTACK = @CODESTACK@
CONFIG_DATE = @CONFIG_DATE@
CONFIG_MODE = @CONFIG_MODE@
CONFIG_USER = @CONFIG_USER@
CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@ @H5_CPPFLAGS@
+CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@ @H5_CXXFLAGS@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_PKG = @DEBUG_PKG@
DEFAULT_API_VERSION = @DEFAULT_API_VERSION@
@@ -158,7 +165,7 @@ F9XMODEXT = @F9XMODEXT@
F9XMODFLAG = @F9XMODFLAG@
F9XSUFFIXFLAG = @F9XSUFFIXFLAG@
FC = @FC@
-FCFLAGS = @FCFLAGS@ @H5_FCFLAGS@
+FCFLAGS = @FCFLAGS@
FCFLAGS_f90 = @FCFLAGS_f90@
FCLIBS = @FCLIBS@
FGREP = @FGREP@
@@ -369,7 +376,7 @@ check_SCRIPTS = $(TEST_SCRIPT)
SCRIPT_DEPEND = h5dump$(EXEEXT)
# Add h5dump specific linker flags here
-h5dump_LDFLAGS = $(LT_STATIC_EXEC)
+h5dump_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
# All the programs depend on the hdf5 and h5tools libraries
LDADD = $(LIBH5TOOLS) $(LIBHDF5)
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c
index c74c9f1..a437619 100644
--- a/tools/h5dump/h5dump.c
+++ b/tools/h5dump/h5dump.c
@@ -3067,22 +3067,22 @@ dump_fcpl(hid_t fid)
hsize_t userblock; /* userblock size retrieved from FCPL */
size_t off_size; /* size of offsets in the file */
size_t len_size; /* size of lengths in the file */
- unsigned super; /* superblock version # */
- unsigned freelist; /* free list version # */
- unsigned stab; /* symbol table entry version # */
- unsigned shhdr; /* shared object header version # */
hid_t fdriver; /* file driver */
char dname[32]; /* buffer to store driver name */
unsigned sym_lk; /* symbol table B-tree leaf 'K' value */
unsigned sym_ik; /* symbol table B-tree internal 'K' value */
unsigned istore_ik; /* indexed storage B-tree internal 'K' value */
+ H5F_file_space_type_t fs_strategy; /* file space strategy */
+ hsize_t fs_threshold; /* free-space section threshold */
+ H5F_info2_t finfo; /* file information */
fcpl=H5Fget_create_plist(fid);
- H5Pget_version(fcpl, &super, &freelist, &stab, &shhdr);
+ H5Fget_info2(fid, &finfo);
H5Pget_userblock(fcpl,&userblock);
H5Pget_sizes(fcpl,&off_size,&len_size);
H5Pget_sym_k(fcpl,&sym_ik,&sym_lk);
H5Pget_istore_k(fcpl,&istore_ik);
+ H5Pget_file_space(fcpl, &fs_strategy, &fs_threshold);
H5Pclose(fcpl);
fapl=h5_fileaccess();
fdriver=H5Pget_driver(fapl);
@@ -3094,13 +3094,13 @@ dump_fcpl(hid_t fid)
*/
printf("%s %s\n",SUPER_BLOCK, BEGIN);
indentation(indent + COL);
- printf("%s %u\n","SUPERBLOCK_VERSION", super);
+ printf("%s %u\n","SUPERBLOCK_VERSION", finfo.super.version);
indentation(indent + COL);
- printf("%s %u\n","FREELIST_VERSION", freelist);
+ printf("%s %u\n","FREELIST_VERSION", finfo.free.version);
indentation(indent + COL);
- printf("%s %u\n","SYMBOLTABLE_VERSION", stab);
+ printf("%s %u\n","SYMBOLTABLE_VERSION", 0); /* Retain this for backward compatibility, for now (QAK) */
indentation(indent + COL);
- printf("%s %u\n","OBJECTHEADER_VERSION", shhdr);
+ printf("%s %u\n","OBJECTHEADER_VERSION", finfo.sohm.version);
indentation(indent + COL);
HDfprintf(stdout,"%s %Hd\n","OFFSET_SIZE", (long long)off_size);
indentation(indent + COL);
@@ -3141,6 +3141,21 @@ dump_fcpl(hid_t fid)
printf("%s %s\n","FILE_DRIVER", dname);*/
indentation(indent + COL);
printf("%s %u\n","ISTORE_K", istore_ik);
+
+ indentation(indent + COL);
+ if(fs_strategy == H5F_FILE_SPACE_ALL_PERSIST)
+ printf("%s %s\n", "FILE_SPACE_STRATEGY", "H5F_FILE_SPACE_ALL_PERSIST");
+ else if(fs_strategy == H5F_FILE_SPACE_ALL)
+ printf("%s %s\n", "FILE_SPACE_STRATEGY", "H5F_FILE_SPACE_ALL");
+ else if(fs_strategy == H5F_FILE_SPACE_AGGR_VFD)
+ printf("%s %s\n", "FILE_SPACE_STRATEGY", "H5F_FILE_SPACE_AGGR_VFD");
+ else if(fs_strategy == H5F_FILE_SPACE_VFD)
+ printf("%s %s\n", "FILE_SPACE_STRATEGY", "H5F_FILE_SPACE_VFD");
+ else
+ printf("%s %s\n", "FILE_SPACE_STRATEGY", "Unknown strategy");
+ indentation(indent + COL);
+ HDfprintf(stdout, "%s %Hu\n","FREE_SPACE_THRESHOLD", fs_threshold);
+
printf("%s\n",END);
/*-------------------------------------------------------------------------
@@ -4063,8 +4078,6 @@ parse_start:
}
break;
- break;
-
/** begin XML parameters **/
case 'x':
/* select XML output */
diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c
index dcb491e..b42b675 100644
--- a/tools/h5dump/h5dumpgentest.c
+++ b/tools/h5dump/h5dumpgentest.c
@@ -93,7 +93,8 @@
#define FILE63 "textlinkfar.h5"
#define FILE64 "tarray8.h5"
#define FILE65 "tattrreg.h5"
-#define FILE66 "tdset_idx.h5"
+#define FILE66 "file_space.h5"
+#define FILE67 "tdset_idx.h5"
@@ -247,6 +248,10 @@ typedef struct s1_t {
#define F64_ARRAY_BUF_LEN (4*1024)
#define F64_DIM1 (F64_ARRAY_BUF_LEN / sizeof(int) + 1)
+/* File 65 macros */
+#define STRATEGY H5F_FILE_SPACE_AGGR_VFD /* File space handling strategy */
+#define THRESHOLD10 10 /* Free space section threshold */
+
/* Declarations for gent_dataset_idx() for "FILE66" */
#define DSET_FIXED "dset_fixed"
#define DSET_FIXED_FILTER "dset_filter"
@@ -390,85 +395,6 @@ gent_dataset2(void)
H5Fclose(fid);
}
-/*
- * Create a file with new format.
- * Create one dataset with (set_chunk, fixed dimension)
- * so that Fixed Array indexing will be used.
- * Create one dataset with (set_chunk, fixed dimension, filter)
- * so that Fixed Array indexing will be used.
- * Create one dataset with (set_chunk, non-fixed dimension)
- * so that B-tree indexing will be used.
- */
-static void
-gent_dataset_idx(void)
-{
- hid_t fid, space, dcpl, fapl;
- hsize_t dims[2];
- hsize_t maxdims[2];
- int buf[20][10];
- int i, j, ret;
-
- /* Get a copy of the file aaccess property */
- fapl = H5Pcreate(H5P_FILE_ACCESS);
-
- /* Set the "use the latest version of the format" bounds for creating objects in the file */
- ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST);
- assert(ret >= 0);
-
- fid = H5Fcreate(FILE66, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
- dcpl = H5Pcreate(H5P_DATASET_CREATE);
-
- dims[0] = CHUNK;
- dims[1] = CHUNK;
-
- /* set chunk */
- ret = H5Pset_chunk(dcpl, RANK, dims);
- assert(ret >= 0);
-
- /* dataset with fixed dimensions */
- dims[0] = DIM20;
- dims[1] = DIM10;
- space = H5Screate_simple(RANK, dims, NULL);
-
- for(i = 0; i < DIM20; i++)
- for(j = 0; j < DIM10; j++)
- buf[i][j] = j;
-
- ret = make_dset(fid, DSET_FIXED, space, H5T_NATIVE_INT, dcpl, buf);
- assert(ret >= 0);
- H5Sclose(space);
-
- /* dataset with non-fixed dimensions */
- maxdims[0] = DIM200;
- maxdims[1] = DIM100;
- space = H5Screate_simple(RANK, dims, maxdims);
-
- ret = make_dset(fid, DSET_BTREE, space, H5T_NATIVE_INT, dcpl, buf);
- assert(ret >= 0);
- H5Sclose(space);
-
-#if defined (H5_HAVE_FILTER_DEFLATE)
-
- /* dataset with fixed dimensions and filters */
- /* remove the filters from the dcpl */
- ret = H5Premove_filter(dcpl, H5Z_FILTER_ALL);
- assert(ret >= 0);
-
- /* set deflate data */
- ret = H5Pset_deflate(dcpl, 9);
- assert(ret >= 0);
-
- space = H5Screate_simple(RANK, dims, NULL);
- ret = make_dset(fid, DSET_FIXED_FILTER, space, H5T_NATIVE_INT, dcpl, buf);
- assert(ret >= 0);
-
- H5Sclose(space);
-#endif
-
- H5Pclose(dcpl);
- H5Fclose(fid);
-}
-
static void
gent_attribute(void)
{
@@ -3043,7 +2969,6 @@ static void gent_array8(void)
hsize_t sdims[] = {F64_DIM0};
hsize_t tdims[] = {F64_DIM1};
int wdata[(F64_DIM1) * sizeof(int)]; /* Write buffer */
- int ndims;
int i;
/*
@@ -6534,7 +6459,111 @@ gent_extlinks(void)
H5Fclose(far_fid);
}
+/*-------------------------------------------------------------------------
+ * Function: gent_fs_strategy_threshold
+ *
+ * Purpose: Generate a file with non-default file space strategy and
+ * non-default free-space section threshold.
+ *-------------------------------------------------------------------------
+ */
+static void
+gent_fs_strategy_threshold(void)
+{
+ hid_t fid; /* File id */
+ hid_t fcpl; /* File creation property */
+
+ /* Create file-creation template */
+ fcpl = H5Pcreate(H5P_FILE_CREATE);
+
+ /* Set file space information */
+ H5Pset_file_space(fcpl, STRATEGY, (hsize_t)THRESHOLD10);
+
+ /* Create the file with the specified strategy and threshold */
+ fid = H5Fcreate(FILE66, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT);
+
+ /* close */
+ H5Fclose(fid);
+ H5Pclose(fcpl);
+}
+
+/*
+ * Create a file with new format.
+ * Create one dataset with (set_chunk, fixed dimension)
+ * so that Fixed Array indexing will be used.
+ * Create one dataset with (set_chunk, fixed dimension, filter)
+ * so that Fixed Array indexing will be used.
+ * Create one dataset with (set_chunk, non-fixed dimension)
+ * so that B-tree indexing will be used.
+ */
+static void
+gent_dataset_idx(void)
+{
+ hid_t fid, space, dcpl, fapl;
+ hsize_t dims[2];
+ hsize_t maxdims[2];
+ int buf[20][10];
+ int i, j, ret;
+
+ /* Get a copy of the file aaccess property */
+ fapl = H5Pcreate(H5P_FILE_ACCESS);
+ /* Set the "use the latest version of the format" bounds for creating objects in the file */
+ ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST);
+ assert(ret >= 0);
+
+ fid = H5Fcreate(FILE67, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
+ dcpl = H5Pcreate(H5P_DATASET_CREATE);
+
+ dims[0] = CHUNK;
+ dims[1] = CHUNK;
+
+ /* set chunk */
+ ret = H5Pset_chunk(dcpl, RANK, dims);
+ assert(ret >= 0);
+
+ /* dataset with fixed dimensions */
+ dims[0] = DIM20;
+ dims[1] = DIM10;
+ space = H5Screate_simple(RANK, dims, NULL);
+
+ for(i = 0; i < DIM20; i++)
+ for(j = 0; j < DIM10; j++)
+ buf[i][j] = j;
+
+ ret = make_dset(fid, DSET_FIXED, space, H5T_NATIVE_INT, dcpl, buf);
+ assert(ret >= 0);
+ H5Sclose(space);
+
+ /* dataset with non-fixed dimensions */
+ maxdims[0] = DIM200;
+ maxdims[1] = DIM100;
+ space = H5Screate_simple(RANK, dims, maxdims);
+
+ ret = make_dset(fid, DSET_BTREE, space, H5T_NATIVE_INT, dcpl, buf);
+ assert(ret >= 0);
+ H5Sclose(space);
+
+#if defined (H5_HAVE_FILTER_DEFLATE)
+
+ /* dataset with fixed dimensions and filters */
+ /* remove the filters from the dcpl */
+ ret = H5Premove_filter(dcpl, H5Z_FILTER_ALL);
+ assert(ret >= 0);
+
+ /* set deflate data */
+ ret = H5Pset_deflate(dcpl, 9);
+ assert(ret >= 0);
+
+ space = H5Screate_simple(RANK, dims, NULL);
+ ret = make_dset(fid, DSET_FIXED_FILTER, space, H5T_NATIVE_INT, dcpl, buf);
+ assert(ret >= 0);
+
+ H5Sclose(space);
+#endif
+
+ H5Pclose(dcpl);
+ H5Fclose(fid);
+}
/*-------------------------------------------------------------------------
* Function: main
@@ -6607,7 +6636,7 @@ int main(void)
gent_attr_creation_order();
gent_fpformat();
gent_extlinks();
-
+ gent_fs_strategy_threshold();
gent_dataset_idx();
return 0;
diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in
index 6d2f273..84274cf 100644
--- a/tools/h5dump/testh5dump.sh.in
+++ b/tools/h5dump/testh5dump.sh.in
@@ -161,12 +161,8 @@ DIFFTEST()
{
PRINT_H5DIFF $@
(
- cd $srcdir/../testfiles
- if [ "`uname -s`" = "TFLOPS O/S" ]; then
- $RUNSERIAL $H5DIFF_BIN $@ -q
- else
- $RUNSERIAL $H5DIFF_BIN "$@" -q
- fi
+ cd $srcdir/../testfiles
+ $RUNSERIAL $H5DIFF_BIN "$@" -q
)
RET=$?
if [ $RET != 0 ] ; then
@@ -198,12 +194,8 @@ IMPORTTEST()
PRINT_H5IMPORT $@
(
- cd $srcdir/../testfiles
- if [ "`uname -s`" = "TFLOPS O/S" ]; then
- $RUNSERIAL $H5IMPORT_BIN $@
- else
- $RUNSERIAL $H5IMPORT_BIN "$@"
- fi
+ cd $srcdir/../testfiles
+ $RUNSERIAL $H5IMPORT_BIN "$@"
)
RET=$?
if [ $RET != 0 ] ; then
@@ -340,6 +332,7 @@ TOOLTEST tnofilename.ddl
# tests for super block
TOOLTEST tboot1.ddl -H -B -d dset tfcontents1.h5
TOOLTEST tboot2.ddl -B tfcontents2.h5
+TOOLTEST file_space.ddl -B file_space.h5
# test -p with a non existing dataset
TOOLTEST tperror.ddl -p -d bogus tfcontents1.h5
diff --git a/tools/h5import/Makefile.am b/tools/h5import/Makefile.am
index 2202f5f..49f4f71 100644
--- a/tools/h5import/Makefile.am
+++ b/tools/h5import/Makefile.am
@@ -35,7 +35,7 @@ SCRIPT_DEPEND=h5import$(EXEEXT)
bin_PROGRAMS=h5import
# Add h5import specific linker flags here
-h5import_LDFLAGS = $(LT_STATIC_EXEC)
+h5import_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
# All programs depend on the main hdf5 library and the tools library
LDADD=$(LIBH5TOOLS) $(LIBHDF5)
diff --git a/tools/h5import/Makefile.in b/tools/h5import/Makefile.in
index f9e88ae..15fcf90 100755
--- a/tools/h5import/Makefile.in
+++ b/tools/h5import/Makefile.in
@@ -103,6 +103,16 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = /home1/packages/automake/automake-1.9.6/bin/aclocal-1.9 -I /afs/ncsa/projects/hdf/packages/libtool_1.5.14/Linux_2.4/share/aclocal
ADD_PARALLEL_FILES = @ADD_PARALLEL_FILES@
AMTAR = @AMTAR@
+
+# H5_CFLAGS holds flags that should be used when building hdf5,
+# but which should not be exported to h5cc for building other programs.
+# AM_CFLAGS is an automake construct which should be used by Makefiles
+# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
+AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
+AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@
+AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
+AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@
+AM_LDFLAGS = @AM_LDFLAGS@
AM_MAKEFLAGS = @AM_MAKEFLAGS@
AR = @AR@
@@ -116,21 +126,18 @@ BYTESEX = @BYTESEX@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CC_VERSION = @CC_VERSION@
-
-# H5_CFLAGS holds flags that should be used as CFLAGS when building hdf5,
-# but which shouldn't be exported to h5cc for building other programs.
-CFLAGS = @CFLAGS@ @H5_CFLAGS@
+CFLAGS = @CFLAGS@
CLEARFILEBUF = @CLEARFILEBUF@
CODESTACK = @CODESTACK@
CONFIG_DATE = @CONFIG_DATE@
CONFIG_MODE = @CONFIG_MODE@
CONFIG_USER = @CONFIG_USER@
CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@ @H5_CPPFLAGS@
+CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@ @H5_CXXFLAGS@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_PKG = @DEBUG_PKG@
DEFAULT_API_VERSION = @DEFAULT_API_VERSION@
@@ -153,7 +160,7 @@ F9XMODEXT = @F9XMODEXT@
F9XMODFLAG = @F9XMODFLAG@
F9XSUFFIXFLAG = @F9XSUFFIXFLAG@
FC = @FC@
-FCFLAGS = @FCFLAGS@ @H5_FCFLAGS@
+FCFLAGS = @FCFLAGS@
FCFLAGS_f90 = @FCFLAGS_f90@
FCLIBS = @FCLIBS@
FGREP = @FGREP@
@@ -361,7 +368,7 @@ check_SCRIPT = h5importtestutil.sh
SCRIPT_DEPEND = h5import$(EXEEXT)
# Add h5import specific linker flags here
-h5import_LDFLAGS = $(LT_STATIC_EXEC)
+h5import_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
# All programs depend on the main hdf5 library and the tools library
LDADD = $(LIBH5TOOLS) $(LIBHDF5)
diff --git a/tools/h5import/h5import.c b/tools/h5import/h5import.c
index 933754e..3818829 100755
--- a/tools/h5import/h5import.c
+++ b/tools/h5import/h5import.c
@@ -174,7 +174,7 @@ int main(int argc, char *argv[])
case ERR: /* command syntax error */
default:
- (void) fprintf(stderr, err2);
+ (void) fprintf(stderr, "%s", err2);
usage(argv[0]);
goto err;
}
@@ -182,7 +182,7 @@ int main(int argc, char *argv[])
if (FALSE == outfile_named)
{
- (void) fprintf(stderr, err3);
+ (void) fprintf(stderr, "%s", err3);
usage(argv[0]);
goto err;
}
@@ -190,10 +190,10 @@ int main(int argc, char *argv[])
if (process(&opt) == -1)
goto err;
- return(0);
+ return(EXIT_SUCCESS);
err:
- (void) fprintf(stderr, err4);
- return(-1);
+ (void) fprintf(stderr, "%s", err4);
+ return(EXIT_FAILURE);
}
static int
@@ -397,7 +397,7 @@ processDataFile(char *infile, struct Input *in, FILE **strm, hid_t file_id)
break;
default:
- (void) fprintf(stderr, err10);
+ (void) fprintf(stderr, "%s", err10);
return(-1);
}
return (0);
@@ -435,7 +435,7 @@ readIntegerData(FILE **strm, struct Input *in)
{
if (fscanf(*strm, "%hd", &temp) != 1)
{
- (void) fprintf(stderr, err1);
+ (void) fprintf(stderr, "%s", err1);
return (-1);
}
(*in08) = (H5DT_INT8)temp;
@@ -448,14 +448,14 @@ readIntegerData(FILE **strm, struct Input *in)
{
if (fread((char *) in08, sizeof(H5DT_INT8), 1, *strm) != 1)
{
- (void) fprintf(stderr, err1);
+ (void) fprintf(stderr, "%s", err1);
return (-1);
}
}
break;
default:
- (void) fprintf(stderr, err2);
+ (void) fprintf(stderr, "%s", err2);
return (-1);
}
break;
@@ -469,7 +469,7 @@ readIntegerData(FILE **strm, struct Input *in)
{
if (fscanf(*strm, "%hd", in16) != 1)
{
- (void) fprintf(stderr, err1);
+ (void) fprintf(stderr, "%s", err1);
return (-1);
}
}
@@ -481,14 +481,14 @@ readIntegerData(FILE **strm, struct Input *in)
{
if (fread((char *) in16, sizeof(H5DT_INT16), 1, *strm) != 1)
{
- (void) fprintf(stderr, err1);
+ (void) fprintf(stderr, "%s", err1);
return (-1);
}
}
break;
default:
- (void) fprintf(stderr, err2);
+ (void) fprintf(stderr, "%s", err2);
return (-1);
}
break;
@@ -502,7 +502,7 @@ readIntegerData(FILE **strm, struct Input *in)
{
if (fscanf(*strm, "%d", in32) != 1)
{
- (void) fprintf(stderr, err1);
+ (void) fprintf(stderr, "%s", err1);
return (-1);
}
}
@@ -513,14 +513,14 @@ readIntegerData(FILE **strm, struct Input *in)
{
if (fread((char *) in32, sizeof(H5DT_INT32), 1, *strm) != 1)
{
- (void) fprintf(stderr, err1);
+ (void) fprintf(stderr, "%s", err1);
return (-1);
}
}
break;
default:
- (void) fprintf(stderr, err2);
+ (void) fprintf(stderr, "%s", err2);
return (-1);
}
break;
@@ -535,7 +535,7 @@ readIntegerData(FILE **strm, struct Input *in)
{
if (fscanf(*strm, "%s", buffer) < 1)
{
- (void) fprintf(stderr, err1);
+ (void) fprintf(stderr, "%s", err1);
return (-1);
}
*in64 = (H5DT_INT64) HDstrtoll(buffer, NULL, 10);
@@ -547,21 +547,21 @@ readIntegerData(FILE **strm, struct Input *in)
{
if (fread((char *) in64, sizeof(H5DT_INT64), 1, *strm) != 1)
{
- (void) fprintf(stderr, err1);
+ (void) fprintf(stderr, "%s", err1);
return (-1);
}
}
break;
default:
- (void) fprintf(stderr, err2);
+ (void) fprintf(stderr, "%s", err2);
return (-1);
}
break;
#endif /* ifndef _WIN32 */
default:
- (void) fprintf(stderr, err3);
+ (void) fprintf(stderr, "%s", err3);
break;
}
return(0);
@@ -598,7 +598,7 @@ readUIntegerData(FILE **strm, struct Input *in)
{
if (fscanf(*strm, "%hu", &temp) != 1)
{
- (void) fprintf(stderr, err1);
+ (void) fprintf(stderr, "%s", err1);
return (-1);
}
(*in08) = (H5DT_UINT8)temp;
@@ -611,14 +611,14 @@ readUIntegerData(FILE **strm, struct Input *in)
{
if (fread((char *) in08, sizeof(H5DT_UINT8), 1, *strm) != 1)
{
- (void) fprintf(stderr, err1);
+ (void) fprintf(stderr, "%s", err1);
return (-1);
}
}
break;
default:
- (void) fprintf(stderr, err2);
+ (void) fprintf(stderr, "%s", err2);
return (-1);
}
break;
@@ -632,7 +632,7 @@ readUIntegerData(FILE **strm, struct Input *in)
{
if (fscanf(*strm, "%hu", in16) != 1)
{
- (void) fprintf(stderr, err1);
+ (void) fprintf(stderr, "%s", err1);
return (-1);
}
}
@@ -643,14 +643,14 @@ readUIntegerData(FILE **strm, struct Input *in)
{
if (fread((char *) in16, sizeof(H5DT_UINT16), 1, *strm) != 1)
{
- (void) fprintf(stderr, err1);
+ (void) fprintf(stderr, "%s", err1);
return (-1);
}
}
break;
default:
- (void) fprintf(stderr, err2);
+ (void) fprintf(stderr, "%s", err2);
return (-1);
}
break;
@@ -664,7 +664,7 @@ readUIntegerData(FILE **strm, struct Input *in)
{
if (fscanf(*strm, "%u", in32) != 1)
{
- (void) fprintf(stderr, err1);
+ (void) fprintf(stderr, "%s", err1);
return (-1);
}
}
@@ -675,14 +675,14 @@ readUIntegerData(FILE **strm, struct Input *in)
{
if (fread((char *) in32, sizeof(H5DT_UINT32), 1, *strm) != 1)
{
- (void) fprintf(stderr, err1);
+ (void) fprintf(stderr, "%s", err1);
return (-1);
}
}
break;
default:
- (void) fprintf(stderr, err2);
+ (void) fprintf(stderr, "%s", err2);
return (-1);
}
break;
@@ -697,7 +697,7 @@ readUIntegerData(FILE **strm, struct Input *in)
{
if (fscanf(*strm, "%s", buffer) < 1)
{
- (void) fprintf(stderr, err1);
+ (void) fprintf(stderr, "%s", err1);
return (-1);
}
*in64 = (H5DT_UINT64) HDstrtoll(buffer, NULL, 10);
@@ -709,21 +709,21 @@ readUIntegerData(FILE **strm, struct Input *in)
{
if (fread((char *) in64, sizeof(H5DT_UINT64), 1, *strm) != 1)
{
- (void) fprintf(stderr, err1);
+ (void) fprintf(stderr, "%s", err1);
return (-1);
}
}
break;
default:
- (void) fprintf(stderr, err2);
+ (void) fprintf(stderr, "%s", err2);
return (-1);
}
break;
#endif /* ifndef _WIN32 */
default:
- (void) fprintf(stderr, err3);
+ (void) fprintf(stderr, "%s", err3);
break;
}
return(0);
@@ -756,7 +756,7 @@ readFloatData(FILE **strm, struct Input *in)
{
if (fscanf(*strm, "%f", fp32) != 1)
{
- (void) fprintf(stderr, err1);
+ (void) fprintf(stderr, "%s", err1);
return (-1);
}
}
@@ -771,7 +771,7 @@ readFloatData(FILE **strm, struct Input *in)
{
if (fscanf(*strm, "%f", fp32) != 1)
{
- (void) fprintf(stderr, err1);
+ (void) fprintf(stderr, "%s", err1);
return (-1);
}
}
@@ -784,14 +784,14 @@ readFloatData(FILE **strm, struct Input *in)
{
if (fread((char *) fp32, sizeof(H5DT_FLOAT32), 1, *strm) != 1)
{
- (void) fprintf(stderr, err1);
+ (void) fprintf(stderr, "%s", err1);
return (-1);
}
}
break;
default:
- (void) fprintf(stderr, err2);
+ (void) fprintf(stderr, "%s", err2);
return (-1);
}
break;
@@ -805,7 +805,7 @@ readFloatData(FILE **strm, struct Input *in)
{
if (fscanf(*strm, "%lf", fp64) != 1)
{
- (void) fprintf(stderr, err1);
+ (void) fprintf(stderr, "%s", err1);
return (-1);
}
}
@@ -820,7 +820,7 @@ readFloatData(FILE **strm, struct Input *in)
{
if (fscanf(*strm, "%lf", fp64) != 1)
{
- (void) fprintf(stderr, err1);
+ (void) fprintf(stderr, "%s", err1);
return (-1);
}
}
@@ -833,20 +833,20 @@ readFloatData(FILE **strm, struct Input *in)
{
if (fread((char *) fp64, sizeof(H5DT_FLOAT64), 1, *strm) != 1)
{
- (void) fprintf(stderr, err1);
+ (void) fprintf(stderr, "%s", err1);
return (-1);
}
}
break;
default:
- (void) fprintf(stderr, err2);
+ (void) fprintf(stderr, "%s", err2);
return (-1);
}
break;
default:
- (void) fprintf(stderr, err3);
+ (void) fprintf(stderr, "%s", err3);
break;
}
return(0);
@@ -1019,7 +1019,7 @@ allocateIntegerStorage(struct Input *in)
case 8:
if ((in->data = (VOIDP) HDmalloc((size_t) len * sizeof(H5DT_INT8))) == NULL)
{
- (void) fprintf(stderr, err1);
+ (void) fprintf(stderr, "%s", err1);
return (-1);
}
break;
@@ -1027,7 +1027,7 @@ allocateIntegerStorage(struct Input *in)
case 16:
if ((in->data = (VOIDP) HDmalloc((size_t) len * sizeof(H5DT_INT16))) == NULL)
{
- (void) fprintf(stderr, err1);
+ (void) fprintf(stderr, "%s", err1);
return (-1);
}
break;
@@ -1035,7 +1035,7 @@ allocateIntegerStorage(struct Input *in)
case 32:
if ((in->data = (VOIDP) HDmalloc((size_t) len * sizeof(H5DT_INT32))) == NULL)
{
- (void) fprintf(stderr, err1);
+ (void) fprintf(stderr, "%s", err1);
return (-1);
}
break;
@@ -1043,13 +1043,13 @@ allocateIntegerStorage(struct Input *in)
case 64:
if ((in->data = (VOIDP) HDmalloc((size_t) len * sizeof(H5DT_INT64))) == NULL)
{
- (void) fprintf(stderr, err1);
+ (void) fprintf(stderr, "%s", err1);
return (-1);
}
break;
default:
- (void) fprintf(stderr, err2);
+ (void) fprintf(stderr, "%s", err2);
break;
}
return(0);
@@ -1070,7 +1070,7 @@ static int allocateUIntegerStorage(struct Input *in)
case 8:
if ((in->data = (VOIDP) HDmalloc((size_t) len * sizeof(H5DT_UINT8))) == NULL)
{
- (void) fprintf(stderr, err1);
+ (void) fprintf(stderr, "%s", err1);
return (-1);
}
break;
@@ -1078,7 +1078,7 @@ static int allocateUIntegerStorage(struct Input *in)
case 16:
if ((in->data = (VOIDP) HDmalloc((size_t) len * sizeof(H5DT_UINT16))) == NULL)
{
- (void) fprintf(stderr, err1);
+ (void) fprintf(stderr, "%s", err1);
return (-1);
}
break;
@@ -1086,7 +1086,7 @@ static int allocateUIntegerStorage(struct Input *in)
case 32:
if ((in->data = (VOIDP) HDmalloc((size_t) len * sizeof(H5DT_UINT32))) == NULL)
{
- (void) fprintf(stderr, err1);
+ (void) fprintf(stderr, "%s", err1);
return (-1);
}
break;
@@ -1094,13 +1094,13 @@ static int allocateUIntegerStorage(struct Input *in)
case 64:
if ((in->data = (VOIDP) HDmalloc((size_t) len * sizeof(H5DT_UINT64))) == NULL)
{
- (void) fprintf(stderr, err1);
+ (void) fprintf(stderr, "%s", err1);
return (-1);
}
break;
default:
- (void) fprintf(stderr, err2);
+ (void) fprintf(stderr, "%s", err2);
break;
}
return(0);
@@ -1122,7 +1122,7 @@ allocateFloatStorage(struct Input *in)
case 32:
if ((in->data = (VOIDP) HDmalloc((size_t) len * sizeof(H5DT_FLOAT32))) == NULL)
{
- (void) fprintf(stderr, err1);
+ (void) fprintf(stderr, "%s", err1);
return (-1);
}
break;
@@ -1130,13 +1130,13 @@ allocateFloatStorage(struct Input *in)
case 64:
if ((in->data = (VOIDP) HDmalloc((size_t) len * sizeof(H5DT_FLOAT64))) == NULL)
{
- (void) fprintf(stderr, err1);
+ (void) fprintf(stderr, "%s", err1);
return (-1);
}
break;
default:
- (void) fprintf(stderr, err2);
+ (void) fprintf(stderr, "%s", err2);
break;
}
return(0);
@@ -1216,7 +1216,7 @@ processConfigurationFile(char *infile, struct Input *in, FILE **strm)
}
if (fscanf(*strm, "%s", temp) != 1)
{
- (void) fprintf(stderr, err18);
+ (void) fprintf(stderr, "%s", err18);
return (-1);
}
if (parsePathInfo(&in->path, temp) == -1)
@@ -1236,7 +1236,7 @@ processConfigurationFile(char *infile, struct Input *in, FILE **strm)
if (fscanf(*strm, "%s", temp) != 1)
{
- (void) fprintf(stderr, err18);
+ (void) fprintf(stderr, "%s", err18);
return (-1);
}
if (getInputClass(in, temp) == -1)
@@ -1267,7 +1267,7 @@ processConfigurationFile(char *infile, struct Input *in, FILE **strm)
}
if (fscanf(*strm, "%d", (&ival)) != 1)
{
- (void) fprintf(stderr, err19);
+ (void) fprintf(stderr, "%s", err19);
return (-1);
}
if (getInputSize(in, ival) == -1)
@@ -1514,7 +1514,7 @@ validateConfigurationParameters(struct Input * in)
(in->configOptionVector[DIM] != 1) ||
(in->configOptionVector[RANK] != 1))
{
- (void) fprintf(stderr, err1);
+ (void) fprintf(stderr, "%s", err1);
return (-1);
}
@@ -1524,7 +1524,7 @@ validateConfigurationParameters(struct Input * in)
(in->configOptionVector[CHUNK] == 1) ||
(in->configOptionVector[EXTEND] == 1))
{
- (void) fprintf(stderr, err2);
+ (void) fprintf(stderr, "%s", err2);
return (-1);
}
}
@@ -1534,7 +1534,7 @@ validateConfigurationParameters(struct Input * in)
{
if (in->configOptionVector[CHUNK] != 1)
{
- (void) fprintf(stderr, err3);
+ (void) fprintf(stderr, "%s", err3);
return (-1);
}
}
@@ -1543,7 +1543,7 @@ validateConfigurationParameters(struct Input * in)
if (in->outputArchitecture == 1)
if (in->outputClass == 1)
{
- (void) fprintf(stderr, err4a);
+ (void) fprintf(stderr, "%s", err4a);
return (-1);
}
@@ -1551,7 +1551,7 @@ validateConfigurationParameters(struct Input * in)
if (in->outputArchitecture == 2)
if (in->outputClass == 0)
{
- (void) fprintf(stderr, err4b);
+ (void) fprintf(stderr, "%s", err4b);
return (-1);
}
@@ -1559,14 +1559,14 @@ validateConfigurationParameters(struct Input * in)
if(in->outputSize != 32 &&
in->outputSize != 64 )
{
- (void) fprintf(stderr, err5);
+ (void) fprintf(stderr, "%s", err5);
return (-1);
}
#ifdef _WIN32
if (in->inputSize == 64 && (in->inputClass == 0 || in->inputClass == 4 || in->inputClass == 6 || in->inputClass == 7) )
{
- (void) fprintf(stderr, err6);
+ (void) fprintf(stderr, "%s", err6);
return -1;
}
#endif
@@ -1626,7 +1626,7 @@ parseDimensions(struct Input *in, char *strm)
if ((in->sizeOfDimension =
(hsize_t *) HDmalloc ((size_t) in->rank * sizeof(hsize_t))) == NULL)
{
- (void) fprintf(stderr, err1);
+ (void) fprintf(stderr, "%s", err1);
return (-1);
}
@@ -1654,13 +1654,13 @@ getOutputClass(struct Input *in, FILE** strm)
if (fscanf(*strm, "%s", temp) != 1)
{
- (void) fprintf(stderr, err1);
+ (void) fprintf(stderr, "%s", err1);
return (-1);
}
if ((kindex = OutputClassStrToInt(temp)) == -1)
{
- (void) fprintf(stderr, err2);
+ (void) fprintf(stderr, "%s", err2);
return (-1);
}
@@ -1694,7 +1694,7 @@ getOutputSize(struct Input *in, FILE** strm)
if (fscanf(*strm, "%d", (&ival)) != 1)
{
- (void) fprintf(stderr, err1);
+ (void) fprintf(stderr, "%s", err1);
return (-1);
}
@@ -1704,7 +1704,7 @@ getOutputSize(struct Input *in, FILE** strm)
in->outputSize = ival;
return (0);
}
- (void) fprintf(stderr, err2);
+ (void) fprintf(stderr, "%s", err2);
return(-1);
}
@@ -1716,7 +1716,7 @@ getInputClass(struct Input *in, char * temp)
if ((kindex = InputClassStrToInt(temp)) == -1)
{
- (void) fprintf(stderr, err1);
+ (void) fprintf(stderr, "%s", err1);
return (-1);
}
@@ -1757,7 +1757,7 @@ getInputSize(struct Input *in, int ival)
in->inputSize = ival;
return (0);
}
- (void) fprintf(stderr, err1);
+ (void) fprintf(stderr, "%s", err1);
return(-1);
}
@@ -1771,7 +1771,7 @@ getRank(struct Input *in, FILE** strm)
if (fscanf(*strm, "%d", (&ival)) != 1)
{
- (void) fprintf(stderr, err1);
+ (void) fprintf(stderr, "%s", err1);
return (-1);
}
if (ival >=MIN_NUM_DIMENSION && ival <=MAX_NUM_DIMENSION )
@@ -1780,7 +1780,7 @@ getRank(struct Input *in, FILE** strm)
return (0);
}
- (void) fprintf(stderr, err2);
+ (void) fprintf(stderr, "%s", err2);
return(-1);
}
@@ -1797,7 +1797,7 @@ getDimensionSizes(struct Input *in, FILE **strm)
if ((in->sizeOfDimension =
(hsize_t *) HDmalloc ((size_t) in->rank * sizeof(hsize_t))) == NULL)
{
- (void) fprintf(stderr, err1);
+ (void) fprintf(stderr, "%s", err1);
return (-1);
}
@@ -1806,7 +1806,7 @@ getDimensionSizes(struct Input *in, FILE **strm)
if (in->rank != i)
{
- (void) fprintf(stderr, err2);
+ (void) fprintf(stderr, "%s", err2);
return (-1);
}
return (0);
@@ -1825,7 +1825,7 @@ getChunkedDimensionSizes(struct Input *in, FILE **strm)
if ((in->sizeOfChunk =
(hsize_t *) HDmalloc ((size_t) in->rank * sizeof(hsize_t))) == NULL)
{
- (void) fprintf(stderr, err1);
+ (void) fprintf(stderr, "%s", err1);
return (-1);
}
@@ -1834,14 +1834,14 @@ getChunkedDimensionSizes(struct Input *in, FILE **strm)
if (in->rank != i)
{
- (void) fprintf(stderr, err2);
+ (void) fprintf(stderr, "%s", err2);
return (-1);
}
for (i=0; i<in->rank; i++)
if (in->sizeOfChunk[i] > in->sizeOfDimension[i])
{
- (void) fprintf(stderr, err3);
+ (void) fprintf(stderr, "%s", err3);
return (-1);
}
return (0);
@@ -1860,7 +1860,7 @@ getMaximumDimensionSizes(struct Input *in, FILE **strm)
if ((in->maxsizeOfDimension =
(hsize_t *) HDmalloc ((size_t) in->rank * sizeof(hsize_t))) == NULL)
{
- (void) fprintf(stderr, err1);
+ (void) fprintf(stderr, "%s", err1);
return (-1);
}
@@ -1874,7 +1874,7 @@ getMaximumDimensionSizes(struct Input *in, FILE **strm)
if (in->rank != i)
{
- (void) fprintf(stderr, err2);
+ (void) fprintf(stderr, "%s", err2);
return (-1);
}
@@ -1883,7 +1883,7 @@ getMaximumDimensionSizes(struct Input *in, FILE **strm)
if (in->maxsizeOfDimension[i] != H5S_UNLIMITED)
if (in->maxsizeOfDimension[i] < in->sizeOfDimension[i])
{
- (void) fprintf(stderr, err3);
+ (void) fprintf(stderr, "%s", err3);
return (-1);
}
}
@@ -1900,13 +1900,13 @@ getOutputArchitecture(struct Input *in, FILE** strm)
if (fscanf(*strm, "%s", temp) != 1)
{
- (void) fprintf(stderr, err1);
+ (void) fprintf(stderr, "%s", err1);
return (-1);
}
if ((kindex = OutputArchStrToInt(temp)) == -1)
{
- (void) fprintf(stderr, err2);
+ (void) fprintf(stderr, "%s", err2);
return (-1);
}
@@ -1943,13 +1943,13 @@ getOutputByteOrder(struct Input *in, FILE** strm)
if (fscanf(*strm, "%s", temp) != 1)
{
- (void) fprintf(stderr, err1);
+ (void) fprintf(stderr, "%s", err1);
return (-1);
}
if ((kindex = OutputByteOrderStrToInt(temp)) == -1)
{
- (void) fprintf(stderr, err2);
+ (void) fprintf(stderr, "%s", err2);
return (-1);
}
@@ -1980,13 +1980,13 @@ getCompressionType(struct Input *in, FILE** strm)
if (fscanf(*strm, "%s", temp) != 1)
{
- (void) fprintf(stderr, err1);
+ (void) fprintf(stderr, "%s", err1);
return (-1);
}
if ((kindex = CompressionTypeStrToInt(temp)) == -1)
{
- (void) fprintf(stderr, err2);
+ (void) fprintf(stderr, "%s", err2);
return (-1);
}
@@ -2027,20 +2027,20 @@ getCompressionParameter(struct Input *in, FILE** strm)
case 0: /* GZIP */
if (fscanf(*strm, "%d", (&ival)) != 1)
{
- (void) fprintf(stderr, err1);
+ (void) fprintf(stderr, "%s", err1);
return (-1);
}
if (ival <0 || ival > 9)
{
- (void) fprintf(stderr, err2);
+ (void) fprintf(stderr, "%s", err2);
return (-1);
}
in->compressionParam = ival;
return (0);
default:
- (void) fprintf(stderr, err3);
+ (void) fprintf(stderr, "%s", err3);
return (-1);
}
}
@@ -2053,7 +2053,7 @@ getExternalFilename(struct Input *in, FILE** strm)
if (fscanf(*strm, "%s", temp) != 1)
{
- (void) fprintf(stderr, err1);
+ (void) fprintf(stderr, "%s", err1);
return (-1);
}
@@ -2370,7 +2370,7 @@ createOutputDataType(struct Input *in)
break;
default:
- (void) fprintf(stderr, err1);
+ (void) fprintf(stderr, "%s", err1);
return (-1);
}
return new_type;
@@ -2447,7 +2447,7 @@ createInputDataType(struct Input *in)
break;
default:
- (void) fprintf(stderr, err1);
+ (void) fprintf(stderr, "%s", err1);
return (-1);
}
return new_type;
@@ -2555,7 +2555,7 @@ process(struct Options *opt)
/* creating the external file if it doesnt exist */
if ((extfile = HDfopen(in->externFilename, "ab")) == NULL)
{
- (void) fprintf(stderr, err4);
+ (void) fprintf(stderr, "%s", err4);
H5Pclose(proplist);
H5Sclose(dataspace);
H5Fclose(file_id);
@@ -2575,7 +2575,7 @@ process(struct Options *opt)
H5E_BEGIN_TRY {
/* create data set */
if((dataset = H5Dcreate2(handle, in->path.group[j], outtype, dataspace, H5P_DEFAULT, proplist, H5P_DEFAULT)) < 0) {
- (void)fprintf(stderr, err5);
+ (void)fprintf(stderr, "%s", err5);
H5Pclose(proplist);
H5Sclose(dataspace);
H5Fclose(file_id);
@@ -2587,7 +2587,7 @@ process(struct Options *opt)
/* write dataset */
if(H5Dwrite(dataset, intype, H5S_ALL, H5S_ALL, H5P_DEFAULT, (VOIDP)in->data) < 0) {
- (void) fprintf(stderr, err6);
+ (void) fprintf(stderr, "%s", err6);
H5Dclose(dataset);
H5Pclose(proplist);
H5Sclose(dataspace);
diff --git a/tools/h5import/h5importtest.c b/tools/h5import/h5importtest.c
index dd1a2be..9c839a3 100755
--- a/tools/h5import/h5importtest.c
+++ b/tools/h5import/h5importtest.c
@@ -370,6 +370,6 @@ main(void)
- return (0);
+ return (EXIT_SUCCESS);
}
diff --git a/tools/h5jam/Makefile.am b/tools/h5jam/Makefile.am
index d89a2d2..2f9bc00 100644
--- a/tools/h5jam/Makefile.am
+++ b/tools/h5jam/Makefile.am
@@ -28,8 +28,8 @@ check_PROGRAMS=tellub h5jamgentest getub
TEST_SCRIPT=testh5jam.sh
# Add h5jam and h5unjam specific linker flags here
-h5jam_LDFLAGS = $(LT_STATIC_EXEC)
-h5unjam_LDFLAGS = $(LT_STATIC_EXEC)
+h5jam_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+h5unjam_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
check_SCRIPTS=$(TEST_SCRIPT)
SCRIPT_DEPEND=h5jam$(EXEEXT) h5unjam$(EXEEXT)
diff --git a/tools/h5jam/Makefile.in b/tools/h5jam/Makefile.in
index 12486a0..5509801 100644
--- a/tools/h5jam/Makefile.in
+++ b/tools/h5jam/Makefile.in
@@ -117,6 +117,16 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = /home1/packages/automake/automake-1.9.6/bin/aclocal-1.9 -I /afs/ncsa/projects/hdf/packages/libtool_1.5.14/Linux_2.4/share/aclocal
ADD_PARALLEL_FILES = @ADD_PARALLEL_FILES@
AMTAR = @AMTAR@
+
+# H5_CFLAGS holds flags that should be used when building hdf5,
+# but which should not be exported to h5cc for building other programs.
+# AM_CFLAGS is an automake construct which should be used by Makefiles
+# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
+AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
+AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@
+AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
+AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@
+AM_LDFLAGS = @AM_LDFLAGS@
AM_MAKEFLAGS = @AM_MAKEFLAGS@
AR = @AR@
@@ -130,21 +140,18 @@ BYTESEX = @BYTESEX@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CC_VERSION = @CC_VERSION@
-
-# H5_CFLAGS holds flags that should be used as CFLAGS when building hdf5,
-# but which shouldn't be exported to h5cc for building other programs.
-CFLAGS = @CFLAGS@ @H5_CFLAGS@
+CFLAGS = @CFLAGS@
CLEARFILEBUF = @CLEARFILEBUF@
CODESTACK = @CODESTACK@
CONFIG_DATE = @CONFIG_DATE@
CONFIG_MODE = @CONFIG_MODE@
CONFIG_USER = @CONFIG_USER@
CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@ @H5_CPPFLAGS@
+CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@ @H5_CXXFLAGS@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_PKG = @DEBUG_PKG@
DEFAULT_API_VERSION = @DEFAULT_API_VERSION@
@@ -167,7 +174,7 @@ F9XMODEXT = @F9XMODEXT@
F9XMODFLAG = @F9XMODFLAG@
F9XSUFFIXFLAG = @F9XSUFFIXFLAG@
FC = @FC@
-FCFLAGS = @FCFLAGS@ @H5_FCFLAGS@
+FCFLAGS = @FCFLAGS@
FCFLAGS_f90 = @FCFLAGS_f90@
FCLIBS = @FCLIBS@
FGREP = @FGREP@
@@ -373,8 +380,8 @@ INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/tools/lib
TEST_SCRIPT = testh5jam.sh
# Add h5jam and h5unjam specific linker flags here
-h5jam_LDFLAGS = $(LT_STATIC_EXEC)
-h5unjam_LDFLAGS = $(LT_STATIC_EXEC)
+h5jam_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+h5unjam_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
check_SCRIPTS = $(TEST_SCRIPT)
SCRIPT_DEPEND = h5jam$(EXEEXT) h5unjam$(EXEEXT)
diff --git a/tools/h5ls/Makefile.am b/tools/h5ls/Makefile.am
index 64e89f1..41e66f6 100644
--- a/tools/h5ls/Makefile.am
+++ b/tools/h5ls/Makefile.am
@@ -32,7 +32,7 @@ SCRIPT_DEPEND=h5ls$(EXEEXT)
bin_PROGRAMS=h5ls
# Add h5ls specific linker flags here
-h5ls_LDFLAGS = $(LT_STATIC_EXEC)
+h5ls_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
# All programs depend on the hdf5 and h5tools libraries
LDADD=$(LIBH5TOOLS) $(LIBHDF5)
diff --git a/tools/h5ls/Makefile.in b/tools/h5ls/Makefile.in
index bace577..c11dc43 100644
--- a/tools/h5ls/Makefile.in
+++ b/tools/h5ls/Makefile.in
@@ -97,6 +97,16 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = /home1/packages/automake/automake-1.9.6/bin/aclocal-1.9 -I /afs/ncsa/projects/hdf/packages/libtool_1.5.14/Linux_2.4/share/aclocal
ADD_PARALLEL_FILES = @ADD_PARALLEL_FILES@
AMTAR = @AMTAR@
+
+# H5_CFLAGS holds flags that should be used when building hdf5,
+# but which should not be exported to h5cc for building other programs.
+# AM_CFLAGS is an automake construct which should be used by Makefiles
+# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
+AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
+AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@
+AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
+AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@
+AM_LDFLAGS = @AM_LDFLAGS@
AM_MAKEFLAGS = @AM_MAKEFLAGS@
AR = @AR@
@@ -110,21 +120,18 @@ BYTESEX = @BYTESEX@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CC_VERSION = @CC_VERSION@
-
-# H5_CFLAGS holds flags that should be used as CFLAGS when building hdf5,
-# but which shouldn't be exported to h5cc for building other programs.
-CFLAGS = @CFLAGS@ @H5_CFLAGS@
+CFLAGS = @CFLAGS@
CLEARFILEBUF = @CLEARFILEBUF@
CODESTACK = @CODESTACK@
CONFIG_DATE = @CONFIG_DATE@
CONFIG_MODE = @CONFIG_MODE@
CONFIG_USER = @CONFIG_USER@
CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@ @H5_CPPFLAGS@
+CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@ @H5_CXXFLAGS@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_PKG = @DEBUG_PKG@
DEFAULT_API_VERSION = @DEFAULT_API_VERSION@
@@ -147,7 +154,7 @@ F9XMODEXT = @F9XMODEXT@
F9XMODFLAG = @F9XMODFLAG@
F9XSUFFIXFLAG = @F9XSUFFIXFLAG@
FC = @FC@
-FCFLAGS = @FCFLAGS@ @H5_FCFLAGS@
+FCFLAGS = @FCFLAGS@
FCFLAGS_f90 = @FCFLAGS_f90@
FCLIBS = @FCLIBS@
FGREP = @FGREP@
@@ -354,7 +361,7 @@ check_SCRIPTS = $(TEST_SCRIPT)
SCRIPT_DEPEND = h5ls$(EXEEXT)
# Add h5ls specific linker flags here
-h5ls_LDFLAGS = $(LT_STATIC_EXEC)
+h5ls_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
# All programs depend on the hdf5 and h5tools libraries
LDADD = $(LIBH5TOOLS) $(LIBHDF5)
diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c
index ca0ddcb..9bc0448 100644
--- a/tools/h5ls/h5ls.c
+++ b/tools/h5ls/h5ls.c
@@ -1991,9 +1991,9 @@ done:
*
* Purpose: Begins iteration on an object
*
- * Return: Success: 0
+ * Return: Success: EXIT_SUCCESS(0)
*
- * Failure: -1
+ * Failure: EXIT_FAILURE(1)
*
* Programmer: Neil Fortner
* Wednesday, August 21, 2008
@@ -2109,15 +2109,12 @@ get_width(void)
width = w[0];
}
#elif defined(H5_HAVE_TIOCGWINSZ) && defined(H5_HAVE_IOCTL)
-#ifndef __PUMAGON__
-/* the ioctl() call coredump on TFLOPS. Turn it off for now. */
{
/* Unix with ioctl(TIOCGWINSZ) */
struct winsize w;
if (ioctl(2, TIOCGWINSZ, &w)>=0 && w.ws_col>0)
width = w.ws_col;
}
-#endif
#elif defined(H5_HAVE_TIOCGETD) && defined(H5_HAVE_IOCTL)
{
/* Unix with ioctl(TIOCGETD) */
@@ -2203,7 +2200,7 @@ main(int argc, const char *argv[])
break;
} else if(!HDstrcmp(argv[argno], "--help")) {
usage();
- leave(0);
+ leave(EXIT_SUCCESS);
} else if(!HDstrcmp(argv[argno], "--address")) {
address_g = TRUE;
} else if(!HDstrcmp(argv[argno], "--data")) {
@@ -2234,25 +2231,25 @@ main(int argc, const char *argv[])
no_line_wrap_g = TRUE;
else if(width_g < 0 || *rest) {
usage();
- leave(1);
+ leave(EXIT_FAILURE);
}
} else if(!HDstrcmp(argv[argno], "--width")) {
if((argno + 1) >= argc) {
usage();
- leave(1);
+ leave(EXIT_FAILURE);
} else {
s = argv[++argno];
}
width_g = (int)HDstrtol(s, &rest, 0);
if(width_g <= 0 || *rest) {
usage();
- leave(1);
+ leave(EXIT_FAILURE);
}
} else if(!HDstrcmp(argv[argno], "--verbose")) {
verbose_g++;
} else if(!HDstrcmp(argv[argno], "--version")) {
print_version(progname);
- leave(0);
+ leave(EXIT_SUCCESS);
} else if(!HDstrcmp(argv[argno], "--hexdump")) {
hexdump_g = TRUE;
} else if(!HDstrncmp(argv[argno], "-w", 2)) {
@@ -2260,7 +2257,7 @@ main(int argc, const char *argv[])
s = argv[argno] + 2;
} else if((argno + 1) >= argc) {
usage();
- leave(1);
+ leave(EXIT_FAILURE);
} else {
s = argv[++argno];
}
@@ -2270,7 +2267,7 @@ main(int argc, const char *argv[])
no_line_wrap_g = TRUE;
else if(width_g < 0 || *rest) {
usage();
- leave(1);
+ leave(EXIT_FAILURE);
}
} else if('-'!=argv[argno][1]) {
/* Single-letter switches */
@@ -2279,7 +2276,7 @@ main(int argc, const char *argv[])
case '?':
case 'h': /* --help */
usage();
- leave(0);
+ leave(EXIT_SUCCESS);
case 'a': /* --address */
address_g = TRUE;
@@ -2328,7 +2325,7 @@ main(int argc, const char *argv[])
case 'V': /* --version */
print_version(progname);
- leave(0);
+ leave(EXIT_SUCCESS);
case 'x': /* --hexdump */
hexdump_g = TRUE;
@@ -2336,12 +2333,12 @@ main(int argc, const char *argv[])
default:
usage();
- leave(1);
+ leave(EXIT_FAILURE);
} /* end switch */
} /* end for */
} else {
usage();
- leave(1);
+ leave(EXIT_FAILURE);
}
} /* end for */
@@ -2349,14 +2346,14 @@ main(int argc, const char *argv[])
* absolutely nothing ;-) */
if(argno >= argc) {
usage();
- leave(1);
+ leave(EXIT_FAILURE);
} /* end if */
/* Check for conflicting arguments */
if(recursive_g && grp_literal_g) {
fprintf(stderr, "Error: 'recursive' option not compatible with 'group info' option!\n\n");
usage();
- leave(1);
+ leave(EXIT_FAILURE);
} /* end if */
/* Turn off HDF5's automatic error printing unless you're debugging h5ls */
@@ -2419,7 +2416,7 @@ main(int argc, const char *argv[])
x = oname;
if(NULL == (oname = HDstrdup(oname))) {
fprintf(stderr, "memory allocation failed\n");
- leave(1);
+ leave(EXIT_FAILURE);
}
*x = '\0';
/* Delay specifying the name start point so the original object name
@@ -2452,7 +2449,7 @@ main(int argc, const char *argv[])
/* Check the type of link given */
if(H5Lget_info(file, oname, &li, H5P_DEFAULT) < 0) {
display_obj_name(stdout, &iter, oname, "**NOT FOUND**");
- leave(1);
+ leave(EXIT_FAILURE);
} /* end if */
} /* end if */
else
@@ -2461,7 +2458,7 @@ main(int argc, const char *argv[])
/* Open the object and display it's information */
if(li.type == H5L_TYPE_HARD) {
if(visit_obj(file, oname, &iter) < 0)
- leave(1);
+ leave(EXIT_FAILURE);
} /* end if(li.type == H5L_TYPE_HARD) */
else {
/* Specified name is not for object -- list that link */
@@ -2481,6 +2478,6 @@ main(int argc, const char *argv[])
HDfree(elink_list.objs);
} /* end while */
- leave(0);
+ leave(EXIT_SUCCESS);
} /* end main() */
diff --git a/tools/h5repack/Makefile.am b/tools/h5repack/Makefile.am
index 1f811f0..96f0082 100644
--- a/tools/h5repack/Makefile.am
+++ b/tools/h5repack/Makefile.am
@@ -37,7 +37,7 @@ SCRIPT_DEPEND=h5repack$(EXEEXT)
bin_PROGRAMS=h5repack
# Add h5repack specific linker flags here
-h5repack_LDFLAGS = $(LT_STATIC_EXEC)
+h5repack_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
# Depend on the hdf5 library, the tools library, the test library
LDADD=$(LIBH5TOOLS) $(LIBH5TEST) $(LIBHDF5)
diff --git a/tools/h5repack/Makefile.in b/tools/h5repack/Makefile.in
index 656cfa6..dd33879 100644
--- a/tools/h5repack/Makefile.in
+++ b/tools/h5repack/Makefile.in
@@ -117,6 +117,16 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = /home1/packages/automake/automake-1.9.6/bin/aclocal-1.9 -I /afs/ncsa/projects/hdf/packages/libtool_1.5.14/Linux_2.4/share/aclocal
ADD_PARALLEL_FILES = @ADD_PARALLEL_FILES@
AMTAR = @AMTAR@
+
+# H5_CFLAGS holds flags that should be used when building hdf5,
+# but which should not be exported to h5cc for building other programs.
+# AM_CFLAGS is an automake construct which should be used by Makefiles
+# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
+AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
+AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@
+AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
+AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@
+AM_LDFLAGS = @AM_LDFLAGS@
AM_MAKEFLAGS = @AM_MAKEFLAGS@
AR = @AR@
@@ -130,21 +140,18 @@ BYTESEX = @BYTESEX@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CC_VERSION = @CC_VERSION@
-
-# H5_CFLAGS holds flags that should be used as CFLAGS when building hdf5,
-# but which shouldn't be exported to h5cc for building other programs.
-CFLAGS = @CFLAGS@ @H5_CFLAGS@
+CFLAGS = @CFLAGS@
CLEARFILEBUF = @CLEARFILEBUF@
CODESTACK = @CODESTACK@
CONFIG_DATE = @CONFIG_DATE@
CONFIG_MODE = @CONFIG_MODE@
CONFIG_USER = @CONFIG_USER@
CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@ @H5_CPPFLAGS@
+CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@ @H5_CXXFLAGS@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_PKG = @DEBUG_PKG@
DEFAULT_API_VERSION = @DEFAULT_API_VERSION@
@@ -167,7 +174,7 @@ F9XMODEXT = @F9XMODEXT@
F9XMODFLAG = @F9XMODFLAG@
F9XSUFFIXFLAG = @F9XSUFFIXFLAG@
FC = @FC@
-FCFLAGS = @FCFLAGS@ @H5_FCFLAGS@
+FCFLAGS = @FCFLAGS@
FCFLAGS_f90 = @FCFLAGS_f90@
FCLIBS = @FCLIBS@
FGREP = @FGREP@
@@ -378,7 +385,7 @@ check_SCRIPTS = $(TEST_SCRIPT)
SCRIPT_DEPEND = h5repack$(EXEEXT)
# Add h5repack specific linker flags here
-h5repack_LDFLAGS = $(LT_STATIC_EXEC)
+h5repack_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
# Depend on the hdf5 library, the tools library, the test library
LDADD = $(LIBH5TOOLS) $(LIBH5TEST) $(LIBHDF5)
diff --git a/tools/h5repack/h5repack.c b/tools/h5repack/h5repack.c
index d0a7a7d..c8a3abe 100644
--- a/tools/h5repack/h5repack.c
+++ b/tools/h5repack/h5repack.c
@@ -90,13 +90,15 @@ int h5repack(const char* infile,
*-------------------------------------------------------------------------
*/
-int h5repack_init (pack_opt_t *options, int verbose, int latest)
+int
+h5repack_init(pack_opt_t *options, int verbose, int latest,
+ H5F_file_space_type_t strategy, hsize_t threshold)
{
int k, n;
memset(options,0,sizeof(pack_opt_t));
options->min_comp = 1024;
options->verbose = verbose;
- options->latest = latest ;
+ options->latest = latest;
for ( n = 0; n < H5_REPACK_MAX_NFILTERS; n++)
{
@@ -106,6 +108,9 @@ int h5repack_init (pack_opt_t *options, int verbose, int latest)
options->filter_g[n].cd_values[k] = 0;
}
+ options->fs_strategy = strategy;
+ options->fs_threshold = threshold;
+
return (options_table_init(&(options->op_tbl)));
}
@@ -649,7 +654,7 @@ static const char* get_sfilter(H5Z_filter_t filtn)
return "SOFF";
else {
error_msg(progname, "input error in filter type\n");
- exit(1);
+ exit(EXIT_FAILURE);
}
}
diff --git a/tools/h5repack/h5repack.h b/tools/h5repack/h5repack.h
index feabeaa..38ce9e4 100644
--- a/tools/h5repack/h5repack.h
+++ b/tools/h5repack/h5repack.h
@@ -112,6 +112,8 @@ typedef struct {
hsize_t ublock_size; /* user block size */
hsize_t threshold; /* alignment threshold for H5Pset_alignment */
hsize_t alignment ; /* alignment for H5Pset_alignment */
+ H5F_file_space_type_t fs_strategy; /* File space handling strategy */
+ hsize_t fs_threshold; /* Free space section threshold */
} pack_opt_t;
@@ -125,14 +127,14 @@ typedef struct {
extern "C" {
#endif
-int h5repack (const char* infile, const char* outfile, pack_opt_t *options);
-int h5repack_addfilter (const char* str, pack_opt_t *options);
-int h5repack_addlayout (const char* str, pack_opt_t *options);
-int h5repack_init (pack_opt_t *options, int verbose, int latest);
-int h5repack_end (pack_opt_t *options);
-int h5repack_verify (const char *fname,pack_opt_t *options);
-int h5repack_cmp_pl (const char *fname1,
- const char *fname2);
+int h5repack(const char* infile, const char* outfile, pack_opt_t *options);
+int h5repack_addfilter(const char* str, pack_opt_t *options);
+int h5repack_addlayout(const char* str, pack_opt_t *options);
+int h5repack_init(pack_opt_t *options, int verbose, int latest,
+ H5F_file_space_type_t strategy, hsize_t threshold);
+int h5repack_end(pack_opt_t *options);
+int h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options);
+int h5repack_cmp_pl(const char *fname1, const char *fname2);
#ifdef __cplusplus
diff --git a/tools/h5repack/h5repack.sh.in b/tools/h5repack/h5repack.sh.in
index 01c33ef..e9aae81 100755
--- a/tools/h5repack/h5repack.sh.in
+++ b/tools/h5repack/h5repack.sh.in
@@ -96,11 +96,7 @@ SKIP() {
DIFFTEST()
{
VERIFY $@
- if [ "`uname -s`" = "TFLOPS O/S" ]; then
- $RUNSERIAL $H5DIFF_BIN -q $@
- else
- $RUNSERIAL $H5DIFF_BIN -q "$@"
- fi
+ $RUNSERIAL $H5DIFF_BIN -q "$@"
RET=$?
if [ $RET != 0 ] ; then
echo "*FAILED*"
@@ -116,27 +112,20 @@ DIFFTEST()
TOOLTEST()
{
# Run test.
- # Tflops interprets "$@" as "" when no parameter is given (e.g., the
- # case of missing file name). Changed it to use $@ till Tflops fixes it.
TESTING $H5REPACK $@
infile=$srcdir/testfiles/$1
path=`pwd`
outfile=$path/out.$1
shift
- if [ "`uname -s`" = "TFLOPS O/S" ]; then
- $RUNSERIAL $H5REPACK_BIN $@ $infile $outfile
- else
- $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile
- fi
-
+ $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile
RET=$?
if [ $RET != 0 ] ; then
- echo "*FAILED*"
- nerrors="`expr $nerrors + 1`"
+ echo "*FAILED*"
+ nerrors="`expr $nerrors + 1`"
else
- echo " PASSED"
- DIFFTEST $infile $outfile
+ echo " PASSED"
+ DIFFTEST $infile $outfile
fi
rm -f $outfile
}
@@ -146,27 +135,20 @@ TOOLTEST()
TOOLTEST0()
{
# Run test.
- # Tflops interprets "$@" as "" when no parameter is given (e.g., the
- # case of missing file name). Changed it to use $@ till Tflops fixes it.
TESTING $H5REPACK $@
infile=$srcdir/testfiles/$1
path=`pwd`
outfile=$path/out.$1
shift
- if [ "`uname -s`" = "TFLOPS O/S" ]; then
- $RUNSERIAL $H5REPACK_BIN -i $infile -o $outfile $@
- else
- $RUNSERIAL $H5REPACK_BIN -i $infile -o $outfile "$@"
- fi
-
+ $RUNSERIAL $H5REPACK_BIN -i $infile -o $outfile "$@"
RET=$?
if [ $RET != 0 ] ; then
- echo "*FAILED*"
- nerrors="`expr $nerrors + 1`"
+ echo "*FAILED*"
+ nerrors="`expr $nerrors + 1`"
else
- echo " PASSED"
- DIFFTEST $infile $outfile
+ echo " PASSED"
+ DIFFTEST $infile $outfile
fi
rm -f $outfile
}
@@ -178,27 +160,20 @@ TOOLTEST0()
TOOLTEST1()
{
# Run test.
- # Tflops interprets "$@" as "" when no parameter is given (e.g., the
- # case of missing file name). Changed it to use $@ till Tflops fixes it.
TESTING $H5REPACK $@
infile=$srcdir/../testfiles/$1
path=`pwd`
outfile=$path/out.$1
shift
- if [ "`uname -s`" = "TFLOPS O/S" ]; then
- $RUNSERIAL $H5REPACK_BIN $@ $infile $outfile
- else
- $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile
- fi
-
+ $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile
RET=$?
if [ $RET != 0 ] ; then
- echo "*FAILED*"
- nerrors="`expr $nerrors + 1`"
+ echo "*FAILED*"
+ nerrors="`expr $nerrors + 1`"
else
- echo " PASSED"
- DIFFTEST $infile $outfile
+ echo " PASSED"
+ DIFFTEST $infile $outfile
fi
rm -f $outfile
}
diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c
index 0fb8fc8..77c03d2 100644
--- a/tools/h5repack/h5repack_copy.c
+++ b/tools/h5repack/h5repack_copy.c
@@ -104,7 +104,7 @@ int copy_objects(const char* fnamein,
goto out;
}
- /* get user block size */
+ /* get user block size and file space strategy/threshold */
{
hid_t fcpl_in; /* file creation property list ID for input file */
@@ -120,6 +120,24 @@ int copy_objects(const char* fnamein,
goto out;
}
+ if(!options->fs_strategy)
+ {
+ if(H5Pget_file_space(fcpl_in, &options->fs_strategy, NULL) < 0)
+ {
+ error_msg(progname, "failed to retrieve file space strategy\n");
+ goto out;
+ }
+ }
+
+ if(!options->fs_threshold)
+ {
+ if(H5Pget_file_space(fcpl_in, NULL, &options->fs_threshold) < 0)
+ {
+ error_msg(progname, "failed to retrieve file space threshold\n");
+ goto out;
+ }
+ }
+
if(H5Pclose(fcpl_in) < 0)
{
error_msg(progname, "failed to close property list\n");
@@ -316,6 +334,32 @@ int copy_objects(const char* fnamein,
}
+ /* either use the FCPL already created or create a new one */
+ if(fcpl != H5P_DEFAULT)
+ {
+ /* set file space strategy and free space threshold */
+ if(H5Pset_file_space(fcpl, options->fs_strategy, options->fs_threshold) < 0)
+ {
+ error_msg(progname, "failed to set file space strategy & threshold\n");
+ goto out;
+ }
+ }
+ else
+ {
+ /* create a file creation property list */
+ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ {
+ error_msg(progname, "fail to create a file creation property list\n");
+ goto out;
+ }
+
+ /* set file space strategy and free space threshold */
+ if(H5Pset_file_space(fcpl, options->fs_strategy, options->fs_threshold) < 0)
+ {
+ error_msg(progname, "failed to set file space strategy & threshold \n");
+ goto out;
+ }
+ }
/*-------------------------------------------------------------------------
* create the output file
diff --git a/tools/h5repack/h5repack_main.c b/tools/h5repack/h5repack_main.c
index d2aed2b..acbd8ee 100644
--- a/tools/h5repack/h5repack_main.c
+++ b/tools/h5repack/h5repack_main.c
@@ -38,7 +38,7 @@ const char *outfile = NULL;
* Command-line options: The user can specify short or long-named
* parameters.
*/
-static const char *s_opts = "hVvf:l:m:e:nLc:d:s:u:b:t:a:i:o:";
+static const char *s_opts = "hVvf:l:m:e:nLc:d:s:u:b:t:a:i:o:S:T:";
static struct long_options l_opts[] = {
{ "help", no_arg, 'h' },
{ "version", no_arg, 'V' },
@@ -58,6 +58,8 @@ static struct long_options l_opts[] = {
{ "alignment", require_arg, 'a' },
{ "infile", require_arg, 'i' }, /* -i for backward compability */
{ "outfile", require_arg, 'o' }, /* -o for backward compability */
+ { "fs_strategy", require_arg, 'S' },
+ { "fs_threshold", require_arg, 'T' },
{ NULL, 0, '\0' }
};
@@ -69,7 +71,9 @@ static struct long_options l_opts[] = {
*
* Purpose: h5repack main program
*
- * Return: 1, error, 0, no error
+ * Return: Success: EXIT_SUCCESS(0)
+ *
+ * Failure: EXIT_FAILURE(1)
*
* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
*
@@ -104,7 +108,7 @@ int main(int argc, const char **argv)
int ret=-1;
/* initialize options */
- h5repack_init (&options,0, 0);
+ h5repack_init (&options, 0, 0, 0, (hsize_t)0);
parse_command_line(argc, argv, &options);
@@ -180,63 +184,77 @@ static void usage(const char *prog)
printf(" -a A, --alignment=A Alignment value for H5Pset_alignment\n");
printf(" -f FILT, --filter=FILT Filter type\n");
printf(" -l LAYT, --layout=LAYT Layout type\n");
+ printf(" -S FS_STRGY, --fs_strategy=FS_STRGY File space management strategy\n");
+ printf(" -T FS_THRD, --fs_threshold=FS_THRD Free-space section threshold\n");
printf("\n");
- printf(" M - is an integer greater than 1, size of dataset in bytes (default is 1024) \n");
- printf(" E - is a filename.\n");
- printf(" S - is an integer\n");
- printf(" U - is a filename.\n");
- printf(" T - is an integer\n");
- printf(" A - is an integer greater than zero\n");
- printf(" B - is the user block size, any value that is 512 or greater and is\n");
+ printf(" M - is an integer greater than 1, size of dataset in bytes (default is 1024) \n");
+ printf(" E - is a filename.\n");
+ printf(" S - is an integer\n");
+ printf(" U - is a filename.\n");
+ printf(" T - is an integer\n");
+ printf(" A - is an integer greater than zero\n");
+ printf(" B - is the user block size, any value that is 512 or greater and is\n");
printf(" a power of 2 (1024 default)\n");
- printf(" F - is the shared object header message type, any of <dspace|dtype|fill|\n");
+ printf(" F - is the shared object header message type, any of <dspace|dtype|fill|\n");
printf(" pline|attr>. If F is not specified, S applies to all messages\n");
-
+ printf("\n");
+ printf(" FS_STRGY is the file space management strategy to use for the output file.\n");
+ printf(" It is a string as listed below:\n");
+ printf(" ALL_PERSIST - Use persistent free-space managers, aggregators and virtual file driver\n");
+ printf(" for file space allocation\n");
+ printf(" ALL - Use non-persistent free-space managers, aggregators and virtual file driver\n");
+ printf(" for file space allocation\n");
+ printf(" AGGR_VFD - Use aggregators and virtual file driver for file space allocation\n");
+ printf(" VFD - Use virtual file driver for file space allocation\n");
+ printf("\n");
+ printf(" FS_THRD is the free-space section threshold to use for the output file.\n");
+ printf(" It is the minimum size (in bytes) of free-space sections to be tracked\n");
+ printf(" by the the library's free-space managers.\n");
printf("\n");
- printf(" FILT - is a string with the format:\n");
+ printf(" FILT - is a string with the format:\n");
printf("\n");
- printf(" <list of objects>:<name of filter>=<filter parameters>\n");
+ printf(" <list of objects>:<name of filter>=<filter parameters>\n");
printf("\n");
- printf(" <list of objects> is a comma separated list of object names, meaning apply\n");
- printf(" compression only to those objects. If no names are specified, the filter\n");
- printf(" is applied to all objects\n");
- printf(" <name of filter> can be:\n");
- printf(" GZIP, to apply the HDF5 GZIP filter (GZIP compression)\n");
- printf(" SZIP, to apply the HDF5 SZIP filter (SZIP compression)\n");
- printf(" SHUF, to apply the HDF5 shuffle filter\n");
- printf(" FLET, to apply the HDF5 checksum filter\n");
- printf(" NBIT, to apply the HDF5 NBIT filter (NBIT compression)\n");
- printf(" SOFF, to apply the HDF5 Scale/Offset filter\n");
- printf(" NONE, to remove all filters\n");
- printf(" <filter parameters> is optional filter parameter information\n");
- printf(" GZIP=<deflation level> from 1-9\n");
- printf(" SZIP=<pixels per block,coding> pixels per block is a even number in\n");
+ printf(" <list of objects> is a comma separated list of object names, meaning apply\n");
+ printf(" compression only to those objects. If no names are specified, the filter\n");
+ printf(" is applied to all objects\n");
+ printf(" <name of filter> can be:\n");
+ printf(" GZIP, to apply the HDF5 GZIP filter (GZIP compression)\n");
+ printf(" SZIP, to apply the HDF5 SZIP filter (SZIP compression)\n");
+ printf(" SHUF, to apply the HDF5 shuffle filter\n");
+ printf(" FLET, to apply the HDF5 checksum filter\n");
+ printf(" NBIT, to apply the HDF5 NBIT filter (NBIT compression)\n");
+ printf(" SOFF, to apply the HDF5 Scale/Offset filter\n");
+ printf(" NONE, to remove all filters\n");
+ printf(" <filter parameters> is optional filter parameter information\n");
+ printf(" GZIP=<deflation level> from 1-9\n");
+ printf(" SZIP=<pixels per block,coding> pixels per block is a even number in\n");
printf(" 2-32 and coding method is either EC or NN\n");
- printf(" SHUF (no parameter)\n");
- printf(" FLET (no parameter)\n");
- printf(" NBIT (no parameter)\n");
- printf(" SOFF=<scale_factor,scale_type> scale_factor is an integer and scale_type\n");
+ printf(" SHUF (no parameter)\n");
+ printf(" FLET (no parameter)\n");
+ printf(" NBIT (no parameter)\n");
+ printf(" SOFF=<scale_factor,scale_type> scale_factor is an integer and scale_type\n");
printf(" is either IN or DS\n");
- printf(" NONE (no parameter)\n");
+ printf(" NONE (no parameter)\n");
printf("\n");
- printf(" LAYT - is a string with the format:\n");
+ printf(" LAYT - is a string with the format:\n");
printf("\n");
- printf(" <list of objects>:<layout type>=<layout parameters>\n");
+ printf(" <list of objects>:<layout type>=<layout parameters>\n");
printf("\n");
- printf(" <list of objects> is a comma separated list of object names, meaning that\n");
- printf(" layout information is supplied for those objects. If no names are\n");
- printf(" specified, the layout type is applied to all objects\n");
- printf(" <layout type> can be:\n");
- printf(" CHUNK, to apply chunking layout\n");
- printf(" COMPA, to apply compact layout\n");
- printf(" CONTI, to apply continuous layout\n");
- printf(" <layout parameters> is optional layout information\n");
- printf(" CHUNK=DIM[xDIM...xDIM], the chunk size of each dimension\n");
- printf(" COMPA (no parameter)\n");
- printf(" CONTI (no parameter)\n");
+ printf(" <list of objects> is a comma separated list of object names, meaning that\n");
+ printf(" layout information is supplied for those objects. If no names are\n");
+ printf(" specified, the layout type is applied to all objects\n");
+ printf(" <layout type> can be:\n");
+ printf(" CHUNK, to apply chunking layout\n");
+ printf(" COMPA, to apply compact layout\n");
+ printf(" CONTI, to apply continuous layout\n");
+ printf(" <layout parameters> is optional layout information\n");
+ printf(" CHUNK=DIM[xDIM...xDIM], the chunk size of each dimension\n");
+ printf(" COMPA (no parameter)\n");
+ printf(" CONTI (no parameter)\n");
printf("\n");
printf("Examples of use:\n");
printf("\n");
@@ -429,6 +447,30 @@ void parse_command_line(int argc, const char **argv, pack_opt_t* options)
}
break;
+ case 'S':
+ {
+ char strategy[MAX_NC_NAME];
+
+ strcpy(strategy, opt_arg);
+ if(!strcmp(strategy, "ALL_PERSIST"))
+ options->fs_strategy = H5F_FILE_SPACE_ALL_PERSIST;
+ else if(!strcmp(strategy, "ALL"))
+ options->fs_strategy = H5F_FILE_SPACE_ALL;
+ else if(!strcmp(strategy, "AGGR_VFD"))
+ options->fs_strategy = H5F_FILE_SPACE_AGGR_VFD;
+ else if(!strcmp(strategy, "VFD"))
+ options->fs_strategy = H5F_FILE_SPACE_VFD;
+ else {
+ error_msg(progname, "invalid file space management strategy\n", opt_arg );
+ exit(EXIT_FAILURE);
+ }
+ break;
+ }
+
+ case 'T':
+
+ options->fs_threshold = (hsize_t)atol( opt_arg );
+ break;
} /* switch */
@@ -484,7 +526,7 @@ void read_info(const char *filename,
if ((fp = fopen(data_file, "r")) == (FILE *)NULL) {
error_msg(progname, "cannot open options file %s\n", filename);
- exit(1);
+ exit(EXIT_FAILURE);
}
/* cycle until end of file reached */
@@ -521,7 +563,7 @@ void read_info(const char *filename,
if (h5repack_addfilter(comp_info,options)==-1){
error_msg(progname, "could not add compression option\n");
- exit(1);
+ exit(EXIT_FAILURE);
}
}
/*-------------------------------------------------------------------------
@@ -551,7 +593,7 @@ void read_info(const char *filename,
if (h5repack_addlayout(comp_info,options)==-1){
error_msg(progname, "could not add chunck option\n");
- exit(1);
+ exit(EXIT_FAILURE);
}
}
/*-------------------------------------------------------------------------
@@ -560,7 +602,7 @@ void read_info(const char *filename,
*/
else {
error_msg(progname, "bad file format for %s", filename);
- exit(1);
+ exit(EXIT_FAILURE);
}
}
diff --git a/tools/h5repack/h5repack_opttable.c b/tools/h5repack/h5repack_opttable.c
index 8572837..5b6d5d0 100644
--- a/tools/h5repack/h5repack_opttable.c
+++ b/tools/h5repack/h5repack_opttable.c
@@ -231,7 +231,7 @@ int options_add_layout( obj_list_t *obj_list,
if (table->objs[i].chunk.rank>0)
{
error_msg(progname, "chunk information already inserted for <%s>\n",obj_list[j].obj);
- exit(1);
+ exit(EXIT_FAILURE);
}
/* insert the layout info */
else
diff --git a/tools/h5repack/h5repack_parse.c b/tools/h5repack/h5repack_parse.c
index 154d6e5..15dc812 100644
--- a/tools/h5repack/h5repack_parse.c
+++ b/tools/h5repack/h5repack_parse.c
@@ -122,7 +122,7 @@ obj_list_t* parse_filter(const char *str,
{
if (obj_list) free(obj_list);
error_msg(progname, "input Error: Invalid compression type in <%s>\n",str);
- exit(1);
+ exit(EXIT_FAILURE);
}
@@ -160,7 +160,7 @@ obj_list_t* parse_filter(const char *str,
if (!isdigit(c) && l==-1){
if (obj_list) free(obj_list);
error_msg(progname, "compression parameter not digit in <%s>\n",str);
- exit(1);
+ exit(EXIT_FAILURE);
}
if (l==-1)
stype[m]=c;
@@ -180,7 +180,7 @@ obj_list_t* parse_filter(const char *str,
else
{
error_msg(progname, "szip mask must be 'NN' or 'EC' \n");
- exit(1);
+ exit(EXIT_FAILURE);
}
@@ -220,7 +220,7 @@ obj_list_t* parse_filter(const char *str,
if (!isdigit(c) && l==-1){
if (obj_list) free(obj_list);
error_msg(progname, "compression parameter is not a digit in <%s>\n",str);
- exit(1);
+ exit(EXIT_FAILURE);
}
if (l==-1)
stype[m]=c;
@@ -240,7 +240,7 @@ obj_list_t* parse_filter(const char *str,
else
{
error_msg(progname, "scale type must be 'IN' or 'DS' \n");
- exit(1);
+ exit(EXIT_FAILURE);
}
}
@@ -264,7 +264,7 @@ obj_list_t* parse_filter(const char *str,
if (!isdigit(c)){
if (obj_list) free(obj_list);
error_msg(progname, "compression parameter is not a digit in <%s>\n",str);
- exit(1);
+ exit(EXIT_FAILURE);
}
stype[m]=c;
} /* u */
@@ -310,7 +310,7 @@ obj_list_t* parse_filter(const char *str,
{ /*no more parameters, GZIP must have parameter */
if (obj_list) free(obj_list);
error_msg(progname, "missing compression parameter in <%s>\n",str);
- exit(1);
+ exit(EXIT_FAILURE);
}
}
@@ -326,7 +326,7 @@ obj_list_t* parse_filter(const char *str,
{ /*no more parameters, SZIP must have parameter */
if (obj_list) free(obj_list);
error_msg(progname, "missing compression parameter in <%s>\n",str);
- exit(1);
+ exit(EXIT_FAILURE);
}
}
@@ -342,7 +342,7 @@ obj_list_t* parse_filter(const char *str,
{ /*shuffle does not have parameter */
if (obj_list) free(obj_list);
error_msg(progname, "extra parameter in SHUF <%s>\n",str);
- exit(1);
+ exit(EXIT_FAILURE);
}
}
/*-------------------------------------------------------------------------
@@ -357,7 +357,7 @@ obj_list_t* parse_filter(const char *str,
{ /*shuffle does not have parameter */
if (obj_list) free(obj_list);
error_msg(progname, "extra parameter in FLET <%s>\n",str);
- exit(1);
+ exit(EXIT_FAILURE);
}
}
/*-------------------------------------------------------------------------
@@ -372,7 +372,7 @@ obj_list_t* parse_filter(const char *str,
{ /*nbit does not have parameter */
if (obj_list) free(obj_list);
error_msg(progname, "extra parameter in NBIT <%s>\n",str);
- exit(1);
+ exit(EXIT_FAILURE);
}
}
/*-------------------------------------------------------------------------
@@ -387,13 +387,13 @@ obj_list_t* parse_filter(const char *str,
{ /*no more parameters, SOFF must have parameter */
if (obj_list) free(obj_list);
error_msg(progname, "missing compression parameter in <%s>\n",str);
- exit(1);
+ exit(EXIT_FAILURE);
}
}
else {
if (obj_list) free(obj_list);
error_msg(progname, "invalid filter type in <%s>\n",str);
- exit(1);
+ exit(EXIT_FAILURE);
}
}
} /*i*/
@@ -416,7 +416,7 @@ obj_list_t* parse_filter(const char *str,
{
if (obj_list) free(obj_list);
error_msg(progname, "invalid compression parameter in <%s>\n",str);
- exit(1);
+ exit(EXIT_FAILURE);
}
break;
@@ -431,19 +431,19 @@ obj_list_t* parse_filter(const char *str,
{
if (obj_list) free(obj_list);
error_msg(progname, "pixels_per_block is not even in <%s>\n",str);
- exit(1);
+ exit(EXIT_FAILURE);
}
if (pixels_per_block>H5_SZIP_MAX_PIXELS_PER_BLOCK)
{
if (obj_list) free(obj_list);
error_msg(progname, "pixels_per_block is too large in <%s>\n",str);
- exit(1);
+ exit(EXIT_FAILURE);
}
if ( (strcmp(smask,"NN")!=0) && (strcmp(smask,"EC")!=0) )
{
if (obj_list) free(obj_list);
error_msg(progname, "szip mask must be 'NN' or 'EC' \n");
- exit(1);
+ exit(EXIT_FAILURE);
}
break;
default:
@@ -544,7 +544,7 @@ obj_list_t* parse_layout(const char *str,
{
if (obj_list) free(obj_list);
error_msg(progname, "in parse layout, no characters after : in <%s>\n",str);
- exit(1);
+ exit(EXIT_FAILURE);
}
/* get layout info */
@@ -561,7 +561,7 @@ obj_list_t* parse_layout(const char *str,
pack->layout=H5D_CHUNKED;
else {
error_msg(progname, "in parse layout, not a valid layout in <%s>\n",str);
- exit(1);
+ exit(EXIT_FAILURE);
}
}
else
@@ -585,7 +585,7 @@ obj_list_t* parse_layout(const char *str,
{
if (obj_list) free(obj_list);
error_msg(progname, "in parse layout, <%s> Chunk dimensions missing\n",str);
- exit(1);
+ exit(EXIT_FAILURE);
}
for ( i=j, c_index=0; i<len; i++)
@@ -600,7 +600,7 @@ obj_list_t* parse_layout(const char *str,
if (obj_list) free(obj_list);
error_msg(progname, "in parse layout, <%s> Not a valid character in <%s>\n",
sdim,str);
- exit(1);
+ exit(EXIT_FAILURE);
}
if ( c=='x' || i==len-1)
@@ -613,7 +613,7 @@ obj_list_t* parse_layout(const char *str,
if (obj_list) free(obj_list);
error_msg(progname, "in parse layout, <%s> conversion to number in <%s>\n",
sdim,str);
- exit(1);
+ exit(EXIT_FAILURE);
}
c_index++;
}
@@ -631,7 +631,7 @@ obj_list_t* parse_layout(const char *str,
if (obj_list) free(obj_list);
error_msg(progname, "in parse layout, <%s> conversion to number in <%s>\n",
sdim,str);
- exit(1);
+ exit(EXIT_FAILURE);
}
pack->chunk.rank=c_index+1;
}
diff --git a/tools/h5repack/h5repack_verify.c b/tools/h5repack/h5repack_verify.c
index 69df02c..fe94148 100644
--- a/tools/h5repack/h5repack_verify.c
+++ b/tools/h5repack/h5repack_verify.c
@@ -44,20 +44,25 @@ static int verify_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *fil
*-------------------------------------------------------------------------
*/
-int h5repack_verify(const char *fname,
- pack_opt_t *options)
+int
+h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options)
{
- hid_t fid; /* file ID */
- hid_t did; /* dataset ID */
- hid_t pid; /* dataset creation property list ID */
- hid_t sid; /* space ID */
- hid_t tid; /* type ID */
+ hid_t fidin; /* file ID for input file*/
+ hid_t fidout; /* file ID for output file*/
+ hid_t did; /* dataset ID */
+ hid_t pid; /* dataset creation property list ID */
+ hid_t sid; /* space ID */
+ hid_t tid; /* type ID */
unsigned int i;
trav_table_t *travt = NULL;
int ok = 1;
+ hid_t fcpl_in; /* file creation property for input file */
+ hid_t fcpl_out; /* file creation property for output file */
+ H5F_file_space_type_t in_strat, out_strat; /* file space handling strategy for in/output file */
+ hsize_t in_thresh, out_thresh; /* free space section threshold for in/output file */
- /* open the file */
- if((fid = H5Fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0 )
+ /* open the output file */
+ if((fidout = H5Fopen(out_fname, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0 )
return -1;
for(i = 0; i < options->op_tbl->nelems; i++)
@@ -69,7 +74,7 @@ int h5repack_verify(const char *fname,
* open
*-------------------------------------------------------------------------
*/
- if((did = H5Dopen2(fid, name, H5P_DEFAULT)) < 0)
+ if((did = H5Dopen2(fidout, name, H5P_DEFAULT)) < 0)
goto error;
if((sid = H5Dget_space(did)) < 0)
goto error;
@@ -121,7 +126,7 @@ int h5repack_verify(const char *fname,
trav_table_init(&travt);
/* get the list of objects in the file */
- if(h5trav_gettable(fid, travt) < 0)
+ if(h5trav_gettable(fidout, travt) < 0)
goto error;
for(i = 0; i < travt->nobjs; i++)
@@ -135,7 +140,7 @@ int h5repack_verify(const char *fname,
* open
*-------------------------------------------------------------------------
*/
- if((did = H5Dopen2(fid, name, H5P_DEFAULT)) < 0)
+ if((did = H5Dopen2(fidout, name, H5P_DEFAULT)) < 0)
goto error;
if((sid = H5Dget_space(did)) < 0)
goto error;
@@ -191,26 +196,100 @@ int h5repack_verify(const char *fname,
}
/*-------------------------------------------------------------------------
- * close
+ * Verify that file space strategy and free space threshold
+ * are set as expected
*-------------------------------------------------------------------------
*/
- if (H5Fclose(fid) < 0)
- return -1;
+ /* open the input file */
+ if((fidin = H5Fopen(in_fname, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0 )
+ goto error;
+
+ /* Get file creation property list for input file */
+ if((fcpl_in = H5Fget_create_plist(fidin)) < 0) {
+ error_msg(progname, "failed to retrieve file creation property list\n");
+ goto error;
+ }
+
+ /* Get file space management info for input file */
+ if(H5Pget_file_space(fcpl_in, &in_strat, &in_thresh) < 0) {
+ error_msg(progname, "failed to retrieve file space strategy & threshold\n");
+ goto error;
+ }
+
+ /* Output file is already opened */
+ /* Get file creation property list for output file */
+ if((fcpl_out = H5Fget_create_plist(fidout)) < 0) {
+ error_msg(progname, "failed to retrieve file creation property list\n");
+ goto error;
+ }
+
+ /* Get file space management info for output file */
+ if(H5Pget_file_space(fcpl_out, &out_strat, &out_thresh) < 0) {
+ error_msg(progname, "failed to retrieve file space strategy & threshold\n");
+ goto error;
+ }
+
+ /*
+ * If the strategy option is not set,
+ * file space handling strategy should be the same for both
+ * input & output files.
+ * If the strategy option is set,
+ * the output file's file space handling strategy should be the same
+ * as what is set via the strategy option
+ */
+ if(!options->fs_strategy && out_strat != in_strat) {
+ error_msg(progname, "file space strategy not set as unexpected\n");
+ goto error;
+
+ } else if(options->fs_strategy && out_strat!= options->fs_strategy) {
+ error_msg(progname, "file space strategy not set as unexpectec\n");
+ goto error;
+ }
+
+ /*
+ * If the threshold option is not set,
+ * the free space section threshold should be the same for both
+ * input & output files.
+ * If the threshold option is set,
+ * the output file's free space section threshold should be the same
+ * as what is set via the threshold option.
+ */
+ if(!options->fs_threshold && out_thresh != in_thresh) {
+ error_msg(progname, "free space threshold not set as unexpected\n");
+ goto error;
+
+ } else if(options->fs_threshold && out_thresh != options->fs_threshold) {
+ error_msg(progname, "free space threshold not set as unexpectec\n");
+ goto error;
+ }
+
+ /* Closing */
+ if (H5Pclose(fcpl_in) < 0)
+ goto error;
+ if (H5Pclose(fcpl_out) < 0)
+ goto error;
+ if (H5Fclose(fidin) < 0)
+ goto error;
+ if (H5Fclose(fidout) < 0)
+ goto error;
return ok;
error:
H5E_BEGIN_TRY {
+ H5Pclose(fcpl_in);
+ H5Pclose(fcpl_out);
H5Pclose(pid);
H5Sclose(sid);
H5Dclose(did);
- H5Fclose(fid);
+ H5Fclose(fidin);
+ H5Fclose(fidout);
if (travt)
trav_table_free(travt);
} H5E_END_TRY;
return -1;
-}
+} /* h5repack_verify() */
diff --git a/tools/h5repack/h5repacktst.c b/tools/h5repack/h5repacktst.c
index 59652e0..adaef43 100644
--- a/tools/h5repack/h5repacktst.c
+++ b/tools/h5repack/h5repacktst.c
@@ -79,7 +79,6 @@
#define FNAME_UB "ublock.bin"
-
const char *H5REPACK_FILENAMES[] = {
"h5repack_big_out",
NULL
@@ -153,6 +152,8 @@ int main (void)
{
pack_opt_t pack_options;
diff_opt_t diff_options;
+ hsize_t fs_size = 0; /* free space section threshold */
+ H5F_file_space_type_t fs_type = H5F_FILE_SPACE_DEFAULT; /* file space handling strategy */
#if defined (H5_HAVE_FILTER_SZIP)
int szip_can_encode = 0;
#endif
@@ -178,19 +179,22 @@ int main (void)
*-------------------------------------------------------------------------
*/
+
/*-------------------------------------------------------------------------
* file with fill values
*-------------------------------------------------------------------------
*/
TESTING(" copy of datasets (fill values)");
- if (h5repack_init (&pack_options, 0, 0) < 0)
+
+ /* fs_type = 0; fs_size = 0 */
+ if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
GOERROR;
if (h5repack(FNAME0,FNAME0OUT,&pack_options) < 0)
GOERROR;
if (h5diff(FNAME0,FNAME0OUT,NULL,NULL,&diff_options) >0)
GOERROR;
- if (h5repack_verify(FNAME0OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME0, FNAME0OUT,&pack_options)<=0)
GOERROR;
if (h5repack_cmp_pl(FNAME0,FNAME0OUT)<=0)
GOERROR;
@@ -204,13 +208,13 @@ int main (void)
*-------------------------------------------------------------------------
*/
TESTING(" copy of datasets (all datatypes)");
- if (h5repack_init (&pack_options, 0, 0) < 0)
+ if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
GOERROR;
if (h5repack(FNAME1,FNAME1OUT,&pack_options) < 0)
GOERROR;
if (h5diff(FNAME1,FNAME1OUT,NULL,NULL,&diff_options) >0)
GOERROR;
- if (h5repack_verify(FNAME1OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME1, FNAME1OUT,&pack_options)<=0)
GOERROR;
if (h5repack_cmp_pl(FNAME1,FNAME1OUT)<=0)
GOERROR;
@@ -224,13 +228,13 @@ int main (void)
*-------------------------------------------------------------------------
*/
TESTING(" copy of datasets (attributes)");
- if (h5repack_init (&pack_options, 0, 0) < 0)
+ if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
GOERROR;
if (h5repack(FNAME2,FNAME2OUT,&pack_options) < 0)
GOERROR;
if (h5diff(FNAME2,FNAME2OUT,NULL,NULL,&diff_options) >0)
GOERROR;
- if (h5repack_verify(FNAME2OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME2, FNAME2OUT,&pack_options)<=0)
GOERROR;
if (h5repack_cmp_pl(FNAME2,FNAME2OUT)<=0)
GOERROR;
@@ -243,13 +247,13 @@ int main (void)
*-------------------------------------------------------------------------
*/
TESTING(" copy of datasets (hardlinks)");
- if (h5repack_init (&pack_options, 0, 0) < 0)
+ if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
GOERROR;
if (h5repack(FNAME3,FNAME3OUT,&pack_options) < 0)
GOERROR;
if (h5diff(FNAME3,FNAME3OUT,NULL,NULL,&diff_options) >0)
GOERROR;
- if (h5repack_verify(FNAME3OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME3, FNAME3OUT,&pack_options)<=0)
GOERROR;
if (h5repack_cmp_pl(FNAME3,FNAME3OUT)<=0)
GOERROR;
@@ -263,13 +267,13 @@ int main (void)
*-------------------------------------------------------------------------
*/
TESTING(" copy of allocation early file");
- if (h5repack_init (&pack_options, 0, 0) < 0)
+ if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
GOERROR;
if (h5repack(FNAME5,FNAME5OUT,&pack_options) < 0)
GOERROR;
if (h5diff(FNAME5,FNAME5OUT,NULL,NULL,&diff_options) >0)
GOERROR;
- if (h5repack_verify(FNAME5OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME5, FNAME5OUT, &pack_options)<=0)
GOERROR;
if (h5repack_end (&pack_options) < 0)
GOERROR;
@@ -293,7 +297,7 @@ int main (void)
*-------------------------------------------------------------------------
*/
- if (h5repack_init (&pack_options, 0, 0) < 0)
+ if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addfilter("dset1:GZIP=9",&pack_options) < 0)
GOERROR;
@@ -303,7 +307,7 @@ int main (void)
GOERROR;
if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0)
GOERROR;
- if (h5repack_verify(FNAME4OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0)
GOERROR;
if (h5repack_end (&pack_options) < 0)
GOERROR;
@@ -320,7 +324,7 @@ int main (void)
*-------------------------------------------------------------------------
*/
- if (h5repack_init (&pack_options, 0, 1) < 0)
+ if (h5repack_init (&pack_options, 0, 1, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addfilter("dset1:GZIP=9",&pack_options) < 0)
GOERROR;
@@ -330,7 +334,7 @@ int main (void)
GOERROR;
if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0)
GOERROR;
- if (h5repack_verify(FNAME4OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0)
GOERROR;
if (h5repack_end (&pack_options) < 0)
GOERROR;
@@ -348,7 +352,7 @@ int main (void)
#ifdef H5_HAVE_FILTER_DEFLATE
- if (h5repack_init (&pack_options, 0, 0) < 0)
+ if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addfilter("GZIP=1",&pack_options) < 0)
GOERROR;
@@ -358,7 +362,7 @@ int main (void)
GOERROR;
if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0)
GOERROR;
- if (h5repack_verify(FNAME4OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0)
GOERROR;
if (h5repack_end (&pack_options) < 0)
GOERROR;
@@ -386,7 +390,7 @@ int main (void)
*/
if (szip_can_encode) {
- if (h5repack_init (&pack_options, 0, 0) < 0)
+ if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addfilter("dset2:SZIP=8,EC",&pack_options) < 0)
GOERROR;
@@ -396,7 +400,7 @@ int main (void)
GOERROR;
if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0)
GOERROR;
- if (h5repack_verify(FNAME4OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0)
GOERROR;
if (h5repack_end (&pack_options) < 0)
GOERROR;
@@ -418,7 +422,7 @@ int main (void)
#if defined (H5_HAVE_FILTER_SZIP)
if (szip_can_encode) {
- if (h5repack_init (&pack_options, 0, 0) < 0)
+ if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addfilter("SZIP=8,NN",&pack_options) < 0)
GOERROR;
@@ -426,7 +430,7 @@ int main (void)
GOERROR;
if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0)
GOERROR;
- if (h5repack_verify(FNAME4OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0)
GOERROR;
if (h5repack_end (&pack_options) < 0)
GOERROR;
@@ -449,7 +453,7 @@ int main (void)
*-------------------------------------------------------------------------
*/
- if (h5repack_init (&pack_options, 0, 0) < 0)
+ if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addfilter("dset1:SHUF",&pack_options) < 0)
GOERROR;
@@ -459,7 +463,7 @@ int main (void)
GOERROR;
if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0)
GOERROR;
- if (h5repack_verify(FNAME4OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0)
GOERROR;
if (h5repack_end (&pack_options) < 0)
GOERROR;
@@ -478,7 +482,8 @@ int main (void)
#ifdef H5_HAVE_FILTER_SHUFFLE
- if (h5repack_init (&pack_options, 0, 0) < 0)
+ /* fs_type = H5F_FILE_SPACE_ALL_PERSIST; fs_size = 1 */
+ if (h5repack_init (&pack_options, 0, 0, H5_INC_ENUM(H5F_file_space_type_t, fs_type), ++fs_size) < 0)
GOERROR;
if (h5repack_addfilter("SHUF",&pack_options) < 0)
GOERROR;
@@ -488,7 +493,7 @@ int main (void)
GOERROR;
if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0)
GOERROR;
- if (h5repack_verify(FNAME4OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0)
GOERROR;
if (h5repack_end (&pack_options) < 0)
GOERROR;
@@ -507,7 +512,7 @@ int main (void)
*-------------------------------------------------------------------------
*/
- if (h5repack_init (&pack_options, 0, 0) < 0)
+ if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addfilter("dset1:FLET",&pack_options) < 0)
GOERROR;
@@ -517,7 +522,7 @@ int main (void)
GOERROR;
if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0)
GOERROR;
- if (h5repack_verify(FNAME4OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0)
GOERROR;
if (h5repack_end (&pack_options) < 0)
GOERROR;
@@ -537,7 +542,7 @@ int main (void)
#ifdef H5_HAVE_FILTER_FLETCHER32
- if (h5repack_init (&pack_options, 0, 0) < 0)
+ if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addfilter("FLET",&pack_options) < 0)
GOERROR;
@@ -547,7 +552,7 @@ int main (void)
GOERROR;
if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0)
GOERROR;
- if (h5repack_verify(FNAME4OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0)
GOERROR;
if (h5repack_end (&pack_options) < 0)
GOERROR;
@@ -565,7 +570,7 @@ int main (void)
*-------------------------------------------------------------------------
*/
- if (h5repack_init (&pack_options, 0, 0) < 0)
+ if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addlayout("dset1:CHUNK 20x10",&pack_options) < 0)
GOERROR;
@@ -596,7 +601,7 @@ int main (void)
GOERROR;
if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0)
GOERROR;
- if (h5repack_verify(FNAME4OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0)
GOERROR;
if (h5repack_end (&pack_options) < 0)
GOERROR;
@@ -611,7 +616,7 @@ int main (void)
*-------------------------------------------------------------------------
*/
- if (h5repack_init (&pack_options, 0, 0) < 0)
+ if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addlayout("dset1:CHUNK=20x10",&pack_options) < 0)
GOERROR;
@@ -619,7 +624,7 @@ int main (void)
GOERROR;
if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0)
GOERROR;
- if (h5repack_verify(FNAME4OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0)
GOERROR;
if (h5repack_end (&pack_options) < 0)
GOERROR;
@@ -633,7 +638,7 @@ int main (void)
*-------------------------------------------------------------------------
*/
- if (h5repack_init (&pack_options, 0, 1) < 0)
+ if (h5repack_init (&pack_options, 0, 1, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addlayout("dset1:CHUNK=20x10",&pack_options) < 0)
GOERROR;
@@ -641,7 +646,7 @@ int main (void)
GOERROR;
if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0)
GOERROR;
- if (h5repack_verify(FNAME4OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options )<= 0)
GOERROR;
if (h5repack_end (&pack_options) < 0)
GOERROR;
@@ -653,7 +658,7 @@ int main (void)
*/
TESTING(" adding layout chunked to all");
- if (h5repack_init (&pack_options, 0, 0) < 0)
+ if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addlayout("CHUNK=20x10",&pack_options) < 0)
GOERROR;
@@ -661,7 +666,7 @@ int main (void)
GOERROR;
if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0)
GOERROR;
- if (h5repack_verify(FNAME4OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0)
GOERROR;
if (h5repack_end (&pack_options) < 0)
GOERROR;
@@ -674,7 +679,7 @@ int main (void)
* test an individual object option
*-------------------------------------------------------------------------
*/
- if (h5repack_init (&pack_options, 0, 0) < 0)
+ if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addlayout("dset1:CONTI",&pack_options) < 0)
GOERROR;
@@ -682,7 +687,7 @@ int main (void)
GOERROR;
if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0)
GOERROR;
- if (h5repack_verify(FNAME4OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0)
GOERROR;
if (h5repack_end (&pack_options) < 0)
GOERROR;
@@ -695,7 +700,7 @@ int main (void)
* test all objects option
*-------------------------------------------------------------------------
*/
- if (h5repack_init (&pack_options, 0, 0) < 0)
+ if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addlayout("CONTI",&pack_options) < 0)
GOERROR;
@@ -703,7 +708,7 @@ int main (void)
GOERROR;
if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0)
GOERROR;
- if (h5repack_verify(FNAME4OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0)
GOERROR;
if (h5repack_end (&pack_options) < 0)
GOERROR;
@@ -712,7 +717,7 @@ int main (void)
* do the same test for a file with filters (chunked)
*-------------------------------------------------------------------------
*/
- if (h5repack_init (&pack_options, 0, 0) < 0)
+ if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addlayout("CONTI",&pack_options) < 0)
GOERROR;
@@ -720,7 +725,7 @@ int main (void)
GOERROR;
if (h5diff(FNAME8,FNAME8OUT,NULL,NULL,&diff_options) >0)
GOERROR;
- if (h5repack_verify(FNAME8OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME8, FNAME8OUT,&pack_options)<=0)
GOERROR;
if (h5repack_end (&pack_options) < 0)
GOERROR;
@@ -734,7 +739,7 @@ int main (void)
*-------------------------------------------------------------------------
*/
- if (h5repack_init (&pack_options, 0, 0) < 0)
+ if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addlayout("dset1:COMPA",&pack_options) < 0)
GOERROR;
@@ -742,7 +747,7 @@ int main (void)
GOERROR;
if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0)
GOERROR;
- if (h5repack_verify(FNAME4OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0)
GOERROR;
if (h5repack_end (&pack_options) < 0)
GOERROR;
@@ -755,7 +760,8 @@ int main (void)
*-------------------------------------------------------------------------
*/
- if (h5repack_init (&pack_options, 0, 0) < 0)
+ /* fs_type = H5F_FILE_SPACE_ALL; fs_size = 2 */
+ if (h5repack_init (&pack_options, 0, 0, H5_INC_ENUM(H5F_file_space_type_t, fs_type), ++fs_size) < 0)
GOERROR;
if (h5repack_addlayout("COMPA",&pack_options) < 0)
GOERROR;
@@ -763,7 +769,7 @@ int main (void)
GOERROR;
if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0)
GOERROR;
- if (h5repack_verify(FNAME4OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0)
GOERROR;
if (h5repack_end (&pack_options) < 0)
GOERROR;
@@ -777,7 +783,7 @@ int main (void)
* layout compact to contiguous conversion
*-------------------------------------------------------------------------
*/
- if (h5repack_init (&pack_options, 0, 0) < 0)
+ if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addlayout("dset_compact:CONTI",&pack_options) < 0)
GOERROR;
@@ -785,7 +791,7 @@ int main (void)
GOERROR;
if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0)
GOERROR;
- if (h5repack_verify(FNAME4OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0)
GOERROR;
if (h5repack_end (&pack_options) < 0)
GOERROR;
@@ -797,7 +803,7 @@ int main (void)
* layout compact to chunk conversion
*-------------------------------------------------------------------------
*/
- if (h5repack_init (&pack_options, 0, 0) < 0)
+ if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addlayout("dset_compact:CHUNK=2x5",&pack_options) < 0)
GOERROR;
@@ -805,7 +811,7 @@ int main (void)
GOERROR;
if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0)
GOERROR;
- if (h5repack_verify(FNAME4OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0)
GOERROR;
if (h5repack_end (&pack_options) < 0)
GOERROR;
@@ -817,7 +823,7 @@ int main (void)
* layout compact to compact conversion
*-------------------------------------------------------------------------
*/
- if (h5repack_init (&pack_options, 0, 0) < 0)
+ if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addlayout("dset_compact:COMPA",&pack_options) < 0)
GOERROR;
@@ -825,7 +831,7 @@ int main (void)
GOERROR;
if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0)
GOERROR;
- if (h5repack_verify(FNAME4OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0)
GOERROR;
if (h5repack_end (&pack_options) < 0)
GOERROR;
@@ -836,7 +842,7 @@ int main (void)
* layout contiguous to compact conversion
*-------------------------------------------------------------------------
*/
- if (h5repack_init (&pack_options, 0, 0) < 0)
+ if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addlayout("dset_contiguous:COMPA",&pack_options) < 0)
GOERROR;
@@ -844,7 +850,7 @@ int main (void)
GOERROR;
if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0)
GOERROR;
- if (h5repack_verify(FNAME4OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0)
GOERROR;
if (h5repack_end (&pack_options) < 0)
GOERROR;
@@ -855,7 +861,7 @@ int main (void)
* layout contiguous to chunk conversion
*-------------------------------------------------------------------------
*/
- if (h5repack_init (&pack_options, 0, 0) < 0)
+ if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addlayout("dset_contiguous:CHUNK=3x6",&pack_options) < 0)
GOERROR;
@@ -863,7 +869,7 @@ int main (void)
GOERROR;
if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0)
GOERROR;
- if (h5repack_verify(FNAME4OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0)
GOERROR;
if (h5repack_end (&pack_options) < 0)
GOERROR;
@@ -875,7 +881,7 @@ int main (void)
* layout contiguous to contiguous conversion
*-------------------------------------------------------------------------
*/
- if (h5repack_init (&pack_options, 0, 0) < 0)
+ if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addlayout("dset_contiguous:CONTI",&pack_options) < 0)
GOERROR;
@@ -883,7 +889,7 @@ int main (void)
GOERROR;
if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0)
GOERROR;
- if (h5repack_verify(FNAME4OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0)
GOERROR;
if (h5repack_end (&pack_options) < 0)
GOERROR;
@@ -894,7 +900,7 @@ int main (void)
* layout chunked to compact conversion
*-------------------------------------------------------------------------
*/
- if (h5repack_init (&pack_options, 0, 0) < 0)
+ if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addlayout("dset_chunk:COMPA",&pack_options) < 0)
GOERROR;
@@ -902,7 +908,7 @@ int main (void)
GOERROR;
if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0)
GOERROR;
- if (h5repack_verify(FNAME4OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0)
GOERROR;
if (h5repack_end (&pack_options) < 0)
GOERROR;
@@ -914,7 +920,7 @@ int main (void)
* layout chunked to contiguous conversion
*-------------------------------------------------------------------------
*/
- if (h5repack_init (&pack_options, 0, 0) < 0)
+ if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addlayout("dset_chunk:CONTI",&pack_options) < 0)
GOERROR;
@@ -922,7 +928,7 @@ int main (void)
GOERROR;
if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0)
GOERROR;
- if (h5repack_verify(FNAME4OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0)
GOERROR;
if (h5repack_end (&pack_options) < 0)
GOERROR;
@@ -933,7 +939,7 @@ int main (void)
* layout chunked to chunked conversion
*-------------------------------------------------------------------------
*/
- if (h5repack_init (&pack_options, 0, 0) < 0)
+ if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addlayout("dset_chunk:CHUNK=18x13",&pack_options) < 0)
GOERROR;
@@ -941,7 +947,7 @@ int main (void)
GOERROR;
if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0)
GOERROR;
- if (h5repack_verify(FNAME4OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0)
GOERROR;
if (h5repack_end (&pack_options) < 0)
GOERROR;
@@ -963,13 +969,14 @@ int main (void)
#if defined (H5_HAVE_FILTER_SZIP)
if (szip_can_encode) {
- if (h5repack_init (&pack_options, 0, 0) < 0)
+ /* fs_type = H5F_FILE_SPACE_AGGR_VFD; fs_size = 3 */
+ if (h5repack_init (&pack_options, 0, 0, H5_INC_ENUM(H5F_file_space_type_t, fs_type), ++fs_size) < 0)
GOERROR;
if (h5repack(FNAME7,FNAME7OUT,&pack_options) < 0)
GOERROR;
if (h5diff(FNAME7,FNAME7OUT,NULL,NULL,&diff_options) >0)
GOERROR;
- if (h5repack_verify(FNAME7OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME7, FNAME7OUT,&pack_options)<=0)
GOERROR;
if (h5repack_cmp_pl(FNAME7,FNAME7OUT)<=0)
GOERROR;
@@ -988,7 +995,7 @@ int main (void)
#if defined (H5_HAVE_FILTER_SZIP)
if (szip_can_encode) {
- if (h5repack_init (&pack_options, 0, 0) < 0)
+ if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addfilter("dset_szip:NONE",&pack_options) < 0)
GOERROR;
@@ -996,7 +1003,7 @@ int main (void)
GOERROR;
if (h5diff(FNAME7,FNAME7OUT,NULL,NULL,&diff_options) >0)
GOERROR;
- if (h5repack_verify(FNAME7OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME7, FNAME7OUT,&pack_options)<=0)
GOERROR;
if (h5repack_end (&pack_options) < 0)
GOERROR;
@@ -1013,13 +1020,13 @@ int main (void)
TESTING(" copy of deflate filter");
#ifdef H5_HAVE_FILTER_DEFLATE
- if (h5repack_init (&pack_options, 0, 0) < 0)
+ if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
GOERROR;
if (h5repack(FNAME8,FNAME8OUT,&pack_options) < 0)
GOERROR;
if (h5diff(FNAME8,FNAME8OUT,NULL,NULL,&diff_options) >0)
GOERROR;
- if (h5repack_verify(FNAME8OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME8, FNAME8OUT,&pack_options)<=0)
GOERROR;
if (h5repack_end (&pack_options) < 0)
GOERROR;
@@ -1033,7 +1040,7 @@ int main (void)
TESTING(" removing deflate filter");
#ifdef H5_HAVE_FILTER_DEFLATE
- if (h5repack_init (&pack_options, 0, 0) < 0)
+ if (h5repack_init (&pack_options, 0, 0, fs_type, ++fs_size) < 0)
GOERROR;
if (h5repack_addfilter("dset_deflate:NONE",&pack_options) < 0)
GOERROR;
@@ -1041,7 +1048,7 @@ int main (void)
GOERROR;
if (h5diff(FNAME8,FNAME8OUT,NULL,NULL,&diff_options) >0)
GOERROR;
- if (h5repack_verify(FNAME8OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME8, FNAME8OUT,&pack_options)<=0)
GOERROR;
if (h5repack_end (&pack_options) < 0)
GOERROR;
@@ -1056,13 +1063,13 @@ int main (void)
TESTING(" copy of shuffle filter");
#ifdef H5_HAVE_FILTER_SHUFFLE
- if (h5repack_init (&pack_options, 0, 0) < 0)
+ if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
GOERROR;
if (h5repack(FNAME9,FNAME9OUT,&pack_options) < 0)
GOERROR;
if (h5diff(FNAME9,FNAME9OUT,NULL,NULL,&diff_options) >0)
GOERROR;
- if (h5repack_verify(FNAME9OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME9, FNAME9OUT,&pack_options)<=0)
GOERROR;
if (h5repack_end (&pack_options) < 0)
GOERROR;
@@ -1075,7 +1082,7 @@ int main (void)
TESTING(" removing shuffle filter");
#ifdef H5_HAVE_FILTER_SHUFFLE
- if (h5repack_init (&pack_options, 0, 0) < 0)
+ if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addfilter("dset_shuffle:NONE",&pack_options) < 0)
GOERROR;
@@ -1083,7 +1090,7 @@ int main (void)
GOERROR;
if (h5diff(FNAME9,FNAME9OUT,NULL,NULL,&diff_options) >0)
GOERROR;
- if (h5repack_verify(FNAME9OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME9, FNAME9OUT,&pack_options)<=0)
GOERROR;
if (h5repack_end (&pack_options) < 0)
GOERROR;
@@ -1096,13 +1103,13 @@ int main (void)
TESTING(" copy of fletcher filter");
#ifdef H5_HAVE_FILTER_FLETCHER32
- if (h5repack_init (&pack_options, 0, 0) < 0)
+ if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
GOERROR;
if (h5repack(FNAME10,FNAME10OUT,&pack_options) < 0)
GOERROR;
if (h5diff(FNAME10,FNAME10OUT,NULL,NULL,&diff_options) >0)
GOERROR;
- if (h5repack_verify(FNAME10OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME10, FNAME10OUT,&pack_options)<=0)
GOERROR;
if (h5repack_end (&pack_options) < 0)
GOERROR;
@@ -1115,7 +1122,7 @@ int main (void)
TESTING(" removing fletcher filter");
#ifdef H5_HAVE_FILTER_FLETCHER32
- if (h5repack_init (&pack_options, 0, 0) < 0)
+ if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addfilter("dset_fletcher32:NONE",&pack_options) < 0)
GOERROR;
@@ -1123,7 +1130,7 @@ int main (void)
GOERROR;
if (h5diff(FNAME10,FNAME10OUT,NULL,NULL,&diff_options) >0)
GOERROR;
- if (h5repack_verify(FNAME10OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME10, FNAME10OUT,&pack_options)<=0)
GOERROR;
if (h5repack_end (&pack_options) < 0)
GOERROR;
@@ -1137,13 +1144,13 @@ int main (void)
TESTING(" copy of nbit filter");
#ifdef H5_HAVE_FILTER_NBIT
- if (h5repack_init (&pack_options, 0, 0) < 0)
+ if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
GOERROR;
if (h5repack(FNAME12,FNAME12OUT,&pack_options) < 0)
GOERROR;
if (h5diff(FNAME12,FNAME12OUT,NULL,NULL,&diff_options) >0)
GOERROR;
- if (h5repack_verify(FNAME12OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME12, FNAME12OUT,&pack_options)<=0)
GOERROR;
if (h5repack_end (&pack_options) < 0)
GOERROR;
@@ -1156,7 +1163,7 @@ int main (void)
TESTING(" removing nbit filter");
#ifdef H5_HAVE_FILTER_NBIT
- if (h5repack_init (&pack_options, 0, 0) < 0)
+ if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addfilter("dset_nbit:NONE",&pack_options) < 0)
GOERROR;
@@ -1164,7 +1171,7 @@ int main (void)
GOERROR;
if (h5diff(FNAME12,FNAME12OUT,NULL,NULL,&diff_options) >0)
GOERROR;
- if (h5repack_verify(FNAME12OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME12, FNAME12OUT,&pack_options)<=0)
GOERROR;
if (h5repack_end (&pack_options) < 0)
GOERROR;
@@ -1178,7 +1185,7 @@ int main (void)
TESTING(" adding nbit filter");
#ifdef H5_HAVE_FILTER_NBIT
- if (h5repack_init (&pack_options, 0, 0) < 0)
+ if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addfilter("dset_int31:NBIT",&pack_options) < 0)
GOERROR;
@@ -1186,7 +1193,7 @@ int main (void)
GOERROR;
if (h5diff(FNAME12,FNAME12OUT,NULL,NULL,&diff_options) >0)
GOERROR;
- if (h5repack_verify(FNAME12OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME12, FNAME12OUT,&pack_options)<=0)
GOERROR;
if (h5repack_end (&pack_options) < 0)
GOERROR;
@@ -1200,13 +1207,13 @@ int main (void)
TESTING(" copy of scaleoffset filter");
#ifdef H5_HAVE_FILTER_SCALEOFFSET
- if (h5repack_init (&pack_options, 0, 0) < 0)
+ if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
GOERROR;
if (h5repack(FNAME13,FNAME13OUT,&pack_options) < 0)
GOERROR;
if (h5diff(FNAME13,FNAME13OUT,NULL,NULL,&diff_options) >0)
GOERROR;
- if (h5repack_verify(FNAME13OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME13, FNAME13OUT,&pack_options)<=0)
GOERROR;
if (h5repack_end (&pack_options) < 0)
GOERROR;
@@ -1219,7 +1226,7 @@ int main (void)
TESTING(" removing scaleoffset filter");
#ifdef H5_HAVE_FILTER_SCALEOFFSET
- if (h5repack_init (&pack_options, 0, 0) < 0)
+ if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addfilter("dset_scaleoffset:NONE",&pack_options) < 0)
GOERROR;
@@ -1227,7 +1234,7 @@ int main (void)
GOERROR;
if (h5diff(FNAME13,FNAME13OUT,NULL,NULL,&diff_options) >0)
GOERROR;
- if (h5repack_verify(FNAME13OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME13, FNAME13OUT,&pack_options)<=0)
GOERROR;
if (h5repack_end (&pack_options) < 0)
GOERROR;
@@ -1241,7 +1248,7 @@ int main (void)
TESTING(" adding scaleoffset filter");
#ifdef H5_HAVE_FILTER_SCALEOFFSET
- if (h5repack_init (&pack_options, 0, 0) < 0)
+ if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addfilter("dset_none:SOFF=31,IN",&pack_options) < 0)
GOERROR;
@@ -1249,7 +1256,7 @@ int main (void)
GOERROR;
if (h5diff(FNAME13,FNAME13OUT,NULL,NULL,&diff_options) >0)
GOERROR;
- if (h5repack_verify(FNAME13OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME13, FNAME13OUT,&pack_options)<=0)
GOERROR;
if (h5repack_end (&pack_options) < 0)
GOERROR;
@@ -1279,7 +1286,8 @@ int main (void)
&& defined (H5_HAVE_FILTER_FLETCHER32) && defined (H5_HAVE_FILTER_SHUFFLE)
if (szip_can_encode) {
- if (h5repack_init (&pack_options, 0, 0) < 0)
+ /* fs_type = H5F_FILE_SPACE_VFD; fs_size = 4 */
+ if (h5repack_init (&pack_options, 0, 0, H5_INC_ENUM(H5F_file_space_type_t, fs_type), ++fs_size) < 0)
GOERROR;
if (h5repack_addfilter("dset_deflate:SZIP=8,NN",&pack_options) < 0)
GOERROR;
@@ -1287,7 +1295,7 @@ int main (void)
GOERROR;
if (h5diff(FNAME11,FNAME11OUT,NULL,NULL,&diff_options) >0)
GOERROR;
- if (h5repack_verify(FNAME11OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME11, FNAME11OUT,&pack_options)<=0)
GOERROR;
if (h5repack_end (&pack_options) < 0)
GOERROR;
@@ -1307,7 +1315,7 @@ int main (void)
&& defined (H5_HAVE_FILTER_FLETCHER32) && defined (H5_HAVE_FILTER_SHUFFLE)
if (szip_can_encode) {
- if (h5repack_init (&pack_options, 0, 0) < 0)
+ if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addfilter("dset_szip:GZIP=1",&pack_options) < 0)
GOERROR;
@@ -1315,7 +1323,7 @@ int main (void)
GOERROR;
if (h5diff(FNAME11,FNAME11OUT,NULL,NULL,&diff_options) >0)
GOERROR;
- if (h5repack_verify(FNAME11OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME11, FNAME11OUT,&pack_options)<=0)
GOERROR;
if (h5repack_end (&pack_options) < 0)
GOERROR;
@@ -1339,7 +1347,7 @@ int main (void)
#if defined (H5_HAVE_FILTER_SZIP) && defined (H5_HAVE_FILTER_DEFLATE) \
&& defined (H5_HAVE_FILTER_FLETCHER32) && defined (H5_HAVE_FILTER_SHUFFLE)
- if (h5repack_init (&pack_options, 0, 0) < 0)
+ if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addfilter("NONE",&pack_options) < 0)
GOERROR;
@@ -1347,7 +1355,7 @@ int main (void)
GOERROR;
if (h5diff(FNAME11,FNAME11OUT,NULL,NULL,&diff_options) >0)
GOERROR;
- if (h5repack_verify(FNAME11OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME11, FNAME11OUT,&pack_options)<=0)
GOERROR;
if (h5repack_end (&pack_options) < 0)
GOERROR;
@@ -1362,13 +1370,14 @@ int main (void)
*-------------------------------------------------------------------------
*/
TESTING(" big file");
- if (h5repack_init (&pack_options, 0, 0) < 0)
+
+ if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
GOERROR;
if (h5repack(FNAME14,FNAME14OUT,&pack_options) < 0)
GOERROR;
if (h5diff(FNAME14,FNAME14OUT,NULL,NULL,&diff_options) >0)
GOERROR;
- if (h5repack_verify(FNAME14OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME14, FNAME14OUT,&pack_options)<=0)
GOERROR;
if (h5repack_end (&pack_options) < 0)
GOERROR;
@@ -1379,13 +1388,13 @@ int main (void)
*-------------------------------------------------------------------------
*/
TESTING(" external datasets");
- if (h5repack_init (&pack_options, 0, 0) < 0)
+ if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
GOERROR;
if (h5repack(FNAME15,FNAME15OUT,&pack_options) < 0)
GOERROR;
if (h5diff(FNAME15,FNAME15OUT,NULL,NULL,&diff_options) > 0)
GOERROR;
- if (h5repack_verify(FNAME15OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME15, FNAME15OUT,&pack_options)<=0)
GOERROR;
if (h5repack_end (&pack_options) < 0)
GOERROR;
@@ -1396,13 +1405,13 @@ int main (void)
*-------------------------------------------------------------------------
*/
TESTING(" file with userblock");
- if(h5repack_init(&pack_options, 0, 0) < 0)
+ if(h5repack_init(&pack_options, 0, 0, fs_type, fs_size) < 0)
GOERROR;
if(h5repack(FNAME16, FNAME16OUT, &pack_options) < 0)
GOERROR;
if(h5diff(FNAME16, FNAME16OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if(h5repack_verify(FNAME16OUT, &pack_options) <= 0)
+ if(h5repack_verify(FNAME16, FNAME16OUT, &pack_options) <= 0)
GOERROR;
if(verify_userblock(FNAME16OUT) < 0)
GOERROR;
@@ -1415,7 +1424,7 @@ int main (void)
*-------------------------------------------------------------------------
*/
TESTING(" latest file format options");
- if (h5repack_init (&pack_options, 0, 0) < 0)
+ if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
GOERROR;
pack_options.latest=1;
pack_options.grp_compact=10;
@@ -1429,7 +1438,7 @@ int main (void)
GOERROR;
if (h5diff(FNAME1,FNAME1OUT,NULL,NULL,&diff_options) > 0)
GOERROR;
- if (h5repack_verify(FNAME1OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME1, FNAME1OUT,&pack_options)<=0)
GOERROR;
if (h5repack_end (&pack_options) < 0)
GOERROR;
@@ -1445,7 +1454,7 @@ int main (void)
#if defined (H5_HAVE_FILTER_DEFLATE) && defined (H5_HAVE_FILTER_SHUFFLE)
- if (h5repack_init (&pack_options, 0, 0) < 0)
+ if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addfilter("GZIP=1",&pack_options) < 0)
GOERROR;
@@ -1455,7 +1464,7 @@ int main (void)
GOERROR;
if (h5diff(FNAME11,FNAME11OUT,NULL,NULL,&diff_options) >0)
GOERROR;
- if (h5repack_verify(FNAME11OUT,&pack_options)<=0)
+ if (h5repack_verify(FNAME11, FNAME11OUT,&pack_options)<=0)
GOERROR;
if (h5repack_end (&pack_options) < 0)
GOERROR;
@@ -1474,7 +1483,7 @@ int main (void)
#ifdef H5_HAVE_FILTER_DEFLATE
- if(h5repack_init(&pack_options, 0, 0) < 0)
+ if(h5repack_init(&pack_options, 0, 0, fs_type, fs_size) < 0)
GOERROR;
/* add the options for a user block size and user block filename */
@@ -1485,7 +1494,7 @@ int main (void)
GOERROR;
if(h5diff(FNAME8, FNAME8OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if(h5repack_verify(FNAME8OUT, &pack_options) <= 0)
+ if(h5repack_verify(FNAME8, FNAME8OUT, &pack_options) <= 0)
GOERROR;
if(verify_userblock(FNAME8OUT) < 0)
GOERROR;
@@ -1507,7 +1516,7 @@ int main (void)
#ifdef H5_HAVE_FILTER_DEFLATE
- if(h5repack_init(&pack_options, 0, 0) < 0)
+ if(h5repack_init(&pack_options, 0, 0, fs_type, fs_size) < 0)
GOERROR;
/* add the options for aligment */
@@ -1518,10 +1527,9 @@ int main (void)
GOERROR;
if(h5diff(FNAME8, FNAME8OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if(h5repack_verify(FNAME8OUT, &pack_options) <= 0)
+ if(h5repack_verify(FNAME8, FNAME8OUT, &pack_options) <= 0)
GOERROR;
-
/* verify aligment */
{
hsize_t threshold;
@@ -1562,14 +1570,14 @@ int main (void)
*/
TESTING(" file with committed datatypes");
- if(h5repack_init(&pack_options, 0, 0) < 0)
+ if(h5repack_init(&pack_options, 0, 0, fs_type, fs_size) < 0)
GOERROR;
if(h5repack(FNAME17, FNAME17OUT, &pack_options) < 0)
GOERROR;
if(h5diff(FNAME17, FNAME17OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if(h5repack_verify(FNAME17OUT, &pack_options) <= 0)
+ if(h5repack_verify(FNAME17, FNAME17OUT, &pack_options) <= 0)
GOERROR;
if(h5repack_end(&pack_options) < 0)
GOERROR;
diff --git a/tools/h5stat/Makefile.am b/tools/h5stat/Makefile.am
index a14172d..13d9baf 100644
--- a/tools/h5stat/Makefile.am
+++ b/tools/h5stat/Makefile.am
@@ -36,7 +36,7 @@ bin_PROGRAMS=h5stat
bin_SCRIPTS=
# Add h5stat specific linker flags here
-h5stat_LDFLAGS = $(LT_STATIC_EXEC)
+h5stat_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
# Tell automake to clean h5redeploy script
CLEANFILES=
diff --git a/tools/h5stat/Makefile.in b/tools/h5stat/Makefile.in
index 15b19ed..08de49b 100644
--- a/tools/h5stat/Makefile.in
+++ b/tools/h5stat/Makefile.in
@@ -126,6 +126,16 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = /home1/packages/automake/automake-1.9.6/bin/aclocal-1.9 -I /afs/ncsa/projects/hdf/packages/libtool_1.5.14/Linux_2.4/share/aclocal
ADD_PARALLEL_FILES = @ADD_PARALLEL_FILES@
AMTAR = @AMTAR@
+
+# H5_CFLAGS holds flags that should be used when building hdf5,
+# but which should not be exported to h5cc for building other programs.
+# AM_CFLAGS is an automake construct which should be used by Makefiles
+# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
+AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
+AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@
+AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
+AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@
+AM_LDFLAGS = @AM_LDFLAGS@
AM_MAKEFLAGS = @AM_MAKEFLAGS@
AR = @AR@
@@ -139,21 +149,18 @@ BYTESEX = @BYTESEX@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CC_VERSION = @CC_VERSION@
-
-# H5_CFLAGS holds flags that should be used as CFLAGS when building hdf5,
-# but which shouldn't be exported to h5cc for building other programs.
-CFLAGS = @CFLAGS@ @H5_CFLAGS@
+CFLAGS = @CFLAGS@
CLEARFILEBUF = @CLEARFILEBUF@
CODESTACK = @CODESTACK@
CONFIG_DATE = @CONFIG_DATE@
CONFIG_MODE = @CONFIG_MODE@
CONFIG_USER = @CONFIG_USER@
CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@ @H5_CPPFLAGS@
+CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@ @H5_CXXFLAGS@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_PKG = @DEBUG_PKG@
DEFAULT_API_VERSION = @DEFAULT_API_VERSION@
@@ -176,7 +183,7 @@ F9XMODEXT = @F9XMODEXT@
F9XMODFLAG = @F9XMODFLAG@
F9XSUFFIXFLAG = @F9XSUFFIXFLAG@
FC = @FC@
-FCFLAGS = @FCFLAGS@ @H5_FCFLAGS@
+FCFLAGS = @FCFLAGS@
FCFLAGS_f90 = @FCFLAGS_f90@
FCLIBS = @FCLIBS@
FGREP = @FGREP@
@@ -390,7 +397,7 @@ SCRIPT_DEPEND = h5stat$(EXEEXT)
bin_SCRIPTS =
# Add h5stat specific linker flags here
-h5stat_LDFLAGS = $(LT_STATIC_EXEC)
+h5stat_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
# Tell automake to clean h5redeploy script
CLEANFILES =
diff --git a/tools/h5stat/h5stat.c b/tools/h5stat/h5stat.c
index 657cf32..b21e5a0 100644
--- a/tools/h5stat/h5stat.c
+++ b/tools/h5stat/h5stat.c
@@ -26,12 +26,21 @@
#define SIZE_SMALL_GROUPS 10
#define SIZE_SMALL_ATTRS 10
#define SIZE_SMALL_DSETS 10
+#define SIZE_SMALL_SECTS 10
#define H5_NFILTERS_IMPL 8 /* Number of currently implemented filters + one to
accommodate for user-define filters + one
to accomodate datasets whithout any filters */
-
+/* File space management strategies: see H5Fpublic.h for declarations */
+const char *FS_STRATEGY_NAME[] = {
+ "unknown",
+ "H5F_FILE_SPACE_ALL_PERSIST",
+ "H5F_FILE_SPACE_ALL",
+ "H5F_FILE_SPACE_AGGR_VFD",
+ "H5F_FILE_SPACE_VFD",
+ NULL
+};
/* Datatype statistics for datasets */
typedef struct dtype_info_t {
@@ -48,7 +57,7 @@ typedef struct ohdr_info_t {
/* Info to pass to the iteration functions */
typedef struct iter_t {
hid_t fid; /* File ID */
-
+ hsize_t filesize; /* Size of the file */
unsigned long uniq_groups; /* Number of unique groups */
unsigned long uniq_dsets; /* Number of unique datasets */
unsigned long uniq_dtypes; /* Number of unique named datatypes */
@@ -79,6 +88,7 @@ typedef struct iter_t {
unsigned long *dset_dim_bins; /* Pointer to array of bins for dataset dimensions */
ohdr_info_t dset_ohdr_info; /* Object header information for datasets */
hsize_t dset_storage_size; /* Size of raw data for datasets */
+ hsize_t dset_external_storage_size; /* Size of raw data for datasets with external storage */
ohdr_info_t dtype_ohdr_info; /* Object header information for datatypes */
hsize_t groups_btree_storage_size; /* btree size for group */
hsize_t groups_heap_storage_size; /* heap size for group */
@@ -87,8 +97,18 @@ typedef struct iter_t {
hsize_t SM_hdr_storage_size; /* header size for SOHM table (1.8) */
hsize_t SM_index_storage_size; /* index (btree & list) size for SOHM table (1.8) */
hsize_t SM_heap_storage_size; /* fractal heap size for SOHM table (1.8) */
+ hsize_t super_size; /* superblock size */
hsize_t super_ext_size; /* superblock extension size */
- hsize_t datasets_index_storage_size; /* meta size for chunked dataset's indexing type */
+ hsize_t ublk_size; /* user block size (if exists) */
+ H5F_file_space_type_t fs_strategy; /* File space management strategy */
+ hsize_t fs_threshold; /* Free-space section threshold */
+ hsize_t free_space; /* amount of freespace in the file */
+ hsize_t free_hdr; /* size of free space manager metadata in the file */
+ unsigned long num_small_sects[SIZE_SMALL_SECTS]; /* Size of small free-space sections */
+ unsigned sect_nbins; /* Number of bins for free-space section sizes */
+ unsigned long *sect_bins; /* Pointer to array of bins for free-space section sizes */
+ hsize_t datasets_index_storage_size;/* meta size for chunked dataset's indexing type */
+ hsize_t datasets_heap_storage_size; /* heap size for dataset with external storage */
unsigned long nexternal; /* Number of external files for a dataset */
int local; /* Flag to indicate iteration over the object*/
} iter_t;
@@ -96,14 +116,24 @@ typedef struct iter_t {
const char *progname = "h5stat";
int d_status = EXIT_SUCCESS;
+
+/* Enable the printing of everything */
static int display_all = TRUE;
-static int display_file_metadata = FALSE;
-static int display_file = FALSE;
-static int display_group = FALSE;
-static int display_dset = FALSE;
-static int display_dtype_metadata = FALSE;
-static int display_object = FALSE;
-static int display_attr = FALSE;
+
+/* Enable the printing of selected statistics */
+static int display_file = FALSE; /* display file information */
+static int display_group = FALSE; /* display groups information */
+static int display_dset = FALSE; /* display datasets information */
+static int display_dset_dtype_info = FALSE; /* display datasets' datatype information */
+static int display_attr = FALSE; /* display attributes information */
+static int display_free_sections = FALSE; /* display free space information */
+static int display_summary = FALSE; /* display summary of file space information */
+
+static int display_file_metadata = FALSE; /* display file space info for file's metadata */
+static int display_group_metadata = FALSE; /* display file space info for groups' metadata */
+static int display_dset_metadata = FALSE; /* display file space info for datasets' metadata */
+
+static int display_object = FALSE; /* not implemented yet */
/* a structure for handling the order command-line parameters come in */
struct handler_t {
@@ -111,10 +141,11 @@ struct handler_t {
};
-static const char *s_opts ="ADdFfhGgTO:V";
+static const char *s_opts ="aDdFfhGgsSTO:v";
static struct long_options l_opts[] = {
{"help", no_arg, 'h'},
{"hel", no_arg, 'h'},
+ {"he", no_arg, 'h'},
{"file", no_arg, 'f'},
{"fil", no_arg, 'f'},
{"fi", no_arg, 'f'},
@@ -130,55 +161,66 @@ static struct long_options l_opts[] = {
{"grou", no_arg, 'g'},
{"gro", no_arg, 'g'},
{"gr", no_arg, 'g'},
- {"groupmetadata", no_arg, 'G'},
- {"groupmetadat", no_arg, 'G'},
- {"groupmetada", no_arg, 'G'},
- {"groupmetad", no_arg, 'G'},
- {"groupmeta", no_arg, 'G'},
- {"groupmet", no_arg, 'G'},
- {"groupme", no_arg, 'G'},
- {"groupm", no_arg, 'G'},
+ {"GROUPmetadata", no_arg, 'G'},
+ {"GROUPmetadat", no_arg, 'G'},
+ {"GROUPmetada", no_arg, 'G'},
+ {"GROUPmetad", no_arg, 'G'},
+ {"GROUPmeta", no_arg, 'G'},
+ {"GROUPmet", no_arg, 'G'},
+ {"GROUPme", no_arg, 'G'},
+ {"GROUPm", no_arg, 'G'},
{"dset", no_arg, 'd'},
{"dse", no_arg, 'd'},
{"ds", no_arg, 'd'},
- {"d", no_arg, 'd'},
- {"dsetmetadata", no_arg, 'D'},
- {"dsetmetadat", no_arg, 'D'},
- {"dsetmetada", no_arg, 'D'},
- {"dsetmetad", no_arg, 'D'},
- {"dsetmeta", no_arg, 'D'},
- {"dsetmet", no_arg, 'D'},
- {"dsetme", no_arg, 'D'},
- {"dsetm", no_arg, 'D'},
- {"dtypemetadata", no_arg, 'T'},
- {"dtypemetadat", no_arg, 'T'},
- {"dtypemetada", no_arg, 'T'},
- {"dtypemetad", no_arg, 'T'},
- {"dtypemeta", no_arg, 'T'},
- {"dtypemet", no_arg, 'T'},
- {"dtypeme", no_arg, 'T'},
- {"dtypem", no_arg, 'T'},
- {"dtype", no_arg, 'T'},
+ {"DSETmetadata", no_arg, 'D'},
+ {"DSETmetadat", no_arg, 'D'},
+ {"DSETmetada", no_arg, 'D'},
+ {"DSETmetad", no_arg, 'D'},
+ {"DSETmeta", no_arg, 'D'},
+ {"DSETmet", no_arg, 'D'},
+ {"DSETme", no_arg, 'D'},
+ {"DSETm", no_arg, 'D'},
+ {"DSETtypeinfo", no_arg, 'T'},
+ {"DSETtypeinf", no_arg, 'T'},
+ {"DSETtypein", no_arg, 'T'},
+ {"DSETtypei", no_arg, 'T'},
+ {"DSETtype", no_arg, 'T'},
+ {"DSETtyp", no_arg, 'T'},
+ {"DSETty", no_arg, 'T'},
+ {"DSETt", no_arg, 'T'},
{ "object", require_arg, 'O' },
{ "objec", require_arg, 'O' },
{ "obje", require_arg, 'O' },
{ "obj", require_arg, 'O' },
{ "ob", require_arg, 'O' },
- { "version", no_arg, 'V' },
- { "versio", no_arg, 'V' },
- { "versi", no_arg, 'V' },
- { "vers", no_arg, 'V' },
- { "ver", no_arg, 'V' },
- { "ve", no_arg, 'V' },
- { "attribute", no_arg, 'A' },
- { "attribut", no_arg, 'A' },
- { "attribu", no_arg, 'A' },
- { "attrib", no_arg, 'A' },
- { "attri", no_arg, 'A' },
- { "attr", no_arg, 'A' },
- { "att", no_arg, 'A' },
- { "at", no_arg, 'A' },
- { "a", no_arg, 'A' },
+ { "version", no_arg, 'v' },
+ { "versio", no_arg, 'v' },
+ { "versi", no_arg, 'v' },
+ { "vers", no_arg, 'v' },
+ { "ver", no_arg, 'v' },
+ { "ve", no_arg, 'v' },
+ { "attribute", no_arg, 'a' },
+ { "attribut", no_arg, 'a' },
+ { "attribu", no_arg, 'a' },
+ { "attrib", no_arg, 'a' },
+ { "attri", no_arg, 'a' },
+ { "attr", no_arg, 'a' },
+ { "att", no_arg, 'a' },
+ { "at", no_arg, 'a' },
+ { "freespace", no_arg, 's' },
+ { "freespac", no_arg, 's' },
+ { "freespa", no_arg, 's' },
+ { "freesp", no_arg, 's' },
+ { "frees", no_arg, 's' },
+ { "free", no_arg, 's' },
+ { "fre", no_arg, 's' },
+ { "fr", no_arg, 's' },
+ { "summary", no_arg, 'S' },
+ { "summar", no_arg, 'S' },
+ { "summa", no_arg, 'S' },
+ { "summ", no_arg, 'S' },
+ { "sum", no_arg, 'S' },
+ { "su", no_arg, 'S' },
{ NULL, 0, '\0' }
};
@@ -197,16 +239,17 @@ static void usage(const char *prog)
fprintf(stdout, "\n");
fprintf(stdout, " OPTIONS\n");
fprintf(stdout, " -h, --help Print a usage message and exit\n");
- fprintf(stdout, " -V, --version Print version number and exit\n");
+ fprintf(stdout, " -v, --version Print version number and exit\n");
fprintf(stdout, " -f, --file Print file information\n");
- fprintf(stdout, " -F, --filemetadata Print file metadata\n");
+ fprintf(stdout, " -F, --FILEmetadata Print file space information for file's metadata\n");
fprintf(stdout, " -g, --group Print group information\n");
- fprintf(stdout, " -G, --groupmetadata Print group metadata\n");
+ fprintf(stdout, " -G, --GROUPmetadata Print file space information for groups' metadata\n");
fprintf(stdout, " -d, --dset Print dataset information\n");
- fprintf(stdout, " -D, --dsetmetadata Print dataset metadata\n");
- fprintf(stdout, " -T, --dtypemetadata Print datatype metadata\n");
- fprintf(stdout, " -A, --attribute Print attribute information\n");
- fprintf(stdout, "\n");
+ fprintf(stdout, " -D, --DSETmetadata Print file space information for datasets' metadata\n");
+ fprintf(stdout, " -T, --DSETtypeinfo Print datasets' datatype information\n");
+ fprintf(stdout, " -a, --attribute Print attribute information\n");
+ fprintf(stdout, " -s, --freespace Print free space information\n");
+ fprintf(stdout, " -S, --summary Print summary of file space information\n");
}
@@ -381,18 +424,6 @@ group_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
* Programmer: Quincey Koziol
* Tuesday, August 16, 2005
*
- * Modifications: Refactored code from the walk_function
- * EIP, Wednesday, August 16, 2006
- *
- * Vailin Choi 12 July 2007
- * 1. Gathered storage info for btree and heap
- * (chunked datasets and attributes)
- * 2. Gathered info for attributes
- *
- * Vailin Choi 14 July 2007
- * Cast "dims" and "num_attrs" to size_t
- * Due to the -Mbounds problem for the pgi-32bit compiler on indexing
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -427,6 +458,7 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
/* Update dataset metadata info */
iter->datasets_index_storage_size += oi->meta_size.obj.index_size;
+ iter->datasets_heap_storage_size += oi->meta_size.obj.heap_size;
/* Update attribute metadata info */
ret = attribute_stats(iter, oi);
@@ -434,7 +466,32 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
/* Get storage info */
storage = H5Dget_storage_size(did);
- iter->dset_storage_size += storage;
+
+ /* Gather layout statistics */
+ dcpl = H5Dget_create_plist(did);
+ assert(dcpl > 0);
+
+ lout = H5Pget_layout(dcpl);
+ assert(lout >= 0);
+
+ /* Object header's total size for H5D_COMPACT layout includes raw data size */
+ /* "storage" also includes H5D_COMPACT raw data size */
+ if(lout == H5D_COMPACT)
+ iter->dset_ohdr_info.total_size -= storage;
+
+ /* Track the layout type for dataset */
+ (iter->dset_layouts[lout])++;
+
+ /* Get the number of external files for the dataset */
+ num_ext = H5Pget_external_count(dcpl);
+ assert (num_ext >= 0);
+
+ /* Accumulate raw data size accordingly */
+ if(num_ext) {
+ iter->nexternal += (unsigned long)num_ext;
+ iter->dset_external_storage_size += (unsigned long)storage;
+ } else
+ iter->dset_storage_size += storage;
/* Gather dataspace statistics */
sid = H5Dget_space(did);
@@ -517,22 +574,6 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
ret = H5Tclose(tid);
assert(ret >= 0);
- /* Gather layout statistics */
- dcpl = H5Dget_create_plist(did);
- assert(dcpl > 0);
-
- lout = H5Pget_layout(dcpl);
- assert(lout >= 0);
-
- /* Track the layout type for dataset */
- (iter->dset_layouts[lout])++;
-
- num_ext = H5Pget_external_count(dcpl);
- assert (num_ext >= 0);
-
- if(num_ext)
- iter->nexternal += (unsigned long)num_ext;
-
/* Track different filters */
if((nfltr = H5Pget_nfilters(dcpl)) >= 0) {
if(nfltr == 0)
@@ -587,8 +628,7 @@ datatype_stats(iter_t *iter, const H5O_info_t *oi)
* Purpose: Gather statistics about an object
*
* Return: Success: 0
- *
- * Failure: -1
+ * Failure: -1
*
* Programmer: Quincey Koziol
* Tuesday, November 6, 2007
@@ -666,6 +706,66 @@ lnk_stats(const char UNUSED *path, const H5L_info_t *li, void *_iter)
return 0;
} /* end lnk_stats() */
+/*-------------------------------------------------------------------------
+ * Function: freespace_stats
+ *
+ * Purpose: Gather statistics for free space sections in the file
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Vailin Choi; July 7th, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+freespace_stats(hid_t fid, iter_t *iter)
+{
+ H5F_sect_info_t *sect_info = NULL; /* Free space sections */
+ ssize_t nsects; /* Number of free space sections */
+ size_t u; /* Local index variable */
+
+ /* Query section information */
+ if((nsects = H5Fget_free_sections(fid, H5FD_MEM_DEFAULT, 0, NULL)) < 0)
+ return(FAIL);
+ else if(nsects) {
+ if(NULL == (sect_info = (H5F_sect_info_t *)calloc((size_t)nsects, sizeof(H5F_sect_info_t))))
+ return(FAIL);
+ nsects = H5Fget_free_sections(fid, H5FD_MEM_DEFAULT, (size_t)nsects, sect_info);
+ assert(nsects);
+ } /* end else-if */
+
+ for(u = 0; u < (size_t)nsects; u++) {
+ unsigned bin; /* "bin" the number of objects falls in */
+
+ if(sect_info[u].size < SIZE_SMALL_SECTS)
+ (iter->num_small_sects[(size_t)sect_info[u].size])++;
+
+ /* Add section size to proper bin */
+ bin = ceil_log10((unsigned long)sect_info[u].size);
+ if(bin >= iter->sect_nbins) {
+ /* Allocate more storage for section info */
+ iter->sect_bins = (unsigned long *)realloc(iter->sect_bins, (bin + 1) * sizeof(unsigned long));
+ assert(iter->sect_bins);
+
+ /* Initialize counts for intermediate bins */
+ while(iter->sect_nbins < bin)
+ iter->sect_bins[iter->sect_nbins++] = 0;
+ iter->sect_nbins++;
+
+ /* Initialize count for this bin */
+ iter->sect_bins[bin] = 1;
+ } /* end if */
+ else
+ (iter->sect_bins[bin])++;
+ } /* end for */
+
+ if(sect_info)
+ free(sect_info);
+
+ return 0;
+} /* end freespace_stats() */
+
/*-------------------------------------------------------------------------
* Function: parse_command_line
@@ -679,6 +779,11 @@ lnk_stats(const char UNUSED *path, const H5L_info_t *li, void *_iter)
* Programmer: Elena Pourmal
* Saturday, August 12, 2006
*
+ * Modifications:
+ * Vailin Choi; October 2009
+ * Turn on display_group_metadata, display_dset_metadata
+ * Add 'S' & 's' for printing free space info (previous checkin)
+ *
*-------------------------------------------------------------------------
*/
static struct handler_t *
@@ -693,11 +798,16 @@ parse_command_line(int argc, const char *argv[])
/* parse command line options */
while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) {
switch ((char)opt) {
- case 'A':
- display_all = FALSE;
- display_attr = TRUE;
+ case 'h':
+ usage(progname);
+ leave(EXIT_SUCCESS);
+
+ case 'v':
+ print_version(progname);
+ leave(EXIT_SUCCESS);
break;
+
case 'F':
display_all = FALSE;
display_file_metadata = TRUE;
@@ -710,6 +820,7 @@ parse_command_line(int argc, const char *argv[])
case 'G':
display_all = FALSE;
+ display_group_metadata = TRUE;
break;
case 'g':
@@ -717,13 +828,9 @@ parse_command_line(int argc, const char *argv[])
display_group = TRUE;
break;
- case 'T':
- display_all = FALSE;
- display_dtype_metadata = TRUE;
- break;
-
case 'D':
display_all = FALSE;
+ display_dset_metadata = TRUE;
break;
case 'd':
@@ -731,16 +838,28 @@ parse_command_line(int argc, const char *argv[])
display_dset = TRUE;
break;
- case 'h':
- usage(progname);
- leave(EXIT_SUCCESS);
+ case 'T':
+ display_all = FALSE;
+ display_dset_dtype_info = TRUE;
+ break;
- case 'V':
- print_version(progname);
- leave(EXIT_SUCCESS);
+ case 'a':
+ display_all = FALSE;
+ display_attr = TRUE;
+ break;
+
+ case 's':
+ display_all = FALSE;
+ display_free_sections = TRUE;
+ break;
+
+ case 'S':
+ display_all = FALSE;
+ display_summary = TRUE;
break;
case 'O':
+ display_all = FALSE;
display_object = TRUE;
for(i = 0; i < argc; i++)
if(!hand[i].obj) {
@@ -815,62 +934,14 @@ print_file_info(const iter_t *iter)
printf("File information\n");
printf("\t# of unique groups: %lu\n", iter->uniq_groups);
printf("\t# of unique datasets: %lu\n", iter->uniq_dsets);
- printf("\t# of unique named dataypes: %lu\n", iter->uniq_dtypes);
+ printf("\t# of unique named datatypes: %lu\n", iter->uniq_dtypes);
printf("\t# of unique links: %lu\n", iter->uniq_links);
printf("\t# of unique other: %lu\n", iter->uniq_others);
printf("\tMax. # of links to object: %lu\n", iter->max_links);
HDfprintf(stdout, "\tMax. # of objects in group: %Hu\n", iter->max_fanout);
return 0;
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: print_file_metadata
- *
- * Purpose: Prints metadata information about file
- *
- * Return: Success: 0
- *
- * Failure: Never fails
- *
- * Programmer: Elena Pourmal
- * Saturday, August 12, 2006
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-print_file_metadata(const iter_t *iter)
-{
- printf("Object header size: (total/unused)\n");
- HDfprintf(stdout, "\tGroups: %Hu/%Hu\n", iter->group_ohdr_info.total_size,
- iter->group_ohdr_info.free_size);
- HDfprintf(stdout, "\tDatasets: %Hu/%Hu\n", iter->dset_ohdr_info.total_size,
- iter->dset_ohdr_info.free_size);
- HDfprintf(stdout, "\tDatatypes: %Hu/%Hu\n", iter->dtype_ohdr_info.total_size,
- iter->dtype_ohdr_info.free_size);
-
- printf("Storage information:\n");
- HDfprintf(stdout, "\tGroups:\n");
- HDfprintf(stdout, "\t\tB-tree/List: %Hu\n", iter->groups_btree_storage_size);
- HDfprintf(stdout, "\t\tHeap: %Hu\n", iter->groups_heap_storage_size);
-
- HDfprintf(stdout, "\tAttributes:\n");
- HDfprintf(stdout, "\t\tB-tree/List: %Hu\n", iter->attrs_btree_storage_size);
- HDfprintf(stdout, "\t\tHeap: %Hu\n", iter->attrs_heap_storage_size);
-
- HDfprintf(stdout, "\tChunked datasets:\n");
- HDfprintf(stdout, "\t\tIndex: %Hu\n", iter->datasets_index_storage_size);
-
- HDfprintf(stdout, "\tShared Messages:\n");
- HDfprintf(stdout, "\t\tHeader: %Hu\n", iter->SM_hdr_storage_size);
- HDfprintf(stdout, "\t\tB-tree/List: %Hu\n", iter->SM_index_storage_size);
- HDfprintf(stdout, "\t\tHeap: %Hu\n", iter->SM_heap_storage_size);
-
- HDfprintf(stdout, "\tSuperblock extension: %Hu\n", iter->super_ext_size);
-
- return 0;
-}
+} /* print_file_info() */
/*-------------------------------------------------------------------------
@@ -927,7 +998,7 @@ print_group_info(const iter_t *iter)
printf("\tTotal # of groups: %lu\n", total);
return 0;
-}
+} /* print_group_info() */
/*-------------------------------------------------------------------------
@@ -978,7 +1049,7 @@ print_attr_info(const iter_t *iter)
printf("\tMax. # of attributes to objects: %lu\n", (unsigned long)iter->max_attrs);
return 0;
-}
+} /* print_attr_info() */
/*-------------------------------------------------------------------------
@@ -1002,7 +1073,6 @@ print_dataset_info(const iter_t *iter)
{
unsigned long power; /* Temporary "power" for bins */
unsigned long total; /* Total count for various statistics */
- size_t dtype_size; /* Size of encoded datatype */
unsigned u; /* Local index variable */
if(iter->uniq_dsets > 0) {
@@ -1048,6 +1118,7 @@ print_dataset_info(const iter_t *iter)
printf("Dataset storage information:\n");
HDfprintf(stdout, "\tTotal raw data size: %Hu\n", iter->dset_storage_size);
+ HDfprintf(stdout, "\tTotal external raw data size: %Hu\n", iter->dset_external_storage_size);
printf("Dataset layout information:\n");
for(u = 0; u < H5D_NLAYOUTS; u++)
@@ -1065,26 +1136,286 @@ print_dataset_info(const iter_t *iter)
printf("\t\tNBIT filter: %lu\n", iter->dset_comptype[H5Z_FILTER_NBIT]);
printf("\t\tSCALEOFFSET filter: %lu\n", iter->dset_comptype[H5Z_FILTER_SCALEOFFSET]);
printf("\t\tUSER-DEFINED filter: %lu\n", iter->dset_comptype[H5_NFILTERS_IMPL-1]);
-
- if(display_dtype_metadata) {
- printf("Dataset datatype information:\n");
- printf("\t# of unique datatypes used by datasets: %lu\n", iter->dset_ntypes);
- total = 0;
- for(u = 0; u < iter->dset_ntypes; u++) {
- H5Tencode(iter->dset_type_info[u].tid, NULL, &dtype_size);
- printf("\tDataset datatype #%u:\n", u);
- printf("\t\tCount (total/named) = (%lu/%lu)\n", iter->dset_type_info[u].count, iter->dset_type_info[u].named);
- printf("\t\tSize (desc./elmt) = (%lu/%lu)\n", (unsigned long)dtype_size,
- (unsigned long)H5Tget_size(iter->dset_type_info[u].tid));
- H5Tclose(iter->dset_type_info[u].tid);
- total += iter->dset_type_info[u].count;
- } /* end for */
- printf("\tTotal dataset datatype count: %lu\n", total);
- }
} /* end if */
return 0;
-}
+} /* print_dataset_info() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: print_dset_dtype_info
+ *
+ * Purpose: Prints datasets' datatype information
+ *
+ * Return: Success: 0
+ *
+ * Failure: Never fails
+ *
+ * Programmer:
+ *
+ * Modifications:
+ * Vailin Choi; October 2009
+ * Moved from print_dataset_info()
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+print_dset_dtype_info(const iter_t *iter)
+{
+ unsigned long total; /* Total count for various statistics */
+ size_t dtype_size; /* Size of encoded datatype */
+ unsigned u; /* Local index variable */
+
+ if(iter->dset_ntypes) {
+ printf("Dataset datatype information:\n");
+ printf("\t# of unique datatypes used by datasets: %lu\n", iter->dset_ntypes);
+ total = 0;
+ for(u = 0; u < iter->dset_ntypes; u++) {
+ H5Tencode(iter->dset_type_info[u].tid, NULL, &dtype_size);
+ printf("\tDataset datatype #%u:\n", u);
+ printf("\t\tCount (total/named) = (%lu/%lu)\n",
+ iter->dset_type_info[u].count, iter->dset_type_info[u].named);
+ printf("\t\tSize (desc./elmt) = (%lu/%lu)\n", (unsigned long)dtype_size,
+ (unsigned long)H5Tget_size(iter->dset_type_info[u].tid));
+ H5Tclose(iter->dset_type_info[u].tid);
+ total += iter->dset_type_info[u].count;
+ } /* end for */
+ printf("\tTotal dataset datatype count: %lu\n", total);
+ }
+
+ return 0;
+} /* print_dset_dtype_info() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: print_freespace_info
+ *
+ * Purpose: Prints information about free space in the file
+ *
+ * Return: Success: 0
+ *
+ * Failure: Never fails
+ *
+ * Programmer: Vailin Choi; July 7th, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+print_freespace_info(const iter_t *iter)
+{
+ unsigned long power; /* Temporary "power" for bins */
+ unsigned long total; /* Total count for various statistics */
+ unsigned u; /* Local index variable */
+
+ HDfprintf(stdout, "Free-space section threshold: %Hu bytes\n", iter->fs_threshold);
+ printf("Small size free-space sections (< %u bytes):\n", (unsigned)SIZE_SMALL_SECTS);
+ total = 0;
+ for(u = 0; u < SIZE_SMALL_SECTS; u++) {
+ if(iter->num_small_sects[u] > 0) {
+ printf("\t# of sections of size %u: %lu\n", u, iter->num_small_sects[u]);
+ total += iter->num_small_sects[u];
+ } /* end if */
+ } /* end for */
+ printf("\tTotal # of small size sections: %lu\n", total);
+
+ printf("Free-space section bins:\n");
+
+ total = 0;
+ power = 1;
+ for(u = 1; u < iter->sect_nbins; u++) {
+ if(iter->sect_bins[u] > 0) {
+ printf("\t# of sections of size %lu - %lu: %lu\n", power, (power * 10) - 1,
+ iter->sect_bins[u]);
+ total += iter->sect_bins[u];
+ } /* end if */
+ power *= 10;
+ } /* end for */
+ printf("\tTotal # of sections: %lu\n", total);
+
+ return 0;
+} /* print_freespace_info() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: print_storage_summary
+ *
+ * Purpose: Prints file space information for the file
+ *
+ * Return: Success: 0
+ *
+ * Failure: Never fails
+ *
+ * Programmer: Vailin Choi; August 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+print_storage_summary(const iter_t *iter)
+{
+ hsize_t total_meta = 0;
+ hsize_t unaccount = 0;
+ float percent = 0.0;
+
+ HDfprintf(stdout, "File space management strategy: %s\n", FS_STRATEGY_NAME[iter->fs_strategy]);
+ printf("Summary of file space information:\n");
+ total_meta =
+ iter->super_size + iter->super_ext_size + iter->ublk_size +
+ iter->group_ohdr_info.total_size +
+ iter->dset_ohdr_info.total_size +
+ iter->dtype_ohdr_info.total_size +
+ iter->groups_btree_storage_size +
+ iter->groups_heap_storage_size +
+ iter->attrs_btree_storage_size +
+ iter->attrs_heap_storage_size +
+ iter->datasets_index_storage_size +
+ iter->datasets_heap_storage_size +
+ iter->SM_hdr_storage_size +
+ iter->SM_index_storage_size +
+ iter->SM_heap_storage_size +
+ iter->free_hdr;
+
+ HDfprintf(stdout, " File metadata: %Hu bytes\n", total_meta);
+ HDfprintf(stdout, " Raw data: %Hu bytes\n", iter->dset_storage_size);
+
+ percent = ((float)iter->free_space / (float)iter->filesize) * 100;
+ HDfprintf(stdout, " Amount/Percent of tracked free space: %Hu bytes/%3.1f%\n",
+ iter->free_space, percent);
+
+ if(iter->filesize < (total_meta+iter->dset_storage_size+iter->free_space)) {
+ unaccount = (total_meta + iter->dset_storage_size + iter->free_space) - iter->filesize;
+ HDfprintf(stdout, " ??? File has %Hu more bytes accounted for than its size! ???\n", unaccount);
+ }
+ else {
+ unaccount = iter->filesize - (total_meta + iter->dset_storage_size + iter->free_space);
+ HDfprintf(stdout, " Unaccounted space: %Hu bytes\n", unaccount);
+ }
+
+ HDfprintf(stdout, "Total space: %Hu bytes\n",
+ total_meta+iter->dset_storage_size+iter->free_space+unaccount);
+
+ if(iter->nexternal)
+ HDfprintf(stdout, "External raw data: %Hu bytes\n", iter->dset_external_storage_size);
+
+
+ return 0;
+} /* print_storage_summary() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: print_file_metadata
+ *
+ * Purpose: Prints file space information for file's metadata
+ *
+ * Return: Success: 0
+ *
+ * Failure: Never fails
+ *
+ * Programmer: Elena Pourmal
+ * Saturday, August 12, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+print_file_metadata(const iter_t *iter)
+{
+ HDfprintf(stdout, "File space information for file metadata (in bytes):\n");
+ HDfprintf(stdout, "\tSuperblock: %Hu\n", iter->super_size);
+ HDfprintf(stdout, "\tSuperblock extension: %Hu\n", iter->super_ext_size);
+ HDfprintf(stdout, "\tUser block: %Hu\n", iter->ublk_size);
+
+ HDfprintf(stdout, "\tObject headers: (total/unused)\n");
+ HDfprintf(stdout, "\t\tGroups: %Hu/%Hu\n",
+ iter->group_ohdr_info.total_size,
+ iter->group_ohdr_info.free_size);
+ HDfprintf(stdout, "\t\tDatasets(exclude compact data): %Hu/%Hu\n",
+ iter->dset_ohdr_info.total_size,
+ iter->dset_ohdr_info.free_size);
+ HDfprintf(stdout, "\t\tDatatypes: %Hu/%Hu\n",
+ iter->dtype_ohdr_info.total_size,
+ iter->dtype_ohdr_info.free_size);
+
+ HDfprintf(stdout, "\tGroups:\n");
+ HDfprintf(stdout, "\t\tB-tree/List: %Hu\n", iter->groups_btree_storage_size);
+ HDfprintf(stdout, "\t\tHeap: %Hu\n", iter->groups_heap_storage_size);
+
+ HDfprintf(stdout, "\tAttributes:\n");
+ HDfprintf(stdout, "\t\tB-tree/List: %Hu\n", iter->attrs_btree_storage_size);
+ HDfprintf(stdout, "\t\tHeap: %Hu\n", iter->attrs_heap_storage_size);
+
+ HDfprintf(stdout, "\tChunked datasets:\n");
+ HDfprintf(stdout, "\t\tIndex: %Hu\n", iter->datasets_index_storage_size);
+
+ HDfprintf(stdout, "\tDatasets:\n");
+ HDfprintf(stdout, "\t\tHeap: %Hu\n", iter->datasets_heap_storage_size);
+
+ HDfprintf(stdout, "\tShared Messages:\n");
+ HDfprintf(stdout, "\t\tHeader: %Hu\n", iter->SM_hdr_storage_size);
+ HDfprintf(stdout, "\t\tB-tree/List: %Hu\n", iter->SM_index_storage_size);
+ HDfprintf(stdout, "\t\tHeap: %Hu\n", iter->SM_heap_storage_size);
+
+ HDfprintf(stdout, "\tFree-space managers:\n");
+ HDfprintf(stdout, "\t\tHeader: %Hu\n", iter->free_hdr);
+ HDfprintf(stdout, "\t\tAmount of free space: %Hu\n", iter->free_space);
+
+ return 0;
+} /* print_file_metadata() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: print_group_metadata
+ *
+ * Purpose: Prints file space information for groups' metadata
+ *
+ * Return: Success: 0
+ *
+ * Failure: Never fails
+ *
+ * Programmer: Vailin Choi; October 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+print_group_metadata(const iter_t *iter)
+{
+ printf("File space information for groups' metadata (in bytes):\n");
+
+ HDfprintf(stdout, "\tObject headers (total/unused): %Hu/%Hu\n",
+ iter->group_ohdr_info.total_size, iter->group_ohdr_info.free_size);
+
+ HDfprintf(stdout, "\tB-tree/List: %Hu\n", iter->groups_btree_storage_size);
+ HDfprintf(stdout, "\tHeap: %Hu\n", iter->groups_heap_storage_size);
+
+ return 0;
+} /* print_group_metadata() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: print_dataset_metadata
+ *
+ * Purpose: Prints file space information for datasets' metadata
+ *
+ * Return: Success: 0
+ *
+ * Failure: Never fails
+ *
+ * Programmer: Vailin Choi; October 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+print_dset_metadata(const iter_t *iter)
+{
+ printf("File space information for datasets' metadata (in bytes):\n");
+
+ HDfprintf(stdout, "\tObject headers (total/unused): %Hu/%Hu\n",
+ iter->dset_ohdr_info.total_size, iter->dset_ohdr_info.free_size);
+
+ HDfprintf(stdout, "\tIndex for Chunked datasets: %Hu\n",
+ iter->datasets_index_storage_size);
+ HDfprintf(stdout, "\tHeap: %Hu\n", iter->datasets_heap_storage_size);
+
+ return 0;
+} /* print_dset_metadata() */
/*-------------------------------------------------------------------------
@@ -1099,6 +1430,11 @@ print_dataset_info(const iter_t *iter)
* Programmer: Elena Pourmal
* Saturday, August 12, 2006
*
+ * Modifications:
+ * Vailin Choi; October 2009
+ * Activate "display_group_metadata", "dislay_dset_metadata" and
+ * "display_dset_dtype_info".
+ *
*-------------------------------------------------------------------------
*/
static void
@@ -1106,18 +1442,31 @@ print_file_statistics(const iter_t *iter)
{
if(display_all) {
display_file = TRUE;
- display_file_metadata = TRUE;
display_group = TRUE;
display_dset = TRUE;
- display_dtype_metadata = TRUE;
+ display_dset_dtype_info = TRUE;
display_attr = TRUE;
+ display_free_sections = TRUE;
+ display_summary = TRUE;
+
+ display_file_metadata = TRUE;
+ display_group_metadata = TRUE;
+ display_dset_metadata = TRUE;
}
- if(display_file) print_file_info(iter);
- if(display_file_metadata) print_file_metadata(iter);
- if(display_group) print_group_info(iter);
- if(display_dset) print_dataset_info(iter);
- if(display_attr) print_attr_info(iter);
+ if(display_file) print_file_info(iter);
+ if(display_file_metadata) print_file_metadata(iter);
+
+ if(display_group) print_group_info(iter);
+ if(!display_all && display_group_metadata) print_group_metadata(iter);
+
+ if(display_dset) print_dataset_info(iter);
+ if(display_dset_dtype_info) print_dset_dtype_info(iter);
+ if(!display_all && display_dset_metadata) print_dset_metadata(iter);
+
+ if(display_attr) print_attr_info(iter);
+ if(display_free_sections) print_freespace_info(iter);
+ if(display_summary) print_storage_summary(iter);
}
@@ -1176,8 +1525,9 @@ main(int argc, const char *argv[])
iter_t iter;
const char *fname = NULL;
hid_t fid;
+ hid_t fcpl;
struct handler_t *hand;
- H5F_info_t finfo;
+ H5F_info2_t finfo;
/* Disable error reporting */
H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
@@ -1203,16 +1553,37 @@ main(int argc, const char *argv[])
/* Initialize iter structure */
iter_init(&iter, fid);
- /* Get storge info for SOHM's btree/list/heap and superblock extension */
- if(H5Fget_info(fid, &finfo) < 0)
- warn_msg(progname, "Unable to retrieve SOHM info\n");
+ if(H5Fget_filesize(fid, &iter.filesize) < 0)
+ warn_msg(progname, "Unable to retrieve file size\n");
+ assert(iter.filesize != 0);
+
+ /* Get storge info for file-level structures */
+ if(H5Fget_info2(fid, &finfo) < 0)
+ warn_msg(progname, "Unable to retrieve file info\n");
else {
- iter.super_ext_size = finfo.super_ext_size;
+ iter.super_size = finfo.super.super_size;
+ iter.super_ext_size = finfo.super.super_ext_size;
iter.SM_hdr_storage_size = finfo.sohm.hdr_size;
iter.SM_index_storage_size = finfo.sohm.msgs_info.index_size;
iter.SM_heap_storage_size = finfo.sohm.msgs_info.heap_size;
+ iter.free_space = finfo.free.tot_space;
+ iter.free_hdr = finfo.free.meta_size;
} /* end else */
+ if((fcpl = H5Fget_create_plist(fid)) < 0)
+ warn_msg(progname, "Unable to retrieve file creation property\n");
+
+ if(H5Pget_userblock(fcpl, &iter.ublk_size) < 0)
+ warn_msg(progname, "Unable to retrieve userblock size\n");
+
+ if(H5Pget_file_space(fcpl, &iter.fs_strategy, &iter.fs_threshold) < 0)
+ warn_msg(progname, "Unable to retrieve file space information\n");
+ assert(iter.fs_strategy != 0 && iter.fs_strategy < H5F_FILE_SPACE_NTYPES);
+
+ /* get information for free-space sections */
+ if(freespace_stats(fid, &iter) < 0)
+ warn_msg(progname, "Unable to retrieve freespace info\n");
+
/* Walk the objects or all file */
if(display_object) {
unsigned u;
diff --git a/tools/h5stat/h5stat_gentest.c b/tools/h5stat/h5stat_gentest.c
index 2a7f210..cf17195 100644
--- a/tools/h5stat/h5stat_gentest.c
+++ b/tools/h5stat/h5stat_gentest.c
@@ -45,18 +45,30 @@
*/
static void gen_file(void)
{
- int ret, i;
- hid_t fapl, gid;
- hid_t file, type_id, space_id, attr_id, dset_id;
- char name[30];
- char attrname[30];
+ hid_t fcpl; /* File creation property */
+ hid_t fapl; /* File access property */
+ hid_t file; /* File id */
+ hid_t gid; /* Group id */
+ hid_t type_id; /* Datatype id */
+ hid_t space_id; /* Dataspace id */
+ hid_t attr_id; /* Attribute id */
+ hid_t dset_id; /* Dataset id */
+ char name[30]; /* Group name */
+ char attrname[30]; /* Attribute name */
+ int ret; /* Return value */
+ int i; /* Local index variable */
fapl = H5Pcreate(H5P_FILE_ACCESS);
ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST);
assert(ret >= 0);
+ /* Set file space handling strategy */
+ fcpl = H5Pcreate(H5P_FILE_CREATE);
+ ret = H5Pset_file_space(fcpl, H5F_FILE_SPACE_ALL_PERSIST, (hsize_t)0);
+ assert(ret >= 0);
+
/* Create dataset */
- file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, fcpl, fapl);
for(i = 1; i <= NUM_GRPS; i++) {
sprintf(name, "%s%d", GROUP_NAME,i);
gid = H5Gcreate2(file, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
diff --git a/tools/h5stat/testfiles/h5stat_filters-F.ddl b/tools/h5stat/testfiles/h5stat_filters-F.ddl
index 8f65c6d..fba875a 100644
--- a/tools/h5stat/testfiles/h5stat_filters-F.ddl
+++ b/tools/h5stat/testfiles/h5stat_filters-F.ddl
@@ -2,11 +2,14 @@
Expected output for 'h5stat -F h5stat_filters.h5'
#############################
Filename: h5stat_filters.h5
-Object header size: (total/unused)
- Groups: 48/8
- Datasets: 4936/1344
- Datatypes: 80/0
-Storage information:
+File space information for file metadata (in bytes):
+ Superblock: 96
+ Superblock extension: 0
+ User block: 0
+ Object headers: (total/unused)
+ Groups: 48/8
+ Datasets(exclude compact data): 4136/1344
+ Datatypes: 80/0
Groups:
B-tree/List: 1200
Heap: 288
@@ -15,8 +18,12 @@ Storage information:
Heap: 0
Chunked datasets:
Index: 31392
+ Datasets:
+ Heap: 72
Shared Messages:
Header: 0
B-tree/List: 0
Heap: 0
- Superblock extension: 0
+ Free-space managers:
+ Header: 0
+ Amount of free space: 0
diff --git a/tools/h5stat/testfiles/h5stat_filters-d.ddl b/tools/h5stat/testfiles/h5stat_filters-d.ddl
index 42d0de3..3cc9071 100644
--- a/tools/h5stat/testfiles/h5stat_filters-d.ddl
+++ b/tools/h5stat/testfiles/h5stat_filters-d.ddl
@@ -15,7 +15,8 @@ Dataset dimension information:
# of datasets of size 100 - 999: 1
Total # of datasets: 1
Dataset storage information:
- Total raw data size: 9059
+ Total raw data size: 8659
+ Total external raw data size: 400
Dataset layout information:
Dataset layout counts[COMPACT]: 1
Dataset layout counts[CONTIG]: 2
diff --git a/tools/h5stat/testfiles/h5stat_filters-dT.ddl b/tools/h5stat/testfiles/h5stat_filters-dT.ddl
index 2edcf7e..ae9121d 100644
--- a/tools/h5stat/testfiles/h5stat_filters-dT.ddl
+++ b/tools/h5stat/testfiles/h5stat_filters-dT.ddl
@@ -15,7 +15,8 @@ Dataset dimension information:
# of datasets of size 100 - 999: 1
Total # of datasets: 1
Dataset storage information:
- Total raw data size: 9059
+ Total raw data size: 8659
+ Total external raw data size: 400
Dataset layout information:
Dataset layout counts[COMPACT]: 1
Dataset layout counts[CONTIG]: 2
diff --git a/tools/h5stat/testfiles/h5stat_filters-file.ddl b/tools/h5stat/testfiles/h5stat_filters-file.ddl
index 7b8f47f..eddc898 100644
--- a/tools/h5stat/testfiles/h5stat_filters-file.ddl
+++ b/tools/h5stat/testfiles/h5stat_filters-file.ddl
@@ -5,7 +5,7 @@ Filename: h5stat_filters.h5
File information
# of unique groups: 1
# of unique datasets: 15
- # of unique named dataypes: 1
+ # of unique named datatypes: 1
# of unique links: 0
# of unique other: 0
Max. # of links to object: 1
diff --git a/tools/h5stat/testfiles/h5stat_filters.ddl b/tools/h5stat/testfiles/h5stat_filters.ddl
index d070dba..ddafd81 100644
--- a/tools/h5stat/testfiles/h5stat_filters.ddl
+++ b/tools/h5stat/testfiles/h5stat_filters.ddl
@@ -5,16 +5,19 @@ Filename: h5stat_filters.h5
File information
# of unique groups: 1
# of unique datasets: 15
- # of unique named dataypes: 1
+ # of unique named datatypes: 1
# of unique links: 0
# of unique other: 0
Max. # of links to object: 1
Max. # of objects in group: 16
-Object header size: (total/unused)
- Groups: 48/8
- Datasets: 4936/1344
- Datatypes: 80/0
-Storage information:
+File space information for file metadata (in bytes):
+ Superblock: 96
+ Superblock extension: 0
+ User block: 0
+ Object headers: (total/unused)
+ Groups: 48/8
+ Datasets(exclude compact data): 4136/1344
+ Datatypes: 80/0
Groups:
B-tree/List: 1200
Heap: 288
@@ -23,11 +26,15 @@ Storage information:
Heap: 0
Chunked datasets:
Index: 31392
+ Datasets:
+ Heap: 72
Shared Messages:
Header: 0
B-tree/List: 0
Heap: 0
- Superblock extension: 0
+ Free-space managers:
+ Header: 0
+ Amount of free space: 0
Small groups:
Total # of small groups: 0
Group bins:
@@ -46,7 +53,8 @@ Dataset dimension information:
# of datasets of size 100 - 999: 1
Total # of datasets: 1
Dataset storage information:
- Total raw data size: 9059
+ Total raw data size: 8659
+ Total external raw data size: 400
Dataset layout information:
Dataset layout counts[COMPACT]: 1
Dataset layout counts[CONTIG]: 2
@@ -76,3 +84,16 @@ Small # of attributes:
Attribute bins:
Total # of objects with attributes: 0
Max. # of attributes to objects: 0
+Free-space section threshold: 1 bytes
+Small size free-space sections (< 10 bytes):
+ Total # of small size sections: 0
+Free-space section bins:
+ Total # of sections: 0
+File space management strategy: H5F_FILE_SPACE_ALL
+Summary of file space information:
+ File metadata: 37312 bytes
+ Raw data: 8659 bytes
+ Amount/Percent of tracked free space: 0 bytes/0.0%
+ Unaccounted space: 301 bytes
+Total space: 46272 bytes
+External raw data: 400 bytes
diff --git a/tools/h5stat/testfiles/h5stat_help1.ddl b/tools/h5stat/testfiles/h5stat_help1.ddl
index 0a86b4c..e70fef1 100644
--- a/tools/h5stat/testfiles/h5stat_help1.ddl
+++ b/tools/h5stat/testfiles/h5stat_help1.ddl
@@ -5,13 +5,14 @@ Usage: h5stat [OPTIONS] file
OPTIONS
-h, --help Print a usage message and exit
- -V, --version Print version number and exit
+ -v, --version Print version number and exit
-f, --file Print file information
- -F, --filemetadata Print file metadata
+ -F, --FILEmetadata Print file space information for file's metadata
-g, --group Print group information
- -G, --groupmetadata Print group metadata
+ -G, --GROUPmetadata Print file space information for groups' metadata
-d, --dset Print dataset information
- -D, --dsetmetadata Print dataset metadata
- -T, --dtypemetadata Print datatype metadata
- -A, --attribute Print attribute information
-
+ -D, --DSETmetadata Print file space information for datasets' metadata
+ -T, --DSETtypeinfo Print datasets' datatype information
+ -a, --attribute Print attribute information
+ -s, --freespace Print free space information
+ -S, --summary Print summary of file space information
diff --git a/tools/h5stat/testfiles/h5stat_help2.ddl b/tools/h5stat/testfiles/h5stat_help2.ddl
index e41eb9e..fbfdd14 100644
--- a/tools/h5stat/testfiles/h5stat_help2.ddl
+++ b/tools/h5stat/testfiles/h5stat_help2.ddl
@@ -5,13 +5,14 @@ Usage: h5stat [OPTIONS] file
OPTIONS
-h, --help Print a usage message and exit
- -V, --version Print version number and exit
+ -v, --version Print version number and exit
-f, --file Print file information
- -F, --filemetadata Print file metadata
+ -F, --FILEmetadata Print file space information for file's metadata
-g, --group Print group information
- -G, --groupmetadata Print group metadata
+ -G, --GROUPmetadata Print file space information for groups' metadata
-d, --dset Print dataset information
- -D, --dsetmetadata Print dataset metadata
- -T, --dtypemetadata Print datatype metadata
- -A, --attribute Print attribute information
-
+ -D, --DSETmetadata Print file space information for datasets' metadata
+ -T, --DSETtypeinfo Print datasets' datatype information
+ -a, --attribute Print attribute information
+ -s, --freespace Print free space information
+ -S, --summary Print summary of file space information
diff --git a/tools/h5stat/testfiles/h5stat_idx.ddl b/tools/h5stat/testfiles/h5stat_idx.ddl
index f7e6031..2de3d96 100644
--- a/tools/h5stat/testfiles/h5stat_idx.ddl
+++ b/tools/h5stat/testfiles/h5stat_idx.ddl
@@ -5,16 +5,19 @@ Filename: h5stat_idx.h5
File information
# of unique groups: 1
# of unique datasets: 2
- # of unique named dataypes: 0
+ # of unique named datatypes: 0
# of unique links: 0
# of unique other: 0
Max. # of links to object: 1
Max. # of objects in group: 2
-Object header size: (total/unused)
- Groups: 147/47
- Datasets: 568/362
- Datatypes: 0/0
-Storage information:
+File space information for file metadata (in bytes):
+ Superblock: 48
+ Superblock extension: 0
+ User block: 0
+ Object headers: (total/unused)
+ Groups: 147/47
+ Datasets(exclude compact data): 568/362
+ Datatypes: 0/0
Groups:
B-tree/List: 0
Heap: 0
@@ -23,11 +26,15 @@ Storage information:
Heap: 0
Chunked datasets:
Index: 202
+ Datasets:
+ Heap: 0
Shared Messages:
Header: 0
B-tree/List: 0
Heap: 0
- Superblock extension: 0
+ Free-space managers:
+ Header: 0
+ Amount of free space: 0
Small groups:
# of groups of size 2: 1
Total # of small groups: 1
@@ -47,6 +54,7 @@ Dataset dimension information:
Total # of datasets: 2
Dataset storage information:
Total raw data size: 110
+ Total external raw data size: 0
Dataset layout information:
Dataset layout counts[COMPACT]: 0
Dataset layout counts[CONTIG]: 0
@@ -73,3 +81,15 @@ Small # of attributes:
Attribute bins:
Total # of objects with attributes: 0
Max. # of attributes to objects: 0
+Free-space section threshold: 1 bytes
+Small size free-space sections (< 10 bytes):
+ Total # of small size sections: 0
+Free-space section bins:
+ Total # of sections: 0
+File space management strategy: H5F_FILE_SPACE_ALL
+Summary of file space information:
+ File metadata: 965 bytes
+ Raw data: 110 bytes
+ Amount/Percent of tracked free space: 0 bytes/0.0%
+ Unaccounted space: 1131 bytes
+Total space: 2206 bytes
diff --git a/tools/h5stat/testfiles/h5stat_newgrat.ddl b/tools/h5stat/testfiles/h5stat_newgrat.ddl
index ce93b9c..9218a73 100644
--- a/tools/h5stat/testfiles/h5stat_newgrat.ddl
+++ b/tools/h5stat/testfiles/h5stat_newgrat.ddl
@@ -5,29 +5,36 @@ Filename: h5stat_newgrat.h5
File information
# of unique groups: 35001
# of unique datasets: 1
- # of unique named dataypes: 0
+ # of unique named datatypes: 0
# of unique links: 0
# of unique other: 0
Max. # of links to object: 1
Max. # of objects in group: 35001
-Object header size: (total/unused)
- Groups: 5145147/3220092
- Datasets: 414/312
- Datatypes: 0/0
-Storage information:
+File space information for file metadata (in bytes):
+ Superblock: 48
+ Superblock extension: 119
+ User block: 0
+ Object headers: (total/unused)
+ Groups: 5145147/3220092
+ Datasets(exclude compact data): 414/312
+ Datatypes: 0/0
Groups:
B-tree/List: 470054
- Heap: 739102
+ Heap: 739045
Attributes:
B-tree/List: 2598
- Heap: 4442
+ Heap: 4431
Chunked datasets:
Index: 0
+ Datasets:
+ Heap: 0
Shared Messages:
Header: 0
B-tree/List: 0
Heap: 0
- Superblock extension: 0
+ Free-space managers:
+ Header: 0
+ Amount of free space: 0
Small groups:
# of groups of size 0: 35000
Total # of small groups: 35000
@@ -45,6 +52,7 @@ Dataset dimension information:
Total small datasets: 0
Dataset storage information:
Total raw data size: 0
+ Total external raw data size: 0
Dataset layout information:
Dataset layout counts[COMPACT]: 0
Dataset layout counts[CONTIG]: 1
@@ -72,3 +80,15 @@ Attribute bins:
# of objects with 100 - 999 attributes: 1
Total # of objects with attributes: 1
Max. # of attributes to objects: 100
+Free-space section threshold: 1 bytes
+Small size free-space sections (< 10 bytes):
+ Total # of small size sections: 0
+Free-space section bins:
+ Total # of sections: 0
+File space management strategy: H5F_FILE_SPACE_ALL
+Summary of file space information:
+ File metadata: 6361856 bytes
+ Raw data: 0 bytes
+ Amount/Percent of tracked free space: 0 bytes/0.0%
+ Unaccounted space: 5813 bytes
+Total space: 6367669 bytes
diff --git a/tools/h5stat/testfiles/h5stat_newgrat.h5 b/tools/h5stat/testfiles/h5stat_newgrat.h5
index 8fa406b..1db0205 100644
--- a/tools/h5stat/testfiles/h5stat_newgrat.h5
+++ b/tools/h5stat/testfiles/h5stat_newgrat.h5
Binary files differ
diff --git a/tools/h5stat/testfiles/h5stat_tsohm.ddl b/tools/h5stat/testfiles/h5stat_tsohm.ddl
index 25e1784..c7ed5f4 100644
--- a/tools/h5stat/testfiles/h5stat_tsohm.ddl
+++ b/tools/h5stat/testfiles/h5stat_tsohm.ddl
@@ -5,16 +5,19 @@ Filename: h5stat_tsohm.h5
File information
# of unique groups: 1
# of unique datasets: 3
- # of unique named dataypes: 0
+ # of unique named datatypes: 0
# of unique links: 0
# of unique other: 0
Max. # of links to object: 1
Max. # of objects in group: 3
-Object header size: (total/unused)
- Groups: 51/2
- Datasets: 852/447
- Datatypes: 0/0
-Storage information:
+File space information for file metadata (in bytes):
+ Superblock: 48
+ Superblock extension: 40
+ User block: 0
+ Object headers: (total/unused)
+ Groups: 51/2
+ Datasets(exclude compact data): 852/447
+ Datatypes: 0/0
Groups:
B-tree/List: 872
Heap: 120
@@ -23,11 +26,15 @@ Storage information:
Heap: 0
Chunked datasets:
Index: 0
+ Datasets:
+ Heap: 0
Shared Messages:
Header: 38
B-tree/List: 550
Heap: 1316
- Superblock extension: 40
+ Free-space managers:
+ Header: 0
+ Amount of free space: 0
Small groups:
# of groups of size 3: 1
Total # of small groups: 1
@@ -44,6 +51,7 @@ Dataset dimension information:
Total small datasets: 0
Dataset storage information:
Total raw data size: 0
+ Total external raw data size: 0
Dataset layout information:
Dataset layout counts[COMPACT]: 0
Dataset layout counts[CONTIG]: 0
@@ -70,3 +78,15 @@ Small # of attributes:
Attribute bins:
Total # of objects with attributes: 0
Max. # of attributes to objects: 0
+Free-space section threshold: 1 bytes
+Small size free-space sections (< 10 bytes):
+ Total # of small size sections: 0
+Free-space section bins:
+ Total # of sections: 0
+File space management strategy: H5F_FILE_SPACE_ALL
+Summary of file space information:
+ File metadata: 3887 bytes
+ Raw data: 0 bytes
+ Amount/Percent of tracked free space: 0 bytes/0.0%
+ Unaccounted space: 0 bytes
+Total space: 3887 bytes
diff --git a/tools/lib/Makefile.in b/tools/lib/Makefile.in
index 55785c7..2b269ca 100644
--- a/tools/lib/Makefile.in
+++ b/tools/lib/Makefile.in
@@ -96,6 +96,16 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = /home1/packages/automake/automake-1.9.6/bin/aclocal-1.9 -I /afs/ncsa/projects/hdf/packages/libtool_1.5.14/Linux_2.4/share/aclocal
ADD_PARALLEL_FILES = @ADD_PARALLEL_FILES@
AMTAR = @AMTAR@
+
+# H5_CFLAGS holds flags that should be used when building hdf5,
+# but which should not be exported to h5cc for building other programs.
+# AM_CFLAGS is an automake construct which should be used by Makefiles
+# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
+AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
+AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@
+AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
+AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@
+AM_LDFLAGS = @AM_LDFLAGS@
AM_MAKEFLAGS = @AM_MAKEFLAGS@
AR = @AR@
@@ -109,21 +119,18 @@ BYTESEX = @BYTESEX@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CC_VERSION = @CC_VERSION@
-
-# H5_CFLAGS holds flags that should be used as CFLAGS when building hdf5,
-# but which shouldn't be exported to h5cc for building other programs.
-CFLAGS = @CFLAGS@ @H5_CFLAGS@
+CFLAGS = @CFLAGS@
CLEARFILEBUF = @CLEARFILEBUF@
CODESTACK = @CODESTACK@
CONFIG_DATE = @CONFIG_DATE@
CONFIG_MODE = @CONFIG_MODE@
CONFIG_USER = @CONFIG_USER@
CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@ @H5_CPPFLAGS@
+CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@ @H5_CXXFLAGS@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_PKG = @DEBUG_PKG@
DEFAULT_API_VERSION = @DEFAULT_API_VERSION@
@@ -146,7 +153,7 @@ F9XMODEXT = @F9XMODEXT@
F9XMODFLAG = @F9XMODFLAG@
F9XSUFFIXFLAG = @F9XSUFFIXFLAG@
FC = @FC@
-FCFLAGS = @FCFLAGS@ @H5_FCFLAGS@
+FCFLAGS = @FCFLAGS@
FCFLAGS_f90 = @FCFLAGS_f90@
FCLIBS = @FCLIBS@
FGREP = @FGREP@
diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c
index 77ee74a..848ba90 100644
--- a/tools/lib/h5diff_array.c
+++ b/tools/lib/h5diff_array.c
@@ -5595,7 +5595,7 @@ hbool_t equal_ldouble(long double value, long double expected, diff_opt_t *optio
return TRUE;
if (options->use_system_epsilon) {
- if ( ABS( (value-expected) / expected) < DBL_EPSILON)
+ if ( ABS( (value-expected) ) < DBL_EPSILON)
return TRUE;
}
@@ -5652,7 +5652,7 @@ hbool_t equal_float(float value, float expected, diff_opt_t *options)
return TRUE;
if (options->use_system_epsilon) {
- if ( ABS( (value-expected) / expected) < FLT_EPSILON)
+ if ( ABS( (value-expected) ) < FLT_EPSILON)
return TRUE;
}
diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c
index dc6b694..fb4bd55 100644
--- a/tools/lib/h5tools.c
+++ b/tools/lib/h5tools.c
@@ -1581,6 +1581,9 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id,
done:
free(ptdata);
+ if(H5Tclose(type_id) < 0)
+ HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed");
+
if(H5Tclose(dtype) < 0)
HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed");
@@ -1880,6 +1883,9 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id,
done:
free(ptdata);
+
+ if(H5Tclose(type_id) < 0)
+ HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed");
if(H5Tclose(dtype) < 0)
HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed");
diff --git a/tools/misc/Makefile.am b/tools/misc/Makefile.am
index fe1acbd..11c86fa 100644
--- a/tools/misc/Makefile.am
+++ b/tools/misc/Makefile.am
@@ -36,9 +36,9 @@ bin_PROGRAMS=h5debug h5repart h5mkgrp
bin_SCRIPTS=h5redeploy
# Add h5debug, h5repart, and h5mkgrp specific linker flags here
-h5debug_LDFLAGS = $(LT_STATIC_EXEC)
-h5repart_LDFLAGS = $(LT_STATIC_EXEC)
-h5mkgrp_LDFLAGS = $(LT_STATIC_EXEC)
+h5debug_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+h5repart_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+h5mkgrp_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
# Tell automake to clean h5redeploy script
CLEANFILES=h5redeploy
diff --git a/tools/misc/Makefile.in b/tools/misc/Makefile.in
index 78a42b8..a3d3e23 100644
--- a/tools/misc/Makefile.in
+++ b/tools/misc/Makefile.in
@@ -151,6 +151,16 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = /home1/packages/automake/automake-1.9.6/bin/aclocal-1.9 -I /afs/ncsa/projects/hdf/packages/libtool_1.5.14/Linux_2.4/share/aclocal
ADD_PARALLEL_FILES = @ADD_PARALLEL_FILES@
AMTAR = @AMTAR@
+
+# H5_CFLAGS holds flags that should be used when building hdf5,
+# but which should not be exported to h5cc for building other programs.
+# AM_CFLAGS is an automake construct which should be used by Makefiles
+# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
+AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
+AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@
+AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
+AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@
+AM_LDFLAGS = @AM_LDFLAGS@
AM_MAKEFLAGS = @AM_MAKEFLAGS@
AR = @AR@
@@ -164,21 +174,18 @@ BYTESEX = @BYTESEX@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CC_VERSION = @CC_VERSION@
-
-# H5_CFLAGS holds flags that should be used as CFLAGS when building hdf5,
-# but which shouldn't be exported to h5cc for building other programs.
-CFLAGS = @CFLAGS@ @H5_CFLAGS@
+CFLAGS = @CFLAGS@
CLEARFILEBUF = @CLEARFILEBUF@
CODESTACK = @CODESTACK@
CONFIG_DATE = @CONFIG_DATE@
CONFIG_MODE = @CONFIG_MODE@
CONFIG_USER = @CONFIG_USER@
CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@ @H5_CPPFLAGS@
+CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@ @H5_CXXFLAGS@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_PKG = @DEBUG_PKG@
DEFAULT_API_VERSION = @DEFAULT_API_VERSION@
@@ -201,7 +208,7 @@ F9XMODEXT = @F9XMODEXT@
F9XMODFLAG = @F9XMODFLAG@
F9XSUFFIXFLAG = @F9XSUFFIXFLAG@
FC = @FC@
-FCFLAGS = @FCFLAGS@ @H5_FCFLAGS@
+FCFLAGS = @FCFLAGS@
FCFLAGS_f90 = @FCFLAGS_f90@
FCLIBS = @FCLIBS@
FGREP = @FGREP@
@@ -415,9 +422,9 @@ SCRIPT_DEPEND = h5repart$(EXEEXT) h5mkgrp$(EXEEXT)
bin_SCRIPTS = h5redeploy
# Add h5debug, h5repart, and h5mkgrp specific linker flags here
-h5debug_LDFLAGS = $(LT_STATIC_EXEC)
-h5repart_LDFLAGS = $(LT_STATIC_EXEC)
-h5mkgrp_LDFLAGS = $(LT_STATIC_EXEC)
+h5debug_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+h5repart_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+h5mkgrp_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
# Tell automake to clean h5redeploy script
CLEANFILES = h5redeploy
diff --git a/tools/misc/h5cc.in b/tools/misc/h5cc.in
index 1ead951..28f0dee 100755
--- a/tools/misc/h5cc.in
+++ b/tools/misc/h5cc.in
@@ -58,9 +58,9 @@ get_output_file="no"
SHOW="eval"
CCBASE="@CC@"
CLINKERBASE="@CC@"
-CFLAGS="@CFLAGS@"
-CPPFLAGS="@CPPFLAGS@"
-LDFLAGS="@LDFLAGS@"
+CFLAGS="@AM_CFLAGS@ @CFLAGS@"
+CPPFLAGS="@AM_CPPFLAGS@ @CPPFLAGS@"
+LDFLAGS="@AM_LDFLAGS@ @LDFLAGS@"
LIBS="@LIBS@"
CC="${HDF5_CC:-$CCBASE}"
@@ -318,7 +318,7 @@ if test "x$do_link" = "xyes"; then
# module. It's okay if they're included twice in the compile line.
link_args="$link_args $LIBS"
- $SHOW $CLINKER $CFLAGS $LDFLAGS $clibpath $link_objs $link_args $shared_link
+ $SHOW $CLINKER $CFLAGS $clibpath $link_objs $link_args $shared_link $LDFLAGS
status=$?
fi
diff --git a/tools/testfiles/file_space.ddl b/tools/testfiles/file_space.ddl
new file mode 100644
index 0000000..d4d3a3c
--- /dev/null
+++ b/tools/testfiles/file_space.ddl
@@ -0,0 +1,23 @@
+#############################
+Expected output for 'h5dump -B file_space.h5'
+#############################
+HDF5 "file_space.h5" {
+SUPER_BLOCK {
+ SUPERBLOCK_VERSION 2
+ FREELIST_VERSION 0
+ SYMBOLTABLE_VERSION 0
+ OBJECTHEADER_VERSION 0
+ OFFSET_SIZE 8
+ LENGTH_SIZE 8
+ BTREE_RANK 16
+ BTREE_LEAF 4
+ ISTORE_K 32
+ FILE_SPACE_STRATEGY H5F_FILE_SPACE_ALL
+ FREE_SPACE_THRESHOLD 1
+}
+USER_BLOCK {
+ USERBLOCK_SIZE 0
+}
+GROUP "/" {
+}
+}
diff --git a/tools/testfiles/file_space.h5 b/tools/testfiles/file_space.h5
new file mode 100644
index 0000000..48184d3
--- /dev/null
+++ b/tools/testfiles/file_space.h5
Binary files differ
diff --git a/tools/testfiles/tboot1.ddl b/tools/testfiles/tboot1.ddl
index 9a7cafc..8ffffc0 100644
--- a/tools/testfiles/tboot1.ddl
+++ b/tools/testfiles/tboot1.ddl
@@ -12,6 +12,8 @@ SUPER_BLOCK {
BTREE_RANK 16
BTREE_LEAF 4
ISTORE_K 32
+ FILE_SPACE_STRATEGY H5F_FILE_SPACE_ALL
+ FREE_SPACE_THRESHOLD 1
}
USER_BLOCK {
USERBLOCK_SIZE 0
diff --git a/tools/testfiles/tboot2.ddl b/tools/testfiles/tboot2.ddl
index d1484ca..51250fe 100644
--- a/tools/testfiles/tboot2.ddl
+++ b/tools/testfiles/tboot2.ddl
@@ -12,6 +12,8 @@ SUPER_BLOCK {
BTREE_RANK 16
BTREE_LEAF 4
ISTORE_K 32
+ FILE_SPACE_STRATEGY H5F_FILE_SPACE_ALL
+ FREE_SPACE_THRESHOLD 1
}
USER_BLOCK {
USERBLOCK_SIZE 0
diff --git a/vms/src/h5pubconf.h b/vms/src/h5pubconf.h
index 1a4e7a3..5087006 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.47-FA_a4"
+#define H5_PACKAGE_STRING "HDF5 1.9.51-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.47-FA_a4"
+#define H5_PACKAGE_VERSION "1.9.51-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.47-FA_a4"
+#define H5_VERSION "1.9.51-FA_a4"
/* Define if vsnprintf() returns the correct value for formatted strings that
don't fit into size allowed */
diff --git a/windows/c++/test/checkcpptests.bat b/windows/c++/test/checkcpptests.bat
index e092c04..93ccd2b 100644
--- a/windows/c++/test/checkcpptests.bat
+++ b/windows/c++/test/checkcpptests.bat
@@ -22,6 +22,8 @@ rem
setlocal enabledelayedexpansion
pushd %~dp0
+set /a nerrors=0
+
rem Clean any variables starting with "HDF5_CPPTEST_", as we use these for our
rem tests. Also clear "HDF5_CPPTEST_TESTS", as we will be addding all of our tests
rem to this variable.
@@ -61,12 +63,16 @@ rem %2 - "dll" or nothing
rem Only add our parameters for batch scripts.
call !hdf5_cpptest_%%a_test:.bat= %1 %2!
rem Exit early if test fails.
- if !errorlevel! neq 0 exit /b
+ if errorlevel 1 (
+ set /a nerrors=!nerrors!+1
+ echo.
+ echo.************************************
+ echo. Testing %%a ^(%1 %2^) FAILED
+ exit /b 1
+ )
)
rem If we get here, that means all of our tests passed.
- echo.All C++ library tests passed.
-
exit /b
@@ -83,6 +89,12 @@ rem on it for sending parameters. --SJW 9/6/07
rem Run the tests, passing in which version to run
call :run_tests %*
+ if "%nerrors%"=="0" (
+ echo.All C++ library tests passed.
+ ) else (
+ echo.** FAILED C++ Library tests.
+ )
+
popd
- endlocal & exit /b
+ endlocal & exit /b %nerrors%
\ No newline at end of file
diff --git a/windows/c++/test/testhdf5_cpp/testhdf5_cpp.vcproj b/windows/c++/test/testhdf5_cpp/testhdf5_cpp.vcproj
index c795d28..0d872af 100644
--- a/windows/c++/test/testhdf5_cpp/testhdf5_cpp.vcproj
+++ b/windows/c++/test/testhdf5_cpp/testhdf5_cpp.vcproj
@@ -428,6 +428,10 @@
>
</File>
<File
+ RelativePath="..\..\..\..\c++\test\tlinks.cpp"
+ >
+ </File>
+ <File
RelativePath="..\..\..\..\c++\test\trefer.cpp"
>
</File>
diff --git a/windows/c++/test/testhdf5_cppdll/testhdf5_cppdll.vcproj b/windows/c++/test/testhdf5_cppdll/testhdf5_cppdll.vcproj
index b169201..4ceef84 100644
--- a/windows/c++/test/testhdf5_cppdll/testhdf5_cppdll.vcproj
+++ b/windows/c++/test/testhdf5_cppdll/testhdf5_cppdll.vcproj
@@ -428,6 +428,10 @@
>
</File>
<File
+ RelativePath="..\..\..\..\c++\test\tlinks.cpp"
+ >
+ </File>
+ <File
RelativePath="..\..\..\..\c++\test\trefer.cpp"
>
</File>
diff --git a/windows/examples/allexamples/allexamples.vcproj b/windows/examples/allexamples/allexamples.vcproj
index 4c87ec0..d426da9 100644
--- a/windows/examples/allexamples/allexamples.vcproj
+++ b/windows/examples/allexamples/allexamples.vcproj
@@ -21,7 +21,7 @@
Name="Release|Win32"
OutputDirectory="..\..\..\examples\$(ProjectName)\$(ConfigurationName)"
IntermediateDirectory="$(OutDir)"
- ConfigurationType="1"
+ ConfigurationType="10"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
@@ -109,7 +109,7 @@
Name="Release|x64"
OutputDirectory="..\..\..\examples\$(ProjectName)\$(ConfigurationName)"
IntermediateDirectory="$(OutDir)"
- ConfigurationType="1"
+ ConfigurationType="10"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
@@ -198,7 +198,7 @@
Name="Debug|Win32"
OutputDirectory="..\..\..\examples\$(ProjectName)\$(ConfigurationName)"
IntermediateDirectory="$(OutDir)"
- ConfigurationType="1"
+ ConfigurationType="10"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
@@ -286,7 +286,7 @@
Name="Debug|x64"
OutputDirectory="..\..\..\examples\$(ProjectName)\$(ConfigurationName)"
IntermediateDirectory="$(OutDir)"
- ConfigurationType="1"
+ ConfigurationType="10"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
diff --git a/windows/examples/testExamples.bat b/windows/examples/testExamples.bat
index 57aa19c..e6367ac 100755
--- a/windows/examples/testExamples.bat
+++ b/windows/examples/testExamples.bat
@@ -19,111 +19,17 @@ REM Last Modified: 10/16/2004
if %1.==. GOTO WRONG
if "%1"=="/?" GOTO HELP
-if %1==release GOTO RELEASE
-if %1==debug GOTO DEBUG
-GOTO WRONG
-:RELEASE
-if %2.==. GOTO REL
-if %2==dll GOTO RELDLL
-GOTO WRONG
-
-:REL
-type nul > %1.txt
-cd examplesREL
-attributetest >> ..\%1.txt
-compoundtest >> ..\%1.txt
-extendwritetest >> ..\%1.txt
-grouptest >> ..\%1.txt
-intermgrouptest >> ..\%1.txt
-selectest >> ..\%1.txt
-writetest >> ..\%1.txt
-chunkread >> ..\%1.txt
-readtest >> ..\%1.txt
-cd ..
-more /e +3 testExamples_exp_output.txt > output.txt
-fc %1.txt output.txt >temp.txt
-if %ERRORLEVEL%==0 (
- echo All HDF5 C examples tests passed.
-) else (
- echo HDF5 C examples tests failed.
- echo.
- more temp.txt
-)
-del output.txt
-del temp.txt
-GOTO END
-
-:RELDLL
-type nul > %1.txt
-cd examplesRELDLL
-attributetestdll >> ..\%1.txt
-compoundtestdll >> ..\%1.txt
-extendwritetestdll >> ..\%1.txt
-grouptestdll >> ..\%1.txt
-intermgrouptestdll >> ..\%1.txt
-selectestdll >> ..\%1.txt
-writetestdll >> ..\%1.txt
-chunkreaddll >> ..\%1.txt
-readtestdll >> ..\%1.txt
-cd ..
-more /e +3 testExamples_exp_output.txt > output.txt
-fc %1.txt output.txt >temp.txt
-if %ERRORLEVEL%==0 (
- echo All HDF5 C examples tests passed.
-) else (
- echo HDF5 C examples tests failed.
- echo.
- more temp.txt
-)
-del output.txt
-del temp.txt
-GOTO END
-
-:DEBUG
-if %2.==. GOTO DBG
-if %2==dll GOTO DBGDLL
-GOTO WRONG
-
-:DBG
-type nul > %1.txt
-cd examplesDBG
-attributetest >> ..\%1.txt
-compoundtest >> ..\%1.txt
-extendwritetest >> ..\%1.txt
-grouptest >> ..\%1.txt
-intermgrouptest >> ..\%1.txt
-selectest >> ..\%1.txt
-writetest >> ..\%1.txt
-chunkread >> ..\%1.txt
-readtest >> ..\%1.txt
-cd ..
-more /e +3 testExamples_exp_output.txt > output.txt
-fc %1.txt output.txt >temp.txt
-if %ERRORLEVEL%==0 (
- echo All HDF5 C examples tests passed.
-) else (
- echo HDF5 C examples tests failed.
- echo.
- more temp.txt
-)
-del output.txt
-del temp.txt
-GOTO END
-
-:DBGDLL
type nul > %1.txt
-cd examplesDBGDLL
-attributetestdll >> ..\%1.txt
-compoundtestdll >> ..\%1.txt
-extendwritetestdll >> ..\%1.txt
-grouptestdll >> ..\%1.txt
-intermgrouptestdll >> ..\%1.txt
-selectestdll >> ..\%1.txt
-writetestdll >> ..\%1.txt
-chunkreaddll >> ..\%1.txt
-readtestdll >> ..\%1.txt
-cd ..
+attributetest%2\%1\attributetest%2 >> %1.txt
+compoundtest%2\%1\compoundtest%2 >> %1.txt
+extendwritetest%2\%1\extendwritetest%2 >> %1.txt
+grouptest%2\%1\grouptest%2 >> %1.txt
+intermgrouptest%2\%1\intermgrouptest%2 >> %1.txt
+selectest%2\%1\selectest%2 >> %1.txt
+writetest%2\%1\writetest%2 >> %1.txt
+chunkread%2\%1\chunkread%2 >> %1.txt
+readtest%2\%1\readtest%2 >> %1.txt
more /e +3 testExamples_exp_output.txt > output.txt
fc %1.txt output.txt >temp.txt
if %ERRORLEVEL%==0 (
diff --git a/windows/examples/testExamples_exp_output.txt b/windows/examples/testExamples_exp_output.txt
index 228c69f..b57688f 100755
--- a/windows/examples/testExamples_exp_output.txt
+++ b/windows/examples/testExamples_exp_output.txt
@@ -2,7 +2,9 @@
Expected output for HDF5 C examples tests
#############################
The value of the attribute "Integer attribute" is 1
-Found string attribute; its index is 1 , value = ABCD
+Found string attribute; its index is 2 , value = ABCD
+
+Name : Character attribute
Name : Float attribute
Rank : 2
@@ -10,8 +12,6 @@ Dimension sizes : 2 3
Type : FLOAT
Values : -1.000000 -1.000000 -1.000000 -1.000000 -1.000000 -1.000000
-Name : Character attribute
-
Name : Integer attribute
Field c :
diff --git a/windows/fortran/test/checkfortrantests.bat b/windows/fortran/test/checkfortrantests.bat
index 2b970f6..e4d7a4e 100644
--- a/windows/fortran/test/checkfortrantests.bat
+++ b/windows/fortran/test/checkfortrantests.bat
@@ -22,6 +22,8 @@ rem
setlocal enabledelayedexpansion
pushd %~dp0
+set /a nerrors=0
+
rem Clean any variables starting with "HDF5_FORTTEST_", as we use these for our
rem tests. Also clear "HDF5_FORTTEST_TESTS", as we will be addding all of our tests
rem to this variable.
@@ -61,12 +63,16 @@ rem %2 - "dll" or nothing
rem Only add our parameters for batch scripts.
call !hdf5_forttest_%%a_test:.bat= %1 %2!
rem Exit early if test fails.
- if !errorlevel! neq 0 exit /b
+ if errorlevel 1 (
+ set /a nerrors=!nerrors!+1
+ echo.
+ echo.************************************
+ echo. Testing %%a ^(%1 %2^) FAILED
+ exit /b 1
+ )
)
rem If we get here, that means all of our tests passed.
- echo.All Fortran library tests passed.
-
exit /b
@@ -86,6 +92,11 @@ rem on it for sending parameters. --SJW 9/6/07
rem Run the tests, passing in which version to run
call :run_tests %*
+ if "%nerrors%"=="0" (
+ echo.All Fortran library tests passed.
+ ) else (
+ echo.** FAILED Fortran Library tests.
+ )
+
popd
- endlocal & exit /b
- \ No newline at end of file
+ endlocal & exit /b %nerrors%
diff --git a/windows/hdf5bt.BAT b/windows/hdf5bt.BAT
index 1cb4644..c0b58a5 100755
--- a/windows/hdf5bt.BAT
+++ b/windows/hdf5bt.BAT
@@ -16,14 +16,15 @@ rem access to either file, you may request a copy from help@hdfgroup.org.
rem File Name: hdf5bt.bat
rem This batch file is used to build and test HDF5 Libraries and Tools.
rem This batch file takes the following options:
+rem . /vs8 Build HDF5 using Visual Studio 2005
rem . /vs9 Build HDF5 using Visual Studio 2008
rem . Note: Default is Visual Studio 2005
rem . /fort Build and test HDF5 with Fortran libraries
rem . /useenv Build HDF5 using compiler settings defined
-rem . in the environment, rather than the IDE.
-rem . /ivf101 Build HDF5 Fortran using Intel Visual Fortran 10.1
-rem . Note: Default is Intel Visual Fortran 9.1
-rem . /log Log the build and test results in files defined by
+rem . in the environment, rather than the IDE.
+rem . /ivf101 Build HDF5 Fortran using Intel Visual Fortran 10.1
+rem . /ivf91 Note: Default is Intel Visual Fortran 9.1
+rem . /log Log the build and test results in files defined by
rem . environment variables HDF5BUILD_LOG and
rem . HDF5CHECK_LOG
rem . /? Help information
@@ -61,11 +62,12 @@ rem Print a help message
echo.
echo Usage: %~nx0 [OPTION]
echo.
+ echo. /vs8 Build HDF5 using Visual Studio 2005
echo. /vs9 Build HDF5 using Visual Studio 2008
echo. Note: Default is Visual Studio 2005
echo. /fort Build and test HDF5 with Fortran libraries
echo. /ivf101 Build HDF5 Fortran using Intel Visual Fortran 10.1
- echo. Note: Default is Intel Visual Fortran 9.1
+ echo. /ivf91 Note: Default is Intel Visual Fortran 9.1
echo. /useenv Build HDF5 using compiler settings defined
echo. in the environment, rather than the IDE.
echo. /? Help information
@@ -77,12 +79,10 @@ rem Parse through the parameters sent to file, and set appropriate variables
:parse_params
for %%a in (%*) do (
- if "%%a"=="/vs7" (
- rem Visual Studio .NET not supported
- rem Set errorlevel 1 and send to help
- call :help
- exit /b 1
-
+ if "%%a"=="/vs8" (
+ rem Use Visual Studio 2005 to build
+ set hdf5_vs2005=true
+
) else if "%%a"=="/vs9" (
rem Use Visual Studio 2008 to build
set hdf5_vs2008=true
@@ -91,6 +91,10 @@ rem Parse through the parameters sent to file, and set appropriate variables
rem Enable Fortran
set hdf5_enablefortran=true
+ ) else if "%%a"=="/ivf91" (
+ rem Enable Fortran
+ set hdf5_ivf91=true
+
) else if "%%a"=="/ivf101" (
rem Enable Fortran
set hdf5_ivf101=true
@@ -127,8 +131,8 @@ rem Setup our environment
set hdf5build_params=
set hdf5check_params=enablecpp
- if defined hdf5_vnet (
- set hdf5build_params=%hdf5build_params% /vs7
+ if defined hdf5_vs2005 (
+ set hdf5build_params=%hdf5build_params% /vs8
)
if defined hdf5_vs2008 (
@@ -140,6 +144,10 @@ rem Setup our environment
set hdf5check_params=enableall
)
+ if defined hdf5_ivf91 (
+ set hdf5build_params=%hdf5build_params% /ivf91
+ )
+
if defined hdf5_ivf101 (
set hdf5build_params=%hdf5build_params% /ivf101
)
@@ -211,8 +219,8 @@ rem This is where the magic happens
:main
call :parse_params %*
- if %errorlevel% neq 0 (
- if !errorlevel! equ 1 (
+ if not errorlevel 0 (
+ if errorlevel 1 (
rem This isn't an error case-- this means /? was specified. Simply
rem quit.
goto end
@@ -225,7 +233,7 @@ rem This is where the magic happens
)
call :setup
- if %errorlevel% neq 0 (
+ if not errorlevel 0 (
echo.Error setting up hdf5bt environment!
goto error
)
@@ -236,13 +244,13 @@ rem This is where the magic happens
echo.
call :build
- if %errorlevel% neq 0 (
+ if not errorlevel 0 (
echo.Error building HDF5 libraries!
goto error
)
call :test
- if %errorlevel% neq 0 (
+ if not errorlevel 0 (
echo.Error testing HDF5 libraries!
goto error
)
diff --git a/windows/hdf5build.BAT b/windows/hdf5build.BAT
index e2a062c..9c9d84d 100755
--- a/windows/hdf5build.BAT
+++ b/windows/hdf5build.BAT
@@ -16,17 +16,16 @@ rem access to either file, you may request a copy from helphdfgroup.org.
rem File Name: hdf5build.bat
rem This batch file is used to build HDF5 Libraries and Tools.
rem This batch file takes the following options:
+rem . /vs8 Build HDF5 using Visual Studio 2005
rem . /vs9 Build HDF5 using Visual Studio 2008
rem . Note: Default is Visual Studio 2005
-rem . /fort Build HDF5 with Fortran libraries
-rem . /ivf101 Build HDF5 Fortran using Intel Visual Fortran 10.1
-rem . Note: Default is Intel Visual Fortran 9.1
+rem . /fort Build HDF5 with Fortran libraries
+rem . /ivf101 Build HDF5 Fortran using Intel Visual Fortran 10.1
+rem . /ivf91 Note: Default is Intel Visual Fortran 9.1
+rem . /nodebug Note: Default is to build debug and release versions
rem . /useenv Build HDF5 using compiler settings defined
rem . in the environment, rather than the IDE.
rem . /? Help information
-rem By Xuan Bai
-rem Created: Aug. 16, 2004
-rem Last Updated: Scott Wegner, 7/2/08
rem This batch file makes the following assumptions:
rem - The appropriate version of Visual Studio is installed and setup
@@ -47,6 +46,8 @@ pushd %~dp0
set nerrors=0
if "%1"=="/?" goto help
+set blddebug=debug
+set bldrelease=release
goto main
rem Print a help message
@@ -56,12 +57,14 @@ rem Print a help message
echo.
echo.Usage: %~nx0 [OPTION]
echo.
+ echo. /vs8 Build HDF5 using Visual Studio 2005
echo. /vs9 Build HDF5 using Visual Studio 2008
echo. Note: Default is Visual Studio 2005
echo. /fort Build HDF5 with Fortran libraries using the
echo. Intel Fortran version specified, or 9.1 by default
echo. /ivf101 Build HDF5 Fortran using Intel Visual Fortran 10.1
- echo. Note: Default is Intel Visual Fortran 9.1
+ echo. /ivf91 Note: Default is Intel Visual Fortran 9.1
+ echo. /nodebug Note: Default is to build debug and release versions
echo. /useenv Build HDF5 using compiler settings defined
echo. in the environment, rather than the IDE.
echo. /? Help information
@@ -73,24 +76,30 @@ rem Parse through the parameters sent to file, and set appropriate variables
:parse_params
for %%a in (%*) do (
- if "%%a"=="/vs7" (
- rem Visual Studio .NET 2003 not supported
- rem Set errorlevel 1 and send to help
- call :help
- exit /b 1
+ if "%%a"=="/vs8" (
+ rem Use Visual Studio 2005
+ set hdf5_vs2005=true
) else if "%%a"=="/vs9" (
- rem Use Visual Studio .NET 2003
+ rem Use Visual Studio 2008
set hdf5_vs2008=true
) else if "%%a"=="/fort" (
rem Enable Fortran
set hdf5_enablefortran=true
+ ) else if "%%a"=="/ivf91" (
+ rem Enable Fortran
+ set hdf5_ivf91=true
+
) else if "%%a"=="/ivf101" (
rem Enable Fortran
set hdf5_ivf101=true
+ ) else if "%%a"=="/nodebug" (
+ rem Enable Fortran
+ set blddebug=
+
) else if "%%a"=="/useenv" (
rem Pass /useenv flag to devenv
set hdf5_useenv=true
@@ -118,29 +127,14 @@ rem Setup our environment
echo.Setting up environment
- rem Sanity check-- make sure VS.NET isn't specified with Fortran or x64
- if defined hdf5_vnet (
- if defined hdf5_enablefortran (
- echo.Error: Building Fortran libraries with Visual Studio .NET is unsupported
- exit /b 1
- )
- if "%PROCESSOR_ARCHITECTURE%"=="AMD64" (
- echo.Error: Building HDF5 on x64 with Visual Studio .NET is unsupported
- exit /b 1
- )
- )
- rem Make sure /vs7 and /vs9 weren't specified together
- if "%hdf5_vnet%%hdf5_vs2008%"=="truetrue" (
- echo.Error: /vs7 and /vs9 should not be specified together.
+ rem Make sure /vs8 and /vs9 weren't specified together
+ if "%hdf5_vs2005%%hdf5_vs2008%"=="truetrue" (
+ echo.Error: /vs8 and /vs9 should not be specified together.
exit /b 1
)
rem Figure out which solution file to use based on configuration
- if defined hdf5_vnet (
- echo.Using Visual Studio .NET 2003
- set hdf5_sln="%CD%\windows_vnet\proj\all\all.sln"
-
- ) else if defined hdf5_vs2008 (
+ if defined hdf5_vs2008 (
echo.Using Visual Studio 2008
if defined hdf5_enablefortran (
echo.Building Fortran projects enabled
@@ -176,17 +170,7 @@ rem Setup our environment
set ccflags=
- if defined hdf5_vnet (
- if defined vs71comntools (
- rem This sets the Visual Studio .NET path and environment variables
- call "%vs71comntools%\vsvars32.bat"
- ) else (
- echo.Error: Cannot setup Visual Studio .NET 2003 environment. Please
- echo.make sure VS71COMNTOOLS is defined in the environment.
- exit /b 1
- )
-
- ) else if defined hdf5_vs2008 (
+ if defined hdf5_vs2008 (
if not defined hdf5_enablefortran (
if defined vs90comntools (
rem This sets the Visual Studio 2005 path and environment variables
@@ -308,15 +292,18 @@ rem Build the HDF5 libraries. By default, C and C++ libraries are built.
echo.
rem Build both debug and release versions
- for %%a in (debug release) DO (
+ for %%a in (%blddebug% %bldrelease%) DO (
echo.Building %hdf5_platform% %%a libraries...
- rem Only add hdf5_platform if not using Visual Studio .NET, because it doesn't like the syntax
- if defined hdf5_vnet (
- devenv %hdf5_sln% %ccflags% /rebuild %%a
- ) else (
- devenv %hdf5_sln% %ccflags% /rebuild "%%a|%hdf5_platform%"
- )
- if !errorlevel! neq 0 exit /b
+ devenv %hdf5_sln% %ccflags% /rebuild "%%a|%hdf5_platform%"
+ if not errorlevel 0 (
+ set /a nerrors=!nerrors!+1
+ echo. Building %%a FAILED
+ exit /b 1
+ ) else if errorlevel 1 (
+ set /a nerrors=!nerrors!+1
+ echo. Building %%a FAILED
+ exit /b 1
+ )
)
exit /b
@@ -338,8 +325,8 @@ rem This is where the magic happens
:main
call :parse_params %*
- if %errorlevel% neq 0 (
- if !errorlevel! equ 1 (
+ if not errorlevel 0 (
+ if errorlevel 1 (
rem This isn't an error case-- this means /? was specified. Simply
rem quit.
goto end
@@ -352,7 +339,7 @@ rem This is where the magic happens
)
call :setup
- if %errorlevel% neq 0 (
+ if not errorlevel 0 (
echo.Error setting up build environment.
goto error
)
@@ -360,7 +347,7 @@ rem This is where the magic happens
rem Upgrade the project files if needed
if defined hdf5_vs2008 (
call :upgrade
- if !errorlevel! neq 0 (
+ if not errorlevel 0 (
echo.Error upgrading project files!
goto error
)
@@ -376,7 +363,10 @@ rem This is where the magic happens
call :all
- if %errorlevel% neq 0 (
+ if not errorlevel 0 (
+ echo.Error building HDF5 libraries!
+ goto error
+ ) else if errorlevel 1 (
echo.Error building HDF5 libraries!
goto error
)
diff --git a/windows/hdf5build_examples.BAT b/windows/hdf5build_examples.BAT
index 52b106a..d12fc0c 100644
--- a/windows/hdf5build_examples.BAT
+++ b/windows/hdf5build_examples.BAT
@@ -17,6 +17,7 @@ rem File Name: hdf5build_examples.bat
rem This batch file is used to build HDF5 C/C++/Fortran examples.
rem This batch file takes the following options:
rem . /fort Build HDF5 examples, including Fortran
+rem . /nodebug Note: Default is to build debug and release versions
rem . /useenv Build HDF5 examples using compiler settings defined
rem . in the environment, rather than the IDE.
rem . /? Help information
@@ -42,6 +43,8 @@ pushd %~dp0
set nerrors=0
if "%1"=="/?" goto help
+set blddebug=debug
+set bldrelease=release
goto main
rem Print a help message
@@ -52,6 +55,7 @@ rem Print a help message
echo.Usage: %~nx0 [OPTION]
echo.
echo. /fort Build HDF5 examples, including Fortran
+ echo. /nodebug Note: Default is to build debug and release versions
echo. /useenv Build HDF5 examples using compiler settings defined
echo. in the environment, rather than the IDE.
echo. /? Help information
@@ -67,6 +71,10 @@ rem Parse through the parameters sent to file, and set appropriate variables
rem Enable Fortran
set hdf5_enablefortran=true
+ ) else if "%%a"=="/nodebug" (
+ rem Enable Fortran
+ set blddebug=
+
) else if "%%a"=="/useenv" (
rem Pass /useenv flag to devenv
set hdf5_useenv=true
@@ -163,7 +171,7 @@ rem Build the HDF5 libraries. By default, C and C++ libraries are built.
echo.**************************
echo. Building %%a Examples
echo.**************************
- for %%b in (Debug Release) do (
+ for %%b in (%blddebug% %bldrelease%) do (
echo.Building %%a %%b examples...
devenv !%%a_SLN! %ccflags% /rebuild %%b
if !errorlevel! neq 0 (
diff --git a/windows/hdf5check.BAT b/windows/hdf5check.BAT
index f3caea2..2f14bfd 100755
--- a/windows/hdf5check.BAT
+++ b/windows/hdf5check.BAT
@@ -20,9 +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 By Xuan Bai
-rem Created: Aug. 12, 2004
-rem Last Updated: Scott Wegner, 9/10/07
+rem disabledebug -- can be added to any of the above to not test debug versions
setlocal enabledelayedexpansion
pushd %~dp0
@@ -35,6 +33,8 @@ rem --SJW 9/5/07
set hdf5_test_=foo
for /f "tokens=1 delims==" %%a in ('set hdf5_test_') do set %%a=
set hdf5_test_tests=
+set chkdebug=debug
+set chkrelease=release
rem Put built DLLs in the system folder for testing
call install_dll.BAT
@@ -50,6 +50,11 @@ 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" (
+ set chkdebug=
+)
+if /i "%2" equ "disabledebug" (
+ set chkdebug=
)
goto main
@@ -75,14 +80,24 @@ rem %2 - "dll" or nothing
:run_tests
for %%a in (%hdf5_test_tests%) do (
echo.
- echo.************************************
+ echo.**==**==**==**==**==**==**==**==**==**
echo. Testing %%a ^(%1 %2^)
- echo.************************************
+ echo.**==**==**==**==**==**==**==**==**==**
rem Only add our parameters for batch scripts.
call !hdf5_test_%%a_test:.bat= %1 %2!
rem Exit early if test fails.
- if !errorlevel! neq 0 exit /b
+ if not errorlevel 0 (
+ set /a nerrors=!nerrors!+1
+ echo. Testing %%a ^(%1 %2^) FAILED
+ echo.**==**==**==**==**==**==**==**==**==**
+ exit /b 1
+ ) else if errorlevel 1 (
+ set /a nerrors=!nerrors!+1
+ echo. Testing %%a ^(%1 %2^) FAILED
+ echo.**==**==**==**==**==**==**==**==**==**
+ exit /b 1
+ )
)
rem If we get here, that means all of our tests passed.
@@ -118,18 +133,24 @@ rem on it for sending parameters. --SJW 9/6/07
rem We use "nodll" here because we cannot simply leave it blank. Filter
rem it out below. --SJW 9/10/07
for %%b in (nodll dll) do (
- for %%a in (debug release) do (
+ echo.======================================
+ for %%a in (%chkdebug% %chkrelease%) do (
set hdf5_config=%%a %%b
call :run_tests !hdf5_config:nodll=!
- if !errorlevel! neq 0 (
+ if not errorlevel 0 (
+ set /a nerrors=!nerrors!+1
+ ) else if errorlevel 1 (
set /a nerrors=!nerrors!+1
)
)
+ echo.======================================
)
- if %nerrors% equ 0 (
+ if "%nerrors%"=="0" (
echo.HDF5 Tests passed for all configurations!
- )
+ ) else (
+ echo.** FAILED HDF5 Tests!
+ )
popd
endlocal & exit /b %nerrors%
diff --git a/windows/hl/c++/test/checkhlcpptests.bat b/windows/hl/c++/test/checkhlcpptests.bat
index 24b7f55..db3f329 100644
--- a/windows/hl/c++/test/checkhlcpptests.bat
+++ b/windows/hl/c++/test/checkhlcpptests.bat
@@ -22,6 +22,8 @@ rem
setlocal enabledelayedexpansion
pushd %~dp0
+set /a nerrors=0
+
rem Clean any variables starting with "HDF5_HLCPPTEST_", as we use these for our
rem tests. Also clear "HDF5_HLCPPTEST_TESTS", as we will be addding all of our tests
rem to this variable.
@@ -61,12 +63,16 @@ rem %2 - "dll" or nothing
rem Only add our parameters for batch scripts.
call !hdf5_hlcpptest_%%a_test:.bat= %1 %2!
rem Exit early if test fails.
- if !errorlevel! neq 0 exit /b
+ if errorlevel 1 (
+ set /a nerrors=!nerrors!+1
+ echo.
+ echo.************************************
+ echo. Testing %%a ^(%1 %2^) FAILED
+ exit /b 1
+ )
)
rem If we get here, that means all of our tests passed.
- echo.All HL C++ library tests passed.
-
exit /b
@@ -82,6 +88,11 @@ rem on it for sending parameters. --SJW 9/6/07
rem Run the tests, passing in which version to run
call :run_tests %*
+ if "%nerrors%"=="0" (
+ echo.All HL C++ library tests passed.
+ ) else (
+ echo.** FAILED HL C++ Library tests.
+ )
+
popd
- endlocal & exit /b
- \ No newline at end of file
+ endlocal & exit /b %nerrors%
diff --git a/windows/hl/examples/test_hl_cexamples.BAT b/windows/hl/examples/test_hl_cexamples.BAT
index 4fb6309..652a602 100644
--- a/windows/hl/examples/test_hl_cexamples.BAT
+++ b/windows/hl/examples/test_hl_cexamples.BAT
@@ -39,30 +39,30 @@ GOTO WRONG
echo Testing %1 %2 version of High Level examples
echo.
- HLCexamples%1%2\ex_ds1%2.exe HLCexamples%1%2
+ ex_ds1%2\%1\ex_ds1%2.exe ex_ds1%1%2
for /l %%a in (1,1,2) do (
- HLCexamples%1%2\ex_image%%a%2.exe HLCexamples%1%2
+ ex_image%%a%2\%1\ex_image%%a%2.exe ex_image%%a%1%2
if not !errorlevel!==0 set /A total_error=!total_error!+1
)
for /l %%a in (1,1,3) do (
- HLCexamples%1%2\ex_lite%%a%2.exe HLCexamples%1%2
+ ex_lite%%a%2\%1\ex_lite%%a%2.exe ex_lite%%a%1%2
if not !errorlevel!==0 set /A total_error=!total_error!+1
)
for /l %%a in (1,1,9) do (
- HLCexamples%1%2\ex_table0%%a%2.exe HLCexamples%1%2
+ ex_table0%%a%2\%1\ex_table0%%a%2.exe ex_table0%%a%1%2
if not !errorlevel!==0 set /A total_error=!total_error!+1
)
for /l %%a in (10,1,12) do (
- HLCexamples%1%2\ex_table%%a%2.exe HLCexamples%1%2
+ ex_table%%a%2\%1\ex_table%%a%2.exe ex_table%%a%1%2
if not !errorlevel!==0 set /A total_error=!total_error!+1
)
for %%a in (FL VL) do (
- HLCexamples%1%2\ptExample%%a%2.exe HLCexamples%1%2
+ ptExample%%a%2\%1\ptExample%%a%2.exe ptExample%%a%1%2
if not !errorlevel!==0 set /A total_error=!total_error!+1
)
diff --git a/windows/hl/fortran/test/checkhlfortrantests.bat b/windows/hl/fortran/test/checkhlfortrantests.bat
index 98d9c38..0710625 100644
--- a/windows/hl/fortran/test/checkhlfortrantests.bat
+++ b/windows/hl/fortran/test/checkhlfortrantests.bat
@@ -22,6 +22,8 @@ rem
setlocal enabledelayedexpansion
pushd %~dp0
+set /a nerrors=0
+
rem Clean any variables starting with "HDF5_HLFORTTEST_", as we use these for our
rem tests. Also clear "HDF5_HLFORTTEST_TESTS", as we will be addding all of our tests
rem to this variable.
@@ -61,12 +63,16 @@ rem %2 - "dll" or nothing
rem Only add our parameters for batch scripts.
call !hdf5_hlforttest_%%a_test:.bat= %1 %2!
rem Exit early if test fails.
- if !errorlevel! neq 0 exit /b
+ if errorlevel 1 (
+ set /a nerrors=!nerrors!+1
+ echo.
+ echo.************************************
+ echo. Testing %%a ^(%1 %2^) FAILED
+ exit /b 1
+ )
)
rem If we get here, that means all of our tests passed.
- echo.All HL Fortran library tests passed.
-
exit /b
@@ -84,6 +90,11 @@ rem on it for sending parameters. --SJW 9/6/07
rem Run the tests, passing in which version to run
call :run_tests %*
+ if "%nerrors%"=="0" (
+ echo.All HL Fortran library tests passed.
+ ) else (
+ echo.** FAILED HL Fortran Library tests.
+ )
+
popd
- endlocal & exit /b
- \ No newline at end of file
+ endlocal & exit /b %nerrors%
diff --git a/windows/hl/test/checkhltests.bat b/windows/hl/test/checkhltests.bat
index 925c245..0804148 100644
--- a/windows/hl/test/checkhltests.bat
+++ b/windows/hl/test/checkhltests.bat
@@ -22,6 +22,8 @@ rem
setlocal enabledelayedexpansion
pushd %~dp0
+set /a nerrors=0
+
rem Clean any variables starting with "HDF5_HLTEST_", as we use these for our
rem tests. Also clear "HDF5_HLTEST_TESTS", as we will be addding all of our tests
rem to this variable.
@@ -66,12 +68,16 @@ rem %2 - "dll" or nothing
rem Only add our parameters for batch scripts.
call !hdf5_hltest_%%a_test:.bat= %1 %2!
rem Exit early if test fails.
- if !errorlevel! neq 0 exit /b
+ if errorlevel 1 (
+ set /a nerrors=!nerrors!+1
+ echo.
+ echo.************************************
+ echo. Testing %%a ^(%1 %2^) FAILED
+ exit /b 1
+ )
)
rem If we get here, that means all of our tests passed.
- echo.All HL library tests passed.
-
exit /b
@@ -134,6 +140,12 @@ rem on it for sending parameters. --SJW 9/6/07
rem Run the tests, passing in which version to run
call :run_tests %*
+ if "%nerrors%"=="0" (
+ echo.All HL library tests passed.
+ ) else (
+ echo.** FAILED HL Library tests.
+ )
+
popd
- endlocal & exit /b
+ endlocal & exit /b %nerrors%
\ No newline at end of file
diff --git a/windows/install_dll.BAT b/windows/install_dll.BAT
index 8a133c3..089d169 100755
--- a/windows/install_dll.BAT
+++ b/windows/install_dll.BAT
@@ -45,15 +45,8 @@ rem Add the DLLS to be copied here.
rem HDF5 Library
call :copy_dll proj\hdf5dll\debug\hdf5ddll.dll
call :copy_dll proj\hdf5dll\release\hdf5dll.dll
- rem We need this conditional because vs6 uses libtestD rather than libtestdll,
- rem Remove later when we fix the VS6 project name.
- if exist test\libtestdll\debug\libtestddll.dll (
- call :copy_dll test\libtestdll\debug\libtestddll.dll
- call :copy_dll test\libtestdll\release\libtestdll.dll
- ) else (
- call :copy_dll test\libtestD\debug\libtestDd.dll
- call :copy_dll test\libtestD\release\libtestD.dll
- )
+ call :copy_dll test\libtestdll\debug\libtestddll.dll
+ call :copy_dll test\libtestdll\release\libtestdll.dll
rem C++
call :copy_dll proj\hdf5_cppdll\debug\hdf5_cppddll.dll
diff --git a/windows/perform/checkperformtests.bat b/windows/perform/checkperformtests.bat
index 35895cf..4d789d1 100644
--- a/windows/perform/checkperformtests.bat
+++ b/windows/perform/checkperformtests.bat
@@ -22,6 +22,8 @@ rem
setlocal enabledelayedexpansion
pushd %~dp0
+set /a nerrors=0
+
rem Clean any variables starting with "HDF5_PERFTEST_", as we use these for our
rem tests. Also clear "HDF5_PERFTEST_TESTS", as we will be addding all of our tests
rem to this variable.
@@ -61,12 +63,16 @@ rem %2 - "dll" or nothing
rem Only add our parameters for batch scripts.
call !hdf5_perftest_%%a_test:.bat= %1 %2!
rem Exit early if test fails.
- if !errorlevel! neq 0 exit /b
+ if errorlevel 1 (
+ set /a nerrors=!nerrors!+1
+ echo.
+ echo.************************************
+ echo. Testing %%a ^(%1 %2^) FAILED
+ exit /b 1
+ )
)
rem If we get here, that means all of our tests passed.
- echo.All performance tests passed.
-
exit /b
@@ -85,6 +91,11 @@ rem on it for sending parameters. --SJW 9/6/07
rem Run the tests, passing in which version to run
call :run_tests %*
+ if "%nerrors%"=="0" (
+ echo.All performance tests passed.
+ ) else (
+ echo.** FAILED performance tests.
+ )
+
popd
- endlocal & exit /b
- \ No newline at end of file
+ endlocal & exit /b %nerrors%
diff --git a/windows/proj/all/all.sln b/windows/proj/all/all.sln
index e553104..8167d2b 100755
--- a/windows/proj/all/all.sln
+++ b/windows/proj/all/all.sln
@@ -1133,6 +1133,18 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "farraydll", "..\..\test\far
{C9535AD9-C61D-4691-A5CE-52EF359892AF} = {C9535AD9-C61D-4691-A5CE-52EF359892AF}
EndProjectSection
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tcheckversion", "..\..\test\tcheckversion\tcheckversion.vcproj", "{DFB6DCC1-2E00-4566-B935-F32172FDA483}"
+ ProjectSection(ProjectDependencies) = postProject
+ {473ABB63-E5C6-4D8E-9380-5DC76E1EAB4A} = {473ABB63-E5C6-4D8E-9380-5DC76E1EAB4A}
+ {26346A09-C500-49E7-963A-D22A8E09AAB7} = {26346A09-C500-49E7-963A-D22A8E09AAB7}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tcheckversiondll", "..\..\test\tcheckversiondll\tcheckversiondll.vcproj", "{7B3EB7A5-DA01-4488-A06B-63E2941EE078}"
+ ProjectSection(ProjectDependencies) = postProject
+ {832DD776-BC7F-40B5-90D0-E6448014CA5B} = {832DD776-BC7F-40B5-90D0-E6448014CA5B}
+ {C9535AD9-C61D-4691-A5CE-52EF359892AF} = {C9535AD9-C61D-4691-A5CE-52EF359892AF}
+ EndProjectSection
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
@@ -2473,6 +2485,22 @@ Global
{79FF58EE-7427-4732-AC25-370341859292}.Release|Win32.Build.0 = Release|Win32
{79FF58EE-7427-4732-AC25-370341859292}.Release|x64.ActiveCfg = Release|x64
{79FF58EE-7427-4732-AC25-370341859292}.Release|x64.Build.0 = Release|x64
+ {DFB6DCC1-2E00-4566-B935-F32172FDA483}.Debug|Win32.ActiveCfg = Debug|Win32
+ {DFB6DCC1-2E00-4566-B935-F32172FDA483}.Debug|Win32.Build.0 = Debug|Win32
+ {DFB6DCC1-2E00-4566-B935-F32172FDA483}.Debug|x64.ActiveCfg = Debug|x64
+ {DFB6DCC1-2E00-4566-B935-F32172FDA483}.Debug|x64.Build.0 = Debug|x64
+ {DFB6DCC1-2E00-4566-B935-F32172FDA483}.Release|Win32.ActiveCfg = Release|Win32
+ {DFB6DCC1-2E00-4566-B935-F32172FDA483}.Release|Win32.Build.0 = Release|Win32
+ {DFB6DCC1-2E00-4566-B935-F32172FDA483}.Release|x64.ActiveCfg = Release|x64
+ {DFB6DCC1-2E00-4566-B935-F32172FDA483}.Release|x64.Build.0 = Release|x64
+ {7B3EB7A5-DA01-4488-A06B-63E2941EE078}.Debug|Win32.ActiveCfg = Debug|Win32
+ {7B3EB7A5-DA01-4488-A06B-63E2941EE078}.Debug|Win32.Build.0 = Debug|Win32
+ {7B3EB7A5-DA01-4488-A06B-63E2941EE078}.Debug|x64.ActiveCfg = Debug|x64
+ {7B3EB7A5-DA01-4488-A06B-63E2941EE078}.Debug|x64.Build.0 = Debug|x64
+ {7B3EB7A5-DA01-4488-A06B-63E2941EE078}.Release|Win32.ActiveCfg = Release|Win32
+ {7B3EB7A5-DA01-4488-A06B-63E2941EE078}.Release|Win32.Build.0 = Release|Win32
+ {7B3EB7A5-DA01-4488-A06B-63E2941EE078}.Release|x64.ActiveCfg = Release|x64
+ {7B3EB7A5-DA01-4488-A06B-63E2941EE078}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/windows/proj/all_fortran/all_fortran.sln b/windows/proj/all_fortran/all_fortran.sln
index c4c5b22..f7ccad0 100644
--- a/windows/proj/all_fortran/all_fortran.sln
+++ b/windows/proj/all_fortran/all_fortran.sln
@@ -1374,6 +1374,18 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "farraydll", "..\..\test\far
{C9535AD9-C61D-4691-A5CE-52EF359892AF} = {C9535AD9-C61D-4691-A5CE-52EF359892AF}
EndProjectSection
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tcheckversion", "..\..\test\tcheckversion\tcheckversion.vcproj", "{DFB6DCC1-2E00-4566-B935-F32172FDA483}"
+ ProjectSection(ProjectDependencies) = postProject
+ {473ABB63-E5C6-4D8E-9380-5DC76E1EAB4A} = {473ABB63-E5C6-4D8E-9380-5DC76E1EAB4A}
+ {26346A09-C500-49E7-963A-D22A8E09AAB7} = {26346A09-C500-49E7-963A-D22A8E09AAB7}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tcheckversiondll", "..\..\test\tcheckversiondll\tcheckversiondll.vcproj", "{7B3EB7A5-DA01-4488-A06B-63E2941EE078}"
+ ProjectSection(ProjectDependencies) = postProject
+ {832DD776-BC7F-40B5-90D0-E6448014CA5B} = {832DD776-BC7F-40B5-90D0-E6448014CA5B}
+ {C9535AD9-C61D-4691-A5CE-52EF359892AF} = {C9535AD9-C61D-4691-A5CE-52EF359892AF}
+ EndProjectSection
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
@@ -2946,6 +2958,22 @@ Global
{79FF58EE-7427-4732-AC25-370341859292}.Release|Win32.Build.0 = Release|Win32
{79FF58EE-7427-4732-AC25-370341859292}.Release|x64.ActiveCfg = Release|x64
{79FF58EE-7427-4732-AC25-370341859292}.Release|x64.Build.0 = Release|x64
+ {DFB6DCC1-2E00-4566-B935-F32172FDA483}.Debug|Win32.ActiveCfg = Debug|Win32
+ {DFB6DCC1-2E00-4566-B935-F32172FDA483}.Debug|Win32.Build.0 = Debug|Win32
+ {DFB6DCC1-2E00-4566-B935-F32172FDA483}.Debug|x64.ActiveCfg = Debug|x64
+ {DFB6DCC1-2E00-4566-B935-F32172FDA483}.Debug|x64.Build.0 = Debug|x64
+ {DFB6DCC1-2E00-4566-B935-F32172FDA483}.Release|Win32.ActiveCfg = Release|Win32
+ {DFB6DCC1-2E00-4566-B935-F32172FDA483}.Release|Win32.Build.0 = Release|Win32
+ {DFB6DCC1-2E00-4566-B935-F32172FDA483}.Release|x64.ActiveCfg = Release|x64
+ {DFB6DCC1-2E00-4566-B935-F32172FDA483}.Release|x64.Build.0 = Release|x64
+ {7B3EB7A5-DA01-4488-A06B-63E2941EE078}.Debug|Win32.ActiveCfg = Debug|Win32
+ {7B3EB7A5-DA01-4488-A06B-63E2941EE078}.Debug|Win32.Build.0 = Debug|Win32
+ {7B3EB7A5-DA01-4488-A06B-63E2941EE078}.Debug|x64.ActiveCfg = Debug|x64
+ {7B3EB7A5-DA01-4488-A06B-63E2941EE078}.Debug|x64.Build.0 = Debug|x64
+ {7B3EB7A5-DA01-4488-A06B-63E2941EE078}.Release|Win32.ActiveCfg = Release|Win32
+ {7B3EB7A5-DA01-4488-A06B-63E2941EE078}.Release|Win32.Build.0 = Release|Win32
+ {7B3EB7A5-DA01-4488-A06B-63E2941EE078}.Release|x64.ActiveCfg = Release|x64
+ {7B3EB7A5-DA01-4488-A06B-63E2941EE078}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/windows/proj/hdf5/hdf5.vcproj b/windows/proj/hdf5/hdf5.vcproj
index 779b05c..3cb9708 100644
--- a/windows/proj/hdf5/hdf5.vcproj
+++ b/windows/proj/hdf5/hdf5.vcproj
@@ -357,6 +357,10 @@
>
</File>
<File
+ RelativePath="..\..\..\src\H5B2hdr.c"
+ >
+ </File>
+ <File
RelativePath="..\..\..\src\H5B2int.c"
>
</File>
@@ -565,6 +569,10 @@
>
</File>
<File
+ RelativePath="..\..\..\src\H5Fdeprec.c"
+ >
+ </File>
+ <File
RelativePath="..\..\..\src\H5FDfamily.c"
>
</File>
@@ -941,6 +949,10 @@
>
</File>
<File
+ RelativePath="..\..\..\src\H5Ofsinfo.c"
+ >
+ </File>
+ <File
RelativePath="..\..\..\src\H5Oginfo.c"
>
</File>
diff --git a/windows/proj/hdf5dll/hdf5dll.vcproj b/windows/proj/hdf5dll/hdf5dll.vcproj
index 492fce9..7f18944 100644
--- a/windows/proj/hdf5dll/hdf5dll.vcproj
+++ b/windows/proj/hdf5dll/hdf5dll.vcproj
@@ -448,6 +448,10 @@
>
</File>
<File
+ RelativePath="..\..\..\src\H5B2hdr.c"
+ >
+ </File>
+ <File
RelativePath="..\..\..\src\H5B2int.c"
>
</File>
@@ -656,6 +660,10 @@
>
</File>
<File
+ RelativePath="..\..\..\src\H5Fdeprec.c"
+ >
+ </File>
+ <File
RelativePath="..\..\..\src\H5FDfamily.c"
>
</File>
@@ -1032,6 +1040,10 @@
>
</File>
<File
+ RelativePath="..\..\..\src\H5Ofsinfo.c"
+ >
+ </File>
+ <File
RelativePath="..\..\..\src\H5Oginfo.c"
>
</File>
diff --git a/windows/src/H5pubconf.h b/windows/src/H5pubconf.h
index d8f5836..52ca244 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.47-FA_a4"
+#define H5_PACKAGE_STRING "HDF5 1.9.51-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.47-FA_a4"
+#define H5_PACKAGE_VERSION "1.9.51-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.47-FA_a4"
+#define H5_VERSION "1.9.51-FA_a4"
/* Define if vsnprintf() returns the correct value for formatted strings that
don't fit into size allowed */
diff --git a/windows/test/checktests.bat b/windows/test/checktests.bat
index 920e058..77a47aa 100644
--- a/windows/test/checktests.bat
+++ b/windows/test/checktests.bat
@@ -22,6 +22,8 @@ rem
setlocal enabledelayedexpansion
pushd %~dp0
+set /a nerrors=0
+
rem Clean any variables starting with "HDF5_LIBTEST_", as we use these for our
rem tests. Also clear "HDF5_LIBTEST_TESTS", as we will be addding all of our tests
rem to this variable.
@@ -61,12 +63,16 @@ rem %2 - "dll" or nothing
rem Only add our parameters for batch scripts.
call !hdf5_libtest_%%a_test:.bat= %1 %2!
rem Exit early if test fails.
- if !errorlevel! neq 0 exit /b
+ if errorlevel 1 (
+ set /a nerrors=!nerrors!+1
+ echo.
+ echo.************************************
+ echo. Testing %%a ^(%1 %2^) FAILED
+ exit /b 1
+ )
)
rem If we get here, that means all of our tests passed.
- echo.All library tests passed.
-
exit /b
@@ -119,16 +125,24 @@ rem on it for sending parameters. --SJW 9/6/07
call :add_test reserved%2 .\reserved%2\%1
call :add_test cross_read%2 .\cross_read%2\%1
call :add_test freespace%2 .\freespace%2\%1
- call :add_test mf%2 .\mf%2\%1
+ rem Test commented out until fixed - assert hangs daily test
+ rem call :add_test mf%2 .\mf%2\%1
call :add_test btree2%2 .\btree2%2\%1
call :add_test fheap%2 .\fheap%2\%1
call :add_test earray%2 .\earray%2\%1
call :add_test farray%2 .\farray%2\%1
+
+ call :add_test tcheckversion%2 .\tcheckversion%2\%1
rem Run the tests, passing in which version to run
call :run_tests %*
+ if "%nerrors%"=="0" (
+ echo.All library tests passed.
+ ) else (
+ echo.** FAILED Library tests.
+ )
+
popd
- endlocal & exit /b
- \ No newline at end of file
+ endlocal & exit /b %nerrors%
diff --git a/windows/test/tcheckversion/tcheckversion.vcproj b/windows/test/tcheckversion/tcheckversion.vcproj
new file mode 100644
index 0000000..0eae847
--- /dev/null
+++ b/windows/test/tcheckversion/tcheckversion.vcproj
@@ -0,0 +1,399 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="tcheckversion"
+ ProjectGUID="{DFB6DCC1-2E00-4566-B935-F32172FDA483}"
+ RootNamespace="tcheckversion"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ <Platform
+ Name="x64"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="..\..\..\test\$(ProjectName)\$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\..\proj\property_sheets\remove-posix-warnings.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\../../../test/tcheckversion/Release/tcheckversion.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ AdditionalIncludeDirectories="..\..\..\test,..\..\..\src"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile=".\../../../test/tcheckversion/Release/tcheckversion.pch"
+ AssemblerListingLocation=".\../../../test/tcheckversion/Release/"
+ ObjectFile=".\../../../test/tcheckversion/Release/"
+ ProgramDataBaseFileName=".\../../../test/tcheckversion/Release/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ CompileAs="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="odbc32.lib odbccp32.lib WS2_32.lib $(HDF5_EXT_ZLIB) $(HDF5_EXT_SZIP)"
+ OutputFile="$(OutDir)\$(ProjectName).exe"
+ LinkIncremental="0"
+ SuppressStartupBanner="true"
+ IgnoreDefaultLibraryNames=""
+ ProgramDatabaseFile=".\../../../test/tcheckversion/Release/tcheckversion.pdb"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|x64"
+ OutputDirectory="..\..\..\test\$(ProjectName)\$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\..\proj\property_sheets\remove-posix-warnings.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ TypeLibraryName=".\../../../test/tcheckversion/Release/tcheckversion.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ AdditionalIncludeDirectories="..\..\..\test,..\..\..\src"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile=".\../../../test/tcheckversion/Release/tcheckversion.pch"
+ AssemblerListingLocation=".\../../../test/tcheckversion/Release/"
+ ObjectFile=".\../../../test/tcheckversion/Release/"
+ ProgramDataBaseFileName=".\../../../test/tcheckversion/Release/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ CompileAs="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="odbc32.lib odbccp32.lib WS2_32.lib $(HDF5_EXT_ZLIB) $(HDF5_EXT_SZIP)"
+ OutputFile="$(OutDir)\$(ProjectName).exe"
+ LinkIncremental="0"
+ SuppressStartupBanner="true"
+ IgnoreDefaultLibraryNames=""
+ ProgramDatabaseFile=".\../../../test/tcheckversion/Release/tcheckversion.pdb"
+ SubSystem="1"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="..\..\..\test\$(ProjectName)\$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\..\proj\property_sheets\remove-posix-warnings.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\../../../test/tcheckversion/Debug/tcheckversion.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\..\test,..\..\..\src"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile=".\../../../test/tcheckversion/Debug/tcheckversion.pch"
+ AssemblerListingLocation=".\../../../test/tcheckversion/Debug/"
+ ObjectFile=".\../../../test/tcheckversion/Debug/"
+ ProgramDataBaseFileName=".\../../../test/tcheckversion/Debug/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="3"
+ CompileAs="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="odbc32.lib odbccp32.lib WS2_32.lib $(HDF5_EXT_ZLIB) $(HDF5_EXT_SZIP)"
+ OutputFile="$(OutDir)\$(ProjectName).exe"
+ LinkIncremental="0"
+ SuppressStartupBanner="true"
+ IgnoreDefaultLibraryNames=""
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile=".\../../../test/tcheckversion/Debug/tcheckversion.pdb"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|x64"
+ OutputDirectory="..\..\..\test\$(ProjectName)\$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\..\proj\property_sheets\remove-posix-warnings.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ TypeLibraryName=".\../../../test/tcheckversion/Debug/tcheckversion.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\..\test,..\..\..\src"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile=".\../../../test/tcheckversion/Debug/tcheckversion.pch"
+ AssemblerListingLocation=".\../../../test/tcheckversion/Debug/"
+ ObjectFile=".\../../../test/tcheckversion/Debug/"
+ ProgramDataBaseFileName=".\../../../test/tcheckversion/Debug/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="3"
+ CompileAs="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="odbc32.lib odbccp32.lib WS2_32.lib $(HDF5_EXT_ZLIB) $(HDF5_EXT_SZIP)"
+ OutputFile="$(OutDir)\$(ProjectName).exe"
+ LinkIncremental="0"
+ SuppressStartupBanner="true"
+ IgnoreDefaultLibraryNames=""
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile=".\../../../test/tcheckversion/Debug/tcheckversion.pdb"
+ SubSystem="1"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath="..\..\..\test\tcheck_version.c"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/windows/test/tcheckversiondll/tcheckversiondll.vcproj b/windows/test/tcheckversiondll/tcheckversiondll.vcproj
new file mode 100644
index 0000000..8139dcc
--- /dev/null
+++ b/windows/test/tcheckversiondll/tcheckversiondll.vcproj
@@ -0,0 +1,395 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="tcheckversiondll"
+ ProjectGUID="{7B3EB7A5-DA01-4488-A06B-63E2941EE078}"
+ RootNamespace="tcheckversiondll"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ <Platform
+ Name="x64"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="..\..\..\test\$(ProjectName)\$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\..\proj\property_sheets\remove-posix-warnings.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\../../../test/tcheckversiondll/Debug/tcheckversiondll.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\..\test,..\..\..\src"
+ PreprocessorDefinitions="_DEBUG;WIN32;_CONSOLE;_HDF5USEDLL_;_HDF5TESTUSEDLL_"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile=".\../../../test/tcheckversiondll/Debug/tcheckversiondll.pch"
+ AssemblerListingLocation=".\../../../test/tcheckversiondll/Debug/"
+ ObjectFile=".\../../../test/tcheckversiondll/Debug/"
+ ProgramDataBaseFileName=".\../../../test/tcheckversiondll/Debug/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="3"
+ CompileAs="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="odbc32.lib odbccp32.lib WS2_32.lib"
+ OutputFile="$(OutDir)\$(ProjectName).exe"
+ LinkIncremental="0"
+ SuppressStartupBanner="true"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile=".\../../../test/tcheckversiondll/Debug/tcheckversiondll.pdb"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|x64"
+ OutputDirectory="..\..\..\test\$(ProjectName)\$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\..\proj\property_sheets\remove-posix-warnings.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ TypeLibraryName=".\../../../test/tcheckversiondll/Debug/tcheckversiondll.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\..\test,..\..\..\src"
+ PreprocessorDefinitions="_DEBUG;WIN32;_CONSOLE;_HDF5USEDLL_;_HDF5TESTUSEDLL_"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile=".\../../../test/tcheckversiondll/Debug/tcheckversiondll.pch"
+ AssemblerListingLocation=".\../../../test/tcheckversiondll/Debug/"
+ ObjectFile=".\../../../test/tcheckversiondll/Debug/"
+ ProgramDataBaseFileName=".\../../../test/tcheckversiondll/Debug/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="3"
+ CompileAs="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="odbc32.lib odbccp32.lib WS2_32.lib"
+ OutputFile="$(OutDir)\$(ProjectName).exe"
+ LinkIncremental="0"
+ SuppressStartupBanner="true"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile=".\../../../test/tcheckversiondll/Debug/tcheckversiondll.pdb"
+ SubSystem="1"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="..\..\..\test\$(ProjectName)\$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\..\proj\property_sheets\remove-posix-warnings.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\../../../test/tcheckversiondll/Release/tcheckversiondll.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ AdditionalIncludeDirectories="..\..\..\test,..\..\..\src"
+ PreprocessorDefinitions="NDEBUG;WIN32;_CONSOLE;_HDF5USEDLL_;_HDF5TESTUSEDLL_"
+ StringPooling="true"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile=".\../../../test/tcheckversiondll/Release/tcheckversiondll.pch"
+ AssemblerListingLocation=".\../../../test/tcheckversiondll/Release/"
+ ObjectFile=".\../../../test/tcheckversiondll/Release/"
+ ProgramDataBaseFileName=".\../../../test/tcheckversiondll/Release/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ CompileAs="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="odbc32.lib odbccp32.lib WS2_32.lib"
+ OutputFile="$(OutDir)\$(ProjectName).exe"
+ LinkIncremental="0"
+ SuppressStartupBanner="true"
+ ProgramDatabaseFile=".\../../../test/tcheckversiondll/Release/tcheckversiondll.pdb"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|x64"
+ OutputDirectory="..\..\..\test\$(ProjectName)\$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\..\proj\property_sheets\remove-posix-warnings.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ TypeLibraryName=".\../../../test/tcheckversiondll/Release/tcheckversiondll.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ AdditionalIncludeDirectories="..\..\..\test,..\..\..\src"
+ PreprocessorDefinitions="NDEBUG;WIN32;_CONSOLE;_HDF5USEDLL_;_HDF5TESTUSEDLL_"
+ StringPooling="true"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile=".\../../../test/tcheckversiondll/Release/tcheckversiondll.pch"
+ AssemblerListingLocation=".\../../../test/tcheckversiondll/Release/"
+ ObjectFile=".\../../../test/tcheckversiondll/Release/"
+ ProgramDataBaseFileName=".\../../../test/tcheckversiondll/Release/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ CompileAs="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="odbc32.lib odbccp32.lib WS2_32.lib"
+ OutputFile="$(OutDir)\$(ProjectName).exe"
+ LinkIncremental="0"
+ SuppressStartupBanner="true"
+ ProgramDatabaseFile=".\../../../test/tcheckversiondll/Release/tcheckversiondll.pdb"
+ SubSystem="1"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath="..\..\..\test\tcheck_version.c"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/windows/test/testerror.bat b/windows/test/testerror.bat
index 844e69c..24d39e0 100644
--- a/windows/test/testerror.bat
+++ b/windows/test/testerror.bat
@@ -146,11 +146,11 @@ rem
)
fc /w %expect1_parsed% %actual% > nul
- if %errorlevel% equ 0 (
+ if errorlevel 0 (
call :testing PASSED %test_err%
) else (
fc /w %expect2_parsed% %actual% > nul
- if !errorlevel! equ 0 (
+ if errorlevel 0 (
call :testing PASSED %test_err%
) else (
call :testing *FAILED* %test_err%
@@ -193,9 +193,11 @@ rem ############################################################################
rem test for error_test
call :test error_test %1 %2
- if %nerrors% equ 0 (
+ if "%nerrors%"=="0" (
echo.All Error API tests passed.
- )
+ ) else (
+ echo.** FAILED Error API tests
+ )
popd
endlocal & exit /b %nerrors%
diff --git a/windows/tools/checktools.bat b/windows/tools/checktools.bat
index f5a5b82..376e1fb 100644
--- a/windows/tools/checktools.bat
+++ b/windows/tools/checktools.bat
@@ -22,6 +22,8 @@ rem
setlocal enabledelayedexpansion
pushd %~dp0
+set /a nerrors=0
+
rem Clean any variables starting with "HDF5_TOOL_", as we use these for our
rem tests. Also clear "HDF5_TOOL_TESTS", as we will be addding all of our tests
rem to this variable.
@@ -61,12 +63,16 @@ rem %2 - "dll" or nothing
rem Only add our parameters for batch scripts.
call !hdf5_tool_%%a_test:.bat= %1 %2!
rem Exit early if test fails.
- if !errorlevel! neq 0 exit /b
+ if errorlevel 1 (
+ set /a nerrors=!nerrors!+1
+ echo.
+ echo.************************************
+ echo. Testing %%a ^(%1 %2^) FAILED
+ exit /b 1
+ )
)
rem If we get here, that means all of our tests passed.
- echo.All tool tests passed.
-
exit /b
@@ -147,6 +153,11 @@ rem on it for sending parameters. --SJW 9/6/07
rem Run the tests, passing in which version to run
call :run_tests %*
+ if "%nerrors%"=="0" (
+ echo.All tool tests passed.
+ ) else (
+ echo.** FAILED tool tests.
+ )
+
popd
- endlocal & exit /b
- \ No newline at end of file
+ endlocal & exit /b %nerrors%