From d612a249afe1eb4799ccbf725d8309452446dee7 Mon Sep 17 00:00:00 2001 From: Richard Warren Date: Fri, 25 Sep 2020 07:44:33 -0400 Subject: Create a new branch for the September Subfiling deliverable --- .github/workflows/main.yml | 4 +- CMakeLists.txt | 17 +- MANIFEST | 38 +- Makefile.am | 8 +- bin/errors | 2 +- bin/h5vers | 2 +- bin/release | 216 +- bin/warnhist | 2 +- c++/src/H5FaccProp.cpp | 47 + c++/src/H5FaccProp.h | 6 + config/cmake/ConfigureChecks.cmake | 25 + config/cmake/H5pubconf.h.in | 12 +- config/cmake/HDF5UseFortran.cmake | 2 +- config/cmake/HDFFortranCompilerFlags.cmake | 2 +- config/cmake/cacheinit.cmake | 3 + config/cmake/libhdf5.settings.cmake.in | 1 + config/cmake/scripts/HDF5config.cmake | 7 +- config/cmake_ext_mod/ConfigureChecks.cmake | 5 - config/gnu-warnings/4.8 | 3 + config/gnu-warnings/developer-4.8 | 1 - config/gnu-warnings/no-developer-4.8 | 1 - config/solaris | 21 +- configure.ac | 73 +- examples/CMakeLists.txt | 1 + examples/Makefile.am | 28 +- examples/h5_cmprss.c | 2 +- examples/h5_debug_trace.c | 144 + examples/run-c-ex.sh.in | 5 + fortran/src/CMakeLists.txt | 20 + fortran/src/H5Pff.F90 | 102 + fortran/src/hdf5_fortrandll.def.in | 2 + fortran/test/fortranlib_test.F90 | 6 +- fortran/test/tH5P.F90 | 73 + hl/fortran/src/CMakeLists.txt | 21 +- hl/fortran/src/H5IMcc.c | 12 +- hl/fortran/src/H5IMfc.c | 24 +- hl/fortran/src/H5IMff.F90 | 24 +- hl/fortran/src/H5LTfc.c | 24 +- hl/fortran/src/H5LTff.F90 | 40 +- hl/fortran/src/H5TBfc.c | 18 +- hl/fortran/src/H5TBff.F90 | 18 +- hl/src/H5DS.c | 635 ++- hl/src/H5IM.c | 33 +- hl/src/H5LD.c | 4 - hl/src/H5LT.c | 127 +- hl/src/H5LTanalyze.c | 1163 +++-- hl/src/H5LTanalyze.l | 7 + hl/src/H5LTparse.c | 1368 +++--- hl/src/H5LTparse.h | 155 +- hl/src/H5PT.c | 58 +- hl/src/H5TB.c | 55 +- hl/test/gen_test_ds.c | 2 - hl/test/h5hltest.h | 2 +- hl/test/test_ds.c | 2 - hl/test/test_dset_append.c | 4 - hl/test/test_image.c | 4 - hl/test/test_ld.c | 5 - hl/test/test_lite.c | 2 - hl/test/test_packet.c | 2 - hl/test/test_table.c | 2 - hl/tools/gif2h5/h52gifgentst.c | 2 +- hl/tools/gif2h5/hdf2gif.c | 74 +- hl/tools/h5watch/h5watch.c | 76 +- java/src/hdf/hdf5lib/H5.java | 49 + java/src/jni/h5pFAPLImp.c | 72 + java/src/jni/h5pFAPLImp.h | 27 + java/test/TestH5Pfapl.java | 32 + java/test/TestH5S.java | 2 +- java/test/junit.sh.in | 16 +- java/test/testfiles/JUnit-TestH5Pfapl.txt | 3 +- release_docs/INSTALL_CMake.txt | 8 + release_docs/RELEASE.txt | 314 +- src/CMakeLists.txt | 5 +- src/H5.c | 32 +- src/H5A.c | 37 +- src/H5AC.c | 351 +- src/H5ACdbg.c | 6 - src/H5ACmodule.h | 2 +- src/H5ACmpio.c | 45 +- src/H5ACprivate.h | 4 +- src/H5ACpublic.h | 4 +- src/H5Abtree2.c | 3 +- src/H5Adense.c | 94 +- src/H5Adeprec.c | 2 +- src/H5Aint.c | 216 +- src/H5Amodule.h | 2 +- src/H5Apkg.h | 3 - src/H5B.c | 42 +- src/H5B2.c | 20 +- src/H5B2cache.c | 24 +- src/H5B2dbg.c | 5 +- src/H5B2hdr.c | 14 +- src/H5B2int.c | 14 +- src/H5B2internal.c | 12 +- src/H5B2leaf.c | 16 +- src/H5B2module.h | 2 +- src/H5B2pkg.h | 2 +- src/H5B2private.h | 2 +- src/H5B2stat.c | 2 +- src/H5B2test.c | 2 +- src/H5Bcache.c | 7 +- src/H5Bdbg.c | 204 +- src/H5Bmodule.h | 2 +- src/H5Bpkg.h | 2 +- src/H5Bprivate.h | 4 +- src/H5C.c | 2377 +++++++---- src/H5CS.c | 4 - src/H5CX.c | 2 +- src/H5CXmodule.h | 2 +- src/H5Cdbg.c | 113 +- src/H5Cimage.c | 219 +- src/H5Cmodule.h | 2 +- src/H5Cmpio.c | 389 +- src/H5Cpkg.h | 509 ++- src/H5Cprivate.h | 8 +- src/H5Cpublic.h | 2 - src/H5Dbtree.c | 5 +- src/H5Dbtree2.c | 13 +- src/H5Dchunk.c | 277 +- src/H5Dcompact.c | 2 +- src/H5Dcontig.c | 2 +- src/H5Ddeprec.c | 6 +- src/H5Dearray.c | 398 +- src/H5Defl.c | 5 +- src/H5Dfarray.c | 180 +- src/H5Dfill.c | 4 +- src/H5Dint.c | 48 +- src/H5Dio.c | 21 +- src/H5Dlayout.c | 36 +- src/H5Dmodule.h | 2 +- src/H5Dmpio.c | 40 +- src/H5Dnone.c | 2 +- src/H5Dpkg.h | 7 +- src/H5Dselect.c | 2 +- src/H5Dsingle.c | 2 +- src/H5Dtest.c | 2 +- src/H5Dvirtual.c | 208 +- src/H5E.c | 51 +- src/H5EA.c | 13 +- src/H5EAcache.c | 31 +- src/H5EAdbg.c | 164 +- src/H5EAdblkpage.c | 7 +- src/H5EAdblock.c | 9 +- src/H5EAhdr.c | 16 +- src/H5EAiblock.c | 34 +- src/H5EAint.c | 4 +- src/H5EAmodule.h | 2 +- src/H5EApkg.h | 2 +- src/H5EAprivate.h | 2 +- src/H5EAsblock.c | 10 +- src/H5EAstat.c | 7 +- src/H5EAtest.c | 4 +- src/H5Edeprec.c | 15 +- src/H5Eint.c | 5 +- src/H5Emodule.h | 2 +- src/H5Epkg.h | 2 +- src/H5Eprivate.h | 2 +- src/H5F.c | 283 +- src/H5FA.c | 3 +- src/H5FAcache.c | 18 +- src/H5FAhdr.c | 4 +- src/H5FAint.c | 2 +- src/H5FAmodule.h | 2 +- src/H5FAstat.c | 6 +- src/H5FAtest.c | 2 +- src/H5FD.c | 10 +- src/H5FDcore.c | 79 +- src/H5FDcore.h | 2 +- src/H5FDdirect.c | 324 +- src/H5FDdirect.h | 2 +- src/H5FDdrvr_module.h | 2 +- src/H5FDfamily.c | 322 +- src/H5FDfamily.h | 2 +- src/H5FDhdfs.c | 1313 ++---- src/H5FDhdfs.h | 11 +- src/H5FDlog.c | 744 ++-- src/H5FDlog.h | 2 +- src/H5FDmirror.c | 878 ++-- src/H5FDmirror.h | 292 -- src/H5FDmirror_priv.h | 323 ++ src/H5FDmodule.h | 2 +- src/H5FDmpi.c | 33 +- src/H5FDmpi.h | 2 +- src/H5FDmpio.c | 2 +- src/H5FDmpio.h | 2 +- src/H5FDmulti.c | 25 +- src/H5FDmulti.h | 2 +- src/H5FDpkg.h | 2 +- src/H5FDprivate.h | 2 +- src/H5FDpublic.h | 2 +- src/H5FDros3.c | 768 ++-- src/H5FDs3comms.c | 1715 +++----- src/H5FDsec2.c | 247 +- src/H5FDsec2.h | 2 +- src/H5FDspace.c | 14 +- src/H5FDsplitter.c | 780 ++-- src/H5FDstdio.c | 55 +- src/H5FDstdio.h | 2 +- src/H5FDtest.c | 1 - src/H5FDwindows.h | 4 +- src/H5FL.c | 2 +- src/H5FLmodule.h | 2 +- src/H5FLprivate.h | 4 +- src/H5FS.c | 11 +- src/H5FScache.c | 8 +- src/H5FSdbg.c | 2 +- src/H5FSint.c | 2 +- src/H5FSmodule.h | 2 +- src/H5FSpkg.h | 2 +- src/H5FSprivate.h | 2 +- src/H5FSsection.c | 135 +- src/H5Faccum.c | 8 +- src/H5Fcwfs.c | 2 +- src/H5Fdbg.c | 3 +- src/H5Fdeprec.c | 2 +- src/H5Fefc.c | 2 +- src/H5Ffake.c | 2 - src/H5Fint.c | 300 +- src/H5Fio.c | 6 +- src/H5Fmodule.h | 2 +- src/H5Fmount.c | 12 +- src/H5Fmpi.c | 2 +- src/H5Fpkg.h | 10 +- src/H5Fprivate.h | 19 +- src/H5Fquery.c | 24 +- src/H5Fspace.c | 2 +- src/H5Fsuper.c | 9 +- src/H5Fsuper_cache.c | 14 +- src/H5Ftest.c | 35 +- src/H5Gbtree2.c | 145 +- src/H5Gcache.c | 2 +- src/H5Gcompact.c | 20 +- src/H5Gdense.c | 167 +- src/H5Gdeprec.c | 10 +- src/H5Gent.c | 9 +- src/H5Gint.c | 36 +- src/H5Glink.c | 56 +- src/H5Gloc.c | 16 +- src/H5Gmodule.h | 2 +- src/H5Gname.c | 101 +- src/H5Gnode.c | 115 +- src/H5Gobj.c | 39 +- src/H5Goh.c | 4 +- src/H5Gpkg.h | 2 +- src/H5Gprivate.h | 2 +- src/H5Gpublic.h | 2 +- src/H5Groot.c | 4 +- src/H5Gstab.c | 47 +- src/H5Gtest.c | 3 +- src/H5Gtraverse.c | 7 +- src/H5HF.c | 65 +- src/H5HFbtree2.c | 2 +- src/H5HFcache.c | 42 +- src/H5HFdbg.c | 29 +- src/H5HFdblock.c | 41 +- src/H5HFdtable.c | 69 +- src/H5HFhdr.c | 254 +- src/H5HFhuge.c | 64 +- src/H5HFiblock.c | 113 +- src/H5HFiter.c | 130 +- src/H5HFman.c | 31 +- src/H5HFmodule.h | 2 +- src/H5HFpkg.h | 126 +- src/H5HFprivate.h | 18 +- src/H5HFsection.c | 385 +- src/H5HFspace.c | 42 +- src/H5HFstat.c | 2 +- src/H5HFtest.c | 11 +- src/H5HFtiny.c | 86 +- src/H5HG.c | 8 +- src/H5HGcache.c | 2 +- src/H5HGdbg.c | 3 +- src/H5HGmodule.h | 2 +- src/H5HGpkg.h | 2 +- src/H5HGprivate.h | 2 +- src/H5HGquery.c | 2 +- src/H5HL.c | 2 +- src/H5HLcache.c | 8 +- src/H5HLdbg.c | 2 +- src/H5HLdblk.c | 2 +- src/H5HLint.c | 2 +- src/H5HLmodule.h | 2 +- src/H5HLpkg.h | 2 +- src/H5HLprfx.c | 2 +- src/H5HLprivate.h | 2 +- src/H5HP.c | 72 +- src/H5I.c | 138 +- src/H5Imodule.h | 2 +- src/H5Ipkg.h | 2 +- src/H5Itest.c | 2 +- src/H5L.c | 97 +- src/H5Lexternal.c | 2 +- src/H5Lmodule.h | 2 +- src/H5Lpkg.h | 24 +- src/H5Lprivate.h | 22 - src/H5Lpublic.h | 2 +- src/H5MF.c | 89 +- src/H5MFaggr.c | 10 +- src/H5MFdbg.c | 5 +- src/H5MFmodule.h | 2 +- src/H5MFpkg.h | 3 +- src/H5MFprivate.h | 3 +- src/H5MFsection.c | 17 +- src/H5MM.c | 2 +- src/H5MMprivate.h | 2 +- src/H5MMpublic.h | 6 +- src/H5MP.c | 30 +- src/H5MPmodule.h | 2 +- src/H5MPpkg.h | 2 +- src/H5MPprivate.h | 2 +- src/H5MPtest.c | 18 +- src/H5Oainfo.c | 55 +- src/H5Oalloc.c | 17 +- src/H5Oattr.c | 146 +- src/H5Oattribute.c | 60 +- src/H5Obogus.c | 36 +- src/H5Obtreek.c | 54 +- src/H5Ocache.c | 10 +- src/H5Ocache_image.c | 36 +- src/H5Ochunk.c | 11 +- src/H5Ocont.c | 6 +- src/H5Ocopy.c | 34 +- src/H5Ocopy_ref.c | 112 +- src/H5Odbg.c | 6 +- src/H5Odeprec.c | 2 +- src/H5Odrvinfo.c | 57 +- src/H5Odtype.c | 181 +- src/H5Oefl.c | 60 +- src/H5Ofill.c | 179 +- src/H5Oflush.c | 24 +- src/H5Ofsinfo.c | 250 +- src/H5Oginfo.c | 65 +- src/H5Oint.c | 148 +- src/H5Olayout.c | 8 +- src/H5Olinfo.c | 46 +- src/H5Olink.c | 76 +- src/H5Omessage.c | 36 +- src/H5Omodule.h | 2 +- src/H5Omtime.c | 90 +- src/H5Oname.c | 60 +- src/H5Onull.c | 1 - src/H5Opkg.h | 5 + src/H5Opline.c | 241 +- src/H5Oprivate.h | 11 +- src/H5Opublic.h | 2 +- src/H5Orefcount.c | 57 +- src/H5Osdspace.c | 105 +- src/H5Oshared.c | 6 +- src/H5Oshared.h | 2 +- src/H5Oshmesg.c | 38 +- src/H5Ostab.c | 16 +- src/H5Otest.c | 4 +- src/H5Ounknown.c | 2 +- src/H5P.c | 2 +- src/H5PBmodule.h | 2 +- src/H5PLpkg.h | 2 +- src/H5PLprivate.h | 4 +- src/H5Pdapl.c | 36 +- src/H5Pdcpl.c | 80 +- src/H5Pdeprec.c | 2 +- src/H5Pdxpl.c | 14 +- src/H5Pencdec.c | 10 +- src/H5Pfapl.c | 269 +- src/H5Pfcpl.c | 39 +- src/H5Pfmpl.c | 14 +- src/H5Pgcpl.c | 2 +- src/H5Pint.c | 6 +- src/H5Plapl.c | 2 +- src/H5Plcpl.c | 14 +- src/H5Pmodule.h | 2 +- src/H5Pocpl.c | 75 +- src/H5Pocpypl.c | 2 +- src/H5Ppkg.h | 2 +- src/H5Ppublic.h | 2 + src/H5Pstrcpl.c | 2 +- src/H5Ptest.c | 2 +- src/H5RS.c | 14 +- src/H5Rdeprec.c | 152 +- src/H5Rint.c | 205 +- src/H5Rpkg.h | 4 - src/H5S.c | 652 +-- src/H5SL.c | 101 +- src/H5SLmodule.h | 2 +- src/H5SM.c | 147 +- src/H5SMbtree2.c | 42 - src/H5SMcache.c | 8 +- src/H5SMmessage.c | 26 +- src/H5SMmodule.h | 2 +- src/H5SMpkg.h | 14 +- src/H5SMprivate.h | 2 +- src/H5SMtest.c | 2 +- src/H5ST.c | 72 +- src/H5Sall.c | 10 +- src/H5Sdbg.c | 24 +- src/H5Sdeprec.c | 1 - src/H5Shyper.c | 260 +- src/H5Smodule.h | 2 +- src/H5Smpio.c | 32 +- src/H5Snone.c | 71 +- src/H5Spkg.h | 8 +- src/H5Spoint.c | 150 +- src/H5Sprivate.h | 1 + src/H5Sselect.c | 47 +- src/H5Stest.c | 2 +- src/H5T.c | 57 +- src/H5TS.c | 1 + src/H5TSprivate.h | 2 - src/H5Tcommit.c | 23 +- src/H5Tcompound.c | 20 +- src/H5Tconv.c | 130 +- src/H5Tcset.c | 8 - src/H5Tdbg.c | 69 +- src/H5Tdeprec.c | 2 +- src/H5Tenum.c | 62 +- src/H5Tfields.c | 13 - src/H5Tfixed.c | 9 - src/H5Tfloat.c | 4 - src/H5Tmodule.h | 2 +- src/H5Toffset.c | 20 +- src/H5Topaque.c | 4 - src/H5Torder.c | 14 +- src/H5Tpad.c | 8 - src/H5Tpkg.h | 8 +- src/H5Tprecis.c | 50 +- src/H5Tprivate.h | 4 +- src/H5Tref.c | 102 +- src/H5Tstrpad.c | 8 - src/H5Tvisit.c | 2 +- src/H5Tvlen.c | 9 +- src/H5VLint.c | 20 +- src/H5VLnative_link.c | 22 +- src/H5VLnative_object.c | 8 +- src/H5VM.c | 67 +- src/H5VMprivate.h | 86 +- src/H5WB.c | 6 +- src/H5WBprivate.h | 2 +- src/H5Z.c | 266 +- src/H5Zdeflate.c | 22 +- src/H5Zfletcher32.c | 29 +- src/H5Zmodule.h | 2 +- src/H5Znbit.c | 268 +- src/H5Zprivate.h | 6 +- src/H5Zpublic.h | 2 +- src/H5Zscaleoffset.c | 192 +- src/H5Zshuffle.c | 34 +- src/H5Zszip.c | 50 +- src/H5Ztrans.c | 393 +- src/H5checksum.c | 22 +- src/H5dbg.c | 92 +- src/H5detect.c | 28 +- src/H5err.txt | 2 + src/H5private.h | 77 +- src/H5public.h | 104 +- src/H5system.c | 157 +- src/H5timer.c | 627 ++- src/H5trace.c | 139 +- src/H5win32defs.h | 48 +- src/Makefile.am | 4 +- src/hdf5.lnt | 2 +- src/libhdf5.settings.in | 1 + test/CMakeLists.txt | 2 + test/H5srcdir.h | 4 +- test/Makefile.am | 4 +- test/SWMR_UseCase_UG.txt | 4 +- test/accum.c | 4 +- test/app_ref.c | 2 +- test/big.c | 8 +- test/bittests.c | 2 +- test/btree2.c | 14 +- test/cache.c | 2108 ++++----- test/cache_common.c | 171 +- test/cache_common.h | 59 + test/cache_image.c | 2 +- test/cache_tagging.c | 29 +- test/chunk_info.c | 28 +- test/cmpd_dset.c | 2 +- test/cross_read.c | 2 +- test/dangle.c | 2 +- test/dsets.c | 117 +- test/dt_arith.c | 36 +- test/dtypes.c | 600 ++- test/earray.c | 40 +- test/enum.c | 2 +- test/extend.c | 2 +- test/external.c | 2 +- test/external_common.c | 2 +- test/external_common.h | 2 +- test/external_fname.h | 2 +- test/fheap.c | 137 +- test/fillval.c | 2 +- test/filter_fail.c | 2 +- test/flush1.c | 2 +- test/flush2.c | 2 +- test/gen_bad_compound.c | 2 +- test/gen_bad_ohdr.c | 2 +- test/gen_bogus.c | 2 +- test/gen_cross.c | 2 +- test/gen_filters.c | 2 +- test/gen_mergemsg.c | 2 +- test/gen_new_array.c | 2 +- test/gen_new_fill.c | 2 +- test/gen_new_group.c | 2 +- test/gen_new_mtime.c | 2 +- test/gen_new_super.c | 36 +- test/gen_nullspace.c | 27 +- test/gen_old_array.c | 2 +- test/gen_old_group.c | 2 +- test/gen_old_layout.c | 2 +- test/gen_old_mtime.c | 2 +- test/gen_sizes_lheap.c | 2 +- test/gen_specmetaread.c | 5 +- test/gen_udlinks.c | 2 +- test/getname.c | 2 +- test/gheap.c | 2 +- test/h5subfiling_vol.c | 3641 ++++++++++++++++ test/h5subfiling_vol.h | 115 + test/h5test.c | 184 +- test/h5test.h | 4 +- test/hdfs.c | 31 +- test/hyperslab.c | 2 +- test/istore.c | 2 +- test/lheap.c | 2 +- test/links.c | 19 +- test/mf.c | 8 + test/mirror_vfd.c | 2 + test/mount.c | 2 +- test/mtime.c | 2 +- test/ntypes.c | 2 +- test/ohdr.c | 26 +- test/page_buffer.c | 1 - test/pool.c | 6 +- test/ros3.c | 2 +- test/s3comms.c | 2 +- test/set_extent.c | 2 +- test/space_overflow.c | 2 +- test/stab.c | 4 +- test/swmr.c | 278 +- test/swmr_addrem_writer.c | 20 - test/swmr_generator.c | 28 - test/swmr_remove_writer.c | 20 - test/swmr_sparse_writer.c | 20 - test/swmr_start_write.c | 10 - test/swmr_writer.c | 16 - test/tattr.c | 11 +- test/tchecksum.c | 2 +- test/testframe.c | 2 +- test/tfile.c | 3 - test/th5o.c | 22 +- test/thread_id.c | 4 +- test/timer.c | 414 ++ test/trefer.c | 803 +++- test/tselect.c | 80 +- test/ttsafe.c | 1 + test/ttsafe.h | 2 + test/ttsafe_attr_vlen.c | 177 + test/unlink.c | 2 +- test/vds.c | 2 +- test/vds_env.c | 2 +- test/vds_swmr.h | 2 - test/vfd.c | 334 +- tools/lib/h5diff.c | 179 +- tools/lib/h5diff.h | 177 +- tools/lib/h5diff_array.c | 4461 +++++++------------- tools/lib/h5diff_attr.c | 163 +- tools/lib/h5diff_dset.c | 670 ++- tools/lib/h5tools.c | 140 +- tools/lib/h5tools.h | 69 +- tools/lib/h5tools_dump.c | 531 +-- tools/lib/h5tools_dump.h | 80 +- tools/lib/h5tools_str.c | 84 +- tools/lib/h5tools_str.h | 7 +- tools/lib/h5tools_utils.c | 2 +- tools/lib/h5tools_utils.h | 2 +- tools/lib/io_timer.c | 1 - tools/libtest/h5tools_test_utils.c | 4 + tools/src/h5copy/h5copy.c | 22 +- tools/src/h5diff/h5diff_common.c | 346 +- tools/src/h5diff/h5diff_main.c | 38 +- tools/src/h5diff/ph5diff_main.c | 2 +- tools/src/h5dump/h5dump.c | 101 +- tools/src/h5dump/h5dump.h | 39 +- tools/src/h5dump/h5dump_ddl.c | 70 +- tools/src/h5dump/h5dump_extern.h | 43 +- tools/src/h5dump/h5dump_xml.c | 30 +- tools/src/h5format_convert/h5format_convert.c | 172 +- tools/src/h5import/h5import.c | 6 +- tools/src/h5jam/h5jam.c | 82 +- tools/src/h5jam/h5unjam.c | 20 +- tools/src/h5ls/h5ls.c | 277 +- tools/src/h5repack/h5repack.h | 38 +- tools/src/h5repack/h5repack_copy.c | 84 +- tools/src/h5repack/h5repack_main.c | 71 +- tools/src/h5repack/h5repack_parse.c | 2 +- tools/src/h5repack/h5repack_refs.c | 1 - tools/src/h5stat/h5stat.c | 22 +- tools/src/misc/h5clear.c | 9 +- tools/src/misc/h5debug.c | 3 +- tools/src/misc/h5mkgrp.c | 6 +- tools/src/misc/h5repart.c | 2 +- tools/test/h5copy/testh5copy.sh.in | 12 +- tools/test/h5diff/CMakeTests.cmake | 42 +- tools/test/h5diff/h5diff_plugin.sh.in | 117 +- tools/test/h5diff/h5diffgentest.c | 118 +- tools/test/h5diff/testfiles/diff_strings1.h5 | Bin 4640 -> 0 bytes tools/test/h5diff/testfiles/diff_strings2.h5 | Bin 4640 -> 0 bytes tools/test/h5diff/testfiles/h5diff_10.txt | 15 +- tools/test/h5diff/testfiles/h5diff_58_ref.txt | 12 +- tools/test/h5diff/testfiles/h5diff_600.txt | 15 +- tools/test/h5diff/testfiles/h5diff_603.txt | 15 +- tools/test/h5diff/testfiles/h5diff_606.txt | 15 +- tools/test/h5diff/testfiles/h5diff_612.txt | 15 +- tools/test/h5diff/testfiles/h5diff_615.txt | 15 +- tools/test/h5diff/testfiles/h5diff_621.txt | 15 +- tools/test/h5diff/testfiles/h5diff_622.txt | 15 +- tools/test/h5diff/testfiles/h5diff_623.txt | 15 +- tools/test/h5diff/testfiles/h5diff_624.txt | 15 +- tools/test/h5diff/testfiles/h5diff_70.txt | 32 + tools/test/h5diff/testfiles/h5diff_700.txt | 32 + tools/test/h5diff/testfiles/h5diff_701.txt | 32 + tools/test/h5diff/testfiles/h5diff_702.txt | 32 + tools/test/h5diff/testfiles/h5diff_703.txt | 32 + tools/test/h5diff/testfiles/h5diff_80.txt | 64 +- tools/test/h5diff/testfiles/h5diff_830.txt | 30 + tools/test/h5diff/testfiles/h5diff_eps.txt | 17 + tools/test/h5diff/testfiles/h5diff_eps1.h5 | Bin 0 -> 2272 bytes tools/test/h5diff/testfiles/h5diff_eps2.h5 | Bin 0 -> 2272 bytes tools/test/h5diff/testfiles/h5diff_reg.txt | 9 +- tools/test/h5diff/testfiles/h5diff_strings1.h5 | Bin 0 -> 4640 bytes tools/test/h5diff/testfiles/h5diff_strings2.h5 | Bin 0 -> 4640 bytes tools/test/h5diff/testh5diff.sh.in | 76 +- tools/test/h5dump/h5dump_plugin.sh.in | 28 +- tools/test/h5dump/h5dumpgentest.c | 10 +- tools/test/h5dump/testh5dump.sh.in | 381 +- tools/test/h5dump/testh5dumppbits.sh.in | 158 +- tools/test/h5dump/testh5dumpvds.sh.in | 172 +- tools/test/h5dump/testh5dumpxml.sh.in | 31 +- .../h5format_convert/testfiles/h5fc_v_err.ddl.err | 7 - tools/test/h5format_convert/testh5fc.sh.in | 2 +- tools/test/h5jam/tellub.c | 46 +- tools/test/h5ls/h5ls_plugin.sh.in | 6 +- tools/test/h5repack/CMakeTests.cmake | 118 +- tools/test/h5repack/h5repack.sh.in | 294 +- tools/test/h5repack/h5repacktst.c | 10 +- ...py_extlinks_src-base.h5copy_extlinks_src.h5.ddl | 28 + ...y_extlinks_src-merge.h5copy_extlinks_src.h5.tst | 26 + ...links_src-mergeprune.h5copy_extlinks_src.h5.ddl | 28 + ...y_extlinks_src-prune.h5copy_extlinks_src.h5.ddl | 6 + .../test/h5repack/testfiles/h5copy_extlinks_src.h5 | Bin 0 -> 2184 bytes .../test/h5repack/testfiles/h5copy_extlinks_trg.h5 | Bin 0 -> 2168 bytes tools/test/h5repack/testfiles/h5repack-help.txt | 3 + .../testfiles/textlink-base.textlink.h5.ddl | 12 + .../testfiles/textlink-merge.textlink.h5.tst | 13 + .../testfiles/textlink-mergeprune.textlink.h5.ddl | 4 + .../testfiles/textlink-prune.textlink.h5.ddl | 4 + .../testfiles/textlinkfar-base.textlinkfar.h5.ddl | 116 + .../testfiles/textlinkfar-merge.textlinkfar.h5.tst | 20 + .../textlinkfar-mergeprune.textlinkfar.h5.ddl | 152 + .../testfiles/textlinkfar-prune.textlinkfar.h5.ddl | 4 + .../testfiles/textlinksrc-base.textlinksrc.h5.ddl | 150 + .../testfiles/textlinksrc-merge.textlinksrc.h5.tst | 32 + .../textlinksrc-mergeprune.textlinksrc.h5.ddl | 187 + .../testfiles/textlinksrc-prune.textlinksrc.h5.ddl | 4 + .../testfiles/textlinktar-base.textlinktar.h5.ddl | 168 + .../testfiles/textlinktar-merge.textlinktar.h5.tst | 44 + .../textlinktar-mergeprune.textlinktar.h5.ddl | 200 + .../testfiles/textlinktar-prune.textlinktar.h5.ddl | 52 + .../testfiles/tsoftlinks-base.tsoftlinks.h5.ddl | 77 + .../testfiles/tsoftlinks-merge.tsoftlinks.h5.tst | 53 + .../tsoftlinks-mergeprune.tsoftlinks.h5.ddl | 127 + .../testfiles/tsoftlinks-prune.tsoftlinks.h5.ddl | 47 + tools/test/misc/h5perf_gentest.c | 4 +- tools/test/misc/h5repart_gentest.c | 2 +- tools/test/misc/testfiles/h5mkgrp_version.txt.in | 2 +- tools/test/misc/testh5mkgrp.sh.in | 93 +- tools/test/perform/CMakeLists.txt | 2 +- tools/test/perform/chunk.c | 2 +- tools/test/perform/chunk_cache.c | 82 +- tools/test/perform/iopipe.c | 405 +- tools/test/perform/overhead.c | 2 +- tools/test/perform/perf_meta.c | 2 +- tools/testfiles/trefer_attrR.ddl | 6 +- tools/testfiles/trefer_extR.ddl | 6 +- utils/mirror_vfd/CMakeLists.txt | 8 +- utils/mirror_vfd/mirror_remote.h | 2 + 684 files changed, 30492 insertions(+), 23668 deletions(-) create mode 100644 examples/h5_debug_trace.c create mode 100644 src/H5FDmirror_priv.h create mode 100644 test/h5subfiling_vol.c create mode 100644 test/h5subfiling_vol.h create mode 100644 test/timer.c create mode 100644 test/ttsafe_attr_vlen.c delete mode 100644 tools/test/h5diff/testfiles/diff_strings1.h5 delete mode 100644 tools/test/h5diff/testfiles/diff_strings2.h5 create mode 100644 tools/test/h5diff/testfiles/h5diff_830.txt create mode 100644 tools/test/h5diff/testfiles/h5diff_eps.txt create mode 100644 tools/test/h5diff/testfiles/h5diff_eps1.h5 create mode 100644 tools/test/h5diff/testfiles/h5diff_eps2.h5 create mode 100644 tools/test/h5diff/testfiles/h5diff_strings1.h5 create mode 100644 tools/test/h5diff/testfiles/h5diff_strings2.h5 create mode 100644 tools/test/h5repack/testfiles/h5copy_extlinks_src-base.h5copy_extlinks_src.h5.ddl create mode 100644 tools/test/h5repack/testfiles/h5copy_extlinks_src-merge.h5copy_extlinks_src.h5.tst create mode 100644 tools/test/h5repack/testfiles/h5copy_extlinks_src-mergeprune.h5copy_extlinks_src.h5.ddl create mode 100644 tools/test/h5repack/testfiles/h5copy_extlinks_src-prune.h5copy_extlinks_src.h5.ddl create mode 100644 tools/test/h5repack/testfiles/h5copy_extlinks_src.h5 create mode 100644 tools/test/h5repack/testfiles/h5copy_extlinks_trg.h5 create mode 100644 tools/test/h5repack/testfiles/textlink-base.textlink.h5.ddl create mode 100644 tools/test/h5repack/testfiles/textlink-merge.textlink.h5.tst create mode 100644 tools/test/h5repack/testfiles/textlink-mergeprune.textlink.h5.ddl create mode 100644 tools/test/h5repack/testfiles/textlink-prune.textlink.h5.ddl create mode 100644 tools/test/h5repack/testfiles/textlinkfar-base.textlinkfar.h5.ddl create mode 100644 tools/test/h5repack/testfiles/textlinkfar-merge.textlinkfar.h5.tst create mode 100644 tools/test/h5repack/testfiles/textlinkfar-mergeprune.textlinkfar.h5.ddl create mode 100644 tools/test/h5repack/testfiles/textlinkfar-prune.textlinkfar.h5.ddl create mode 100644 tools/test/h5repack/testfiles/textlinksrc-base.textlinksrc.h5.ddl create mode 100644 tools/test/h5repack/testfiles/textlinksrc-merge.textlinksrc.h5.tst create mode 100644 tools/test/h5repack/testfiles/textlinksrc-mergeprune.textlinksrc.h5.ddl create mode 100644 tools/test/h5repack/testfiles/textlinksrc-prune.textlinksrc.h5.ddl create mode 100644 tools/test/h5repack/testfiles/textlinktar-base.textlinktar.h5.ddl create mode 100644 tools/test/h5repack/testfiles/textlinktar-merge.textlinktar.h5.tst create mode 100644 tools/test/h5repack/testfiles/textlinktar-mergeprune.textlinktar.h5.ddl create mode 100644 tools/test/h5repack/testfiles/textlinktar-prune.textlinktar.h5.ddl create mode 100644 tools/test/h5repack/testfiles/tsoftlinks-base.tsoftlinks.h5.ddl create mode 100644 tools/test/h5repack/testfiles/tsoftlinks-merge.tsoftlinks.h5.tst create mode 100644 tools/test/h5repack/testfiles/tsoftlinks-mergeprune.tsoftlinks.h5.ddl create mode 100644 tools/test/h5repack/testfiles/tsoftlinks-prune.tsoftlinks.h5.ddl diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a3fdadb..60e21c7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -4,8 +4,8 @@ name: hdf5 dev CI on: push: branches: [ develop, hdf5_1_12, hdf5_1_10, hdf5_1_8 ] -# pull_request: -# branches: [ develop ] + pull_request: + branches: [ develop, hdf5_1_12, hdf5_1_10, hdf5_1_8 ] # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: diff --git a/CMakeLists.txt b/CMakeLists.txt index b559446..e4b87a4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -236,7 +236,7 @@ string (REGEX REPLACE ".*#define[ \t]+H5_VERS_MINOR[ \t]+([0-9]*).*$" "\\1" H5_VERS_MINOR ${_h5public_h_contents}) string (REGEX REPLACE ".*#define[ \t]+H5_VERS_RELEASE[ \t]+([0-9]*).*$" "\\1" H5_VERS_RELEASE ${_h5public_h_contents}) -string (REGEX REPLACE ".*#define[ \t]+H5_VERS_SUBRELEASE[ \t]+\"([0-9A-Za-z._]*)\".*$" +string (REGEX REPLACE ".*#define[ \t]+H5_VERS_SUBRELEASE[ \t]+\"([0-9A-Za-z._\-]*)\".*$" "\\1" H5_VERS_SUBRELEASE ${_h5public_h_contents}) #message (STATUS "VERSION: ${H5_VERS_MAJOR}.${H5_VERS_MINOR}.${H5_VERS_RELEASE}-${H5_VERS_SUBRELEASE}") @@ -339,9 +339,11 @@ set (HDF5_PACKAGE_VERSION "${H5_VERS_MAJOR}.${H5_VERS_MINOR}.${H5_VERS_RELEASE}" set (HDF5_PACKAGE_VERSION_MAJOR "${H5_VERS_MAJOR}.${H5_VERS_MINOR}") set (HDF5_PACKAGE_VERSION_MINOR "${H5_VERS_RELEASE}") if (H5_VERS_SUBRELEASE) - set (HDF5_PACKAGE_VERSION_STRING "${HDF5_PACKAGE_VERSION}-${H5_VERS_SUBRELEASE}") + set (HDF5_PACKAGE_VERSION_STRING "${HDF5_PACKAGE_VERSION}.${H5_VERS_SUBRELEASE}") + set (HDF5_RELEASE_VERSION_STRING "${HDF5_PACKAGE_VERSION}-${H5_VERS_SUBRELEASE}") else () set (HDF5_PACKAGE_VERSION_STRING "${HDF5_PACKAGE_VERSION}") + set (HDF5_RELEASE_VERSION_STRING "${HDF5_PACKAGE_VERSION}") endif () set (HDF5_LIB_PACKAGE_SOVERSION "${H5_LIB_SOVERS_MAJOR}.${H5_LIB_SOVERS_RELEASE}.${H5_LIB_SOVERS_MINOR}") set (HDF5_LIB_PACKAGE_SOVERSION_MAJOR "${H5_LIB_SOVERS_MAJOR}") @@ -995,6 +997,17 @@ if (EXISTS "${HDF5_SOURCE_DIR}/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/for endif () endif () + #option (HDF5_INSTALL_MOD_FORTRAN "Copy FORTRAN mod files to include directory (NO SHARED STATIC)" "NO") + set (HDF5_INSTALL_MOD_FORTRAN "SHARED" CACHE STRING "Copy FORTRAN mod files to include directory (NO SHARED STATIC)") + set_property (CACHE HDF5_INSTALL_MOD_FORTRAN PROPERTY STRINGS NO SHARED STATIC) + if (NOT HDF5_INSTALL_MOD_FORTRAN MATCHES "NO") + if (NOT BUILD_SHARED_LIBS AND BUILD_STATIC_LIBS) + set (HDF5_INSTALL_MOD_FORTRAN "STATIC") + elseif (BUILD_SHARED_LIBS AND NOT BUILD_STATIC_LIBS) + set (HDF5_INSTALL_MOD_FORTRAN "SHARED") + endif () + endif () + add_subdirectory (fortran) if (HDF5_BUILD_HL_LIB) if (EXISTS "${HDF5_SOURCE_DIR}/hl/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/hl/fortran") diff --git a/MANIFEST b/MANIFEST index eda21bb..0228bf4 100644 --- a/MANIFEST +++ b/MANIFEST @@ -192,6 +192,7 @@ ./examples/h5_chunk_read.c ./examples/h5_compound.c ./examples/h5_crtgrpd.c +./examples/h5_debug_trace.c ./examples/h5_subset.c ./examples/h5_cmprss.c ./examples/h5_rdwt.c @@ -691,6 +692,7 @@ ./src/H5FDlog.h ./src/H5FDmirror.c ./src/H5FDmirror.h +./src/H5FDmirror_priv.h ./src/H5FDmodule.h ./src/H5FDmpi.c ./src/H5FDmpi.h @@ -1232,6 +1234,7 @@ ./test/theap.c ./test/thread_id.c ./test/tid.c +./test/timer.c ./test/titerate.c ./test/tlayouto.h5 ./test/tmeta.c @@ -1251,6 +1254,7 @@ ./test/ttsafe.c ./test/ttsafe.h ./test/ttsafe_acreate.c +./test/ttsafe_attr_vlen.c ./test/ttsafe_cancel.c ./test/ttsafe_dcreate.c ./test/ttsafe_error.c @@ -2493,6 +2497,7 @@ ./tools/test/h5diff/testfiles/h5diff_80.txt ./tools/test/h5diff/testfiles/h5diff_800.txt ./tools/test/h5diff/testfiles/h5diff_801.txt +./tools/test/h5diff/testfiles/h5diff_830.txt ./tools/test/h5diff/testfiles/h5diff_90.txt ./tools/test/h5diff/testfiles/h5diff_100.txt ./tools/test/h5diff/testfiles/h5diff_101.txt @@ -2608,6 +2613,8 @@ ./tools/test/h5diff/testfiles/h5diff_dset3.h5 ./tools/test/h5diff/testfiles/h5diff_dtypes.h5 ./tools/test/h5diff/testfiles/h5diff_empty.h5 +./tools/test/h5diff/testfiles/h5diff_eps1.h5 +./tools/test/h5diff/testfiles/h5diff_eps2.h5 ./tools/test/h5diff/testfiles/h5diff_hyper1.h5 ./tools/test/h5diff/testfiles/h5diff_hyper2.h5 ./tools/test/h5diff/testfiles/h5diff_types.h5 @@ -2636,6 +2643,7 @@ ./tools/test/h5diff/testfiles/h5diff_dset_zero_dim_size1.h5 ./tools/test/h5diff/testfiles/h5diff_dset_zero_dim_size2.h5 ./tools/test/h5diff/testfiles/h5diff_enum_invalid_values.h5 +./tools/test/h5diff/testfiles/h5diff_eps.txt ./tools/test/h5diff/testfiles/compounds_array_vlen1.h5 ./tools/test/h5diff/testfiles/compounds_array_vlen2.h5 ./tools/test/h5diff/testfiles/non_comparables1.h5 @@ -2647,8 +2655,8 @@ ./tools/test/h5diff/testfiles/h5diff_ud.txt ./tools/test/h5diff/testfiles/h5diff_udfail.err ./tools/test/h5diff/testfiles/h5diff_udfail.txt -./tools/test/h5diff/testfiles/diff_strings1.h5 -./tools/test/h5diff/testfiles/diff_strings2.h5 +./tools/test/h5diff/testfiles/h5diff_strings1.h5 +./tools/test/h5diff/testfiles/h5diff_strings2.h5 ./tools/test/h5diff/testfiles/h5diff_vlstr.txt #vds ./tools/test/h5diff/testfiles/h5diff_v1.txt @@ -2660,6 +2668,7 @@ #test files for h5repack ./tools/test/h5repack/testfiles/README ./tools/test/h5repack/testfiles/bounds_latest_latest.h5 +./tools/test/h5repack/testfiles/h5copy_extlinks_src.h5 ./tools/test/h5repack/testfiles/h5repack_aggr.h5 ./tools/test/h5repack/testfiles/h5repack_attr.h5 ./tools/test/h5repack/testfiles/h5repack_attr_refs.h5 @@ -2738,6 +2747,31 @@ ./tools/test/h5repack/testfiles/4_vds.h5-vds_compa-v.ddl ./tools/test/h5repack/testfiles/attrregion.tattrreg.h5.ddl ./tools/test/h5repack/testfiles/dataregion.tdatareg.h5.ddl +./tools/test/h5repack/testfiles/textlink-base.textlink.h5.ddl +./tools/test/h5repack/testfiles/textlink-merge.textlink.h5.tst +./tools/test/h5repack/testfiles/textlink-mergeprune.textlink.h5.ddl +./tools/test/h5repack/testfiles/textlink-prune.textlink.h5.ddl +./tools/test/h5repack/testfiles/textlinkfar-base.textlinkfar.h5.ddl +./tools/test/h5repack/testfiles/textlinkfar-merge.textlinkfar.h5.tst +./tools/test/h5repack/testfiles/textlinkfar-mergeprune.textlinkfar.h5.ddl +./tools/test/h5repack/testfiles/textlinkfar-prune.textlinkfar.h5.ddl +./tools/test/h5repack/testfiles/textlinksrc-base.textlinksrc.h5.ddl +./tools/test/h5repack/testfiles/textlinksrc-merge.textlinksrc.h5.tst +./tools/test/h5repack/testfiles/textlinksrc-mergeprune.textlinksrc.h5.ddl +./tools/test/h5repack/testfiles/textlinksrc-prune.textlinksrc.h5.ddl +./tools/test/h5repack/testfiles/textlinktar-base.textlinktar.h5.ddl +./tools/test/h5repack/testfiles/textlinktar-merge.textlinktar.h5.tst +./tools/test/h5repack/testfiles/textlinktar-mergeprune.textlinktar.h5.ddl +./tools/test/h5repack/testfiles/textlinktar-prune.textlinktar.h5.ddl +./tools/test/h5repack/testfiles/tsoftlinks-base.tsoftlinks.h5.ddl +./tools/test/h5repack/testfiles/tsoftlinks-merge.tsoftlinks.h5.tst +./tools/test/h5repack/testfiles/tsoftlinks-mergeprune.tsoftlinks.h5.ddl +./tools/test/h5repack/testfiles/tsoftlinks-prune.tsoftlinks.h5.ddl +./tools/test/h5repack/testfiles/h5copy_extlinks_src-base.h5copy_extlinks_src.h5.ddl +./tools/test/h5repack/testfiles/h5copy_extlinks_src-merge.h5copy_extlinks_src.h5.tst +./tools/test/h5repack/testfiles/h5copy_extlinks_src-mergeprune.h5copy_extlinks_src.h5.ddl +./tools/test/h5repack/testfiles/h5copy_extlinks_src-prune.h5copy_extlinks_src.h5.ddl +./tools/test/h5repack/testfiles/h5copy_extlinks_trg.h5 # jam utility and tests ./tools/src/h5jam/Makefile.am diff --git a/Makefile.am b/Makefile.am index 8565788..9cb5d02 100644 --- a/Makefile.am +++ b/Makefile.am @@ -190,10 +190,10 @@ trace: # Run tests with different Virtual File Drivers. # Currently, only invoke check-vfd in the test directory. check-vfd: - for d in src utils test; do \ - if test $$d != .; then \ - (cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1; \ - fi; \ + for d in src utils test; do \ + if test $$d != .; then \ + (cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1; \ + fi; \ done # Run tests with different passthrough Virtual Object Layer Connectors. diff --git a/bin/errors b/bin/errors index 107bb9c..a5bad3a 100755 --- a/bin/errors +++ b/bin/errors @@ -17,7 +17,7 @@ use Text::Tabs; # If you do not have access to either file, you may request a copy from # help@hdfgroup.org. # -# Robb Matzke, matzke@llnl.gov +# Robb Matzke # 30 Aug 1997 # # Purpose: This script will read standard input which should be a diff --git a/bin/h5vers b/bin/h5vers index 659a081..6093eb0 100755 --- a/bin/h5vers +++ b/bin/h5vers @@ -17,7 +17,7 @@ use strict; # If you do not have access to either file, you may request a copy from # help@hdfgroup.org. # -# Robb Matzke +# Robb Matzke # 17 July 1998 ### Purpose diff --git a/bin/release b/bin/release index a34191e..95f58ea 100755 --- a/bin/release +++ b/bin/release @@ -39,7 +39,7 @@ USAGE() { cat << EOF Usage: $0 -d [--docver BRANCHNAME] [-h] [--nocheck] [--private] ... - -d DIR The name of the directory where the releas(es) should be + -d DIR The name of the directory where the releas(es) should be placed. --docver BRANCHNAME This is added for 1.8 and beyond to get the correct version of documentation files from the hdf5docs @@ -53,10 +53,10 @@ The other command-line options are the names of the programs to use for compressing the resulting tar archive (if none are given then "tar" is assumed): - tar -- use tar and don't do any compressing. - gzip -- use gzip with "-9" and append ".gz" to the output name. + tar -- use tar and don't do any compressing. + gzip -- use gzip with "-9" and append ".gz" to the output name. bzip2 -- use bzip2 with "-9" and append ".bz2" to the output name. - zip -- convert all text files to DOS style and form a zip file for Windows use. + zip -- convert all text files to DOS style and form a zip file for Windows use. cmake-tgz -- create a tar file using the gzip default level with a build-unix.sh command file and all other CMake files needed to build HDF5 source using CMake on unix machines. @@ -122,8 +122,8 @@ EOF tar2zip() { if [ $# -ne 3 ]; then - echo "usage: tar2zip " - return 1 + echo "usage: tar2zip " + return 1 fi ztmpdir=/tmp/ztmpdir$$ mkdir -p $ztmpdir @@ -135,10 +135,10 @@ tar2zip() (cd $ztmpdir; tar xf -) < $tarfile # sanity check if [ ! -d $ztmpdir/$version ]; then - echo "untar did not create $ztmpdir/$version source dir" - # cleanup - rm -rf $ztmpdir - return 1 + echo "untar did not create $ztmpdir/$version source dir" + # cleanup + rm -rf $ztmpdir + return 1 fi # step 2: convert text files # There maybe a simpler way to do this. @@ -147,11 +147,11 @@ tar2zip() # -q quiet mode # grep redirect output to /dev/null because -q or -s are not portable. find $ztmpdir/$version | \ - while read inf; do \ - if file $inf | grep "$inf\: .*text" > /dev/null 2>&1 ; then \ - unix2dos -q -k $inf; \ - fi\ - done + while read inf; do \ + if file $inf | grep "$inf\: .*text" > /dev/null 2>&1 ; then \ + unix2dos -q -k $inf; \ + fi\ + done # step 3: make zipball # -9 maximum compression # -y Store symbolic links as such in the zip archive @@ -202,8 +202,8 @@ tar2zip() tar2cmakezip() { if [ $# -ne 3 ]; then - echo "usage: tar2cmakezip " - return 1 + echo "usage: tar2cmakezip " + return 1 fi cmziptmpdir=/tmp/cmziptmpdir$$ cmziptmpsubdir=$cmziptmpdir/CMake-$HDF5_VERS @@ -216,10 +216,10 @@ tar2cmakezip() (cd $cmziptmpsubdir; tar xf -) < $tarfile # sanity check if [ ! -d $cmziptmpsubdir/$version ]; then - echo "untar did not create $cmziptmpsubdir/$version source dir" - # cleanup - rm -rf $cmziptmpdir - return 1 + echo "untar did not create $cmziptmpsubdir/$version source dir" + # cleanup + rm -rf $cmziptmpdir + return 1 fi # step 2: add batch file for building CMake on window @@ -245,11 +245,11 @@ tar2cmakezip() # -q quiet mode # grep redirect output to /dev/null because -q or -s are not portable. find $cmziptmpsubdir/$version | \ - while read inf; do \ - if file $inf | grep "$inf\: .*text" > /dev/null 2>&1 ; then \ - unix2dos -q -k $inf; \ - fi\ - done + while read inf; do \ + if file $inf | grep "$inf\: .*text" > /dev/null 2>&1 ; then \ + unix2dos -q -k $inf; \ + fi\ + done # step 3: make zipball # -9 maximum compression @@ -301,8 +301,8 @@ tar2cmakezip() tar2cmaketgz() { if [ $# -ne 3 ]; then - echo "usage: tar2cmaketgz " - return 1 + echo "usage: tar2cmaketgz " + return 1 fi cmgztmpdir=/tmp/cmgztmpdir$$ cmgztmpsubdir=$cmgztmpdir/CMake-$HDF5_VERS @@ -315,10 +315,10 @@ tar2cmaketgz() (cd $cmgztmpsubdir; tar xf -) < $tarfile # sanity check if [ ! -d $cmgztmpsubdir/$version ]; then - echo "untar did not create $cmgztmpsubdir/$version source dir" - # cleanup - rm -rf $cmgztmpdir - return 1 + echo "untar did not create $cmgztmpsubdir/$version source dir" + # cleanup + rm -rf $cmgztmpdir + return 1 fi @@ -384,8 +384,8 @@ tar2cmaketgz() tar2hpccmaketgz() { if [ $# -ne 3 ]; then - echo "usage: tar2hpccmaketgz " - return 1 + echo "usage: tar2hpccmaketgz " + return 1 fi cmgztmpdir=/tmp/cmgztmpdir$$ cmgztmpsubdir=$cmgztmpdir/HPC-CMake-$HDF5_VERS @@ -398,10 +398,10 @@ tar2hpccmaketgz() (cd $cmgztmpsubdir; tar xf -) < $tarfile # sanity check if [ ! -d $cmgztmpsubdir/$version ]; then - echo "untar did not create $cmgztmpsubdir/$version source dir" - # cleanup - rm -rf $cmgztmpdir - return 1 + echo "untar did not create $cmgztmpsubdir/$version source dir" + # cleanup + rm -rf $cmgztmpdir + return 1 fi @@ -442,7 +442,7 @@ check=yes release_date=`date +%F` today=`date +%Y%m%d` pmode='no' -tmpdir="../#release_tmp.$$" # tmp work directory +tmpdir="../#release_tmp.$$" # tmp work directory DOC_URL=https://git@bitbucket.hdfgroup.org/scm/hdffv/hdf5doc.git CPPLUS_RM_NAME=cpplus_RM MAINT_MODE_ENABLED="" @@ -459,11 +459,11 @@ fi RESTORE_VERSION() { if [ X-${VERS_OLD} != X- ]; then - echo restoring version information back to $VERS_OLD - rm -f config/lt_vers.am - cp $tmpdir/lt_vers.am config/lt_vers.am - bin/h5vers -s $VERS_OLD - VERS_OLD= + echo restoring version information back to $VERS_OLD + rm -f config/lt_vers.am + cp $tmpdir/lt_vers.am config/lt_vers.am + bin/h5vers -s $VERS_OLD + VERS_OLD= fi } @@ -473,32 +473,32 @@ while [ -n "$1" ]; do arg=$1 shift case "$arg" in - -d) - DEST=$1 - shift - ;; - --nocheck) - check=no - ;; - -h) - USAGE - exit 0 - ;; - --private) - pmode=yes - ;; + -d) + DEST=$1 + shift + ;; + --nocheck) + check=no + ;; + -h) + USAGE + exit 0 + ;; + --private) + pmode=yes + ;; --docver) DOCVERSION=$1 shift ;; - -*) - echo "Unknown switch: $arg" 1>&2 - USAGE - exit 1 - ;; - *) - methods="$methods $arg" - ;; + -*) + echo "Unknown switch: $arg" 1>&2 + USAGE + exit 1 + ;; + *) + methods="$methods $arg" + ;; esac done @@ -553,7 +553,7 @@ if [ "X$fail" = "Xyes" ]; then echo "--nocheck argument to the bin/release command." exit 1 else - echo "Continuing anyway..." + echo "Continuing anyway..." fi fi @@ -595,61 +595,61 @@ MD5file=$HDF5_VERS.md5 cp /dev/null $DEST/$MD5file for comp in $methods; do case $comp in - tar) - cp -p $tmpdir/$HDF5_VERS.tar $DEST/$HDF5_VERS.tar - (cd $DEST; md5sum $HDF5_VERS.tar >> $MD5file) - ;; - gzip) - test "$verbose" && echo " Running gzip..." 1>&2 - gzip -9 <$tmpdir/$HDF5_VERS.tar >$DEST/$HDF5_VERS.tar.gz - (cd $DEST; md5sum $HDF5_VERS.tar.gz >> $MD5file) - ;; + tar) + cp -p $tmpdir/$HDF5_VERS.tar $DEST/$HDF5_VERS.tar + (cd $DEST; md5sum $HDF5_VERS.tar >> $MD5file) + ;; + gzip) + test "$verbose" && echo " Running gzip..." 1>&2 + gzip -9 <$tmpdir/$HDF5_VERS.tar >$DEST/$HDF5_VERS.tar.gz + (cd $DEST; md5sum $HDF5_VERS.tar.gz >> $MD5file) + ;; cmake-tgz) - test "$verbose" && echo " Creating CMake tar.gz file..." 1>&2 - tar2cmaketgz $HDF5_VERS $tmpdir/$HDF5_VERS.tar $DEST/CMake-$HDF5_VERS.tar.gz 1>&2 - (cd $DEST; md5sum CMake-$HDF5_VERS.tar.gz >> $MD5file) + test "$verbose" && echo " Creating CMake tar.gz file..." 1>&2 + tar2cmaketgz $HDF5_VERS $tmpdir/$HDF5_VERS.tar $DEST/CMake-$HDF5_VERS.tar.gz 1>&2 + (cd $DEST; md5sum CMake-$HDF5_VERS.tar.gz >> $MD5file) ;; hpc-cmake-tgz) - test "$verbose" && echo " Creating HPC-CMake tar.gz file..." 1>&2 - tar2hpccmaketgz $HDF5_VERS $tmpdir/$HDF5_VERS.tar $DEST/HPC-CMake-$HDF5_VERS.tar.gz 1>&2 - (cd $DEST; md5sum HPC-CMake-$HDF5_VERS.tar.gz >> $MD5file) + test "$verbose" && echo " Creating HPC-CMake tar.gz file..." 1>&2 + tar2hpccmaketgz $HDF5_VERS $tmpdir/$HDF5_VERS.tar $DEST/HPC-CMake-$HDF5_VERS.tar.gz 1>&2 + (cd $DEST; md5sum HPC-CMake-$HDF5_VERS.tar.gz >> $MD5file) + ;; + bzip2) + test "$verbose" && echo " Running bzip2..." 1>&2 + bzip2 -9 <$tmpdir/$HDF5_VERS.tar >$DEST/$HDF5_VERS.tar.bz2 + (cd $DEST; md5sum $HDF5_VERS.tar.bz2 >> $MD5file) + ;; + zip) + test "$verbose" && echo " Creating zip ball..." 1>&2 + tar2zip $HDF5_VERS $tmpdir/$HDF5_VERS.tar $DEST/$HDF5_VERS.zip 1>&2 + (cd $DEST; md5sum $HDF5_VERS.zip >> $MD5file) ;; - bzip2) - test "$verbose" && echo " Running bzip2..." 1>&2 - bzip2 -9 <$tmpdir/$HDF5_VERS.tar >$DEST/$HDF5_VERS.tar.bz2 - (cd $DEST; md5sum $HDF5_VERS.tar.bz2 >> $MD5file) - ;; - zip) - test "$verbose" && echo " Creating zip ball..." 1>&2 - tar2zip $HDF5_VERS $tmpdir/$HDF5_VERS.tar $DEST/$HDF5_VERS.zip 1>&2 - (cd $DEST; md5sum $HDF5_VERS.zip >> $MD5file) - ;; cmake-zip) test "$verbose" && echo " Creating CMake-zip ball..." 1>&2 tar2cmakezip $HDF5_VERS $tmpdir/$HDF5_VERS.tar $DEST/CMake-$HDF5_VERS.zip 1>&2 (cd $DEST; md5sum CMake-$HDF5_VERS.zip >> $MD5file) ;; - doc) + doc) if [ "${DOCVERSION}" = "" ]; then DOCVERSION=master fi - test "$verbose" && echo " Creating docs..." 1>&2 - # Check out docs from git repo - (cd $tmpdir; git clone -q $DOC_URL ${DOCVERSION} > /dev/null) || exit 1 + test "$verbose" && echo " Creating docs..." 1>&2 + # Check out docs from git repo + (cd $tmpdir; git clone -q $DOC_URL ${DOCVERSION} > /dev/null) || exit 1 # Create doxygen C++ RM - (cd c++/src && doxygen cpp_doc_config > /dev/null ) || exit 1 - # Replace version of C++ RM with just-created version - rm -rf $tmpdir/${DOCVERSION}/html/$CPPLUS_RM_NAME || exit 1 - mv c++/src/$CPPLUS_RM_NAME $tmpdir/${DOCVERSION}/html/$CPPLUS_RM_NAME || exit 1 + (cd c++/src && doxygen cpp_doc_config > /dev/null ) || exit 1 + # Replace version of C++ RM with just-created version + rm -rf $tmpdir/${DOCVERSION}/html/$CPPLUS_RM_NAME || exit 1 + mv c++/src/$CPPLUS_RM_NAME $tmpdir/${DOCVERSION}/html/$CPPLUS_RM_NAME || exit 1 # Compress the docs and move them to the release area - mv $tmpdir/${DOCVERSION} $tmpdir/${HDF5_VERS}_docs || exit 1 - (cd $tmpdir && tar cf ${HDF5_VERS}_docs.tar ${HDF5_VERS}_docs) || exit 1 - mv $tmpdir/${HDF5_VERS}_docs.tar $DEST || exit 1 - ;; - *) - echo "***Error*** Unknown method $comp" - exit 1 - ;; + mv $tmpdir/${DOCVERSION} $tmpdir/${HDF5_VERS}_docs || exit 1 + (cd $tmpdir && tar cf ${HDF5_VERS}_docs.tar ${HDF5_VERS}_docs) || exit 1 + mv $tmpdir/${HDF5_VERS}_docs.tar $DEST || exit 1 + ;; + *) + echo "***Error*** Unknown method $comp" + exit 1 + ;; esac done diff --git a/bin/warnhist b/bin/warnhist index a88474b..3b2cec6 100755 --- a/bin/warnhist +++ b/bin/warnhist @@ -15,7 +15,7 @@ use warnings; # 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. # -# Quincey Koziol, koziol@hdfgroup.org +# Quincey Koziol # 9 Aug 2013 # # Purpose: Given an input file containing the output from a build of the diff --git a/c++/src/H5FaccProp.cpp b/c++/src/H5FaccProp.cpp index 5a478e7..a028e00 100644 --- a/c++/src/H5FaccProp.cpp +++ b/c++/src/H5FaccProp.cpp @@ -685,6 +685,53 @@ unsigned FileAccPropList::getGcReferences() const } //-------------------------------------------------------------------------- +// Function: FileAccPropList::setFileLocking +///\brief Sets file locking flags. +///\param use_file_locking - IN: Flag that determines if file locks should +// be used or not. +///\param ignore_when_disabled - IN: Flag that determines if file locks +// should be be used when disabled on the file system or not. +///\exception H5::PropListIException +///\par Description +/// For information, please refer to the H5Pset_file_locking API in +/// the HDF5 C Reference Manual. +// Programmer Dana Robinson - 2020 +//-------------------------------------------------------------------------- +void FileAccPropList::setFileLocking(hbool_t use_file_locking, hbool_t ignore_when_disabled) const +{ + herr_t ret_value = H5Pset_file_locking(id, use_file_locking, ignore_when_disabled); + + if (ret_value < 0) + { + throw PropListIException("FileAccPropList::setFileLocking", "H5Pset_file_locking failed"); + } +} + +//-------------------------------------------------------------------------- +// Function: FileAccPropList::getFileLocking +///\brief Gets file locking flags. +///\param use_file_locking - OUT: Flag that determines if file locks +// should be used or not. +///\param ignore_when_disabled - OUT: Flag that determines if file locks +// should be be used when disabled on the file system or not. +///\exception H5::PropListIException +///\par Description +/// For information, please refer to the H5Pget_file_locking API in +/// the HDF5 C Reference Manual. +// Programmer Dana Robinson - 2020 +//-------------------------------------------------------------------------- +void FileAccPropList::getFileLocking(hbool_t& use_file_locking, hbool_t& ignore_when_disabled) const +{ + herr_t ret_value = H5Pget_file_locking(id, &use_file_locking, &ignore_when_disabled); + + if (ret_value < 0) + { + throw PropListIException("FileAccPropList::getFileLocking", "H5Pget_file_locking failed"); + } +} + + +//-------------------------------------------------------------------------- // Function: FileAccPropList::setLibverBounds ///\brief Sets bounds on versions of library format to be used when creating /// or writing objects. diff --git a/c++/src/H5FaccProp.h b/c++/src/H5FaccProp.h index 58f049e..ee90fa4 100644 --- a/c++/src/H5FaccProp.h +++ b/c++/src/H5FaccProp.h @@ -126,6 +126,12 @@ class H5_DLLCPP FileAccPropList : public PropList { // Returns garbage collecting references setting. unsigned getGcReferences() const; + // Sets file locking parameters. + void setFileLocking(hbool_t use_file_locking, hbool_t ignore_when_disabled) const; + + // Gets file locking parameters. + void getFileLocking(hbool_t& use_file_locking, hbool_t& ignore_when_disabled) const; + // Sets bounds on versions of library format to be used when creating // or writing objects. void setLibverBounds(H5F_libver_t libver_low, H5F_libver_t libver_high) const; diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index 2930969..ab121e9 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -61,6 +61,31 @@ if (HDF5_ENABLE_CODESTACK) endif () MARK_AS_ADVANCED (HDF5_ENABLE_CODESTACK) +# ---------------------------------------------------------------------- +# Check if they would like to use file locking by default +#----------------------------------------------------------------------------- +option (HDF5_USE_FILE_LOCKING "Use file locking by default (mainly for SWMR)" ON) +if (HDF5_USE_FILE_LOCKING) + set (${HDF_PREFIX}_USE_FILE_LOCKING 1) +endif () + +# ---------------------------------------------------------------------- +# Check if they would like to ignore file locks when disabled on a file system +#----------------------------------------------------------------------------- +option (HDF5_IGNORE_DISABLED_FILE_LOCKS "Ignore file locks when disabled on file system" ON) +if (HDF5_IGNORE_DISABLED_FILE_LOCKS) + set (${HDF_PREFIX}_IGNORE_DISABLED_FILE_LOCKS 1) +endif () + +# Set the libhdf5.settings file variable +if (HDF5_IGNORE_DISABLED_FILE_LOCKS AND HDF5_USE_FILE_LOCKING) + set (HDF5_FILE_LOCKING_SETTING "best-effort") +elseif (HDF5_IGNORE_DISABLED_FILE_LOCKS) + set (HDF5_FILE_LOCKING_SETTING "yes") +else () + set (HDF5_FILE_LOCKING_SETTING "no") +endif () + #----------------------------------------------------------------------------- # Are we going to use HSIZE_T #----------------------------------------------------------------------------- diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in index 6edf6b4..600b046 100644 --- a/config/cmake/H5pubconf.h.in +++ b/config/cmake/H5pubconf.h.in @@ -267,9 +267,6 @@ /* Define to 1 if you have the `lstat' function. */ #cmakedefine H5_HAVE_LSTAT @H5_HAVE_LSTAT@ -/* Define to 1 if you have the header file. */ -#cmakedefine H5_HAVE_MACH_MACH_TIME_H @H5_HAVE_MACH_MACH_TIME_H@ - /* Define if the map API (H5M) should be compiled */ #cmakedefine H5_HAVE_MAP_API @H5_HAVE_MAP_API@ @@ -424,9 +421,6 @@ /* Define to 1 if you have the header file. */ #cmakedefine H5_HAVE_SYS_STAT_H @H5_HAVE_SYS_STAT_H@ -/* Define to 1 if you have the header file. */ -#cmakedefine H5_HAVE_SYS_TIMEB_H @H5_HAVE_SYS_TIMEB_H@ - /* Define to 1 if you have the header file. */ #cmakedefine H5_HAVE_SYS_TIME_H @H5_HAVE_SYS_TIME_H@ @@ -495,6 +489,9 @@ /* Define if the compiler understands __inline__ */ #cmakedefine H5_HAVE___INLINE__ @H5_HAVE___INLINE__@ +/* Define if the library will ignore file locks when disabled */ +#cmakedefine H5_IGNORE_DISABLED_FILE_LOCKS @H5_IGNORE_DISABLED_FILE_LOCKS@ + /* Define if the high-level library headers should be included in hdf5.h */ #cmakedefine H5_INCLUDE_HL @H5_INCLUDE_HL@ @@ -735,6 +732,9 @@ /* Define using v1.14 public API symbols by default */ #cmakedefine H5_USE_114_API_DEFAULT @H5_USE_114_API_DEFAULT@ +/* Define if the library will use file locking */ +#cmakedefine H5_USE_FILE_LOCKING @H5_USE_FILE_LOCKING@ + /* Define if a memory checking tool will be used on the library, to cause library to be very picky about memory operations and also disable the internal free list manager code. */ diff --git a/config/cmake/HDF5UseFortran.cmake b/config/cmake/HDF5UseFortran.cmake index c5d8200..4350b7a 100644 --- a/config/cmake/HDF5UseFortran.cmake +++ b/config/cmake/HDF5UseFortran.cmake @@ -435,7 +435,7 @@ set (${HDF_PREFIX}_H5CONFIG_F_RKIND_SIZEOF "INTEGER, DIMENSION(1:num_rkinds) :: ENABLE_LANGUAGE (C) if (NOT CMAKE_VERSION VERSION_LESS "3.14.0") -include (CheckCSourceRuns) + include (CheckCSourceRuns) else () #----------------------------------------------------------------------------- # The provided CMake C macros don't provide a general compile/run function diff --git a/config/cmake/HDFFortranCompilerFlags.cmake b/config/cmake/HDFFortranCompilerFlags.cmake index 15edaa8..2bbb35d 100644 --- a/config/cmake/HDFFortranCompilerFlags.cmake +++ b/config/cmake/HDFFortranCompilerFlags.cmake @@ -48,7 +48,7 @@ endif () # CDash is configured to only allow 3000 warnings, so # break into groups (from the config/gnu-flags file) #----------------------------------------------------------------------------- -if (NOT MSVC) +if (NOT MSVC AND NOT MINGW) # General flags if (CMAKE_Fortran_COMPILER_ID STREQUAL "Intel") ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/ifort-general") diff --git a/config/cmake/cacheinit.cmake b/config/cmake/cacheinit.cmake index 4846997..64e8dcc 100644 --- a/config/cmake/cacheinit.cmake +++ b/config/cmake/cacheinit.cmake @@ -23,6 +23,9 @@ set (HDF_PACKAGE_NAMESPACE "hdf5::" CACHE STRING "Name for HDF package namespace set (HDF5_BUILD_FORTRAN ON CACHE BOOL "Build FORTRAN support" FORCE) +set (HDF5_INSTALL_MOD_FORTRAN "NO" CACHE STRING "Copy FORTRAN mod files to include directory (NO SHARED STATIC)" FORCE) +set_property (CACHE HDF5_INSTALL_MOD_FORTRAN PROPERTY STRINGS NO SHARED STATIC) + set (HDF5_BUILD_GENERATORS ON CACHE BOOL "Build Test Generators" FORCE) set (HDF5_ENABLE_Z_LIB_SUPPORT ON CACHE BOOL "Enable Zlib Filters" FORCE) diff --git a/config/cmake/libhdf5.settings.cmake.in b/config/cmake/libhdf5.settings.cmake.in index b745765..ebcbd61 100644 --- a/config/cmake/libhdf5.settings.cmake.in +++ b/config/cmake/libhdf5.settings.cmake.in @@ -85,5 +85,6 @@ Parallel Filtered Dataset Writes: @PARALLEL_FILTERED_WRITES@ Using memory checker: @HDF5_ENABLE_USING_MEMCHECKER@ Memory allocation sanity checks: @HDF5_MEMORY_ALLOC_SANITY_CHECK@ Function Stack Tracing: @HDF5_ENABLE_CODESTACK@ + Use file locking: @HDF5_FILE_LOCKING_SETTING@ Strict File Format Checks: @HDF5_STRICT_FORMAT_CHECKS@ Optimization Instrumentation: @HDF5_Enable_Instrument@ diff --git a/config/cmake/scripts/HDF5config.cmake b/config/cmake/scripts/HDF5config.cmake index 7b7560f..3a8d5b7 100644 --- a/config/cmake/scripts/HDF5config.cmake +++ b/config/cmake/scripts/HDF5config.cmake @@ -21,6 +21,7 @@ cmake_minimum_required (VERSION 3.12) # ctest -S HDF5config.cmake,OPTION=VALUE -C Release -VV -O test.log # where valid options for OPTION are: # BUILD_GENERATOR - The cmake build generator: +# MinGW * MinGW Makefiles # Unix * Unix Makefiles # VS2019 * Visual Studio 16 2019 # VS201964 * Visual Studio 16 2019 @@ -167,7 +168,11 @@ if (NOT DEFINED HPC) ## Set the following to unique id your computer ## set (CTEST_SITE "WIN7${BUILD_GENERATOR}.XXXX") else () - set (CTEST_CMAKE_GENERATOR "Unix Makefiles") + if (MINGW) + set (CTEST_CMAKE_GENERATOR "MinGW Makefiles") + else () + set (CTEST_CMAKE_GENERATOR "Unix Makefiles") + endif () ## Set the following to unique id your computer ## if (APPLE) set (CTEST_SITE "MAC.XXXX") diff --git a/config/cmake_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake index 0875aad..0ddb6d0 100644 --- a/config/cmake_ext_mod/ConfigureChecks.cmake +++ b/config/cmake_ext_mod/ConfigureChecks.cmake @@ -137,15 +137,11 @@ CHECK_INCLUDE_FILE_CONCAT ("stddef.h" ${HDF_PREFIX}_HAVE_STDDEF_H) CHECK_INCLUDE_FILE_CONCAT ("stdint.h" ${HDF_PREFIX}_HAVE_STDINT_H) CHECK_INCLUDE_FILE_CONCAT ("unistd.h" ${HDF_PREFIX}_HAVE_UNISTD_H) -# Darwin -CHECK_INCLUDE_FILE_CONCAT ("mach/mach_time.h" ${HDF_PREFIX}_HAVE_MACH_MACH_TIME_H) - # Windows CHECK_INCLUDE_FILE_CONCAT ("io.h" ${HDF_PREFIX}_HAVE_IO_H) if (NOT CYGWIN) CHECK_INCLUDE_FILE_CONCAT ("winsock2.h" ${HDF_PREFIX}_HAVE_WINSOCK2_H) endif () -CHECK_INCLUDE_FILE_CONCAT ("sys/timeb.h" ${HDF_PREFIX}_HAVE_SYS_TIMEB_H) if (CMAKE_SYSTEM_NAME MATCHES "OSF") CHECK_INCLUDE_FILE_CONCAT ("sys/sysinfo.h" ${HDF_PREFIX}_HAVE_SYS_SYSINFO_H) @@ -683,4 +679,3 @@ endif () # the cache value is set in it's config file) # set (${HDF_PREFIX}_CONVERT_DENORMAL_FLOAT 1) - diff --git a/config/gnu-warnings/4.8 b/config/gnu-warnings/4.8 index c7e3dd1..05f4d92 100644 --- a/config/gnu-warnings/4.8 +++ b/config/gnu-warnings/4.8 @@ -9,6 +9,9 @@ # warning flag added for GCC >= 4.5 -Wstrict-overflow=5 +# This warning can only be truly addressed using the gcc extension of +# using D to indicate doubles (e.g., 1.23D). +-Wno-unsuffixed-float-constants # warning flags added for GCC >= 4.6 -Wdouble-promotion diff --git a/config/gnu-warnings/developer-4.8 b/config/gnu-warnings/developer-4.8 index fd76f6c..bfd15a1 100644 --- a/config/gnu-warnings/developer-4.8 +++ b/config/gnu-warnings/developer-4.8 @@ -5,7 +5,6 @@ # the variable is never *used* before it has been initialized? # -Wjump-misses-init --Wunsuffixed-float-constants # developer warning flag added for GCC >= 4.6 -Wsuggest-attribute=const diff --git a/config/gnu-warnings/no-developer-4.8 b/config/gnu-warnings/no-developer-4.8 index 1e29c78..09a9a96 100644 --- a/config/gnu-warnings/no-developer-4.8 +++ b/config/gnu-warnings/no-developer-4.8 @@ -1,6 +1,5 @@ # no-developer warning flag added for GCC >= 4.5 -Wno-jump-misses-init --Wno-unsuffixed-float-constants # no-developer warning flag added for GCC >= 4.6 -Wno-suggest-attribute=const diff --git a/config/solaris b/config/solaris index 656fee1..a424503 100644 --- a/config/solaris +++ b/config/solaris @@ -29,7 +29,9 @@ fi # Try solaris native compiler flags if test "X-" = "X-$cc_flags_set"; then - H5_CFLAGS="$H5_CFLAGS -erroff=%none -DBSD_COMP" + # HDF5 must be built with a C99 compiler on Solaris + # -erroff=%none turns on all warnings + H5_CFLAGS="$H5_CFLAGS -xc99=all -erroff=%none" # Production # NDEBUG is handled explicitly by the configure script @@ -41,17 +43,26 @@ if test "X-" = "X-$cc_flags_set"; then DEBUG_CFLAGS= # Symbols + # -g produces output for dbx, NOT gdb. You can use "gdb on" from + # inside gdb to use gdb commands if you need to debug. + # If you want a LOT of debugging information (at the expense of + # really slow code), try using -g3. That will even let you debug + # into macros. + # -s strips symbols, as in gcc NO_SYMBOLS_CFLAGS="-s" SYMBOLS_CFLAGS="-g" # Profile + # This produces profiling output for gprof. If you want to use + # the Solaris profiler, use -xprofile instead. PROFILE_CFLAGS="-xpg" # Optimization - # -g produces rather slow code. "-g -O" produces much faster code with some - # loss of debugger functions such as not able to print local variables. - HIGH_OPT_CFLAGS="-O" - DEBUG_OPT_CFLAGS="-O" + # -O has switched to -xO{1|2|3|4|5}. -xO3 is probably a good compromise + # for the daily tests, but you might want to switch to -xO2 or lower + # if you are actively debugging. + HIGH_OPT_CFLAGS="-xO5" + DEBUG_OPT_CFLAGS="-xO3" NO_OPT_CFLAGS= cc_flags_set=yes diff --git a/configure.ac b/configure.ac index 9480033..75b94f0 100644 --- a/configure.ac +++ b/configure.ac @@ -1150,12 +1150,13 @@ AC_CHECK_HEADERS([stdbool.h]) AC_CHECK_HEADERS([netdb.h netinet/in.h arpa/inet.h]) ## Darwin -AC_CHECK_HEADERS([mach/mach_time.h]) -## Also need to detect Darwin for pubconf +AC_SUBST([H5_IS_DARWIN]) +H5_IS_DARWIN="no" case $host_os in darwin*) AC_DEFINE([HAVE_DARWIN], [1], [Define if Darwin or Mac OS X]) - ;; + H5_IS_DARWIN="yes" + ;; esac ## Windows @@ -1248,6 +1249,7 @@ case "$host_cpu-$host_vendor-$host_os" in ## VFD on Linux systems. H5_CPPFLAGS="-D_GNU_SOURCE $H5_CPPFLAGS" ;; + esac ## Need to add the AM_ and H5_ into CFLAGS/CPPFLAGS to make them visible @@ -1592,18 +1594,21 @@ case "X-$withval" in AM_CPPFLAGS="$AM_CPPFLAGS -I$szlib_inc" fi - AC_CHECK_HEADERS([szlib.h], - [HAVE_SZLIB_H="yes"], - [CPPFLAGS="$saved_CPPFLAGS"; AM_CPPFLAGS="$saved_AM_CPPFLAGS"] [unset HAVE_SZLIB]) - if test -n "$szlib_lib"; then LDFLAGS="$LDFLAGS -L$szlib_lib" AM_LDFLAGS="$AM_LDFLAGS -L$szlib_lib" fi - if test "x$HAVE_SZLIB" = "xyes" -a "x$HAVE_SZLIB_H" = "xyes"; then + if test "x$HAVE_SZLIB" = "xyes"; then AC_CHECK_LIB([sz], [SZ_BufftoBuffCompress],, - [LDFLAGS="$saved_LDFLAGS"; AM_LDFLAGS="$saved_AM_LDFLAGS"; unset HAVE_SZLIB]) + [CPPFLAGS="$saved_CPPFLAGS"; AM_CPPFLAGS="$saved_AM_CPPFLAGS"; LDFLAGS="$saved_LDFLAGS"; AM_LDFLAGS="$saved_AM_LDFLAGS"; unset HAVE_SZLIB]) + if test -n "$HAVE_SZLIB"; then + AC_CHECK_HEADERS([szlib.h], + [HAVE_SZLIB_H="yes"], + [CPPFLAGS="$saved_CPPFLAGS"; AM_CPPFLAGS="$saved_AM_CPPFLAGS"] [unset HAVE_SZLIB]) + else + AC_MSG_RESULT([Using SZ_BufftoBuffCompress from libsz in $szlib_lib failed. Szip not enabled.]) + fi fi if test -z "$HAVE_SZLIB" -a -n "$HDF5_CONFIG_ABORT"; then @@ -2311,6 +2316,56 @@ case "X-$OPTIMIZATION" in esac ## ---------------------------------------------------------------------- +## Check if file locking should be used +## +AC_MSG_CHECKING([enable file locking]) +AC_ARG_ENABLE([file-locking], + [AS_HELP_STRING([--enable-file-locking=(yes|no|best-effort)], + [Sets the default for whether or not to use file + locking when opening files. Can be overridden + with the HDF5_USE_FILE_LOCKING environment variable + and the H5Pset_file_locking() API call. + best-effort attempts to use file locking but does + not fail when file locks have been disabled on + the file system (useful with Lustre). + [default=best-effort] + ])], + [DESIRED_FILE_LOCKING=$enableval]) + +## Set defaults +if test "X-$DESIRED_FILE_LOCKING" = X- ; then + DESIRED_FILE_LOCKING=best-effort +fi + +## Allow this variable to be substituted in +## other files (src/libhdf5.settings.in, etc.) +AC_SUBST([DESIRED_FILE_LOCKING]) +AC_SUBST([USE_FILE_LOCKING]) +AC_SUBST([IGNORE_DISABLED_FILE_LOCKS]) + +case "X-$DESIRED_FILE_LOCKING" in + X-best-effort) + AC_MSG_RESULT([best-effort]) + AC_DEFINE([USE_FILE_LOCKING], [1], + [Define if the library will use file locking]) + AC_DEFINE([IGNORE_DISABLED_FILE_LOCKS], [1], + [Define if the library will ignore file locks when disabled]) + ;; + X-yes) + AC_MSG_RESULT([yes]) + AC_DEFINE([USE_FILE_LOCKING], [1], + [Define if the library will use file locking]) + ;; + X-no) + AC_MSG_RESULT([no]) + ;; + *) + AC_MSG_ERROR([Unrecognized value: $USE_FILE_LOCKING]) + ;; +esac + + +## ---------------------------------------------------------------------- ## Enable/disable internal package-level debugging output ## AC_MSG_CHECKING([for internal debug output]) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 1bcbbf2..527b11f 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -31,6 +31,7 @@ set (examples h5_extlink h5_elink_unix2win h5_shared_mesg + h5_debug_trace h5_vds h5_vds-exc h5_vds-exclim diff --git a/examples/Makefile.am b/examples/Makefile.am index c00f0b9..944a9d8 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -34,25 +34,25 @@ INSTALL_TOP_FILES = README EXAMPLE_PROG = h5_write h5_read h5_extend_write h5_chunk_read h5_compound \ h5_crtgrpd h5_subset h5_cmprss h5_rdwt h5_crtgrpar h5_extend \ h5_crtatt h5_crtgrp h5_crtdat \ - h5_group h5_select h5_attribute h5_mount h5_reference_deprec h5_drivers \ - h5_ref_extern h5_ref_compat \ - h5_ref2reg_deprec h5_extlink h5_elink_unix2win h5_shared_mesg h5_vds h5_vds-exc \ - h5_vds-exclim h5_vds-eiger h5_vds-simpleIO h5_vds-percival \ - h5_vds-percival-unlim h5_vds-percival-unlim-maxmin + h5_group h5_select h5_attribute h5_mount h5_drivers \ + h5_reference_deprec h5_ref_extern h5_ref_compat h5_ref2reg_deprec \ + h5_extlink h5_elink_unix2win h5_shared_mesg h5_debug_trace \ + h5_vds h5_vds-exc h5_vds-exclim h5_vds-eiger h5_vds-simpleIO \ + h5_vds-percival h5_vds-percival-unlim h5_vds-percival-unlim-maxmin TEST_SCRIPT=testh5cc.sh TEST_EXAMPLES_SCRIPT=$(INSTALL_SCRIPT_FILES) # Install files # List all file that should be installed in examples directory -INSTALL_FILES = h5_write.c h5_read.c h5_extend_write.c h5_chunk_read.c \ - h5_crtgrpd.c h5_subset.c h5_cmprss.c h5_rdwt.c h5_crtgrpar.c \ - h5_extend.c h5_crtatt.c h5_crtgrp.c h5_crtdat.c \ - h5_compound.c h5_group.c h5_select.c h5_attribute.c h5_mount.c \ - h5_reference_deprec.c h5_drivers.c h5_extlink.c h5_elink_unix2win.c \ - h5_ref_extern.c h5_ref_compat.c \ - h5_ref2reg_deprec.c h5_shared_mesg.c ph5example.c h5_vds.c h5_vds-exc.c \ - h5_vds-exclim.c h5_vds-eiger.c h5_vds-simpleIO.c h5_vds-percival.c \ - h5_vds-percival-unlim.c h5_vds-percival-unlim-maxmin.c +INSTALL_FILES = h5_write.c h5_read.c h5_extend_write.c h5_chunk_read.c h5_compound.c \ + h5_crtgrpd.c h5_subset.c h5_cmprss.c h5_rdwt.c h5_crtgrpar.c h5_extend.c \ + h5_crtatt.c h5_crtgrp.c h5_crtdat.c \ + h5_group.c h5_select.c h5_attribute.c h5_mount.c h5_drivers.c \ + h5_reference_deprec.c h5_ref_extern.c h5_ref_compat.c h5_ref2reg_deprec.c \ + h5_extlink.c h5_elink_unix2win.c h5_shared_mesg.c h5_debug_trace.c \ + ph5example.c \ + h5_vds.c h5_vds-exc.c h5_vds-exclim.c h5_vds-eiger.c h5_vds-simpleIO.c \ + h5_vds-percival.c h5_vds-percival-unlim.c h5_vds-percival-unlim-maxmin.c diff --git a/examples/h5_cmprss.c b/examples/h5_cmprss.c index 5feadd3..97f6567 100644 --- a/examples/h5_cmprss.c +++ b/examples/h5_cmprss.c @@ -98,7 +98,7 @@ int main () { for (i=0; i +#include + +#include "hdf5.h" + +#define BUF_SIZE 1048576 +#define N_LOOPS 64 + +#define TESTFILE "h5_debug_trace_out.h5" + +int +main(int argc, char **argv) +{ + int i, j; + int *data; + + hid_t fid; + hid_t pid; + hid_t did; + hid_t sid; + + hsize_t dims[1] = { BUF_SIZE }; + hsize_t chunk_sizes[1] = { 1024 }; + + herr_t err; + + /*************************************************************************/ + + /* Warn the user about trace deluge to come */ + + printf("Testing debug/trace/performance data generation\n"); + printf("\n"); + printf("This test should generate a large amount of trace data\n"); + printf("\n"); + printf("*** BEGIN TRACE OUTPUT ***\n"); + printf("\n"); + fflush(stdout); + + /* This will emit H5Tconvert() performance information */ + + for(i = 0; i < N_LOOPS; i++) { + + /* The buffer has to be large enough to hold the conversion output */ + data = (int *)malloc(BUF_SIZE * sizeof(double)); + + for(j = 0; j < BUF_SIZE; j++) { + data[j] = j; + } + + err = H5Tconvert(H5T_NATIVE_INT, H5T_NATIVE_DOUBLE, BUF_SIZE, data, + NULL, H5P_DEFAULT); + + if(err < 0) { + fprintf(stderr, "ERROR: Conversion failed\n"); + free(data); + return err; + } + + free(data); + + } + + + /* This will emit H5Z performance information */ + + data = (int *)malloc(BUF_SIZE * sizeof(int)); + + for(i = 0; i < BUF_SIZE; i++) { + data[i] = i; + } + + fid = H5Fcreate(TESTFILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + + pid = H5Pcreate(H5P_DATASET_CREATE); + err = H5Pset_chunk(pid, 1, chunk_sizes); + err = H5Pset_shuffle(pid); + + sid = H5Screate_simple(1, dims, dims); + did = H5Dcreate2(fid, "somedata", H5T_NATIVE_INT, sid, H5P_DEFAULT, pid, H5P_DEFAULT); + err = H5Dwrite(did, H5T_NATIVE_INT, sid, sid, H5P_DEFAULT, data); + + H5Sclose(sid); + H5Dclose(did); + H5Pclose(pid); + H5Fclose(fid); + + free(data); + + /* Finished */ + fflush(stdout); + printf("\n"); + printf("*** END TRACE OUTPUT ***\n"); + printf("\n"); + + remove(TESTFILE); + + return 0; +} + diff --git a/examples/run-c-ex.sh.in b/examples/run-c-ex.sh.in index b649d98..a037f6c 100644 --- a/examples/run-c-ex.sh.in +++ b/examples/run-c-ex.sh.in @@ -149,6 +149,11 @@ then rm h5_extlink &&\ RunTest h5_elink_unix2win &&\ rm h5_elink_unix2win &&\ + OLD_DEBUG_STRING=$HDF5_DEBUG &&\ + export HDF5_DEBUG="+all +trace +ttimes" &&\ + RunTest h5_debug_trace &&\ + HDF5_DEBUG=$OLD_DEBUG_STRING &&\ + rm h5_debug_trace &&\ RunTest h5_shared_mesg &&\ rm h5_shared_mesg &&\ RunTest h5_vds-eiger &&\ diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index bf2fd84..b1add54 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -412,6 +412,16 @@ if (NOT ONLY_SHARED_LIBS) COMPONENT fortheaders ) + if (HDF5_INSTALL_MOD_FORTRAN MATCHES "STATIC") + install ( + FILES + ${mod_files} + DESTINATION + ${HDF5_INSTALL_INCLUDE_DIR} + COMPONENT + fortheaders + ) + endif () endif () if (BUILD_SHARED_LIBS) @@ -445,6 +455,16 @@ if (BUILD_SHARED_LIBS) COMPONENT fortheaders ) + if (HDF5_INSTALL_MOD_FORTRAN MATCHES "SHARED") + install ( + FILES + ${modsh_files} + DESTINATION + ${HDF5_INSTALL_INCLUDE_DIR} + COMPONENT + fortheaders + ) + endif () endif () #----------------------------------------------------------------------------- diff --git a/fortran/src/H5Pff.F90 b/fortran/src/H5Pff.F90 index 7e06cf3..38e3aac 100644 --- a/fortran/src/H5Pff.F90 +++ b/fortran/src/H5Pff.F90 @@ -8263,5 +8263,107 @@ END SUBROUTINE h5pget_virtual_dsetname_f END SUBROUTINE h5pget_vol_id_f +!****s* H5P (F03)/h5pget_file_locking_f_F03 +! +! NAME +! h5pget_file_locking_f +! +! PURPOSE +! Gets the file locking properties. File locking is mainly used to help +! enforce SWMR semantics. +! +! INPUTS +! fapl_id - Target file access property list identifier. +! +! OUTPUTS +! use_file_locking - Whether or not to use file locks. +! ignore_disabled_locks - Whether or not to ignore file locks when locking +! is disabled on a file system. +! hdferr - error code: +! 0 on success and -1 on failure +! +! AUTHOR +! Dana Robinson +! Summer 2020 +! +! Fortran2003 Interface: + SUBROUTINE h5pget_file_locking_f(fapl_id, use_file_locking, ignore_disabled_locks, hdferr) + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN) :: fapl_id + LOGICAL , INTENT(OUT) :: use_file_locking + LOGICAL , INTENT(OUT) :: ignore_disabled_locks + INTEGER , INTENT(OUT) :: hdferr +!***** + LOGICAL(C_BOOL) :: c_use_flag + LOGICAL(C_BOOL) :: c_ignore_flag + + INTERFACE + INTEGER FUNCTION h5pget_file_locking(fapl_id, use_file_locking, ignore_disabled_locks) BIND(C, NAME='H5Pget_file_locking') + IMPORT :: HID_T, C_BOOL + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN), VALUE :: fapl_id + LOGICAL(C_BOOL), INTENT(OUT) :: use_file_locking + LOGICAL(C_BOOL), INTENT(OUT) :: ignore_disabled_locks + END FUNCTION h5pget_file_locking + END INTERFACE + + hdferr = INT(h5pget_file_locking(fapl_id, c_use_flag, c_ignore_flag)) + + ! Transfer value of C C_BOOL type to Fortran LOGICAL + use_file_locking = c_use_flag + ignore_disabled_locks = c_ignore_flag + + END SUBROUTINE h5pget_file_locking_f + +!****s* H5P (F03)/h5pset_file_locking_f_F03 +! +! NAME +! h5pset_file_locking_f +! +! PURPOSE +! Sets the file locking properties. File locking is mainly used to help +! enforce SWMR semantics. +! +! INPUTS +! fapl_id - Target file access property list identifier. +! use_file_locking - Whether or not to use file locks. +! ignore_disabled_locks - Whether or not to ignore file locks when locking +! is disabled on a file system. +! hdferr - error code: +! 0 on success and -1 on failure +! +! AUTHOR +! Dana Robinson +! Summer 2020 +! +! Fortran2003 Interface: + SUBROUTINE h5pset_file_locking_f(fapl_id, use_file_locking, ignore_disabled_locks, hdferr) + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN) :: fapl_id + LOGICAL , INTENT(IN) :: use_file_locking + LOGICAL , INTENT(IN) :: ignore_disabled_locks + INTEGER , INTENT(OUT) :: hdferr +!***** + LOGICAL(C_BOOL) :: c_use_flag + LOGICAL(C_BOOL) :: c_ignore_flag + + INTERFACE + INTEGER FUNCTION h5pset_file_locking(fapl_id, use_file_locking, ignore_disabled_locks) BIND(C, NAME='H5Pset_file_locking') + IMPORT :: HID_T, C_BOOL + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN), VALUE :: fapl_id + LOGICAL(C_BOOL), INTENT(IN), VALUE :: use_file_locking + LOGICAL(C_BOOL), INTENT(IN), VALUE :: ignore_disabled_locks + END FUNCTION h5pset_file_locking + END INTERFACE + + ! Transfer value of Fortran LOGICAL to C C_BOOL type + c_use_flag = use_file_locking + c_ignore_flag = ignore_disabled_locks + + hdferr = INT(h5pset_file_locking(fapl_id, c_use_flag, c_ignore_flag)) + + END SUBROUTINE h5pset_file_locking_f + END MODULE H5P diff --git a/fortran/src/hdf5_fortrandll.def.in b/fortran/src/hdf5_fortrandll.def.in index 9c69e5a..4207239 100644 --- a/fortran/src/hdf5_fortrandll.def.in +++ b/fortran/src/hdf5_fortrandll.def.in @@ -339,6 +339,8 @@ H5P_mp_H5PGET_DSET_NO_ATTRS_HINT_F H5P_mp_H5PSET_DSET_NO_ATTRS_HINT_F H5P_mp_H5PSET_VOL_F H5P_mp_H5PGET_VOL_ID_F +H5P_mp_H5PSET_FILE_LOCKING_F +H5P_mp_H5PGET_FILE_LOCKING_F ; Parallel @H5_NOPAREXP@H5P_mp_H5PSET_FAPL_MPIO_F @H5_NOPAREXP@H5P_mp_H5PGET_FAPL_MPIO_F diff --git a/fortran/test/fortranlib_test.F90 b/fortran/test/fortranlib_test.F90 index 92f9279..1fb3e68 100644 --- a/fortran/test/fortranlib_test.F90 +++ b/fortran/test/fortranlib_test.F90 @@ -183,9 +183,13 @@ PROGRAM fortranlibtest CALL write_test_status(ret_total_error, ' Multi file driver test', total_error) ret_total_error = 0 - CALL test_chunk_cache (cleanup, ret_total_error) + CALL test_chunk_cache(cleanup, ret_total_error) CALL write_test_status(ret_total_error, ' Dataset chunk cache configuration', total_error) + ret_total_error = 0 + CALL test_misc_properties(cleanup, ret_total_error) + CALL write_test_status(ret_total_error, ' Miscellaneous properties', total_error) + ! ! '=========================================' ! 'Testing ATTRIBUTE interface ' diff --git a/fortran/test/tH5P.F90 b/fortran/test/tH5P.F90 index 7fe3971..19bee75 100644 --- a/fortran/test/tH5P.F90 +++ b/fortran/test/tH5P.F90 @@ -724,4 +724,77 @@ SUBROUTINE test_chunk_cache(cleanup, total_error) END SUBROUTINE test_chunk_cache +!------------------------------------------------------------------------- +! Function: test_misc_properties +! +! Purpose: Tests setting and getting of miscellaneous properties. Does +! not test the underlying functionality as that is done in +! the C library tests. +! +! Tests APIs: +! H5P_GET/SET_FILE_LOCKING_F +! +! Return: Success: 0 +! Failure: -1 +! +!------------------------------------------------------------------------- +! +SUBROUTINE test_misc_properties(cleanup, total_error) + + IMPLICIT NONE + LOGICAL, INTENT(IN) :: cleanup + INTEGER, INTENT(INOUT) :: total_error + + INTEGER(hid_t) :: fapl_id = -1 ! Local fapl + LOGICAL :: use_file_locking ! (H5Pset/get_file_locking_f) + LOGICAL :: ignore_disabled_locks ! (H5Pset/get_file_locking_f) + INTEGER :: error + + ! Create a default fapl + CALL H5Pcreate_f(H5P_FILE_ACCESS_F, fapl_id, error) + CALL check("H5Pcreate_f", error, total_error) + + ! Test H5Pset/get_file_locking_f + ! true values + use_file_locking = .TRUE. + ignore_disabled_locks = .TRUE. + CALL h5pset_file_locking_f(fapl_id, use_file_locking, ignore_disabled_locks, error) + CALL check("h5pset_set_file_locking_f", error, total_error) + use_file_locking = .FALSE. + ignore_disabled_locks = .FALSE. + CALL h5pget_file_locking_f(fapl_id, use_file_locking, ignore_disabled_locks, error) + CALL check("h5pget_set_file_locking_f", error, total_error) + if(use_file_locking .neqv. .TRUE.) then + total_error = total_error + 1 + write(*,*) "Got wrong use_file_locking flag from h5pget_file_locking_f" + endif + if(ignore_disabled_locks .neqv. .TRUE.) then + total_error = total_error + 1 + write(*,*) "Got wrong ignore_disabled_locks flag from h5pget_file_locking_f" + endif + + ! false values + use_file_locking = .FALSE. + ignore_disabled_locks = .FALSE. + CALL h5pset_file_locking_f(fapl_id, use_file_locking, ignore_disabled_locks, error) + CALL check("h5pset_set_file_locking_f", error, total_error) + use_file_locking = .TRUE. + ignore_disabled_locks = .TRUE. + CALL h5pget_file_locking_f(fapl_id, use_file_locking, ignore_disabled_locks, error) + CALL check("h5pget_set_file_locking_f", error, total_error) + if(use_file_locking .neqv. .FALSE.) then + total_error = total_error + 1 + write(*,*) "Got wrong use_file_locking flag from h5pget_file_locking_f" + endif + if(ignore_disabled_locks .neqv. .FALSE.) then + total_error = total_error + 1 + write(*,*) "Got wrong ignore_disabled_locks flag from h5pget_file_locking_f" + endif + + ! Close the fapl + CALL H5Pclose_f(fapl_id, error) + CALL check("H5Pclose_f", error, total_error) + +END SUBROUTINE test_misc_properties + END MODULE TH5P diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt index 71b9380..d682d5f 100644 --- a/hl/fortran/src/CMakeLists.txt +++ b/hl/fortran/src/CMakeLists.txt @@ -234,7 +234,6 @@ if (NOT ONLY_SHARED_LIBS) ${MOD_BUILD_DIR}/h5lt_const.mod ${MOD_BUILD_DIR}/h5im.mod ) - install ( FILES ${mod_files} @@ -243,6 +242,16 @@ if (NOT ONLY_SHARED_LIBS) COMPONENT fortheaders ) + if (HDF5_INSTALL_MOD_FORTRAN MATCHES "STATIC") + install ( + FILES + ${mod_files} + DESTINATION + ${HDF5_INSTALL_INCLUDE_DIR} + COMPONENT + fortheaders + ) + endif () endif () if (BUILD_SHARED_LIBS) set (modsh_files @@ -261,6 +270,16 @@ if (BUILD_SHARED_LIBS) COMPONENT fortheaders ) + if (HDF5_INSTALL_MOD_FORTRAN MATCHES "SHARED") + install ( + FILES + ${modsh_files} + DESTINATION + ${HDF5_INSTALL_INCLUDE_DIR} + COMPONENT + fortheaders + ) + endif () endif () #----------------------------------------------------------------------------- diff --git a/hl/fortran/src/H5IMcc.c b/hl/fortran/src/H5IMcc.c index c6e4b1b..1d12f56 100644 --- a/hl/fortran/src/H5IMcc.c +++ b/hl/fortran/src/H5IMcc.c @@ -34,7 +34,7 @@ herr_t H5IM_get_palette(hid_t loc_id, * * Return: Success: 0, Failure: -1 * - * Programmer: Pedro Vicente Nunes, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente Nunes * * Date: May 10, 2005 * @@ -127,7 +127,7 @@ herr_t H5IMmake_image_8bitf(hid_t loc_id, * * Return: Success: 0, Failure: -1 * - * Programmer: Pedro Vicente Nunes, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente Nunes * * Date: May 10, 2005 * @@ -244,7 +244,7 @@ herr_t H5IMmake_image_24bitf(hid_t loc_id, * * Return: Success: 0, Failure: -1 * - * Programmer: Pedro Vicente Nunes, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente Nunes * * Date: May 10, 2005 * @@ -302,7 +302,7 @@ out: * * Return: Success: 0, Failure: -1 * - * Programmer: Pedro Vicente Nunes, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente Nunes * * Date: May 10, 2005 * @@ -395,7 +395,7 @@ herr_t H5IMmake_palettef(hid_t loc_id, * * Return: Success: 0, Failure: -1 * - * Programmer: Pedro Vicente Nunes, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente Nunes * * Date: May 10, 2005 * @@ -434,7 +434,7 @@ herr_t H5IMget_palettef(hid_t loc_id, * * Return: Success: 0, Failure: -1 * - * Programmer: Pedro Vicente Nunes, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente Nunes * * Date: May 10, 2005 * diff --git a/hl/fortran/src/H5IMfc.c b/hl/fortran/src/H5IMfc.c index cafd623..638cea4 100644 --- a/hl/fortran/src/H5IMfc.c +++ b/hl/fortran/src/H5IMfc.c @@ -24,7 +24,7 @@ * * Return: Success: 0, Failure: -1 * -* Programmer: pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: October 05, 2004 * @@ -85,7 +85,7 @@ done: * * Return: Success: 0, Failure: -1 * -* Programmer: pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: October 05, 2004 * @@ -138,7 +138,7 @@ done: * * Return: Success: 0, Failure: -1 * -* Programmer: pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: October 05, 2004 * @@ -207,7 +207,7 @@ done: * * Return: Success: 0, Failure: -1 * -* Programmer: pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: October 05, 2004 * @@ -292,7 +292,7 @@ done: * * Return: Success: 0, Failure: -1 * -* Programmer: pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: October 06, 2004 * @@ -341,7 +341,7 @@ h5imis_image_c(hid_t_f *loc_id, * * Return: Success: 0, Failure: -1 * -* Programmer: pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: October 06, 2004 * @@ -396,7 +396,7 @@ done: * * Return: Success: 0, Failure: -1 * -* Programmer: pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: October 06, 2004 * @@ -461,7 +461,7 @@ done: * * Return: Success: 0, Failure: -1 * -* Programmer: pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: October 06, 2004 * @@ -527,7 +527,7 @@ done: * * Return: Success: 0, Failure: -1 * -* Programmer: pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: October 06 2004 * @@ -588,7 +588,7 @@ done: * * Return: Success: 0, Failure: -1 * -* Programmer: pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: October 06 2004 * @@ -655,7 +655,7 @@ done: * * Return: Success: 0, Failure: -1 * -* Programmer: pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: October 06 2004 * @@ -714,7 +714,7 @@ done: * * Return: true, false, fail * -* Programmer: pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: October 06, 2004 * diff --git a/hl/fortran/src/H5IMff.F90 b/hl/fortran/src/H5IMff.F90 index ffa18aa..3438e7f 100644 --- a/hl/fortran/src/H5IMff.F90 +++ b/hl/fortran/src/H5IMff.F90 @@ -41,7 +41,7 @@ CONTAINS ! ! Return: Success: 0, Failure: -1 ! -! Programmer: pvn@ncsa.uiuc.edu +! Programmer: Pedro Vicente ! ! Date: October 05, 2004 ! @@ -95,7 +95,7 @@ CONTAINS ! ! Return: Success: 0, Failure: -1 ! -! Programmer: pvn@ncsa.uiuc.edu +! Programmer: Pedro Vicente ! ! Date: October 05, 2004 ! @@ -142,7 +142,7 @@ CONTAINS ! ! Return: Success: 0, Failure: -1 ! -! Programmer: pvn@ncsa.uiuc.edu +! Programmer: Pedro Vicente ! ! Date: October 05, 2004 ! @@ -204,7 +204,7 @@ CONTAINS ! ! Return: Success: 0, Failure: -1 ! -! Programmer: pvn@ncsa.uiuc.edu +! Programmer: Pedro Vicente ! ! Date: October 05, 2004 ! @@ -267,7 +267,7 @@ CONTAINS ! ! Return: Success: 0, Failure: -1 ! -! Programmer: pvn@ncsa.uiuc.edu +! Programmer: Pedro Vicente ! ! Date: October 05, 2004 ! @@ -313,7 +313,7 @@ CONTAINS ! ! Return: Success: 0, Failure: -1 ! -! Programmer: pvn@ncsa.uiuc.edu +! Programmer: Pedro Vicente ! ! Date: October 06, 2004 ! @@ -364,7 +364,7 @@ CONTAINS ! ! Return: Success: 0, Failure: -1 ! -! Programmer: pvn@ncsa.uiuc.edu +! Programmer: Pedro Vicente ! ! Date: October 06, 2004 ! @@ -416,7 +416,7 @@ CONTAINS ! ! Return: Success: 0, Failure: -1 ! -! Programmer: pvn@ncsa.uiuc.edu +! Programmer: Pedro Vicente ! ! Date: October 06, 2004 ! @@ -467,7 +467,7 @@ CONTAINS ! ! Return: Success: 0, Failure: -1 ! -! Programmer: pvn@ncsa.uiuc.edu +! Programmer: Pedro Vicente ! ! Date: October 05, 2004 ! @@ -516,7 +516,7 @@ CONTAINS ! ! Return: Success: 0, Failure: -1 ! -! Programmer: pvn@ncsa.uiuc.edu +! Programmer: Pedro Vicente ! ! Date: October 06, 2004 ! @@ -567,7 +567,7 @@ CONTAINS ! ! Return: Success: 0, Failure: -1 ! -! Programmer: pvn@ncsa.uiuc.edu +! Programmer: Pedro Vicente ! ! Date: October 06, 2004 ! @@ -619,7 +619,7 @@ CONTAINS ! ! Return: true, false, fail ! -! Programmer: pvn@ncsa.uiuc.edu +! Programmer: Pedro Vicente ! ! Date: October 06, 2004 ! diff --git a/hl/fortran/src/H5LTfc.c b/hl/fortran/src/H5LTfc.c index 3597c3a..2c4f274 100644 --- a/hl/fortran/src/H5LTfc.c +++ b/hl/fortran/src/H5LTfc.c @@ -24,7 +24,7 @@ * * Return: Success: 0, Failure: -1 * -* Programmer: pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: September 09, 2004 * @@ -94,7 +94,7 @@ done: * * Return: Success: 0, Failure: -1 * -* Programmer: pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: September 09, 2004 * @@ -153,7 +153,7 @@ done: * * Return: Success: 0, Failure: -1 * -* Programmer: pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: September 09, 2004 * @@ -218,7 +218,7 @@ done: * * Return: Success: 0, Failure: -1 * -* Programmer: pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: September 09, 2004 * @@ -274,7 +274,7 @@ done: * * Return: Success: 0, Failure: -1 * -* Programmer: pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: October 05, 2004 * @@ -373,7 +373,7 @@ done: * * Return: Success: 0, Failure: -1 * -* Programmer: pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: October 05, 2004 * @@ -460,7 +460,7 @@ done: * * Return: Success: 0, Failure: -1 * -* Programmer: pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: October 05, 2004 * @@ -535,7 +535,7 @@ done: * * Return: Success: 0, Failure: -1 * -* Programmer: pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: September 09, 2004 * @@ -595,7 +595,7 @@ done: * * Return: Success: 0, Failure: -1 * -* Programmer: pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: September 09, 2004 * @@ -643,7 +643,7 @@ h5ltfind_dataset_c(hid_t_f *loc_id, * * Return: Success: 0, Failure: -1 * -* Programmer: pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: September 09, 2004 * @@ -722,7 +722,7 @@ done: * * Return: Success: 0, Failure: -1 * -* Programmer: pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: October 05, 2004 * @@ -791,7 +791,7 @@ done: * * Return: Success: 0, Failure: -1 * -* Programmer: pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: September 09, 2004 * diff --git a/hl/fortran/src/H5LTff.F90 b/hl/fortran/src/H5LTff.F90 index bc8734f..5cd255c 100644 --- a/hl/fortran/src/H5LTff.F90 +++ b/hl/fortran/src/H5LTff.F90 @@ -164,7 +164,7 @@ CONTAINS ! ! Return: Success: 0, Failure: -1 ! - ! Programmer: pvn@ncsa.uiuc.edu + ! Programmer: Pedro Vicente ! ! Date: September 1, 2004 ! @@ -385,7 +385,7 @@ CONTAINS ! ! Return: Success: 0, Failure: -1 ! - ! Programmer: pvn@ncsa.uiuc.edu + ! Programmer: Pedro Vicente ! ! Date: September 22, 2004 ! @@ -426,7 +426,7 @@ CONTAINS ! ! Return: Success: 0, Failure: -1 ! - ! Programmer: pvn@ncsa.uiuc.edu + ! Programmer: Pedro Vicente ! ! Date: September 22, 2004 ! @@ -595,7 +595,7 @@ CONTAINS ! ! Return: Success: 0, Failure: -1 ! - ! Programmer: pvn@ncsa.uiuc.edu + ! Programmer: Pedro Vicente ! ! Date: September 22, 2004 ! @@ -770,7 +770,7 @@ CONTAINS ! ! Return: Success: 0, Failure: -1 ! - ! Programmer: pvn@ncsa.uiuc.edu + ! Programmer: Pedro Vicente ! ! Date: September 22, 2004 ! @@ -933,7 +933,7 @@ CONTAINS ! ! Return: Success: 0, Failure: -1 ! - ! Programmer: pvn@ncsa.uiuc.edu + ! Programmer: Pedro Vicente ! ! Date: September 22, 2004 ! @@ -983,7 +983,7 @@ CONTAINS ! ! Return: Success: 0, Failure: -1 ! - ! Programmer: pvn@ncsa.uiuc.edu + ! Programmer: Pedro Vicente ! ! Date: September 22, 2004 ! @@ -1092,7 +1092,7 @@ CONTAINS ! ! Return: Success: 0, Failure: -1 ! - ! Programmer: pvn@ncsa.uiuc.edu + ! Programmer: Pedro Vicente ! ! Date: October 05, 2004 ! @@ -1143,7 +1143,7 @@ CONTAINS ! ! Return: Success: 0, Failure: -1 ! - ! Programmer: pvn@ncsa.uiuc.edu + ! Programmer: Pedro Vicente ! ! Date: October 05, 2004 ! @@ -1193,7 +1193,7 @@ CONTAINS ! ! Return: Success: 0, Failure: -1 ! - ! Programmer: pvn@ncsa.uiuc.edu + ! Programmer: Pedro Vicente ! ! Date: October 05, 2004 ! @@ -1245,7 +1245,7 @@ CONTAINS ! ! Return: Success: 0, Failure: -1 ! - ! Programmer: pvn@ncsa.uiuc.edu + ! Programmer: Pedro Vicente ! ! Date: October 05, 2004 ! @@ -1350,7 +1350,7 @@ CONTAINS ! ! Return: Success: 0, Failure: -1 ! - ! Programmer: pvn@ncsa.uiuc.edu + ! Programmer: Pedro Vicente ! ! Date: October 05, 2004 ! @@ -1397,7 +1397,7 @@ CONTAINS ! ! Return: Success: 0, Failure: -1 ! - ! Programmer: pvn@ncsa.uiuc.edu + ! Programmer: Pedro Vicente ! ! Date: October 05, 2004 ! @@ -1443,7 +1443,7 @@ CONTAINS ! ! Return: Success: 0, Failure: -1 ! - ! Programmer: pvn@ncsa.uiuc.edu + ! Programmer: Pedro Vicente ! ! Date: October 05, 2004 ! @@ -1490,7 +1490,7 @@ CONTAINS ! ! Return: Success: 0, Failure: -1 ! - ! Programmer: pvn@ncsa.uiuc.edu + ! Programmer: Pedro Vicente ! ! Date: October 05, 2004 ! @@ -1551,7 +1551,7 @@ CONTAINS ! ! Return: Success: 0, Failure: -1 ! - ! Programmer: pvn@ncsa.uiuc.edu + ! Programmer: Pedro Vicente ! ! Date: September 30, 2004 ! @@ -1600,7 +1600,7 @@ CONTAINS ! ! Return: Success: 0, Failure: -1 ! - ! Programmer: pvn@ncsa.uiuc.edu + ! Programmer: Pedro Vicente ! ! Date: October 05, 2004 ! @@ -1644,7 +1644,7 @@ CONTAINS ! ! Return: Success: 0, Failure: -1 ! - ! Programmer: pvn@ncsa.uiuc.edu + ! Programmer: Pedro Vicente ! ! Date: September 30, 2004 ! @@ -1703,7 +1703,7 @@ CONTAINS ! ! Return: Success: 0, Failure: -1 ! - ! Programmer: pvn@ncsa.uiuc.edu + ! Programmer: Pedro Vicente ! ! Date: October 05, 2004 ! @@ -1757,7 +1757,7 @@ CONTAINS ! ! Return: Success: 0, Failure: -1 ! - ! Programmer: pvn@ncsa.uiuc.edu + ! Programmer: Pedro Vicente ! ! Date: September 30, 2004 ! diff --git a/hl/fortran/src/H5TBfc.c b/hl/fortran/src/H5TBfc.c index 285cd84..bd582e4 100644 --- a/hl/fortran/src/H5TBfc.c +++ b/hl/fortran/src/H5TBfc.c @@ -26,7 +26,7 @@ * * Return: Success: 0, Failure: -1 * -* Programmer: pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: October 06, 2004 * @@ -301,7 +301,7 @@ done: * * Return: Success: 0, Failure: -1 * -* Programmer: pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: October 12, 2004 * @@ -350,7 +350,7 @@ done: * * Return: Success: 0, Failure: -1 * -* Programmer: pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: October 12, 2004 * @@ -398,7 +398,7 @@ done: * * Return: Success: 0, Failure: -1 * -* Programmer: pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: October 12, 2004 * @@ -443,7 +443,7 @@ done: * * Return: Success: 0, Failure: -1 * -* Programmer: pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: October 12, 2004 * @@ -487,7 +487,7 @@ done: * * Return: Success: 0, Failure: -1 * -* Programmer: pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: October 13, 2004 * @@ -534,7 +534,7 @@ done: * * Return: Success: 0, Failure: -1 * -* Programmer: pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: October 13, 2004 * @@ -580,7 +580,7 @@ done: * * Return: Success: 0, Failure: -1 * -* Programmer: pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: October 12, 2004 * @@ -627,7 +627,7 @@ done: * * Return: Success: 0, Failure: -1 * -* Programmer: pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: October 13, 2004 * diff --git a/hl/fortran/src/H5TBff.F90 b/hl/fortran/src/H5TBff.F90 index c3db01e..e39af97 100644 --- a/hl/fortran/src/H5TBff.F90 +++ b/hl/fortran/src/H5TBff.F90 @@ -172,7 +172,7 @@ CONTAINS ! ! Return: Success: 0, Failure: -1 ! -! Programmer: pvn@ncsa.uiuc.edu +! Programmer: Pedro Vicente ! ! Date: October 06, 2004 ! @@ -424,7 +424,7 @@ CONTAINS ! ! Purpose: Writes one field ! -! Programmer: pvn@ncsa.uiuc.edu +! Programmer: Pedro Vicente ! ! Date: October 12, 2004 ! @@ -505,7 +505,7 @@ CONTAINS ! ! Purpose: Reads one field ! -! Programmer: pvn@ncsa.uiuc.edu +! Programmer: Pedro Vicente ! ! Date: October 12, 2004 ! @@ -586,7 +586,7 @@ CONTAINS ! ! Purpose: Writes one field ! -! Programmer: pvn@ncsa.uiuc.edu +! Programmer: Pedro Vicente ! ! Date: October 12, 2004 ! @@ -661,7 +661,7 @@ CONTAINS ! ! Purpose: Reads one field ! -! Programmer: pvn@ncsa.uiuc.edu +! Programmer: Pedro Vicente ! ! Date: October 12, 2004 ! @@ -734,7 +734,7 @@ CONTAINS ! ! Purpose: Inserts one field ! -! Programmer: pvn@ncsa.uiuc.edu +! Programmer: Pedro Vicente ! ! Date: October 13, 2004 ! @@ -807,7 +807,7 @@ CONTAINS ! ! Purpose: Inserts one field ! -! Programmer: pvn@ncsa.uiuc.edu +! Programmer: Pedro Vicente ! ! Date: October 13, 2004 ! @@ -858,7 +858,7 @@ CONTAINS ! ! Return: Success: 0, Failure: -1 ! -! Programmer: pvn@ncsa.uiuc.edu +! Programmer: Pedro Vicente ! ! Date: October 13, 2004 ! @@ -909,7 +909,7 @@ CONTAINS ! ! Return: Success: 0, Failure: -1 ! -! Programmer: pvn@ncsa.uiuc.edu +! Programmer: Pedro Vicente ! ! Date: October 13, 2004 ! diff --git a/hl/src/H5DS.c b/hl/src/H5DS.c index 63fb461..9847cae 100644 --- a/hl/src/H5DS.c +++ b/hl/src/H5DS.c @@ -11,9 +11,6 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include -#include -#include #include "H5DSprivate.h" #include "H5LTprivate.h" #include "H5IMprivate.h" @@ -25,29 +22,24 @@ static herr_t H5DS_is_reserved(hid_t did); static hid_t H5DS_get_REFLIST_type(void); /*------------------------------------------------------------------------- -* Function: H5DSset_scale -* -* Purpose: The dataset DSID is converted to a Dimension Scale dataset. -* Creates the CLASS attribute, set to the value "DIMENSION_SCALE" -* and an empty REFERENCE_LIST attribute. -* If DIMNAME is specified, then an attribute called NAME is created, -* with the value DIMNAME. -* -* Return: Success: SUCCEED, Failure: FAIL -* -* Programmer: pvn@ncsa.uiuc.edu -* -* Date: January 04, 2005 -* -* Comments: -* -* Modifications: -* -*------------------------------------------------------------------------- -*/ - -herr_t H5DSset_scale(hid_t dsid, - const char *dimname) + * Function: H5DSset_scale + * + * Purpose: The dataset DSID is converted to a Dimension Scale dataset. + * Creates the CLASS attribute, set to the value "DIMENSION_SCALE" + * and an empty REFERENCE_LIST attribute. + * If DIMNAME is specified, then an attribute called NAME is created, + * with the value DIMNAME. + * + * Return: Success: SUCCEED, Failure: FAIL + * + * Programmer: Pedro Vicente + * + * Date: January 04, 2005 + * + *------------------------------------------------------------------------- + */ +herr_t +H5DSset_scale(hid_t dsid, const char *dimname) { int has_dimlist; H5I_type_t it; @@ -95,34 +87,28 @@ herr_t H5DSset_scale(hid_t dsid, /*------------------------------------------------------------------------- -* Function: H5DSattach_scale -* -* Purpose: Define Dimension Scale DSID to be associated with dimension IDX -* of Dataset DID. Entries are created in the DIMENSION_LIST and -* REFERENCE_LIST attributes. -* -* Return: -* Success: SUCCEED -* Failure: FAIL -* -* Fails if: Bad arguments -* If DSID is not a Dimension Scale -* If DID is a Dimension Scale (A Dimension Scale cannot have scales) -* -* Programmer: pvn@ncsa.uiuc.edu -* -* Date: December 20, 2004 -* -* Comments: -* -* Modifications: -* -*------------------------------------------------------------------------- -*/ - -herr_t H5DSattach_scale(hid_t did, - hid_t dsid, - unsigned int idx) + * Function: H5DSattach_scale + * + * Purpose: Define Dimension Scale DSID to be associated with dimension IDX + * of Dataset DID. Entries are created in the DIMENSION_LIST and + * REFERENCE_LIST attributes. + * + * Return: + * Success: SUCCEED + * Failure: FAIL + * + * Fails if: Bad arguments + * If DSID is not a Dimension Scale + * If DID is a Dimension Scale (A Dimension Scale cannot have scales) + * + * Programmer: Pedro Vicente + * + * Date: December 20, 2004 + * + *------------------------------------------------------------------------- + */ +herr_t +H5DSattach_scale(hid_t did, hid_t dsid, unsigned int idx) { int has_dimlist; int has_reflist; @@ -547,39 +533,31 @@ out: } /*------------------------------------------------------------------------- -* Function: H5DSdetach_scale -* -* Purpose: If possible, deletes association of Dimension Scale DSID with -* dimension IDX of Dataset DID. This deletes the entries in the -* DIMENSION_LIST and REFERENCE_LIST attributes. -* -* Return: -* Success: SUCCEED -* Failure: FAIL -* -* Fails if: Bad arguments -* The dataset DID or DSID do not exist. -* The DSID is not a Dimension Scale -* DSID is not attached to DID. -* Note that a scale may be associated with more than dimension of the same dataset. -* If so, the detach operation only deletes one of the associations, for DID. -* -* Programmer: pvn@ncsa.uiuc.edu -* -* Date: December 20, 2004 -* -* Comments: -* -* Modifications: Function didn't delete DIMENSION_LIST attribute, when -* all dimension scales were detached from a dataset; added. -* 2010/05/13 EIP -* -*------------------------------------------------------------------------- -*/ - -herr_t H5DSdetach_scale(hid_t did, - hid_t dsid, - unsigned int idx) + * Function: H5DSdetach_scale + * + * Purpose: If possible, deletes association of Dimension Scale DSID with + * dimension IDX of Dataset DID. This deletes the entries in the + * DIMENSION_LIST and REFERENCE_LIST attributes. + * + * Return: + * Success: SUCCEED + * Failure: FAIL + * + * Fails if: Bad arguments + * The dataset DID or DSID do not exist. + * The DSID is not a Dimension Scale + * DSID is not attached to DID. + * Note that a scale may be associated with more than dimension of the same dataset. + * If so, the detach operation only deletes one of the associations, for DID. + * + * Programmer: Pedro Vicente + * + * Date: December 20, 2004 + * + *------------------------------------------------------------------------- + */ +herr_t +H5DSdetach_scale(hid_t did, hid_t dsid, unsigned int idx) { int has_dimlist; int has_reflist; @@ -940,35 +918,29 @@ out: } /*------------------------------------------------------------------------- -* Function: H5DSis_attached -* -* Purpose: Report if dimension scale DSID is currently attached to -* dimension IDX of dataset DID by checking if DID has a pointer in the REFERENCE_LIST -* attribute and DSID (scale ) has a pointer in the DIMENSION_LIST attribute -* -* Return: -* 1: both the DS and the dataset pointers match -* 0: one of them or both do not match -* FAIL (-1): error -* -* Fails if: Bad arguments -* If DSID is not a Dimension Scale -* If DID is a Dimension Scale (A Dimension Scale cannot have scales) -* -* Programmer: pvn@ncsa.uiuc.edu -* -* Date: February 18, 2005 -* -* Comments: -* -* Modifications: -* -*------------------------------------------------------------------------- -*/ - -htri_t H5DSis_attached(hid_t did, - hid_t dsid, - unsigned int idx) + * Function: H5DSis_attached + * + * Purpose: Report if dimension scale DSID is currently attached to + * dimension IDX of dataset DID by checking if DID has a pointer in the REFERENCE_LIST + * attribute and DSID (scale ) has a pointer in the DIMENSION_LIST attribute + * + * Return: + * 1: both the DS and the dataset pointers match + * 0: one of them or both do not match + * FAIL (-1): error + * + * Fails if: Bad arguments + * If DSID is not a Dimension Scale + * If DID is a Dimension Scale (A Dimension Scale cannot have scales) + * + * Programmer: Pedro Vicente + * + * Date: February 18, 2005 + * + *------------------------------------------------------------------------- + */ +htri_t +H5DSis_attached(hid_t did, hid_t dsid, unsigned int idx) { int has_dimlist; int has_reflist; @@ -1249,54 +1221,47 @@ out: } /*------------------------------------------------------------------------- -* Function: H5DSiterate_scales -* -* Purpose: H5DSiterate_scales iterates over the scales attached to dimension DIM -* of dataset DID. For each scale in the list, the visitor_data and some -* additional information, specified below, are passed to the visitor function. -* The iteration begins with the IDX object in the group and the next element -* to be processed by the operator is returned in IDX. If IDX is NULL, then the -* iterator starts at zero. -* -* Parameters: -* -* hid_t DID; IN: the dataset -* unsigned int DIM; IN: the dimension of the dataset -* int *DS_IDX; IN/OUT: on input the dimension scale index to start iterating, -* on output the next index to visit. If NULL, start at -* the first position. -* H5DS_iterate_t VISITOR; IN: the visitor function -* void *VISITOR_DATA; IN: arbitrary data to pass to the visitor function. -* -* Iterate over all scales of DIM, calling an application callback -* with the item, key and any operator data. -* -* The operator callback receives a pointer to the item , -* and the pointer to the operator data passed -* in to H5SL_iterate ('op_data'). The return values from an operator are: -* A. Zero causes the iterator to continue, returning zero when all -* nodes of that type have been processed. -* B. Positive causes the iterator to immediately return that positive -* value, indicating short-circuit success. -* C. Negative causes the iterator to immediately return that value, -* indicating failure. -* -* Programmer: pvn@ncsa.uiuc.edu -* -* Date: January 31, 2005 -* -* Comments: -* -* Modifications: -* -*------------------------------------------------------------------------- -*/ - -herr_t H5DSiterate_scales(hid_t did, - unsigned int dim, - int *ds_idx, - H5DS_iterate_t visitor, - void *visitor_data ) + * Function: H5DSiterate_scales + * + * Purpose: H5DSiterate_scales iterates over the scales attached to dimension DIM + * of dataset DID. For each scale in the list, the visitor_data and some + * additional information, specified below, are passed to the visitor function. + * The iteration begins with the IDX object in the group and the next element + * to be processed by the operator is returned in IDX. If IDX is NULL, then the + * iterator starts at zero. + * + * Parameters: + * + * hid_t DID; IN: the dataset + * unsigned int DIM; IN: the dimension of the dataset + * int *DS_IDX; IN/OUT: on input the dimension scale index to start iterating, + * on output the next index to visit. If NULL, start at + * the first position. + * H5DS_iterate_t VISITOR; IN: the visitor function + * void *VISITOR_DATA; IN: arbitrary data to pass to the visitor function. + * + * Iterate over all scales of DIM, calling an application callback + * with the item, key and any operator data. + * + * The operator callback receives a pointer to the item , + * and the pointer to the operator data passed + * in to H5SL_iterate ('op_data'). The return values from an operator are: + * A. Zero causes the iterator to continue, returning zero when all + * nodes of that type have been processed. + * B. Positive causes the iterator to immediately return that positive + * value, indicating short-circuit success. + * C. Negative causes the iterator to immediately return that value, + * indicating failure. + * + * Programmer: Pedro Vicente + * + * Date: January 31, 2005 + * + *------------------------------------------------------------------------- + */ +herr_t +H5DSiterate_scales(hid_t did, unsigned int dim, int *ds_idx, + H5DS_iterate_t visitor, void *visitor_data ) { hid_t scale_id; int rank; @@ -1450,24 +1415,20 @@ out: } /*------------------------------------------------------------------------- -* Function: H5DSset_label -* -* Purpose: Set label for the dimension IDX of dataset DID to the value LABEL -* -* Return: Success: SUCCEED, Failure: FAIL -* -* Programmer: pvn@ncsa.uiuc.edu -* -* Date: January 11, 2005 -* -* Comments: -* -* Modifications: -* -*------------------------------------------------------------------------- -*/ - -herr_t H5DSset_label(hid_t did, unsigned int idx, const char *label) + * Function: H5DSset_label + * + * Purpose: Set label for the dimension IDX of dataset DID to the value LABEL + * + * Return: Success: SUCCEED, Failure: FAIL + * + * Programmer: Pedro Vicente + * + * Date: January 11, 2005 + * + *------------------------------------------------------------------------- + */ +herr_t +H5DSset_label(hid_t did, unsigned int idx, const char *label) { int has_labels; hid_t sid = -1; /* space ID */ @@ -1481,6 +1442,9 @@ herr_t H5DSset_label(hid_t did, unsigned int idx, const char *label) char ** buf; /* discarding the 'const' qualifier in the free */ char const ** const_buf; /* buf calls */ } u; + + HDmemset(&u, 0, sizeof(u)); + /*------------------------------------------------------------------------- * parameter checking *------------------------------------------------------------------------- @@ -1656,29 +1620,24 @@ out: } /*------------------------------------------------------------------------- -* Function: H5DSget_label -* -* Purpose: Read the label LABEL for dimension IDX of dataset DID -* Up to 'size' characters are stored in 'label' followed by a '\0' string -* terminator. If the label is longer than 'size'-1, -* the string terminator is stored in the last position of the buffer to -* properly terminate the string. -* -* Return: 0 if no label found, size of label if found, Failure: FAIL -* -* Programmer: pvn@ncsa.uiuc.edu -* -* Date: January 11, 2005 -* -* Comments: -* -* Modifications: -* JIRA HDFFV-7673: Added a check to see if the label name exists, -* if not then returns zero. July 30, 2011. MSB -* -*------------------------------------------------------------------------- -*/ -ssize_t H5DSget_label(hid_t did, unsigned int idx, char *label, size_t size) + * Function: H5DSget_label + * + * Purpose: Read the label LABEL for dimension IDX of dataset DID + * Up to 'size' characters are stored in 'label' followed by a '\0' string + * terminator. If the label is longer than 'size'-1, + * the string terminator is stored in the last position of the buffer to + * properly terminate the string. + * + * Return: 0 if no label found, size of label if found, Failure: FAIL + * + * Programmer: Pedro Vicente + * + * Date: January 11, 2005 + * + *------------------------------------------------------------------------- + */ +ssize_t +H5DSget_label(hid_t did, unsigned int idx, char *label, size_t size) { int has_labels; hid_t sid = -1; /* space ID */ @@ -1818,32 +1777,24 @@ out: } /*------------------------------------------------------------------------- -* Function: H5DSget_scale_name -* -* Purpose: Read the name of dataset scale DID into buffer NAME -* Up to 'size' characters are stored in 'name' followed by a '\0' string -* terminator. If the name is longer than 'size'-1, -* the string terminator is stored in the last position of the buffer to -* properly terminate the string. -* -* Return: size of name if found, zero if not found, Failure: FAIL -* -* Programmer: pvn@ncsa.uiuc.edu -* -* Date: January 04, 2005 -* -* Comments: -* -* Modifications: -* The size of the name returned should not include the NULL termination -* in its value so as to be consistent with other HDF5 APIs. -* -*------------------------------------------------------------------------- -*/ - -ssize_t H5DSget_scale_name(hid_t did, - char *name, - size_t size) + * Function: H5DSget_scale_name + * + * Purpose: Read the name of dataset scale DID into buffer NAME + * Up to 'size' characters are stored in 'name' followed by a '\0' string + * terminator. If the name is longer than 'size'-1, + * the string terminator is stored in the last position of the buffer to + * properly terminate the string. + * + * Return: size of name if found, zero if not found, Failure: FAIL + * + * Programmer: Pedro Vicente + * + * Date: January 04, 2005 + * + *------------------------------------------------------------------------- + */ +ssize_t +H5DSget_scale_name(hid_t did, char *name, size_t size) { hid_t aid; /* attribute ID */ hid_t tid = -1; /* attribute type ID */ @@ -1945,51 +1896,49 @@ out: } /*------------------------------------------------------------------------- -* Function: H5DSis_scale -* -* Purpose: check if the dataset DID is a dimension scale -* -* Return: 1, is, 0, not, FAIL, error -* -* Programmer: pvn@ncsa.uiuc.edu -* -* Date: January 04, 2005 -* -* Comments: -* -* Modifications: -* -*------------------------------------------------------------------------- -*/ - + * Function: H5DSis_scale + * + * Purpose: check if the dataset DID is a dimension scale + * + * Return: 1, is, 0, not, FAIL, error + * + * Programmer: Pedro Vicente + * + * Date: January 04, 2005 + * + *------------------------------------------------------------------------- + */ htri_t H5DSis_scale(hid_t did) { - hid_t tid = -1; /* attribute type ID */ - hid_t aid = -1; /* attribute ID */ - herr_t has_class; /* has the "CLASS" attribute */ - htri_t is_ds; /* boolean return value */ - H5I_type_t it; /* ID type */ - char *buf; /* Name of attribute */ - hsize_t storage_size; /* Size of storage for attribute */ - - /*------------------------------------------------------------------------- + hid_t tid = -1; /* attribute type ID */ + hid_t aid = -1; /* attribute ID */ + herr_t attr_class; /* has the "CLASS" attribute */ + htri_t is_ds = -1; /* set to "not a dimension scale" */ + H5I_type_t it; /* type of identifier */ + char *buf = NULL; /* buffer to read name of attribute */ + size_t string_size; /* size of storage for the attribute */ + H5T_class_t type_class; + H5T_str_t strpad; + + /*------------------------------------------------------------------------ * parameter checking *------------------------------------------------------------------------- */ /* get ID type */ if ((it = H5Iget_type(did)) < 0) - return FAIL; + goto out; if(H5I_DATASET != it) - return FAIL; + goto out; /* try to find the attribute "CLASS" on the dataset */ - if((has_class = H5LT_find_attribute(did, "CLASS")) < 0) - return FAIL; + if((attr_class = H5LT_find_attribute(did, "CLASS")) < 0) + goto out; - if(has_class == 0) + if(attr_class == 0) { is_ds = 0; - + goto out; + } else { if((aid = H5Aopen(did, "CLASS", H5P_DEFAULT)) < 0) @@ -1998,19 +1947,33 @@ htri_t H5DSis_scale(hid_t did) if((tid = H5Aget_type(aid)) < 0) goto out; - /* check to make sure attribute is a string */ - if(H5T_STRING != H5Tget_class(tid)) + /* check to make sure attribute is a string; + if not, then it is not dimension scale */ + if((type_class = H5Tget_class(tid)) < 0) goto out; - - /* check to make sure string is null-terminated */ - if(H5T_STR_NULLTERM != H5Tget_strpad(tid)) + if(H5T_STRING != type_class) { + is_ds = 0; + goto out; + } + /* check to make sure string is null-terminated; + if not, then it is not dimension scale */ + if((strpad = H5Tget_strpad(tid)) < 0 ) + goto out; + if(H5T_STR_NULLTERM != strpad) { + is_ds = 0; goto out; + } - /* allocate buffer large enough to hold string */ - if((storage_size = H5Aget_storage_size(aid)) == 0) + /* According to Spec string is ASCII and its size should be 16 to hold + "DIMENSION_SCALE" string */ + if((string_size = H5Tget_size(tid)) == 0) + goto out; + if(string_size != 16) { + is_ds = 0; goto out; + } - buf = (char*)HDmalloc( (size_t)storage_size * sizeof(char) + 1); + buf = (char*)HDmalloc((size_t)string_size * sizeof(char)); if(buf == NULL) goto out; @@ -2019,10 +1982,9 @@ htri_t H5DSis_scale(hid_t did) goto out; /* compare strings */ - if(HDstrncmp(buf, DIMENSION_SCALE_CLASS, MIN(HDstrlen(DIMENSION_SCALE_CLASS),HDstrlen(buf)))==0) + if(HDstrncmp(buf, DIMENSION_SCALE_CLASS, + MIN(HDstrlen(DIMENSION_SCALE_CLASS),HDstrlen(buf)))==0) is_ds = 1; - else - is_ds = 0; HDfree(buf); @@ -2031,44 +1993,35 @@ htri_t H5DSis_scale(hid_t did) if (H5Aclose(aid) < 0) goto out; - - } - - return is_ds; - - /* error zone */ out: - H5E_BEGIN_TRY { - H5Aclose(aid); - H5Tclose(tid); - } H5E_END_TRY; - return FAIL; - + if(is_ds < 0) { + HDfree(buf); + H5E_BEGIN_TRY { + H5Aclose(aid); + H5Tclose(tid); + } H5E_END_TRY; + } + return is_ds; } /*------------------------------------------------------------------------- -* Function: H5DSget_num_scales -* -* Purpose: get the number of scales linked to the IDX dimension of dataset DID -* -* Return: -* Success: number of scales -* Failure: FAIL -* -* Programmer: pvn@ncsa.uiuc.edu -* -* Date: January 13, 2005 -* -* Comments: -* -* Modifications: -* -*------------------------------------------------------------------------- -*/ - -int H5DSget_num_scales(hid_t did, - unsigned int idx) + * Function: H5DSget_num_scales + * + * Purpose: get the number of scales linked to the IDX dimension of dataset DID + * + * Return: + * Success: number of scales + * Failure: FAIL + * + * Programmer: Pedro Vicente + * + * Date: January 13, 2005 + * + *------------------------------------------------------------------------- + */ +int +H5DSget_num_scales(hid_t did, unsigned int idx) { int has_dimlist; hid_t sid; /* space ID */ @@ -2171,25 +2124,20 @@ out: } /*------------------------------------------------------------------------- -* Function: H5DS_is_reserved -* -* Purpose: Verify that a dataset's CLASS is either an image, palette or table -* -* Return: true, false, fail -* -* Programmer: pvn@ncsa.uiuc.edu -* -* Date: March 19, 2005 -* -* Comments: -* -* Modifications: -* -*------------------------------------------------------------------------- -*/ - -static -herr_t H5DS_is_reserved(hid_t did) + * Function: H5DS_is_reserved + * + * Purpose: Verify that a dataset's CLASS is either an image, palette or table + * + * Return: true, false, fail + * + * Programmer: Pedro Vicente + * + * Date: March 19, 2005 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5DS_is_reserved(hid_t did) { int has_class; hid_t tid = -1; @@ -2262,26 +2210,21 @@ out: } /*------------------------------------------------------------------------- -* Function: H5DS_get_REFLIST_type -* -* Purpose: This is a helper function to return a native type for -* the REFERENCE_LIST attribute. -* -* Return: Type identifier on success and negative on failure -* -* Programmer: epourmal@hdfgroup.org -* -* Date: May 22, 2010 -* -* Comments: -* -* Modifications: -* -*------------------------------------------------------------------------- -*/ - -static -hid_t H5DS_get_REFLIST_type(void) + * Function: H5DS_get_REFLIST_type + * + * Purpose: This is a helper function to return a native type for + * the REFERENCE_LIST attribute. + * + * Return: Type identifier on success and negative on failure + * + * Programmer: Elena Pourmal + * + * Date: May 22, 2010 + * + *------------------------------------------------------------------------- + */ +static hid_t +H5DS_get_REFLIST_type(void) { hid_t ntid_t = -1; diff --git a/hl/src/H5IM.c b/hl/src/H5IM.c index 2a7ed9b..2b292dc 100644 --- a/hl/src/H5IM.c +++ b/hl/src/H5IM.c @@ -13,8 +13,6 @@ #include "H5IMprivate.h" #include "H5LTprivate.h" -#include -#include /*------------------------------------------------------------------------- * Function: H5IMmake_image_8bit @@ -23,7 +21,7 @@ * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente Nunes, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente Nunes * * Date: June 13, 2001 * @@ -77,7 +75,7 @@ herr_t H5IMmake_image_8bit( hid_t loc_id, * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente Nunes, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente Nunes * * Date: June 13, 2001 * @@ -162,7 +160,7 @@ herr_t H5IMmake_image_24bit( hid_t loc_id, * * Return: * -* Programmer: Pedro Vicente Nunes, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente Nunes * * Date: May 28, 2001 * @@ -204,7 +202,7 @@ static herr_t find_palette(hid_t loc_id, * * Return: Success: 1, Failure: 0 * -* Programmer: Pedro Vicente Nunes, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente Nunes * * Date: May 11, 2001 * @@ -230,7 +228,7 @@ herr_t H5IM_find_palette( hid_t loc_id ) * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente Nunes, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente Nunes * * Date: July 25, 2001 * @@ -274,7 +272,8 @@ herr_t H5IMget_image_info( hid_t loc_id, return -1; /* Try to find the attribute "INTERLACE_MODE" on the >>image<< dataset */ - has_attr = H5LT_find_attribute(did, "INTERLACE_MODE"); + if ((has_attr = H5LT_find_attribute(did, "INTERLACE_MODE")) < 0) + goto out; /* It exists, get it */ if(has_attr == 1) @@ -411,7 +410,7 @@ out: * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente Nunes, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente Nunes * * Date: June 13, 2001 * @@ -461,7 +460,7 @@ out: * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente Nunes, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente Nunes * * Date: May 01, 2001 * @@ -517,7 +516,7 @@ herr_t H5IMmake_palette( hid_t loc_id, * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente Nunes, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente Nunes * * Date: May 01, 2001 * @@ -694,7 +693,7 @@ out: * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente Nunes, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente Nunes * * Date: September 10, 2001 * @@ -795,7 +794,7 @@ out: * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente Nunes, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente Nunes * * Date: July 22, 2001 * @@ -886,7 +885,7 @@ out: * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente Nunes, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente Nunes * * Date: July 22, 2001 * @@ -1002,7 +1001,7 @@ out: * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente Nunes, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente Nunes * * Date: August 30, 2001 * @@ -1109,7 +1108,7 @@ out: * * Return: true, false, fail * -* Programmer: Pedro Vicente Nunes, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente Nunes * * Date: August 30, 2001 * @@ -1213,7 +1212,7 @@ out: * * Return: true, false, fail * -* Programmer: Pedro Vicente Nunes, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente Nunes * * Date: August 30, 2001 * diff --git a/hl/src/H5LD.c b/hl/src/H5LD.c index 3106ea8..21975d1 100644 --- a/hl/src/H5LD.c +++ b/hl/src/H5LD.c @@ -11,10 +11,6 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include -#include -#include -#include #include "H5LDprivate.h" /*------------------------------------------------------------------------- diff --git a/hl/src/H5LT.c b/hl/src/H5LT.c index a631533..939f6aa 100644 --- a/hl/src/H5LT.c +++ b/hl/src/H5LT.c @@ -11,11 +11,6 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include -#include -#include -#include - #include "H5LTprivate.h" /* For Lex and Yacc */ @@ -504,7 +499,7 @@ static herr_t H5LT_get_attribute_mem(hid_t loc_id, * * Return: Success: 0, Failure: -1 * -* Programmer: Quincey Koziol, koziol@hdfgroup.org +* Programmer: Quincey Koziol * * Date: October 10, 2007 * @@ -570,7 +565,7 @@ out: * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: March 19, 2001 * @@ -599,7 +594,7 @@ herr_t H5LTmake_dataset( hid_t loc_id, * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: September 14, 2001 * @@ -628,7 +623,7 @@ herr_t H5LTmake_dataset_char( hid_t loc_id, * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: September 14, 2001 * @@ -657,7 +652,7 @@ herr_t H5LTmake_dataset_short( hid_t loc_id, * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: September 14, 2001 * @@ -688,7 +683,7 @@ herr_t H5LTmake_dataset_int( hid_t loc_id, * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: September 14, 2001 * @@ -717,7 +712,7 @@ herr_t H5LTmake_dataset_long( hid_t loc_id, * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: September 14, 2001 * @@ -748,7 +743,7 @@ herr_t H5LTmake_dataset_float( hid_t loc_id, * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: September 14, 2001 * @@ -778,7 +773,7 @@ herr_t H5LTmake_dataset_double( hid_t loc_id, * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: October 05, 2004 * @@ -970,7 +965,7 @@ out: * * Return: Success: 0, Failure: -1 * -* Programmer: Quincey Koziol, koziol@hdfgroup.org +* Programmer: Quincey Koziol * * Date: October 8, 2007 * @@ -1012,7 +1007,7 @@ out: * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: June 13, 2001 * @@ -1035,7 +1030,7 @@ herr_t H5LTread_dataset(hid_t loc_id, * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: November 5, 2001 * @@ -1056,7 +1051,7 @@ herr_t H5LTread_dataset_char( hid_t loc_id, * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: November 5, 2001 * @@ -1077,7 +1072,7 @@ herr_t H5LTread_dataset_short( hid_t loc_id, * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: November 5, 2001 * @@ -1098,7 +1093,7 @@ herr_t H5LTread_dataset_int( hid_t loc_id, * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: November 5, 2001 * @@ -1119,7 +1114,7 @@ herr_t H5LTread_dataset_long( hid_t loc_id, * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: November 5, 2001 * @@ -1141,7 +1136,7 @@ herr_t H5LTread_dataset_float( hid_t loc_id, * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: November 5, 2001 * @@ -1163,7 +1158,7 @@ herr_t H5LTread_dataset_double( hid_t loc_id, * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: October 05, 2004 * @@ -1216,7 +1211,7 @@ out: * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: September 4, 2001 * @@ -1272,7 +1267,7 @@ out: * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: September 4, 2001 * Modified: February 28, 2006: checked for NULL parameters @@ -1348,7 +1343,7 @@ out: * * Purpose: operator function used by H5LTfind_dataset * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: June 21, 2001 * @@ -1392,7 +1387,7 @@ find_dataset(hid_t loc_id, const char *name, const H5L_info2_t *linfo, void *op_ * Purpose: Inquires if a dataset named dset_name exists attached * to the object loc_id. * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: July 15, 2001 * @@ -1436,7 +1431,7 @@ H5_GCC_DIAG_ON(cast-qual) * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: July 23, 2001 * @@ -1534,7 +1529,7 @@ out: * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: July 25, 2001 * @@ -1613,7 +1608,7 @@ out: * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: November 7, 2001 * @@ -1643,7 +1638,7 @@ herr_t H5LTset_attribute_char( hid_t loc_id, * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: March 8, 2004 * @@ -1674,7 +1669,7 @@ herr_t H5LTset_attribute_uchar( hid_t loc_id, * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: November 7, 2001 * @@ -1705,7 +1700,7 @@ herr_t H5LTset_attribute_short( hid_t loc_id, * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: March 8, 2004 * @@ -1736,7 +1731,7 @@ herr_t H5LTset_attribute_ushort( hid_t loc_id, * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: November 7, 2001 * @@ -1767,7 +1762,7 @@ herr_t H5LTset_attribute_int( hid_t loc_id, * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: March 8, 2004 * @@ -1799,7 +1794,7 @@ herr_t H5LTset_attribute_uint( hid_t loc_id, * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: November 7, 2001 * @@ -1829,7 +1824,7 @@ herr_t H5LTset_attribute_long( hid_t loc_id, * * Return: Success: 0, Failure: -1 * -* Programmer: Elena Pourmal, epourmal@ncsa.uiuc.edu +* Programmer: Elena Pourmal * * Date: June 17, 2005 * @@ -1861,7 +1856,7 @@ herr_t H5LTset_attribute_long_long( hid_t loc_id, * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: March 8, 2004 * @@ -1893,7 +1888,7 @@ herr_t H5LTset_attribute_ulong( hid_t loc_id, * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: July 25, 2001 * @@ -1926,7 +1921,7 @@ herr_t H5LTset_attribute_float( hid_t loc_id, * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: November 7, 2001 * @@ -1957,7 +1952,7 @@ herr_t H5LTset_attribute_double( hid_t loc_id, * * Purpose: operator function used by H5LT_find_attribute * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: June 21, 2001 * @@ -1998,7 +1993,7 @@ find_attr(hid_t loc_id, const char *name, const H5A_info_t *ainfo, * Purpose: Inquires if an attribute named attr_name exists attached to * the object loc_id. * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: May 17, 2006 * @@ -2020,7 +2015,7 @@ herr_t H5LTfind_attribute( hid_t loc_id, const char* attr_name ) * * Purpose: Inquires if an attribute named attr_name exists attached to the object loc_id. * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: June 21, 2001 * @@ -2059,7 +2054,7 @@ H5_GCC_DIAG_ON(cast-qual) * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: September 4, 2001 * @@ -2129,7 +2124,7 @@ out: * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: September 4, 2001 * @@ -2215,7 +2210,7 @@ out: * * Return: Success: 0, Failure: -1 * -* Programmer: Raymond Lu, slu@ncsa.uiuc.edu +* Programmer: Raymond Lu * * Date: October 6, 2004 * @@ -2265,7 +2260,7 @@ out: * * Return: void * -* Programmer: Raymond Lu, songyulu@hdfgroup.org +* Programmer: Raymond Lu * * Date: 29 September 2011 * @@ -2325,7 +2320,7 @@ out: * * Return: void * -* Programmer: Raymond Lu, slu@ncsa.uiuc.edu +* Programmer: Raymond Lu * * Date: December 6, 2005 * @@ -2489,7 +2484,7 @@ out: * * Return: Success: 0, Failure: -1 * -* Programmer: Raymond Lu, slu@ncsa.uiuc.edu +* Programmer: Raymond Lu * * Date: December 6, 2005 * @@ -2536,7 +2531,7 @@ out: * * Return: Success: 0, Failure: -1 * -* Programmer: Raymond Lu, slu@ncsa.uiuc.edu +* Programmer: Raymond Lu * * Date: December 20, 2005 * @@ -3101,7 +3096,7 @@ out: * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: September 19, 2002 * @@ -3153,7 +3148,7 @@ herr_t H5LTget_attribute_string( hid_t loc_id, * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: September 19, 2002 * @@ -3182,7 +3177,7 @@ herr_t H5LTget_attribute_char( hid_t loc_id, * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: March 8, 2004 * @@ -3213,7 +3208,7 @@ herr_t H5LTget_attribute_uchar( hid_t loc_id, * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: September 19, 2002 * @@ -3242,7 +3237,7 @@ herr_t H5LTget_attribute_short( hid_t loc_id, * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: March 8, 2004 * @@ -3273,7 +3268,7 @@ herr_t H5LTget_attribute_ushort( hid_t loc_id, * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: September 19, 2002 * @@ -3302,7 +3297,7 @@ herr_t H5LTget_attribute_int( hid_t loc_id, * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: March 8, 2004 * @@ -3333,7 +3328,7 @@ herr_t H5LTget_attribute_uint( hid_t loc_id, * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: September 19, 2002 * @@ -3362,7 +3357,7 @@ herr_t H5LTget_attribute_long( hid_t loc_id, * * Return: Success: 0, Failure: -1 * -* Programmer: Elena Pourmal, epourmal@ncsa.uiuc.edu +* Programmer: Elena Pourmal * * Date: June 17, 2005 * @@ -3392,7 +3387,7 @@ herr_t H5LTget_attribute_long_long( hid_t loc_id, * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: March 8, 2004 * @@ -3422,7 +3417,7 @@ herr_t H5LTget_attribute_ulong( hid_t loc_id, * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: September 19, 2002 * @@ -3454,7 +3449,7 @@ herr_t H5LTget_attribute_float( hid_t loc_id, * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: September 19, 2002 * @@ -3486,7 +3481,7 @@ herr_t H5LTget_attribute_double( hid_t loc_id, * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: September 19, 2002 * @@ -3525,7 +3520,7 @@ herr_t H5LTget_attribute( hid_t loc_id, * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: September 19, 2002 * @@ -3589,7 +3584,7 @@ out: * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: September 19, 2002 * @@ -3639,7 +3634,7 @@ out: * * Return: FAIL on error, SUCCESS on success * -* Programmer: pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: January 04, 2005 * diff --git a/hl/src/H5LTanalyze.c b/hl/src/H5LTanalyze.c index c05db67..e5f0bea 100644 --- a/hl/src/H5LTanalyze.c +++ b/hl/src/H5LTanalyze.c @@ -1,25 +1,25 @@ -#if defined __GNUC__ && 402 <= __GNUC__ * 100 + __GNUC_MINOR__ -#pragma GCC diagnostic ignored "-Wconversion" -#pragma GCC diagnostic ignored "-Wimplicit-function-declaration" -#pragma GCC diagnostic ignored "-Wlarger-than=" -#pragma GCC diagnostic ignored "-Wmissing-prototypes" -#pragma GCC diagnostic ignored "-Wnested-externs" -#pragma GCC diagnostic ignored "-Wold-style-definition" -#pragma GCC diagnostic ignored "-Wredundant-decls" -#pragma GCC diagnostic ignored "-Wsign-compare" -#pragma GCC diagnostic ignored "-Wsign-conversion" -#pragma GCC diagnostic ignored "-Wstrict-overflow" -#pragma GCC diagnostic ignored "-Wstrict-prototypes" -#pragma GCC diagnostic ignored "-Wsuggest-attribute=pure" -#pragma GCC diagnostic ignored "-Wswitch-default" -#pragma GCC diagnostic ignored "-Wunused-function" -#pragma GCC diagnostic ignored "-Wunused-macros" -#pragma GCC diagnostic ignored "-Wunused-parameter" -#elif defined __SUNPRO_CC -#pragma disable_warn -#elif defined _MSC_VER -#pragma warning(push, 1) -#endif +#if defined __GNUC__ && 402 <= __GNUC__ * 100 + __GNUC_MINOR__ +#pragma GCC diagnostic ignored "-Wconversion" +#pragma GCC diagnostic ignored "-Wimplicit-function-declaration" +#pragma GCC diagnostic ignored "-Wlarger-than=" +#pragma GCC diagnostic ignored "-Wmissing-prototypes" +#pragma GCC diagnostic ignored "-Wnested-externs" +#pragma GCC diagnostic ignored "-Wold-style-definition" +#pragma GCC diagnostic ignored "-Wredundant-decls" +#pragma GCC diagnostic ignored "-Wsign-compare" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wstrict-overflow" +#pragma GCC diagnostic ignored "-Wstrict-prototypes" +#pragma GCC diagnostic ignored "-Wsuggest-attribute=pure" +#pragma GCC diagnostic ignored "-Wswitch-default" +#pragma GCC diagnostic ignored "-Wunused-function" +#pragma GCC diagnostic ignored "-Wunused-macros" +#pragma GCC diagnostic ignored "-Wunused-parameter" +#elif defined __SUNPRO_CC +#pragma disable_warn +#elif defined _MSC_VER +#pragma warning(push, 1) +#endif #line 2 "hl/src/H5LTanalyze.c" #line 4 "hl/src/H5LTanalyze.c" @@ -30,11 +30,17 @@ #define yy_create_buffer H5LTyy_create_buffer #define yy_delete_buffer H5LTyy_delete_buffer -#define yy_flex_debug H5LTyy_flex_debug +#define yy_scan_buffer H5LTyy_scan_buffer +#define yy_scan_string H5LTyy_scan_string +#define yy_scan_bytes H5LTyy_scan_bytes #define yy_init_buffer H5LTyy_init_buffer #define yy_flush_buffer H5LTyy_flush_buffer #define yy_load_buffer_state H5LTyy_load_buffer_state #define yy_switch_to_buffer H5LTyy_switch_to_buffer +#define yypush_buffer_state H5LTyypush_buffer_state +#define yypop_buffer_state H5LTyypop_buffer_state +#define yyensure_buffer_stack H5LTyyensure_buffer_stack +#define yy_flex_debug H5LTyy_flex_debug #define yyin H5LTyyin #define yyleng H5LTyyleng #define yylex H5LTyylex @@ -49,12 +55,246 @@ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 37 +#define YY_FLEX_MINOR_VERSION 6 +#define YY_FLEX_SUBMINOR_VERSION 4 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif +#ifdef yy_create_buffer +#define H5LTyy_create_buffer_ALREADY_DEFINED +#else +#define yy_create_buffer H5LTyy_create_buffer +#endif + +#ifdef yy_delete_buffer +#define H5LTyy_delete_buffer_ALREADY_DEFINED +#else +#define yy_delete_buffer H5LTyy_delete_buffer +#endif + +#ifdef yy_scan_buffer +#define H5LTyy_scan_buffer_ALREADY_DEFINED +#else +#define yy_scan_buffer H5LTyy_scan_buffer +#endif + +#ifdef yy_scan_string +#define H5LTyy_scan_string_ALREADY_DEFINED +#else +#define yy_scan_string H5LTyy_scan_string +#endif + +#ifdef yy_scan_bytes +#define H5LTyy_scan_bytes_ALREADY_DEFINED +#else +#define yy_scan_bytes H5LTyy_scan_bytes +#endif + +#ifdef yy_init_buffer +#define H5LTyy_init_buffer_ALREADY_DEFINED +#else +#define yy_init_buffer H5LTyy_init_buffer +#endif + +#ifdef yy_flush_buffer +#define H5LTyy_flush_buffer_ALREADY_DEFINED +#else +#define yy_flush_buffer H5LTyy_flush_buffer +#endif + +#ifdef yy_load_buffer_state +#define H5LTyy_load_buffer_state_ALREADY_DEFINED +#else +#define yy_load_buffer_state H5LTyy_load_buffer_state +#endif + +#ifdef yy_switch_to_buffer +#define H5LTyy_switch_to_buffer_ALREADY_DEFINED +#else +#define yy_switch_to_buffer H5LTyy_switch_to_buffer +#endif + +#ifdef yypush_buffer_state +#define H5LTyypush_buffer_state_ALREADY_DEFINED +#else +#define yypush_buffer_state H5LTyypush_buffer_state +#endif + +#ifdef yypop_buffer_state +#define H5LTyypop_buffer_state_ALREADY_DEFINED +#else +#define yypop_buffer_state H5LTyypop_buffer_state +#endif + +#ifdef yyensure_buffer_stack +#define H5LTyyensure_buffer_stack_ALREADY_DEFINED +#else +#define yyensure_buffer_stack H5LTyyensure_buffer_stack +#endif + +#ifdef yylex +#define H5LTyylex_ALREADY_DEFINED +#else +#define yylex H5LTyylex +#endif + +#ifdef yyrestart +#define H5LTyyrestart_ALREADY_DEFINED +#else +#define yyrestart H5LTyyrestart +#endif + +#ifdef yylex_init +#define H5LTyylex_init_ALREADY_DEFINED +#else +#define yylex_init H5LTyylex_init +#endif + +#ifdef yylex_init_extra +#define H5LTyylex_init_extra_ALREADY_DEFINED +#else +#define yylex_init_extra H5LTyylex_init_extra +#endif + +#ifdef yylex_destroy +#define H5LTyylex_destroy_ALREADY_DEFINED +#else +#define yylex_destroy H5LTyylex_destroy +#endif + +#ifdef yyget_debug +#define H5LTyyget_debug_ALREADY_DEFINED +#else +#define yyget_debug H5LTyyget_debug +#endif + +#ifdef yyset_debug +#define H5LTyyset_debug_ALREADY_DEFINED +#else +#define yyset_debug H5LTyyset_debug +#endif + +#ifdef yyget_extra +#define H5LTyyget_extra_ALREADY_DEFINED +#else +#define yyget_extra H5LTyyget_extra +#endif + +#ifdef yyset_extra +#define H5LTyyset_extra_ALREADY_DEFINED +#else +#define yyset_extra H5LTyyset_extra +#endif + +#ifdef yyget_in +#define H5LTyyget_in_ALREADY_DEFINED +#else +#define yyget_in H5LTyyget_in +#endif + +#ifdef yyset_in +#define H5LTyyset_in_ALREADY_DEFINED +#else +#define yyset_in H5LTyyset_in +#endif + +#ifdef yyget_out +#define H5LTyyget_out_ALREADY_DEFINED +#else +#define yyget_out H5LTyyget_out +#endif + +#ifdef yyset_out +#define H5LTyyset_out_ALREADY_DEFINED +#else +#define yyset_out H5LTyyset_out +#endif + +#ifdef yyget_leng +#define H5LTyyget_leng_ALREADY_DEFINED +#else +#define yyget_leng H5LTyyget_leng +#endif + +#ifdef yyget_text +#define H5LTyyget_text_ALREADY_DEFINED +#else +#define yyget_text H5LTyyget_text +#endif + +#ifdef yyget_lineno +#define H5LTyyget_lineno_ALREADY_DEFINED +#else +#define yyget_lineno H5LTyyget_lineno +#endif + +#ifdef yyset_lineno +#define H5LTyyset_lineno_ALREADY_DEFINED +#else +#define yyset_lineno H5LTyyset_lineno +#endif + +#ifdef yywrap +#define H5LTyywrap_ALREADY_DEFINED +#else +#define yywrap H5LTyywrap +#endif + +#ifdef yyalloc +#define H5LTyyalloc_ALREADY_DEFINED +#else +#define yyalloc H5LTyyalloc +#endif + +#ifdef yyrealloc +#define H5LTyyrealloc_ALREADY_DEFINED +#else +#define yyrealloc H5LTyyrealloc +#endif + +#ifdef yyfree +#define H5LTyyfree_ALREADY_DEFINED +#else +#define yyfree H5LTyyfree +#endif + +#ifdef yytext +#define H5LTyytext_ALREADY_DEFINED +#else +#define yytext H5LTyytext +#endif + +#ifdef yyleng +#define H5LTyyleng_ALREADY_DEFINED +#else +#define yyleng H5LTyyleng +#endif + +#ifdef yyin +#define H5LTyyin_ALREADY_DEFINED +#else +#define yyin H5LTyyin +#endif + +#ifdef yyout +#define H5LTyyout_ALREADY_DEFINED +#else +#define yyout H5LTyyout +#endif + +#ifdef yy_flex_debug +#define H5LTyy_flex_debug_ALREADY_DEFINED +#else +#define yy_flex_debug H5LTyy_flex_debug +#endif + +#ifdef yylineno +#define H5LTyylineno_ALREADY_DEFINED +#else +#define yylineno H5LTyylineno +#endif + /* First, we deal with platform-specific or compiler-specific issues. */ /* begin standard C headers. */ @@ -75,7 +315,7 @@ #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, - * if you want the limit (max/min) macros for int types. + * if you want the limit (max/min) macros for int types. */ #ifndef __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS 1 @@ -92,7 +332,7 @@ typedef uint32_t flex_uint32_t; typedef signed char flex_int8_t; typedef short int flex_int16_t; typedef int flex_int32_t; -typedef unsigned char flex_uint8_t; +typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; @@ -125,65 +365,61 @@ typedef unsigned int flex_uint32_t; #define UINT32_MAX (4294967295U) #endif +#ifndef SIZE_MAX +#define SIZE_MAX (~(size_t)0) +#endif + #endif /* ! C99 */ #endif /* ! FLEXINT_H */ -#ifdef __cplusplus - -/* The "const" storage-class-modifier is valid. */ -#define YY_USE_CONST - -#else /* ! __cplusplus */ +/* begin standard C++ headers. */ -/* C99 requires __STDC__ to be defined as 1. */ -#if defined (__STDC__) - -#define YY_USE_CONST - -#endif /* defined (__STDC__) */ -#endif /* ! __cplusplus */ - -#ifdef YY_USE_CONST +/* TODO: this is always defined, so inline it */ #define yyconst const + +#if defined(__GNUC__) && __GNUC__ >= 3 +#define yynoreturn __attribute__((__noreturn__)) #else -#define yyconst +#define yynoreturn #endif /* Returned upon end-of-file. */ #define YY_NULL 0 -/* Promotes a possibly negative, possibly signed char to an unsigned - * integer for use as an array index. If the signed char is negative, - * we want to instead treat it as an 8-bit unsigned char, hence the - * double cast. +/* Promotes a possibly negative, possibly signed char to an + * integer in range [0..255] for use as an array index. */ -#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) +#define YY_SC_TO_UI(c) ((YY_CHAR) (c)) /* Enter a start condition. This macro really ought to take a parameter, * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ #define BEGIN (yy_start) = 1 + 2 * - /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ #define YY_START (((yy_start) - 1) / 2) #define YYSTATE YY_START - /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) - /* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE H5LTyyrestart(H5LTyyin ) - +#define YY_NEW_FILE yyrestart( yyin ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ #ifndef YY_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k. + * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. + * Ditto for the __ia64__ case accordingly. + */ +#define YY_BUF_SIZE 32768 +#else #define YY_BUF_SIZE 16384 +#endif /* __ia64__ */ #endif /* The state buf must be large enough to hold one state per character in the main buffer. @@ -200,30 +436,30 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE; typedef size_t yy_size_t; #endif -extern yy_size_t H5LTyyleng; +extern int yyleng; -extern FILE *H5LTyyin, *H5LTyyout; +extern FILE *yyin, *yyout; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 - + #define YY_LESS_LINENO(n) - + #define YY_LINENO_REWIND_TO(ptr) + /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ do \ { \ - /* Undo effects of setting up H5LTyytext. */ \ + /* Undo effects of setting up yytext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ *yy_cp = (yy_hold_char); \ YY_RESTORE_YY_MORE_OFFSET \ (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up H5LTyytext again */ \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ } \ while ( 0 ) - #define unput(c) yyunput( c, (yytext_ptr) ) #ifndef YY_STRUCT_YY_BUFFER_STATE @@ -238,12 +474,12 @@ struct yy_buffer_state /* Size of input buffer in bytes, not including room for EOB * characters. */ - yy_size_t yy_buf_size; + int yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB * characters. */ - yy_size_t yy_n_chars; + int yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to @@ -283,8 +519,8 @@ struct yy_buffer_state * possible backing-up. * * When we actually see the EOF, we change the status to "new" - * (via H5LTyyrestart()), so that the user can continue scanning by - * just pointing H5LTyyin at a new input file. + * (via yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 @@ -294,7 +530,7 @@ struct yy_buffer_state /* Stack of input buffers. */ static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ -static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ +static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */ /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general @@ -305,103 +541,98 @@ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ : NULL) - /* Same as previous macro, but useful when we know that the buffer stack is not * NULL or when we need an lvalue. For internal use only. */ #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] -/* yy_hold_char holds the character lost when H5LTyytext is formed. */ +/* yy_hold_char holds the character lost when yytext is formed. */ static char yy_hold_char; -static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */ -yy_size_t H5LTyyleng; +static int yy_n_chars; /* number of characters read into yy_ch_buf */ +int yyleng; /* Points to current character in buffer. */ -static char *yy_c_buf_p = (char *) 0; +static char *yy_c_buf_p = NULL; static int yy_init = 0; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ -/* Flag which is used to allow H5LTyywrap()'s to do buffer switches - * instead of setting up a fresh H5LTyyin. A bit of a hack ... +/* Flag which is used to allow yywrap()'s to do buffer switches + * instead of setting up a fresh yyin. A bit of a hack ... */ static int yy_did_buffer_switch_on_eof; -void H5LTyyrestart (FILE *input_file ); -void H5LTyy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); -YY_BUFFER_STATE H5LTyy_create_buffer (FILE *file,int size ); -void H5LTyy_delete_buffer (YY_BUFFER_STATE b ); -void H5LTyy_flush_buffer (YY_BUFFER_STATE b ); -void H5LTyypush_buffer_state (YY_BUFFER_STATE new_buffer ); -void H5LTyypop_buffer_state (void ); +void yyrestart ( FILE *input_file ); +void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size ); +void yy_delete_buffer ( YY_BUFFER_STATE b ); +void yy_flush_buffer ( YY_BUFFER_STATE b ); +void yypush_buffer_state ( YY_BUFFER_STATE new_buffer ); +void yypop_buffer_state ( void ); -static void H5LTyyensure_buffer_stack (void ); -static void H5LTyy_load_buffer_state (void ); -static void H5LTyy_init_buffer (YY_BUFFER_STATE b,FILE *file ); +static void yyensure_buffer_stack ( void ); +static void yy_load_buffer_state ( void ); +static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file ); +#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER ) -#define YY_FLUSH_BUFFER H5LTyy_flush_buffer(YY_CURRENT_BUFFER ) +YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size ); +YY_BUFFER_STATE yy_scan_string ( const char *yy_str ); +YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len ); -YY_BUFFER_STATE H5LTyy_scan_buffer (char *base,yy_size_t size ); -YY_BUFFER_STATE H5LTyy_scan_string (yyconst char *yy_str ); -YY_BUFFER_STATE H5LTyy_scan_bytes (yyconst char *bytes,yy_size_t len ); - -void *H5LTyyalloc (yy_size_t ); -void *H5LTyyrealloc (void *,yy_size_t ); -void H5LTyyfree (void * ); - -#define yy_new_buffer H5LTyy_create_buffer +void *yyalloc ( yy_size_t ); +void *yyrealloc ( void *, yy_size_t ); +void yyfree ( void * ); +#define yy_new_buffer yy_create_buffer #define yy_set_interactive(is_interactive) \ { \ if ( ! YY_CURRENT_BUFFER ){ \ - H5LTyyensure_buffer_stack (); \ + yyensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ - H5LTyy_create_buffer(H5LTyyin,YY_BUF_SIZE ); \ + yy_create_buffer( yyin, YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } - #define yy_set_bol(at_bol) \ { \ if ( ! YY_CURRENT_BUFFER ){\ - H5LTyyensure_buffer_stack (); \ + yyensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ - H5LTyy_create_buffer(H5LTyyin,YY_BUF_SIZE ); \ + yy_create_buffer( yyin, YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ } - #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) /* Begin user sect3 */ +typedef flex_uint8_t YY_CHAR; -typedef unsigned char YY_CHAR; - -FILE *H5LTyyin = (FILE *) 0, *H5LTyyout = (FILE *) 0; +FILE *yyin = NULL, *yyout = NULL; typedef int yy_state_type; -extern int H5LTyylineno; +extern int yylineno; +int yylineno = 1; -int H5LTyylineno = 1; - -extern char *H5LTyytext; -#define yytext_ptr H5LTyytext +extern char *yytext; +#ifdef yytext_ptr +#undef yytext_ptr +#endif +#define yytext_ptr yytext -static yy_state_type yy_get_previous_state (void ); -static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); -static int yy_get_next_buffer (void ); -static void yy_fatal_error (yyconst char msg[] ); +static yy_state_type yy_get_previous_state ( void ); +static yy_state_type yy_try_NUL_trans ( yy_state_type current_state ); +static int yy_get_next_buffer ( void ); +static void yynoreturn yy_fatal_error ( const char* msg ); /* Done after the current pattern has been matched and before the - * corresponding action - sets up H5LTyytext. + * corresponding action - sets up yytext. */ #define YY_DO_BEFORE_ACTION \ (yytext_ptr) = yy_bp; \ - H5LTyyleng = (size_t) (yy_cp - yy_bp); \ + yyleng = (int) (yy_cp - yy_bp); \ (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; - #define YY_NUM_RULES 66 #define YY_END_OF_BUFFER 67 /* This struct is not used in this scanner, @@ -411,7 +642,7 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static yyconst flex_int16_t yy_acclist[437] = +static const flex_int16_t yy_acclist[437] = { 0, 64, 64, 64, 64, 67, 66, 64, 66, 64, 65, 66, 56, 66, 55, 66, 62, 66, 63, 66, 66, @@ -463,7 +694,7 @@ static yyconst flex_int16_t yy_acclist[437] = 57, 21, 57, 34, 34, 57 } ; -static yyconst flex_int16_t yy_accept[546] = +static const flex_int16_t yy_accept[546] = { 0, 1, 2, 3, 4, 5, 6, 7, 9, 12, 14, 16, 18, 20, 21, 22, 23, 24, 26, 28, 30, @@ -527,7 +758,7 @@ static yyconst flex_int16_t yy_accept[546] = 432, 434, 435, 437, 437 } ; -static yyconst flex_int32_t yy_ec[256] = +static const YY_CHAR yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -559,7 +790,7 @@ static yyconst flex_int32_t yy_ec[256] = 1, 1, 1, 1, 1 } ; -static yyconst flex_int32_t yy_meta[42] = +static const YY_CHAR yy_meta[42] = { 0, 1, 1, 1, 2, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, @@ -568,7 +799,7 @@ static yyconst flex_int32_t yy_meta[42] = 1 } ; -static yyconst flex_int16_t yy_base[547] = +static const flex_int16_t yy_base[547] = { 0, 0, 0, 41, 0, 610, 611, 81, 83, 611, 0, 611, 611, 56, 599, 580, 575, 611, 611, 611, 611, @@ -632,7 +863,7 @@ static yyconst flex_int16_t yy_base[547] = 0, 611, 0, 611, 106, 275 } ; -static yyconst flex_int16_t yy_def[547] = +static const flex_int16_t yy_def[547] = { 0, 544, 1, 544, 3, 544, 544, 544, 544, 544, 545, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, @@ -696,7 +927,7 @@ static yyconst flex_int16_t yy_def[547] = 546, 544, 546, 0, 544, 544 } ; -static yyconst flex_int16_t yy_nxt[653] = +static const flex_int16_t yy_nxt[653] = { 0, 6, 7, 8, 9, 10, 10, 10, 10, 10, 10, 10, 10, 11, 12, 6, 6, 13, 6, 6, 6, @@ -772,7 +1003,7 @@ static yyconst flex_int16_t yy_nxt[653] = 544, 544 } ; -static yyconst flex_int16_t yy_chk[653] = +static const flex_int16_t yy_chk[653] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -848,15 +1079,15 @@ static yyconst flex_int16_t yy_chk[653] = 544, 544 } ; -extern int H5LTyy_flex_debug; -int H5LTyy_flex_debug = 0; +extern int yy_flex_debug; +int yy_flex_debug = 0; static yy_state_type *yy_state_buf=0, *yy_state_ptr=0; static char *yy_full_match; static int yy_lp; #define REJECT \ { \ -*yy_cp = (yy_hold_char); /* undo effects of setting up H5LTyytext */ \ +*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */ \ yy_cp = (yy_full_match); /* restore poss. backed-over text */ \ ++(yy_lp); \ goto find_rule; \ @@ -865,7 +1096,7 @@ goto find_rule; \ #define yymore() yymore_used_but_not_detected #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET -char *H5LTyytext; +char *yytext; #line 1 "hl/src/H5LTanalyze.l" /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * @@ -893,6 +1124,13 @@ char *H5LTyytext; /* Turn off suggest const & malloc attribute warnings in gcc */ #if defined __GNUC__ && 402 <= __GNUC__ * 100 + __GNUC_MINOR__ #pragma GCC diagnostic ignored "-Wsuggest-attribute=const" +#endif + +/* Turn off null dereference warnings in gcc. + * We have no control over this generated code. + */ +#if defined __GNUC__ && 600 <= __GNUC__ * 100 +#pragma GCC diagnostic ignored "-Wnull-dereference" #endif int my_yyinput(char *, int); @@ -942,8 +1180,9 @@ extern hbool_t is_opq_tag; hbool_t first_quote = 1; +#line 1162 "hl/src/H5LTanalyze.c" -#line 925 "hl/src/H5LTanalyze.c" +#line 1164 "hl/src/H5LTanalyze.c" #define INITIAL 0 #define TAG_STRING 1 @@ -952,36 +1191,36 @@ hbool_t first_quote = 1; #define YY_EXTRA_TYPE void * #endif -static int yy_init_globals (void ); +static int yy_init_globals ( void ); /* Accessor methods to globals. These are made visible to non-reentrant scanners for convenience. */ -int H5LTyylex_destroy (void ); +int yylex_destroy ( void ); -int H5LTyyget_debug (void ); +int yyget_debug ( void ); -void H5LTyyset_debug (int debug_flag ); +void yyset_debug ( int debug_flag ); -YY_EXTRA_TYPE H5LTyyget_extra (void ); +YY_EXTRA_TYPE yyget_extra ( void ); -void H5LTyyset_extra (YY_EXTRA_TYPE user_defined ); +void yyset_extra ( YY_EXTRA_TYPE user_defined ); -FILE *H5LTyyget_in (void ); +FILE *yyget_in ( void ); -void H5LTyyset_in (FILE * in_str ); +void yyset_in ( FILE * _in_str ); -FILE *H5LTyyget_out (void ); +FILE *yyget_out ( void ); -void H5LTyyset_out (FILE * out_str ); +void yyset_out ( FILE * _out_str ); -yy_size_t H5LTyyget_leng (void ); + int yyget_leng ( void ); -char *H5LTyyget_text (void ); +char *yyget_text ( void ); -int H5LTyyget_lineno (void ); +int yyget_lineno ( void ); -void H5LTyyset_lineno (int line_number ); +void yyset_lineno ( int _line_number ); /* Macros after this point can all be overridden by user definitions in * section 1. @@ -989,35 +1228,43 @@ void H5LTyyset_lineno (int line_number ); #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus -extern "C" int H5LTyywrap (void ); +extern "C" int yywrap ( void ); #else -extern int H5LTyywrap (void ); +extern int yywrap ( void ); #endif #endif - static void yyunput (int c,char *buf_ptr ); +#ifndef YY_NO_UNPUT + + static void yyunput ( int c, char *buf_ptr ); + +#endif #ifndef yytext_ptr -static void yy_flex_strncpy (char *,yyconst char *,int ); +static void yy_flex_strncpy ( char *, const char *, int ); #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * ); +static int yy_flex_strlen ( const char * ); #endif #ifndef YY_NO_INPUT - #ifdef __cplusplus -static int yyinput (void ); +static int yyinput ( void ); #else -static int input (void ); +static int input ( void ); #endif #endif /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k */ +#define YY_READ_BUF_SIZE 16384 +#else #define YY_READ_BUF_SIZE 8192 +#endif /* __ia64__ */ #endif /* Copy whatever the last rule matched to the standard output. */ @@ -1025,7 +1272,7 @@ static int input (void ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO do { if (fwrite( H5LTyytext, H5LTyyleng, 1, H5LTyyout )) {} } while (0) +#define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -1036,20 +1283,20 @@ static int input (void ); if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ - size_t n; \ + int n; \ for ( n = 0; n < max_size && \ - (c = getc( H5LTyyin )) != EOF && c != '\n'; ++n ) \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ if ( c == '\n' ) \ buf[n++] = (char) c; \ - if ( c == EOF && ferror( H5LTyyin ) ) \ + if ( c == EOF && ferror( yyin ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ else \ { \ errno=0; \ - while ( (result = fread(buf, 1, max_size, H5LTyyin))==0 && ferror(H5LTyyin)) \ + while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \ { \ if( errno != EINTR) \ { \ @@ -1057,7 +1304,7 @@ static int input (void ); break; \ } \ errno=0; \ - clearerr(H5LTyyin); \ + clearerr(yyin); \ } \ }\ \ @@ -1090,12 +1337,12 @@ static int input (void ); #ifndef YY_DECL #define YY_DECL_IS_OURS 1 -extern int H5LTyylex (void); +extern int yylex (void); -#define YY_DECL int H5LTyylex (void) +#define YY_DECL int yylex (void) #endif /* !YY_DECL */ -/* Code executed at the beginning of each rule, after H5LTyytext and H5LTyyleng +/* Code executed at the beginning of each rule, after yytext and yyleng * have been set up. */ #ifndef YY_USER_ACTION @@ -1104,7 +1351,7 @@ extern int H5LTyylex (void); /* Code executed at the end of each rule. */ #ifndef YY_BREAK -#define YY_BREAK break; +#define YY_BREAK /*LINTED*/break; #endif #define YY_RULE_SETUP \ @@ -1114,15 +1361,10 @@ extern int H5LTyylex (void); */ YY_DECL { - register yy_state_type yy_current_state; - register char *yy_cp, *yy_bp; - register int yy_act; - -#line 82 "hl/src/H5LTanalyze.l" - - -#line 1103 "hl/src/H5LTanalyze.c" - + yy_state_type yy_current_state; + char *yy_cp, *yy_bp; + int yy_act; + if ( !(yy_init) ) { (yy_init) = 1; @@ -1133,33 +1375,39 @@ YY_DECL /* Create the reject buffer large enough to save one state per allowed character. */ if ( ! (yy_state_buf) ) - (yy_state_buf) = (yy_state_type *)H5LTyyalloc(YY_STATE_BUF_SIZE ); + (yy_state_buf) = (yy_state_type *)yyalloc(YY_STATE_BUF_SIZE ); if ( ! (yy_state_buf) ) - YY_FATAL_ERROR( "out of dynamic memory in H5LTyylex()" ); + YY_FATAL_ERROR( "out of dynamic memory in yylex()" ); if ( ! (yy_start) ) (yy_start) = 1; /* first start state */ - if ( ! H5LTyyin ) - H5LTyyin = stdin; + if ( ! yyin ) + yyin = stdin; - if ( ! H5LTyyout ) - H5LTyyout = stdout; + if ( ! yyout ) + yyout = stdout; if ( ! YY_CURRENT_BUFFER ) { - H5LTyyensure_buffer_stack (); + yyensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = - H5LTyy_create_buffer(H5LTyyin,YY_BUF_SIZE ); + yy_create_buffer( yyin, YY_BUF_SIZE ); } - H5LTyy_load_buffer_state( ); + yy_load_buffer_state( ); } - while ( 1 ) /* loops until end-of-file is reached */ + { +#line 89 "hl/src/H5LTanalyze.l" + + +#line 1383 "hl/src/H5LTanalyze.c" + + while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ { yy_cp = (yy_c_buf_p); - /* Support of H5LTyytext. */ + /* Support of yytext. */ *yy_cp = (yy_hold_char); /* yy_bp points to the position in yy_ch_buf of the start of @@ -1175,14 +1423,14 @@ YY_DECL yy_match: do { - register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 545 ) - yy_c = yy_meta[(unsigned int) yy_c]; + yy_c = yy_meta[yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; *(yy_state_ptr)++ = yy_current_state; ++yy_cp; } @@ -1191,7 +1439,9 @@ yy_match: yy_find_action: yy_current_state = *--(yy_state_ptr); (yy_lp) = yy_accept[yy_current_state]; + find_rule: /* we branch to this label when backing up */ + for ( ; ; ) /* until we find what rule we matched */ { if ( (yy_lp) && (yy_lp) < yy_accept[yy_current_state + 1] ) @@ -1215,293 +1465,293 @@ do_action: /* This label is used only to access EOF actions. */ { /* beginning of action switch */ case 1: YY_RULE_SETUP -#line 84 "hl/src/H5LTanalyze.l" +#line 91 "hl/src/H5LTanalyze.l" {return hid(H5T_STD_I8BE_TOKEN);} YY_BREAK case 2: YY_RULE_SETUP -#line 85 "hl/src/H5LTanalyze.l" +#line 92 "hl/src/H5LTanalyze.l" {return hid(H5T_STD_I8LE_TOKEN);} YY_BREAK case 3: YY_RULE_SETUP -#line 86 "hl/src/H5LTanalyze.l" +#line 93 "hl/src/H5LTanalyze.l" {return hid(H5T_STD_I16BE_TOKEN);} YY_BREAK case 4: YY_RULE_SETUP -#line 87 "hl/src/H5LTanalyze.l" +#line 94 "hl/src/H5LTanalyze.l" {return hid(H5T_STD_I16LE_TOKEN);} YY_BREAK case 5: YY_RULE_SETUP -#line 88 "hl/src/H5LTanalyze.l" +#line 95 "hl/src/H5LTanalyze.l" {return hid(H5T_STD_I32BE_TOKEN);} YY_BREAK case 6: YY_RULE_SETUP -#line 89 "hl/src/H5LTanalyze.l" +#line 96 "hl/src/H5LTanalyze.l" {return hid(H5T_STD_I32LE_TOKEN);} YY_BREAK case 7: YY_RULE_SETUP -#line 90 "hl/src/H5LTanalyze.l" +#line 97 "hl/src/H5LTanalyze.l" {return hid(H5T_STD_I64BE_TOKEN);} YY_BREAK case 8: YY_RULE_SETUP -#line 91 "hl/src/H5LTanalyze.l" +#line 98 "hl/src/H5LTanalyze.l" {return hid(H5T_STD_I64LE_TOKEN);} YY_BREAK case 9: YY_RULE_SETUP -#line 93 "hl/src/H5LTanalyze.l" +#line 100 "hl/src/H5LTanalyze.l" {return hid(H5T_STD_U8BE_TOKEN);} YY_BREAK case 10: YY_RULE_SETUP -#line 94 "hl/src/H5LTanalyze.l" +#line 101 "hl/src/H5LTanalyze.l" {return hid(H5T_STD_U8LE_TOKEN);} YY_BREAK case 11: YY_RULE_SETUP -#line 95 "hl/src/H5LTanalyze.l" +#line 102 "hl/src/H5LTanalyze.l" {return hid(H5T_STD_U16BE_TOKEN);} YY_BREAK case 12: YY_RULE_SETUP -#line 96 "hl/src/H5LTanalyze.l" +#line 103 "hl/src/H5LTanalyze.l" {return hid(H5T_STD_U16LE_TOKEN);} YY_BREAK case 13: YY_RULE_SETUP -#line 97 "hl/src/H5LTanalyze.l" +#line 104 "hl/src/H5LTanalyze.l" {return hid(H5T_STD_U32BE_TOKEN);} YY_BREAK case 14: YY_RULE_SETUP -#line 98 "hl/src/H5LTanalyze.l" +#line 105 "hl/src/H5LTanalyze.l" {return hid(H5T_STD_U32LE_TOKEN);} YY_BREAK case 15: YY_RULE_SETUP -#line 99 "hl/src/H5LTanalyze.l" +#line 106 "hl/src/H5LTanalyze.l" {return hid(H5T_STD_U64BE_TOKEN);} YY_BREAK case 16: YY_RULE_SETUP -#line 100 "hl/src/H5LTanalyze.l" +#line 107 "hl/src/H5LTanalyze.l" {return hid(H5T_STD_U64LE_TOKEN);} YY_BREAK case 17: YY_RULE_SETUP -#line 102 "hl/src/H5LTanalyze.l" +#line 109 "hl/src/H5LTanalyze.l" {return hid(H5T_NATIVE_CHAR_TOKEN);} YY_BREAK case 18: YY_RULE_SETUP -#line 103 "hl/src/H5LTanalyze.l" +#line 110 "hl/src/H5LTanalyze.l" {return hid(H5T_NATIVE_SCHAR_TOKEN);} YY_BREAK case 19: YY_RULE_SETUP -#line 104 "hl/src/H5LTanalyze.l" +#line 111 "hl/src/H5LTanalyze.l" {return hid(H5T_NATIVE_UCHAR_TOKEN);} YY_BREAK case 20: YY_RULE_SETUP -#line 105 "hl/src/H5LTanalyze.l" +#line 112 "hl/src/H5LTanalyze.l" {return hid(H5T_NATIVE_SHORT_TOKEN);} YY_BREAK case 21: YY_RULE_SETUP -#line 106 "hl/src/H5LTanalyze.l" +#line 113 "hl/src/H5LTanalyze.l" {return hid(H5T_NATIVE_USHORT_TOKEN);} YY_BREAK case 22: YY_RULE_SETUP -#line 107 "hl/src/H5LTanalyze.l" +#line 114 "hl/src/H5LTanalyze.l" {return hid(H5T_NATIVE_INT_TOKEN);} YY_BREAK case 23: YY_RULE_SETUP -#line 108 "hl/src/H5LTanalyze.l" +#line 115 "hl/src/H5LTanalyze.l" {return hid(H5T_NATIVE_UINT_TOKEN);} YY_BREAK case 24: YY_RULE_SETUP -#line 109 "hl/src/H5LTanalyze.l" +#line 116 "hl/src/H5LTanalyze.l" {return hid(H5T_NATIVE_LONG_TOKEN);} YY_BREAK case 25: YY_RULE_SETUP -#line 110 "hl/src/H5LTanalyze.l" +#line 117 "hl/src/H5LTanalyze.l" {return hid(H5T_NATIVE_ULONG_TOKEN);} YY_BREAK case 26: YY_RULE_SETUP -#line 111 "hl/src/H5LTanalyze.l" +#line 118 "hl/src/H5LTanalyze.l" {return hid(H5T_NATIVE_LLONG_TOKEN);} YY_BREAK case 27: YY_RULE_SETUP -#line 112 "hl/src/H5LTanalyze.l" +#line 119 "hl/src/H5LTanalyze.l" {return hid(H5T_NATIVE_ULLONG_TOKEN);} YY_BREAK case 28: YY_RULE_SETUP -#line 114 "hl/src/H5LTanalyze.l" +#line 121 "hl/src/H5LTanalyze.l" {return hid(H5T_IEEE_F32BE_TOKEN);} YY_BREAK case 29: YY_RULE_SETUP -#line 115 "hl/src/H5LTanalyze.l" +#line 122 "hl/src/H5LTanalyze.l" {return hid(H5T_IEEE_F32LE_TOKEN);} YY_BREAK case 30: YY_RULE_SETUP -#line 116 "hl/src/H5LTanalyze.l" +#line 123 "hl/src/H5LTanalyze.l" {return hid(H5T_IEEE_F64BE_TOKEN);} YY_BREAK case 31: YY_RULE_SETUP -#line 117 "hl/src/H5LTanalyze.l" +#line 124 "hl/src/H5LTanalyze.l" {return hid(H5T_IEEE_F64LE_TOKEN);} YY_BREAK case 32: YY_RULE_SETUP -#line 118 "hl/src/H5LTanalyze.l" +#line 125 "hl/src/H5LTanalyze.l" {return hid(H5T_NATIVE_FLOAT_TOKEN);} YY_BREAK case 33: YY_RULE_SETUP -#line 119 "hl/src/H5LTanalyze.l" +#line 126 "hl/src/H5LTanalyze.l" {return hid(H5T_NATIVE_DOUBLE_TOKEN);} YY_BREAK case 34: YY_RULE_SETUP -#line 120 "hl/src/H5LTanalyze.l" +#line 127 "hl/src/H5LTanalyze.l" {return hid(H5T_NATIVE_LDOUBLE_TOKEN);} YY_BREAK case 35: YY_RULE_SETUP -#line 122 "hl/src/H5LTanalyze.l" +#line 129 "hl/src/H5LTanalyze.l" {return token(H5T_STRING_TOKEN);} YY_BREAK case 36: YY_RULE_SETUP -#line 123 "hl/src/H5LTanalyze.l" +#line 130 "hl/src/H5LTanalyze.l" {return token(STRSIZE_TOKEN);} YY_BREAK case 37: YY_RULE_SETUP -#line 124 "hl/src/H5LTanalyze.l" +#line 131 "hl/src/H5LTanalyze.l" {return token(STRPAD_TOKEN);} YY_BREAK case 38: YY_RULE_SETUP -#line 125 "hl/src/H5LTanalyze.l" +#line 132 "hl/src/H5LTanalyze.l" {return token(CSET_TOKEN);} YY_BREAK case 39: YY_RULE_SETUP -#line 126 "hl/src/H5LTanalyze.l" +#line 133 "hl/src/H5LTanalyze.l" {return token(CTYPE_TOKEN);} YY_BREAK case 40: YY_RULE_SETUP -#line 127 "hl/src/H5LTanalyze.l" -{return token(H5T_STR_NULLTERM_TOKEN);} +#line 134 "hl/src/H5LTanalyze.l" +{return token(H5T_STR_NULLTERM_TOKEN);} YY_BREAK case 41: YY_RULE_SETUP -#line 128 "hl/src/H5LTanalyze.l" -{return token(H5T_STR_NULLPAD_TOKEN);} +#line 135 "hl/src/H5LTanalyze.l" +{return token(H5T_STR_NULLPAD_TOKEN);} YY_BREAK case 42: YY_RULE_SETUP -#line 129 "hl/src/H5LTanalyze.l" -{return token(H5T_STR_SPACEPAD_TOKEN);} +#line 136 "hl/src/H5LTanalyze.l" +{return token(H5T_STR_SPACEPAD_TOKEN);} YY_BREAK case 43: YY_RULE_SETUP -#line 130 "hl/src/H5LTanalyze.l" +#line 137 "hl/src/H5LTanalyze.l" {return token(H5T_CSET_ASCII_TOKEN);} YY_BREAK case 44: YY_RULE_SETUP -#line 131 "hl/src/H5LTanalyze.l" +#line 138 "hl/src/H5LTanalyze.l" {return token(H5T_CSET_UTF8_TOKEN);} YY_BREAK case 45: YY_RULE_SETUP -#line 132 "hl/src/H5LTanalyze.l" +#line 139 "hl/src/H5LTanalyze.l" {return token(H5T_C_S1_TOKEN);} YY_BREAK case 46: YY_RULE_SETUP -#line 133 "hl/src/H5LTanalyze.l" +#line 140 "hl/src/H5LTanalyze.l" {return token(H5T_FORTRAN_S1_TOKEN);} YY_BREAK case 47: YY_RULE_SETUP -#line 134 "hl/src/H5LTanalyze.l" +#line 141 "hl/src/H5LTanalyze.l" {return token(H5T_VARIABLE_TOKEN);} YY_BREAK case 48: YY_RULE_SETUP -#line 136 "hl/src/H5LTanalyze.l" +#line 143 "hl/src/H5LTanalyze.l" {return token(H5T_COMPOUND_TOKEN);} YY_BREAK case 49: YY_RULE_SETUP -#line 137 "hl/src/H5LTanalyze.l" +#line 144 "hl/src/H5LTanalyze.l" {return token(H5T_ENUM_TOKEN);} YY_BREAK case 50: YY_RULE_SETUP -#line 138 "hl/src/H5LTanalyze.l" +#line 145 "hl/src/H5LTanalyze.l" {return token(H5T_ARRAY_TOKEN);} YY_BREAK case 51: YY_RULE_SETUP -#line 139 "hl/src/H5LTanalyze.l" +#line 146 "hl/src/H5LTanalyze.l" {return token(H5T_VLEN_TOKEN);} YY_BREAK case 52: YY_RULE_SETUP -#line 141 "hl/src/H5LTanalyze.l" +#line 148 "hl/src/H5LTanalyze.l" {return token(H5T_OPAQUE_TOKEN);} YY_BREAK case 53: YY_RULE_SETUP -#line 142 "hl/src/H5LTanalyze.l" +#line 149 "hl/src/H5LTanalyze.l" {return token(OPQ_SIZE_TOKEN);} YY_BREAK case 54: YY_RULE_SETUP -#line 143 "hl/src/H5LTanalyze.l" +#line 150 "hl/src/H5LTanalyze.l" {return token(OPQ_TAG_TOKEN);} YY_BREAK case 55: YY_RULE_SETUP -#line 145 "hl/src/H5LTanalyze.l" -{ - if( is_str_size || (is_enum && is_enum_memb) || +#line 152 "hl/src/H5LTanalyze.l" +{ + if( is_str_size || (is_enum && is_enum_memb) || is_opq_size || (asindex>-1 && arr_stack[asindex].is_dim) || (csindex>-1 && cmpd_stack[csindex].is_field) ) { - H5LTyylval.ival = atoi(H5LTyytext); - return NUMBER; + H5LTyylval.ival = atoi(yytext); + return NUMBER; } else REJECT; } YY_BREAK case 56: YY_RULE_SETUP -#line 155 "hl/src/H5LTanalyze.l" +#line 162 "hl/src/H5LTanalyze.l" { /*if it's first quote, and is a compound field name or an enum symbol*/ - if((is_opq_tag || is_enum || (csindex>-1 && cmpd_stack[csindex].is_field)) + if((is_opq_tag || is_enum || (csindex>-1 && cmpd_stack[csindex].is_field)) && first_quote) { first_quote = 0; BEGIN TAG_STRING; @@ -1513,12 +1763,12 @@ YY_RULE_SETUP case 57: /* rule 57 can match eol */ YY_RULE_SETUP -#line 165 "hl/src/H5LTanalyze.l" +#line 172 "hl/src/H5LTanalyze.l" { #ifdef H5_HAVE_WIN32_API - H5LTyylval.sval = _strdup(H5LTyytext); + H5LTyylval.sval = _strdup(yytext); #else /* H5_HAVE_WIN32_API */ - H5LTyylval.sval = strdup(H5LTyytext); + H5LTyylval.sval = strdup(yytext); #endif /* H5_HAVE_WIN32_API */ BEGIN INITIAL; return STRING; @@ -1526,52 +1776,52 @@ YY_RULE_SETUP YY_BREAK case 58: YY_RULE_SETUP -#line 175 "hl/src/H5LTanalyze.l" +#line 182 "hl/src/H5LTanalyze.l" {return token('{');} YY_BREAK case 59: YY_RULE_SETUP -#line 176 "hl/src/H5LTanalyze.l" +#line 183 "hl/src/H5LTanalyze.l" {return token('}');} YY_BREAK case 60: YY_RULE_SETUP -#line 177 "hl/src/H5LTanalyze.l" +#line 184 "hl/src/H5LTanalyze.l" {return token('[');} YY_BREAK case 61: YY_RULE_SETUP -#line 178 "hl/src/H5LTanalyze.l" +#line 185 "hl/src/H5LTanalyze.l" {return token(']');} YY_BREAK case 62: YY_RULE_SETUP -#line 179 "hl/src/H5LTanalyze.l" +#line 186 "hl/src/H5LTanalyze.l" {return token(':');} YY_BREAK case 63: YY_RULE_SETUP -#line 180 "hl/src/H5LTanalyze.l" +#line 187 "hl/src/H5LTanalyze.l" {return token(';');} YY_BREAK case 64: /* rule 64 can match eol */ YY_RULE_SETUP -#line 181 "hl/src/H5LTanalyze.l" +#line 188 "hl/src/H5LTanalyze.l" ; YY_BREAK case 65: /* rule 65 can match eol */ YY_RULE_SETUP -#line 182 "hl/src/H5LTanalyze.l" +#line 189 "hl/src/H5LTanalyze.l" { return 0; } YY_BREAK case 66: YY_RULE_SETUP -#line 184 "hl/src/H5LTanalyze.l" +#line 191 "hl/src/H5LTanalyze.l" ECHO; YY_BREAK -#line 1553 "hl/src/H5LTanalyze.c" +#line 1803 "hl/src/H5LTanalyze.c" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(TAG_STRING): yyterminate(); @@ -1589,15 +1839,15 @@ ECHO; { /* We're scanning a new file or input source. It's * possible that this happened because the user - * just pointed H5LTyyin at a new source and called - * H5LTyylex(). If so, then we have to assure + * just pointed yyin at a new source and called + * yylex(). If so, then we have to assure * consistency between YY_CURRENT_BUFFER and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a * back-up) that will match for the new input source. */ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - YY_CURRENT_BUFFER_LVALUE->yy_input_file = H5LTyyin; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; } @@ -1650,11 +1900,11 @@ ECHO; { (yy_did_buffer_switch_on_eof) = 0; - if ( H5LTyywrap( ) ) + if ( yywrap( ) ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up - * H5LTyytext, we can now set up + * yytext, we can now set up * yy_c_buf_p so that if some total * hoser (like flex itself) wants to * call the scanner after we return the @@ -1703,7 +1953,8 @@ ECHO; "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ -} /* end of H5LTyylex */ + } /* end of user's declarations */ +} /* end of yylex */ /* yy_get_next_buffer - try to read in a new buffer * @@ -1714,9 +1965,9 @@ ECHO; */ static int yy_get_next_buffer (void) { - register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; - register char *source = (yytext_ptr); - register int number_to_move, i; + char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + char *source = (yytext_ptr); + int number_to_move, i; int ret_val; if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) @@ -1745,7 +1996,7 @@ static int yy_get_next_buffer (void) /* Try to read more data. */ /* First move last chars to start of buffer. */ - number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1); for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); @@ -1758,7 +2009,7 @@ static int yy_get_next_buffer (void) else { - yy_size_t num_to_read = + int num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) @@ -1784,7 +2035,7 @@ static int yy_get_next_buffer (void) if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; - H5LTyyrestart(H5LTyyin ); + yyrestart( yyin ); } else @@ -1798,12 +2049,15 @@ static int yy_get_next_buffer (void) else ret_val = EOB_ACT_CONTINUE_SCAN; - if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { /* Extend the array by 50%, plus the number we really need. */ - yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) H5LTyyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); + int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc( + (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size ); if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + /* "- 2" to take care of EOB's */ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2); } (yy_n_chars) += number_to_move; @@ -1819,9 +2073,9 @@ static int yy_get_next_buffer (void) static yy_state_type yy_get_previous_state (void) { - register yy_state_type yy_current_state; - register char *yy_cp; - + yy_state_type yy_current_state; + char *yy_cp; + yy_current_state = (yy_start); (yy_state_ptr) = (yy_state_buf); @@ -1829,14 +2083,14 @@ static int yy_get_next_buffer (void) for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) { - register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 545 ) - yy_c = yy_meta[(unsigned int) yy_c]; + yy_c = yy_meta[yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; *(yy_state_ptr)++ = yy_current_state; } @@ -1850,16 +2104,16 @@ static int yy_get_next_buffer (void) */ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) { - register int yy_is_jam; - - register YY_CHAR yy_c = 1; + int yy_is_jam; + + YY_CHAR yy_c = 1; while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 545 ) - yy_c = yy_meta[(unsigned int) yy_c]; + yy_c = yy_meta[yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; yy_is_jam = (yy_current_state == 544); if ( ! yy_is_jam ) *(yy_state_ptr)++ = yy_current_state; @@ -1867,22 +2121,24 @@ static int yy_get_next_buffer (void) return yy_is_jam ? 0 : yy_current_state; } - static void yyunput (int c, register char * yy_bp ) -{ - register char *yy_cp; +#ifndef YY_NO_UNPUT + static void yyunput (int c, char * yy_bp ) +{ + char *yy_cp; + yy_cp = (yy_c_buf_p); - /* undo effects of setting up H5LTyytext */ + /* undo effects of setting up yytext */ *yy_cp = (yy_hold_char); if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) { /* need to shift things up to make room */ /* +2 for EOB chars. */ - register yy_size_t number_to_move = (yy_n_chars) + 2; - register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ + int number_to_move = (yy_n_chars) + 2; + char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; - register char *source = + char *source = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) @@ -1891,7 +2147,7 @@ static int yy_get_next_buffer (void) yy_cp += (int) (dest - source); yy_bp += (int) (dest - source); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; + (yy_n_chars) = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size; if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) YY_FATAL_ERROR( "flex scanner push-back overflow" ); @@ -1904,6 +2160,8 @@ static int yy_get_next_buffer (void) (yy_c_buf_p) = yy_cp; } +#endif + #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (void) @@ -1913,7 +2171,7 @@ static int yy_get_next_buffer (void) { int c; - + *(yy_c_buf_p) = (yy_hold_char); if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) @@ -1928,7 +2186,7 @@ static int yy_get_next_buffer (void) else { /* need more input */ - yy_size_t offset = (yy_c_buf_p) - (yytext_ptr); + int offset = (int) ((yy_c_buf_p) - (yytext_ptr)); ++(yy_c_buf_p); switch ( yy_get_next_buffer( ) ) @@ -1945,14 +2203,14 @@ static int yy_get_next_buffer (void) */ /* Reset buffer status. */ - H5LTyyrestart(H5LTyyin ); + yyrestart( yyin ); /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { - if ( H5LTyywrap( ) ) - return EOF; + if ( yywrap( ) ) + return 0; if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; @@ -1971,7 +2229,7 @@ static int yy_get_next_buffer (void) } c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ - *(yy_c_buf_p) = '\0'; /* preserve H5LTyytext */ + *(yy_c_buf_p) = '\0'; /* preserve yytext */ (yy_hold_char) = *++(yy_c_buf_p); return c; @@ -1980,35 +2238,35 @@ static int yy_get_next_buffer (void) /** Immediately switch to a different input stream. * @param input_file A readable stream. - * + * * @note This function does not reset the start condition to @c INITIAL . */ - void H5LTyyrestart (FILE * input_file ) + void yyrestart (FILE * input_file ) { - + if ( ! YY_CURRENT_BUFFER ){ - H5LTyyensure_buffer_stack (); + yyensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = - H5LTyy_create_buffer(H5LTyyin,YY_BUF_SIZE ); + yy_create_buffer( yyin, YY_BUF_SIZE ); } - H5LTyy_init_buffer(YY_CURRENT_BUFFER,input_file ); - H5LTyy_load_buffer_state( ); + yy_init_buffer( YY_CURRENT_BUFFER, input_file ); + yy_load_buffer_state( ); } /** Switch to a different input buffer. * @param new_buffer The new input buffer. - * + * */ - void H5LTyy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) + void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) { - + /* TODO. We should be able to replace this entire function body * with - * H5LTyypop_buffer_state(); - * H5LTyypush_buffer_state(new_buffer); + * yypop_buffer_state(); + * yypush_buffer_state(new_buffer); */ - H5LTyyensure_buffer_stack (); + yyensure_buffer_stack (); if ( YY_CURRENT_BUFFER == new_buffer ) return; @@ -2021,61 +2279,61 @@ static int yy_get_next_buffer (void) } YY_CURRENT_BUFFER_LVALUE = new_buffer; - H5LTyy_load_buffer_state( ); + yy_load_buffer_state( ); /* We don't actually know whether we did this switch during - * EOF (H5LTyywrap()) processing, but the only time this flag - * is looked at is after H5LTyywrap() is called, so it's safe + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe * to go ahead and always set it. */ (yy_did_buffer_switch_on_eof) = 1; } -static void H5LTyy_load_buffer_state (void) +static void yy_load_buffer_state (void) { (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; - H5LTyyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; (yy_hold_char) = *(yy_c_buf_p); } /** Allocate and initialize an input buffer state. * @param file A readable stream. * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. - * + * * @return the allocated buffer state. */ - YY_BUFFER_STATE H5LTyy_create_buffer (FILE * file, int size ) + YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) { YY_BUFFER_STATE b; - - b = (YY_BUFFER_STATE) H5LTyyalloc(sizeof( struct yy_buffer_state ) ); + + b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) ); if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in H5LTyy_create_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_buf_size = size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ - b->yy_ch_buf = (char *) H5LTyyalloc(b->yy_buf_size + 2 ); + b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) ); if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in H5LTyy_create_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_is_our_buffer = 1; - H5LTyy_init_buffer(b,file ); + yy_init_buffer( b, file ); return b; } /** Destroy the buffer. - * @param b a buffer created with H5LTyy_create_buffer() - * + * @param b a buffer created with yy_create_buffer() + * */ - void H5LTyy_delete_buffer (YY_BUFFER_STATE b ) + void yy_delete_buffer (YY_BUFFER_STATE b ) { - + if ( ! b ) return; @@ -2083,27 +2341,27 @@ static void H5LTyy_load_buffer_state (void) YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) - H5LTyyfree((void *) b->yy_ch_buf ); + yyfree( (void *) b->yy_ch_buf ); - H5LTyyfree((void *) b ); + yyfree( (void *) b ); } /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, - * such as during a H5LTyyrestart() or at EOF. + * such as during a yyrestart() or at EOF. */ - static void H5LTyy_init_buffer (YY_BUFFER_STATE b, FILE * file ) + static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) { int oerrno = errno; - - H5LTyy_flush_buffer(b ); + + yy_flush_buffer( b ); b->yy_input_file = file; b->yy_fill_buffer = 1; - /* If b is the current buffer, then H5LTyy_init_buffer was _probably_ - * called from H5LTyyrestart() or through yy_get_next_buffer. + /* If b is the current buffer, then yy_init_buffer was _probably_ + * called from yyrestart() or through yy_get_next_buffer. * In that case, we don't want to reset the lineno or column. */ if (b != YY_CURRENT_BUFFER){ @@ -2112,15 +2370,15 @@ static void H5LTyy_load_buffer_state (void) } b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; - + errno = oerrno; } /** Discard all buffered characters. On the next scan, YY_INPUT will be called. * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. - * + * */ - void H5LTyy_flush_buffer (YY_BUFFER_STATE b ) + void yy_flush_buffer (YY_BUFFER_STATE b ) { if ( ! b ) return; @@ -2140,23 +2398,23 @@ static void H5LTyy_load_buffer_state (void) b->yy_buffer_status = YY_BUFFER_NEW; if ( b == YY_CURRENT_BUFFER ) - H5LTyy_load_buffer_state( ); + yy_load_buffer_state( ); } /** Pushes the new state onto the stack. The new state becomes * the current state. This function will allocate the stack * if necessary. * @param new_buffer The new state. - * + * */ -void H5LTyypush_buffer_state (YY_BUFFER_STATE new_buffer ) +void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) { if (new_buffer == NULL) return; - H5LTyyensure_buffer_stack(); + yyensure_buffer_stack(); - /* This block is copied from H5LTyy_switch_to_buffer. */ + /* This block is copied from yy_switch_to_buffer. */ if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ @@ -2170,27 +2428,27 @@ void H5LTyypush_buffer_state (YY_BUFFER_STATE new_buffer ) (yy_buffer_stack_top)++; YY_CURRENT_BUFFER_LVALUE = new_buffer; - /* copied from H5LTyy_switch_to_buffer. */ - H5LTyy_load_buffer_state( ); + /* copied from yy_switch_to_buffer. */ + yy_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } /** Removes and deletes the top of the stack, if present. * The next element becomes the new top. - * + * */ -void H5LTyypop_buffer_state (void) +void yypop_buffer_state (void) { if (!YY_CURRENT_BUFFER) return; - H5LTyy_delete_buffer(YY_CURRENT_BUFFER ); + yy_delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; if ((yy_buffer_stack_top) > 0) --(yy_buffer_stack_top); if (YY_CURRENT_BUFFER) { - H5LTyy_load_buffer_state( ); + yy_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } } @@ -2198,22 +2456,22 @@ void H5LTyypop_buffer_state (void) /* Allocates the stack if it does not exist. * Guarantees space for at least one push. */ -static void H5LTyyensure_buffer_stack (void) +static void yyensure_buffer_stack (void) { yy_size_t num_to_alloc; - + if (!(yy_buffer_stack)) { /* First allocation is just for 2 elements, since we don't know if this * scanner will even need a stack. We use 2 instead of 1 to avoid an * immediate realloc on the next call. */ - num_to_alloc = 1; - (yy_buffer_stack) = (struct yy_buffer_state**)H5LTyyalloc + num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ + (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc (num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) - YY_FATAL_ERROR( "out of dynamic memory in H5LTyyensure_buffer_stack()" ); + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); @@ -2225,15 +2483,15 @@ static void H5LTyyensure_buffer_stack (void) if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ /* Increase the buffer to prepare for a possible push. */ - int grow_size = 8 /* arbitrary grow size */; + yy_size_t grow_size = 8 /* arbitrary grow size */; num_to_alloc = (yy_buffer_stack_max) + grow_size; - (yy_buffer_stack) = (struct yy_buffer_state**)H5LTyyrealloc + (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc ((yy_buffer_stack), num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) - YY_FATAL_ERROR( "out of dynamic memory in H5LTyyensure_buffer_stack()" ); + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); /* zero only the new slots.*/ memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); @@ -2244,80 +2502,80 @@ static void H5LTyyensure_buffer_stack (void) /** Setup the input buffer state to scan directly from a user-specified character buffer. * @param base the character buffer * @param size the size in bytes of the character buffer - * + * * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE H5LTyy_scan_buffer (char * base, yy_size_t size ) +YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) { YY_BUFFER_STATE b; - + if ( size < 2 || base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ - return 0; + return NULL; - b = (YY_BUFFER_STATE) H5LTyyalloc(sizeof( struct yy_buffer_state ) ); + b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) ); if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in H5LTyy_scan_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); - b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; b->yy_is_our_buffer = 0; - b->yy_input_file = 0; + b->yy_input_file = NULL; b->yy_n_chars = b->yy_buf_size; b->yy_is_interactive = 0; b->yy_at_bol = 1; b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; - H5LTyy_switch_to_buffer(b ); + yy_switch_to_buffer( b ); return b; } -/** Setup the input buffer state to scan a string. The next call to H5LTyylex() will +/** Setup the input buffer state to scan a string. The next call to yylex() will * scan from a @e copy of @a str. * @param yystr a NUL-terminated string to scan - * + * * @return the newly allocated buffer state object. * @note If you want to scan bytes that may contain NUL values, then use - * H5LTyy_scan_bytes() instead. + * yy_scan_bytes() instead. */ -YY_BUFFER_STATE H5LTyy_scan_string (yyconst char * yystr ) +YY_BUFFER_STATE yy_scan_string (const char * yystr ) { - - return H5LTyy_scan_bytes(yystr,strlen(yystr) ); + + return yy_scan_bytes( yystr, (int) strlen(yystr) ); } -/** Setup the input buffer state to scan the given bytes. The next call to H5LTyylex() will +/** Setup the input buffer state to scan the given bytes. The next call to yylex() will * scan from a @e copy of @a bytes. * @param yybytes the byte buffer to scan * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. - * + * * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE H5LTyy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len ) +YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len ) { YY_BUFFER_STATE b; char *buf; yy_size_t n; int i; - + /* Get memory for full buffer, including space for trailing EOB's. */ - n = _yybytes_len + 2; - buf = (char *) H5LTyyalloc(n ); + n = (yy_size_t) (_yybytes_len + 2); + buf = (char *) yyalloc( n ); if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in H5LTyy_scan_bytes()" ); + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); for ( i = 0; i < _yybytes_len; ++i ) buf[i] = yybytes[i]; buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; - b = H5LTyy_scan_buffer(buf,n ); + b = yy_scan_buffer( buf, n ); if ( ! b ) - YY_FATAL_ERROR( "bad buffer in H5LTyy_scan_bytes()" ); + YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); /* It's okay to grow etc. this buffer, and we should throw it * away when we're done. @@ -2331,9 +2589,9 @@ YY_BUFFER_STATE H5LTyy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_ #define YY_EXIT_FAILURE 2 #endif -static void yy_fatal_error (yyconst char* msg ) +static void yynoreturn yy_fatal_error (const char* msg ) { - (void) fprintf( stderr, "%s\n", msg ); + fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); } @@ -2343,107 +2601,107 @@ static void yy_fatal_error (yyconst char* msg ) #define yyless(n) \ do \ { \ - /* Undo effects of setting up H5LTyytext. */ \ + /* Undo effects of setting up yytext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ - H5LTyytext[H5LTyyleng] = (yy_hold_char); \ - (yy_c_buf_p) = H5LTyytext + yyless_macro_arg; \ + yytext[yyleng] = (yy_hold_char); \ + (yy_c_buf_p) = yytext + yyless_macro_arg; \ (yy_hold_char) = *(yy_c_buf_p); \ *(yy_c_buf_p) = '\0'; \ - H5LTyyleng = yyless_macro_arg; \ + yyleng = yyless_macro_arg; \ } \ while ( 0 ) /* Accessor methods (get/set functions) to struct members. */ /** Get the current line number. - * + * */ -int H5LTyyget_lineno (void) +int yyget_lineno (void) { - - return H5LTyylineno; + + return yylineno; } /** Get the input stream. - * + * */ -FILE *H5LTyyget_in (void) +FILE *yyget_in (void) { - return H5LTyyin; + return yyin; } /** Get the output stream. - * + * */ -FILE *H5LTyyget_out (void) +FILE *yyget_out (void) { - return H5LTyyout; + return yyout; } /** Get the length of the current token. - * + * */ -yy_size_t H5LTyyget_leng (void) +int yyget_leng (void) { - return H5LTyyleng; + return yyleng; } /** Get the current token. - * + * */ -char *H5LTyyget_text (void) +char *yyget_text (void) { - return H5LTyytext; + return yytext; } /** Set the current line number. - * @param line_number - * + * @param _line_number line number + * */ -void H5LTyyset_lineno (int line_number ) +void yyset_lineno (int _line_number ) { - - H5LTyylineno = line_number; + + yylineno = _line_number; } /** Set the input stream. This does not discard the current * input buffer. - * @param in_str A readable stream. - * - * @see H5LTyy_switch_to_buffer + * @param _in_str A readable stream. + * + * @see yy_switch_to_buffer */ -void H5LTyyset_in (FILE * in_str ) +void yyset_in (FILE * _in_str ) { - H5LTyyin = in_str ; + yyin = _in_str ; } -void H5LTyyset_out (FILE * out_str ) +void yyset_out (FILE * _out_str ) { - H5LTyyout = out_str ; + yyout = _out_str ; } -int H5LTyyget_debug (void) +int yyget_debug (void) { - return H5LTyy_flex_debug; + return yy_flex_debug; } -void H5LTyyset_debug (int bdebug ) +void yyset_debug (int _bdebug ) { - H5LTyy_flex_debug = bdebug ; + yy_flex_debug = _bdebug ; } static int yy_init_globals (void) { /* Initialization is the same as for the non-reentrant scanner. - * This function is called from H5LTyylex_destroy(), so don't allocate here. + * This function is called from yylex_destroy(), so don't allocate here. */ - (yy_buffer_stack) = 0; + (yy_buffer_stack) = NULL; (yy_buffer_stack_top) = 0; (yy_buffer_stack_max) = 0; - (yy_c_buf_p) = (char *) 0; + (yy_c_buf_p) = NULL; (yy_init) = 0; (yy_start) = 0; @@ -2454,39 +2712,39 @@ static int yy_init_globals (void) /* Defined in main.c */ #ifdef YY_STDINIT - H5LTyyin = stdin; - H5LTyyout = stdout; + yyin = stdin; + yyout = stdout; #else - H5LTyyin = (FILE *) 0; - H5LTyyout = (FILE *) 0; + yyin = NULL; + yyout = NULL; #endif /* For future reference: Set errno on error, since we are called by - * H5LTyylex_init() + * yylex_init() */ return 0; } -/* H5LTyylex_destroy is for both reentrant and non-reentrant scanners. */ -int H5LTyylex_destroy (void) +/* yylex_destroy is for both reentrant and non-reentrant scanners. */ +int yylex_destroy (void) { - + /* Pop the buffer stack, destroying each element. */ while(YY_CURRENT_BUFFER){ - H5LTyy_delete_buffer(YY_CURRENT_BUFFER ); + yy_delete_buffer( YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; - H5LTyypop_buffer_state(); + yypop_buffer_state(); } /* Destroy the stack itself. */ - H5LTyyfree((yy_buffer_stack) ); + yyfree((yy_buffer_stack) ); (yy_buffer_stack) = NULL; - H5LTyyfree ( (yy_state_buf) ); + yyfree ( (yy_state_buf) ); (yy_state_buf) = NULL; /* Reset the globals. This is important in a non-reentrant scanner so the next time - * H5LTyylex() is called, initialization will occur. */ + * yylex() is called, initialization will occur. */ yy_init_globals( ); return 0; @@ -2497,18 +2755,19 @@ int H5LTyylex_destroy (void) */ #ifndef yytext_ptr -static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) +static void yy_flex_strncpy (char* s1, const char * s2, int n ) { - register int i; + + int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * s ) +static int yy_flex_strlen (const char * s ) { - register int n; + int n; for ( n = 0; s[n]; ++n ) ; @@ -2516,13 +2775,14 @@ static int yy_flex_strlen (yyconst char * s ) } #endif -void *H5LTyyalloc (yy_size_t size ) +void *yyalloc (yy_size_t size ) { - return (void *) malloc( size ); + return malloc(size); } -void *H5LTyyrealloc (void * ptr, yy_size_t size ) +void *yyrealloc (void * ptr, yy_size_t size ) { + /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter @@ -2530,35 +2790,34 @@ void *H5LTyyrealloc (void * ptr, yy_size_t size ) * any pointer type to void*, and deal with argument conversions * as though doing an assignment. */ - return (void *) realloc( (char *) ptr, size ); + return realloc(ptr, size); } -void H5LTyyfree (void * ptr ) +void yyfree (void * ptr ) { - free( (char *) ptr ); /* see H5LTyyrealloc() for (char *) cast */ + free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" -#line 184 "hl/src/H5LTanalyze.l" - +#line 191 "hl/src/H5LTanalyze.l" int my_yyinput(char *buf, int max_size) { int ret; - - memcpy(buf, myinput, input_len); + + memcpy(buf, myinput, input_len); ret = (int)input_len; return ret; } int H5LTyyerror(const char *msg) { - printf("ERROR: %s before \"%s\".\n", msg, H5LTyytext); + printf("ERROR: %s before \"%s\".\n", msg, yytext); return 0; } -int H5LTyywrap() +int yywrap() { return(1); } diff --git a/hl/src/H5LTanalyze.l b/hl/src/H5LTanalyze.l index 5015053..cdd5b0d 100644 --- a/hl/src/H5LTanalyze.l +++ b/hl/src/H5LTanalyze.l @@ -28,6 +28,13 @@ #pragma GCC diagnostic ignored "-Wsuggest-attribute=const" #endif +/* Turn off null dereference warnings in gcc. + * We have no control over this generated code. + */ +#if defined __GNUC__ && 600 <= __GNUC__ * 100 +#pragma GCC diagnostic ignored "-Wnull-dereference" +#endif + int my_yyinput(char *, int); #undef YY_INPUT #define YY_INPUT(b, r, ms) (r=my_yyinput(b, ms)) diff --git a/hl/src/H5LTparse.c b/hl/src/H5LTparse.c index d8661a7..a9b3dc3 100644 --- a/hl/src/H5LTparse.c +++ b/hl/src/H5LTparse.c @@ -1,30 +1,30 @@ -#if defined __GNUC__ && 402 <= __GNUC__ * 100 + __GNUC_MINOR__ -#pragma GCC diagnostic ignored "-Wconversion" -#pragma GCC diagnostic ignored "-Wimplicit-function-declaration" -#pragma GCC diagnostic ignored "-Wlarger-than=" -#pragma GCC diagnostic ignored "-Wmissing-prototypes" -#pragma GCC diagnostic ignored "-Wnested-externs" -#pragma GCC diagnostic ignored "-Wold-style-definition" -#pragma GCC diagnostic ignored "-Wredundant-decls" -#pragma GCC diagnostic ignored "-Wsign-compare" -#pragma GCC diagnostic ignored "-Wsign-conversion" -#pragma GCC diagnostic ignored "-Wstrict-overflow" -#pragma GCC diagnostic ignored "-Wstrict-prototypes" -#pragma GCC diagnostic ignored "-Wsuggest-attribute=pure" -#pragma GCC diagnostic ignored "-Wswitch-default" -#pragma GCC diagnostic ignored "-Wunused-function" -#pragma GCC diagnostic ignored "-Wunused-macros" -#pragma GCC diagnostic ignored "-Wunused-parameter" -#elif defined __SUNPRO_CC -#pragma disable_warn -#elif defined _MSC_VER -#pragma warning(push, 1) -#endif -/* A Bison parser, made by GNU Bison 2.7. */ +#if defined __GNUC__ && 402 <= __GNUC__ * 100 + __GNUC_MINOR__ +#pragma GCC diagnostic ignored "-Wconversion" +#pragma GCC diagnostic ignored "-Wimplicit-function-declaration" +#pragma GCC diagnostic ignored "-Wlarger-than=" +#pragma GCC diagnostic ignored "-Wmissing-prototypes" +#pragma GCC diagnostic ignored "-Wnested-externs" +#pragma GCC diagnostic ignored "-Wold-style-definition" +#pragma GCC diagnostic ignored "-Wredundant-decls" +#pragma GCC diagnostic ignored "-Wsign-compare" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wstrict-overflow" +#pragma GCC diagnostic ignored "-Wstrict-prototypes" +#pragma GCC diagnostic ignored "-Wsuggest-attribute=pure" +#pragma GCC diagnostic ignored "-Wswitch-default" +#pragma GCC diagnostic ignored "-Wunused-function" +#pragma GCC diagnostic ignored "-Wunused-macros" +#pragma GCC diagnostic ignored "-Wunused-parameter" +#elif defined __SUNPRO_CC +#pragma disable_warn +#elif defined _MSC_VER +#pragma warning(push, 1) +#endif +/* A Bison parser, made by GNU Bison 3.0.4. */ /* Bison implementation for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -66,7 +66,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.7" +#define YYBISON_VERSION "3.0.4" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -85,14 +85,14 @@ #define yyparse H5LTyyparse #define yylex H5LTyylex #define yyerror H5LTyyerror -#define yylval H5LTyylval -#define yychar H5LTyychar #define yydebug H5LTyydebug #define yynerrs H5LTyynerrs +#define yylval H5LTyylval +#define yychar H5LTyychar + /* Copy the first part of user declarations. */ -/* Line 371 of yacc.c */ -#line 20 "hl/src/H5LTparse.y" +#line 20 "hl/src/H5LTparse.y" /* yacc.c:339 */ #include #include @@ -127,7 +127,7 @@ struct arr_info { }; /*stack for nested array type*/ struct arr_info arr_stack[STACK_SIZE]; -int asindex = -1; /*pointer to the top of array stack*/ +int asindex = -1; /*pointer to the top of array stack*/ hbool_t is_str_size = 0; /*flag to lexer for string size*/ hbool_t is_str_pad = 0; /*flag to lexer for string padding*/ @@ -135,7 +135,7 @@ H5T_str_t str_pad; /*variable for string padding*/ H5T_cset_t str_cset; /*variable for string character set*/ hbool_t is_variable = 0; /*variable for variable-length string*/ size_t str_size; /*variable for string size*/ - + hid_t enum_id; /*type ID*/ hbool_t is_enum = 0; /*flag to lexer for enum type*/ hbool_t is_enum_memb = 0; /*flag to lexer for enum member*/ @@ -145,14 +145,13 @@ hbool_t is_opq_size = 0; /*flag to lexer for opaque type size*/ hbool_t is_opq_tag = 0; /*flag to lexer for opaque type tag*/ -/* Line 371 of yacc.c */ -#line 128 "hl/src/H5LTparse.c" +#line 127 "hl/src/H5LTparse.c" /* yacc.c:339 */ -# ifndef YY_NULL +# ifndef YY_NULLPTR # if defined __cplusplus && 201103L <= __cplusplus -# define YY_NULL nullptr +# define YY_NULLPTR nullptr # else -# define YY_NULL 0 +# define YY_NULLPTR 0 # endif # endif @@ -168,7 +167,7 @@ hbool_t is_opq_tag = 0; /*flag to lexer for opaque type tag*/ by #include "H5LTparse.h". */ #ifndef YY_H5LTYY_HL_SRC_H5LTPARSE_H_INCLUDED # define YY_H5LTYY_HL_SRC_H5LTPARSE_H_INCLUDED -/* Enabling traces. */ +/* Debug traces. */ #ifndef YYDEBUG # define YYDEBUG 0 #endif @@ -176,113 +175,99 @@ hbool_t is_opq_tag = 0; /*flag to lexer for opaque type tag*/ extern int H5LTyydebug; #endif -/* Tokens. */ +/* Token type. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - H5T_STD_I8BE_TOKEN = 258, - H5T_STD_I8LE_TOKEN = 259, - H5T_STD_I16BE_TOKEN = 260, - H5T_STD_I16LE_TOKEN = 261, - H5T_STD_I32BE_TOKEN = 262, - H5T_STD_I32LE_TOKEN = 263, - H5T_STD_I64BE_TOKEN = 264, - H5T_STD_I64LE_TOKEN = 265, - H5T_STD_U8BE_TOKEN = 266, - H5T_STD_U8LE_TOKEN = 267, - H5T_STD_U16BE_TOKEN = 268, - H5T_STD_U16LE_TOKEN = 269, - H5T_STD_U32BE_TOKEN = 270, - H5T_STD_U32LE_TOKEN = 271, - H5T_STD_U64BE_TOKEN = 272, - H5T_STD_U64LE_TOKEN = 273, - H5T_NATIVE_CHAR_TOKEN = 274, - H5T_NATIVE_SCHAR_TOKEN = 275, - H5T_NATIVE_UCHAR_TOKEN = 276, - H5T_NATIVE_SHORT_TOKEN = 277, - H5T_NATIVE_USHORT_TOKEN = 278, - H5T_NATIVE_INT_TOKEN = 279, - H5T_NATIVE_UINT_TOKEN = 280, - H5T_NATIVE_LONG_TOKEN = 281, - H5T_NATIVE_ULONG_TOKEN = 282, - H5T_NATIVE_LLONG_TOKEN = 283, - H5T_NATIVE_ULLONG_TOKEN = 284, - H5T_IEEE_F32BE_TOKEN = 285, - H5T_IEEE_F32LE_TOKEN = 286, - H5T_IEEE_F64BE_TOKEN = 287, - H5T_IEEE_F64LE_TOKEN = 288, - H5T_NATIVE_FLOAT_TOKEN = 289, - H5T_NATIVE_DOUBLE_TOKEN = 290, - H5T_NATIVE_LDOUBLE_TOKEN = 291, - H5T_STRING_TOKEN = 292, - STRSIZE_TOKEN = 293, - STRPAD_TOKEN = 294, - CSET_TOKEN = 295, - CTYPE_TOKEN = 296, - H5T_VARIABLE_TOKEN = 297, - H5T_STR_NULLTERM_TOKEN = 298, - H5T_STR_NULLPAD_TOKEN = 299, - H5T_STR_SPACEPAD_TOKEN = 300, - H5T_CSET_ASCII_TOKEN = 301, - H5T_CSET_UTF8_TOKEN = 302, - H5T_C_S1_TOKEN = 303, - H5T_FORTRAN_S1_TOKEN = 304, - H5T_OPAQUE_TOKEN = 305, - OPQ_SIZE_TOKEN = 306, - OPQ_TAG_TOKEN = 307, - H5T_COMPOUND_TOKEN = 308, - H5T_ENUM_TOKEN = 309, - H5T_ARRAY_TOKEN = 310, - H5T_VLEN_TOKEN = 311, - STRING = 312, - NUMBER = 313 - }; + enum yytokentype + { + H5T_STD_I8BE_TOKEN = 258, + H5T_STD_I8LE_TOKEN = 259, + H5T_STD_I16BE_TOKEN = 260, + H5T_STD_I16LE_TOKEN = 261, + H5T_STD_I32BE_TOKEN = 262, + H5T_STD_I32LE_TOKEN = 263, + H5T_STD_I64BE_TOKEN = 264, + H5T_STD_I64LE_TOKEN = 265, + H5T_STD_U8BE_TOKEN = 266, + H5T_STD_U8LE_TOKEN = 267, + H5T_STD_U16BE_TOKEN = 268, + H5T_STD_U16LE_TOKEN = 269, + H5T_STD_U32BE_TOKEN = 270, + H5T_STD_U32LE_TOKEN = 271, + H5T_STD_U64BE_TOKEN = 272, + H5T_STD_U64LE_TOKEN = 273, + H5T_NATIVE_CHAR_TOKEN = 274, + H5T_NATIVE_SCHAR_TOKEN = 275, + H5T_NATIVE_UCHAR_TOKEN = 276, + H5T_NATIVE_SHORT_TOKEN = 277, + H5T_NATIVE_USHORT_TOKEN = 278, + H5T_NATIVE_INT_TOKEN = 279, + H5T_NATIVE_UINT_TOKEN = 280, + H5T_NATIVE_LONG_TOKEN = 281, + H5T_NATIVE_ULONG_TOKEN = 282, + H5T_NATIVE_LLONG_TOKEN = 283, + H5T_NATIVE_ULLONG_TOKEN = 284, + H5T_IEEE_F32BE_TOKEN = 285, + H5T_IEEE_F32LE_TOKEN = 286, + H5T_IEEE_F64BE_TOKEN = 287, + H5T_IEEE_F64LE_TOKEN = 288, + H5T_NATIVE_FLOAT_TOKEN = 289, + H5T_NATIVE_DOUBLE_TOKEN = 290, + H5T_NATIVE_LDOUBLE_TOKEN = 291, + H5T_STRING_TOKEN = 292, + STRSIZE_TOKEN = 293, + STRPAD_TOKEN = 294, + CSET_TOKEN = 295, + CTYPE_TOKEN = 296, + H5T_VARIABLE_TOKEN = 297, + H5T_STR_NULLTERM_TOKEN = 298, + H5T_STR_NULLPAD_TOKEN = 299, + H5T_STR_SPACEPAD_TOKEN = 300, + H5T_CSET_ASCII_TOKEN = 301, + H5T_CSET_UTF8_TOKEN = 302, + H5T_C_S1_TOKEN = 303, + H5T_FORTRAN_S1_TOKEN = 304, + H5T_OPAQUE_TOKEN = 305, + OPQ_SIZE_TOKEN = 306, + OPQ_TAG_TOKEN = 307, + H5T_COMPOUND_TOKEN = 308, + H5T_ENUM_TOKEN = 309, + H5T_ARRAY_TOKEN = 310, + H5T_VLEN_TOKEN = 311, + STRING = 312, + NUMBER = 313 + }; #endif - +/* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE + +union YYSTYPE { -/* Line 387 of yacc.c */ -#line 72 "hl/src/H5LTparse.y" +#line 72 "hl/src/H5LTparse.y" /* yacc.c:355 */ int ival; /*for integer token*/ char *sval; /*for name string*/ hid_t hid; /*for hid_t token*/ +#line 232 "hl/src/H5LTparse.c" /* yacc.c:355 */ +}; -/* Line 387 of yacc.c */ -#line 236 "hl/src/H5LTparse.c" -} YYSTYPE; +typedef union YYSTYPE YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 #endif + extern YYSTYPE H5LTyylval; -#ifdef YYPARSE_PARAM -#if defined __STDC__ || defined __cplusplus -hid_t H5LTyyparse (void *YYPARSE_PARAM); -#else -hid_t H5LTyyparse (); -#endif -#else /* ! YYPARSE_PARAM */ -#if defined __STDC__ || defined __cplusplus hid_t H5LTyyparse (void); -#else -hid_t H5LTyyparse (); -#endif -#endif /* ! YYPARSE_PARAM */ #endif /* !YY_H5LTYY_HL_SRC_H5LTPARSE_H_INCLUDED */ /* Copy the second part of user declarations. */ -/* Line 390 of yacc.c */ -#line 264 "hl/src/H5LTparse.c" +#line 249 "hl/src/H5LTparse.c" /* yacc.c:358 */ #ifdef short # undef short @@ -296,11 +281,8 @@ typedef unsigned char yytype_uint8; #ifdef YYTYPE_INT8 typedef YYTYPE_INT8 yytype_int8; -#elif (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -typedef signed char yytype_int8; #else -typedef short int yytype_int8; +typedef signed char yytype_int8; #endif #ifdef YYTYPE_UINT16 @@ -320,8 +302,7 @@ typedef short int yytype_int16; # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t -# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# elif ! defined YYSIZE_T # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else @@ -343,6 +324,33 @@ typedef short int yytype_int16; # endif #endif +#ifndef YY_ATTRIBUTE +# if (defined __GNUC__ \ + && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ + || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C +# define YY_ATTRIBUTE(Spec) __attribute__(Spec) +# else +# define YY_ATTRIBUTE(Spec) /* empty */ +# endif +#endif + +#ifndef YY_ATTRIBUTE_PURE +# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) +#endif + +#ifndef YY_ATTRIBUTE_UNUSED +# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) +#endif + +#if !defined _Noreturn \ + && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) +# if defined _MSC_VER && 1200 <= _MSC_VER +# define _Noreturn __declspec (noreturn) +# else +# define _Noreturn YY_ATTRIBUTE ((__noreturn__)) +# endif +#endif + /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ # define YYUSE(E) ((void) (E)) @@ -350,24 +358,26 @@ typedef short int yytype_int16; # define YYUSE(E) /* empty */ #endif -/* Identity function, used to suppress warnings about constant conditions. */ -#ifndef lint -# define YYID(N) (N) +#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ +/* Suppress an incorrect diagnostic about yylval being uninitialized. */ +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ + _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") +# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ + _Pragma ("GCC diagnostic pop") #else -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static int -YYID (int yyi) -#else -static int -YYID (yyi) - int yyi; +# define YY_INITIAL_VALUE(Value) Value #endif -{ - return yyi; -} +#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_END +#endif +#ifndef YY_INITIAL_VALUE +# define YY_INITIAL_VALUE(Value) /* Nothing. */ #endif + #if ! defined yyoverflow || YYERROR_VERBOSE /* The parser invokes alloca or malloc; define the necessary symbols. */ @@ -385,8 +395,7 @@ YYID (yyi) # define alloca _alloca # else # define YYSTACK_ALLOC alloca -# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS # include /* INFRINGES ON USER NAME SPACE */ /* Use EXIT_SUCCESS as a witness for stdlib.h. */ # ifndef EXIT_SUCCESS @@ -398,8 +407,8 @@ YYID (yyi) # endif # ifdef YYSTACK_ALLOC - /* Pacify GCC's `empty if-body' warning. */ -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) + /* Pacify GCC's 'empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) # ifndef YYSTACK_ALLOC_MAXIMUM /* The OS might guarantee only one guard page at the bottom of the stack, and a page size can be as small as 4096 bytes. So we cannot safely @@ -415,7 +424,7 @@ YYID (yyi) # endif # if (defined __cplusplus && ! defined EXIT_SUCCESS \ && ! ((defined YYMALLOC || defined malloc) \ - && (defined YYFREE || defined free))) + && (defined YYFREE || defined free))) # include /* INFRINGES ON USER NAME SPACE */ # ifndef EXIT_SUCCESS # define EXIT_SUCCESS 0 @@ -423,15 +432,13 @@ YYID (yyi) # endif # ifndef YYMALLOC # define YYMALLOC malloc -# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# if ! defined malloc && ! defined EXIT_SUCCESS void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free -# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# if ! defined free && ! defined EXIT_SUCCESS void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif @@ -441,7 +448,7 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ #if (! defined yyoverflow \ && (! defined __cplusplus \ - || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) + || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc @@ -466,16 +473,16 @@ union yyalloc elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ -# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ - do \ - { \ - YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ - Stack = &yyptr->Stack_alloc; \ - yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ - yyptr += yynewbytes / sizeof (*yyptr); \ - } \ - while (YYID (0)) +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (0) #endif @@ -494,7 +501,7 @@ union yyalloc for (yyi = 0; yyi < (Count); yyi++) \ (Dst)[yyi] = (Src)[yyi]; \ } \ - while (YYID (0)) + while (0) # endif # endif #endif /* !YYCOPY_NEEDED */ @@ -510,17 +517,19 @@ union yyalloc #define YYNNTS 46 /* YYNRULES -- Number of rules. */ #define YYNRULES 95 -/* YYNRULES -- Number of states. */ +/* YYNSTATES -- Number of states. */ #define YYNSTATES 143 -/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ +/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned + by yylex, with out-of-bounds checking. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 313 -#define YYTRANSLATE(YYX) \ +#define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) -/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ +/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM + as returned by yylex, without out-of-bounds checking. */ static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -558,52 +567,7 @@ static const yytype_uint8 yytranslate[] = }; #if YYDEBUG -/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in - YYRHS. */ -static const yytype_uint8 yyprhs[] = -{ - 0, 0, 3, 4, 6, 8, 10, 12, 14, 16, - 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, - 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, - 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, - 78, 80, 82, 84, 86, 88, 90, 92, 93, 99, - 100, 103, 104, 112, 114, 115, 118, 120, 121, 128, - 129, 132, 133, 134, 140, 142, 147, 148, 149, 150, - 151, 167, 169, 171, 172, 173, 174, 175, 176, 197, - 199, 201, 203, 205, 207, 209, 211, 213, 215, 216, - 224, 225, 228, 229, 236, 238 -}; - -/* YYRHS -- A `-1'-separated list of the rules' RHS. */ -static const yytype_int8 yyrhs[] = -{ - 67, 0, -1, -1, 68, -1, 69, -1, 72, -1, - 80, -1, 87, -1, 70, -1, 71, -1, 95, -1, - 105, -1, 88, -1, 3, -1, 4, -1, 5, -1, - 6, -1, 7, -1, 8, -1, 9, -1, 10, -1, - 11, -1, 12, -1, 13, -1, 14, -1, 15, -1, - 16, -1, 17, -1, 18, -1, 19, -1, 20, -1, - 21, -1, 22, -1, 23, -1, 24, -1, 25, -1, - 26, -1, 27, -1, 28, -1, 29, -1, 30, -1, - 31, -1, 32, -1, 33, -1, 34, -1, 35, -1, - 36, -1, -1, 53, 73, 59, 74, 60, -1, -1, - 74, 75, -1, -1, 68, 76, 63, 77, 63, 78, - 65, -1, 57, -1, -1, 64, 79, -1, 58, -1, - -1, 55, 81, 59, 82, 68, 60, -1, -1, 82, - 83, -1, -1, -1, 61, 84, 86, 85, 62, -1, - 58, -1, 56, 59, 68, 60, -1, -1, -1, -1, - -1, 50, 59, 51, 89, 93, 65, 90, 52, 91, - 63, 94, 63, 65, 92, 60, -1, 58, -1, 57, - -1, -1, -1, -1, -1, -1, 37, 59, 38, 96, - 101, 65, 97, 39, 102, 65, 98, 40, 103, 65, - 99, 41, 104, 65, 100, 60, -1, 42, -1, 58, - -1, 43, -1, 44, -1, 45, -1, 46, -1, 47, - -1, 48, -1, 49, -1, -1, 54, 59, 70, 65, - 106, 107, 60, -1, -1, 107, 108, -1, -1, 63, - 110, 63, 109, 111, 65, -1, 57, -1, 58, -1 -}; - -/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ + /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { 0, 105, 105, 106, 108, 109, 110, 111, 113, 114, @@ -652,13 +616,13 @@ static const char *const yytname[] = "$@5", "dimsize", "vlen_type", "opaque_type", "$@6", "@7", "$@8", "$@9", "opaque_size", "opaque_tag", "string_type", "$@10", "$@11", "$@12", "$@13", "@14", "strsize", "strpad", "cset", "ctype", "enum_type", "$@15", - "enum_list", "enum_def", "$@16", "enum_symbol", "enum_val", YY_NULL + "enum_list", "enum_def", "$@16", "enum_symbol", "enum_val", YY_NULLPTR }; #endif # ifdef YYPRINT -/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to - token YYLEX-NUM. */ +/* YYTOKNUM[NUM] -- (External) token number corresponding to the + (internal) symbol number NUM (which must be that of a token). */ static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, @@ -671,71 +635,18 @@ static const yytype_uint16 yytoknum[] = }; # endif -/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const yytype_uint8 yyr1[] = -{ - 0, 66, 67, 67, 68, 68, 68, 68, 69, 69, - 69, 69, 69, 70, 70, 70, 70, 70, 70, 70, - 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, - 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, - 71, 71, 71, 71, 71, 71, 71, 73, 72, 74, - 74, 76, 75, 77, 78, 78, 79, 81, 80, 82, - 82, 84, 85, 83, 86, 87, 89, 90, 91, 92, - 88, 93, 94, 96, 97, 98, 99, 100, 95, 101, - 101, 102, 102, 102, 103, 103, 104, 104, 106, 105, - 107, 107, 109, 108, 110, 111 -}; +#define YYPACT_NINF -25 -/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ -static const yytype_uint8 yyr2[] = -{ - 0, 2, 0, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 0, 5, 0, - 2, 0, 7, 1, 0, 2, 1, 0, 6, 0, - 2, 0, 0, 5, 1, 4, 0, 0, 0, 0, - 15, 1, 1, 0, 0, 0, 0, 0, 20, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 0, 7, - 0, 2, 0, 6, 1, 1 -}; +#define yypact_value_is_default(Yystate) \ + (!!((Yystate) == (-25))) -/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM. - Performed when YYTABLE doesn't specify something else to do. Zero - means the default is an error. */ -static const yytype_uint8 yydefact[] = -{ - 2, 13, 14, 15, 16, 17, 18, 19, 20, 21, - 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, - 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, - 42, 43, 44, 45, 46, 0, 0, 47, 0, 57, - 0, 0, 3, 4, 8, 9, 5, 6, 7, 12, - 10, 11, 0, 0, 0, 0, 0, 0, 1, 73, - 66, 49, 0, 59, 0, 0, 0, 0, 88, 0, - 65, 79, 80, 0, 71, 0, 48, 51, 50, 90, - 61, 0, 60, 74, 67, 0, 0, 0, 58, 0, - 0, 0, 89, 0, 91, 64, 62, 0, 68, 53, - 0, 94, 0, 0, 81, 82, 83, 0, 0, 54, - 92, 63, 75, 0, 0, 0, 0, 0, 72, 0, - 56, 55, 52, 95, 0, 0, 0, 93, 84, 85, - 0, 69, 76, 0, 0, 70, 0, 86, 87, 0, - 77, 0, 78 -}; +#define YYTABLE_NINF -1 -/* YYDEFGOTO[NTERM-NUM]. */ -static const yytype_int16 yydefgoto[] = -{ - -1, 41, 42, 43, 44, 45, 46, 54, 67, 78, - 85, 100, 115, 121, 47, 56, 69, 82, 87, 103, - 96, 48, 49, 66, 90, 108, 133, 75, 119, 50, - 65, 89, 117, 134, 141, 73, 107, 130, 139, 51, - 79, 86, 94, 116, 102, 124 -}; +#define yytable_value_is_error(Yytable_value) \ + 0 -/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing - STATE-NUM. */ -#define YYPACT_NINF -25 + /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ static const yytype_int16 yypact[] = { 114, -25, -25, -25, -25, -25, -25, -25, -25, -25, @@ -755,7 +666,29 @@ static const yytype_int16 yypact[] = -25, 143, -25 }; -/* YYPGOTO[NTERM-NUM]. */ + /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. + Performed when YYTABLE does not specify something else to do. Zero + means the default is an error. */ +static const yytype_uint8 yydefact[] = +{ + 2, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 0, 0, 47, 0, 57, + 0, 0, 3, 4, 8, 9, 5, 6, 7, 12, + 10, 11, 0, 0, 0, 0, 0, 0, 1, 73, + 66, 49, 0, 59, 0, 0, 0, 0, 88, 0, + 65, 79, 80, 0, 71, 0, 48, 51, 50, 90, + 61, 0, 60, 74, 67, 0, 0, 0, 58, 0, + 0, 0, 89, 0, 91, 64, 62, 0, 68, 53, + 0, 94, 0, 0, 81, 82, 83, 0, 0, 54, + 92, 63, 75, 0, 0, 0, 0, 0, 72, 0, + 56, 55, 52, 95, 0, 0, 0, 93, 84, 85, + 0, 69, 76, 0, 0, 70, 0, 86, 87, 0, + 77, 0, 78 +}; + + /* YYPGOTO[NTERM-NUM]. */ static const yytype_int8 yypgoto[] = { -25, -25, -21, -25, 108, -25, -25, -25, -25, -25, @@ -765,10 +698,19 @@ static const yytype_int8 yypgoto[] = -25, -25, -25, -25, -25, -25 }; -/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If - positive, shift that token. If negative, reduce the rule which - number is the opposite. If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -1 + /* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int16 yydefgoto[] = +{ + -1, 41, 42, 43, 44, 45, 46, 54, 67, 78, + 85, 100, 115, 121, 47, 56, 69, 82, 87, 103, + 96, 48, 49, 66, 90, 108, 133, 75, 119, 50, + 65, 89, 117, 134, 141, 73, 107, 130, 139, 51, + 79, 86, 94, 116, 102, 124 +}; + + /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule whose + number is the opposite. If YYTABLE_NINF, syntax error. */ static const yytype_uint8 yytable[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, @@ -794,12 +736,6 @@ static const yytype_uint8 yytable[] = 132, 136, 140, 142 }; -#define yypact_value_is_default(Yystate) \ - (!!((Yystate) == (-25))) - -#define yytable_value_is_error(Yytable_value) \ - YYID (0) - static const yytype_uint8 yycheck[] = { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, @@ -825,8 +761,8 @@ static const yytype_uint8 yycheck[] = 65, 41, 65, 60 }; -/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing - symbol of state STATE-NUM. */ + /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { 0, 3, 4, 5, 6, 7, 8, 9, 10, 11, @@ -846,30 +782,46 @@ static const yytype_uint8 yystos[] = 65, 100, 60 }; -#define yyerrok (yyerrstatus = 0) -#define yyclearin (yychar = YYEMPTY) -#define YYEMPTY (-2) -#define YYEOF 0 - -#define YYACCEPT goto yyacceptlab -#define YYABORT goto yyabortlab -#define YYERROR goto yyerrorlab - - -/* Like YYERROR except do call yyerror. This remains here temporarily - to ease the transition to the new meaning of YYERROR, for GCC. - Once GCC version 2 has supplanted version 1, this can go. However, - YYFAIL appears to be in use. Nevertheless, it is formally deprecated - in Bison 2.4.2's NEWS entry, where a plan to phase it out is - discussed. */ - -#define YYFAIL goto yyerrlab -#if defined YYFAIL - /* This is here to suppress warnings from the GCC cpp's - -Wunused-macros. Normally we don't worry about that warning, but - some users do, and we want to make it easy for users to remove - YYFAIL uses, which will produce warnings from Bison 2.5. */ -#endif + /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const yytype_uint8 yyr1[] = +{ + 0, 66, 67, 67, 68, 68, 68, 68, 69, 69, + 69, 69, 69, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 71, 71, 71, 71, 71, 71, 71, 73, 72, 74, + 74, 76, 75, 77, 78, 78, 79, 81, 80, 82, + 82, 84, 85, 83, 86, 87, 89, 90, 91, 92, + 88, 93, 94, 96, 97, 98, 99, 100, 95, 101, + 101, 102, 102, 102, 103, 103, 104, 104, 106, 105, + 107, 107, 109, 108, 110, 111 +}; + + /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ +static const yytype_uint8 yyr2[] = +{ + 0, 2, 0, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 0, 5, 0, + 2, 0, 7, 1, 0, 2, 1, 0, 6, 0, + 2, 0, 0, 5, 1, 4, 0, 0, 0, 0, + 15, 1, 1, 0, 0, 0, 0, 0, 20, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 0, 7, + 0, 2, 0, 6, 1, 1 +}; + + +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY (-2) +#define YYEOF 0 + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab + #define YYRECOVERING() (!!yyerrstatus) @@ -886,27 +838,15 @@ do \ else \ { \ yyerror (YY_("syntax error: cannot back up")); \ - YYERROR; \ - } \ -while (YYID (0)) + YYERROR; \ + } \ +while (0) /* Error token number */ -#define YYTERROR 1 -#define YYERRCODE 256 +#define YYTERROR 1 +#define YYERRCODE 256 -/* This macro is provided for backward compatibility. */ -#ifndef YY_LOCATION_PRINT -# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -#endif - - -/* YYLEX -- calling `yylex' with the right arguments. */ -#ifdef YYLEX_PARAM -# define YYLEX yylex (YYLEX_PARAM) -#else -# define YYLEX yylex () -#endif /* Enable debugging if requested. */ #if YYDEBUG @@ -916,40 +856,36 @@ while (YYID (0)) # define YYFPRINTF fprintf # endif -# define YYDPRINTF(Args) \ -do { \ - if (yydebug) \ - YYFPRINTF Args; \ -} while (YYID (0)) +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (0) -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ -do { \ - if (yydebug) \ - { \ - YYFPRINTF (stderr, "%s ", Title); \ - yy_symbol_print (stderr, \ - Type, Value); \ - YYFPRINTF (stderr, "\n"); \ - } \ -} while (YYID (0)) +/* This macro is provided for backward compatibility. */ +#ifndef YY_LOCATION_PRINT +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +#endif -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (0) + + +/*----------------------------------------. +| Print this symbol's value on YYOUTPUT. | +`----------------------------------------*/ -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) -#else -static void -yy_symbol_value_print (yyoutput, yytype, yyvaluep) - FILE *yyoutput; - int yytype; - YYSTYPE const * const yyvaluep; -#endif { FILE *yyo = yyoutput; YYUSE (yyo); @@ -958,14 +894,8 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep) # ifdef YYPRINT if (yytype < YYNTOKENS) YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); -# else - YYUSE (yyoutput); # endif - switch (yytype) - { - default: - break; - } + YYUSE (yytype); } @@ -973,22 +903,11 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep) | Print this symbol on YYOUTPUT. | `--------------------------------*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) -#else -static void -yy_symbol_print (yyoutput, yytype, yyvaluep) - FILE *yyoutput; - int yytype; - YYSTYPE const * const yyvaluep; -#endif { - if (yytype < YYNTOKENS) - YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); - else - YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + YYFPRINTF (yyoutput, "%s %s (", + yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); yy_symbol_value_print (yyoutput, yytype, yyvaluep); YYFPRINTF (yyoutput, ")"); @@ -999,16 +918,8 @@ yy_symbol_print (yyoutput, yytype, yyvaluep) | TOP (included). | `------------------------------------------------------------------*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) -#else -static void -yy_stack_print (yybottom, yytop) - yytype_int16 *yybottom; - yytype_int16 *yytop; -#endif { YYFPRINTF (stderr, "Stack now"); for (; yybottom <= yytop; yybottom++) @@ -1019,49 +930,42 @@ yy_stack_print (yybottom, yytop) YYFPRINTF (stderr, "\n"); } -# define YY_STACK_PRINT(Bottom, Top) \ -do { \ - if (yydebug) \ - yy_stack_print ((Bottom), (Top)); \ -} while (YYID (0)) +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (0) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void -yy_reduce_print (YYSTYPE *yyvsp, int yyrule) -#else -static void -yy_reduce_print (yyvsp, yyrule) - YYSTYPE *yyvsp; - int yyrule; -#endif +yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule) { + unsigned long int yylno = yyrline[yyrule]; int yynrhs = yyr2[yyrule]; int yyi; - unsigned long int yylno = yyrline[yyrule]; YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", - yyrule - 1, yylno); + yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { YYFPRINTF (stderr, " $%d = ", yyi + 1); - yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], - &(yyvsp[(yyi + 1) - (yynrhs)]) - ); + yy_symbol_print (stderr, + yystos[yyssp[yyi + 1 - yynrhs]], + &(yyvsp[(yyi + 1) - (yynrhs)]) + ); YYFPRINTF (stderr, "\n"); } } -# define YY_REDUCE_PRINT(Rule) \ -do { \ - if (yydebug) \ - yy_reduce_print (yyvsp, Rule); \ -} while (YYID (0)) +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (yyssp, yyvsp, Rule); \ +} while (0) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ @@ -1075,7 +979,7 @@ int yydebug; /* YYINITDEPTH -- initial size of the parser's stacks. */ -#ifndef YYINITDEPTH +#ifndef YYINITDEPTH # define YYINITDEPTH 200 #endif @@ -1098,15 +1002,8 @@ int yydebug; # define yystrlen strlen # else /* Return the length of YYSTR. */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static YYSIZE_T yystrlen (const char *yystr) -#else -static YYSIZE_T -yystrlen (yystr) - const char *yystr; -#endif { YYSIZE_T yylen; for (yylen = 0; yystr[yylen]; yylen++) @@ -1122,16 +1019,8 @@ yystrlen (yystr) # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static char * yystpcpy (char *yydest, const char *yysrc) -#else -static char * -yystpcpy (yydest, yysrc) - char *yydest; - const char *yysrc; -#endif { char *yyd = yydest; const char *yys = yysrc; @@ -1161,27 +1050,27 @@ yytnamerr (char *yyres, const char *yystr) char const *yyp = yystr; for (;;) - switch (*++yyp) - { - case '\'': - case ',': - goto do_not_strip_quotes; - - case '\\': - if (*++yyp != '\\') - goto do_not_strip_quotes; - /* Fall through. */ - default: - if (yyres) - yyres[yyn] = *yyp; - yyn++; - break; - - case '"': - if (yyres) - yyres[yyn] = '\0'; - return yyn; - } + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } do_not_strip_quotes: ; } @@ -1204,11 +1093,11 @@ static int yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, yytype_int16 *yyssp, int yytoken) { - YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]); + YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); YYSIZE_T yysize = yysize0; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; /* Internationalized format string. */ - const char *yyformat = YY_NULL; + const char *yyformat = YY_NULLPTR; /* Arguments of yyformat. */ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; /* Number of reported tokens (one for the "unexpected", one per @@ -1216,10 +1105,6 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, int yycount = 0; /* There are many possibilities here to consider: - - Assume YYFAIL is not used. It's too flawed to consider. See - - for details. YYERROR is fine as it does not invoke this - function. - If this state is a consistent state with a default action, then the only way this function was invoked is if the default action is an error action. In that case, don't check for expected @@ -1269,7 +1154,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, } yyarg[yycount++] = yytname[yyx]; { - YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]); + YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) return 2; @@ -1336,31 +1221,17 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, | Release the memory associated to this symbol. | `-----------------------------------------------*/ -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) -#else -static void -yydestruct (yymsg, yytype, yyvaluep) - const char *yymsg; - int yytype; - YYSTYPE *yyvaluep; -#endif { YYUSE (yyvaluep); - if (!yymsg) yymsg = "Deleting"; YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); - switch (yytype) - { - - default: - break; - } + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + YYUSE (yytype); + YY_IGNORE_MAYBE_UNINITIALIZED_END } @@ -1369,18 +1240,8 @@ yydestruct (yymsg, yytype, yyvaluep) /* The lookahead symbol. */ int yychar; - -#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN -# define YY_IGNORE_MAYBE_UNINITIALIZED_END -#endif -#ifndef YY_INITIAL_VALUE -# define YY_INITIAL_VALUE(Value) /* Nothing. */ -#endif - /* The semantic value of the lookahead symbol. */ -YYSTYPE yylval YY_INITIAL_VALUE(yyval_default); - +YYSTYPE yylval; /* Number of syntax errors so far. */ int yynerrs; @@ -1389,35 +1250,16 @@ int yynerrs; | yyparse. | `----------*/ -#ifdef YYPARSE_PARAM -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -hid_t -yyparse (void *YYPARSE_PARAM) -#else -hid_t -yyparse (YYPARSE_PARAM) - void *YYPARSE_PARAM; -#endif -#else /* ! YYPARSE_PARAM */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) hid_t yyparse (void) -#else -hid_t -yyparse () - -#endif -#endif { int yystate; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; /* The stacks and their tools: - `yyss': related to states. - `yyvs': related to semantic values. + 'yyss': related to states. + 'yyvs': related to semantic values. Refer to the stacks through separate pointers, to allow yyoverflow to reallocate them elsewhere. */ @@ -1485,23 +1327,23 @@ yyparse () #ifdef yyoverflow { - /* Give user a chance to reallocate the stack. Use copies of - these so that the &'s don't force the real ones into - memory. */ - YYSTYPE *yyvs1 = yyvs; - yytype_int16 *yyss1 = yyss; - - /* Each stack pointer address is followed by the size of the - data in use in that stack, in bytes. This used to be a - conditional around just the two extra args, but that might - be undefined if yyoverflow is a macro. */ - yyoverflow (YY_("memory exhausted"), - &yyss1, yysize * sizeof (*yyssp), - &yyvs1, yysize * sizeof (*yyvsp), - &yystacksize); - - yyss = yyss1; - yyvs = yyvs1; + /* Give user a chance to reallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + YYSTYPE *yyvs1 = yyvs; + yytype_int16 *yyss1 = yyss; + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow (YY_("memory exhausted"), + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + &yystacksize); + + yyss = yyss1; + yyvs = yyvs1; } #else /* no yyoverflow */ # ifndef YYSTACK_RELOCATE @@ -1509,22 +1351,22 @@ yyparse () # else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) - goto yyexhaustedlab; + goto yyexhaustedlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) - yystacksize = YYMAXDEPTH; + yystacksize = YYMAXDEPTH; { - yytype_int16 *yyss1 = yyss; - union yyalloc *yyptr = - (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); - if (! yyptr) - goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss_alloc, yyss); - YYSTACK_RELOCATE (yyvs_alloc, yyvs); + yytype_int16 *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyexhaustedlab; + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); # undef YYSTACK_RELOCATE - if (yyss1 != yyssa) - YYSTACK_FREE (yyss1); + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); } # endif #endif /* no yyoverflow */ @@ -1533,10 +1375,10 @@ yyparse () yyvsp = yyvs + yysize - 1; YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long int) yystacksize)); + (unsigned long int) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) - YYABORT; + YYABORT; } YYDPRINTF ((stderr, "Entering state %d\n", yystate)); @@ -1565,7 +1407,7 @@ yybackup: if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); - yychar = YYLEX; + yychar = yylex (); } if (yychar <= YYEOF) @@ -1630,7 +1472,7 @@ yyreduce: yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: - `$$ = $1'. + '$$ = $1'. Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison @@ -1644,440 +1486,439 @@ yyreduce: switch (yyn) { case 2: -/* Line 1792 of yacc.c */ -#line 105 "hl/src/H5LTparse.y" +#line 105 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { memset(arr_stack, 0, STACK_SIZE*sizeof(struct arr_info)); /*initialize here?*/ } +#line 1470 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 3: -/* Line 1792 of yacc.c */ -#line 106 "hl/src/H5LTparse.y" +#line 106 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { return (yyval.hid);} +#line 1476 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 13: -/* Line 1792 of yacc.c */ -#line 120 "hl/src/H5LTparse.y" +#line 120 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_STD_I8BE); } +#line 1482 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 14: -/* Line 1792 of yacc.c */ -#line 121 "hl/src/H5LTparse.y" +#line 121 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_STD_I8LE); } +#line 1488 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 15: -/* Line 1792 of yacc.c */ -#line 122 "hl/src/H5LTparse.y" +#line 122 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_STD_I16BE); } +#line 1494 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 16: -/* Line 1792 of yacc.c */ -#line 123 "hl/src/H5LTparse.y" +#line 123 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_STD_I16LE); } +#line 1500 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 17: -/* Line 1792 of yacc.c */ -#line 124 "hl/src/H5LTparse.y" +#line 124 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_STD_I32BE); } +#line 1506 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 18: -/* Line 1792 of yacc.c */ -#line 125 "hl/src/H5LTparse.y" +#line 125 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_STD_I32LE); } +#line 1512 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 19: -/* Line 1792 of yacc.c */ -#line 126 "hl/src/H5LTparse.y" +#line 126 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_STD_I64BE); } +#line 1518 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 20: -/* Line 1792 of yacc.c */ -#line 127 "hl/src/H5LTparse.y" +#line 127 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_STD_I64LE); } +#line 1524 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 21: -/* Line 1792 of yacc.c */ -#line 128 "hl/src/H5LTparse.y" +#line 128 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_STD_U8BE); } +#line 1530 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 22: -/* Line 1792 of yacc.c */ -#line 129 "hl/src/H5LTparse.y" +#line 129 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_STD_U8LE); } +#line 1536 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 23: -/* Line 1792 of yacc.c */ -#line 130 "hl/src/H5LTparse.y" +#line 130 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_STD_U16BE); } +#line 1542 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 24: -/* Line 1792 of yacc.c */ -#line 131 "hl/src/H5LTparse.y" +#line 131 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_STD_U16LE); } +#line 1548 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 25: -/* Line 1792 of yacc.c */ -#line 132 "hl/src/H5LTparse.y" +#line 132 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_STD_U32BE); } +#line 1554 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 26: -/* Line 1792 of yacc.c */ -#line 133 "hl/src/H5LTparse.y" +#line 133 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_STD_U32LE); } +#line 1560 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 27: -/* Line 1792 of yacc.c */ -#line 134 "hl/src/H5LTparse.y" +#line 134 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_STD_U64BE); } +#line 1566 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 28: -/* Line 1792 of yacc.c */ -#line 135 "hl/src/H5LTparse.y" +#line 135 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_STD_U64LE); } +#line 1572 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 29: -/* Line 1792 of yacc.c */ -#line 136 "hl/src/H5LTparse.y" +#line 136 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_NATIVE_CHAR); } +#line 1578 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 30: -/* Line 1792 of yacc.c */ -#line 137 "hl/src/H5LTparse.y" +#line 137 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_NATIVE_SCHAR); } +#line 1584 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 31: -/* Line 1792 of yacc.c */ -#line 138 "hl/src/H5LTparse.y" +#line 138 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_NATIVE_UCHAR); } +#line 1590 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 32: -/* Line 1792 of yacc.c */ -#line 139 "hl/src/H5LTparse.y" +#line 139 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_NATIVE_SHORT); } +#line 1596 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 33: -/* Line 1792 of yacc.c */ -#line 140 "hl/src/H5LTparse.y" +#line 140 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_NATIVE_USHORT); } +#line 1602 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 34: -/* Line 1792 of yacc.c */ -#line 141 "hl/src/H5LTparse.y" +#line 141 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_NATIVE_INT); } +#line 1608 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 35: -/* Line 1792 of yacc.c */ -#line 142 "hl/src/H5LTparse.y" +#line 142 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_NATIVE_UINT); } +#line 1614 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 36: -/* Line 1792 of yacc.c */ -#line 143 "hl/src/H5LTparse.y" +#line 143 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_NATIVE_LONG); } +#line 1620 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 37: -/* Line 1792 of yacc.c */ -#line 144 "hl/src/H5LTparse.y" +#line 144 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_NATIVE_ULONG); } +#line 1626 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 38: -/* Line 1792 of yacc.c */ -#line 145 "hl/src/H5LTparse.y" +#line 145 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_NATIVE_LLONG); } +#line 1632 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 39: -/* Line 1792 of yacc.c */ -#line 146 "hl/src/H5LTparse.y" +#line 146 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_NATIVE_ULLONG); } +#line 1638 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 40: -/* Line 1792 of yacc.c */ -#line 149 "hl/src/H5LTparse.y" +#line 149 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_IEEE_F32BE); } +#line 1644 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 41: -/* Line 1792 of yacc.c */ -#line 150 "hl/src/H5LTparse.y" +#line 150 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_IEEE_F32LE); } +#line 1650 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 42: -/* Line 1792 of yacc.c */ -#line 151 "hl/src/H5LTparse.y" +#line 151 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_IEEE_F64BE); } +#line 1656 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 43: -/* Line 1792 of yacc.c */ -#line 152 "hl/src/H5LTparse.y" +#line 152 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_IEEE_F64LE); } +#line 1662 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 44: -/* Line 1792 of yacc.c */ -#line 153 "hl/src/H5LTparse.y" +#line 153 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_NATIVE_FLOAT); } +#line 1668 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 45: -/* Line 1792 of yacc.c */ -#line 154 "hl/src/H5LTparse.y" +#line 154 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_NATIVE_DOUBLE); } +#line 1674 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 46: -/* Line 1792 of yacc.c */ -#line 155 "hl/src/H5LTparse.y" +#line 155 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.hid) = H5Tcopy(H5T_NATIVE_LDOUBLE); } +#line 1680 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 47: -/* Line 1792 of yacc.c */ -#line 159 "hl/src/H5LTparse.y" +#line 159 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { csindex++; cmpd_stack[csindex].id = H5Tcreate(H5T_COMPOUND, 1); /*temporarily set size to 1*/ } +#line 1686 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 48: -/* Line 1792 of yacc.c */ -#line 161 "hl/src/H5LTparse.y" - { (yyval.hid) = cmpd_stack[csindex].id; +#line 161 "hl/src/H5LTparse.y" /* yacc.c:1646 */ + { (yyval.hid) = cmpd_stack[csindex].id; cmpd_stack[csindex].id = 0; - cmpd_stack[csindex].first_memb = 1; + cmpd_stack[csindex].first_memb = 1; csindex--; } +#line 1696 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 51: -/* Line 1792 of yacc.c */ -#line 170 "hl/src/H5LTparse.y" +#line 170 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { cmpd_stack[csindex].is_field = 1; /*notify lexer a compound member is parsed*/ } +#line 1702 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 52: -/* Line 1792 of yacc.c */ -#line 172 "hl/src/H5LTparse.y" - { +#line 172 "hl/src/H5LTparse.y" /* yacc.c:1646 */ + { size_t origin_size, new_size; hid_t dtype_id = cmpd_stack[csindex].id; /*Adjust size and insert member, consider both member size and offset.*/ if(cmpd_stack[csindex].first_memb) { /*reclaim the size 1 temporarily set*/ - new_size = H5Tget_size((yyvsp[(1) - (7)].hid)) + (yyvsp[(6) - (7)].ival); + new_size = H5Tget_size((yyvsp[-6].hid)) + (yyvsp[-1].ival); H5Tset_size(dtype_id, new_size); /*member name is saved in yylval.sval by lexer*/ - H5Tinsert(dtype_id, (yyvsp[(4) - (7)].sval), (yyvsp[(6) - (7)].ival), (yyvsp[(1) - (7)].hid)); + H5Tinsert(dtype_id, (yyvsp[-3].sval), (yyvsp[-1].ival), (yyvsp[-6].hid)); cmpd_stack[csindex].first_memb = 0; } else { origin_size = H5Tget_size(dtype_id); - - if((yyvsp[(6) - (7)].ival) == 0) { - new_size = origin_size + H5Tget_size((yyvsp[(1) - (7)].hid)); + + if((yyvsp[-1].ival) == 0) { + new_size = origin_size + H5Tget_size((yyvsp[-6].hid)); H5Tset_size(dtype_id, new_size); - H5Tinsert(dtype_id, (yyvsp[(4) - (7)].sval), origin_size, (yyvsp[(1) - (7)].hid)); + H5Tinsert(dtype_id, (yyvsp[-3].sval), origin_size, (yyvsp[-6].hid)); } else { - new_size = (yyvsp[(6) - (7)].ival) + H5Tget_size((yyvsp[(1) - (7)].hid)); + new_size = (yyvsp[-1].ival) + H5Tget_size((yyvsp[-6].hid)); H5Tset_size(dtype_id, new_size); - H5Tinsert(dtype_id, (yyvsp[(4) - (7)].sval), (yyvsp[(6) - (7)].ival), (yyvsp[(1) - (7)].hid)); + H5Tinsert(dtype_id, (yyvsp[-3].sval), (yyvsp[-1].ival), (yyvsp[-6].hid)); } } - if((yyvsp[(4) - (7)].sval)) { - free((yyvsp[(4) - (7)].sval)); - (yyvsp[(4) - (7)].sval) = NULL; + if((yyvsp[-3].sval)) { + free((yyvsp[-3].sval)); + (yyvsp[-3].sval) = NULL; } cmpd_stack[csindex].is_field = 0; - H5Tclose((yyvsp[(1) - (7)].hid)); - + H5Tclose((yyvsp[-6].hid)); + new_size = H5Tget_size(dtype_id); } +#line 1741 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 53: -/* Line 1792 of yacc.c */ -#line 208 "hl/src/H5LTparse.y" +#line 208 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.sval) = strdup(yylval.sval); free(yylval.sval); yylval.sval = NULL; } +#line 1751 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 54: -/* Line 1792 of yacc.c */ -#line 215 "hl/src/H5LTparse.y" +#line 215 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.ival) = 0; } +#line 1757 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 55: -/* Line 1792 of yacc.c */ -#line 217 "hl/src/H5LTparse.y" +#line 217 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { (yyval.ival) = yylval.ival; } +#line 1763 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 57: -/* Line 1792 of yacc.c */ -#line 221 "hl/src/H5LTparse.y" +#line 221 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { asindex++; /*pushd onto the stack*/ } +#line 1769 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 58: -/* Line 1792 of yacc.c */ -#line 223 "hl/src/H5LTparse.y" - { - (yyval.hid) = H5Tarray_create2((yyvsp[(5) - (6)].hid), arr_stack[asindex].ndims, arr_stack[asindex].dims); +#line 223 "hl/src/H5LTparse.y" /* yacc.c:1646 */ + { + (yyval.hid) = H5Tarray_create2((yyvsp[-1].hid), arr_stack[asindex].ndims, arr_stack[asindex].dims); arr_stack[asindex].ndims = 0; asindex--; - H5Tclose((yyvsp[(5) - (6)].hid)); + H5Tclose((yyvsp[-1].hid)); } +#line 1780 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 61: -/* Line 1792 of yacc.c */ -#line 233 "hl/src/H5LTparse.y" +#line 233 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { arr_stack[asindex].is_dim = 1; /*notice lexer of dimension size*/ } +#line 1786 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 62: -/* Line 1792 of yacc.c */ -#line 234 "hl/src/H5LTparse.y" +#line 234 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { unsigned ndims = arr_stack[asindex].ndims; - arr_stack[asindex].dims[ndims] = (hsize_t)yylval.ival; + arr_stack[asindex].dims[ndims] = (hsize_t)yylval.ival; arr_stack[asindex].ndims++; - arr_stack[asindex].is_dim = 0; + arr_stack[asindex].is_dim = 0; } +#line 1796 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 65: -/* Line 1792 of yacc.c */ -#line 245 "hl/src/H5LTparse.y" - { (yyval.hid) = H5Tvlen_create((yyvsp[(3) - (4)].hid)); H5Tclose((yyvsp[(3) - (4)].hid)); } +#line 245 "hl/src/H5LTparse.y" /* yacc.c:1646 */ + { (yyval.hid) = H5Tvlen_create((yyvsp[-1].hid)); H5Tclose((yyvsp[-1].hid)); } +#line 1802 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 66: -/* Line 1792 of yacc.c */ -#line 250 "hl/src/H5LTparse.y" +#line 250 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { is_opq_size = 1; } +#line 1808 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 67: -/* Line 1792 of yacc.c */ -#line 251 "hl/src/H5LTparse.y" - { +#line 251 "hl/src/H5LTparse.y" /* yacc.c:1646 */ + { size_t size = (size_t)yylval.ival; (yyval.hid) = H5Tcreate(H5T_OPAQUE, size); - is_opq_size = 0; + is_opq_size = 0; } +#line 1818 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 68: -/* Line 1792 of yacc.c */ -#line 256 "hl/src/H5LTparse.y" +#line 256 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { is_opq_tag = 1; } +#line 1824 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 69: -/* Line 1792 of yacc.c */ -#line 257 "hl/src/H5LTparse.y" - { - H5Tset_tag((yyvsp[(7) - (13)].hid), yylval.sval); +#line 257 "hl/src/H5LTparse.y" /* yacc.c:1646 */ + { + H5Tset_tag((yyvsp[-6].hid), yylval.sval); free(yylval.sval); yylval.sval = NULL; is_opq_tag = 0; } +#line 1835 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 70: -/* Line 1792 of yacc.c */ -#line 263 "hl/src/H5LTparse.y" - { (yyval.hid) = (yyvsp[(7) - (15)].hid); } +#line 263 "hl/src/H5LTparse.y" /* yacc.c:1646 */ + { (yyval.hid) = (yyvsp[-8].hid); } +#line 1841 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 73: -/* Line 1792 of yacc.c */ -#line 271 "hl/src/H5LTparse.y" +#line 271 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { is_str_size = 1; } +#line 1847 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 74: -/* Line 1792 of yacc.c */ -#line 272 "hl/src/H5LTparse.y" - { - if((yyvsp[(5) - (6)].ival) == H5T_VARIABLE_TOKEN) +#line 272 "hl/src/H5LTparse.y" /* yacc.c:1646 */ + { + if((yyvsp[-1].ival) == H5T_VARIABLE_TOKEN) is_variable = 1; - else + else str_size = yylval.ival; - is_str_size = 0; + is_str_size = 0; } +#line 1859 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 75: -/* Line 1792 of yacc.c */ -#line 280 "hl/src/H5LTparse.y" +#line 280 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { - if((yyvsp[(9) - (10)].ival) == H5T_STR_NULLTERM_TOKEN) + if((yyvsp[-1].ival) == H5T_STR_NULLTERM_TOKEN) str_pad = H5T_STR_NULLTERM; - else if((yyvsp[(9) - (10)].ival) == H5T_STR_NULLPAD_TOKEN) + else if((yyvsp[-1].ival) == H5T_STR_NULLPAD_TOKEN) str_pad = H5T_STR_NULLPAD; - else if((yyvsp[(9) - (10)].ival) == H5T_STR_SPACEPAD_TOKEN) + else if((yyvsp[-1].ival) == H5T_STR_SPACEPAD_TOKEN) str_pad = H5T_STR_SPACEPAD; } +#line 1872 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 76: -/* Line 1792 of yacc.c */ -#line 289 "hl/src/H5LTparse.y" - { - if((yyvsp[(13) - (14)].ival) == H5T_CSET_ASCII_TOKEN) +#line 289 "hl/src/H5LTparse.y" /* yacc.c:1646 */ + { + if((yyvsp[-1].ival) == H5T_CSET_ASCII_TOKEN) str_cset = H5T_CSET_ASCII; - else if((yyvsp[(13) - (14)].ival) == H5T_CSET_UTF8_TOKEN) + else if((yyvsp[-1].ival) == H5T_CSET_UTF8_TOKEN) str_cset = H5T_CSET_UTF8; } +#line 1883 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 77: -/* Line 1792 of yacc.c */ -#line 296 "hl/src/H5LTparse.y" +#line 296 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { - if((yyvsp[(17) - (18)].hid) == H5T_C_S1_TOKEN) + if((yyvsp[-1].hid) == H5T_C_S1_TOKEN) (yyval.hid) = H5Tcopy(H5T_C_S1); - else if((yyvsp[(17) - (18)].hid) == H5T_FORTRAN_S1_TOKEN) + else if((yyvsp[-1].hid) == H5T_FORTRAN_S1_TOKEN) (yyval.hid) = H5Tcopy(H5T_FORTRAN_S1); } +#line 1894 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 78: -/* Line 1792 of yacc.c */ -#line 303 "hl/src/H5LTparse.y" - { - hid_t str_id = (yyvsp[(19) - (20)].hid); +#line 303 "hl/src/H5LTparse.y" /* yacc.c:1646 */ + { + hid_t str_id = (yyvsp[-1].hid); /*set string size*/ if(is_variable) { @@ -2085,93 +1926,93 @@ yyreduce: is_variable = 0; } else H5Tset_size(str_id, str_size); - + /*set string padding and character set*/ H5Tset_strpad(str_id, str_pad); H5Tset_cset(str_id, str_cset); - (yyval.hid) = str_id; + (yyval.hid) = str_id; } +#line 1915 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 79: -/* Line 1792 of yacc.c */ -#line 320 "hl/src/H5LTparse.y" +#line 320 "hl/src/H5LTparse.y" /* yacc.c:1646 */ {(yyval.ival) = H5T_VARIABLE_TOKEN;} +#line 1921 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 81: -/* Line 1792 of yacc.c */ -#line 323 "hl/src/H5LTparse.y" +#line 323 "hl/src/H5LTparse.y" /* yacc.c:1646 */ {(yyval.ival) = H5T_STR_NULLTERM_TOKEN;} +#line 1927 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 82: -/* Line 1792 of yacc.c */ -#line 324 "hl/src/H5LTparse.y" +#line 324 "hl/src/H5LTparse.y" /* yacc.c:1646 */ {(yyval.ival) = H5T_STR_NULLPAD_TOKEN;} +#line 1933 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 83: -/* Line 1792 of yacc.c */ -#line 325 "hl/src/H5LTparse.y" +#line 325 "hl/src/H5LTparse.y" /* yacc.c:1646 */ {(yyval.ival) = H5T_STR_SPACEPAD_TOKEN;} +#line 1939 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 84: -/* Line 1792 of yacc.c */ -#line 327 "hl/src/H5LTparse.y" +#line 327 "hl/src/H5LTparse.y" /* yacc.c:1646 */ {(yyval.ival) = H5T_CSET_ASCII_TOKEN;} +#line 1945 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 85: -/* Line 1792 of yacc.c */ -#line 328 "hl/src/H5LTparse.y" +#line 328 "hl/src/H5LTparse.y" /* yacc.c:1646 */ {(yyval.ival) = H5T_CSET_UTF8_TOKEN;} +#line 1951 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 86: -/* Line 1792 of yacc.c */ -#line 330 "hl/src/H5LTparse.y" +#line 330 "hl/src/H5LTparse.y" /* yacc.c:1646 */ {(yyval.hid) = H5T_C_S1_TOKEN;} +#line 1957 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 87: -/* Line 1792 of yacc.c */ -#line 331 "hl/src/H5LTparse.y" +#line 331 "hl/src/H5LTparse.y" /* yacc.c:1646 */ {(yyval.hid) = H5T_FORTRAN_S1_TOKEN;} +#line 1963 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 88: -/* Line 1792 of yacc.c */ -#line 335 "hl/src/H5LTparse.y" - { is_enum = 1; enum_id = H5Tenum_create((yyvsp[(3) - (4)].hid)); H5Tclose((yyvsp[(3) - (4)].hid)); } +#line 335 "hl/src/H5LTparse.y" /* yacc.c:1646 */ + { is_enum = 1; enum_id = H5Tenum_create((yyvsp[-1].hid)); H5Tclose((yyvsp[-1].hid)); } +#line 1969 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 89: -/* Line 1792 of yacc.c */ -#line 337 "hl/src/H5LTparse.y" +#line 337 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { is_enum = 0; /*reset*/ (yyval.hid) = enum_id; } +#line 1975 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 92: -/* Line 1792 of yacc.c */ -#line 342 "hl/src/H5LTparse.y" +#line 342 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { is_enum_memb = 1; /*indicate member of enum*/ #ifdef H5_HAVE_WIN32_API - enum_memb_symbol = _strdup(yylval.sval); + enum_memb_symbol = _strdup(yylval.sval); #else /* H5_HAVE_WIN32_API */ - enum_memb_symbol = strdup(yylval.sval); + enum_memb_symbol = strdup(yylval.sval); #endif /* H5_HAVE_WIN32_API */ free(yylval.sval); yylval.sval = NULL; } +#line 1990 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; case 93: -/* Line 1792 of yacc.c */ -#line 353 "hl/src/H5LTparse.y" +#line 353 "hl/src/H5LTparse.y" /* yacc.c:1646 */ { char char_val=(char)yylval.ival; short short_val=(short)yylval.ival; @@ -2182,43 +2023,43 @@ yyreduce: hid_t native = H5Tget_native_type(super, H5T_DIR_ASCEND); H5T_order_t super_order = H5Tget_order(super); H5T_order_t native_order = H5Tget_order(native); - + if(is_enum && is_enum_memb) { /*if it's an enum member*/ /*To handle machines of different endianness*/ if(H5Tequal(native, H5T_NATIVE_SCHAR) || H5Tequal(native, H5T_NATIVE_UCHAR)) { if(super_order != native_order) - H5Tconvert(native, super, 1, &char_val, NULL, H5P_DEFAULT); + H5Tconvert(native, super, 1, &char_val, NULL, H5P_DEFAULT); H5Tenum_insert(enum_id, enum_memb_symbol, &char_val); } else if(H5Tequal(native, H5T_NATIVE_SHORT) || H5Tequal(native, H5T_NATIVE_USHORT)) { if(super_order != native_order) - H5Tconvert(native, super, 1, &short_val, NULL, H5P_DEFAULT); + H5Tconvert(native, super, 1, &short_val, NULL, H5P_DEFAULT); H5Tenum_insert(enum_id, enum_memb_symbol, &short_val); } else if(H5Tequal(native, H5T_NATIVE_INT) || H5Tequal(native, H5T_NATIVE_UINT)) { if(super_order != native_order) - H5Tconvert(native, super, 1, &int_val, NULL, H5P_DEFAULT); + H5Tconvert(native, super, 1, &int_val, NULL, H5P_DEFAULT); H5Tenum_insert(enum_id, enum_memb_symbol, &int_val); } else if(H5Tequal(native, H5T_NATIVE_LONG) || H5Tequal(native, H5T_NATIVE_ULONG)) { if(super_order != native_order) - H5Tconvert(native, super, 1, &long_val, NULL, H5P_DEFAULT); + H5Tconvert(native, super, 1, &long_val, NULL, H5P_DEFAULT); H5Tenum_insert(enum_id, enum_memb_symbol, &long_val); } else if(H5Tequal(native, H5T_NATIVE_LLONG) || H5Tequal(native, H5T_NATIVE_ULLONG)) { if(super_order != native_order) - H5Tconvert(native, super, 1, &llong_val, NULL, H5P_DEFAULT); + H5Tconvert(native, super, 1, &llong_val, NULL, H5P_DEFAULT); H5Tenum_insert(enum_id, enum_memb_symbol, &llong_val); } - is_enum_memb = 0; + is_enum_memb = 0; if(enum_memb_symbol) free(enum_memb_symbol); } H5Tclose(super); H5Tclose(native); } +#line 2037 "hl/src/H5LTparse.c" /* yacc.c:1646 */ break; -/* Line 1792 of yacc.c */ -#line 2200 "hl/src/H5LTparse.c" +#line 2041 "hl/src/H5LTparse.c" /* yacc.c:1646 */ default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -2240,7 +2081,7 @@ yyreduce: *++yyvsp = yyval; - /* Now `shift' the result of the reduction. Determine what state + /* Now 'shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ @@ -2255,9 +2096,9 @@ yyreduce: goto yynewstate; -/*------------------------------------. -| yyerrlab -- here on detecting error | -`------------------------------------*/ +/*--------------------------------------. +| yyerrlab -- here on detecting error. | +`--------------------------------------*/ yyerrlab: /* Make sure we have latest lookahead translation. See comments at user semantic actions for why this is necessary. */ @@ -2308,20 +2149,20 @@ yyerrlab: if (yyerrstatus == 3) { /* If just tried and failed to reuse lookahead token after an - error, discard it. */ + error, discard it. */ if (yychar <= YYEOF) - { - /* Return failure if at end of input. */ - if (yychar == YYEOF) - YYABORT; - } + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } else - { - yydestruct ("Error: discarding", - yytoken, &yylval); - yychar = YYEMPTY; - } + { + yydestruct ("Error: discarding", + yytoken, &yylval); + yychar = YYEMPTY; + } } /* Else will try to reuse lookahead token after shifting the error @@ -2340,7 +2181,7 @@ yyerrorlab: if (/*CONSTCOND*/ 0) goto yyerrorlab; - /* Do not reclaim the symbols of the rule which action triggered + /* Do not reclaim the symbols of the rule whose action triggered this YYERROR. */ YYPOPSTACK (yylen); yylen = 0; @@ -2353,29 +2194,29 @@ yyerrorlab: | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ yyerrlab1: - yyerrstatus = 3; /* Each real token shifted decrements this. */ + yyerrstatus = 3; /* Each real token shifted decrements this. */ for (;;) { yyn = yypact[yystate]; if (!yypact_value_is_default (yyn)) - { - yyn += YYTERROR; - if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) - { - yyn = yytable[yyn]; - if (0 < yyn) - break; - } - } + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } /* Pop the current state because it cannot handle the error token. */ if (yyssp == yyss) - YYABORT; + YYABORT; yydestruct ("Error: popping", - yystos[yystate], yyvsp); + yystos[yystate], yyvsp); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); @@ -2426,14 +2267,14 @@ yyreturn: yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval); } - /* Do not reclaim the symbols of the rule which action triggered + /* Do not reclaim the symbols of the rule whose action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); YY_STACK_PRINT (yyss, yyssp); while (yyssp != yyss) { yydestruct ("Cleanup: popping", - yystos[*yyssp], yyvsp); + yystos[*yyssp], yyvsp); YYPOPSTACK (1); } #ifndef yyoverflow @@ -2444,8 +2285,5 @@ yyreturn: if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); #endif - /* Make sure YYID is used. */ - return YYID (yyresult); + return yyresult; } - - diff --git a/hl/src/H5LTparse.h b/hl/src/H5LTparse.h index 0ecd15d..e38116a 100644 --- a/hl/src/H5LTparse.h +++ b/hl/src/H5LTparse.h @@ -1,8 +1,8 @@ -/* A Bison parser, made by GNU Bison 2.7. */ +/* A Bison parser, made by GNU Bison 3.0.4. */ /* Bison interface for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -32,7 +32,7 @@ #ifndef YY_H5LTYY_HL_SRC_H5LTPARSE_H_INCLUDED # define YY_H5LTYY_HL_SRC_H5LTPARSE_H_INCLUDED -/* Enabling traces. */ +/* Debug traces. */ #ifndef YYDEBUG # define YYDEBUG 0 #endif @@ -40,105 +40,92 @@ extern int H5LTyydebug; #endif -/* Tokens. */ +/* Token type. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - H5T_STD_I8BE_TOKEN = 258, - H5T_STD_I8LE_TOKEN = 259, - H5T_STD_I16BE_TOKEN = 260, - H5T_STD_I16LE_TOKEN = 261, - H5T_STD_I32BE_TOKEN = 262, - H5T_STD_I32LE_TOKEN = 263, - H5T_STD_I64BE_TOKEN = 264, - H5T_STD_I64LE_TOKEN = 265, - H5T_STD_U8BE_TOKEN = 266, - H5T_STD_U8LE_TOKEN = 267, - H5T_STD_U16BE_TOKEN = 268, - H5T_STD_U16LE_TOKEN = 269, - H5T_STD_U32BE_TOKEN = 270, - H5T_STD_U32LE_TOKEN = 271, - H5T_STD_U64BE_TOKEN = 272, - H5T_STD_U64LE_TOKEN = 273, - H5T_NATIVE_CHAR_TOKEN = 274, - H5T_NATIVE_SCHAR_TOKEN = 275, - H5T_NATIVE_UCHAR_TOKEN = 276, - H5T_NATIVE_SHORT_TOKEN = 277, - H5T_NATIVE_USHORT_TOKEN = 278, - H5T_NATIVE_INT_TOKEN = 279, - H5T_NATIVE_UINT_TOKEN = 280, - H5T_NATIVE_LONG_TOKEN = 281, - H5T_NATIVE_ULONG_TOKEN = 282, - H5T_NATIVE_LLONG_TOKEN = 283, - H5T_NATIVE_ULLONG_TOKEN = 284, - H5T_IEEE_F32BE_TOKEN = 285, - H5T_IEEE_F32LE_TOKEN = 286, - H5T_IEEE_F64BE_TOKEN = 287, - H5T_IEEE_F64LE_TOKEN = 288, - H5T_NATIVE_FLOAT_TOKEN = 289, - H5T_NATIVE_DOUBLE_TOKEN = 290, - H5T_NATIVE_LDOUBLE_TOKEN = 291, - H5T_STRING_TOKEN = 292, - STRSIZE_TOKEN = 293, - STRPAD_TOKEN = 294, - CSET_TOKEN = 295, - CTYPE_TOKEN = 296, - H5T_VARIABLE_TOKEN = 297, - H5T_STR_NULLTERM_TOKEN = 298, - H5T_STR_NULLPAD_TOKEN = 299, - H5T_STR_SPACEPAD_TOKEN = 300, - H5T_CSET_ASCII_TOKEN = 301, - H5T_CSET_UTF8_TOKEN = 302, - H5T_C_S1_TOKEN = 303, - H5T_FORTRAN_S1_TOKEN = 304, - H5T_OPAQUE_TOKEN = 305, - OPQ_SIZE_TOKEN = 306, - OPQ_TAG_TOKEN = 307, - H5T_COMPOUND_TOKEN = 308, - H5T_ENUM_TOKEN = 309, - H5T_ARRAY_TOKEN = 310, - H5T_VLEN_TOKEN = 311, - STRING = 312, - NUMBER = 313 - }; + enum yytokentype + { + H5T_STD_I8BE_TOKEN = 258, + H5T_STD_I8LE_TOKEN = 259, + H5T_STD_I16BE_TOKEN = 260, + H5T_STD_I16LE_TOKEN = 261, + H5T_STD_I32BE_TOKEN = 262, + H5T_STD_I32LE_TOKEN = 263, + H5T_STD_I64BE_TOKEN = 264, + H5T_STD_I64LE_TOKEN = 265, + H5T_STD_U8BE_TOKEN = 266, + H5T_STD_U8LE_TOKEN = 267, + H5T_STD_U16BE_TOKEN = 268, + H5T_STD_U16LE_TOKEN = 269, + H5T_STD_U32BE_TOKEN = 270, + H5T_STD_U32LE_TOKEN = 271, + H5T_STD_U64BE_TOKEN = 272, + H5T_STD_U64LE_TOKEN = 273, + H5T_NATIVE_CHAR_TOKEN = 274, + H5T_NATIVE_SCHAR_TOKEN = 275, + H5T_NATIVE_UCHAR_TOKEN = 276, + H5T_NATIVE_SHORT_TOKEN = 277, + H5T_NATIVE_USHORT_TOKEN = 278, + H5T_NATIVE_INT_TOKEN = 279, + H5T_NATIVE_UINT_TOKEN = 280, + H5T_NATIVE_LONG_TOKEN = 281, + H5T_NATIVE_ULONG_TOKEN = 282, + H5T_NATIVE_LLONG_TOKEN = 283, + H5T_NATIVE_ULLONG_TOKEN = 284, + H5T_IEEE_F32BE_TOKEN = 285, + H5T_IEEE_F32LE_TOKEN = 286, + H5T_IEEE_F64BE_TOKEN = 287, + H5T_IEEE_F64LE_TOKEN = 288, + H5T_NATIVE_FLOAT_TOKEN = 289, + H5T_NATIVE_DOUBLE_TOKEN = 290, + H5T_NATIVE_LDOUBLE_TOKEN = 291, + H5T_STRING_TOKEN = 292, + STRSIZE_TOKEN = 293, + STRPAD_TOKEN = 294, + CSET_TOKEN = 295, + CTYPE_TOKEN = 296, + H5T_VARIABLE_TOKEN = 297, + H5T_STR_NULLTERM_TOKEN = 298, + H5T_STR_NULLPAD_TOKEN = 299, + H5T_STR_SPACEPAD_TOKEN = 300, + H5T_CSET_ASCII_TOKEN = 301, + H5T_CSET_UTF8_TOKEN = 302, + H5T_C_S1_TOKEN = 303, + H5T_FORTRAN_S1_TOKEN = 304, + H5T_OPAQUE_TOKEN = 305, + OPQ_SIZE_TOKEN = 306, + OPQ_TAG_TOKEN = 307, + H5T_COMPOUND_TOKEN = 308, + H5T_ENUM_TOKEN = 309, + H5T_ARRAY_TOKEN = 310, + H5T_VLEN_TOKEN = 311, + STRING = 312, + NUMBER = 313 + }; #endif - +/* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE + +union YYSTYPE { -/* Line 2058 of yacc.c */ -#line 72 "hl/src/H5LTparse.y" +#line 72 "hl/src/H5LTparse.y" /* yacc.c:1909 */ int ival; /*for integer token*/ char *sval; /*for name string*/ hid_t hid; /*for hid_t token*/ +#line 119 "hl/src/H5LTparse.h" /* yacc.c:1909 */ +}; -/* Line 2058 of yacc.c */ -#line 122 "hl/src/H5LTparse.h" -} YYSTYPE; +typedef union YYSTYPE YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 #endif + extern YYSTYPE H5LTyylval; -#ifdef YYPARSE_PARAM -#if defined __STDC__ || defined __cplusplus -int H5LTyyparse (void *YYPARSE_PARAM); -#else -int H5LTyyparse (); -#endif -#else /* ! YYPARSE_PARAM */ -#if defined __STDC__ || defined __cplusplus int H5LTyyparse (void); -#else -int H5LTyyparse (); -#endif -#endif /* ! YYPARSE_PARAM */ #endif /* !YY_H5LTYY_HL_SRC_H5LTPARSE_H_INCLUDED */ diff --git a/hl/src/H5PT.c b/hl/src/H5PT.c index f413bea..fa77ae1 100644 --- a/hl/src/H5PT.c +++ b/hl/src/H5PT.c @@ -11,8 +11,6 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include - #include "H5PTprivate.h" #include "H5TBprivate.h" @@ -53,8 +51,8 @@ static herr_t H5PT_get_index(htbl_t *table_id, hsize_t *pt_index); * * Return: Success: table ID, Failure: FAIL * - * Programmer: Nat Furrer, nfurrer@ncsa.uiuc.edu (Author of H5PTcreate_fl) - * James Laird, jlaird@ncsa.uiuc.edu (Author of H5PTcreate_fl) + * Programmer: Nat Furrer (Author of H5PTcreate_fl) + * James Laird (Author of H5PTcreate_fl) * * Date: March 12, 2004 * @@ -182,8 +180,8 @@ error: * * Return: Success: table ID, Failure: Negative * - * Programmer: Nat Furrer, nfurrer@ncsa.uiuc.edu - * James Laird, jlaird@ncsa.uiuc.edu + * Programmer: Nat Furrer + * James Laird * * Date: March 12, 2004 * @@ -301,8 +299,8 @@ error: * * Return: Success: table ID, Failure: Negative * - * Programmer: Nat Furrer, nfurrer@ncsa.uiuc.edu - * James Laird, jlaird@ncsa.uiuc.edu + * Programmer: Nat Furrer + * James Laird * * Date: March 10, 2004 * @@ -426,8 +424,8 @@ H5PT_free_id(void *id) * * Return: Success: SUCCEED, Failure: FAIL * - * Programmer: Nat Furrer, nfurrer@ncsa.uiuc.edu - * James Laird, jlaird@ncsa.uiuc.edu + * Programmer: Nat Furrer + * James Laird * * Date: March 10, 2004 * @@ -475,8 +473,8 @@ error: * * Return: Success: SUCCEED, Failure: FAIL * - * Programmer: Nat Furrer, nfurrer@ncsa.uiuc.edu - * James Laird, jlaird@ncsa.uiuc.edu + * Programmer: Nat Furrer + * James Laird * * Date: April 21, 2004 * @@ -530,8 +528,8 @@ error: * * Return: Success: SUCCEED, Failure: FAIL * - * Programmer: Nat Furrer, nfurrer@ncsa.uiuc.edu - * James Laird, jlaird@ncsa.uiuc.edu + * Programmer: Nat Furrer + * James Laird * * Date: March 12, 2004 * @@ -583,8 +581,8 @@ error: * * Return: Success: SUCCEED, Failure: FAIL * - * Programmer: Nat Furrer, nfurrer@ncsa.uiuc.edu - * James Laird, jlaird@ncsa.uiuc.edu + * Programmer: Nat Furrer + * James Laird * * Date: March 10, 2004 * @@ -628,8 +626,8 @@ error: * * Return: Success: SUCCEED, Failure: FAIL * - * Programmer: Nat Furrer, nfurrer@ncsa.uiuc.edu - * James Laird, jlaird@ncsa.uiuc.edu + * Programmer: Nat Furrer + * James Laird * * Date: March 12, 2004 * @@ -680,8 +678,8 @@ error: * * Return: Success: SUCCEED, Failure: FAIL * - * Programmer: Nat Furrer, nfurrer@ncsa.uiuc.edu - * James Laird, jlaird@ncsa.uiuc.edu + * Programmer: Nat Furrer + * James Laird * * Date: March 12, 2004 * @@ -737,8 +735,8 @@ H5PT_get_index(htbl_t *table, hsize_t *pt_index) * * Return: Success: SUCCEED, Failure: FAIL * - * Programmer: Nat Furrer, nfurrer@ncsa.uiuc.edu - * James Laird, jlaird@ncsa.uiuc.edu + * Programmer: Nat Furrer + * James Laird * * Date: April 23, 2004 * @@ -795,8 +793,8 @@ herr_t H5PTget_index(hid_t table_id, hsize_t *pt_index) * * Return: Success: SUCCEED, Failure: FAIL * - * Programmer: Nat Furrer, nfurrer@ncsa.uiuc.edu - * James Laird, jlaird@ncsa.uiuc.edu + * Programmer: Nat Furrer + * James Laird * * Date: March 12, 2004 * @@ -832,8 +830,8 @@ error: * * Return: Success: SUCCEED, Failure: FAIL * - * Programmer: Nat Furrer, nfurrer@ncsa.uiuc.edu - * James Laird, jlaird@ncsa.uiuc.edu + * Programmer: Nat Furrer + * James Laird * * Date: March 12, 2004 * @@ -861,8 +859,8 @@ herr_t H5PTis_valid(hid_t table_id) * * Return: True: 1, False: 0, Failure: FAIL * - * Programmer: Nat Furrer, nfurrer@ncsa.uiuc.edu - * James Laird, jlaird@ncsa.uiuc.edu + * Programmer: Nat Furrer + * James Laird * * Date: April 14, 2004 * @@ -910,8 +908,8 @@ error: * Return: Success: SUCCEED, Failure: FAIL * -2 if memory was reclaimed but another error occurred * - * Programmer: Nat Furrer, nfurrer@ncsa.uiuc.edu - * James Laird, jlaird@ncsa.uiuc.edu + * Programmer: Nat Furrer + * James Laird * * Date: April 12, 2004 * diff --git a/hl/src/H5TB.c b/hl/src/H5TB.c index c54c41f..79d5cef 100644 --- a/hl/src/H5TB.c +++ b/hl/src/H5TB.c @@ -11,9 +11,6 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include -#include - #include "H5LTprivate.h" #include "H5TBprivate.h" @@ -55,7 +52,7 @@ static hid_t H5TB_create_type(hid_t loc_id, * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * Quincey Koziol * * Date: January 17, 2001 @@ -275,7 +272,7 @@ out: * Return: Success: 0, Failure: -1 * * Programmers: -* Pedro Vicente, pvn@ncsa.uiuc.edu +* Pedro Vicente * Quincey Koziol * * Date: November 19, 2001 @@ -345,7 +342,7 @@ out: * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: November 19, 2001 * @@ -442,7 +439,7 @@ out: * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: November 21, 2001 * @@ -605,7 +602,7 @@ out: * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: November 21, 2001 * @@ -778,7 +775,7 @@ out: * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: November 20, 2001 * @@ -853,7 +850,7 @@ out: * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: November 19, 2001 * @@ -923,7 +920,7 @@ out: * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: November 19, 2001 * @@ -1086,7 +1083,7 @@ out: * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: November 19, 2001 * @@ -1251,7 +1248,7 @@ out: * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: November 26, 2001 * @@ -1413,7 +1410,7 @@ out: * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: November 26, 2001 * @@ -1569,7 +1566,7 @@ out: * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: December 5, 2001 * @@ -1701,7 +1698,7 @@ out: * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: December 10, 2001 * @@ -2059,7 +2056,7 @@ out: * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: January 30, 2002 * @@ -2480,7 +2477,7 @@ out: * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: January 30, 2002 * @@ -2934,7 +2931,7 @@ out: * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: January 30, 2001 * @@ -2960,7 +2957,7 @@ herr_t H5TBAget_title(hid_t loc_id, * * Return: Success: TRUE/FALSE, Failure: -1 * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: January 30, 2002 * @@ -3033,7 +3030,7 @@ out: * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: November 19, 2001 * @@ -3120,7 +3117,7 @@ out: * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: November 19, 2001 * @@ -3240,7 +3237,7 @@ out: * * Return: Success: TRUE/FALSE, Failure: N/A * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: November 19, 2001 * @@ -3281,7 +3278,7 @@ hbool_t H5TB_find_field(const char *field, const char *field_list) * * Return: Success: 0, Failure: -1 * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: December 6, 2001 * @@ -3345,7 +3342,7 @@ out: * * Return: Success: the memory type ID, Failure: -1 * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: March 31, 2004 * @@ -3445,8 +3442,8 @@ out: * * Return: Success: 0, Failure: -1 * -* Programmer: Nat Furrer, nfurrer@ncsa.uiuc.edu -* James Laird, jlaird@ncsa.uiuc.edu +* Programmer: Nat Furrer +* James Laird * * Date: March 8, 2004 * @@ -3512,8 +3509,8 @@ out: * * Return: Success: 0, Failure: -1 * -* Programmer: Nat Furrer, nfurrer@ncsa.uiuc.edu -* James Laird, jlaird@ncsa.uiuc.edu +* Programmer: Nat Furrer +* James Laird * * Date: March 8, 2004 * diff --git a/hl/test/gen_test_ds.c b/hl/test/gen_test_ds.c index 285ab77..a43af77 100644 --- a/hl/test/gen_test_ds.c +++ b/hl/test/gen_test_ds.c @@ -23,8 +23,6 @@ * in test_ds.c will read them. */ -#include -#include #include "h5hltest.h" #include "H5DSpublic.h" #include "H5LTpublic.h" diff --git a/hl/test/h5hltest.h b/hl/test/h5hltest.h index 85f47bd..6cf5062 100644 --- a/hl/test/h5hltest.h +++ b/hl/test/h5hltest.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Friday, April 28, 2006 * * Purpose: Test support stuff. diff --git a/hl/test/test_ds.c b/hl/test/test_ds.c index 79e6f45..5550dd1 100644 --- a/hl/test/test_ds.c +++ b/hl/test/test_ds.c @@ -11,8 +11,6 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include -#include #include "h5hltest.h" #include "H5srcdir.h" #include "H5DSpublic.h" diff --git a/hl/test/test_dset_append.c b/hl/test/test_dset_append.c index 1914a08..455c0e8 100644 --- a/hl/test/test_dset_append.c +++ b/hl/test/test_dset_append.c @@ -11,10 +11,6 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include -#include -#include - #include "h5hltest.h" #include "H5DOpublic.h" diff --git a/hl/test/test_image.c b/hl/test/test_image.c index 6d13419..06a0ff3 100644 --- a/hl/test/test_image.c +++ b/hl/test/test_image.c @@ -11,10 +11,6 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include -#include -#include - #include "h5hltest.h" #include "H5srcdir.h" #include "H5LTpublic.h" diff --git a/hl/test/test_ld.c b/hl/test/test_ld.c index e3cde5d..7de409f 100644 --- a/hl/test/test_ld.c +++ b/hl/test/test_ld.c @@ -11,11 +11,6 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include -#include -#include -#include -#include #include "h5hltest.h" #include "H5srcdir.h" #include "H5LDpublic.h" diff --git a/hl/test/test_lite.c b/hl/test/test_lite.c index e6b4668..f3e6e97 100644 --- a/hl/test/test_lite.c +++ b/hl/test/test_lite.c @@ -11,8 +11,6 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include -#include #include "h5hltest.h" #include "H5srcdir.h" #include "H5LTpublic.h" diff --git a/hl/test/test_packet.c b/hl/test/test_packet.c index 61aebc7..eb28e3d 100644 --- a/hl/test/test_packet.c +++ b/hl/test/test_packet.c @@ -11,8 +11,6 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include -#include #include "h5hltest.h" #include "H5PTpublic.h" #include "H5TBpublic.h" diff --git a/hl/test/test_table.c b/hl/test/test_table.c index 1d6bcec..cd2e2a4 100644 --- a/hl/test/test_table.c +++ b/hl/test/test_table.c @@ -11,8 +11,6 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include -#include #include "h5hltest.h" #include "H5srcdir.h" #include "H5TBpublic.h" diff --git a/hl/tools/gif2h5/h52gifgentst.c b/hl/tools/gif2h5/h52gifgentst.c index 655563c..c0ad151 100644 --- a/hl/tools/gif2h5/h52gifgentst.c +++ b/hl/tools/gif2h5/h52gifgentst.c @@ -22,7 +22,7 @@ * * Purpose: generate files for h52gif testing * - * Programmer: Pedro Vicente, pvn@hdfgroup.org + * Programmer: Pedro Vicente * * Date: March 15, 2007 * diff --git a/hl/tools/gif2h5/hdf2gif.c b/hl/tools/gif2h5/hdf2gif.c index e32facb..1833c92 100644 --- a/hl/tools/gif2h5/hdf2gif.c +++ b/hl/tools/gif2h5/hdf2gif.c @@ -18,8 +18,11 @@ #include "h5tools.h" #include "h5tools_utils.h" -#define IMAGE_WIDTH_MAX 65535 /* unsigned 16bits integer */ -#define IMAGE_HEIGHT_MAX 65535 /* unsigned 16bits integer */ +/* Name of tool */ +#define PROGRAMNAME "hdf2gif" + +#define IMAGE_WIDTH_MAX 65535 /* unsigned 16bits integer */ +#define IMAGE_HEIGHT_MAX 65535 /* unsigned 16bits integer */ int EndianOrder; @@ -42,12 +45,17 @@ usage(void) } +static void +leave(int ret) +{ + h5tools_close(); + HDexit(ret); +} + FILE *fpGif = NULL; int main(int argc , char **argv) { GIFBYTE *Image; - void *edata; - H5E_auto2_t func; /* compression structs */ GIFCHAR *HDFName = NULL; @@ -73,9 +81,8 @@ int main(int argc , char **argv) char *image_name = NULL; int idx; - /* Disable error reporting */ - H5Eget_auto2(H5E_DEFAULT, &func, &edata); - H5Eset_auto2(H5E_DEFAULT, NULL, NULL); + h5tools_setprogname(PROGRAMNAME); + h5tools_setstatus(EXIT_SUCCESS); /* Initialize h5tools lib */ h5tools_init(); @@ -83,8 +90,7 @@ int main(int argc , char **argv) if ( argv[1] && (strcmp("-V",argv[1])==0) ) { print_version("gif2h5"); - exit(EXIT_SUCCESS); - + h5tools_setstatus(EXIT_SUCCESS); } @@ -92,7 +98,7 @@ int main(int argc , char **argv) { /* they didn't supply at least one image -- bail */ usage(); - return EXIT_FAILURE; + h5tools_setstatus(EXIT_FAILURE); } HDFName = argv[1]; @@ -149,30 +155,41 @@ int main(int argc , char **argv) goto out; } - /* read image */ + /* get image's information */ if ( H5IMget_image_info( fid, image_name, &width, &height, &planes, interlace, &npals ) < 0 ) + { + fprintf(stderr , "Unable to get information of the image. Aborting.\n"); goto out; + } - if (width > IMAGE_WIDTH_MAX || height > IMAGE_HEIGHT_MAX){ - fprintf(stderr, "HDF5 image is too large. Limit is %d by %d.\n", IMAGE_WIDTH_MAX, IMAGE_HEIGHT_MAX); - goto out; - } + if (width > IMAGE_WIDTH_MAX || height > IMAGE_HEIGHT_MAX) + { + fprintf(stderr, "HDF5 image is too large. Limit is %d by %d.\n", IMAGE_WIDTH_MAX, IMAGE_HEIGHT_MAX); + goto out; + } - /* tool can handle single plane images only. */ - if (planes > 1){ - fprintf(stderr, "Cannot handle multiple planes image\n"); - goto out; - } + /* tool can handle single plane images only. */ + if (planes > 1) + { + fprintf(stderr, "Cannot handle multiple planes image\n"); + goto out; + } Image = (GIFBYTE*) malloc( (size_t) width * (size_t) height ); if ( H5IMread_image( fid, image_name, Image ) < 0 ) + { + fprintf(stderr , "Unable to read the image. Aborting.\n"); goto out; + } if (npals) { if ( H5IMget_palette_info( fid, image_name, 0, pal_dims ) < 0 ) + { + fprintf(stderr , "Unable to get information of the palette. Aborting.\n"); goto out; + } pal = (GIFBYTE*) malloc( (size_t) pal_dims[0] * (size_t) pal_dims[1] ); @@ -211,9 +228,9 @@ int main(int argc , char **argv) numcols = 256; for (i = 0 ; i < numcols ; i++) { - Red[i] = (GIFBYTE)(255 - i); - Green[i] = (GIFBYTE)(255 - i); - Blue[i] = (GIFBYTE)(255 - i); + Red[i] = (GIFBYTE)(255 - i); + Green[i] = (GIFBYTE)(255 - i); + Blue[i] = (GIFBYTE)(255 - i); } } else @@ -246,7 +263,7 @@ int main(int argc , char **argv) if (j==i) { /* wasn't found */ - pc2nc[i] = (GIFBYTE)nc; + pc2nc[i] = (GIFBYTE)nc; r1[nc] = Red[i]; g1[nc] = Green[i]; b1[nc] = Blue[i]; @@ -334,9 +351,7 @@ int main(int argc , char **argv) if (image_name != NULL) free(image_name); - H5Eset_auto2(H5E_DEFAULT, func, edata); - - return EXIT_SUCCESS; + leave(h5tools_getstatus()); out: @@ -346,7 +361,6 @@ out: if (image_name != NULL) free(image_name); - H5Eset_auto2(H5E_DEFAULT, func, edata); - - return EXIT_FAILURE; + h5tools_setstatus(EXIT_FAILURE); + leave(h5tools_getstatus()); } diff --git a/hl/tools/h5watch/h5watch.c b/hl/tools/h5watch/h5watch.c index ff9a078..a05c63b 100644 --- a/hl/tools/h5watch/h5watch.c +++ b/hl/tools/h5watch/h5watch.c @@ -821,10 +821,6 @@ main(int argc, const char *argv[]) char drivername[50]; /* VFD name */ char *fname = NULL; /* File name */ char *dname = NULL; /* Dataset name */ - void *edata; /* Error reporting */ - void *tools_edata; /* Error reporting */ - H5E_auto2_t func; /* Error reporting */ - H5E_auto2_t tools_func; /* Error reporting */ char *x; /* Temporary string pointer */ hid_t fid = -1; /* File ID */ hid_t fapl = -1; /* File access property list */ @@ -833,17 +829,9 @@ main(int argc, const char *argv[]) h5tools_setprogname(PROGRAMNAME); h5tools_setstatus(EXIT_SUCCESS); - /* Disable error reporting */ - H5Eget_auto2(H5E_DEFAULT, &func, &edata); - H5Eset_auto2(H5E_DEFAULT, NULL, NULL); - /* Initialize h5tools lib */ h5tools_init(); - /* Disable tools error reporting */ - H5Eget_auto2(H5tools_ERR_STACK_g, &tools_func, &tools_edata); - H5Eset_auto2(H5tools_ERR_STACK_g, NULL, NULL); - /* To exit from h5watch for SIGTERM signal */ if(HDsignal(SIGTERM, catch_signal) == SIG_ERR) { error_msg("An error occurred while setting a signal handler.\n"); @@ -865,6 +853,9 @@ main(int argc, const char *argv[]) leave(EXIT_FAILURE); } + /* enable error reporting if command line option */ + h5tools_error_report(); + /* Mostly copied from tools/h5ls coding & modified accordingly */ /* * [OBJECT] is specified as @@ -881,18 +872,22 @@ main(int argc, const char *argv[]) * doesn't exist). */ if((fname = HDstrdup(argv[opt_ind])) == NULL) { - error_msg("memory allocation failed (file %s:line %d)\n", - __FILE__, __LINE__); + error_msg("memory allocation failed (file %s:line %d)\n", __FILE__, __LINE__); h5tools_setstatus(EXIT_FAILURE); + goto done; } /* Create a copy of file access property list */ - if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) - return -1; + if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) { + h5tools_setstatus(EXIT_FAILURE); + goto done; + } /* Set to use the latest library format */ - if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) - return -1; + if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) { + h5tools_setstatus(EXIT_FAILURE); + goto done; + } do { while(fname && *fname) { @@ -917,30 +912,37 @@ main(int argc, const char *argv[]) if(fid < 0) { error_msg("unable to open file \"%s\"\n", fname); - if(fname) HDfree(fname); - if(fapl >= 0) H5Pclose(fapl); - leave(EXIT_FAILURE); + h5tools_setstatus(EXIT_FAILURE); + goto done; } if(!dname) { error_msg("no dataset specified\n"); h5tools_setstatus(EXIT_FAILURE); - } else { + goto done; + } + else { *dname = '/'; x = dname; if((dname = HDstrdup(dname)) == NULL) { - error_msg("memory allocation failed (file %s:line %d)\n", - __FILE__, __LINE__); + error_msg("memory allocation failed (file %s:line %d)\n", __FILE__, __LINE__); h5tools_setstatus(EXIT_FAILURE); - } else { + goto done; + } + else { *x = '\0'; /* Validate dataset */ - if(check_dataset(fid, dname) < 0) + if(check_dataset(fid, dname) < 0) { h5tools_setstatus(EXIT_FAILURE); + goto done; + } /* Validate input "fields" */ - else if(g_list_of_fields && *g_list_of_fields) - if(process_cmpd_fields(fid, dname) < 0) + else if(g_list_of_fields && *g_list_of_fields) { + if(process_cmpd_fields(fid, dname) < 0) { h5tools_setstatus(EXIT_FAILURE); + goto done; + } + } } } @@ -949,15 +951,20 @@ main(int argc, const char *argv[]) if(monitor_dataset(fid, dname) < 0) h5tools_setstatus(EXIT_FAILURE); +done: /* Free spaces */ - if(fname) HDfree(fname); - if(dname) HDfree(dname); - if(g_list_of_fields) HDfree(g_list_of_fields); + if(fname) + HDfree(fname); + if(dname) + HDfree(dname); + if(g_list_of_fields) + HDfree(g_list_of_fields); if(g_listv) { H5LD_clean_vector(g_listv); HDfree(g_listv); } - if(g_dup_fields) HDfree(g_dup_fields); + if(g_dup_fields) + HDfree(g_dup_fields); /* Close the file access property list */ if(fapl >= 0 && H5Pclose(fapl) < 0) { @@ -966,14 +973,11 @@ main(int argc, const char *argv[]) } /* Close the file */ - if(H5Fclose(fid) < 0) { + if(fid >= 0 && H5Fclose(fid) < 0) { error_msg("unable to close file\n"); h5tools_setstatus(EXIT_FAILURE); } - H5Eset_auto2(H5E_DEFAULT, func, edata); - H5Eset_auto2(H5tools_ERR_STACK_g, tools_func, tools_edata); - /* exit */ leave(h5tools_getstatus()); } /* main() */ diff --git a/java/src/hdf/hdf5lib/H5.java b/java/src/hdf/hdf5lib/H5.java index 1527dc2..1147e6c 100644 --- a/java/src/hdf/hdf5lib/H5.java +++ b/java/src/hdf/hdf5lib/H5.java @@ -6687,6 +6687,55 @@ public class H5 implements java.io.Serializable { public synchronized static native void H5Pset_evict_on_close(long fapl_id, boolean evict_on_close) throws HDF5LibraryException; + /** + * H5Pget_use_file_locking retrieves whether we are using file locking. + * + * @param fapl_id + * IN: File access property list identifier + * + * @return indication if file locking is used. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * + **/ + public synchronized static native boolean H5Pget_use_file_locking(long fapl_id) + throws HDF5LibraryException; + + /** + * H5Pget_use_file_locking retrieves whether we ignore file locks when they are disabled. + * + * @param fapl_id + * IN: File access property list identifier + * + * @return indication if file locking is ignored. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * + **/ + public synchronized static native boolean H5Pget_ignore_disabled_file_locking(long fapl_id) + throws HDF5LibraryException; + + /** + * H5Pset_file_locking sets parameters related to file locking. + * + * @param fapl_id + * IN: File access property list identifier + * + * @param use_file_locking + * IN: Whether the library will use file locking when opening files (mainly for SWMR semantics). + * + * @param ignore_when_disabled + * IN: Whether file locking will be ignored when disabled on a file system (useful for Lustre). + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * + **/ + public synchronized static native void H5Pset_file_locking(long fapl_id, boolean use_file_locking, boolean ignore_when_disabled) + throws HDF5LibraryException; + // ///// unimplemented ///// // herr_t H5Pset_vol(hid_t plist_id, hid_t new_vol_id, const void *new_vol_info); // herr_t H5Pget_vol_id(hid_t plist_id, hid_t *vol_id); diff --git a/java/src/jni/h5pFAPLImp.c b/java/src/jni/h5pFAPLImp.c index 9ae8775..dbfbb5a 100644 --- a/java/src/jni/h5pFAPLImp.c +++ b/java/src/jni/h5pFAPLImp.c @@ -1377,6 +1377,78 @@ done: /* * Class: hdf_hdf5lib_H5 + * Method: H5Pset_file_locking + * Signature: (JZZ)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1file_1locking + (JNIEnv *env, jclass clss, jlong fapl_id, jboolean use_file_locking, jboolean ignore_when_disabled) +{ + hbool_t use_file_locking_val = TRUE; + hbool_t ignore_when_disabled_val = TRUE; + + UNUSED(clss); + + use_file_locking_val = (use_file_locking == JNI_TRUE) ? TRUE : FALSE; + ignore_when_disabled_val = (ignore_when_disabled == JNI_TRUE) ? TRUE : FALSE; + + if (H5Pset_file_locking((hid_t)fapl_id, use_file_locking_val, ignore_when_disabled_val) < 0) + H5_LIBRARY_ERROR(ENVONLY); + +done: + return; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1file_1locking */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_use_file_locking + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1use_1file_1locking + (JNIEnv *env, jclass clss, jlong fapl_id) +{ + hbool_t use_file_locking_val = TRUE; + hbool_t unused = TRUE; + jboolean bval = JNI_FALSE; + + UNUSED(clss); + + if (H5Pget_file_locking((hid_t)fapl_id, &use_file_locking_val, &unused) < 0) + H5_LIBRARY_ERROR(ENVONLY); + + bval = (use_file_locking_val == TRUE) ? JNI_TRUE : JNI_FALSE; + +done: + return bval; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1use_1file_1locking */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_ignore_disabled_file_locking + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1ignore_1disabled_1file_1locking + (JNIEnv *env, jclass clss, jlong fapl_id) +{ + hbool_t ignore_when_disabled_val = TRUE; + hbool_t unused = TRUE; + jboolean bval = JNI_FALSE; + + UNUSED(clss); + + if (H5Pget_file_locking((hid_t)fapl_id, &unused, &ignore_when_disabled_val) < 0) + H5_LIBRARY_ERROR(ENVONLY); + + bval = (ignore_when_disabled_val == TRUE) ? JNI_TRUE : JNI_FALSE; + +done: + return bval; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1ignore_1disabled_1file_1locking */ + +/* + * Class: hdf_hdf5lib_H5 * Method: H5Pset_metadata_read_attempts * Signature: (JJ)V */ diff --git a/java/src/jni/h5pFAPLImp.h b/java/src/jni/h5pFAPLImp.h index 9b353e6..b9b4556 100644 --- a/java/src/jni/h5pFAPLImp.h +++ b/java/src/jni/h5pFAPLImp.h @@ -392,6 +392,33 @@ Java_hdf_hdf5lib_H5_H5Pget_1evict_1on_1close /* * Class: hdf_hdf5lib_H5 + * Method: H5Pset_file_locking + * Signature: (JZZ)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1file_1locking +(JNIEnv *env, jclass clss, jlong fapl_id, jboolean use_file_locking, jboolean ignore_when_disabled); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_use_file_locking + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1use_1file_1locking +(JNIEnv *env, jclass clss, jlong fapl_id); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_ignore_disabled_file_locking + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1ignore_1disabled_1file_1locking +(JNIEnv *env, jclass clss, jlong fapl_id); + +/* + * Class: hdf_hdf5lib_H5 * Method: H5Pset_metadata_read_attempts * Signature: (JJ)V */ diff --git a/java/test/TestH5Pfapl.java b/java/test/TestH5Pfapl.java index 10a79dd..4233580 100644 --- a/java/test/TestH5Pfapl.java +++ b/java/test/TestH5Pfapl.java @@ -1398,4 +1398,36 @@ public class TestH5Pfapl { fail("H5P_evict_on_close: " + err); } } + + @Test + public void testH5P_file_locking() { + boolean use_file_locking = false; + boolean ignore_disabled_file_locking = false; + try { + // false values (usually not the default) + H5.H5Pset_file_locking(fapl_id, false, false); + use_file_locking = H5.H5Pget_use_file_locking(fapl_id); + ignore_disabled_file_locking = H5.H5Pget_ignore_disabled_file_locking(fapl_id); + assertFalse("H5P_file_locking", use_file_locking); + assertFalse("H5P_file_locking", ignore_disabled_file_locking); + + // true values (typically the default) + H5.H5Pset_file_locking(fapl_id, true, true); + use_file_locking = H5.H5Pget_use_file_locking(fapl_id); + ignore_disabled_file_locking = H5.H5Pget_ignore_disabled_file_locking(fapl_id); + assertTrue("H5P_file_locking", use_file_locking); + assertTrue("H5P_file_locking", ignore_disabled_file_locking); + } + catch (HDF5PropertyListInterfaceException err) { + // parallel is not supported + if (err.getMinorErrorNumber() != HDF5Constants.H5E_UNSUPPORTED) { + err.printStackTrace(); + fail("H5P_test_file_locking: " + err); + } + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5P_test_file_locking: " + err); + } + } } diff --git a/java/test/TestH5S.java b/java/test/TestH5S.java index 985342b..97c0b68 100644 --- a/java/test/TestH5S.java +++ b/java/test/TestH5S.java @@ -171,7 +171,7 @@ public class TestH5S { try { H5.H5Sset_extent_none(H5sid); read_type = H5.H5Sget_simple_extent_type(H5sid); - assertTrue("H5.H5Sget_simple_extent_type: "+read_type, HDF5Constants.H5S_NO_CLASS == read_type); + assertTrue("H5.H5Sget_simple_extent_type: "+read_type, HDF5Constants.H5S_NULL == read_type); } catch (Throwable err) { err.printStackTrace(); diff --git a/java/test/junit.sh.in b/java/test/junit.sh.in index 598b3d2..62a5104 100644 --- a/java/test/junit.sh.in +++ b/java/test/junit.sh.in @@ -15,12 +15,12 @@ top_builddir=@top_builddir@ top_srcdir=@top_srcdir@ srcdir=@srcdir@ -prefix=@prefix@ USE_FILTER_SZIP="@USE_FILTER_SZIP@" USE_FILTER_DEFLATE="@USE_FILTER_DEFLATE@" USE_ROS3_VFD="@HAVE_ROS3_VFD@" USE_HDFS_VFD="@HAVE_LIBHDFS@" +IS_DARWIN="@H5_IS_DARWIN@" TESTNAME=JUnitInterface EXIT_SUCCESS=0 @@ -43,8 +43,8 @@ myos=`uname -s` # where the libs exist HDFLIB_HOME="$top_srcdir/java/lib" -BLDLIBDIR="$prefix/lib" BLDDIR="." +BLDLIBDIR="$BLDDIR/testlibs" HDFTEST_HOME="$top_srcdir/java/test" JARFILE=jar@PACKAGE_TARNAME@-@PACKAGE_VERSION@.jar TESTJARFILE=jar@PACKAGE_TARNAME@test.jar @@ -146,6 +146,13 @@ COPY_LIBFILES_TO_BLDLIBDIR() fi fi done + if [ "$IS_DARWIN" = "yes" ]; then + (cd testlibs; \ + install_name_tool -add_rpath @loader_path libhdf5_java.dylib; \ + exist_path=` otool -l libhdf5_java.dylib | grep libhdf5 | grep -v java | awk '{print $2}'`; \ + echo $exist_path; \ + install_name_tool -change $exist_path @rpath/libhdf5.dylib libhdf5_java.dylib) + fi # copy jar files. Used -f to make sure get a new copy for tstfile in $COPY_JARTESTFILES do @@ -204,10 +211,7 @@ CLEAN_LIBFILES_AND_BLDLIBDIR() INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'` if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then - for tstfile in $COPY_JARTESTFILES - do - $RM $BLDLIBDIR/tstfile - done + $RM -rf $BLDLIBDIR fi } diff --git a/java/test/testfiles/JUnit-TestH5Pfapl.txt b/java/test/testfiles/JUnit-TestH5Pfapl.txt index c4f37d0..c34ac1c 100644 --- a/java/test/testfiles/JUnit-TestH5Pfapl.txt +++ b/java/test/testfiles/JUnit-TestH5Pfapl.txt @@ -28,6 +28,7 @@ JUnit version 4.11 .testH5Pset_elink_fapl .testH5P_hyper_vector_size .testH5P_gc_references +.testH5P_file_locking .testH5P_family_offset .testH5P_fapl_core .testH5P_fapl_muti @@ -37,5 +38,5 @@ JUnit version 4.11 Time: XXXX -OK (35 tests) +OK (36 tests) diff --git a/release_docs/INSTALL_CMake.txt b/release_docs/INSTALL_CMake.txt index 5442f6c..89cd9f8 100644 --- a/release_docs/INSTALL_CMake.txt +++ b/release_docs/INSTALL_CMake.txt @@ -624,6 +624,7 @@ The config/cmake/cacheinit.cmake file can override the following values. ---------------- General Build Options --------------------- BUILD_SHARED_LIBS "Build Shared Libraries" ON +BUILD_STATIC_LIBS "Build Static Libraries" ON BUILD_STATIC_EXECS "Build Static Executables" OFF BUILD_TESTING "Build HDF5 Unit Testing" ON @@ -636,6 +637,7 @@ HDF5_BUILD_HL_LIB "Build HIGH Level HDF5 Library" ON HDF5_BUILD_TOOLS "Build HDF5 Tools" ON ---------------- HDF5 Advanced Options --------------------- +ONLY_SHARED_LIBS "Only Build Shared Libraries" OFF ALLOW_UNSUPPORTED "Allow unsupported combinations of configure options" OFF HDF5_EXTERNAL_LIB_PREFIX "Use prefix for custom library naming." "" HDF5_DISABLE_COMPILER_WARNINGS "Disable compiler warnings" OFF @@ -676,6 +678,12 @@ if (CMAKE_BUILD_TYPE MATCHES Debug) HDF5_ENABLE_INSTRUMENT "Instrument The library" OFF if (HDF5_TEST_VFD) HDF5_TEST_FHEAP_VFD "Execute fheap test with different VFDs" ON +if (HDF5_BUILD_FORTRAN) + HDF5_INSTALL_MOD_FORTRAN "Copy FORTRAN mod files to include directory (NO SHARED STATIC)" "XX" + if (BUILD_SHARED_LIBS AND BUILD_STATIC_LIBS) default HDF5_INSTALL_MOD_FORTRAN is SHARED + if (BUILD_SHARED_LIBS AND NOT BUILD_STATIC_LIBS) default HDF5_INSTALL_MOD_FORTRAN is SHARED + if (NOT BUILD_SHARED_LIBS AND BUILD_STATIC_LIBS) default HDF5_INSTALL_MOD_FORTRAN is STATIC + if (NOT BUILD_SHARED_LIBS AND NOT BUILD_STATIC_LIBS) default HDF5_INSTALL_MOD_FORTRAN is SHARED ---------------- External Library Options --------------------- HDF5_ALLOW_EXTERNAL_SUPPORT "Allow External Library Building (NO GIT TGZ)" "NO" diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 102402e..dbf55a9 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -48,6 +48,31 @@ New Features Configuration: ------------- + - CMake option to link the generated Fortran MOD files into the include + directory. + + The Fortran generation of MOD files by a Fortran compile can produce + different binary files between SHARED and STATIC compiles with different + compilers and/or different platforms. Note that it has been found that + different versions of Fortran compilers will produce incompatible MOD + files. Currently, CMake will locate these MOD files in subfolders of + the include directory and add that path to the Fortran library target + in the CMake config file, which can be used by the CMake find library + process. For other build systems using the binary from a CMake install, + a new CMake configuration can be used to copy the pre-chosen version + of the Fortran MOD files into the install include directory. + + The default will depend on the configuration of + BUILD_STATIC_LIBS and BUILD_SHARED_LIBS: + YES YES Default to SHARED + YES NO Default to STATIC + NO YES Default to SHARED + NO NO Default to SHARED + The defaults can be overriden by setting the config option + HDF5_INSTALL_MOD_FORTRAN to one of NO, SHARED, or STATIC + + (ADB - 2020/07/9, HDFFV-11116) + - CMake option to use AEC (open source SZip) library instead of SZip The open source AEC library is a replacement library for SZip. In @@ -305,9 +330,92 @@ New Features (ADB - 2018/07/16) + - Add file locking configure and CMake options + + HDF5 1.10.0 introduced a file locking scheme, primarily to help + enforce SWMR setup. Formerly, the only user-level control of the scheme + was via the HDF5_USE_FILE_LOCKING environment variable. + + This change introduces configure-time options that control whether + or not file locking will be used and whether or not the library + ignores errors when locking has been disabled on the file system + (useful on some HPC Lustre installations). + + In both the Autotools and CMake, the settings have the effect of changing + the default property list settings (see the H5Pset/get_file_locking() + entry, below). + + The yes/no/best-effort file locking configure setting has also been + added to the libhdf5.settings file. + + Autotools: + + An --enable-file-locking=(yes|no|best-effort) option has been added. + + yes: Use file locking. + no: Do not use file locking. + best-effort: Use file locking and ignore "disabled" errors. + + CMake: + + Two self-explanatory options have been added: + + HDF5_USE_FILE_LOCKING + HDF5_IGNORE_DISABLED_FILE_LOCKS + + Setting both of these to ON is the equivalent to the Autotools' + best-effort setting. + + NOTE: + The precedence order of the various file locking control mechanisms is: + + 1) HDF5_USE_FILE_LOCKING environment variable (highest) + + 2) H5Pset_file_locking() + + 3) configure/CMake options (which set the property list defaults) + + 4) library defaults (currently best-effort) + + (DER - 2020/07/30, HDFFV-11092) + Library: -------- + - Remove HDFS VFD stubs + + The original implementation of the HDFS VFD included non-functional + versions of the following public API calls when the HDFS VFD is + not built as a part of the HDF5 library: + + * H5FD_hdfs_init() + * H5Pget_fapl_hdfs() + * H5Pset_fapl_hdfs() + + They will remain present in HDF5 1.10 and HDF5 1.12 releases + for binary compatibility purposes but have been removed as of 1.14.0. + + Note that this has nothing to do with the real HDFS VFD API calls + that are fully functional when the HDFS VFD is configured and built. + + We simply changed: + + #ifdef LIBHDFS + + #else + + #endif + + to: + + #ifdef LIBHDFS + + #endif + + Which is how the other optional VFDs are handled. + + (DER - 2020/08/27) + - Add Mirror VFD Use TCP/IP sockets to perform write-only (W/O) file I/O on a remote @@ -482,6 +590,32 @@ New Features (DER - 2020/03/18, HDFFV-11057) + - Add BEST_EFFORT value to HDF5_USE_FILE_LOCKING environment variable + + This change adds a BEST_EFFORT to the TRUE/FALSE, 1/0 settings that + were previously accepted. This option turns on file locking but + ignores locking errors when the library detects that file locking + has been disabled on a file system (useful on some HPC Lustre + installations). + + The capitalization of BEST_EFFORT is mandatory. + + See the configure option discussion for HDFFV-11092 (above) for more + information on the file locking feature and how it's controlled. + + (DER - 2020/07/30, HDFFV-11092) + + + - Add H5Pset/get_file_locking() API calls + + This change adds new API calls which can be used to set or get the + file locking parameters. The single API call sets both the "use file + locking" flag and the "ignore disabled file locking" flag. + + See the configure option discussion for HDFFV-11092 (above) for more + information on the file locking feature and how it's controlled. + + (DER - 2020/07/30, HDFFV-11092) Parallel Library: ----------------- @@ -512,11 +646,21 @@ New Features (MSB, 2019/01/08, HDFFV-10443) + - Add wrappers for H5Pset/get_file_locking() API calls + + h5pget_file_locking_f() + h5pset_file_locking_f() + + See the configure option discussion for HDFFV-11092 (above) for more + information on the file locking feature and how it's controlled. + + (DER - 2020/07/30, HDFFV-11092) + C++ Library: ------------ - Added new wrappers for H5Pset/get_create_intermediate_group() - LinkCreatPropList::setCreateIntermediateGroup() LinkCreatPropList::getCreateIntermediateGroup() + LinkCreatPropList::setCreateIntermediateGroup() (BMR - 2019/04/22, HDFFV-10622) @@ -525,6 +669,16 @@ New Features (BMR - 2019/02/14, HDFFV-10532) + - Add wrappers for H5Pset/get_file_locking() API calls + + FileAccPropList::setFileLocking() + FileAccPropList::getFileLocking() + + See the configure option discussion for HDFFV-11092 (above) for more + information on the file locking feature and how it's controlled. + + (DER - 2020/07/30, HDFFV-11092) + Java Library: ---------------- @@ -562,9 +716,34 @@ New Features (DER - 2018/12/08, HDFFV-10252) + - Add wrappers for H5Pset/get_file_locking() API calls + + H5Pset_file_locking() + H5Pget_use_file_locking() + H5Pget_ignore_disabled_file_locking() + + Unlike the C++ and Fortran wrappers, there are separate getters for the + two file locking settings, each of which returns a boolean value. + + See the configure option discussion for HDFFV-11092 (above) for more + information on the file locking feature and how it's controlled. + + (DER - 2020/07/30, HDFFV-11092) + Tools: ------ + - h5repack added options to control how external links are handled. + + Currently h5repack preserves external links and cannot copy and merge + data from the external files. Two options, merge and prune, were added to + control how to merge data from an external link into the resulting file. + --merge Follow external soft link recursively and merge data. + --prune Do not follow external soft links and remove link. + --merge --prune Follow external link, merge data and remove dangling link. + + (ADB - 2020/08/05, HDFFV-9984) + - h5repack was fixed to repack the reference attributes properly. The code line that checks if the update of reference inside a compound datatype is misplaced outside the code block loop that carries out the @@ -608,7 +787,7 @@ New Features High-Level APIs: --------------- - - + - C Packet Table API ------------------ @@ -631,6 +810,70 @@ Bug Fixes since HDF5-1.10.3 release Library ------- + - Creation of dataset with optional filter + + When the combination of type, space, etc doesn't work for filter + and the filter is optional, it was supposed to be skipped but it was + not skipped and the creation failed. + + Allowed the creation of the dataset in such situation. + + (BMR - 2020/8/13, HDFFV-10933) + + - Explicitly declared dlopen to use RTLD_LOCAL + + dlopen documentation states that if neither RTLD_GLOBAL nor + RTLD_LOCAL are specified, then the default behavior is unspecified. + The default on linux is usually RTLD_LOCAL while macos will default + to RTLD_GLOBAL. + + (ADB - 2020/08/12, HDFFV-11127) + + - Fixed issues CVE-2018-13870 and CVE-2018-13869 + + When a buffer overflow occurred because a name length was corrupted + and became very large, h5dump crashed on memory access violation. + + A check for reading pass the end of the buffer was added to multiple + locations to prevent the crashes and h5dump now simply fails with an + error message when this error condition occurs. + + (BMR - 2020/07/22, HDFFV-11120 and HDFFV-11121) + + - Fixed the segmentation fault when reading attributes with multiple threads + + It was reported that the reading of attributes with variable length string + datatype will crash with segmentation fault particularly when the number of + threads is high (>16 threads). The problem was due to the file pointer that + was set in the variable length string datatype for the attribute. That file + pointer was already closed when the attribute was accessed. + + The problem was fixed by setting the file pointer to the current opened file pointer + when the attribute was accessed. Similar patch up was done before when reading + dataset with variable length string datatype. + + (VC - 2020/07/13, HDFFV-11080) + + - Fixed CVE-2020-10810 + + The tool h5clear produced a segfault during an error recovery in + the superblock decoding. An internal pointer was reset to prevent + further accessing when it is not assigned with a value. + + (BMR - 2020/6/29, HDFFV-11053) + + - Fixed CVE-2018-17435 + + The tool h52gif produced a segfault when the size of an attribute + message was corrupted and caused a buffer overflow. + + The problem was fixed by verifying the attribute message's size + against the buffer size before accessing the buffer. h52gif was + also fixed to display the failure instead of silently exiting + after the segfault was eliminated. + + (BMR - 2020/6/19, HDFFV-10591) + - Improved peformance when creating a large number of small datasets by retrieving default property values from the API context instead of doing skip list searches. @@ -892,6 +1135,21 @@ Bug Fixes since HDF5-1.10.3 release (DER - 2019/12/09, HDFFV-10945) + - H5Sset_extent_none() sets the dataspace class to H5S_NO_CLASS which + causes asserts/errors when passed to other dataspace API calls. + + H5S_NO_CLASS is an internal class value that should not have been + exposed via a public API call. + + In debug builds of the library, this can cause asserts to trip. In + non-debug builds, it will produce normal library errors. + + The new library behavior is for H5Sset_extent_none() to convert + the dataspace into one of type H5S_NULL, which is better handled + by the library and easier for developers to reason about. + + (DER - 2020/07/27, HDFFV-11027) + Java Library: ---------------- @@ -969,11 +1227,51 @@ Bug Fixes since HDF5-1.10.3 release Tools ----- - - + - The tools library was updated by standardizing the error stack process. + + General sequence is: + h5tools_setprogname(PROGRAMNAME); + h5tools_setstatus(EXIT_SUCCESS); + h5tools_init(); + ... process the command-line (check for error-stack enable) ... + h5tools_error_report(); + ... (do work) ... + h5diff_exit(ret); + + (ADB - 2020/07/20, HDFFV-11066) + + - h5diff fixed a command line parsing error. + + h5diff would ignore the argument to -d (delta) if it is smaller than DBL_EPSILON. + The macro H5_DBL_ABS_EQUAL was removed and a direct value comparision was used. + + (ADB - 2020/07/20, HDFFV-10897) + + - h5diff added a command line option to ignore attributes. + + h5diff would ignore all objects with a supplied path if the exclude-path argument is used. + Adding the exclude-attribute argument will only eclude attributes, with the supplied path, + from comparision. + + (ADB - 2020/07/20, HDFFV-5935) + + - h5diff added another level to the verbose argument to print filenames. + + Added verbose level 3 that is level 2 plus the filenames. The levels are: + 0 : Identical to '-v' or '--verbose' + 1 : All level 0 information plus one-line attribute status summary + 2 : All level 1 information plus extended attribute status report + 3 : All level 2 information plus file names + + (ADB - 2020/07/20, HDFFV-10005) High-Level APIs: ------ - - + - The H5DSis_scale function was updated to return "not a dimension scale" (0) + instead of failing (-1), when CLASS or DIMENSION_SCALE attributes are + not written according to Dimension Scales Specification. + + (EIP - 2020/08/12, HDFFV-10436) Fortran High-Level APIs: ------ @@ -993,6 +1291,14 @@ Bug Fixes since HDF5-1.10.3 release Testing ------- + - Stopped java/test/junit.sh.in installing libs for testing under ${prefix} + + Lib files needed are now copied to a subdirectory in the java/test + directory, and on Macs the loader path for libhdf5.xxxs.so is changed + in the temporary copy of libhdf5_java.dylib. + + (LRK, 2020/7/2, HDFFV-11063) + - Fixed a test failure in testpar/t_dset.c caused by the test trying to use the parallel filters feature on MPI-2 implementations. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c5f6316..dc97db3 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -846,6 +846,7 @@ set (H5_PRIVATE_HEADERS ${HDF5_SRC_DIR}/H5FApkg.h ${HDF5_SRC_DIR}/H5FAprivate.h + ${HDF5_SRC_DIR}/H5FDmirror_priv.h ${HDF5_SRC_DIR}/H5FDpkg.h ${HDF5_SRC_DIR}/H5FDprivate.h @@ -1146,7 +1147,7 @@ if (NOT ONLY_SHARED_LIBS) add_library (${HDF5_LIB_TARGET} STATIC ${common_SRCS} ${gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS}) target_include_directories (${HDF5_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" - INTERFACE "$/include>" + INTERFACE "$/include>;$" ) target_compile_options(${HDF5_LIB_TARGET} PRIVATE "${HDF5_CMAKE_C_FLAGS}") target_compile_definitions(${HDF5_LIB_TARGET} @@ -1183,7 +1184,7 @@ if (BUILD_SHARED_LIBS) target_include_directories (${HDF5_LIBSH_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" PUBLIC "$<$:${HDFS_INCLUDE_DIR}>" - INTERFACE "$/include>" + INTERFACE "$/include>;$" ) target_compile_options(${HDF5_LIBSH_TARGET} PRIVATE "${HDF5_CMAKE_C_FLAGS}") target_compile_definitions(${HDF5_LIBSH_TARGET} diff --git a/src/H5.c b/src/H5.c index bd78ca2..4e5648a 100644 --- a/src/H5.c +++ b/src/H5.c @@ -50,9 +50,9 @@ /********************/ /* Local Prototypes */ /********************/ -static void H5_debug_mask(const char*); +static void H5__debug_mask(const char*); #ifdef H5_HAVE_PARALLEL -static int H5_mpi_delete_cb(MPI_Comm comm, int keyval, void *attr_val, int *flag); +static int H5__mpi_delete_cb(MPI_Comm comm, int keyval, void *attr_val, int *flag); #endif /*H5_HAVE_PARALLEL*/ /*********************/ @@ -139,7 +139,7 @@ H5_init_library(void) int key_val; if(MPI_SUCCESS != (mpi_code = MPI_Comm_create_keyval(MPI_COMM_NULL_COPY_FN, - (MPI_Comm_delete_attr_function *)H5_mpi_delete_cb, + (MPI_Comm_delete_attr_function *)H5__mpi_delete_cb, &key_val, NULL))) HMPI_GOTO_ERROR(FAIL, "MPI_Comm_create_keyval failed", mpi_code) @@ -219,10 +219,6 @@ H5_init_library(void) HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize vol interface") if(H5P_init() < 0) HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize property list interface") - if(H5T_init() < 0) - HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize datatype interface") - if(H5D_init() < 0) - HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize dataset interface") if(H5AC_init() < 0) HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize metadata caching interface") if(H5L_init() < 0) @@ -235,8 +231,8 @@ H5_init_library(void) HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize vol interface") /* Debugging? */ - H5_debug_mask("-all"); - H5_debug_mask(HDgetenv("HDF5_DEBUG")); + H5__debug_mask("-all"); + H5__debug_mask(HDgetenv("HDF5_DEBUG")); done: FUNC_LEAVE_NOAPI(ret_value) @@ -639,7 +635,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5_debug_mask + * Function: H5__debug_mask * * Purpose: Set runtime debugging flags according to the string S. The * string should contain file numbers and package names @@ -662,7 +658,7 @@ done: *------------------------------------------------------------------------- */ static void -H5_debug_mask(const char *s) +H5__debug_mask(const char *s) { FILE *stream = stderr; char pkg_name[32], *rest; @@ -738,12 +734,12 @@ H5_debug_mask(const char *s) return; -} /* end H5_debug_mask() */ +} /* end H5__debug_mask() */ #ifdef H5_HAVE_PARALLEL /*------------------------------------------------------------------------- - * Function: H5_mpi_delete_cb + * Function: H5__mpi_delete_cb * * Purpose: Callback attribute on MPI_COMM_SELF to terminate the HDF5 * library when the communicator is destroyed, i.e. on MPI_Finalize. @@ -752,7 +748,7 @@ H5_debug_mask(const char *s) * *------------------------------------------------------------------------- */ -static int H5_mpi_delete_cb(MPI_Comm H5_ATTR_UNUSED comm, int H5_ATTR_UNUSED keyval, void H5_ATTR_UNUSED *attr_val, int H5_ATTR_UNUSED *flag) +static int H5__mpi_delete_cb(MPI_Comm H5_ATTR_UNUSED comm, int H5_ATTR_UNUSED keyval, void H5_ATTR_UNUSED *attr_val, int H5_ATTR_UNUSED *flag) { H5_term_library(); return MPI_SUCCESS; @@ -938,11 +934,13 @@ H5open(void) { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_API_NOCLEAR(FAIL) - H5TRACE0("e",""); + FUNC_ENTER_API_NOPUSH(FAIL) + /*NO TRACE*/ + /* all work is done by FUNC_ENTER() */ + done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOPUSH(ret_value) } /* end H5open() */ diff --git a/src/H5A.c b/src/H5A.c index 2986466..19c2e77 100644 --- a/src/H5A.c +++ b/src/H5A.c @@ -313,7 +313,7 @@ H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id, /* Register the new attribute and get an ID for it */ if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") + HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register attribute for ID") done: /* Cleanup on failure */ @@ -403,7 +403,7 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, /* Register the new attribute and get an ID for it */ if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") + HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register attribute for ID") done: /* Cleanup on failure */ @@ -471,7 +471,7 @@ H5Aopen(hid_t loc_id, const char *attr_name, hid_t aapl_id) /* Register the attribute and get an ID for it */ if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") + HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register attribute for ID") done: /* Cleanup on failure */ @@ -1028,7 +1028,7 @@ H5Aget_info(hid_t attr_id, H5A_info_t *ainfo) FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*x", attr_id, ainfo); - /* Check arguments */ + /* Check args */ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(attr_id, H5I_ATTR))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute") if(!ainfo) @@ -1170,7 +1170,8 @@ done: * * Purpose: Rename an attribute * - * Return: SUCCEED/FAIL + * Return: Success: Non-negative + * Failure: Negative * * Programmer: Raymond Lu * October 23, 2002 @@ -1185,7 +1186,7 @@ H5Arename(hid_t loc_id, const char *old_name, const char *new_name) FUNC_ENTER_API(FAIL) H5TRACE3("e", "i*s*s", loc_id, old_name, new_name); - /* check arguments */ + /* Check arguments */ if(H5I_ATTR == H5I_get_type(loc_id)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") if(!old_name) @@ -1205,7 +1206,6 @@ H5Arename(hid_t loc_id, const char *old_name, const char *new_name) loc_params.type = H5VL_OBJECT_BY_SELF; loc_params.obj_type = H5I_get_type(loc_id); - /* Get the location object */ if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") @@ -1228,7 +1228,8 @@ done: * * Purpose: Rename an attribute * - * Return: SUCCEED/FAIL + * Return: Success: Non-negative + * Failure: Negative * * Programmer: Quincey Koziol * February 20, 2007 @@ -1330,7 +1331,7 @@ H5Aiterate2(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, { H5VL_object_t *vol_obj = NULL; /* object of loc_id */ H5VL_loc_params_t loc_params; - herr_t ret_value; /* Return value */ + herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE6("e", "iIiIo*hx*x", loc_id, idx_type, order, idx, op, op_data); @@ -1407,15 +1408,15 @@ H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx, H5A_operator2_t op, void *op_data, hid_t lapl_id) { - H5VL_object_t *vol_obj = NULL; /* object of loc_id */ + H5VL_object_t *vol_obj = NULL; /* Object location */ H5VL_loc_params_t loc_params; - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE8("e", "i*sIiIo*hx*xi", loc_id, obj_name, idx_type, order, idx, op, op_data, lapl_id); - /* check arguments */ + /* Check arguments */ if(H5I_ATTR == H5I_get_type(loc_id)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") if(!obj_name || !*obj_name) @@ -1466,7 +1467,7 @@ H5Adelete(hid_t loc_id, const char *name) { H5VL_object_t *vol_obj = NULL; H5VL_loc_params_t loc_params; - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*s", loc_id, name); @@ -1522,7 +1523,7 @@ H5Adelete_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, { H5VL_object_t *vol_obj; H5VL_loc_params_t loc_params; - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE4("e", "i*s*si", loc_id, obj_name, attr_name, lapl_id); @@ -1588,7 +1589,7 @@ H5Adelete_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, { H5VL_object_t *vol_obj; H5VL_loc_params_t loc_params; - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE6("e", "i*sIiIohi", loc_id, obj_name, idx_type, order, n, lapl_id); @@ -1619,7 +1620,7 @@ H5Adelete_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") - /* Delete the attribute through the VOL */ + /* Delete the attribute */ if(H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, NULL) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") @@ -1679,7 +1680,7 @@ H5Aexists(hid_t obj_id, const char *attr_name) { H5VL_object_t *vol_obj; H5VL_loc_params_t loc_params; - htri_t ret_value; /* Return value */ + htri_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("t", "i*s", obj_id, attr_name); @@ -1725,7 +1726,7 @@ H5Aexists_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, { H5VL_object_t *vol_obj; H5VL_loc_params_t loc_params; - htri_t ret_value; /* Return value */ + htri_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE4("t", "i*s*si", loc_id, obj_name, attr_name, lapl_id); diff --git a/src/H5AC.c b/src/H5AC.c index f8805b3..0f5d3a3 100644 --- a/src/H5AC.c +++ b/src/H5AC.c @@ -15,7 +15,7 @@ * * Created: H5AC.c * Jul 9 1997 - * Robb Matzke + * Robb Matzke * * Purpose: Functions in this file implement a cache for * things which exist on disk. All "things" associated @@ -138,10 +138,10 @@ static const H5AC_class_t *const H5AC_class_s[] = { /*------------------------------------------------------------------------- * Function: H5AC_init * - * Purpose: Initialize the interface from some other layer. + * Purpose: Initialize the interface from some other layer. * - * Return: Success: non-negative - * Failure: negative + * Return: Success: non-negative + * Failure: negative * * Programmer: Quincey Koziol * Saturday, January 18, 2003 @@ -162,7 +162,7 @@ done: /*------------------------------------------------------------------------- - * Function H5AC__init_package + * Function: H5AC__init_package * * Purpose: Initialize interface-specific information * @@ -202,9 +202,9 @@ H5AC__init_package(void) * * Purpose: Terminate this interface. * - * Return: Success: Positive if anything was done that might - * affect other interfaces; zero otherwise. - * Failure: Negative. + * Return: Success: Positive if anything was done that might + * affect other interfaces; zero otherwise. + * Failure: Negative. * * Programmer: Quincey Koziol * Thursday, July 18, 2002 @@ -239,8 +239,6 @@ H5AC_term_package(void) * * Programmer: John Mainzer, 1/10/17 * - * Changes: None. - * *------------------------------------------------------------------------- */ hbool_t @@ -275,7 +273,6 @@ H5AC_cache_image_pending(const H5F_t *f) * Failure: Negative * * Programmer: Robb Matzke - * matzke@llnl.gov * Jul 9 1997 * *------------------------------------------------------------------------- @@ -284,7 +281,7 @@ herr_t H5AC_create(const H5F_t *f, H5AC_cache_config_t *config_ptr, H5AC_cache_image_config_t * image_config_ptr) { #ifdef H5_HAVE_PARALLEL - char prefix[H5C__PREFIX_LEN] = ""; + char prefix[H5C__PREFIX_LEN] = ""; H5AC_aux_t * aux_ptr = NULL; #endif /* H5_HAVE_PARALLEL */ struct H5C_cache_image_ctl_t int_ci_config = H5C__DEFAULT_CACHE_IMAGE_CTL; @@ -469,9 +466,16 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Jul 9 1997 * + * Changes: + * + * In the parallel case, added code to setup the MDC slist + * before the call to H5AC__flush_entries() and take it down + * afterwards. + * + * JRM -- 7/29/20 + * *------------------------------------------------------------------------- */ herr_t @@ -497,58 +501,115 @@ H5AC_dest(H5F_t *f) #endif /* H5AC_DUMP_STATS_ON_CLOSE */ /* Check if log messages are being emitted */ - if(H5C_get_logging_status(f->shared->cache, &log_enabled, &curr_logging) < 0) + if(H5C_get_logging_status(f->shared->cache, + &log_enabled, &curr_logging) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to get logging status") - if(log_enabled && curr_logging) + if(log_enabled && curr_logging) { + if(H5C_log_write_destroy_cache_msg(f->shared->cache) < 0) - HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + + HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, \ + "unable to emit log message") + } + /* Tear down logging */ - if(log_enabled) + if(log_enabled) { + if(H5C_log_tear_down(f->shared->cache) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "mdc logging tear-down failed") + + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, \ + "mdc logging tear-down failed") + } #ifdef H5_HAVE_PARALLEL + /* destroying the cache, so clear all collective entries */ if(H5C_clear_coll_entries(f->shared->cache, FALSE) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5C_clear_coll_entries() failed") + + HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, \ + "H5C_clear_coll_entries() failed") aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(f->shared->cache); - if(aux_ptr) + + if(aux_ptr) { + /* Sanity check */ HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); + + + /* If the file was opened R/W, attempt to flush all entries + * from rank 0 & Bcast clean list to other ranks. + * + * Must not flush in the R/O case, as this will trigger the + * free space manager settle routines. + * + * Must also enable the skip list before the call to + * H5AC__flush_entries() and disable it afterwards, as the + * skip list will be disabled after the previous flush. + * + * Note that H5C_dest() does slist setup and take down as well. + * Unfortunately, we can't do the setup and take down just once, + * as H5C_dest() is called directly in the test code. + * + * Fortunately, the cache should be clean or close to it at this + * point, so the overhead should be minimal. + */ + if(H5F_ACC_RDWR & H5F_INTENT(f)) { - /* If the file was opened R/W, attempt to flush all entries - * from rank 0 & Bcast clean list to other ranks. - * - * Must not flush in the R/O case, as this will trigger the - * free space manager settle routines. - */ - if(H5F_ACC_RDWR & H5F_INTENT(f)) - if(H5AC__flush_entries(f) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush") + /* enable and load the slist */ + if ( H5C_set_slist_enabled(f->shared->cache, TRUE, FALSE) < 0 ) + + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "set slist enabled failed") + + if(H5AC__flush_entries(f) < 0) + + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush") + + /* disable the slist -- should be empty */ + if ( H5C_set_slist_enabled(f->shared->cache, FALSE, FALSE) < 0 ) + + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "disable slist failed") + } + } #endif /* H5_HAVE_PARALLEL */ /* Destroy the cache */ if(H5C_dest(f) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, "can't destroy cache") + f->shared->cache = NULL; #ifdef H5_HAVE_PARALLEL + if(aux_ptr != NULL) { + if(aux_ptr->d_slist_ptr != NULL) { + HDassert(H5SL_count(aux_ptr->d_slist_ptr) == 0); H5SL_close(aux_ptr->d_slist_ptr); + } /* end if */ + if(aux_ptr->c_slist_ptr != NULL) { + HDassert(H5SL_count(aux_ptr->c_slist_ptr) == 0); H5SL_close(aux_ptr->c_slist_ptr); + } /* end if */ + if(aux_ptr->candidate_slist_ptr != NULL) { + HDassert(H5SL_count(aux_ptr->candidate_slist_ptr) == 0); H5SL_close(aux_ptr->candidate_slist_ptr); + } /* end if */ + aux_ptr->magic = 0; aux_ptr = H5FL_FREE(H5AC_aux_t, aux_ptr); + } /* end if */ #endif /* H5_HAVE_PARALLEL */ @@ -587,7 +648,6 @@ H5AC_evict(H5F_t *f) HGOTO_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, "can't evict cache") done: - /* If currently logging, generate a message */ if(f->shared->cache->log_info->logging) if(H5C_log_write_evict_cache_msg(f->shared->cache, ret_value) < 0) @@ -655,7 +715,6 @@ done: * request to flush all items and something was protected. * * Programmer: Robb Matzke - * matzke@llnl.gov * Jul 9 1997 * *------------------------------------------------------------------------- @@ -742,20 +801,20 @@ H5AC_get_entry_status(const H5F_t *f, haddr_t addr, unsigned *status) if(in_cache) { *status |= H5AC_ES__IN_CACHE; - if(is_dirty) - *status |= H5AC_ES__IS_DIRTY; - if(is_protected) - *status |= H5AC_ES__IS_PROTECTED; - if(is_pinned) - *status |= H5AC_ES__IS_PINNED; - if(is_corked) - *status |= H5AC_ES__IS_CORKED; - if(is_flush_dep_parent) - *status |= H5AC_ES__IS_FLUSH_DEP_PARENT; - if(is_flush_dep_child) - *status |= H5AC_ES__IS_FLUSH_DEP_CHILD; - if(image_is_up_to_date) - *status |= H5AC_ES__IMAGE_IS_UP_TO_DATE; + if(is_dirty) + *status |= H5AC_ES__IS_DIRTY; + if(is_protected) + *status |= H5AC_ES__IS_PROTECTED; + if(is_pinned) + *status |= H5AC_ES__IS_PINNED; + if(is_corked) + *status |= H5AC_ES__IS_CORKED; + if(is_flush_dep_parent) + *status |= H5AC_ES__IS_FLUSH_DEP_PARENT; + if(is_flush_dep_child) + *status |= H5AC_ES__IS_FLUSH_DEP_CHILD; + if(image_is_up_to_date) + *status |= H5AC_ES__IMAGE_IS_UP_TO_DATE; } /* end if */ else *status = 0; @@ -775,7 +834,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Jul 9 1997 * *------------------------------------------------------------------------- @@ -918,9 +976,10 @@ H5AC_mark_entry_dirty(void *thing) done: /* If currently logging, generate a message */ - if(cache_ptr->log_info->logging) - if(H5C_log_write_mark_entry_dirty_msg(cache_ptr, entry_ptr, ret_value) < 0) - HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + if(cache_ptr != NULL && cache_ptr->log_info != NULL) + if(cache_ptr->log_info->logging) + if(H5C_log_write_mark_entry_dirty_msg(cache_ptr, entry_ptr, ret_value) < 0) + HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") FUNC_LEAVE_NOAPI(ret_value) } /* H5AC_mark_entry_dirty() */ @@ -971,9 +1030,10 @@ H5AC_mark_entry_clean(void *thing) done: /* If currently logging, generate a message */ - if(cache_ptr->log_info->logging) - if(H5C_log_write_mark_entry_clean_msg(cache_ptr, entry_ptr, ret_value) < 0) - HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + if(cache_ptr != NULL && cache_ptr->log_info != NULL) + if(cache_ptr->log_info->logging) + if(H5C_log_write_mark_entry_clean_msg(cache_ptr, entry_ptr, ret_value) < 0) + HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") FUNC_LEAVE_NOAPI(ret_value) } /* H5AC_mark_entry_clean() */ @@ -1013,9 +1073,10 @@ H5AC_mark_entry_unserialized(void *thing) done: /* If currently logging, generate a message */ - if(cache_ptr->log_info->logging) - if(H5C_log_write_mark_unserialized_entry_msg(cache_ptr, entry_ptr, ret_value) < 0) - HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + if(cache_ptr != NULL && cache_ptr->log_info != NULL) + if(cache_ptr->log_info->logging) + if(H5C_log_write_mark_unserialized_entry_msg(cache_ptr, entry_ptr, ret_value) < 0) + HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") FUNC_LEAVE_NOAPI(ret_value) } /* H5AC_mark_entry_unserialized() */ @@ -1054,9 +1115,10 @@ H5AC_mark_entry_serialized(void *thing) done: /* If currently logging, generate a message */ - if(cache_ptr->log_info->logging) - if(H5C_log_write_mark_serialized_entry_msg(cache_ptr, entry_ptr, ret_value) < 0) - HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + if(cache_ptr != NULL && cache_ptr->log_info != NULL) + if(cache_ptr->log_info->logging) + if(H5C_log_write_mark_serialized_entry_msg(cache_ptr, entry_ptr, ret_value) < 0) + HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") FUNC_LEAVE_NOAPI(ret_value) } /* H5AC_mark_entry_serialized() */ @@ -1071,7 +1133,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Jul 9 1997 * *------------------------------------------------------------------------- @@ -1156,9 +1217,10 @@ H5AC_pin_protected_entry(void *thing) done: /* If currently logging, generate a message */ - if(cache_ptr->log_info->logging) - if(H5C_log_write_pin_entry_msg(cache_ptr, entry_ptr, ret_value) < 0) - HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + if(cache_ptr != NULL && cache_ptr->log_info != NULL) + if(cache_ptr->log_info->logging) + if(H5C_log_write_pin_entry_msg(cache_ptr, entry_ptr, ret_value) < 0) + HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") FUNC_LEAVE_NOAPI(ret_value) } /* H5AC_pin_protected_entry() */ @@ -1203,6 +1265,109 @@ done: /*------------------------------------------------------------------------- + * + * Function: H5AC_prep_for_file_flush + * + * Purpose: This function should be called just prior to the first + * call to H5AC_flush() during a file flush. + * + * Its purpose is to handly any setup required prior to + * metadata cache flush. + * + * Initially, this means setting up the slist prior to the + * flush. We do this in a seperate call because + * H5F__flush_phase2() make repeated calls to H5AC_flush(). + * Handling this detail in separate calls allows us to avoid + * the overhead of setting up and taking down the skip list + * repeatedly. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: John Mainzer + * 5/5/20 + * + * Changes: None. + * + *------------------------------------------------------------------------- + */ +herr_t +H5AC_prep_for_file_flush(H5F_t *f) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(f); + HDassert(f->shared); + HDassert(f->shared->cache); + + if ( H5C_set_slist_enabled(f->shared->cache, TRUE, FALSE) < 0) + + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "slist enabled failed") + +done: + + FUNC_LEAVE_NOAPI(ret_value) + +} /* H5AC_prep_for_file_flush() */ + + +/*------------------------------------------------------------------------- + * + * Function: H5AC_secure_from_file_flush + * + * Purpose: This function should be called just after the last + * call to H5AC_flush() during a file flush. + * + * Its purpose is to perform any necessary cleanup after the + * metadata cache flush. + * + * The objective of the call is to allow the metadata cache + * to do any necessary necessary cleanup work after a cache + * flush. + * + * Initially, this means taking down the slist after the + * flush. We do this in a seperate call because + * H5F__flush_phase2() make repeated calls to H5AC_flush(). + * Handling this detail in separate calls allows us to avoid + * the overhead of setting up and taking down the skip list + * repeatedly. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: John Mainzer + * 5/5/20 + * + * Changes: None. + * + *------------------------------------------------------------------------- + */ +herr_t +H5AC_secure_from_file_flush(H5F_t *f) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(f); + HDassert(f->shared); + HDassert(f->shared->cache); + + if ( H5C_set_slist_enabled(f->shared->cache, FALSE, FALSE) < 0) + + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "slist enabled failed") + +done: + + FUNC_LEAVE_NOAPI(ret_value) + +} /* H5AC_secure_from_file_flush() */ + + +/*------------------------------------------------------------------------- + * * Function: H5AC_create_flush_dependency() * * Purpose: Create a flush dependency between two entries in the metadata @@ -1238,9 +1403,10 @@ H5AC_create_flush_dependency(void * parent_thing, void * child_thing) done: /* If currently logging, generate a message */ - if(cache_ptr->log_info->logging) - if(H5C_log_write_create_fd_msg(cache_ptr, (H5AC_info_t *)parent_thing, (H5AC_info_t *)child_thing, ret_value) < 0) - HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + if(cache_ptr != NULL && cache_ptr->log_info != NULL) + if(cache_ptr->log_info->logging) + if(H5C_log_write_create_fd_msg(cache_ptr, (H5AC_info_t *)parent_thing, (H5AC_info_t *)child_thing, ret_value) < 0) + HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") FUNC_LEAVE_NOAPI(ret_value) } /* H5AC_create_flush_dependency() */ @@ -1265,7 +1431,6 @@ done: * Failure: NULL * * Programmer: Robb Matzke - * matzke@llnl.gov * Sep 2 1997 * *------------------------------------------------------------------------- @@ -1373,9 +1538,10 @@ H5AC_resize_entry(void *thing, size_t new_size) done: /* If currently logging, generate a message */ - if(cache_ptr->log_info->logging) - if(H5C_log_write_resize_entry_msg(cache_ptr, entry_ptr, new_size, ret_value) < 0) - HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + if(cache_ptr != NULL && cache_ptr->log_info != NULL) + if(cache_ptr->log_info->logging) + if(H5C_log_write_resize_entry_msg(cache_ptr, entry_ptr, new_size, ret_value) < 0) + HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") FUNC_LEAVE_NOAPI(ret_value) } /* H5AC_resize_entry() */ @@ -1416,9 +1582,10 @@ H5AC_unpin_entry(void *thing) done: /* If currently logging, generate a message */ - if(cache_ptr->log_info->logging) - if(H5C_log_write_unpin_entry_msg(cache_ptr, entry_ptr, ret_value) < 0) - HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + if(cache_ptr != NULL && cache_ptr->log_info != NULL) + if(cache_ptr->log_info->logging) + if(H5C_log_write_unpin_entry_msg(cache_ptr, entry_ptr, ret_value) < 0) + HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") FUNC_LEAVE_NOAPI(ret_value) } /* H5AC_unpin_entry() */ @@ -1459,9 +1626,10 @@ H5AC_destroy_flush_dependency(void * parent_thing, void * child_thing) done: /* If currently logging, generate a message */ - if(cache_ptr->log_info->logging) - if(H5C_log_write_destroy_fd_msg(cache_ptr, (H5AC_info_t *)parent_thing, (H5AC_info_t *)child_thing, ret_value) < 0) - HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + if(cache_ptr != NULL && cache_ptr->log_info != NULL) + if(cache_ptr->log_info->logging) + if(H5C_log_write_destroy_fd_msg(cache_ptr, (H5AC_info_t *)parent_thing, (H5AC_info_t *)child_thing, ret_value) < 0) + HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") FUNC_LEAVE_NOAPI(ret_value) } /* H5AC_destroy_flush_dependency() */ @@ -1500,7 +1668,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Sep 2 1997 * *------------------------------------------------------------------------- @@ -1509,8 +1676,8 @@ herr_t H5AC_unprotect(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *thing, unsigned flags) { - hbool_t dirtied; - hbool_t deleted; + hbool_t dirtied; + hbool_t deleted; #ifdef H5_HAVE_PARALLEL H5AC_aux_t * aux_ptr = NULL; #endif /* H5_HAVE_PARALLEL */ @@ -1527,18 +1694,18 @@ H5AC_unprotect(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *thing, HDassert(type->image_len); HDassert(H5F_addr_defined(addr)); HDassert(thing); - HDassert( ((H5AC_info_t *)thing)->addr == addr ); - HDassert( ((H5AC_info_t *)thing)->type == type ); + HDassert(((H5AC_info_t *)thing)->addr == addr); + HDassert(((H5AC_info_t *)thing)->type == type); dirtied = (hbool_t)(((flags & H5AC__DIRTIED_FLAG) == H5AC__DIRTIED_FLAG) || - (((H5AC_info_t *)thing)->dirtied)); + (((H5AC_info_t *)thing)->dirtied)); deleted = (hbool_t)((flags & H5C__DELETED_FLAG) == H5C__DELETED_FLAG); /* Check if the size changed out from underneath us, if we're not deleting * the entry. */ if(dirtied && !deleted) { - size_t curr_size = 0; + size_t curr_size = 0; if((type->image_len)(thing, &curr_size) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTGETSIZE, FAIL, "Can't get size of thing") @@ -1625,7 +1792,7 @@ H5AC_get_cache_auto_resize_config(const H5AC_t *cache_ptr, if(internal_config.rpt_fcn == NULL) config_ptr->rpt_fcn_enabled = FALSE; else - config_ptr->rpt_fcn_enabled = TRUE; + config_ptr->rpt_fcn_enabled = TRUE; config_ptr->open_trace_file = FALSE; config_ptr->close_trace_file = FALSE; config_ptr->trace_file_name[0] = '\0'; @@ -1914,7 +2081,7 @@ H5AC_validate_config(H5AC_cache_config_t *config_ptr) /* don't bother to test trace_file_name unless open_trace_file is TRUE */ if(config_ptr->open_trace_file) { - size_t name_len; + size_t name_len; /* Can't really test the trace_file_name field without trying to * open the file, so we will content ourselves with a couple of @@ -2035,9 +2202,9 @@ H5_ATTR_UNUSED *f, hbool_t *write_permitted_ptr) { #ifdef H5_HAVE_PARALLEL - H5AC_aux_t * aux_ptr = NULL; + H5AC_aux_t * aux_ptr = NULL; #endif /* H5_HAVE_PARALLEL */ - hbool_t write_permitted = TRUE; + hbool_t write_permitted = TRUE; FUNC_ENTER_STATIC_NOERR @@ -2534,8 +2701,8 @@ H5AC_set_ring(H5AC_ring_t ring, H5AC_ring_t *orig_ring) * Note that this function simply passes the call on to * the metadata cache proper, and returns the result. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * * Programmer: Quincey Koziol * September 17, 2016 @@ -2637,9 +2804,10 @@ H5AC_remove_entry(void *_entry) done: /* If currently logging, generate a message */ - if(cache->log_info->logging) - if(H5C_log_write_remove_entry_msg(cache, entry, ret_value) < 0) - HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + if(cache != NULL && cache->log_info != NULL) + if(cache->log_info->logging) + if(H5C_log_write_remove_entry_msg(cache, entry, ret_value) < 0) + HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") FUNC_LEAVE_NOAPI(ret_value) } /* H5AC_remove_entry() */ @@ -2669,4 +2837,3 @@ H5AC_get_mdc_image_info(H5AC_t *cache_ptr, haddr_t *image_addr, hsize_t *image_l done: FUNC_LEAVE_NOAPI(ret_value) } /* H5AC_get_mdc_image_info() */ - diff --git a/src/H5ACdbg.c b/src/H5ACdbg.c index b40f8d0..94f3d83 100644 --- a/src/H5ACdbg.c +++ b/src/H5ACdbg.c @@ -270,10 +270,6 @@ H5AC_flush_dependency_exists(H5F_t *f, haddr_t parent_addr, haddr_t child_addr, * * Programmer: John Mainzer, 5/30/14 * - * Changes: None. - * - * JRM -- 9/17/16 - * *------------------------------------------------------------------------- */ #ifndef NDEBUG @@ -351,8 +347,6 @@ H5AC_get_serialization_in_progress(H5F_t *f) * * Programmer: John Mainzer, 6/18/16 * - * Changes: None. - * *------------------------------------------------------------------------- */ #ifndef NDEBUG diff --git a/src/H5ACmodule.h b/src/H5ACmodule.h index e218b31..8c6eae2 100644 --- a/src/H5ACmodule.h +++ b/src/H5ACmodule.h @@ -11,7 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, September 12, 2015 * * Purpose: This file contains declarations which define macros for the diff --git a/src/H5ACmpio.c b/src/H5ACmpio.c index f097e83..7474460 100644 --- a/src/H5ACmpio.c +++ b/src/H5ACmpio.c @@ -15,7 +15,7 @@ * * Created: H5ACmpio.c * Jun 20 2015 - * Quincey Koziol + * Quincey Koziol * * Purpose: Functions in this file implement support for parallel * I/O cache functionality @@ -791,7 +791,7 @@ H5AC__log_dirtied_entry(const H5AC_info_t *entry_ptr) else { aux_ptr->dirty_bytes += entry_ptr->size; #if H5AC_DEBUG_DIRTY_BYTES_CREATION - aux_ptr->unprotect_dirty_bytes += entry_size; + aux_ptr->unprotect_dirty_bytes += entry_ptr->size; aux_ptr->unprotect_dirty_bytes_updates += 1; #endif /* H5AC_DEBUG_DIRTY_BYTES_CREATION */ } /* end else */ @@ -989,7 +989,7 @@ H5AC__log_inserted_entry(const H5AC_info_t *entry_ptr) aux_ptr->dirty_bytes += entry_ptr->size; #if H5AC_DEBUG_DIRTY_BYTES_CREATION - aux_ptr->insert_dirty_bytes += size; + aux_ptr->insert_dirty_bytes += entry_ptr->size; aux_ptr->insert_dirty_bytes_updates += 1; #endif /* H5AC_DEBUG_DIRTY_BYTES_CREATION */ @@ -1875,6 +1875,8 @@ done: * Programmer: John Mainzer * April 28, 2010 * + * Changes: None. + * *------------------------------------------------------------------------- */ static herr_t @@ -1894,7 +1896,8 @@ H5AC__rsp__p0_only__flush(H5F_t *f) aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); - HDassert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY); + HDassert(aux_ptr->metadata_write_strategy == \ + H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY); /* To prevent "messages from the future" we must * synchronize all processes before we start the flush. @@ -1903,9 +1906,12 @@ H5AC__rsp__p0_only__flush(H5F_t *f) * However, when flushing from within the close operation from a file, * it's possible to skip this barrier (on the second flush of the cache). */ - if(!H5CX_get_mpi_file_flushing()) - if(MPI_SUCCESS != (mpi_result = MPI_Barrier(aux_ptr->mpi_comm))) + if ( ! H5CX_get_mpi_file_flushing() ) { + + if ( MPI_SUCCESS != (mpi_result = MPI_Barrier(aux_ptr->mpi_comm)) ) + HMPI_GOTO_ERROR(FAIL, "MPI_Barrier failed", mpi_result) + } /* Flush data to disk, from rank 0 process */ if(aux_ptr->mpi_rank == 0) { @@ -1921,23 +1927,30 @@ H5AC__rsp__p0_only__flush(H5F_t *f) aux_ptr->write_permitted = FALSE; /* Check for error on the write operation */ - if(result < 0) + if ( result < 0 ) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush.") /* this code exists primarily for the test bed -- it allows us to * enforce POSIX semantics on the server that pretends to be a * file system in our parallel tests. */ - if(aux_ptr->write_done) + if ( aux_ptr->write_done ) { + (aux_ptr->write_done)(); + } } /* end if */ /* Propagate cleaned entries to other ranks. */ - if(H5AC__propagate_flushed_and_still_clean_entries_list(f) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't propagate clean entries list.") + if ( H5AC__propagate_flushed_and_still_clean_entries_list(f) < 0 ) + + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \ + "Can't propagate clean entries list.") done: + FUNC_LEAVE_NOAPI(ret_value) + } /* H5AC__rsp__p0_only__flush() */ @@ -2104,16 +2117,22 @@ H5AC__run_sync_point(H5F_t *f, int sync_point_op) /* Sanity checks */ HDassert(f != NULL); + cache_ptr = f->shared->cache; + HDassert(cache_ptr != NULL); + aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); + HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); HDassert((sync_point_op == H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN) || - (sync_point_op == H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED)); + (sync_point_op == H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED)); + #if H5AC_DEBUG_DIRTY_BYTES_CREATION -HDfprintf(stdout, "%d:H5AC_propagate...:%u: (u/uu/i/iu/r/ru) = %zu/%u/%zu/%u/%zu/%u\n", +HDfprintf(stdout, + "%d:H5AC_propagate...:%u: (u/uu/i/iu/r/ru) = %zu/%u/%zu/%u/%zu/%u\n", aux_ptr->mpi_rank, aux_ptr->dirty_bytes_propagations, aux_ptr->unprotect_dirty_bytes, @@ -2188,6 +2207,7 @@ HDfprintf(stdout, "%d:H5AC_propagate...:%u: (u/uu/i/iu/r/ru) = %zu/%u/%zu/%u/%zu #endif /* H5AC_DEBUG_DIRTY_BYTES_CREATION */ done: + FUNC_LEAVE_NOAPI(ret_value) } /* H5AC__run_sync_point() */ @@ -2284,7 +2304,6 @@ H5AC__tidy_cache_0_lists(H5AC_t *cache_ptr, unsigned num_candidates, * request to flush all items and something was protected. * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 22 2009 * *------------------------------------------------------------------------- diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index b932e16..84c6672 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -15,7 +15,7 @@ * * Created: H5ACprivate.h * Jul 9 1997 - * Robb Matzke + * Robb Matzke * * Purpose: Constants and typedefs available to the rest of the * library. @@ -387,6 +387,8 @@ H5_DLL herr_t H5AC_insert_entry(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *thing, unsigned int flags); H5_DLL herr_t H5AC_pin_protected_entry(void *thing); H5_DLL herr_t H5AC_prep_for_file_close(H5F_t *f); +H5_DLL herr_t H5AC_prep_for_file_flush(H5F_t *f); +H5_DLL herr_t H5AC_secure_from_file_flush(H5F_t *f); H5_DLL herr_t H5AC_create_flush_dependency(void *parent_thing, void *child_thing); H5_DLL void * H5AC_protect(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *udata, unsigned flags); diff --git a/src/H5ACpublic.h b/src/H5ACpublic.h index a48aa69..e6f4010 100644 --- a/src/H5ACpublic.h +++ b/src/H5ACpublic.h @@ -15,12 +15,10 @@ * * Created: H5ACpublic.h * Jul 10 1997 - * Robb Matzke + * Robb Matzke * * Purpose: Public include file for cache functions. * - * Modifications: - * *------------------------------------------------------------------------- */ #ifndef _H5ACpublic_H diff --git a/src/H5Abtree2.c b/src/H5Abtree2.c index 3377aa2..843799e 100644 --- a/src/H5Abtree2.c +++ b/src/H5Abtree2.c @@ -15,7 +15,7 @@ * * Created: H5Abtree2.c * Dec 4 2006 - * Quincey Koziol + * Quincey Koziol * * Purpose: v2 B-tree callbacks for indexing attributes on objects * @@ -152,7 +152,6 @@ const H5B2_class_t H5A_BT2_CORDER[1]={{ /* B-tree class information */ * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Dec 4 2006 * *------------------------------------------------------------------------- diff --git a/src/H5Adense.c b/src/H5Adense.c index a73fcc6..ac6501a 100644 --- a/src/H5Adense.c +++ b/src/H5Adense.c @@ -15,7 +15,7 @@ * * Created: H5Adense.c * Dec 4 2006 - * Quincey Koziol + * Quincey Koziol * * Purpose: Routines for operating on "dense" attribute storage * for an object. @@ -171,7 +171,6 @@ typedef struct H5A_bt2_ud_rmbi_t { * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Dec 4 2006 * *------------------------------------------------------------------------- @@ -210,9 +209,6 @@ H5A__dense_create(H5F_t *f, H5O_ainfo_t *ainfo) /* Retrieve the heap's address in the file */ if(H5HF_get_heap_addr(fheap, &ainfo->fheap_addr) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGETSIZE, FAIL, "can't get fractal heap address") -#ifdef QAK -HDfprintf(stderr, "%s: ainfo->fheap_addr = %a\n", FUNC, ainfo->fheap_addr); -#endif /* QAK */ #ifndef NDEBUG { @@ -222,9 +218,6 @@ HDfprintf(stderr, "%s: ainfo->fheap_addr = %a\n", FUNC, ainfo->fheap_addr); if(H5HF_get_id_len(fheap, &fheap_id_len) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGETSIZE, FAIL, "can't get fractal heap ID length") HDassert(fheap_id_len == H5O_FHEAP_ID_LEN); -#ifdef QAK -HDfprintf(stderr, "%s: fheap_id_len = %Zu\n", FUNC, fheap_id_len); -#endif /* QAK */ } #endif /* NDEBUG */ @@ -244,9 +237,6 @@ HDfprintf(stderr, "%s: fheap_id_len = %Zu\n", FUNC, fheap_id_len); /* 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 */ /* Check if we should create a creation order index v2 B-tree */ if(ainfo->index_corder) { @@ -265,9 +255,6 @@ HDfprintf(stderr, "%s: ainfo->name_bt2_addr = %a\n", FUNC, ainfo->name_bt2_addr) /* 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: @@ -290,9 +277,8 @@ done: * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Dec 11 2006 + * Programmer: Quincey Koziol + * Dec 11 2006 * *------------------------------------------------------------------------- */ @@ -351,9 +337,8 @@ done: * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Dec 11 2006 + * Programmer: Quincey Koziol + * Dec 11 2006 * *------------------------------------------------------------------------- */ @@ -440,9 +425,8 @@ done: * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Dec 4 2006 + * Programmer: Quincey Koziol + * Dec 4 2006 * *------------------------------------------------------------------------- */ @@ -598,7 +582,7 @@ done: * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, February 20, 2007 * *------------------------------------------------------------------------- @@ -632,7 +616,7 @@ H5A__dense_write_bt2_cb2(void *_record, void *_op_data, hbool_t *changed) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, December 5, 2006 * *------------------------------------------------------------------------- @@ -743,9 +727,8 @@ done: * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Dec 4 2006 + * Programmer: Quincey Koziol + * Dec 4 2006 * *------------------------------------------------------------------------- */ @@ -840,9 +823,8 @@ done: * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Dec 5 2006 + * Programmer: Quincey Koziol + * Dec 5 2006 * *------------------------------------------------------------------------- */ @@ -883,9 +865,8 @@ done: * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Jan 3 2007 + * Programmer: Quincey Koziol + * Jan 3 2007 * *------------------------------------------------------------------------- */ @@ -1065,9 +1046,8 @@ done: * * Return: H5_ITER_ERROR/H5_ITER_CONT/H5_ITER_STOP * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Dec 5 2006 + * Programmer: Quincey Koziol + * Dec 5 2006 * *------------------------------------------------------------------------- */ @@ -1161,9 +1141,8 @@ done: * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Dec 5 2006 + * Programmer: Quincey Koziol + * Dec 5 2006 * *------------------------------------------------------------------------- */ @@ -1296,9 +1275,8 @@ done: * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Dec 11 2006 + * Programmer: Quincey Koziol + * Dec 11 2006 * *------------------------------------------------------------------------- */ @@ -1360,9 +1338,8 @@ done: * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Dec 11 2006 + * Programmer: Quincey Koziol + * Dec 11 2006 * *------------------------------------------------------------------------- */ @@ -1448,9 +1425,8 @@ done: * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Feb 14 2007 + * Programmer: Quincey Koziol + * Feb 14 2007 * *------------------------------------------------------------------------- */ @@ -1574,9 +1550,8 @@ done: * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Feb 14 2007 + * Programmer: Quincey Koziol + * Feb 14 2007 * *------------------------------------------------------------------------- */ @@ -1702,9 +1677,8 @@ done: * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Dec 11 2006 + * Programmer: Quincey Koziol + * Dec 11 2006 * *------------------------------------------------------------------------- */ @@ -1788,9 +1762,8 @@ done: * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Jan 3 2007 + * Programmer: Quincey Koziol + * Jan 3 2007 * *------------------------------------------------------------------------- */ @@ -1852,9 +1825,8 @@ done: * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Dec 6 2006 + * Programmer: Quincey Koziol + * Dec 6 2006 * *------------------------------------------------------------------------- */ diff --git a/src/H5Adeprec.c b/src/H5Adeprec.c index dd5eae3..c4d8bb8 100644 --- a/src/H5Adeprec.c +++ b/src/H5Adeprec.c @@ -15,7 +15,7 @@ * * Created: H5Adeprec.c * November 27 2006 - * Quincey Koziol + * Quincey Koziol * * Purpose: Deprecated functions from the H5A interface. These * functions are here for compatibility purposes and may be diff --git a/src/H5Aint.c b/src/H5Aint.c index 1a74abe..5ecfd06 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -14,8 +14,8 @@ /*------------------------------------------------------------------------- * * Created: H5Aint.c - * Dec 18 2006 - * Quincey Koziol + * Dec 18 2006 + * Quincey Koziol * * Purpose: Internal routines for managing attributes. * @@ -122,10 +122,10 @@ const unsigned H5O_attr_ver_bounds[] = { /* Local Variables */ /*******************/ -typedef H5A_t* H5A_t_ptr; +typedef H5A_t* H5A_t_ptr; H5FL_SEQ_DEFINE(H5A_t_ptr); - + /*------------------------------------------------------------------------- * Function: H5A__create * @@ -288,16 +288,16 @@ done: FUNC_LEAVE_NOAPI_TAG(ret_value) } /* H5A__create() */ - + /*------------------------------------------------------------------------- * Function: H5A__create_by_name * - * Purpose: Create an attribute on object, according to it's name + * Purpose: Create an attribute on object, according to it's name * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * December 6, 2017 + * Programmer: Quincey Koziol + * December 6, 2017 * *------------------------------------------------------------------------- */ @@ -306,8 +306,8 @@ H5A__create_by_name(const H5G_loc_t *loc, const char *obj_name, const char *attr const H5T_t *type, const H5S_t *space, hid_t acpl_id) { H5G_loc_t obj_loc; /* Location used to open group */ - H5G_name_t obj_path; /* Opened object group hier. path */ - H5O_loc_t obj_oloc; /* Opened object object location */ + H5G_name_t obj_path; /* Opened object group hier. path */ + H5O_loc_t obj_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */ H5A_t *attr = NULL; /* Attribute from object header */ H5A_t *ret_value = NULL; /* Return value */ @@ -349,22 +349,21 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5A__create_by_name() */ - + /*------------------------------------------------------------------------- * Function: H5A__open_common * - * Purpose: - * Finishes initializing an attributes the open + * Purpose: Finishes initializing an attributes the open * * Usage: * herr_t H5A__open_common(loc, name) * const H5G_loc_t *loc; IN: Pointer to group location for object * H5A_t *attr; IN/OUT: Pointer to attribute to initialize * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * December 18, 2006 + * Programmer: Quincey Koziol + * December 18, 2006 * *------------------------------------------------------------------------- */ @@ -406,7 +405,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5A__open_common() */ - + /*------------------------------------------------------------------------- * Function: H5A__open * @@ -451,13 +450,13 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5A__open() */ - + /*------------------------------------------------------------------------- * Function: H5A__open_by_idx * * Purpose: Open an attribute according to its index order * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * April 2, 1998 @@ -515,7 +514,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5A__open_by_idx() */ - + /*------------------------------------------------------------------------- * Function: H5A__open_by_name * @@ -579,7 +578,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5A__open_by_name() */ - + /*-------------------------------------------------------------------------- NAME H5A__read @@ -616,6 +615,10 @@ H5A__read(const H5A_t *attr, const H5T_t *mem_type, void *buf) HDassert(mem_type); HDassert(buf); + /* Patch the top level file pointer in attr->shared->dt->shared->u.vlen.f if needed */ + if(H5T_patch_vlen_file(attr->shared->dt, H5F_VOL_OBJ(attr->oloc.file)) < 0 ) + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't patch VL datatype file pointer") + /* Create buffer for data to store on disk */ if((snelmts = H5S_GET_EXTENT_NPOINTS(attr->shared->ds)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTCOUNT, FAIL, "dataspace is invalid") @@ -677,12 +680,12 @@ done: if(tconv_buf) tconv_buf = H5FL_BLK_FREE(attr_buf, tconv_buf); if(bkg_buf) - bkg_buf = H5FL_BLK_FREE(attr_buf, bkg_buf); + bkg_buf = H5FL_BLK_FREE(attr_buf, bkg_buf); FUNC_LEAVE_NOAPI_TAG(ret_value) } /* H5A__read() */ - + /*-------------------------------------------------------------------------- NAME H5A__write @@ -796,7 +799,7 @@ done: FUNC_LEAVE_NOAPI_TAG(ret_value) } /* H5A__write() */ - + /*-------------------------------------------------------------------------- NAME H5A__get_name @@ -817,7 +820,7 @@ ssize_t H5A__get_name(H5A_t *attr, size_t buf_size, char *buf) { size_t copy_len, nbytes; - ssize_t ret_value = -1; /* Return value */ + ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_PACKAGE_NOERR @@ -842,7 +845,7 @@ H5A__get_name(H5A_t *attr, size_t buf_size, char *buf) FUNC_LEAVE_NOAPI(ret_value) } /* H5A__get_name() */ - + /*------------------------------------------------------------------------- * Function: H5A_get_space * @@ -879,14 +882,13 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5A_get_space() */ - + /*------------------------------------------------------------------------- * Function: H5A__get_type * * Purpose: Returns an ID for the datatype of an attribute * * Return: Success: A valid ID for the datatype of an attribute - * * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- @@ -942,7 +944,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__get_type() */ - + /*-------------------------------------------------------------------------- NAME H5A__get_create_plist @@ -974,7 +976,7 @@ H5A__get_create_plist(H5A_t* attr) /* Create the property list object to return */ if((new_plist_id = H5P_copy_plist(plist, TRUE)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "unable to copy attribute creation properties") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "unable to copy attribute creation properties") if(NULL == (new_plist = (H5P_genplist_t *)H5I_object(new_plist_id))) HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "can't get property list") @@ -988,7 +990,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__get_create_plist() */ - + /*------------------------------------------------------------------------- * Function: H5A__get_info * @@ -1029,14 +1031,13 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__get_info() */ - + /*------------------------------------------------------------------------- * Function: H5A__copy * * Purpose: Copies attribute OLD_ATTR. * * Return: Success: Pointer to a new copy of the OLD_ATTR argument. - * * Failure: NULL * * Programmer: Robb Matzke @@ -1092,7 +1093,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__copy() */ - + /*------------------------------------------------------------------------- * Function: H5A__shared_free * @@ -1144,7 +1145,7 @@ H5A__shared_free(H5A_t *attr) FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__shared_free() */ - + /*------------------------------------------------------------------------- * Function: H5A__close_cb * @@ -1176,7 +1177,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__close_cb() */ - + /*------------------------------------------------------------------------- * Function: H5A__close * @@ -1227,7 +1228,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__close() */ - + /*------------------------------------------------------------------------- * Function: H5A_oloc * @@ -1259,7 +1260,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5A_oloc() */ - + /*------------------------------------------------------------------------- * Function: H5A_nameof * @@ -1291,7 +1292,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5A_nameof() */ - + /*------------------------------------------------------------------------- * Function: H5A_type * @@ -1321,7 +1322,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5A_type() */ - + /*------------------------------------------------------------------------- * Function: H5A__exists_by_name * @@ -1367,7 +1368,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5A__exists_by_name() */ - + /*------------------------------------------------------------------------- * Function: H5A__compact_build_table_cb * @@ -1377,7 +1378,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Dec 18 2006 * * Modification:Raymond Lu @@ -1428,7 +1428,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__compact_build_table_cb() */ - + /*------------------------------------------------------------------------- * Function: H5A__compact_build_table * @@ -1440,8 +1440,8 @@ done: * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Dec 18, 2006 + * Programmer: Quincey Koziol + * Dec 18, 2006 * *------------------------------------------------------------------------- */ @@ -1491,18 +1491,16 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__compact_build_table() */ - + /*------------------------------------------------------------------------- * Function: H5A__dense_build_table_cb * * Purpose: Callback routine for building table of attributes from dense * attribute storage. * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Dec 11 2006 * *------------------------------------------------------------------------- @@ -1535,7 +1533,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__dense_build_table_cb() */ - + /*------------------------------------------------------------------------- * Function: H5A__dense_build_table * @@ -1620,21 +1618,20 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__dense_build_table() */ - + /*------------------------------------------------------------------------- * Function: H5A__attr_cmp_name_inc * - * Purpose: Callback routine for comparing two attribute names, in + * Purpose: Callback routine for comparing two attribute names, in * increasing alphabetic order * - * Return: An integer less than, equal to, or greater than zero if the + * Return: An integer less than, equal to, or greater than zero if the * first argument is considered to be respectively less than, * equal to, or greater than the second. If two members compare * as equal, their order in the sorted array is undefined. * (i.e. same as strcmp()) * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Dec 11 2006 * *------------------------------------------------------------------------- @@ -1648,7 +1645,7 @@ H5A__attr_cmp_name_inc(const void *attr1, const void *attr2) (*(const H5A_t * const *)attr2)->shared->name)) } /* end H5A__attr_cmp_name_inc() */ - + /*------------------------------------------------------------------------- * Function: H5A__attr_cmp_name_dec * @@ -1662,7 +1659,6 @@ H5A__attr_cmp_name_inc(const void *attr1, const void *attr2) * (i.e. opposite of strcmp()) * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Feb 8 2007 * *------------------------------------------------------------------------- @@ -1676,7 +1672,7 @@ H5A__attr_cmp_name_dec(const void *attr1, const void *attr2) (*(const H5A_t * const *)attr1)->shared->name)) } /* end H5A__attr_cmp_name_dec() */ - + /*------------------------------------------------------------------------- * Function: H5A__attr_cmp_corder_inc * @@ -1689,7 +1685,6 @@ H5A__attr_cmp_name_dec(const void *attr1, const void *attr2) * as equal, their order in the sorted array is undefined. * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Feb 8 2007 * *------------------------------------------------------------------------- @@ -1711,21 +1706,20 @@ H5A__attr_cmp_corder_inc(const void *attr1, const void *attr2) FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__attr_cmp_corder_inc() */ - + /*------------------------------------------------------------------------- * Function: H5A__attr_cmp_corder_dec * - * Purpose: Callback routine for comparing two attributes, in + * Purpose: Callback routine for comparing two attributes, in * decreasing creation order * - * Return: An integer less than, equal to, or greater than zero if the + * Return: An integer less than, equal to, or greater than zero if the * second argument is considered to be respectively less than, * equal to, or greater than the first. If two members compare * as equal, their order in the sorted array is undefined. * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Feb 8 2007 + * Programmer: Quincey Koziol + * Feb 8 2007 * *------------------------------------------------------------------------- */ @@ -1746,17 +1740,16 @@ H5A__attr_cmp_corder_dec(const void *attr1, const void *attr2) FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__attr_cmp_corder_dec() */ - + /*------------------------------------------------------------------------- * Function: H5A__attr_sort_table * * Purpose: Sort table containing a list of attributes for an object * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Dec 11, 2006 + * Programmer: Quincey Koziol + * Dec 11, 2006 * *------------------------------------------------------------------------- */ @@ -1791,7 +1784,7 @@ H5A__attr_sort_table(H5A_attr_table_t *atable, H5_index_t idx_type, FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5A__attr_sort_table() */ - + /*------------------------------------------------------------------------- * Function: H5A__attr_iterate_table * @@ -1800,8 +1793,8 @@ H5A__attr_sort_table(H5A_attr_table_t *atable, H5_index_t idx_type, * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Dec 18, 2006 + * Programmer: Quincey Koziol + * Dec 18, 2006 * *------------------------------------------------------------------------- */ @@ -1873,7 +1866,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__attr_iterate_table() */ - + /*------------------------------------------------------------------------- * Function: H5A__attr_release_table * @@ -1881,7 +1874,7 @@ done: * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Dec 11, 2006 * *------------------------------------------------------------------------- @@ -1889,7 +1882,7 @@ done: herr_t H5A__attr_release_table(H5A_attr_table_t *atable) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -1914,18 +1907,16 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__attr_release_table() */ - + /*------------------------------------------------------------------------- * Function: H5A__get_ainfo * * Purpose: Retrieves the "attribute info" message for an object. Also * sets the number of attributes correctly, if it isn't set up yet. * - * Return: Success: TRUE/FALSE whether message was found & retrieved - * Failure: FAIL if error occurred + * Return: TRUE/FALSE/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Mar 11 2007 * *------------------------------------------------------------------------- @@ -1945,11 +1936,11 @@ H5A__get_ainfo(H5F_t *f, H5O_t *oh, H5O_ainfo_t *ainfo) /* Check if the "attribute info" message exists */ if((ret_value = H5O_msg_exists_oh(oh, H5O_AINFO_ID)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "unable to check object header") + HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "unable to check object header") if(ret_value > 0) { /* Retrieve the "attribute info" structure */ if(NULL == H5O_msg_read_oh(f, oh, H5O_AINFO_ID, ainfo)) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't read AINFO message") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't read AINFO message") /* Check if we don't know how many attributes there are */ if(ainfo->nattrs == HSIZET_MAX) { @@ -1978,7 +1969,7 @@ done: FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5A__get_ainfo() */ - + /*------------------------------------------------------------------------- * Function: H5A__set_version * @@ -1989,7 +1980,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jul 17 2007 * *------------------------------------------------------------------------- @@ -2040,7 +2030,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__set_version() */ - + /*------------------------------------------------------------------------- * Function: H5A__attr_copy_file * @@ -2250,10 +2240,10 @@ H5A__attr_copy_file(const H5A_t *attr_src, H5F_t *file_dst, hbool_t *recompute_s H5MM_memcpy(buf, attr_src->shared->data, attr_src->shared->data_size); - /* Allocate background memory */ - if(H5T_path_bkg(tpath_src_mem) || H5T_path_bkg(tpath_mem_dst)) - if(NULL == (bkg_buf = H5FL_BLK_CALLOC(attr_buf, buf_size))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTALLOC, NULL, "memory allocation failed") + /* Allocate background memory */ + if(H5T_path_bkg(tpath_src_mem) || H5T_path_bkg(tpath_mem_dst)) + if(NULL == (bkg_buf = H5FL_BLK_CALLOC(attr_buf, buf_size))) + HGOTO_ERROR(H5E_ATTR, H5E_CANTALLOC, NULL, "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, bkg_buf) < 0) @@ -2261,9 +2251,9 @@ H5A__attr_copy_file(const H5A_t *attr_src, H5F_t *file_dst, hbool_t *recompute_s H5MM_memcpy(reclaim_buf, buf, buf_size); - /* Set background buffer to all zeros */ - if(bkg_buf) - HDmemset(bkg_buf, 0, buf_size); + /* Set background buffer to all zeros */ + if(bkg_buf) + HDmemset(bkg_buf, 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_buf) < 0) @@ -2323,7 +2313,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5A__attr_copy_file() */ - + /*------------------------------------------------------------------------- * Function: H5A__attr_post_copy_file * @@ -2416,7 +2406,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5A__attr_post_copy_file() */ - + /*------------------------------------------------------------------------- * Function: H5A__dense_post_copy_file_cb * @@ -2426,7 +2416,6 @@ done: * Failure: Negative * * Programmer: Peter Cao - * xcao@hdfgroup.org * July 20, 2007 * *------------------------------------------------------------------------- @@ -2474,7 +2463,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__dense_post_copy_file_cb() */ - + /*------------------------------------------------------------------------- * Function: H5A__dense_post_copy_file_all * @@ -2483,7 +2472,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Peter Cao - * xcao@hdfgroup.org * July 20, 2007 * *------------------------------------------------------------------------- @@ -2521,7 +2509,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__dense_post_copy_file_all */ - + /*------------------------------------------------------------------------- * Function: H5A__rename_by_name * @@ -2529,7 +2517,7 @@ done: * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * February 20, 2007 * *------------------------------------------------------------------------- @@ -2539,10 +2527,10 @@ H5A__rename_by_name(H5G_loc_t loc, const char *obj_name, const char *old_attr_na const char *new_attr_name) { H5G_loc_t obj_loc; /* Location used to open group */ - H5G_name_t obj_path; /* Opened object group hier. path */ - H5O_loc_t obj_oloc; /* Opened object object location */ + H5G_name_t obj_path; /* Opened object group hier. path */ + H5O_loc_t obj_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -2571,7 +2559,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5A__rename_by_name() */ - + /*------------------------------------------------------------------------- * Function: H5A__iterate_common * @@ -2579,7 +2567,7 @@ done: * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * December 6, 2017 * *------------------------------------------------------------------------- @@ -2606,7 +2594,7 @@ H5A__iterate_common(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, FUNC_LEAVE_NOAPI(ret_value) } /* H5A__iterate_common() */ - + /*------------------------------------------------------------------------- * Function: H5A__iterate * @@ -2671,7 +2659,7 @@ done: } /* end H5A__iterate() */ #ifndef H5_NO_DEPRECATED_SYMBOLS - + /*------------------------------------------------------------------------- * Function: H5A__iterate_old * @@ -2679,7 +2667,7 @@ done: * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * December 6, 2017 * *------------------------------------------------------------------------- @@ -2721,7 +2709,7 @@ H5A__iterate_old(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op, * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * December 6, 2017 * *------------------------------------------------------------------------- @@ -2730,8 +2718,8 @@ herr_t H5A__delete_by_name(const H5G_loc_t *loc, const char *obj_name, const char *attr_name) { H5G_loc_t obj_loc; /* Location used to open group */ - H5G_name_t obj_path; /* Opened object group hier. path */ - H5O_loc_t obj_oloc; /* Opened object object location */ + H5G_name_t obj_path; /* Opened object group hier. path */ + H5O_loc_t obj_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */ herr_t ret_value = SUCCEED; /* Return value */ @@ -2759,7 +2747,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5A__delete_by_name() */ - + /*------------------------------------------------------------------------- * Function: H5A__delete_by_idx * @@ -2767,7 +2755,7 @@ done: * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * December 6, 2017 * *------------------------------------------------------------------------- @@ -2777,8 +2765,8 @@ H5A__delete_by_idx(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_ty H5_iter_order_t order, hsize_t n) { H5G_loc_t obj_loc; /* Location used to open group */ - H5G_name_t obj_path; /* Opened object group hier. path */ - H5O_loc_t obj_oloc; /* Opened object object location */ + H5G_name_t obj_path; /* Opened object group hier. path */ + H5O_loc_t obj_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */ herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5Amodule.h b/src/H5Amodule.h index 8ed056b..6b835e1 100644 --- a/src/H5Amodule.h +++ b/src/H5Amodule.h @@ -11,7 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, September 12, 2015 * * Purpose: This file contains declarations which define macros for the diff --git a/src/H5Apkg.h b/src/H5Apkg.h index f3870c0..39fdea3 100644 --- a/src/H5Apkg.h +++ b/src/H5Apkg.h @@ -263,9 +263,6 @@ H5_DLL herr_t H5O__attr_remove(const H5O_loc_t *loc, const char *name); H5_DLL herr_t H5O__attr_remove_by_idx(const H5O_loc_t *loc, H5_index_t idx_type, H5_iter_order_t order, hsize_t n); H5_DLL htri_t H5O__attr_exists(const H5O_loc_t *loc, const char *name); -#ifndef H5_NO_DEPRECATED_SYMBOLS -H5_DLL int H5O__attr_count(const H5O_loc_t *loc); -#endif /* H5_NO_DEPRECATED_SYMBOLS */ H5_DLL H5A_t *H5A__attr_copy_file(const H5A_t *attr_src, H5F_t *file_dst, hbool_t *recompute_size, H5O_copy_t *cpy_info); H5_DLL herr_t H5A__attr_post_copy_file(const H5O_loc_t *src_oloc, const H5A_t *mesg_src, diff --git a/src/H5B.c b/src/H5B.c index f909d90..1c6ab21 100644 --- a/src/H5B.c +++ b/src/H5B.c @@ -13,9 +13,9 @@ /*------------------------------------------------------------------------- * - * Created: H5B.c - * Jul 10 1997 - * Robb Matzke + * Created: H5B.c + * Jul 10 1997 + * Robb Matzke * * Purpose: Implements balanced, sibling-linked, N-ary trees * capable of storing any type of data with unique key @@ -206,7 +206,6 @@ H5FL_SEQ_DEFINE_STATIC(size_t); * Failure: Negative * * Programmer: Robb Matzke - * matzke@llnl.gov * Jun 23 1997 * *------------------------------------------------------------------------- @@ -291,7 +290,6 @@ done: * UDATA is undefined). * * Programmer: Robb Matzke - * matzke@llnl.gov * Jun 23 1997 * *------------------------------------------------------------------------- @@ -387,7 +385,6 @@ done: * returned through the NEW_ADDR argument). Negative on failure. * * Programmer: Robb Matzke - * matzke@llnl.gov * Jul 3 1997 * *------------------------------------------------------------------------- @@ -542,7 +539,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Jun 23 1997 * *------------------------------------------------------------------------- @@ -596,7 +592,7 @@ H5B_insert(H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata) if((int)(my_ins = H5B__insert_helper(f, &bt_ud, type, lt_key, <_key_changed, md_key, udata, rt_key, &rt_key_changed, &split_bt_ud/*out*/)) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to insert key") + HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to insert key") /* Check if the root node split */ if(H5B_INS_NOOP == my_ins) { @@ -613,9 +609,9 @@ H5B_insert(H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata) /* update left and right keys */ if(!lt_key_changed) - H5MM_memcpy(lt_key, H5B_NKEY(bt_ud.bt,shared,0), type->sizeof_nkey); + H5MM_memcpy(lt_key, H5B_NKEY(bt_ud.bt,shared,0), type->sizeof_nkey); if(!rt_key_changed) - H5MM_memcpy(rt_key, H5B_NKEY(split_bt_ud.bt,shared,split_bt_ud.bt->nchildren), type->sizeof_nkey); + H5MM_memcpy(rt_key, H5B_NKEY(split_bt_ud.bt,shared,split_bt_ud.bt->nchildren), type->sizeof_nkey); /* * Copy the old root node to some other file location and make the new root @@ -624,7 +620,7 @@ H5B_insert(H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata) */ H5_CHECK_OVERFLOW(shared->sizeof_rnode,size_t,hsize_t); if(HADDR_UNDEF == (old_root_addr = H5MF_alloc(f, H5FD_MEM_BTREE, (hsize_t)shared->sizeof_rnode))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "unable to allocate file space to move root") + HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "unable to allocate file space to move root") /* * Move the node to the new location @@ -637,12 +633,12 @@ H5B_insert(H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata) /* Unprotect the old root so we can move it. Also force it to be marked * dirty so it is written to the new location. */ if(H5AC_unprotect(f, H5AC_BT, bt_ud.addr, bt_ud.bt, H5AC__DIRTIED_FLAG) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release old root") + HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release old root") bt_ud.bt = NULL; /* Make certain future references will be caught */ /* Move the location of the old root on the disk */ if(H5AC_move_entry(f, H5AC_BT, bt_ud.addr, old_root_addr) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to move B-tree root node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to move B-tree root node") bt_ud.addr = old_root_addr; /* Update the split b-tree's left pointer to point to the new location */ @@ -700,7 +696,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Jul 8 1997 * *------------------------------------------------------------------------- @@ -789,7 +784,6 @@ H5B__insert_child(H5B_t *bt, unsigned *bt_flags, unsigned idx, * Failure: H5B_INS_ERROR * * Programmer: Robb Matzke - * matzke@llnl.gov * Jul 9 1997 * *------------------------------------------------------------------------- @@ -839,7 +833,7 @@ H5B__insert_helper(H5F_t *f, H5B_ins_ud_t *bt_ud, const H5B_class_t *type, /* Get shared info for B-tree */ if(NULL == (rc_shared = (type->get_shared)(f, udata))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, H5B_INS_ERROR, "can't retrieve B-tree's shared ref. count object") + HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, H5B_INS_ERROR, "can't retrieve B-tree's shared ref. count object") shared = (H5B_shared_t *)H5UC_GET_OBJ(rc_shared); HDassert(shared); @@ -1118,7 +1112,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Jun 23 1997 * *------------------------------------------------------------------------- @@ -1185,7 +1178,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Jun 23 1997 * *------------------------------------------------------------------------- @@ -1266,7 +1258,7 @@ H5B__remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, int level, /* Get shared info for B-tree */ if(NULL == (rc_shared = (type->get_shared)(f, udata))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, H5B_INS_ERROR, "can't retrieve B-tree's shared ref. count object") + HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, H5B_INS_ERROR, "can't retrieve B-tree's shared ref. count object") shared = (H5B_shared_t *)H5UC_GET_OBJ(rc_shared); HDassert(shared); @@ -1278,7 +1270,7 @@ H5B__remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, int level, cache_udata.type = type; cache_udata.rc_shared = rc_shared; if(NULL == (bt = (H5B_t *)H5AC_protect(f, H5AC_BT, addr, &cache_udata, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR, "unable to load B-tree node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR, "unable to load B-tree node") rt = bt->nchildren; while(lt < rt && cmp) { @@ -1417,7 +1409,7 @@ H5B__remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, int level, bt->nchildren = 0; /* Delete the node from disk (via the metadata cache) */ - bt_flags |= H5AC__DIRTIED_FLAG | H5AC__FREE_FILE_SPACE_FLAG; + bt_flags |= H5AC__DIRTIED_FLAG | H5AC__FREE_FILE_SPACE_FLAG; H5_CHECK_OVERFLOW(shared->sizeof_rnode, size_t, hsize_t); if(H5AC_unprotect(f, H5AC_BT, addr, bt, bt_flags | H5AC__DELETED_FLAG) < 0) { bt = NULL; @@ -1679,7 +1671,6 @@ done: * Failure: NULL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * May 27 2008 * *------------------------------------------------------------------------- @@ -1786,7 +1777,6 @@ H5B_shared_free(void *_shared) * Failure: NULL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Apr 18 2000 * *------------------------------------------------------------------------- @@ -1852,7 +1842,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jun 3 2008 * *------------------------------------------------------------------------- @@ -1885,7 +1874,7 @@ H5B__get_info_helper(H5F_t *f, const H5B_class_t *type, haddr_t addr, /* Get shared info for B-tree */ if(NULL == (rc_shared = (type->get_shared)(f, info_udata->udata))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree's shared ref. count object") + HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree's shared ref. count object") shared = (H5B_shared_t *)H5UC_GET_OBJ(rc_shared); HDassert(shared); @@ -1897,7 +1886,7 @@ H5B__get_info_helper(H5F_t *f, const H5B_class_t *type, haddr_t addr, cache_udata.type = type; cache_udata.rc_shared = rc_shared; if(NULL == (bt = (H5B_t *)H5AC_protect(f, H5AC_BT, addr, &cache_udata, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree node") /* Cache information from this node */ left_child = bt->child[0]; @@ -2066,7 +2055,6 @@ done: * Failure: FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Mar 26, 2008 * *------------------------------------------------------------------------- diff --git a/src/H5B2.c b/src/H5B2.c index c9ed303..06806aa 100644 --- a/src/H5B2.c +++ b/src/H5B2.c @@ -15,7 +15,7 @@ * * Created: H5B2.c * Jan 31 2005 - * Quincey Koziol + * Quincey Koziol * * Purpose: Implements a B-tree, with several modifications from * the "standard" methods. @@ -129,7 +129,6 @@ H5FL_DEFINE_STATIC(H5B2_t); * filled in), negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Jan 31 2005 * *------------------------------------------------------------------------- @@ -200,7 +199,6 @@ done: * NULL on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Oct 15 2009 * *------------------------------------------------------------------------- @@ -264,7 +262,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 2 2005 * *------------------------------------------------------------------------- @@ -307,7 +304,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Dec 23 2015 * *------------------------------------------------------------------------- @@ -379,7 +375,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Nov 5 2009 * *------------------------------------------------------------------------- @@ -414,7 +409,6 @@ H5B2_get_addr(const H5B2_t *bt2, haddr_t *addr_p) * Return: Value from callback: non-negative on success, negative on error * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 11 2005 * *------------------------------------------------------------------------- @@ -465,7 +459,6 @@ H5B2_iterate(H5B2_t *bt2, H5B2_operator_t op, void *op_data) * Return: Non-negative (TRUE/FALSE) on success, negative on failure. * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 23 2005 * *------------------------------------------------------------------------- @@ -705,7 +698,6 @@ done: * Return: Non-negative on success, negative on failure. * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 23 2005 * *------------------------------------------------------------------------- @@ -894,7 +886,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 25 2005 * *------------------------------------------------------------------------- @@ -968,7 +959,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Nov 14 2006 * *------------------------------------------------------------------------- @@ -1051,7 +1041,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 25 2005 * *------------------------------------------------------------------------- @@ -1092,7 +1081,6 @@ H5B2_get_nrec(const H5B2_t *bt2, hsize_t *nrec) * Return: Non-negative on success, negative on failure. * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 8 2005 * *------------------------------------------------------------------------- @@ -1150,7 +1138,6 @@ done: * Return: Non-negative on success, negative on failure. * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 10 2005 * *------------------------------------------------------------------------- @@ -1384,7 +1371,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Oct 15 2009 * *------------------------------------------------------------------------- @@ -1493,7 +1479,6 @@ done: * Return: Non-negative on success, negative on failure. * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 9 2005 * *------------------------------------------------------------------------- @@ -1512,9 +1497,6 @@ H5B2_delete(H5F_t *f, haddr_t addr, void *ctx_udata, H5B2_remove_t op, 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_protect(f, addr, ctx_udata, H5AC__NO_FLAGS_SET))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect v2 B-tree header") diff --git a/src/H5B2cache.c b/src/H5B2cache.c index 80cb6c5..3b7dd5d 100644 --- a/src/H5B2cache.c +++ b/src/H5B2cache.c @@ -15,7 +15,7 @@ * * Created: H5B2cache.c * Jan 31 2005 - * Quincey Koziol + * Quincey Koziol * * Purpose: Implement v2 B-tree metadata cache methods. * @@ -171,7 +171,6 @@ const H5AC_class_t H5AC_BT2_LEAF[1] = {{ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * May 18, 2010 * *------------------------------------------------------------------------- @@ -240,7 +239,6 @@ H5B2__cache_hdr_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSE * Failure: NULL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 1 2005 * *------------------------------------------------------------------------- @@ -339,7 +337,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * May 20, 2010 * *------------------------------------------------------------------------- @@ -370,7 +367,6 @@ H5B2__cache_hdr_image_len(const void *_thing, size_t *image_len) * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 1 2005 * *------------------------------------------------------------------------- @@ -442,7 +438,6 @@ H5B2__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le * Return: Non-negative on success/Negative on failure * * Programmer: Neil Fortner - * nfortne2@hdfgroup.org * Apr 24 2012 * *------------------------------------------------------------------------- @@ -530,7 +525,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Mike McGreevy - * mcgreevy@hdfgroup.org * June 18, 2008 * *------------------------------------------------------------------------- @@ -562,7 +556,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * May 18, 2010 * *------------------------------------------------------------------------- @@ -637,7 +630,6 @@ H5B2__cache_int_verify_chksum(const void *_image, size_t H5_ATTR_UNUSED len, voi * Failure: NULL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 2 2005 * *------------------------------------------------------------------------- @@ -756,7 +748,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * May 20, 2010 * *------------------------------------------------------------------------- @@ -788,7 +779,6 @@ H5B2__cache_int_image_len(const void *_thing, size_t *image_len) * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 3 2005 * *------------------------------------------------------------------------- @@ -875,7 +865,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Neil Fortner - * nfortne2@hdfgroup.org * Apr 25 2012 * *------------------------------------------------------------------------- @@ -886,7 +875,7 @@ H5B2__cache_int_notify(H5AC_notify_action_t action, void *_thing) H5B2_internal_t *internal = (H5B2_internal_t *)_thing; herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* * Check arguments. @@ -952,7 +941,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Mike McGreevy - * mcgreevy@hdfgroup.org * June 18, 2008 * *------------------------------------------------------------------------- @@ -985,7 +973,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * May 18, 2010 * *------------------------------------------------------------------------- @@ -1060,7 +1047,6 @@ H5B2__cache_leaf_verify_chksum(const void *_image, size_t H5_ATTR_UNUSED len, vo * Failure: NULL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 2 2005 * *------------------------------------------------------------------------- @@ -1159,7 +1145,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * May 20, 2010 * *------------------------------------------------------------------------- @@ -1191,7 +1176,6 @@ H5B2__cache_leaf_image_len(const void *_thing, size_t *image_len) * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 2 2005 * *------------------------------------------------------------------------- @@ -1264,7 +1248,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Neil Fortner - * nfortne2@hdfgroup.org * Apr 25 2012 * *------------------------------------------------------------------------- @@ -1275,7 +1258,7 @@ H5B2__cache_leaf_notify(H5AC_notify_action_t action, void *_thing) H5B2_leaf_t *leaf = (H5B2_leaf_t *)_thing; herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* * Check arguments. @@ -1341,7 +1324,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Mike McGreevy - * mcgreevy@hdfgroup.org * June 18, 2008 * *------------------------------------------------------------------------- diff --git a/src/H5B2dbg.c b/src/H5B2dbg.c index b5b1c03..0d93ed6 100644 --- a/src/H5B2dbg.c +++ b/src/H5B2dbg.c @@ -15,7 +15,7 @@ * * Created: H5B2dbg.c * Feb 2 2005 - * Quincey Koziol + * Quincey Koziol * * Purpose: Dump debugging information about a v2 B-tree. * @@ -80,7 +80,6 @@ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 2 2005 * *------------------------------------------------------------------------- @@ -175,7 +174,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 4 2005 * *------------------------------------------------------------------------- @@ -287,7 +285,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 7 2005 * *------------------------------------------------------------------------- diff --git a/src/H5B2hdr.c b/src/H5B2hdr.c index 68669e8..7b8b564 100644 --- a/src/H5B2hdr.c +++ b/src/H5B2hdr.c @@ -15,7 +15,7 @@ * * Created: H5B2int.c * Feb 27 2006 - * Quincey Koziol + * Quincey Koziol * * Purpose: Internal routines for managing v2 B-trees. * @@ -101,7 +101,6 @@ H5FL_SEQ_DEFINE(H5B2_node_info_t); * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 2 2005 * *------------------------------------------------------------------------- @@ -230,7 +229,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Oct 27 2009 * *------------------------------------------------------------------------- @@ -276,7 +274,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 21 2006 * *------------------------------------------------------------------------- @@ -355,7 +352,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Oct 13 2009 * *------------------------------------------------------------------------- @@ -391,7 +387,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Oct 13 2009 * *------------------------------------------------------------------------- @@ -428,7 +423,6 @@ done: * Return: SUCCEED (Can't fail) * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Oct 27 2009 * *------------------------------------------------------------------------- @@ -456,7 +450,6 @@ H5B2__hdr_fuse_incr(H5B2_hdr_t *hdr) * Return: The file's reference count after the decrement. (Can't fail) * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Oct 27 2009 * *------------------------------------------------------------------------- @@ -485,7 +478,6 @@ H5B2__hdr_fuse_decr(H5B2_hdr_t *hdr) * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Oct 13 2009 * *------------------------------------------------------------------------- @@ -517,7 +509,6 @@ done: * Return: Non-NULL pointer to header on success/NULL on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Dec 18 2015 * *------------------------------------------------------------------------- @@ -582,7 +573,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Dec 18 2015 * *------------------------------------------------------------------------- @@ -614,7 +604,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 2 2005 * *------------------------------------------------------------------------- @@ -691,7 +680,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Oct 15 2009 * *------------------------------------------------------------------------- diff --git a/src/H5B2int.c b/src/H5B2int.c index 53ac835..816d8f8 100644 --- a/src/H5B2int.c +++ b/src/H5B2int.c @@ -15,7 +15,7 @@ * * Created: H5B2int.c * Feb 27 2006 - * Quincey Koziol + * Quincey Koziol * * Purpose: Internal routines for managing v2 B-trees. * @@ -97,7 +97,6 @@ H5FL_SEQ_EXTERN(H5B2_node_info_t); * record to locate is greater than all records to search). * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 3 2005 * *------------------------------------------------------------------------- @@ -141,7 +140,6 @@ done: * Failure: Negative * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 28 2006 * *------------------------------------------------------------------------- @@ -336,7 +334,6 @@ done: * Failure: Negative * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 3 2005 * *------------------------------------------------------------------------- @@ -414,7 +411,6 @@ done: * Failure: Negative * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 9 2005 * *------------------------------------------------------------------------- @@ -658,7 +654,6 @@ done: * Failure: Negative * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 9 2005 * *------------------------------------------------------------------------- @@ -1032,7 +1027,6 @@ done: * Failure: Negative * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 4 2005 * *------------------------------------------------------------------------- @@ -1195,7 +1189,6 @@ done: * Failure: Negative * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 4 2005 * *------------------------------------------------------------------------- @@ -1437,7 +1430,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Dec 23 2015 * *------------------------------------------------------------------------- @@ -1497,7 +1489,6 @@ done: * Return: Value from callback, non-negative on success, negative on error * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 11 2005 * *------------------------------------------------------------------------- @@ -1612,7 +1603,6 @@ done: * Return: Value from callback, non-negative on success, negative on error * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 9 2005 * *------------------------------------------------------------------------- @@ -1779,7 +1769,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@lbl.gov * Dec 1 2016 * *------------------------------------------------------------------------- @@ -1877,7 +1866,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@lbl.gov * Dec 1 2016 * *------------------------------------------------------------------------- diff --git a/src/H5B2internal.c b/src/H5B2internal.c index 1fee0af..82f676f 100644 --- a/src/H5B2internal.c +++ b/src/H5B2internal.c @@ -15,7 +15,7 @@ * * Created: H5B2internal.c * Dec 01 2016 - * Quincey Koziol + * Quincey Koziol * * Purpose: Routines for managing v2 B-tree internal ndoes. * @@ -87,7 +87,6 @@ H5FL_DEFINE(H5B2_internal_t); * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 3 2005 * *------------------------------------------------------------------------- @@ -183,7 +182,6 @@ done: * Return: Pointer to internal node on success/NULL on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 25 2006 * *------------------------------------------------------------------------- @@ -277,7 +275,6 @@ done: * Return: Non-negative on success, negative on failure. * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 9 2005 * *------------------------------------------------------------------------- @@ -350,7 +347,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 2 2005 * *------------------------------------------------------------------------- @@ -513,7 +509,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Dec 24 2015 * *------------------------------------------------------------------------- @@ -782,7 +777,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 3 2005 * *------------------------------------------------------------------------- @@ -1015,7 +1009,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Nov 14 2006 * *------------------------------------------------------------------------- @@ -1300,7 +1293,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 2 2005 * *------------------------------------------------------------------------- @@ -1349,7 +1341,6 @@ done: * Return: Non-negative on success, negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 19 2005 * *------------------------------------------------------------------------- @@ -1390,7 +1381,6 @@ H5B2__assert_internal(hsize_t parent_all_nrec, const H5B2_hdr_t H5_ATTR_NDEBUG_U * Return: Non-negative on success, negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 19 2005 * *------------------------------------------------------------------------- diff --git a/src/H5B2leaf.c b/src/H5B2leaf.c index 1fde36d..d2cfbe0 100644 --- a/src/H5B2leaf.c +++ b/src/H5B2leaf.c @@ -15,7 +15,7 @@ * * Created: H5B2leaf.c * Dec 01 2016 - * Quincey Koziol + * Quincey Koziol * * Purpose: Routines for managing v2 B-tree leaf ndoes. * @@ -88,7 +88,6 @@ H5FL_DEFINE(H5B2_leaf_t); * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 2 2005 * *------------------------------------------------------------------------- @@ -174,7 +173,6 @@ done: * Return: Pointer to leaf node on success/NULL on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * May 5 2010 * *------------------------------------------------------------------------- @@ -266,7 +264,6 @@ done: * Return: Non-negative on success, negative on failure. * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 9 2005 * *------------------------------------------------------------------------- @@ -340,7 +337,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 3 2005 * *------------------------------------------------------------------------- @@ -453,7 +449,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Dec 23 2015 * *------------------------------------------------------------------------- @@ -608,7 +603,6 @@ done: * Failure: Negative * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 4 2005 * *------------------------------------------------------------------------- @@ -765,14 +759,14 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 3 2005 * *------------------------------------------------------------------------- */ herr_t H5B2__remove_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr, - H5B2_nodepos_t curr_pos, void *parent, void *udata, H5B2_remove_t op, void *op_data) + H5B2_nodepos_t curr_pos, void *parent, 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 */ @@ -874,7 +868,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Nov 14 2006 * *------------------------------------------------------------------------- @@ -976,7 +969,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 2 2005 * *------------------------------------------------------------------------- @@ -1021,7 +1013,6 @@ done: * Return: Non-negative on success, negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 19 2005 * *------------------------------------------------------------------------- @@ -1045,7 +1036,6 @@ H5B2__assert_leaf(const H5B2_hdr_t H5_ATTR_NDEBUG_UNUSED *hdr, * Return: Non-negative on success, negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 19 2005 * *------------------------------------------------------------------------- diff --git a/src/H5B2module.h b/src/H5B2module.h index 35c982c..6e8c92a 100644 --- a/src/H5B2module.h +++ b/src/H5B2module.h @@ -11,7 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, September 12, 2015 * * Purpose: This file contains declarations which define macros for the diff --git a/src/H5B2pkg.h b/src/H5B2pkg.h index 338db5a..7d73752 100644 --- a/src/H5B2pkg.h +++ b/src/H5B2pkg.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, January 31, 2005 * * Purpose: This file contains declarations which are visible only within diff --git a/src/H5B2private.h b/src/H5B2private.h index 0b64381..9303d4f 100644 --- a/src/H5B2private.h +++ b/src/H5B2private.h @@ -15,7 +15,7 @@ * * Created: H5B2private.h * Jan 31 2005 - * Quincey Koziol + * Quincey Koziol * * Purpose: Private header for library accessible B-tree routines. * diff --git a/src/H5B2stat.c b/src/H5B2stat.c index 5dd9cc2..5c09b3d 100644 --- a/src/H5B2stat.c +++ b/src/H5B2stat.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol +/* Programmer: Quincey Koziol * Monday, March 6, 2006 * * Purpose: v2 B-tree metadata statistics functions. diff --git a/src/H5B2test.c b/src/H5B2test.c index 7affd49..ee37c54 100644 --- a/src/H5B2test.c +++ b/src/H5B2test.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol +/* Programmer: Quincey Koziol * Thursday, February 3, 2005 * * Purpose: v2 B-tree testing functions. diff --git a/src/H5Bcache.c b/src/H5Bcache.c index c2c7a80..80fb200 100644 --- a/src/H5Bcache.c +++ b/src/H5Bcache.c @@ -15,7 +15,7 @@ * * Created: H5Bcache.c * Oct 31 2005 - * Quincey Koziol + * Quincey Koziol * * Purpose: Implement B-tree metadata cache methods. * @@ -98,7 +98,6 @@ const H5AC_class_t H5AC_BT[1] = {{ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * May 18, 2010 * *------------------------------------------------------------------------- @@ -135,7 +134,6 @@ H5B__cache_get_initial_load_size(void *_udata, size_t *image_len) * Failure: NULL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Mar 24, 2008 * *------------------------------------------------------------------------- @@ -241,7 +239,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * May 20, 2010 * *------------------------------------------------------------------------- @@ -277,7 +274,6 @@ H5B__cache_image_len(const void *_thing, size_t *image_len) * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Mar 24, 2008 * *------------------------------------------------------------------------- @@ -363,7 +359,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Mar 26, 2008 * *------------------------------------------------------------------------- diff --git a/src/H5Bdbg.c b/src/H5Bdbg.c index 665e826..d900852 100644 --- a/src/H5Bdbg.c +++ b/src/H5Bdbg.c @@ -13,11 +13,11 @@ /*------------------------------------------------------------------------- * - * Created: H5Bdbg.c - * Dec 11 2008 - * Quincey Koziol + * Created: H5Bdbg.c + * Dec 11 2008 + * Quincey Koziol * - * Purpose: Debugging routines for B-link tree package. + * Purpose: Debugging routines for B-link tree package. * *------------------------------------------------------------------------- */ @@ -32,35 +32,33 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Bpkg.h" /* B-link trees */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5MMprivate.h" /* Memory management */ +#include "H5private.h" /* Generic Functions */ +#include "H5Bpkg.h" /* B-link trees */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5MMprivate.h" /* Memory management */ /*------------------------------------------------------------------------- - * Function: H5B_debug + * Function: H5B_debug * - * Purpose: Prints debugging info about a B-tree. + * Purpose: Prints debugging info about a B-tree. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Aug 4 1997 + * Programmer: Robb Matzke + * Aug 4 1997 * *------------------------------------------------------------------------- */ herr_t -H5B_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, - const H5B_class_t *type, void *udata) +H5B_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, const H5B_class_t *type, void *udata) { - H5B_t *bt = NULL; - H5UC_t *rc_shared; /* Ref-counted shared info */ + H5B_t *bt = NULL; + H5UC_t *rc_shared; /* Ref-counted shared info */ H5B_shared_t *shared; /* Pointer to shared B-tree info */ H5B_cache_ud_t cache_udata; /* User-data for metadata cache callback */ - unsigned u; /* Local index variable */ + unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -97,55 +95,53 @@ H5B_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, * Print the values. */ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, - "Tree type ID:", - ((shared->type->id) == H5B_SNODE_ID ? "H5B_SNODE_ID" : + "Tree type ID:", + ((shared->type->id) == H5B_SNODE_ID ? "H5B_SNODE_ID" : ((shared->type->id) == H5B_CHUNK_ID ? "H5B_CHUNK_ID" : "Unknown!"))); HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, - "Size of node:", - shared->sizeof_rnode); + "Size of node:", + shared->sizeof_rnode); HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, - "Size of raw (disk) key:", - shared->sizeof_rkey); + "Size of raw (disk) key:", + shared->sizeof_rkey); HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, - "Dirty flag:", - bt->cache_info.is_dirty ? "True" : "False"); + "Dirty flag:", + bt->cache_info.is_dirty ? "True" : "False"); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "Level:", - bt->level); + "Level:", + bt->level); HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, - "Address of left sibling:", - bt->left); + "Address of left sibling:", + bt->left); HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, - "Address of right sibling:", - bt->right); + "Address of right sibling:", + bt->right); HDfprintf(stream, "%*s%-*s %u (%u)\n", indent, "", fwidth, - "Number of children (max):", - bt->nchildren, shared->two_k); + "Number of children (max):", + bt->nchildren, shared->two_k); /* * Print the child addresses */ for(u = 0; u < bt->nchildren; u++) { - HDfprintf(stream, "%*sChild %d...\n", indent, "", u); - HDfprintf(stream, "%*s%-*s %a\n", indent + 3, "", MAX(0, fwidth - 3), - "Address:", bt->child[u]); + HDfprintf(stream, "%*sChild %d...\n", indent, "", u); + HDfprintf(stream, "%*s%-*s %a\n", indent + 3, "", MAX(0, fwidth - 3), + "Address:", bt->child[u]); /* If there is a key debugging routine, use it to display the left & right keys */ - if(type->debug_key) { + if(type->debug_key) { /* Decode the 'left' key & print it */ HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3), "Left Key:"); HDassert(H5B_NKEY(bt,shared,u)); - (void)(type->debug_key)(stream, indent + 6, MAX(0, fwidth - 6), - H5B_NKEY(bt, shared, u), udata); + (void)(type->debug_key)(stream, indent + 6, MAX(0, fwidth - 6), H5B_NKEY(bt, shared, u), udata); /* Decode the 'right' key & print it */ HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3), "Right Key:"); HDassert(H5B_NKEY(bt, shared, u + 1)); - (void)(type->debug_key)(stream, indent + 6, MAX (0, fwidth - 6), - H5B_NKEY(bt, shared, u + 1), udata); - } /* end if */ + (void)(type->debug_key)(stream, indent + 6, MAX (0, fwidth - 6), H5B_NKEY(bt, shared, u + 1), udata); + } /* end if */ } /* end for */ done: @@ -157,16 +153,16 @@ done: /*------------------------------------------------------------------------- - * Function: H5B__assert + * Function: H5B__assert * - * Purpose: Verifies that the tree is structured correctly. + * Purpose: Verifies that the tree is structured correctly. * - * Return: Success: SUCCEED + * Return: Success: SUCCEED * - * Failure: aborts if something is wrong. + * Failure: aborts if something is wrong. * - * Programmer: Robb Matzke - * Tuesday, November 4, 1997 + * Programmer: Robb Matzke + * Tuesday, November 4, 1997 * *------------------------------------------------------------------------- */ @@ -174,20 +170,20 @@ done: herr_t H5B__assert(H5F_t *f, haddr_t addr, const H5B_class_t *type, void *udata) { - H5B_t *bt = NULL; - H5UC_t *rc_shared; /* Ref-counted shared info */ + H5B_t *bt = NULL; + H5UC_t *rc_shared; /* Ref-counted shared info */ H5B_shared_t *shared; /* Pointer to shared B-tree info */ H5B_cache_ud_t cache_udata; /* User-data for metadata cache callback */ - int ncell, cmp; - static int ncalls = 0; - herr_t status; + int ncell, cmp; + static int ncalls = 0; + herr_t status; herr_t ret_value = SUCCEED; /* Return value */ /* A queue of child data */ struct child_t { - haddr_t addr; - unsigned level; - struct child_t *next; + haddr_t addr; + unsigned level; + struct child_t *next; } *head = NULL, *tail = NULL, *prev = NULL, *cur = NULL, *tmp = NULL; FUNC_ENTER_PACKAGE @@ -228,60 +224,60 @@ H5B__assert(H5F_t *f, haddr_t addr, const H5B_class_t *type, void *udata) * test. */ for(ncell = 0; cur; ncell++) { - bt = (H5B_t *)H5AC_protect(f, H5AC_BT, cur->addr, &cache_udata, H5AC__READ_ONLY_FLAG); - HDassert(bt); - - /* Check node header */ - HDassert(bt->level == cur->level); - if(cur->next && cur->next->level == bt->level) - HDassert(H5F_addr_eq(bt->right, cur->next->addr)); - else - HDassert(!H5F_addr_defined(bt->right)); - if(prev && prev->level == bt->level) - HDassert(H5F_addr_eq(bt->left, prev->addr)); - else - HDassert(!H5F_addr_defined(bt->left)); - - if(cur->level > 0) { + bt = (H5B_t *)H5AC_protect(f, H5AC_BT, cur->addr, &cache_udata, H5AC__READ_ONLY_FLAG); + HDassert(bt); + + /* Check node header */ + HDassert(bt->level == cur->level); + if(cur->next && cur->next->level == bt->level) + HDassert(H5F_addr_eq(bt->right, cur->next->addr)); + else + HDassert(!H5F_addr_defined(bt->right)); + if(prev && prev->level == bt->level) + HDassert(H5F_addr_eq(bt->left, prev->addr)); + else + HDassert(!H5F_addr_defined(bt->left)); + + if(cur->level > 0) { unsigned u; - for(u = 0; u < bt->nchildren; u++) { - /* - * Check that child nodes haven't already been seen. If they - * have then the tree has a cycle. - */ - for(tmp = head; tmp; tmp = tmp->next) - HDassert(H5F_addr_ne(tmp->addr, bt->child[u])); - - /* Add the child node to the end of the queue */ - tmp = (struct child_t *)H5MM_calloc(sizeof(struct child_t)); - HDassert(tmp); - tmp->addr = bt->child[u]; - tmp->level = bt->level - 1; - tail->next = tmp; - tail = tmp; - - /* Check that the keys are monotonically increasing */ - cmp = (type->cmp2)(H5B_NKEY(bt, shared, u), udata, H5B_NKEY(bt, shared, u + 1)); - HDassert(cmp < 0); - } /* end for */ - } /* end if */ - - /* Release node */ - status = H5AC_unprotect(f, H5AC_BT, cur->addr, bt, H5AC__NO_FLAGS_SET); - HDassert(status >= 0); + for(u = 0; u < bt->nchildren; u++) { + /* + * Check that child nodes haven't already been seen. If they + * have then the tree has a cycle. + */ + for(tmp = head; tmp; tmp = tmp->next) + HDassert(H5F_addr_ne(tmp->addr, bt->child[u])); + + /* Add the child node to the end of the queue */ + tmp = (struct child_t *)H5MM_calloc(sizeof(struct child_t)); + HDassert(tmp); + tmp->addr = bt->child[u]; + tmp->level = bt->level - 1; + tail->next = tmp; + tail = tmp; + + /* Check that the keys are monotonically increasing */ + cmp = (type->cmp2)(H5B_NKEY(bt, shared, u), udata, H5B_NKEY(bt, shared, u + 1)); + HDassert(cmp < 0); + } /* end for */ + } /* end if */ + + /* Release node */ + status = H5AC_unprotect(f, H5AC_BT, cur->addr, bt, H5AC__NO_FLAGS_SET); + HDassert(status >= 0); bt = NULL; /* Make certain future references will be caught */ - /* Advance current location in queue */ - prev = cur; - cur = cur->next; + /* Advance current location in queue */ + prev = cur; + cur = cur->next; } /* end for */ /* Free all entries from queue */ while(head) { - tmp = head->next; - H5MM_xfree(head); - head = tmp; + tmp = head->next; + H5MM_xfree(head); + head = tmp; } /* end while */ done: diff --git a/src/H5Bmodule.h b/src/H5Bmodule.h index bc46752..c8e1546 100644 --- a/src/H5Bmodule.h +++ b/src/H5Bmodule.h @@ -11,7 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, September 12, 2015 * * Purpose: This file contains declarations which define macros for the diff --git a/src/H5Bpkg.h b/src/H5Bpkg.h index a451cab..a57584e 100644 --- a/src/H5Bpkg.h +++ b/src/H5Bpkg.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, May 15, 2003 * * Purpose: This file contains declarations which are visible only within diff --git a/src/H5Bprivate.h b/src/H5Bprivate.h index 5aa3628..55bf5b3 100644 --- a/src/H5Bprivate.h +++ b/src/H5Bprivate.h @@ -15,12 +15,10 @@ * * Created: H5Bprivate.h * Jul 10 1997 - * Robb Matzke + * Robb Matzke * * Purpose: Private non-prototype header. * - * Modifications: - * *------------------------------------------------------------------------- */ diff --git a/src/H5C.c b/src/H5C.c index 91e4158..2cc417a 100644 --- a/src/H5C.c +++ b/src/H5C.c @@ -147,11 +147,11 @@ static herr_t H5C__flash_increase_cache_size(H5C_t * cache_ptr, static herr_t H5C__flush_invalidate_cache(H5F_t *f, unsigned flags); -static herr_t H5C_flush_invalidate_ring(H5F_t *f, H5C_ring_t ring, unsigned flags); +static herr_t H5C__flush_invalidate_ring(H5F_t *f, H5C_ring_t ring, unsigned flags); static herr_t H5C__flush_ring(H5F_t *f, H5C_ring_t ring, unsigned flags); -static void * H5C_load_entry(H5F_t * f, +static void * H5C__load_entry(H5F_t * f, #ifdef H5_HAVE_PARALLEL hbool_t coll_access, #endif /* H5_HAVE_PARALLEL */ @@ -166,19 +166,20 @@ static herr_t H5C__mark_flush_dep_clean(H5C_cache_entry_t * entry); static herr_t H5C__serialize_ring(H5F_t *f, H5C_ring_t ring); static herr_t H5C__serialize_single_entry(H5F_t *f, H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr); - +static herr_t H5C__generate_image(H5F_t *f, H5C_t *cache_ptr, + H5C_cache_entry_t *entry_ptr); static herr_t H5C__verify_len_eoa(H5F_t *f, const H5C_class_t * type, haddr_t addr, size_t *len, hbool_t actual); #if H5C_DO_SLIST_SANITY_CHECKS -static hbool_t H5C_entry_in_skip_list(H5C_t * cache_ptr, +static hbool_t H5C__entry_in_skip_list(H5C_t * cache_ptr, H5C_cache_entry_t *target_ptr); #endif /* H5C_DO_SLIST_SANITY_CHECKS */ #if H5C_DO_EXTREME_SANITY_CHECKS -static herr_t H5C_validate_lru_list(H5C_t * cache_ptr); -static herr_t H5C_validate_pinned_entry_list(H5C_t * cache_ptr); -static herr_t H5C_validate_protected_entry_list(H5C_t * cache_ptr); +static herr_t H5C__validate_lru_list(H5C_t * cache_ptr); +static herr_t H5C__validate_pinned_entry_list(H5C_t * cache_ptr); +static herr_t H5C__validate_protected_entry_list(H5C_t * cache_ptr); #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ #ifndef NDEBUG @@ -237,6 +238,82 @@ H5FL_SEQ_DEFINE_STATIC(H5C_cache_entry_ptr_t); * Programmer: John Mainzer * 6/2/04 * + * Modifications: + * + * JRM -- 7/20/04 + * Updated for the addition of the hash table. + * + * JRM -- 10/5/04 + * Added call to H5C_reset_cache_hit_rate_stats(). Also + * added initialization for cache_is_full flag and for + * resize_ctl. + * + * JRM -- 11/12/04 + * Added initialization for the new size_decreased field. + * + * JRM -- 11/17/04 + * Added/updated initialization for the automatic cache + * size control data structures. + * + * JRM -- 6/24/05 + * Added support for the new write_permitted field of + * the H5C_t structure. + * + * JRM -- 7/5/05 + * Added the new log_flush parameter and supporting code. + * + * JRM -- 9/21/05 + * Added the new aux_ptr parameter and supporting code. + * + * JRM -- 1/20/06 + * Added initialization of the new prefix field in H5C_t. + * + * JRM -- 3/16/06 + * Added initialization for the pinned entry related fields. + * + * JRM -- 5/31/06 + * Added initialization for the trace_file_ptr field. + * + * JRM -- 8/19/06 + * Added initialization for the flush_in_progress field. + * + * JRM -- 8/25/06 + * Added initialization for the slist_len_increase and + * slist_size_increase fields. These fields are used + * for sanity checking in the flush process, and are not + * compiled in unless H5C_DO_SANITY_CHECKS is TRUE. + * + * JRM -- 3/28/07 + * Added initialization for the new is_read_only and + * ro_ref_count fields. + * + * JRM -- 7/27/07 + * Added initialization for the new evictions_enabled + * field of H5C_t. + * + * JRM -- 12/31/07 + * Added initialization for the new flash cache size increase + * related fields of H5C_t. + * + * JRM -- 11/5/08 + * Added initialization for the new clean_index_size and + * dirty_index_size fields of H5C_t. + * + * + * Missing entries? + * + * + * JRM -- 4/20/20 + * Added initialization for the slist_enabled field. Recall + * that the slist is used to flush metadata cache entries + * in (roughly) increasing address order. While this is + * needed at flush and close, it is not used elsewhere. + * The slist_enabled field exists to allow us to construct + * the slist when needed, and leave it empty otherwise -- thus + * avoiding the overhead of maintaining it. + * + * JRM -- 4/29/20 + * *------------------------------------------------------------------------- */ H5C_t * @@ -311,30 +388,36 @@ H5C_create(size_t max_cache_size, cache_ptr->dirty_index_size = (size_t)0; for(i = 0; i < H5C_RING_NTYPES; i++) { - cache_ptr->index_ring_len[i] = 0; - cache_ptr->index_ring_size[i] = (size_t)0; - cache_ptr->clean_index_ring_size[i] = (size_t)0; - cache_ptr->dirty_index_ring_size[i] = (size_t)0; + cache_ptr->index_ring_len[i] = 0; + cache_ptr->index_ring_size[i] = (size_t)0; + cache_ptr->clean_index_ring_size[i] = (size_t)0; + cache_ptr->dirty_index_ring_size[i] = (size_t)0; - cache_ptr->slist_ring_len[i] = 0; - cache_ptr->slist_ring_size[i] = (size_t)0; + cache_ptr->slist_ring_len[i] = 0; + cache_ptr->slist_ring_size[i] = (size_t)0; } /* end for */ for(i = 0; i < H5C__HASH_TABLE_LEN; i++) (cache_ptr->index)[i] = NULL; - cache_ptr->il_len = 0; - cache_ptr->il_size = (size_t)0; - cache_ptr->il_head = NULL; - cache_ptr->il_tail = NULL; + cache_ptr->il_len = 0; + cache_ptr->il_size = (size_t)0; + cache_ptr->il_head = NULL; + cache_ptr->il_tail = NULL; /* Tagging Field Initializations */ cache_ptr->ignore_tags = FALSE; cache_ptr->num_objs_corked = 0; - cache_ptr->slist_changed = FALSE; - cache_ptr->slist_len = 0; - cache_ptr->slist_size = (size_t)0; + /* slist field initializations */ + cache_ptr->slist_enabled = ! H5C__SLIST_OPT_ENABLED; + cache_ptr->slist_changed = FALSE; + cache_ptr->slist_len = 0; + cache_ptr->slist_size = (size_t)0; + + /* slist_ring_len, slist_ring_size, and + * slist_ptr initializaed above. + */ #if H5C_DO_SANITY_CHECKS cache_ptr->slist_len_increase = 0; @@ -406,17 +489,17 @@ H5C_create(size_t max_cache_size, (cache_ptr->resize_ctl).max_increment = H5C__DEF_AR_MAX_INCREMENT; (cache_ptr->resize_ctl).flash_incr_mode = H5C_flash_incr__off; - (cache_ptr->resize_ctl).flash_multiple = 1.0f; - (cache_ptr->resize_ctl).flash_threshold = 0.25f; + (cache_ptr->resize_ctl).flash_multiple = (double)1.0f; + (cache_ptr->resize_ctl).flash_threshold = (double)0.25f; (cache_ptr->resize_ctl).decr_mode = H5C_decr__off; - (cache_ptr->resize_ctl).upper_hr_threshold = H5C__DEF_AR_UPPER_THRESHHOLD; - (cache_ptr->resize_ctl).decrement = H5C__DEF_AR_DECREMENT; + (cache_ptr->resize_ctl).upper_hr_threshold = (double)H5C__DEF_AR_UPPER_THRESHHOLD; + (cache_ptr->resize_ctl).decrement = (double)H5C__DEF_AR_DECREMENT; (cache_ptr->resize_ctl).apply_max_decrement = TRUE; (cache_ptr->resize_ctl).max_decrement = H5C__DEF_AR_MAX_DECREMENT; (cache_ptr->resize_ctl).epochs_before_eviction = H5C__DEF_AR_EPCHS_B4_EVICT; (cache_ptr->resize_ctl).apply_empty_reserve = TRUE; - (cache_ptr->resize_ctl).empty_reserve = H5C__DEF_AR_EMPTY_RESERVE; + (cache_ptr->resize_ctl).empty_reserve = (double)H5C__DEF_AR_EMPTY_RESERVE; cache_ptr->epoch_markers_active = 0; @@ -691,7 +774,7 @@ H5C_def_auto_resize_rpt_fcn(H5C_t * cache_ptr, /*------------------------------------------------------------------------- - * Function: H5C_free_tag_list_cb + * Function: H5C__free_tag_list_cb * * Purpose: Callback function to free tag nodes from the skip list. * @@ -703,11 +786,11 @@ H5C_def_auto_resize_rpt_fcn(H5C_t * cache_ptr, *------------------------------------------------------------------------- */ static herr_t -H5C_free_tag_list_cb(void *_item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSED *op_data) +H5C__free_tag_list_cb(void *_item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSED *op_data) { H5C_tag_info_t *tag_info = (H5C_tag_info_t *)_item; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(tag_info); @@ -715,7 +798,7 @@ H5C_free_tag_list_cb(void *_item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSED tag_info = H5FL_FREE(H5C_tag_info_t, tag_info); FUNC_LEAVE_NOAPI(0) -} /* H5C_free_tag_list_cb() */ +} /* H5C__free_tag_list_cb() */ /*------------------------------------------------------------------------- @@ -828,6 +911,20 @@ done: * Programmer: John Mainzer * 6/2/04 * + * Modifications: + * + * JRM -- 5/15/20 + * + * Updated the function to enable the slist prior to the + * call to H5C__flush_invalidate_cache(). + * + * Arguably, it shouldn't be necessary to re-enable the + * slist after the call to H5C__flush_invalidate_cache(), as + * the metadata cache should be discarded. However, in the + * test code, we make multiple calls to H5C_dest(). Thus + * we re-enable the slist on failure if it and the cache + * still exist. + * *------------------------------------------------------------------------- */ herr_t @@ -848,33 +945,61 @@ H5C_dest(H5F_t * f) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't display cache image stats") #endif /* H5AC_DUMP_IMAGE_STATS_ON_CLOSE */ + /* Enable the slist, as it is needed in the flush */ + if ( H5C_set_slist_enabled(f->shared->cache, TRUE, FALSE) < 0 ) + + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "set slist enabled failed") + /* Flush and invalidate all cache entries */ - if(H5C__flush_invalidate_cache(f, H5C__NO_FLAGS_SET) < 0 ) + if ( H5C__flush_invalidate_cache(f, H5C__NO_FLAGS_SET) < 0 ) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush cache") /* Generate & write cache image if requested */ - if(cache_ptr->image_ctl.generate_image) - if(H5C__generate_cache_image(f, cache_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "Can't generate metadata cache image") + if ( cache_ptr->image_ctl.generate_image ) { + + if ( H5C__generate_cache_image(f, cache_ptr) < 0 ) + + HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, \ + "Can't generate metadata cache image") + } + + /* Question: Is it possible for cache_ptr->slist be non-null at this + * point? If no, shouldn't this if statement be an assert? + */ + if ( cache_ptr->slist_ptr != NULL ) { + + HDassert(cache_ptr->slist_len == 0); + HDassert(cache_ptr->slist_size == 0); - if(cache_ptr->slist_ptr != NULL) { H5SL_close(cache_ptr->slist_ptr); + cache_ptr->slist_ptr = NULL; + } /* end if */ if(cache_ptr->tag_list != NULL) { - H5SL_destroy(cache_ptr->tag_list, H5C_free_tag_list_cb, NULL); + + H5SL_destroy(cache_ptr->tag_list, H5C__free_tag_list_cb, NULL); + cache_ptr->tag_list = NULL; + } /* end if */ - if(cache_ptr->log_info != NULL) + if(cache_ptr->log_info != NULL) { + H5MM_xfree(cache_ptr->log_info); + } #ifndef NDEBUG #if H5C_DO_SANITY_CHECKS - if(cache_ptr->get_entry_ptr_from_addr_counter > 0) - HDfprintf(stdout, "*** %ld calls to H5C_get_entry_ptr_from_add(). ***\n", - cache_ptr->get_entry_ptr_from_addr_counter); + + if ( cache_ptr->get_entry_ptr_from_addr_counter > 0 ) { + + HDfprintf(stdout, + "*** %ld calls to H5C_get_entry_ptr_from_add(). ***\n", + cache_ptr->get_entry_ptr_from_addr_counter); + } #endif /* H5C_DO_SANITY_CHECKS */ cache_ptr->magic = 0; @@ -883,7 +1008,19 @@ H5C_dest(H5F_t * f) cache_ptr = H5FL_FREE(H5C_t, cache_ptr); done: + + if ( ( ret_value < 0 ) && ( cache_ptr ) && ( cache_ptr->slist_ptr ) ) { + + /* need this for test code -- see change note for details */ + + if ( H5C_set_slist_enabled(f->shared->cache, FALSE, FALSE) < 0 ) + + HDONE_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "disable slist on flush dest failure failed") + } + FUNC_LEAVE_NOAPI(ret_value) + } /* H5C_dest() */ @@ -897,6 +1034,14 @@ done: * Programmer: Vailin Choi * Dec 2013 * + * Modifications: + * + * JRM -- 5/5/20 + * + * Added code to enable the skip list prior to the call + * to H5C__flush_invalidate_cache(), and disable it + * afterwards. + * *------------------------------------------------------------------------- */ herr_t @@ -909,9 +1054,22 @@ H5C_evict(H5F_t * f) /* Sanity check */ HDassert(f); + /* Enable the slist, as it is needed in the flush */ + if ( H5C_set_slist_enabled(f->shared->cache, TRUE, FALSE) < 0 ) + + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "set slist enabled failed") + /* Flush and invalidate all cache entries except the pinned entries */ - if(H5C__flush_invalidate_cache(f, H5C__EVICT_ALLOW_LAST_PINS_FLAG) < 0 ) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to evict entries in the cache") + if ( H5C__flush_invalidate_cache(f, H5C__EVICT_ALLOW_LAST_PINS_FLAG) < 0 ) + + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, + "unable to evict entries in the cache") + + /* Disable the slist, + */ + if ( H5C_set_slist_enabled(f->shared->cache, FALSE, TRUE) < 0) + + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "set slist disabled failed") done: FUNC_LEAVE_NOAPI(ret_value) @@ -951,7 +1109,7 @@ H5C_expunge_entry(H5F_t *f, const H5C_class_t *type, haddr_t addr, unsigned flag HDassert(H5F_addr_defined(addr)); #if H5C_DO_EXTREME_SANITY_CHECKS - if(H5C_validate_lru_list(cache_ptr) < 0) + if(H5C__validate_lru_list(cache_ptr) < 0) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "LRU extreme sanity check failed on entry") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ @@ -986,7 +1144,7 @@ H5C_expunge_entry(H5F_t *f, const H5C_class_t *type, haddr_t addr, unsigned flag done: #if H5C_DO_EXTREME_SANITY_CHECKS - if(H5C_validate_lru_list(cache_ptr) < 0) + if(H5C__validate_lru_list(cache_ptr) < 0) HDONE_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "LRU extreme sanity check failed on exit") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ @@ -1094,9 +1252,9 @@ H5C_flush_cache(H5F_t *f, unsigned flags) #endif /* H5C_DO_SANITY_CHECKS */ #if H5C_DO_EXTREME_SANITY_CHECKS - if((H5C_validate_protected_entry_list(cache_ptr) < 0) || - (H5C_validate_pinned_entry_list(cache_ptr) < 0) || - (H5C_validate_lru_list(cache_ptr) < 0)) + if((H5C__validate_protected_entry_list(cache_ptr) < 0) || + (H5C__validate_pinned_entry_list(cache_ptr) < 0) || + (H5C__validate_lru_list(cache_ptr) < 0)) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ @@ -1277,9 +1435,9 @@ H5C_insert_entry(H5F_t * f, #if H5C_DO_EXTREME_SANITY_CHECKS /* no need to verify that entry is not already in the index as */ /* we already make that check below. */ - if((H5C_validate_protected_entry_list(cache_ptr) < 0) || - (H5C_validate_pinned_entry_list(cache_ptr) < 0) || - (H5C_validate_lru_list(cache_ptr) < 0)) + if((H5C__validate_protected_entry_list(cache_ptr) < 0) || + (H5C__validate_pinned_entry_list(cache_ptr) < 0) || + (H5C__validate_lru_list(cache_ptr) < 0)) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ @@ -1468,9 +1626,9 @@ H5C_insert_entry(H5F_t * f, H5C__UPDATE_RP_FOR_INSERTION(cache_ptr, entry_ptr, FAIL) #if H5C_DO_EXTREME_SANITY_CHECKS - if((H5C_validate_protected_entry_list(cache_ptr) < 0) || - (H5C_validate_pinned_entry_list(cache_ptr) < 0) || - (H5C_validate_lru_list(cache_ptr) < 0)) + if((H5C__validate_protected_entry_list(cache_ptr) < 0) || + (H5C__validate_pinned_entry_list(cache_ptr) < 0) || + (H5C__validate_lru_list(cache_ptr) < 0)) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed just before done") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ @@ -1500,9 +1658,9 @@ H5C_insert_entry(H5F_t * f, done: #if H5C_DO_EXTREME_SANITY_CHECKS - if((H5C_validate_protected_entry_list(cache_ptr) < 0) || - (H5C_validate_pinned_entry_list(cache_ptr) < 0) || - (H5C_validate_lru_list(cache_ptr) < 0)) + if((H5C__validate_protected_entry_list(cache_ptr) < 0) || + (H5C__validate_pinned_entry_list(cache_ptr) < 0) || + (H5C__validate_lru_list(cache_ptr) < 0)) HDONE_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on exit") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ @@ -1828,9 +1986,9 @@ H5C_move_entry(H5C_t * cache_ptr, HDassert(H5F_addr_ne(old_addr, new_addr)); #if H5C_DO_EXTREME_SANITY_CHECKS - if((H5C_validate_protected_entry_list(cache_ptr) < 0) || - (H5C_validate_pinned_entry_list(cache_ptr) < 0) || - (H5C_validate_lru_list(cache_ptr) < 0)) + if((H5C__validate_protected_entry_list(cache_ptr) < 0) || + (H5C__validate_pinned_entry_list(cache_ptr) < 0) || + (H5C__validate_lru_list(cache_ptr) < 0)) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ @@ -1932,9 +2090,9 @@ H5C_move_entry(H5C_t * cache_ptr, done: #if H5C_DO_EXTREME_SANITY_CHECKS - if((H5C_validate_protected_entry_list(cache_ptr) < 0) || - (H5C_validate_pinned_entry_list(cache_ptr) < 0) || - (H5C_validate_lru_list(cache_ptr) < 0)) + if((H5C__validate_protected_entry_list(cache_ptr) < 0) || + (H5C__validate_pinned_entry_list(cache_ptr) < 0) || + (H5C__validate_lru_list(cache_ptr) < 0)) HDONE_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on exit") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ @@ -1981,8 +2139,8 @@ H5C_resize_entry(void *thing, size_t new_size) HGOTO_ERROR(H5E_CACHE, H5E_BADTYPE, FAIL, "Entry isn't pinned or protected??") #if H5C_DO_EXTREME_SANITY_CHECKS - if((H5C_validate_protected_entry_list(cache_ptr) < 0) || - (H5C_validate_pinned_entry_list(cache_ptr) < 0)) + if((H5C__validate_protected_entry_list(cache_ptr) < 0) || + (H5C__validate_pinned_entry_list(cache_ptr) < 0)) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ @@ -2081,8 +2239,8 @@ H5C_resize_entry(void *thing, size_t new_size) done: #if H5C_DO_EXTREME_SANITY_CHECKS - if((H5C_validate_protected_entry_list(cache_ptr) < 0) || - (H5C_validate_pinned_entry_list(cache_ptr) < 0)) + if((H5C__validate_protected_entry_list(cache_ptr) < 0) || + (H5C__validate_pinned_entry_list(cache_ptr) < 0)) HDONE_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on exit") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ @@ -2123,9 +2281,9 @@ H5C_pin_protected_entry(void *thing) HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); #if H5C_DO_EXTREME_SANITY_CHECKS - if((H5C_validate_protected_entry_list(cache_ptr) < 0) || - (H5C_validate_pinned_entry_list(cache_ptr) < 0) || - (H5C_validate_lru_list(cache_ptr) < 0)) + if((H5C__validate_protected_entry_list(cache_ptr) < 0) || + (H5C__validate_pinned_entry_list(cache_ptr) < 0) || + (H5C__validate_lru_list(cache_ptr) < 0)) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ @@ -2140,9 +2298,9 @@ H5C_pin_protected_entry(void *thing) done: #if H5C_DO_EXTREME_SANITY_CHECKS - if((H5C_validate_protected_entry_list(cache_ptr) < 0) || - (H5C_validate_pinned_entry_list(cache_ptr) < 0) || - (H5C_validate_lru_list(cache_ptr) < 0)) + if((H5C__validate_protected_entry_list(cache_ptr) < 0) || + (H5C__validate_pinned_entry_list(cache_ptr) < 0) || + (H5C__validate_lru_list(cache_ptr) < 0)) HDONE_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on exit") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ @@ -2210,9 +2368,9 @@ H5C_protect(H5F_t * f, HDassert( H5F_addr_defined(addr) ); #if H5C_DO_EXTREME_SANITY_CHECKS - if((H5C_validate_protected_entry_list(cache_ptr) < 0) || - (H5C_validate_pinned_entry_list(cache_ptr) < 0) || - (H5C_validate_lru_list(cache_ptr) < 0)) + if((H5C__validate_protected_entry_list(cache_ptr) < 0) || + (H5C__validate_pinned_entry_list(cache_ptr) < 0) || + (H5C__validate_lru_list(cache_ptr) < 0)) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, NULL, "an extreme sanity check failed on entry") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ @@ -2338,7 +2496,7 @@ H5C_protect(H5F_t * f, hit = FALSE; - if(NULL == (thing = H5C_load_entry(f, + if(NULL == (thing = H5C__load_entry(f, #ifdef H5_HAVE_PARALLEL coll_access, #endif /* H5_HAVE_PARALLEL */ @@ -2592,9 +2750,9 @@ H5C_protect(H5F_t * f, done: #if H5C_DO_EXTREME_SANITY_CHECKS - if((H5C_validate_protected_entry_list(cache_ptr) < 0) || - (H5C_validate_pinned_entry_list(cache_ptr) < 0) || - (H5C_validate_lru_list(cache_ptr) < 0)) + if((H5C__validate_protected_entry_list(cache_ptr) < 0) || + (H5C__validate_pinned_entry_list(cache_ptr) < 0) || + (H5C__validate_lru_list(cache_ptr) < 0)) HDONE_ERROR(H5E_CACHE, H5E_SYSTEM, NULL, "an extreme sanity check failed on exit") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ @@ -2879,6 +3037,179 @@ done: /*------------------------------------------------------------------------- + * + * Function: H5C_set_slist_enabled() + * + * Purpose: Enable or disable the slist as directed. + * + * The slist (skip list) is an address ordered list of + * dirty entries in the metadata cache. However, this + * list is only needed during flush and close, where we + * use it to write entries in more or less increasing + * address order. + * + * This function sets up and enables further operations + * on the slist, or disable the slist. This in turn + * allows us to avoid the overhead of maintaining the + * slist when it is not needed. + * + * + * If the slist_enabled parameter is TRUE, the function + * + * 1) Verifies that the slist is empty. + * + * 2) Scans the index list, and inserts all dirty entries + * into the slist. + * + * 3) Sets cache_ptr->slist_enabled = TRUE. + * + * Note that the clear_slist parameter is ignored if + * the slist_enabed parameter is TRUE. + * + * + * If the slist_enabled_parameter is FALSE, the function + * shuts down the slist. + * + * Normally the slist will be empty at this point, however + * that need not be the case if H5C_flush_cache() has been + * called with the H5C__FLUSH_MARKED_ENTRIES_FLAG. + * + * Thus shutdown proceeds as follows: + * + * 1) Test to see if the slist is empty. If it is, proceed + * to step 3. + * + * 2) Test to see if the clear_slist parameter is TRUE. + * + * If it is, remove all entries from the slist. + * + * If it isn't, throw an error. + * + * 3) set cache_ptr->slist_enabled = FALSE. + * + * Return: SUCCEED on success, and FAIL on failure. + * + * Programmer: John Mainzer + * 5/1/20 + * + * Modifications: + * + * None. + * + *------------------------------------------------------------------------- + */ +herr_t +H5C_set_slist_enabled(H5C_t *cache_ptr, hbool_t slist_enabled, + hbool_t clear_slist) +{ + H5C_cache_entry_t * entry_ptr; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + if ( ( cache_ptr == NULL ) || ( cache_ptr->magic != H5C__H5C_T_MAGIC ) ) + + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr on entry") + +#if H5C__SLIST_OPT_ENABLED + + if ( slist_enabled ) { + + if ( cache_ptr->slist_enabled ) { + + HDassert(FALSE); + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "slist already enabled?") + } + + if ( ( cache_ptr->slist_len != 0 ) || + ( cache_ptr->slist_size != 0 ) ) { + + HDassert(FALSE); + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "slist not empty (1)?") + } + + + /* set cache_ptr->slist_enabled to TRUE so that the slist + * mainenance macros will be enabled. + */ + cache_ptr->slist_enabled = TRUE; + + + /* scan the index list and insert all dirty entries in the slist */ + entry_ptr = cache_ptr->il_head; + + while ( entry_ptr != NULL ) { + + HDassert( entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC ); + + if ( entry_ptr->is_dirty ) { + + H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, FAIL) + } + + entry_ptr = entry_ptr->il_next; + } + + /* we don't maintain a dirty index len, so we can't do a cross + * check against it. Note that there is no point in cross checking + * against the dirty LRU size, as the dirty LRU may not be maintained, + * and in any case, there is no requirement that all dirty entries + * will reside on the dirty LRU. + */ + HDassert( cache_ptr->dirty_index_size == cache_ptr->slist_size ); + + } else { /* take down the skip list */ + + if ( ! cache_ptr->slist_enabled ) { + + HDassert(FALSE); + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "slist already disabled?") + } + + if ( ( cache_ptr->slist_len != 0 ) || + ( cache_ptr->slist_size != 0 ) ) { + + if ( clear_slist ) { + + H5SL_node_t *node_ptr; + + node_ptr = H5SL_first(cache_ptr->slist_ptr); + + while ( node_ptr != NULL ) { + + entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr); + + H5C__REMOVE_ENTRY_FROM_SLIST(cache_ptr, entry_ptr, FALSE); + + node_ptr = H5SL_first(cache_ptr->slist_ptr); + } + } else { + + HDassert(FALSE); + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "slist not empty (2)?") + } + } + + cache_ptr->slist_enabled = FALSE; + + HDassert( 0 == cache_ptr->slist_len ); + HDassert( 0 == cache_ptr->slist_size ); + } + +#else /* H5C__SLIST_OPT_ENABLED is FALSE */ + + HDassert(cache_ptr->slist_enabled); + +#endif /* H5C__SLIST_OPT_ENABLED is FALSE */ + +done: + + FUNC_LEAVE_NOAPI(ret_value) + +} /* H5C_set_slist_enabled() */ + + +/*------------------------------------------------------------------------- * Function: H5C_unpin_entry() * * Purpose: Unpin a cache entry. The entry can be either protected or @@ -2889,8 +3220,8 @@ done: * Programmer: John Mainzer * 3/22/06 * - * Changes: Added extreme sanity checks on entry and exit. - JRM -- 4/26/14 + * Changes: Added extreme sanity checks on entry and exit. + * JRM -- 4/26/14 * *------------------------------------------------------------------------- */ @@ -2910,9 +3241,9 @@ H5C_unpin_entry(void *_entry_ptr) HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); #if H5C_DO_EXTREME_SANITY_CHECKS - if((H5C_validate_protected_entry_list(cache_ptr) < 0) || - (H5C_validate_pinned_entry_list(cache_ptr) < 0) || - (H5C_validate_lru_list(cache_ptr) < 0)) + if((H5C__validate_protected_entry_list(cache_ptr) < 0) || + (H5C__validate_pinned_entry_list(cache_ptr) < 0) || + (H5C__validate_lru_list(cache_ptr) < 0)) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ @@ -2923,9 +3254,9 @@ H5C_unpin_entry(void *_entry_ptr) done: #if H5C_DO_EXTREME_SANITY_CHECKS - if((H5C_validate_protected_entry_list(cache_ptr) < 0) || - (H5C_validate_pinned_entry_list(cache_ptr) < 0) || - (H5C_validate_lru_list(cache_ptr) < 0)) + if((H5C__validate_protected_entry_list(cache_ptr) < 0) || + (H5C__validate_pinned_entry_list(cache_ptr) < 0) || + (H5C__validate_lru_list(cache_ptr) < 0)) HDONE_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on exit") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ @@ -2956,6 +3287,81 @@ done: * Programmer: John Mainzer * 6/2/04 * + * Modifications: + * + * JRM -- 7/21/04 + * Updated for the addition of the hash table. + * + * JRM -- 10/28/04 + * Added code to set cache_full to TRUE whenever we try to + * make space in the cache. + * + * JRM -- 11/12/04 + * Added code to call to H5C_make_space_in_cache() after the + * call to H5C__auto_adjust_cache_size() if that function + * sets the size_decreased flag is TRUE. + * + * JRM -- 4/25/05 + * The size_decreased flag can also be set to TRUE in + * H5C_set_cache_auto_resize_config() if a new configuration + * forces an immediate reduction in cache size. Modified + * the code to deal with this eventuallity. + * + * JRM -- 6/24/05 + * Added support for the new write_permitted field of H5C_t. + * + * JRM -- 10/22/05 + * Hand optimizations. + * + * JRM -- 5/3/06 + * Added code to set the new dirtied field in + * H5C_cache_entry_t to FALSE prior to return. + * + * JRM -- 6/23/06 + * Modified code to allow dirty entries to be loaded from + * disk. This is necessary as a bug fix in the object + * header code requires us to modify a header as it is read. + * + * JRM -- 3/28/07 + * Added the flags parameter and supporting code. At least + * for now, this parameter is used to allow the entry to + * be protected read only, thus allowing multiple protects. + * + * Also added code to allow multiple read only protects + * of cache entries. + * + * JRM -- 7/27/07 + * Added code supporting the new evictions_enabled field + * in H5C_t. + * + * JRM -- 1/3/08 + * Added to do a flash cache size increase if appropriate + * when a large entry is loaded. + * + * JRM -- 11/13/08 + * Modified function to call H5C_make_space_in_cache() when + * the min_clean_size is violated, not just when there isn't + * enough space for and entry that has just been loaded. + * + * The purpose of this modification is to avoid "metadata + * blizzards" in the write only case. In such instances, + * the cache was allowed to fill with dirty metadata. When + * we finally needed to evict an entry to make space, we had + * to flush out a whole cache full of metadata -- which has + * interesting performance effects. We hope to avoid (or + * perhaps more accurately hide) this effect by maintaining + * the min_clean_size, which should force us to start flushing + * entries long before we actually have to evict something + * to make space. + * + * + * Missing entries? + * + * + * JRM -- 5/8/20 + * Updated for the possibility that the slist will be + * disabled. + * *------------------------------------------------------------------------- */ herr_t @@ -2997,9 +3403,15 @@ H5C_unprotect(H5F_t *f, haddr_t addr, void *thing, unsigned flags) HDassert( H5F_addr_defined(addr) ); HDassert( thing ); HDassert( ! ( pin_entry && unpin_entry ) ); - HDassert( ( ! free_file_space ) || ( deleted ) ); /* deleted flag must accompany free_file_space */ - HDassert( ( ! take_ownership ) || ( deleted ) ); /* deleted flag must accompany take_ownership */ - HDassert( ! ( free_file_space && take_ownership ) ); /* can't have both free_file_space & take_ownership */ + + /* deleted flag must accompany free_file_space */ + HDassert( ( ! free_file_space ) || ( deleted ) ); + + /* deleted flag must accompany take_ownership */ + HDassert( ( ! take_ownership ) || ( deleted ) ); + + /* can't have both free_file_space & take_ownership */ + HDassert( ! ( free_file_space && take_ownership ) ); entry_ptr = (H5C_cache_entry_t *)thing; @@ -3012,48 +3424,66 @@ H5C_unprotect(H5F_t *f, haddr_t addr, void *thing, unsigned flags) was_clean = ! ( entry_ptr->is_dirty ); #if H5C_DO_EXTREME_SANITY_CHECKS - if((H5C_validate_protected_entry_list(cache_ptr) < 0) || - (H5C_validate_pinned_entry_list(cache_ptr) < 0) || - (H5C_validate_lru_list(cache_ptr) < 0)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry") + if ( ( H5C__validate_protected_entry_list(cache_ptr) < 0 ) || + ( H5C__validate_pinned_entry_list(cache_ptr) < 0 ) || + ( H5C__validate_lru_list(cache_ptr) < 0 ) ) + + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "an extreme sanity check failed on entry") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ /* if the entry has multiple read only protects, just decrement * the ro_ref_counter. Don't actually unprotect until the ref count * drops to zero. */ - if(entry_ptr->ro_ref_count > 1) { + if ( entry_ptr->ro_ref_count > 1 ) { + /* Sanity check */ - HDassert(entry_ptr->is_protected); + HDassert(entry_ptr->is_protected); HDassert(entry_ptr->is_read_only); - if(dirtied) - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "Read only entry modified??") + if ( dirtied ) + + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, \ + "Read only entry modified??") /* Reduce the RO ref count */ - (entry_ptr->ro_ref_count)--; + (entry_ptr->ro_ref_count)--; /* Pin or unpin the entry as requested. */ - if(pin_entry) { + if ( pin_entry ) { + /* Pin the entry from a client */ - if(H5C__pin_entry_from_client(cache_ptr, entry_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTPIN, FAIL, "Can't pin entry by client") - } else if(unpin_entry) { + if ( H5C__pin_entry_from_client(cache_ptr, entry_ptr) < 0 ) + + HGOTO_ERROR(H5E_CACHE, H5E_CANTPIN, FAIL, \ + "Can't pin entry by client") + + } else if ( unpin_entry ) { + /* Unpin the entry from a client */ - if(H5C__unpin_entry_from_client(cache_ptr, entry_ptr, FALSE) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, "Can't unpin entry by client") + if ( H5C__unpin_entry_from_client(cache_ptr, entry_ptr, FALSE) < 0 ) + + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, \ + "Can't unpin entry by client") + } /* end if */ } else { - if(entry_ptr->is_read_only) { + + if ( entry_ptr->is_read_only ) { + /* Sanity check */ - HDassert(entry_ptr->ro_ref_count == 1); + HDassert(entry_ptr->ro_ref_count == 1); - if(dirtied) - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "Read only entry modified??") + if ( dirtied ) - entry_ptr->is_read_only = FALSE; - entry_ptr->ro_ref_count = 0; - } /* end if */ + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, \ + "Read only entry modified??") + + entry_ptr->is_read_only = FALSE; + entry_ptr->ro_ref_count = 0; + + } /* end if */ #ifdef H5_HAVE_PARALLEL /* When the H5C code is used to implement the metadata cache in the @@ -3081,63 +3511,102 @@ H5C_unprotect(H5F_t *f, haddr_t addr, void *thing, unsigned flags) } /* end if */ #endif /* H5_HAVE_PARALLEL */ - if(!entry_ptr->is_protected) - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "Entry already unprotected??") + if ( ! entry_ptr->is_protected ) + + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, \ + "Entry already unprotected??") /* Mark the entry as dirty if appropriate */ entry_ptr->is_dirty = (entry_ptr->is_dirty || dirtied); - if(dirtied) - if(entry_ptr->image_up_to_date) { - entry_ptr->image_up_to_date = FALSE; - if(entry_ptr->flush_dep_nparents > 0) - if(H5C__mark_flush_dep_unserialized(entry_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "Can't propagate serialization status to fd parents") + if ( dirtied ) { + + if ( entry_ptr->image_up_to_date ) { + + entry_ptr->image_up_to_date = FALSE; + + if ( entry_ptr->flush_dep_nparents > 0 ) { + + if ( H5C__mark_flush_dep_unserialized(entry_ptr) < 0 ) + + HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, \ + "Can't propagate serialization status to fd parents") + + } /* end if */ } /* end if */ + } /* end if */ /* Check for newly dirtied entry */ - if(was_clean && entry_ptr->is_dirty) { + if ( was_clean && entry_ptr->is_dirty ) { + /* Update index for newly dirtied entry */ H5C__UPDATE_INDEX_FOR_ENTRY_DIRTY(cache_ptr, entry_ptr) - /* If the entry's type has a 'notify' callback send a 'entry dirtied' - * notice now that the entry is fully integrated into the cache. + /* If the entry's type has a 'notify' callback send a + * 'entry dirtied' notice now that the entry is fully + * integrated into the cache. */ - if(entry_ptr->type->notify && - (entry_ptr->type->notify)(H5C_NOTIFY_ACTION_ENTRY_DIRTIED, entry_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "can't notify client about entry dirty flag set") + if ( ( entry_ptr->type->notify ) && + ( (entry_ptr->type->notify)(H5C_NOTIFY_ACTION_ENTRY_DIRTIED, + entry_ptr) < 0 ) ) + + HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, \ + "can't notify client about entry dirty flag set") /* Propagate the flush dep dirty flag up the flush dependency chain - * if appropriate */ - if(entry_ptr->flush_dep_nparents > 0) - if(H5C__mark_flush_dep_dirty(entry_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "Can't propagate flush dep dirty flag") + * if appropriate + */ + if ( entry_ptr->flush_dep_nparents > 0 ) { + + if ( H5C__mark_flush_dep_dirty(entry_ptr) < 0 ) + + HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, \ + "Can't propagate flush dep dirty flag") + } } /* end if */ /* Check for newly clean entry */ - else if(!was_clean && !entry_ptr->is_dirty) { - /* If the entry's type has a 'notify' callback send a 'entry cleaned' - * notice now that the entry is fully integrated into the cache. + else if ( ! was_clean && ! entry_ptr->is_dirty ) { + + /* If the entry's type has a 'notify' callback send a + * 'entry cleaned' notice now that the entry is fully + * integrated into the cache. */ - if(entry_ptr->type->notify && - (entry_ptr->type->notify)(H5C_NOTIFY_ACTION_ENTRY_CLEANED, entry_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "can't notify client about entry dirty flag cleared") + if ( ( entry_ptr->type->notify ) && + ( (entry_ptr->type->notify)(H5C_NOTIFY_ACTION_ENTRY_CLEANED, + entry_ptr) < 0 ) ) + + HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, \ + "can't notify client about entry dirty flag cleared") /* Propagate the flush dep clean flag up the flush dependency chain - * if appropriate */ - if(entry_ptr->flush_dep_nparents > 0) - if(H5C__mark_flush_dep_clean(entry_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "Can't propagate flush dep dirty flag") + * if appropriate + */ + if ( entry_ptr->flush_dep_nparents > 0 ) { + + if ( H5C__mark_flush_dep_clean(entry_ptr) < 0 ) + + HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, \ + "Can't propagate flush dep dirty flag") + + } } /* end else-if */ /* Pin or unpin the entry as requested. */ - if(pin_entry) { + if ( pin_entry ) { + /* Pin the entry from a client */ - if(H5C__pin_entry_from_client(cache_ptr, entry_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTPIN, FAIL, "Can't pin entry by client") - } else if(unpin_entry) { + if ( H5C__pin_entry_from_client(cache_ptr, entry_ptr) < 0 ) + + HGOTO_ERROR(H5E_CACHE, H5E_CANTPIN, FAIL, \ + "Can't pin entry by client") + + } else if ( unpin_entry ) { + /* Unpin the entry from a client */ - if(H5C__unpin_entry_from_client(cache_ptr, entry_ptr, FALSE) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, "Can't unpin entry by client") + if ( H5C__unpin_entry_from_client(cache_ptr, entry_ptr, FALSE) < 0 ) + + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, \ + "Can't unpin entry by client") } /* end if */ /* H5C__UPDATE_RP_FOR_UNPROTECT will place the unprotected entry on @@ -3150,10 +3619,15 @@ H5C_unprotect(H5F_t *f, haddr_t addr, void *thing, unsigned flags) /* if the entry is dirty, 'or' its flush_marker with the set flush flag, * and then add it to the skip list if it isn't there already. */ - if(entry_ptr->is_dirty) { + if ( entry_ptr->is_dirty ) { + entry_ptr->flush_marker |= set_flush_marker; - if(!entry_ptr->in_slist) + + if ( !entry_ptr->in_slist ) { + + /* this is a no-op if cache_ptr->slist_enabled is FALSE */ H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, FAIL) + } } /* end if */ /* this implementation of the "deleted" option is a bit inefficient, as @@ -3165,44 +3639,71 @@ H5C_unprotect(H5F_t *f, haddr_t addr, void *thing, unsigned flags) * makes good use of existing code. * JRM - 5/19/04 */ - if(deleted) { - unsigned flush_flags = (H5C__FLUSH_CLEAR_ONLY_FLAG | - H5C__FLUSH_INVALIDATE_FLAG); + if ( deleted ) { + + unsigned flush_flags = (H5C__FLUSH_CLEAR_ONLY_FLAG | + H5C__FLUSH_INVALIDATE_FLAG); /* verify that the target entry is in the cache. */ H5C__SEARCH_INDEX(cache_ptr, addr, test_entry_ptr, FAIL) - if(test_entry_ptr == NULL) - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "entry not in hash table?!?") - else if(test_entry_ptr != entry_ptr) - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "hash table contains multiple entries for addr?!?") + + if ( test_entry_ptr == NULL ) + + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, \ + "entry not in hash table?!?") + + else if ( test_entry_ptr != entry_ptr ) + + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, \ + "hash table contains multiple entries for addr?!?") /* Set the 'free file space' flag for the flush, if needed */ - if(free_file_space) + if ( free_file_space ) { + flush_flags |= H5C__FREE_FILE_SPACE_FLAG; + } /* Set the "take ownership" flag for the flush, if needed */ - if(take_ownership) + if ( take_ownership ) { + flush_flags |= H5C__TAKE_OWNERSHIP_FLAG; + } /* Delete the entry from the skip list on destroy */ flush_flags |= H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG; - HDassert(((!was_clean) || dirtied) == entry_ptr->in_slist); - if(H5C__flush_single_entry(f, entry_ptr, flush_flags) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "Can't flush entry") + HDassert( ( ! cache_ptr->slist_enabled ) || \ + ( ( ( ! was_clean ) || dirtied ) == \ + ( entry_ptr->in_slist ) ) ); + + if ( H5C__flush_single_entry(f, entry_ptr, flush_flags) < 0 ) + + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, \ + "Can't flush entry") + } /* end if */ #ifdef H5_HAVE_PARALLEL - else if(clear_entry) { + else if ( clear_entry ) { /* verify that the target entry is in the cache. */ H5C__SEARCH_INDEX(cache_ptr, addr, test_entry_ptr, FAIL) - if(test_entry_ptr == NULL) - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "entry not in hash table?!?") - else if(test_entry_ptr != entry_ptr) - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "hash table contains multiple entries for addr?!?") - if(H5C__flush_single_entry(f, entry_ptr, H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "Can't clear entry") + if ( test_entry_ptr == NULL ) + + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, \ + "entry not in hash table?!?") + + else if ( test_entry_ptr != entry_ptr ) + + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, \ + "hash table contains multiple entries for addr?!?") + + if ( H5C__flush_single_entry(f, entry_ptr, + H5C__FLUSH_CLEAR_ONLY_FLAG | + H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG) < 0 ) + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, \ + "Can't clear entry") + } /* end else if */ #endif /* H5_HAVE_PARALLEL */ } @@ -3210,14 +3711,18 @@ H5C_unprotect(H5F_t *f, haddr_t addr, void *thing, unsigned flags) H5C__UPDATE_STATS_FOR_UNPROTECT(cache_ptr) done: + #if H5C_DO_EXTREME_SANITY_CHECKS - if((H5C_validate_protected_entry_list(cache_ptr) < 0) || - (H5C_validate_pinned_entry_list(cache_ptr) < 0) || - (H5C_validate_lru_list(cache_ptr) < 0)) { - HDONE_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on exit") + if ( ( H5C__validate_protected_entry_list(cache_ptr) < 0 ) || + ( H5C__validate_pinned_entry_list(cache_ptr) < 0 ) || + ( H5C__validate_lru_list(cache_ptr) < 0 ) ) { + + HDONE_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "an extreme sanity check failed on exit") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ FUNC_LEAVE_NOAPI(ret_value) + } /* H5C_unprotect() */ @@ -3958,7 +4463,7 @@ H5C__auto_adjust_cache_size(H5F_t *f, hbool_t write_permitted) enum H5C_resize_status status = in_spec; /* will change if needed */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert( f ); HDassert( cache_ptr ); @@ -4274,7 +4779,7 @@ H5C__autoadjust__ageout(H5F_t * f, double hit_rate, enum H5C_resize_status * sta size_t test_size; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert( f ); HDassert( cache_ptr ); @@ -4375,10 +4880,10 @@ done: static herr_t H5C__autoadjust__ageout__cycle_epoch_marker(H5C_t * cache_ptr) { - herr_t ret_value = SUCCEED; /* Return value */ int i; + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert( cache_ptr ); HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); @@ -4492,7 +4997,7 @@ H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t *f, hbool_t write_permitte H5C_cache_entry_t * prev_ptr; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert( f ); HDassert( cache_ptr ); @@ -4675,10 +5180,10 @@ done: static herr_t H5C__autoadjust__ageout__insert_new_marker(H5C_t * cache_ptr) { - herr_t ret_value = SUCCEED; /* Return value */ int i; + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert( cache_ptr ); HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); @@ -4745,11 +5250,11 @@ done: static herr_t H5C__autoadjust__ageout__remove_all_markers(H5C_t * cache_ptr) { - herr_t ret_value = SUCCEED; /* Return value */ - int i; int ring_buf_index; + int i; + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert( cache_ptr ); HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); @@ -4822,11 +5327,11 @@ done: static herr_t H5C__autoadjust__ageout__remove_excess_markers(H5C_t * cache_ptr) { - herr_t ret_value = SUCCEED; /* Return value */ - int i; int ring_buf_index; + int i; + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert( cache_ptr ); HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); @@ -4912,7 +5417,7 @@ H5C__flash_increase_cache_size(H5C_t * cache_ptr, double hit_rate; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert( cache_ptr ); HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); @@ -5035,6 +5540,7 @@ done: /*------------------------------------------------------------------------- + * * Function: H5C__flush_invalidate_cache * * Purpose: Flush and destroy the entries contained in the target @@ -5064,6 +5570,51 @@ done: * Programmer: John Mainzer * 3/24/065 * + * Modifications: + * + * To support the fractal heap, the cache must now deal with + * entries being dirtied, resized, and/or renamed inside + * flush callbacks. Updated function to support this. + * + * -- JRM 8/27/06 + * + * Added code to detect and manage the case in which a + * flush callback changes the s-list out from under + * the function. The only way I can think of in which this + * can happen is if a flush function loads an entry + * into the cache that isn't there already. Quincey tells + * me that this will never happen, but I'm not sure I + * believe him. + * + * Note that this is a pretty bad scenario if it ever + * happens. The code I have added should allow us to + * handle the situation under all but the worst conditions, + * but one can argue that we should just scream and die if + * we ever detect the condition. + * + * -- JRM 10/13/07 + * + * Missing entries? + * + * + * Added support for the H5C__EVICT_ALLOW_LAST_PINS_FLAG. + * This flag is used to flush and evict all entries in + * the metadata cache that are not pinned -- typically, + * everything other than the superblock. + * + * ??? -- ??/??/?? + * + * Added sanity checks to verify that the skip list is + * enabled on entry. On the face of it, it would make + * sense to enable the slist on entry, and disable it + * on exit, as this function is not called repeatedly. + * However, since this function can be called from + * H5C_flush_cache(), this would create cases in the test + * code where we would have to check the flags to determine + * whether we must setup and take down the slist. + * + * JRM -- 5/5/20 + * *------------------------------------------------------------------------- */ static herr_t @@ -5081,6 +5632,7 @@ H5C__flush_invalidate_cache(H5F_t *f, unsigned flags) HDassert(cache_ptr); HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); HDassert(cache_ptr->slist_ptr); + HDassert(cache_ptr->slist_enabled); #if H5C_DO_SANITY_CHECKS { @@ -5099,7 +5651,8 @@ H5C__flush_invalidate_cache(H5F_t *f, unsigned flags) HDassert(cache_ptr->slist_ring_len[H5C_RING_UNDEFINED] == 0); HDassert(cache_ptr->slist_ring_size[H5C_RING_UNDEFINED] == (size_t)0); - for(i = H5C_RING_USER; i < H5C_RING_NTYPES; i++) { + for ( i = H5C_RING_USER; i < H5C_RING_NTYPES; i++ ) { + index_len += cache_ptr->index_ring_len[i]; index_size += cache_ptr->index_ring_size[i]; clean_index_size += cache_ptr->clean_index_ring_size[i]; @@ -5107,6 +5660,7 @@ H5C__flush_invalidate_cache(H5F_t *f, unsigned flags) slist_len += cache_ptr->slist_ring_len[i]; slist_size += cache_ptr->slist_ring_size[i]; + } /* end for */ HDassert(cache_ptr->index_len == index_len); @@ -5119,49 +5673,68 @@ H5C__flush_invalidate_cache(H5F_t *f, unsigned flags) #endif /* H5C_DO_SANITY_CHECKS */ /* remove ageout markers if present */ - if(cache_ptr->epoch_markers_active > 0) - if(H5C__autoadjust__ageout__remove_all_markers(cache_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "error removing all epoch markers") + if ( cache_ptr->epoch_markers_active > 0 ) { + + if ( H5C__autoadjust__ageout__remove_all_markers(cache_ptr) < 0 ) + + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "error removing all epoch markers") + } /* flush invalidate each ring, starting from the outermost ring and * working inward. */ ring = H5C_RING_USER; - while(ring < H5C_RING_NTYPES) { - if(H5C_flush_invalidate_ring(f, ring, flags) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "flush invalidate ring failed") + + while ( ring < H5C_RING_NTYPES) { + + if(H5C__flush_invalidate_ring(f, ring, flags) < 0) + + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, + "flush invalidate ring failed") ring++; + } /* end while */ /* Invariants, after destroying all entries in the hash table */ - if(!(flags & H5C__EVICT_ALLOW_LAST_PINS_FLAG)) { + if( ! ( flags & H5C__EVICT_ALLOW_LAST_PINS_FLAG ) ) { + HDassert(cache_ptr->index_size == 0); HDassert(cache_ptr->clean_index_size == 0); HDassert(cache_ptr->pel_len == 0); HDassert(cache_ptr->pel_size == 0); + } /* end if */ else { + H5C_cache_entry_t *entry_ptr; /* Cache entry */ unsigned u; /* Local index variable */ /* All rings except ring 4 should be empty now */ /* (Ring 4 has the superblock) */ - for(u = H5C_RING_USER; u < H5C_RING_SB; u++) { + for ( u = H5C_RING_USER; u < H5C_RING_SB; u++ ) { + HDassert(cache_ptr->index_ring_len[u] == 0); HDassert(cache_ptr->index_ring_size[u] == 0); HDassert(cache_ptr->clean_index_ring_size[u] == 0); + } /* end for */ /* Check that any remaining pinned entries are in the superblock ring */ + entry_ptr = cache_ptr->pel_head_ptr; + while(entry_ptr) { + /* Check ring */ HDassert(entry_ptr->ring == H5C_RING_SB); /* Advance to next entry in pinned entry list */ entry_ptr = entry_ptr->next; + } /* end while */ } /* end else */ + HDassert(cache_ptr->dirty_index_size == 0); HDassert(cache_ptr->slist_len == 0); HDassert(cache_ptr->slist_size == 0); @@ -5171,48 +5744,64 @@ H5C__flush_invalidate_cache(H5F_t *f, unsigned flags) HDassert(cache_ptr->LRU_list_size == 0); done: + FUNC_LEAVE_NOAPI(ret_value) + } /* H5C__flush_invalidate_cache() */ /*------------------------------------------------------------------------- - * Function: H5C_flush_invalidate_ring + * Function: H5C__flush_invalidate_ring * - * Purpose: Flush and destroy the entries contained in the target - * cache and ring. + * Purpose: Flush and destroy the entries contained in the target + * cache and ring. * - * If the ring contains protected entries, the function will - * fail, as protected entries cannot be either flushed or - * destroyed. However all unprotected entries should be - * flushed and destroyed before the function returns failure. + * If the ring contains protected entries, the function will + * fail, as protected entries cannot be either flushed or + * destroyed. However all unprotected entries should be + * flushed and destroyed before the function returns failure. * - * While pinned entries can usually be flushed, they cannot - * be destroyed. However, they should be unpinned when all - * the entries that reference them have been destroyed (thus - * reduding the pinned entry's reference count to 0, allowing - * it to be unpinned). + * While pinned entries can usually be flushed, they cannot + * be destroyed. However, they should be unpinned when all + * the entries that reference them have been destroyed (thus + * reduding the pinned entry's reference count to 0, allowing + * it to be unpinned). * - * If pinned entries are present, the function makes repeated - * passes through the cache, flushing all dirty entries - * (including the pinned dirty entries where permitted) and - * destroying all unpinned entries. This process is repeated - * until either the cache is empty, or the number of pinned - * entries stops decreasing on each pass. + * If pinned entries are present, the function makes repeated + * passes through the cache, flushing all dirty entries + * (including the pinned dirty entries where permitted) and + * destroying all unpinned entries. This process is repeated + * until either the cache is empty, or the number of pinned + * entries stops decreasing on each pass. * - * If flush dependencies appear in the target ring, the - * function makes repeated passes through the cache flushing - * entries in flush dependency order. + * If flush dependencies appear in the target ring, the + * function makes repeated passes through the cache flushing + * entries in flush dependency order. * * Return: Non-negative on success/Negative on failure or if there was - * a request to flush all items and something was protected. + * a request to flush all items and something was protected. * * Programmer: John Mainzer - * 9/1/15 + * 9/1/15 + * + * Changes: Added support for the H5C__EVICT_ALLOW_LAST_PINS_FLAG. + * This flag is used to flush and evict all entries in + * the metadata cache that are not pinned -- typically, + * everything other than the superblock. + * + * ??? -- ??/??/?? + * + * A recent optimization turns off the slist unless a flush + * is in progress. This should not effect this function, as + * it is only called during a flush. Added an assertion to + * verify this. + * + * JRM -- 5/6/20 * *------------------------------------------------------------------------- */ static herr_t -H5C_flush_invalidate_ring(H5F_t * f, H5C_ring_t ring, unsigned flags) +H5C__flush_invalidate_ring(H5F_t * f, H5C_ring_t ring, unsigned flags) { H5C_t *cache_ptr; hbool_t restart_slist_scan; @@ -5231,13 +5820,16 @@ H5C_flush_invalidate_ring(H5F_t * f, H5C_ring_t ring, unsigned flags) #endif /* H5C_DO_SANITY_CHECKS */ herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_STATIC HDassert(f); HDassert(f->shared); + cache_ptr = f->shared->cache; + HDassert(cache_ptr); HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + HDassert(cache_ptr->slist_enabled); HDassert(cache_ptr->slist_ptr); HDassert(ring > H5C_RING_UNDEFINED); HDassert(ring < H5C_RING_NTYPES); @@ -5279,19 +5871,25 @@ H5C_flush_invalidate_ring(H5F_t * f, H5C_ring_t ring, unsigned flags) */ /* compute the number of pinned entries in this ring */ + entry_ptr = cache_ptr->pel_head_ptr; cur_ring_pel_len = 0; - while(entry_ptr != NULL) { + + while ( entry_ptr != NULL ) { + HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); HDassert(entry_ptr->ring >= ring); if(entry_ptr->ring == ring) cur_ring_pel_len++; entry_ptr = entry_ptr->next; + } /* end while */ old_ring_pel_len = cur_ring_pel_len; + while(cache_ptr->index_ring_len[ring] > 0) { + /* first, try to flush-destroy any dirty entries. Do this by * making a scan through the slist. Note that new dirty entries * may be created by the flush call backs. Thus it is possible @@ -5326,7 +5924,7 @@ H5C_flush_invalidate_ring(H5F_t * f, H5C_ring_t ring, unsigned flags) * This flag is set to TRUE by H5C__flush_single_entry if the slist * is modified by a pre_serialize, serialize, or notify callback. * - * H5C_flush_invalidate_ring() uses this flag to detect any + * H5C__flush_invalidate_ring() uses this flag to detect any * modifications to the slist that might corrupt the scan of * the slist -- and restart the scan in this event. */ @@ -5334,25 +5932,33 @@ H5C_flush_invalidate_ring(H5F_t * f, H5C_ring_t ring, unsigned flags) /* this done, start the scan of the slist */ restart_slist_scan = TRUE; - while(restart_slist_scan || (node_ptr != NULL)) { - if(restart_slist_scan) { + + while ( restart_slist_scan || ( node_ptr != NULL ) ) { + + if ( restart_slist_scan ) { + restart_slist_scan = FALSE; /* Start at beginning of skip list */ node_ptr = H5SL_first(cache_ptr->slist_ptr); - if(node_ptr == NULL) + + if ( node_ptr == NULL ) /* the slist is empty -- break out of inner loop */ break; /* Get cache entry for this node */ next_entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr); - if(NULL == next_entry_ptr) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "next_entry_ptr == NULL ?!?!") + + if ( NULL == next_entry_ptr ) + + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "next_entry_ptr == NULL ?!?!") HDassert(next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); HDassert(next_entry_ptr->is_dirty); HDassert(next_entry_ptr->in_slist); HDassert(next_entry_ptr->ring >= ring); + } /* end if */ entry_ptr = next_entry_ptr; @@ -5378,18 +5984,26 @@ H5C_flush_invalidate_ring(H5F_t * f, H5C_ring_t ring, unsigned flags) * from the slist. */ node_ptr = H5SL_next(node_ptr); + if(node_ptr != NULL) { + next_entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr); + if(NULL == next_entry_ptr) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "next_entry_ptr == NULL ?!?!") + + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "next_entry_ptr == NULL ?!?!") + HDassert(next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); HDassert(next_entry_ptr->is_dirty); HDassert(next_entry_ptr->in_slist); HDassert(next_entry_ptr->ring >= ring); HDassert(entry_ptr != next_entry_ptr); } /* end if */ - else + else { + next_entry_ptr = NULL; + } /* Note that we now remove nodes from the slist as we flush * the associated entries, instead of leaving them there @@ -5401,22 +6015,31 @@ H5C_flush_invalidate_ring(H5F_t * f, H5C_ring_t ring, unsigned flags) * flush, we must keep the slist in canonical form at all * times. */ - if(((!entry_ptr->flush_me_last) || - ((entry_ptr->flush_me_last) && - (cache_ptr->num_last_entries >= cache_ptr->slist_len))) && - (entry_ptr->flush_dep_nchildren == 0) && - (entry_ptr->ring == ring)) { - if(entry_ptr->is_protected) { + if ( ( ( !entry_ptr->flush_me_last ) || + ( ( entry_ptr->flush_me_last ) && + ( cache_ptr->num_last_entries >= cache_ptr->slist_len ) ) + ) && + ( entry_ptr->flush_dep_nchildren == 0 ) && + ( entry_ptr->ring == ring ) ) { + + if ( entry_ptr->is_protected ) { + /* we have major problems -- but lets flush * everything we can before we flag an error. */ protected_entries++; + } /* end if */ - else if(entry_ptr->is_pinned) { - if(H5C__flush_single_entry(f, entry_ptr, H5C__DURING_FLUSH_FLAG) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty pinned entry flush failed") + else if ( entry_ptr->is_pinned ) { + + if ( H5C__flush_single_entry(f, entry_ptr, + H5C__DURING_FLUSH_FLAG) < 0 ) + + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \ + "dirty pinned entry flush failed") + + if ( cache_ptr->slist_changed ) { - if(cache_ptr->slist_changed) { /* The slist has been modified by something * other than the simple removal of the * of the flushed entry after the flush. @@ -5427,13 +6050,22 @@ H5C_flush_invalidate_ring(H5F_t * f, H5C_ring_t ring, unsigned flags) restart_slist_scan = TRUE; cache_ptr->slist_changed = FALSE; H5C__UPDATE_STATS_FOR_SLIST_SCAN_RESTART(cache_ptr); + } /* end if */ } /* end else-if */ else { - if(H5C__flush_single_entry(f, entry_ptr, (cooked_flags | H5C__DURING_FLUSH_FLAG | H5C__FLUSH_INVALIDATE_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG)) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty entry flush destroy failed") - if(cache_ptr->slist_changed) { + if ( H5C__flush_single_entry(f, entry_ptr, + (cooked_flags | + H5C__DURING_FLUSH_FLAG | + H5C__FLUSH_INVALIDATE_FLAG | + H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG) ) < 0) + + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, + "dirty entry flush destroy failed") + + if ( cache_ptr->slist_changed ) { + /* The slist has been modified by something * other than the simple removal of the * of the flushed entry after the flush. @@ -5459,9 +6091,15 @@ H5C_flush_invalidate_ring(H5F_t * f, H5C_ring_t ring, unsigned flags) * out from under us. */ - if(node_ptr == NULL) { - HDassert(cache_ptr->slist_len == (uint32_t)((int32_t)initial_slist_len + cache_ptr->slist_len_increase)); - HDassert(cache_ptr->slist_size == (size_t)((ssize_t)initial_slist_size + cache_ptr->slist_size_increase)); + if ( node_ptr == NULL ) { + + HDassert(cache_ptr->slist_len == + (uint32_t)((int32_t)initial_slist_len + + cache_ptr->slist_len_increase)); + + HDassert(cache_ptr->slist_size == + (size_t)((ssize_t)initial_slist_size + + cache_ptr->slist_size_increase)); } /* end if */ #endif /* H5C_DO_SANITY_CHECKS */ @@ -5485,7 +6123,9 @@ H5C_flush_invalidate_ring(H5F_t * f, H5C_ring_t ring, unsigned flags) cache_ptr->entries_relocated_counter = 0; next_entry_ptr = cache_ptr->il_head; - while(next_entry_ptr != NULL) { + + while ( next_entry_ptr != NULL ) { + entry_ptr = next_entry_ptr; HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); HDassert(entry_ptr->ring >= ring); @@ -5494,18 +6134,28 @@ H5C_flush_invalidate_ring(H5F_t * f, H5C_ring_t ring, unsigned flags) HDassert((next_entry_ptr == NULL) || (next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC)); - if((!entry_ptr->flush_me_last || (entry_ptr->flush_me_last && cache_ptr->num_last_entries >= cache_ptr->slist_len)) - && entry_ptr->flush_dep_nchildren == 0 && entry_ptr->ring == ring) { - if(entry_ptr->is_protected) { + if ( ( ( ! entry_ptr->flush_me_last ) || + ( entry_ptr->flush_me_last && + ( cache_ptr->num_last_entries >= cache_ptr->slist_len ) ) + ) && + ( entry_ptr->flush_dep_nchildren == 0 ) && + ( entry_ptr->ring == ring ) ) { + + if ( entry_ptr->is_protected ) { + /* we have major problems -- but lets flush and * destroy everything we can before we flag an * error. */ protected_entries++; - if(!entry_ptr->in_slist) + + if ( ! entry_ptr->in_slist ) { + HDassert(!(entry_ptr->is_dirty)); + } } /* end if */ - else if(!(entry_ptr->is_pinned)) { + else if ( ! ( entry_ptr->is_pinned ) ) { + /* if *entry_ptr is dirty, it is possible * that one or more other entries may be * either removed from the cache, loaded @@ -5534,8 +6184,14 @@ H5C_flush_invalidate_ring(H5F_t * f, H5C_ring_t ring, unsigned flags) */ cache_ptr->entry_watched_for_removal = next_entry_ptr; - if(H5C__flush_single_entry(f, entry_ptr, (cooked_flags | H5C__DURING_FLUSH_FLAG | H5C__FLUSH_INVALIDATE_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG)) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Entry flush destroy failed") + if ( H5C__flush_single_entry(f, entry_ptr, + (cooked_flags | + H5C__DURING_FLUSH_FLAG | + H5C__FLUSH_INVALIDATE_FLAG | + H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG)) < 0 ) + + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \ + "Entry flush destroy failed") /* Restart the index list scan if necessary. Must * do this if the next entry is evicted, and also if @@ -5545,10 +6201,12 @@ H5C_flush_invalidate_ring(H5F_t * f, H5C_ring_t ring, unsigned flags) * if this results in the size of the pinned entry * failing to decline during the pass. */ - if((NULL != next_entry_ptr && NULL == cache_ptr->entry_watched_for_removal) - || (cache_ptr->entries_loaded_counter > 0) - || (cache_ptr->entries_inserted_counter > 0) - || (cache_ptr->entries_relocated_counter > 0)) { + if ( ( ( NULL != next_entry_ptr ) && + ( NULL == cache_ptr->entry_watched_for_removal ) + ) || + ( cache_ptr->entries_loaded_counter > 0 ) || + ( cache_ptr->entries_inserted_counter > 0 ) || + ( cache_ptr->entries_relocated_counter > 0 ) ) { next_entry_ptr = cache_ptr->il_head; @@ -5557,9 +6215,12 @@ H5C_flush_invalidate_ring(H5F_t * f, H5C_ring_t ring, unsigned flags) cache_ptr->entries_relocated_counter = 0; H5C__UPDATE_STATS_FOR_INDEX_SCAN_RESTART(cache_ptr) + } /* end if */ - else + else { + cache_ptr->entry_watched_for_removal = NULL; + } } /* end if */ } /* end if */ } /* end for loop scanning hash table */ @@ -5575,35 +6236,53 @@ H5C_flush_invalidate_ring(H5F_t * f, H5C_ring_t ring, unsigned flags) old_ring_pel_len = cur_ring_pel_len; entry_ptr = cache_ptr->pel_head_ptr; cur_ring_pel_len = 0; - while(entry_ptr != NULL) { + + while ( entry_ptr != NULL ) { + HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); HDassert(entry_ptr->ring >= ring); - if(entry_ptr->ring == ring) + if ( entry_ptr->ring == ring ) { + cur_ring_pel_len++; + } entry_ptr = entry_ptr->next; + } /* end while */ /* Check if the number of pinned entries in the ring is positive, and * it is not declining. Scream and die if so. */ - if(cur_ring_pel_len > 0 && cur_ring_pel_len >= old_ring_pel_len) { + if ( ( cur_ring_pel_len > 0 ) && + ( cur_ring_pel_len >= old_ring_pel_len ) ) { + /* Don't error if allowed to have pinned entries remaining */ - if(evict_flags) + if ( evict_flags ) { + HGOTO_DONE(TRUE) + } - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Pinned entry count not decreasing, cur_ring_pel_len = %d, old_ring_pel_len = %d, ring = %d", (int)cur_ring_pel_len, (int)old_ring_pel_len, (int)ring) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \ + "Pinned entry count not decreasing, cur_ring_pel_len = %d, old_ring_pel_len = %d, ring = %d", \ + (int)cur_ring_pel_len, \ + (int)old_ring_pel_len, (int)ring) } /* end if */ HDassert(protected_entries == cache_ptr->pl_len); - if(protected_entries > 0 && protected_entries == cache_ptr->index_len) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Only protected entries left in cache, protected_entries = %d", (int)protected_entries) + if ( ( protected_entries > 0 ) && + ( protected_entries == cache_ptr->index_len ) ) + + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \ + "Only protected entries left in cache, protected_entries = %d",\ + (int)protected_entries) + } /* main while loop */ /* Invariants, after destroying all entries in the ring */ - for(i = (int)H5C_RING_UNDEFINED; i <= (int)ring; i++) { + for ( i = (int)H5C_RING_UNDEFINED; i <= (int)ring; i++ ) { + HDassert(cache_ptr->index_ring_len[i] == 0); HDassert(cache_ptr->index_ring_size[i] == (size_t)0); HDassert(cache_ptr->clean_index_ring_size[i] == (size_t)0); @@ -5611,41 +6290,59 @@ H5C_flush_invalidate_ring(H5F_t * f, H5C_ring_t ring, unsigned flags) HDassert(cache_ptr->slist_ring_len[i] == 0); HDassert(cache_ptr->slist_ring_size[i] == (size_t)0); + } /* end for */ HDassert(protected_entries <= cache_ptr->pl_len); - if(protected_entries > 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Cache has protected entries") - else if(cur_ring_pel_len > 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't unpin all pinned entries in ring") + if ( protected_entries > 0 ) { + + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \ + "Cache has protected entries") + + } else if ( cur_ring_pel_len > 0 ) { + + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \ + "Can't unpin all pinned entries in ring") + } done: + FUNC_LEAVE_NOAPI(ret_value) -} /* H5C_flush_invalidate_ring() */ + +} /* H5C__flush_invalidate_ring() */ /*------------------------------------------------------------------------- + * * Function: H5C__flush_ring * - * Purpose: Flush the entries contained in the specified cache and - * ring. All entries in rings outside the specified ring - * must have been flushed on entry. + * Purpose: Flush the entries contained in the specified cache and + * ring. All entries in rings outside the specified ring + * must have been flushed on entry. * - * If the cache contains protected entries in the specified - * ring, the function will fail, as protected entries cannot - * be flushed. However all unprotected entries in the target - * ring should be flushed before the function returns failure. + * If the cache contains protected entries in the specified + * ring, the function will fail, as protected entries cannot + * be flushed. However all unprotected entries in the target + * ring should be flushed before the function returns failure. * - * If flush dependencies appear in the target ring, the - * function makes repeated passes through the slist flushing - * entries in flush dependency order. + * If flush dependencies appear in the target ring, the + * function makes repeated passes through the slist flushing + * entries in flush dependency order. * * Return: Non-negative on success/Negative on failure or if there was - * a request to flush all items and something was protected. + * a request to flush all items and something was protected. * * Programmer: John Mainzer - * 9/1/15 + * 9/1/15 + * + * Changes: A recent optimization turns off the slist unless a flush + * is in progress. This should not effect this function, as + * it is only called during a flush. Added an assertion to + * verify this. + * + * JRM -- 5/6/20 + * * *------------------------------------------------------------------------- */ @@ -5673,24 +6370,31 @@ H5C__flush_ring(H5F_t *f, H5C_ring_t ring, unsigned flags) HDassert(cache_ptr); HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + HDassert(cache_ptr->slist_enabled); HDassert(cache_ptr->slist_ptr); HDassert((flags & H5C__FLUSH_INVALIDATE_FLAG) == 0); HDassert(ring > H5C_RING_UNDEFINED); HDassert(ring < H5C_RING_NTYPES); #if H5C_DO_EXTREME_SANITY_CHECKS - if((H5C_validate_protected_entry_list(cache_ptr) < 0) || - (H5C_validate_pinned_entry_list(cache_ptr) < 0) || - (H5C_validate_lru_list(cache_ptr) < 0)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry") + if ( ( H5C__validate_protected_entry_list(cache_ptr) < 0 ) || + ( H5C__validate_pinned_entry_list(cache_ptr ) < 0 ) || + ( H5C__validate_lru_list(cache_ptr) < 0 ) ) + + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, + "an extreme sanity check failed on entry") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ ignore_protected = ( (flags & H5C__FLUSH_IGNORE_PROTECTED_FLAG) != 0 ); flush_marked_entries = ( (flags & H5C__FLUSH_MARKED_ENTRIES_FLAG) != 0 ); - if(!flush_marked_entries) - for(i = (int)H5C_RING_UNDEFINED; i < (int)ring; i++) - HDassert(cache_ptr->slist_ring_len[i] == 0); + if ( ! flush_marked_entries ) { + + for ( i = (int)H5C_RING_UNDEFINED; i < (int)ring; i++ ) { + + HDassert(cache_ptr->slist_ring_len[i] == 0); + } + } HDassert(cache_ptr->flush_in_progress); @@ -5711,9 +6415,10 @@ H5C__flush_ring(H5F_t *f, H5C_ring_t ring, unsigned flags) */ cache_ptr->slist_changed = FALSE; - while((cache_ptr->slist_ring_len[ring] > 0) && - (protected_entries == 0) && - (flushed_entries_last_pass)) { + while ( ( cache_ptr->slist_ring_len[ring] > 0 ) && + ( protected_entries == 0 ) && + ( flushed_entries_last_pass ) ) { + flushed_entries_last_pass = FALSE; #if H5C_DO_SANITY_CHECKS @@ -5757,26 +6462,33 @@ H5C__flush_ring(H5F_t *f, H5C_ring_t ring, unsigned flags) restart_slist_scan = TRUE; - while((restart_slist_scan ) || (node_ptr != NULL)) { - if(restart_slist_scan) { + while ( ( restart_slist_scan ) || ( node_ptr != NULL ) ) { + + if ( restart_slist_scan ) { + restart_slist_scan = FALSE; /* Start at beginning of skip list */ node_ptr = H5SL_first(cache_ptr->slist_ptr); - if(node_ptr == NULL) + if ( node_ptr == NULL ) { + /* the slist is empty -- break out of inner loop */ break; + } /* Get cache entry for this node */ next_entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr); - if(NULL == next_entry_ptr) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "next_entry_ptr == NULL ?!?!") + if ( NULL == next_entry_ptr ) + + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "next_entry_ptr == NULL ?!?!") HDassert(next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); HDassert(next_entry_ptr->is_dirty); HDassert(next_entry_ptr->in_slist); + } /* end if */ entry_ptr = next_entry_ptr; @@ -5801,54 +6513,76 @@ H5C__flush_ring(H5F_t *f, H5C_ring_t ring, unsigned flags) HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); HDassert(entry_ptr->in_slist); HDassert(entry_ptr->is_dirty); - if(!flush_marked_entries || entry_ptr->flush_marker) + + if ( ( ! flush_marked_entries ) || ( entry_ptr->flush_marker ) ) { + HDassert(entry_ptr->ring >= ring); + } /* Advance node pointer now, before we delete its target * from the slist. */ node_ptr = H5SL_next(node_ptr); - if(node_ptr != NULL) { + + if ( node_ptr != NULL ) { + next_entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr); - if(NULL == next_entry_ptr) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "next_entry_ptr == NULL ?!?!") + + if ( NULL == next_entry_ptr ) + + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "next_entry_ptr == NULL ?!?!") HDassert(next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); HDassert(next_entry_ptr->is_dirty); HDassert(next_entry_ptr->in_slist); - if(!flush_marked_entries || next_entry_ptr->flush_marker) + if ( ! flush_marked_entries || next_entry_ptr->flush_marker ) { + HDassert(next_entry_ptr->ring >= ring); + } HDassert(entry_ptr != next_entry_ptr); + } /* end if */ - else + else { + next_entry_ptr = NULL; + } - if((!flush_marked_entries || entry_ptr->flush_marker) - && (!entry_ptr->flush_me_last || - (entry_ptr->flush_me_last - && (cache_ptr->num_last_entries >= cache_ptr->slist_len - || (flush_marked_entries && entry_ptr->flush_marker)))) - && (entry_ptr->flush_dep_nchildren == 0 - || entry_ptr->flush_dep_ndirty_children == 0) - && entry_ptr->ring == ring) { + if ( ( ! flush_marked_entries || entry_ptr->flush_marker ) && + ( ( ! entry_ptr->flush_me_last ) || + ( ( entry_ptr->flush_me_last ) && + ( ( cache_ptr->num_last_entries >= cache_ptr->slist_len )|| + ( flush_marked_entries && entry_ptr->flush_marker ) ) + ) + ) && + ( ( entry_ptr->flush_dep_nchildren == 0 ) || + ( entry_ptr->flush_dep_ndirty_children == 0 ) ) && + ( entry_ptr->ring == ring ) ) { HDassert(entry_ptr->flush_dep_nunser_children == 0); - if(entry_ptr->is_protected) { + if ( entry_ptr->is_protected ) { + /* we probably have major problems -- but lets * flush everything we can before we decide * whether to flag an error. */ tried_to_flush_protected_entry = TRUE; protected_entries++; + } /* end if */ else { - if(H5C__flush_single_entry(f, entry_ptr, (flags | H5C__DURING_FLUSH_FLAG)) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush entry") - if(cache_ptr->slist_changed) { + if ( H5C__flush_single_entry(f, entry_ptr, + (flags | H5C__DURING_FLUSH_FLAG)) < 0 ) + + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \ + "Can't flush entry") + + if ( cache_ptr->slist_changed ) { + /* The slist has been modified by something * other than the simple removal of the * of the flushed entry after the flush. @@ -5859,34 +6593,46 @@ H5C__flush_ring(H5F_t *f, H5C_ring_t ring, unsigned flags) restart_slist_scan = TRUE; cache_ptr->slist_changed = FALSE; H5C__UPDATE_STATS_FOR_SLIST_SCAN_RESTART(cache_ptr) + } /* end if */ flushed_entries_last_pass = TRUE; + } /* end else */ } /* end if */ } /* while ( ( restart_slist_scan ) || ( node_ptr != NULL ) ) */ #if H5C_DO_SANITY_CHECKS /* Verify that the slist size and length are as expected. */ - HDassert((uint32_t)((int32_t)initial_slist_len + cache_ptr->slist_len_increase) == cache_ptr->slist_len); - HDassert((size_t)((ssize_t)initial_slist_size + cache_ptr->slist_size_increase) == cache_ptr->slist_size); + HDassert((uint32_t)((int32_t)initial_slist_len + \ + cache_ptr->slist_len_increase) == cache_ptr->slist_len); + HDassert((size_t)((ssize_t)initial_slist_size + \ + cache_ptr->slist_size_increase) == cache_ptr->slist_size); #endif /* H5C_DO_SANITY_CHECKS */ + } /* while */ HDassert(protected_entries <= cache_ptr->pl_len); - if(((cache_ptr->pl_len > 0) && (!ignore_protected)) || (tried_to_flush_protected_entry)) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "cache has protected items") + if ( ( ( cache_ptr->pl_len > 0 ) && ( ! ignore_protected ) ) || + ( tried_to_flush_protected_entry ) ) + + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \ + "cache has protected items") #if H5C_DO_SANITY_CHECKS - if(!flush_marked_entries) { + if ( ! flush_marked_entries ) { + HDassert(cache_ptr->slist_ring_len[ring] == 0); HDassert(cache_ptr->slist_ring_size[ring] == 0); + } /* end if */ #endif /* H5C_DO_SANITY_CHECKS */ done: + FUNC_LEAVE_NOAPI(ret_value) + } /* H5C__flush_ring() */ @@ -5895,53 +6641,110 @@ done: * Function: H5C__flush_single_entry * * Purpose: Flush or clear (and evict if requested) the cache entry - * with the specified address and type. If the type is NULL, - * any unprotected entry at the specified address will be - * flushed (and possibly evicted). + * with the specified address and type. If the type is NULL, + * any unprotected entry at the specified address will be + * flushed (and possibly evicted). * - * Attempts to flush a protected entry will result in an - * error. + * Attempts to flush a protected entry will result in an + * error. * - * If the H5C__FLUSH_INVALIDATE_FLAG flag is set, the entry will - * be cleared and not flushed, and the call can't be part of a + * If the H5C__FLUSH_INVALIDATE_FLAG flag is set, the entry will + * be cleared and not flushed, and the call can't be part of a * sequence of flushes. * - * If the caller knows the address of the skip list node at - * which the target entry resides, it can avoid a lookup - * by supplying that address in the tgt_node_ptr parameter. - * If this parameter is NULL, the function will do a skip list - * search for the entry instead. - * - * The function does nothing silently if there is no entry - * at the supplied address, or if the entry found has the - * wrong type. + * The function does nothing silently if there is no entry + * at the supplied address, or if the entry found has the + * wrong type. * * Return: Non-negative on success/Negative on failure or if there was - * an attempt to flush a protected item. + * an attempt to flush a protected item. * * Programmer: John Mainzer, 5/5/04 * + * Modifications: + * + * JRM -- 7/21/04 + * Updated function for the addition of the hash table. + * + * QAK -- 11/26/04 + * Updated function for the switch from TBBTs to skip lists. + * + * JRM -- 1/6/05 + * Updated function to reset the flush_marker field. + * Also replace references to H5F_FLUSH_INVALIDATE and + * H5F_FLUSH_CLEAR_ONLY with references to + * H5C__FLUSH_INVALIDATE_FLAG and H5C__FLUSH_CLEAR_ONLY_FLAG + * respectively. + * + * JRM -- 6/24/05 + * Added code to remove dirty entries from the slist after + * they have been flushed. Also added a sanity check that + * will scream if we attempt a write when writes are + * completely disabled. + * + * JRM -- 7/5/05 + * Added code to call the new log_flush callback whenever + * a dirty entry is written to disk. Note that the callback + * is not called if the H5C__FLUSH_CLEAR_ONLY_FLAG is set, + * as there is no write to file in this case. + * + * JRM -- 8/21/06 + * Added code maintaining the flush_in_progress and + * destroy_in_progress fields in H5C_cache_entry_t. + * + * Also added flush_flags parameter to the call to + * type_ptr->flush() so that the flush routine can report + * whether the entry has been resized or renamed. Added + * code using the flush_flags variable to detect the case + * in which the target entry is resized during flush, and + * update the caches data structures accordingly. + * + * JRM -- 3/29/07 + * Added sanity checks on the new is_read_only and + * ro_ref_count fields. + * + * QAK -- 2/07/08 + * Separated "destroy entry" concept from "remove entry from + * cache" concept, by adding the 'take_ownership' flag and + * the "destroy_entry" variable. + * + * JRM -- 11/5/08 + * Added call to H5C__UPDATE_INDEX_FOR_ENTRY_CLEAN() to + * maintain the new clean_index_size and clean_index_size + * fields of H5C_t. + * + * + * Missing entries?? + * + * + * JRM -- 5/8/20 + * Updated sanity checks for the possibility that the slist + * is disabled. + * + * Also updated main comment to conform more closely with + * the current state of the code. + * *------------------------------------------------------------------------- */ herr_t H5C__flush_single_entry(H5F_t *f, H5C_cache_entry_t *entry_ptr, unsigned flags) { - H5C_t * cache_ptr; /* Cache for file */ - hbool_t destroy; /* external flag */ - hbool_t clear_only; /* external flag */ - hbool_t free_file_space; /* external flag */ - hbool_t take_ownership; /* external flag */ - hbool_t del_from_slist_on_destroy; /* external flag */ - hbool_t during_flush; /* external flag */ - hbool_t write_entry; /* internal flag */ - hbool_t destroy_entry; /* internal flag */ - hbool_t generate_image; /* internal flag */ - hbool_t update_page_buffer; /* internal flag */ - hbool_t was_dirty; - hbool_t suppress_image_entry_writes = FALSE; - hbool_t suppress_image_entry_frees = FALSE; - haddr_t entry_addr = HADDR_UNDEF; - herr_t ret_value = SUCCEED; /* Return value */ + H5C_t * cache_ptr; /* Cache for file */ + hbool_t destroy; /* external flag */ + hbool_t clear_only; /* external flag */ + hbool_t free_file_space; /* external flag */ + hbool_t take_ownership; /* external flag */ + hbool_t del_from_slist_on_destroy; /* external flag */ + hbool_t during_flush; /* external flag */ + hbool_t write_entry; /* internal flag */ + hbool_t destroy_entry; /* internal flag */ + hbool_t generate_image; /* internal flag */ + hbool_t update_page_buffer; /* internal flag */ + hbool_t was_dirty; + hbool_t suppress_image_entry_writes = FALSE; + hbool_t suppress_image_entry_frees = FALSE; + haddr_t entry_addr = HADDR_UNDEF; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -5955,30 +6758,39 @@ H5C__flush_single_entry(H5F_t *f, H5C_cache_entry_t *entry_ptr, unsigned flags) HDassert(entry_ptr->type); /* setup external flags from the flags parameter */ - destroy = ((flags & H5C__FLUSH_INVALIDATE_FLAG) != 0); - clear_only = ((flags & H5C__FLUSH_CLEAR_ONLY_FLAG) != 0); - free_file_space = ((flags & H5C__FREE_FILE_SPACE_FLAG) != 0); - take_ownership = ((flags & H5C__TAKE_OWNERSHIP_FLAG) != 0); - del_from_slist_on_destroy = ((flags & H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG) != 0); - during_flush = ((flags & H5C__DURING_FLUSH_FLAG) != 0); - generate_image = ((flags & H5C__GENERATE_IMAGE_FLAG) != 0); - update_page_buffer = ((flags & H5C__UPDATE_PAGE_BUFFER_FLAG) != 0); + destroy = ((flags & H5C__FLUSH_INVALIDATE_FLAG) != 0); + clear_only = ((flags & H5C__FLUSH_CLEAR_ONLY_FLAG) != 0); + free_file_space = ((flags & H5C__FREE_FILE_SPACE_FLAG) != 0); + take_ownership = ((flags & H5C__TAKE_OWNERSHIP_FLAG) != 0); + del_from_slist_on_destroy = + ((flags & H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG) != 0); + during_flush = ((flags & H5C__DURING_FLUSH_FLAG) != 0); + generate_image = ((flags & H5C__GENERATE_IMAGE_FLAG) != 0); + update_page_buffer = ((flags & H5C__UPDATE_PAGE_BUFFER_FLAG) != 0); /* Set the flag for destroying the entry, based on the 'take ownership' * and 'destroy' flags */ - if(take_ownership) + if ( take_ownership ) { + destroy_entry = FALSE; - else + + } else { + destroy_entry = destroy; + } /* we will write the entry to disk if it exists, is dirty, and if the * clear only flag is not set. */ - if(entry_ptr->is_dirty && !clear_only) + if ( entry_ptr->is_dirty && !clear_only ) { + write_entry = TRUE; - else + + } else { + write_entry = FALSE; + } /* if we have received close warning, and we have been instructed to * generate a metadata cache image, and we have actually constructed @@ -5987,8 +6799,11 @@ H5C__flush_single_entry(H5F_t *f, H5C_cache_entry_t *entry_ptr, unsigned flags) * Set suppress_image_entry_writes to TRUE if indicated by the * image_ctl flags. */ - if(cache_ptr->close_warning_received && cache_ptr->image_ctl.generate_image - && cache_ptr->num_entries_in_image > 0 && cache_ptr->image_entries) { + if ( ( cache_ptr->close_warning_received ) && + ( cache_ptr->image_ctl.generate_image ) && + ( cache_ptr->num_entries_in_image > 0 ) && + ( cache_ptr->image_entries != NULL ) ) { + /* Sanity checks */ HDassert(entry_ptr->image_up_to_date || !(entry_ptr->include_in_image)); HDassert(entry_ptr->image_ptr || !(entry_ptr->include_in_image)); @@ -5998,32 +6813,60 @@ H5C__flush_single_entry(H5F_t *f, H5C_cache_entry_t *entry_ptr, unsigned flags) suppress_image_entry_frees = TRUE; - if(cache_ptr->image_ctl.flags & H5C_CI__SUPRESS_ENTRY_WRITES) + if ( cache_ptr->image_ctl.flags & H5C_CI__SUPRESS_ENTRY_WRITES ) { + suppress_image_entry_writes = TRUE; + + } /* end if */ } /* end if */ - /* run initial sanity checks */ -#if H5C_DO_SANITY_CHECKS - if(entry_ptr->in_slist) { - HDassert(entry_ptr->is_dirty); + /* run initial sanity checks */ +#if H5C_DO_SANITY_CHECKS + if ( cache_ptr->slist_enabled ) { - if((entry_ptr->flush_marker) && (!entry_ptr->is_dirty)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "entry in slist failed sanity checks") - } /* end if */ - else { - HDassert(!entry_ptr->is_dirty); - HDassert(!entry_ptr->flush_marker); + if ( entry_ptr->in_slist ) { - if((entry_ptr->is_dirty) || (entry_ptr->flush_marker)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "entry failed sanity checks") - } /* end else */ + HDassert(entry_ptr->is_dirty); + + if ( ( entry_ptr->flush_marker ) && ( ! entry_ptr->is_dirty ) ) + + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "entry in slist failed sanity checks") + } /* end if */ + else { + + HDassert(!entry_ptr->is_dirty); + HDassert(!entry_ptr->flush_marker); + + if ( ( entry_ptr->is_dirty ) || ( entry_ptr->flush_marker ) ) + + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "entry failed sanity checks") + + } /* end else */ + } else { /* slist is disabled */ + + HDassert( ! entry_ptr->in_slist ); + + if ( ! entry_ptr->is_dirty ) { + + if ( entry_ptr->flush_marker ) + + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "flush marked clean entry?") + + } + } #endif /* H5C_DO_SANITY_CHECKS */ - if(entry_ptr->is_protected) { + if ( entry_ptr->is_protected ) { + HDassert(!entry_ptr->is_protected); /* Attempt to flush a protected entry -- scream and die. */ - HGOTO_ERROR(H5E_CACHE, H5E_PROTECT, FAIL, "Attempt to flush a protected entry") + HGOTO_ERROR(H5E_CACHE, H5E_PROTECT, FAIL, \ + "Attempt to flush a protected entry") + } /* end if */ /* Set entry_ptr->flush_in_progress = TRUE and set @@ -6042,24 +6885,36 @@ H5C__flush_single_entry(H5F_t *f, H5C_cache_entry_t *entry_ptr, unsigned flags) * been requested to generate an image. In those cases, serialize the * entry. */ - if(write_entry || generate_image) { + if ( write_entry || generate_image ) { + HDassert(entry_ptr->is_dirty); - if(NULL == entry_ptr->image_ptr) { - if(NULL == (entry_ptr->image_ptr = H5MM_malloc(entry_ptr->size + H5C_IMAGE_EXTRA_SPACE))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for on disk image buffer") + if ( NULL == entry_ptr->image_ptr ) { + + if ( NULL == (entry_ptr->image_ptr = + H5MM_malloc(entry_ptr->size + H5C_IMAGE_EXTRA_SPACE)) ) + + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, \ + "memory allocation failed for on disk image buffer") + #if H5C_DO_MEMORY_SANITY_CHECKS - H5MM_memcpy(((uint8_t *)entry_ptr->image_ptr) + entry_ptr->size, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE); + H5MM_memcpy(((uint8_t *)entry_ptr->image_ptr) + entry_ptr->size, + H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE); #endif /* H5C_DO_MEMORY_SANITY_CHECKS */ + } /* end if */ - if(!(entry_ptr->image_up_to_date)) { + if ( ! ( entry_ptr->image_up_to_date ) ) { + /* Sanity check */ HDassert(!entry_ptr->prefetched); /* Generate the entry's image */ - if(H5C__generate_image(f, cache_ptr, entry_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "can't generate entry's image") + if ( H5C__generate_image(f, cache_ptr, entry_ptr) < 0 ) + + HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, \ + "can't generate entry's image") + } /* end if ( ! (entry_ptr->image_up_to_date) ) */ } /* end if */ @@ -6069,12 +6924,16 @@ H5C__flush_single_entry(H5F_t *f, H5C_cache_entry_t *entry_ptr, unsigned flags) * in the entry's type, we silently skip the write. This * flag should only be used in test code. */ - if(write_entry) { + if ( write_entry ) { + HDassert(entry_ptr->is_dirty); #if H5C_DO_SANITY_CHECKS - if(cache_ptr->check_write_permitted && !(cache_ptr->write_permitted)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Write when writes are always forbidden!?!?!") + if ( ( cache_ptr->check_write_permitted ) && + ( ! ( cache_ptr->write_permitted ) ) ) + + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "Write when writes are always forbidden!?!?!") #endif /* H5C_DO_SANITY_CHECKS */ /* Write the image to disk unless the write is suppressed. @@ -6084,41 +6943,60 @@ H5C__flush_single_entry(H5F_t *f, H5C_cache_entry_t *entry_ptr, unsigned flags) * H5AC__CLASS_SKIP_WRITES is set in the entry's type. This * flag should only be used in test code */ - if((!suppress_image_entry_writes || !entry_ptr->include_in_image) - && (((entry_ptr->type->flags) & H5C__CLASS_SKIP_WRITES) == 0)) { + if ( ( ( ! suppress_image_entry_writes ) || + ( ! entry_ptr->include_in_image ) ) && + ( ( (entry_ptr->type->flags) & H5C__CLASS_SKIP_WRITES) == 0 ) ) { + H5FD_mem_t mem_type = H5FD_MEM_DEFAULT; #ifdef H5_HAVE_PARALLEL - if(cache_ptr->coll_write_list) { - if(H5SL_insert(cache_ptr->coll_write_list, entry_ptr, &entry_ptr->addr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTINSERT, FAIL, "unable to insert skip list item") + if ( cache_ptr->coll_write_list ) { + + if ( H5SL_insert(cache_ptr->coll_write_list, entry_ptr, + &entry_ptr->addr) < 0 ) + + HGOTO_ERROR(H5E_CACHE, H5E_CANTINSERT, FAIL, \ + "unable to insert skip list item") } /* end if */ else { #endif /* H5_HAVE_PARALLEL */ - if(entry_ptr->prefetched) { + if ( entry_ptr->prefetched ) { + HDassert(entry_ptr->type->id == H5AC_PREFETCHED_ENTRY_ID); + mem_type = cache_ptr-> class_table_ptr[entry_ptr->prefetch_type_id]-> mem_type; } /* end if */ - else + else { + mem_type = entry_ptr->type->mem_type; + } + + if ( H5F_block_write(f, mem_type, entry_ptr->addr, + entry_ptr->size, entry_ptr->image_ptr) < 0 ) + + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \ + "Can't write image to file") - if(H5F_block_write(f, mem_type, entry_ptr->addr, entry_ptr->size, entry_ptr->image_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't write image to file") #ifdef H5_HAVE_PARALLEL } #endif /* H5_HAVE_PARALLEL */ + } /* end if */ /* if the entry has a notify callback, notify it that we have * just flushed the entry. */ - if(entry_ptr->type->notify && - (entry_ptr->type->notify)(H5C_NOTIFY_ACTION_AFTER_FLUSH, entry_ptr) < 0 ) - HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "can't notify client of entry flush") + if ( ( entry_ptr->type->notify ) && + ( (entry_ptr->type->notify)(H5C_NOTIFY_ACTION_AFTER_FLUSH, + entry_ptr) < 0 ) ) + + HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, \ + "can't notify client of entry flush") + } /* if ( write_entry ) */ /* At this point, all pre-serialize and serialize calls have been @@ -6130,16 +7008,21 @@ H5C__flush_single_entry(H5F_t *f, H5C_cache_entry_t *entry_ptr, unsigned flags) */ /* start by updating the statistics */ - if(clear_only) { + if ( clear_only ) { + /* only log a clear if the entry was dirty */ - if(was_dirty) { + if ( was_dirty ) { + H5C__UPDATE_STATS_FOR_CLEAR(cache_ptr, entry_ptr) + } /* end if */ } else if(write_entry) { + HDassert(was_dirty); /* only log a flush if we actually wrote to disk */ H5C__UPDATE_STATS_FOR_FLUSH(cache_ptr, entry_ptr) + } /* end else if */ /* Note that the algorithm below is (very) similar to the set of operations @@ -6148,12 +7031,18 @@ H5C__flush_single_entry(H5F_t *f, H5C_cache_entry_t *entry_ptr, unsigned flags) */ /* Update the cache internal data structures. */ - if(destroy) { + if ( destroy ) { + /* Sanity checks */ - if(take_ownership) + if ( take_ownership ) { + HDassert(!destroy_entry); - else + + } else { + HDassert(destroy_entry); + } + HDassert(!entry_ptr->is_pinned); /* Update stats, while entry is still in the cache */ @@ -6163,8 +7052,12 @@ H5C__flush_single_entry(H5F_t *f, H5C_cache_entry_t *entry_ptr, unsigned flags) * to be removed from the cache, send a 'before eviction' notice while * the entry is still fully integrated in the cache. */ - if(entry_ptr->type->notify && (entry_ptr->type->notify)(H5C_NOTIFY_ACTION_BEFORE_EVICT, entry_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "can't notify client about entry to evict") + if ( ( entry_ptr->type->notify ) && + ( (entry_ptr->type->notify)(H5C_NOTIFY_ACTION_BEFORE_EVICT, + entry_ptr) < 0 ) ) + + HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, \ + "can't notify client about entry to evict") /* Update the cache internal data structures as appropriate * for a destroy. Specifically: @@ -6184,31 +7077,40 @@ H5C__flush_single_entry(H5F_t *f, H5C_cache_entry_t *entry_ptr, unsigned flags) */ H5C__DELETE_FROM_INDEX(cache_ptr, entry_ptr, FAIL) - if(entry_ptr->in_slist && del_from_slist_on_destroy) + if ( ( entry_ptr->in_slist ) && ( del_from_slist_on_destroy ) ) { + H5C__REMOVE_ENTRY_FROM_SLIST(cache_ptr, entry_ptr, during_flush) + } #ifdef H5_HAVE_PARALLEL /* Check for collective read access flag */ - if(entry_ptr->coll_access) { + if ( entry_ptr->coll_access ) { + entry_ptr->coll_access = FALSE; + H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL) + } /* end if */ #endif /* H5_HAVE_PARALLEL */ H5C__UPDATE_RP_FOR_EVICTION(cache_ptr, entry_ptr, FAIL) /* Remove entry from tag list */ - if(H5C__untag_entry(cache_ptr, entry_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, "can't remove entry from tag list") + if ( H5C__untag_entry(cache_ptr, entry_ptr) < 0 ) - /* verify that the entry is no longer part of any flush dependencies */ + HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, \ + "can't remove entry from tag list") + + /* verify that the entry is no longer part of any flush dependencies */ HDassert(entry_ptr->flush_dep_nparents == 0); - HDassert(entry_ptr->flush_dep_nchildren == 0); + HDassert(entry_ptr->flush_dep_nchildren == 0); + } /* end if */ else { + HDassert(clear_only || write_entry); HDassert(entry_ptr->is_dirty); - HDassert(entry_ptr->in_slist); + HDassert((!cache_ptr->slist_enabled) || (entry_ptr->in_slist)); /* We are either doing a flush or a clear. * @@ -6216,7 +7118,7 @@ H5C__flush_single_entry(H5F_t *f, H5C_cache_entry_t *entry_ptr, unsigned flags) * view of the replacement policy and the slist. * Hence no differentiation between them. * - * JRM -- 7/7/07 + * JRM -- 7/7/07 */ H5C__UPDATE_RP_FOR_FLUSH(cache_ptr, entry_ptr, FAIL) @@ -6232,20 +7134,34 @@ H5C__flush_single_entry(H5F_t *f, H5C_cache_entry_t *entry_ptr, unsigned flags) H5C__UPDATE_INDEX_FOR_ENTRY_CLEAN(cache_ptr, entry_ptr); /* Check for entry changing status and do notifications, etc. */ - if(was_dirty) { - /* If the entry's type has a 'notify' callback send a 'entry cleaned' - * notice now that the entry is fully integrated into the cache. + if ( was_dirty ) { + + /* If the entry's type has a 'notify' callback send a + * 'entry cleaned' notice now that the entry is fully + * integrated into the cache. */ - if(entry_ptr->type->notify && - (entry_ptr->type->notify)(H5C_NOTIFY_ACTION_ENTRY_CLEANED, entry_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "can't notify client about entry dirty flag cleared") + if ( ( entry_ptr->type->notify ) && + ( (entry_ptr->type->notify)(H5C_NOTIFY_ACTION_ENTRY_CLEANED, + entry_ptr) < 0 ) ) + + HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, \ + "can't notify client about entry dirty flag cleared") + + /* Propagate the clean flag up the flush dependency chain + * if appropriate + */ + if ( entry_ptr->flush_dep_ndirty_children != 0 ) { - /* Propagate the clean flag up the flush dependency chain if appropriate */ - if(entry_ptr->flush_dep_ndirty_children != 0) HDassert(entry_ptr->flush_dep_ndirty_children == 0); - if(entry_ptr->flush_dep_nparents > 0) - if(H5C__mark_flush_dep_clean(entry_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKCLEAN, FAIL, "Can't propagate flush dep clean flag") + } + + if ( entry_ptr->flush_dep_nparents > 0 ) { + + if ( H5C__mark_flush_dep_clean(entry_ptr) < 0 ) + + HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKCLEAN, FAIL, \ + "Can't propagate flush dep clean flag") + } } /* end if */ } /* end else */ @@ -6253,7 +7169,8 @@ H5C__flush_single_entry(H5F_t *f, H5C_cache_entry_t *entry_ptr, unsigned flags) entry_ptr->flush_in_progress = FALSE; /* capture the cache entry address for the log_flush call at the - end before the entry_ptr gets freed */ + * end before the entry_ptr gets freed + */ entry_addr = entry_ptr->addr; /* Internal cache data structures should now be up to date, and @@ -6261,7 +7178,8 @@ H5C__flush_single_entry(H5F_t *f, H5C_cache_entry_t *entry_ptr, unsigned flags) * * Now discard the entry if appropriate. */ - if(destroy) { + if ( destroy ) { + /* Sanity check */ HDassert(0 == entry_ptr->flush_dep_nparents); @@ -6272,10 +7190,14 @@ H5C__flush_single_entry(H5F_t *f, H5C_cache_entry_t *entry_ptr, unsigned flags) * * Otherwise, free the buffer if it exists. */ - if(suppress_image_entry_frees && entry_ptr->include_in_image) + if ( suppress_image_entry_frees && entry_ptr->include_in_image ) { + entry_ptr->image_ptr = NULL; - else if(entry_ptr->image_ptr != NULL) + + } else if ( entry_ptr->image_ptr != NULL ) { + entry_ptr->image_ptr = H5MM_xfree(entry_ptr->image_ptr); + } /* If the entry is not a prefetched entry, verify that the flush * dependency parents addresses array has been transferred. @@ -6283,15 +7205,18 @@ H5C__flush_single_entry(H5F_t *f, H5C_cache_entry_t *entry_ptr, unsigned flags) * If the entry is prefetched, the free_isr routine will dispose of * the flush dependency parents addresses array if necessary. */ - if(!entry_ptr->prefetched) { + if ( ! entry_ptr->prefetched ) { + HDassert(0 == entry_ptr->fd_parent_count); HDassert(NULL == entry_ptr->fd_parent_addrs); + } /* end if */ /* Check whether we should free the space in the file that * the entry occupies */ - if(free_file_space) { + if ( free_file_space ) { + hsize_t fsf_size; /* Sanity checks */ @@ -6311,16 +7236,27 @@ H5C__flush_single_entry(H5F_t *f, H5C_cache_entry_t *entry_ptr, unsigned flags) * it to get the size of the block of file space to free. * Otherwise use entry_ptr->size. */ - if(entry_ptr->type->fsf_size) { - if((entry_ptr->type->fsf_size)((void *)entry_ptr, &fsf_size) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, "unable to get file space free size") + if ( entry_ptr->type->fsf_size ) { + + if ( (entry_ptr->type->fsf_size)((void *)entry_ptr, &fsf_size) + < 0 ) + + HGOTO_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, \ + "unable to get file space free size") + } /* end if */ - else /* no file space free size callback -- use entry size */ + else { /* no file space free size callback -- use entry size */ + fsf_size = entry_ptr->size; + } /* Release the space on disk */ - if(H5MF_xfree(f, entry_ptr->type->mem_type, entry_ptr->addr, fsf_size) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, "unable to free file space for cache entry") + if ( H5MF_xfree(f, entry_ptr->type->mem_type, + entry_ptr->addr, fsf_size) < 0 ) + + HGOTO_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, \ + "unable to free file space for cache entry") + } /* end if ( free_file_space ) */ /* Reset the pointer to the cache the entry is within. -QAK */ @@ -6343,22 +7279,32 @@ H5C__flush_single_entry(H5F_t *f, H5C_cache_entry_t *entry_ptr, unsigned flags) */ cache_ptr->entries_removed_counter++; cache_ptr->last_entry_removed_ptr = entry_ptr; - if(entry_ptr == cache_ptr->entry_watched_for_removal) + + if ( entry_ptr == cache_ptr->entry_watched_for_removal ) { + cache_ptr->entry_watched_for_removal = NULL; + } /* Check for actually destroying the entry in memory */ /* (As opposed to taking ownership of it) */ - if(destroy_entry) { - if(entry_ptr->is_dirty) { + if ( destroy_entry ) { + + if ( entry_ptr->is_dirty ) { + /* Reset dirty flag */ entry_ptr->is_dirty = FALSE; - /* If the entry's type has a 'notify' callback send a 'entry cleaned' - * notice now that the entry is fully integrated into the cache. + /* If the entry's type has a 'notify' callback send a + * 'entry cleaned' notice now that the entry is fully + * integrated into the cache. */ - if(entry_ptr->type->notify && - (entry_ptr->type->notify)(H5C_NOTIFY_ACTION_ENTRY_CLEANED, entry_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "can't notify client about entry dirty flag cleared") + if ( ( entry_ptr->type->notify ) && + ( (entry_ptr->type->notify) + (H5C_NOTIFY_ACTION_ENTRY_CLEANED, entry_ptr) < 0 ) ) + + HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, \ + "can't notify client about entry dirty flag cleared") + } /* end if */ /* we are about to discard the in core representation -- @@ -6370,10 +7316,14 @@ H5C__flush_single_entry(H5F_t *f, H5C_cache_entry_t *entry_ptr, unsigned flags) /* verify that the image has been freed */ HDassert(entry_ptr->image_ptr == NULL); - if(entry_ptr->type->free_icr((void *)entry_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "free_icr callback failed") + if ( entry_ptr->type->free_icr((void *)entry_ptr) < 0 ) + + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \ + "free_icr callback failed") + } /* end if */ else { + HDassert(take_ownership); /* client is taking ownership of the entry. @@ -6381,33 +7331,50 @@ H5C__flush_single_entry(H5F_t *f, H5C_cache_entry_t *entry_ptr, unsigned flags) * unless the entry is re-inserted properly */ entry_ptr->magic = H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC; + } /* end else */ } /* if (destroy) */ /* Check if we have to update the page buffer with cleared entries * so it doesn't go out of date */ - if(update_page_buffer) { + if ( update_page_buffer ) { + /* Sanity check */ HDassert(!destroy); HDassert(entry_ptr->image_ptr); - if(f->shared->page_buf && f->shared->page_buf->page_size >= entry_ptr->size) - if(H5PB_update_entry(f->shared->page_buf, entry_ptr->addr, entry_ptr->size, entry_ptr->image_ptr) > 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Failed to update PB with metadata cache") + if ( ( f->shared->page_buf ) && + ( f->shared->page_buf->page_size >= entry_ptr->size ) ) { + + if ( H5PB_update_entry(f->shared->page_buf, entry_ptr->addr, + entry_ptr->size, entry_ptr->image_ptr) > 0 ) + + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "Failed to update PB with metadata cache") + } /* end if */ } /* end if */ - if(cache_ptr->log_flush) - if((cache_ptr->log_flush)(cache_ptr, entry_addr, was_dirty, flags) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "log_flush callback failed") + if ( cache_ptr->log_flush ) { + + if ( (cache_ptr->log_flush)(cache_ptr, entry_addr, + was_dirty, flags) < 0 ) + + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \ + "log_flush callback failed") + + } /* end if */ done: + HDassert( ( ret_value != SUCCEED ) || ( destroy_entry ) || ( ! entry_ptr->flush_in_progress ) ); + HDassert( ( ret_value != SUCCEED ) || ( destroy_entry ) || ( take_ownership ) || ( ! entry_ptr->is_dirty ) ); FUNC_LEAVE_NOAPI(ret_value) + } /* H5C__flush_single_entry() */ @@ -6477,7 +7444,7 @@ done: /*------------------------------------------------------------------------- * - * Function: H5C_load_entry + * Function: H5C__load_entry * * Purpose: Attempt to load the entry at the specified disk address * and with the specified type into memory. If successful. @@ -6494,7 +7461,7 @@ done: *------------------------------------------------------------------------- */ static void * -H5C_load_entry(H5F_t * f, +H5C__load_entry(H5F_t * f, #ifdef H5_HAVE_PARALLEL hbool_t coll_access, #endif /* H5_HAVE_PARALLEL */ @@ -6514,7 +7481,7 @@ H5C_load_entry(H5F_t * f, #endif /* H5_HAVE_PARALLEL */ void * ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity checks */ HDassert(f); @@ -6812,7 +7779,7 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* H5C_load_entry() */ +} /* H5C__load_entry() */ /*------------------------------------------------------------------------- @@ -7160,7 +8127,7 @@ done: /*------------------------------------------------------------------------- * - * Function: H5C_validate_lru_list + * Function: H5C__validate_lru_list * * Purpose: Debugging function that scans the LRU list for errors. * @@ -7172,123 +8139,73 @@ done: * * Programmer: John Mainzer, 7/14/05 * - * Changes: - * - * Added code to verify that the LRU contains no pinned - * entries. JRM -- 4/25/14 - * *------------------------------------------------------------------------- */ #if H5C_DO_EXTREME_SANITY_CHECKS - static herr_t -H5C_validate_lru_list(H5C_t * cache_ptr) +H5C__validate_lru_list(H5C_t * cache_ptr) { - herr_t ret_value = SUCCEED; /* Return value */ int32_t len = 0; size_t size = 0; H5C_cache_entry_t * entry_ptr = NULL; + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT - - HDassert( cache_ptr ); - HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); + FUNC_ENTER_STATIC - if ( ( ( cache_ptr->LRU_head_ptr == NULL ) - || - ( cache_ptr->LRU_tail_ptr == NULL ) - ) - && - ( cache_ptr->LRU_head_ptr != cache_ptr->LRU_tail_ptr ) - ) { + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + if(((cache_ptr->LRU_head_ptr == NULL) || (cache_ptr->LRU_tail_ptr == NULL)) + && (cache_ptr->LRU_head_ptr != cache_ptr->LRU_tail_ptr)) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 1 failed") - } if(cache_ptr->LRU_list_len < 0) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 2 failed") - if ( ( cache_ptr->LRU_list_len == 1 ) - && - ( ( cache_ptr->LRU_head_ptr != cache_ptr->LRU_tail_ptr ) - || - ( cache_ptr->LRU_head_ptr == NULL ) - || - ( cache_ptr->LRU_head_ptr->size != cache_ptr->LRU_list_size ) - ) - ) { - + if((cache_ptr->LRU_list_len == 1) && + ((cache_ptr->LRU_head_ptr != cache_ptr->LRU_tail_ptr) || + (cache_ptr->LRU_head_ptr == NULL) || (cache_ptr->LRU_head_ptr->size != cache_ptr->LRU_list_size))) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 3 failed") - } - - if ( ( cache_ptr->LRU_list_len >= 1 ) - && - ( ( cache_ptr->LRU_head_ptr == NULL ) - || - ( cache_ptr->LRU_head_ptr->prev != NULL ) - || - ( cache_ptr->LRU_tail_ptr == NULL ) - || - ( cache_ptr->LRU_tail_ptr->next != NULL ) - ) - ) { + if((cache_ptr->LRU_list_len >= 1) && + ((cache_ptr->LRU_head_ptr == NULL) || (cache_ptr->LRU_head_ptr->prev != NULL) + || (cache_ptr->LRU_tail_ptr == NULL) || (cache_ptr->LRU_tail_ptr->next != NULL))) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 4 failed") - } entry_ptr = cache_ptr->LRU_head_ptr; - while ( entry_ptr != NULL ) - { - - if ( ( entry_ptr != cache_ptr->LRU_head_ptr ) && - ( ( entry_ptr->prev == NULL ) || - ( entry_ptr->prev->next != entry_ptr ) ) ) { - + while(entry_ptr != NULL) { + if((entry_ptr != cache_ptr->LRU_head_ptr) && + ((entry_ptr->prev == NULL) || (entry_ptr->prev->next != entry_ptr))) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 5 failed") - } - - if ( ( entry_ptr != cache_ptr->LRU_tail_ptr ) && - ( ( entry_ptr->next == NULL ) || - ( entry_ptr->next->prev != entry_ptr ) ) ) { + if((entry_ptr != cache_ptr->LRU_tail_ptr) && + ((entry_ptr->next == NULL) || (entry_ptr->next->prev != entry_ptr))) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 6 failed") - } - - if ( ( entry_ptr->is_pinned ) || - ( entry_ptr->pinned_from_client ) || - ( entry_ptr->pinned_from_cache ) ) { + if((entry_ptr->is_pinned) || + (entry_ptr->pinned_from_client) || (entry_ptr->pinned_from_cache)) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 7 failed") - } len++; size += entry_ptr->size; entry_ptr = entry_ptr->next; } - if ( ( cache_ptr->LRU_list_len != len ) || - ( cache_ptr->LRU_list_size != size ) ) { - + if((cache_ptr->LRU_list_len != len) || (cache_ptr->LRU_list_size != size)) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 8 failed") - } done: - - if ( ret_value != SUCCEED ) { - + if(ret_value != SUCCEED) HDassert(0); - } FUNC_LEAVE_NOAPI(ret_value) - -} /* H5C_validate_lru_list() */ - +} /* H5C__validate_lru_list() */ #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ /*------------------------------------------------------------------------- * - * Function: H5C_validate_pinned_entry_list + * Function: H5C__validate_pinned_entry_list * * Purpose: Debugging function that scans the pinned entry list for * errors. @@ -7301,126 +8218,78 @@ done: * * Programmer: John Mainzer, 4/25/14 * - * Changes: - * - * None. - * *------------------------------------------------------------------------- */ #if H5C_DO_EXTREME_SANITY_CHECKS - static herr_t -H5C_validate_pinned_entry_list(H5C_t * cache_ptr) +H5C__validate_pinned_entry_list(H5C_t * cache_ptr) { - herr_t ret_value = SUCCEED; /* Return value */ int32_t len = 0; size_t size = 0; H5C_cache_entry_t * entry_ptr = NULL; + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT - - HDassert( cache_ptr ); - HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); + FUNC_ENTER_STATIC - if ( ( ( cache_ptr->pel_head_ptr == NULL ) - || - ( cache_ptr->pel_tail_ptr == NULL ) - ) - && - ( cache_ptr->pel_head_ptr != cache_ptr->pel_tail_ptr ) - ) { + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + if(((cache_ptr->pel_head_ptr == NULL) || (cache_ptr->pel_tail_ptr == NULL)) + && (cache_ptr->pel_head_ptr != cache_ptr->pel_tail_ptr)) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 1 failed") - } if(cache_ptr->pel_len < 0) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 2 failed") - if ( ( cache_ptr->pel_len == 1 ) - && - ( ( cache_ptr->pel_head_ptr != cache_ptr->pel_tail_ptr ) - || - ( cache_ptr->pel_head_ptr == NULL ) - || - ( cache_ptr->pel_head_ptr->size != cache_ptr->pel_size ) - ) - ) { - + if((cache_ptr->pel_len == 1) && + ((cache_ptr->pel_head_ptr != cache_ptr->pel_tail_ptr) || + (cache_ptr->pel_head_ptr == NULL) || + (cache_ptr->pel_head_ptr->size != cache_ptr->pel_size))) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 3 failed") - } - - if ( ( cache_ptr->pel_len >= 1 ) - && - ( ( cache_ptr->pel_head_ptr == NULL ) - || - ( cache_ptr->pel_head_ptr->prev != NULL ) - || - ( cache_ptr->pel_tail_ptr == NULL ) - || - ( cache_ptr->pel_tail_ptr->next != NULL ) - ) - ) { + if((cache_ptr->pel_len >= 1) && + ((cache_ptr->pel_head_ptr == NULL) || + (cache_ptr->pel_head_ptr->prev != NULL) || + (cache_ptr->pel_tail_ptr == NULL) || + (cache_ptr->pel_tail_ptr->next != NULL))) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 4 failed") - } entry_ptr = cache_ptr->pel_head_ptr; - while ( entry_ptr != NULL ) - { - - if ( ( entry_ptr != cache_ptr->pel_head_ptr ) && - ( ( entry_ptr->prev == NULL ) || - ( entry_ptr->prev->next != entry_ptr ) ) ) { - + while(entry_ptr != NULL) { + if((entry_ptr != cache_ptr->pel_head_ptr) && + ((entry_ptr->prev == NULL) || (entry_ptr->prev->next != entry_ptr))) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 5 failed") - } - - if ( ( entry_ptr != cache_ptr->pel_tail_ptr ) && - ( ( entry_ptr->next == NULL ) || - ( entry_ptr->next->prev != entry_ptr ) ) ) { + if((entry_ptr != cache_ptr->pel_tail_ptr) && + ((entry_ptr->next == NULL) || (entry_ptr->next->prev != entry_ptr))) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 6 failed") - } - - if ( ! entry_ptr->is_pinned ) { + if(!entry_ptr->is_pinned) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 7 failed") - } - - if ( ! ( ( entry_ptr->pinned_from_client ) || - ( entry_ptr->pinned_from_cache ) ) ) { + if(!(entry_ptr->pinned_from_client || entry_ptr->pinned_from_cache)) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 8 failed") - } len++; size += entry_ptr->size; entry_ptr = entry_ptr->next; } - if ( ( cache_ptr->pel_len != len ) || - ( cache_ptr->pel_size != size ) ) { - + if((cache_ptr->pel_len != len) || (cache_ptr->pel_size != size)) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 9 failed") - } done: - - if ( ret_value != SUCCEED ) { - + if(ret_value != SUCCEED) HDassert(0); - } FUNC_LEAVE_NOAPI(ret_value) - -} /* H5C_validate_pinned_entry_list() */ - +} /* H5C__validate_pinned_entry_list() */ #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ /*------------------------------------------------------------------------- * - * Function: H5C_validate_protected_entry_list + * Function: H5C__validate_protected_entry_list * * Purpose: Debugging function that scans the protected entry list for * errors. @@ -7433,26 +8302,21 @@ done: * * Programmer: John Mainzer, 4/25/14 * - * Changes: - * - * None. - * *------------------------------------------------------------------------- */ #if H5C_DO_EXTREME_SANITY_CHECKS - static herr_t -H5C_validate_protected_entry_list(H5C_t * cache_ptr) +H5C__validate_protected_entry_list(H5C_t * cache_ptr) { - herr_t ret_value = SUCCEED; /* Return value */ int32_t len = 0; size_t size = 0; H5C_cache_entry_t * entry_ptr = NULL; + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC - HDassert( cache_ptr ); - HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); if(((cache_ptr->pl_head_ptr == NULL) || (cache_ptr->pl_tail_ptr == NULL)) && (cache_ptr->pl_head_ptr != cache_ptr->pl_tail_ptr)) @@ -7461,91 +8325,55 @@ H5C_validate_protected_entry_list(H5C_t * cache_ptr) if(cache_ptr->pl_len < 0) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 2 failed") - if ( ( cache_ptr->pl_len == 1 ) - && - ( ( cache_ptr->pl_head_ptr != cache_ptr->pl_tail_ptr ) - || - ( cache_ptr->pl_head_ptr == NULL ) - || - ( cache_ptr->pl_head_ptr->size != cache_ptr->pl_size ) - ) - ) { - + if((cache_ptr->pl_len == 1) && + ((cache_ptr->pl_head_ptr != cache_ptr->pl_tail_ptr) || + (cache_ptr->pl_head_ptr == NULL) || + (cache_ptr->pl_head_ptr->size != cache_ptr->pl_size))) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 3 failed") - } - - if ( ( cache_ptr->pl_len >= 1 ) - && - ( ( cache_ptr->pl_head_ptr == NULL ) - || - ( cache_ptr->pl_head_ptr->prev != NULL ) - || - ( cache_ptr->pl_tail_ptr == NULL ) - || - ( cache_ptr->pl_tail_ptr->next != NULL ) - ) - ) { + if((cache_ptr->pl_len >= 1) && + ((cache_ptr->pl_head_ptr == NULL) || + (cache_ptr->pl_head_ptr->prev != NULL) || + (cache_ptr->pl_tail_ptr == NULL) || + (cache_ptr->pl_tail_ptr->next != NULL))) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 4 failed") - } entry_ptr = cache_ptr->pl_head_ptr; - while ( entry_ptr != NULL ) - { - - if ( ( entry_ptr != cache_ptr->pl_head_ptr ) && - ( ( entry_ptr->prev == NULL ) || - ( entry_ptr->prev->next != entry_ptr ) ) ) { - + while(entry_ptr != NULL) { + if((entry_ptr != cache_ptr->pl_head_ptr) && + ((entry_ptr->prev == NULL) || (entry_ptr->prev->next != entry_ptr))) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 5 failed") - } - - if ( ( entry_ptr != cache_ptr->pl_tail_ptr ) && - ( ( entry_ptr->next == NULL ) || - ( entry_ptr->next->prev != entry_ptr ) ) ) { + if((entry_ptr != cache_ptr->pl_tail_ptr) && + ((entry_ptr->next == NULL) || (entry_ptr->next->prev != entry_ptr))) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 6 failed") - } - - if ( ! entry_ptr->is_protected ) { + if(!entry_ptr->is_protected) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 7 failed") - } - - if ( ( entry_ptr->is_read_only ) && - ( entry_ptr->ro_ref_count <= 0 ) ) { + if(entry_ptr->is_read_only && (entry_ptr->ro_ref_count <= 0)) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 8 failed") - } len++; size += entry_ptr->size; entry_ptr = entry_ptr->next; } - if ( ( cache_ptr->pl_len != len ) || - ( cache_ptr->pl_size != size ) ) { - + if((cache_ptr->pl_len != len) || (cache_ptr->pl_size != size)) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 9 failed") - } done: - - if ( ret_value != SUCCEED ) { - + if(ret_value != SUCCEED) HDassert(0); - } FUNC_LEAVE_NOAPI(ret_value) - -} /* H5C_validate_protected_entry_list() */ - +} /* H5C__validate_protected_entry_list() */ #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ /*------------------------------------------------------------------------- * - * Function: H5C_entry_in_skip_list + * Function: H5C__entry_in_skip_list * * Purpose: Debugging function that scans skip list to see if it * is in present. We need this, as it is possible for @@ -7556,49 +8384,39 @@ done: * * Programmer: John Mainzer, 11/1/14 * - * Changes: - * - * None. - * *------------------------------------------------------------------------- */ #if H5C_DO_SLIST_SANITY_CHECKS - static hbool_t -H5C_entry_in_skip_list(H5C_t * cache_ptr, H5C_cache_entry_t *target_ptr) +H5C__entry_in_skip_list(H5C_t * cache_ptr, H5C_cache_entry_t *target_ptr) { - hbool_t in_slist = FALSE; - H5SL_node_t * node_ptr = NULL; - H5C_cache_entry_t * entry_ptr = NULL; + H5SL_node_t *node_ptr; + hbool_t in_slist; - HDassert( cache_ptr ); - HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); - HDassert( cache_ptr->slist_ptr ); + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + HDassert(cache_ptr->slist_ptr); node_ptr = H5SL_first(cache_ptr->slist_ptr); + in_slist = FALSE; + while((node_ptr != NULL) && (!in_slist)) { + H5C_cache_entry_t *entry_ptr; - while ( ( node_ptr != NULL ) && ( ! in_slist ) ) - { entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr); - HDassert( entry_ptr ); - HDassert( entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC ); - HDassert( entry_ptr->is_dirty ); - HDassert( entry_ptr->in_slist ); - - if ( entry_ptr == target_ptr ) { + HDassert(entry_ptr); + HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + HDassert(entry_ptr->is_dirty); + HDassert(entry_ptr->in_slist); + if(entry_ptr == target_ptr) in_slist = TRUE; - - } else { - + else node_ptr = H5SL_next(node_ptr); - } } return(in_slist); - -} /* H5C_entry_in_skip_list() */ +} /* H5C__entry_in_skip_list() */ #endif /* H5C_DO_SLIST_SANITY_CHECKS */ @@ -7613,8 +8431,18 @@ H5C_entry_in_skip_list(H5C_t * cache_ptr, H5C_cache_entry_t *target_ptr) * Programmer: Mike McGreevy * November 3, 2010 * + * Changes: Modified function to setup the slist before calling + * H%C_flush_cache(), and take it down afterwards. Note + * that the slist need not be empty after the call to + * H5C_flush_cache() since we are only flushing marked + * entries. Thus must set the clear_slist parameter + * of H5C_set_slist_enabled to TRUE. + * + * JRM -- 5/6/20 + * *------------------------------------------------------------------------- */ + herr_t H5C__flush_marked_entries(H5F_t * f) { @@ -7625,12 +8453,31 @@ H5C__flush_marked_entries(H5F_t * f) /* Assertions */ HDassert(f != NULL); + + /* Enable the slist, as it is needed in the flush */ + if ( H5C_set_slist_enabled(f->shared->cache, TRUE, FALSE) < 0 ) + + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "set slist enabled failed") + + /* Flush all marked entries */ - if(H5C_flush_cache(f, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_IGNORE_PROTECTED_FLAG) < 0) + if ( H5C_flush_cache(f, H5C__FLUSH_MARKED_ENTRIES_FLAG | + H5C__FLUSH_IGNORE_PROTECTED_FLAG) < 0 ) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush cache") + /* Disable the slist. Set the clear_slist parameter to TRUE + * since we called H5C_flush_cache() with the + * H5C__FLUSH_MARKED_ENTRIES_FLAG. + */ + if ( H5C_set_slist_enabled(f->shared->cache, FALSE, TRUE) < 0 ) + + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "disable slist failed") + done: + FUNC_LEAVE_NOAPI(ret_value) + } /* H5C__flush_marked_entries */ @@ -8062,9 +8909,9 @@ H5C__serialize_cache(H5F_t *f) #endif /* H5C_DO_SANITY_CHECKS */ #if H5C_DO_EXTREME_SANITY_CHECKS - if((H5C_validate_protected_entry_list(cache_ptr) < 0) || - (H5C_validate_pinned_entry_list(cache_ptr) < 0) || - (H5C_validate_lru_list(cache_ptr) < 0)) + if((H5C__validate_protected_entry_list(cache_ptr) < 0) || + (H5C__validate_pinned_entry_list(cache_ptr) < 0) || + (H5C__validate_lru_list(cache_ptr) < 0)) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ @@ -8486,7 +9333,7 @@ done: * * Purpose: Serialize an entry and generate its image. * - * Note: This may cause the entry to be re-sized and/or moved in + * Note: This may cause the entry to be re-sized and/or moved in * the cache. * * As we will not update the metadata cache's data structures @@ -8500,18 +9347,22 @@ done: * Programmer: Mohamad Chaarawi * 2/10/16 * + * Changes: Updated sanity checks for the possibility that the skip + * list is disabled. + * JRM 5/16/20 + * *------------------------------------------------------------------------- */ -herr_t +static herr_t H5C__generate_image(H5F_t *f, H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr) { - haddr_t new_addr = HADDR_UNDEF; - haddr_t old_addr = HADDR_UNDEF; - size_t new_len = 0; + haddr_t new_addr = HADDR_UNDEF; + haddr_t old_addr = HADDR_UNDEF; + size_t new_len = 0; unsigned serialize_flags = H5C__SERIALIZE_NO_FLAGS_SET; herr_t ret_value = SUCCEED; - FUNC_ENTER_PACKAGE + FUNC_ENTER_STATIC /* Sanity check */ HDassert(f); @@ -8528,16 +9379,24 @@ H5C__generate_image(H5F_t *f, H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr) old_addr = entry_ptr->addr; /* Call client's pre-serialize callback, if there's one */ - if(entry_ptr->type->pre_serialize && - (entry_ptr->type->pre_serialize)(f, (void *)entry_ptr, - entry_ptr->addr, entry_ptr->size, &new_addr, &new_len, &serialize_flags) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to pre-serialize entry") + if ( ( entry_ptr->type->pre_serialize ) && + ( (entry_ptr->type->pre_serialize)(f, (void *)entry_ptr, + entry_ptr->addr, entry_ptr->size, + &new_addr, &new_len, + &serialize_flags) < 0 ) ) + + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \ + "unable to pre-serialize entry") /* Check for any flags set in the pre-serialize callback */ - if(serialize_flags != H5C__SERIALIZE_NO_FLAGS_SET) { + if ( serialize_flags != H5C__SERIALIZE_NO_FLAGS_SET ) { + /* Check for unexpected flags from serialize callback */ - if(serialize_flags & ~(H5C__SERIALIZE_RESIZED_FLAG | H5C__SERIALIZE_MOVED_FLAG)) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unknown serialize flag(s)") + if ( serialize_flags & ~(H5C__SERIALIZE_RESIZED_FLAG | + H5C__SERIALIZE_MOVED_FLAG) ) + + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \ + "unknown serialize flag(s)") #ifdef H5_HAVE_PARALLEL /* In the parallel case, resizes and moves in @@ -8566,28 +9425,40 @@ H5C__generate_image(H5F_t *f, H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr) * If that ceases to be the case, further * tests will be necessary. */ - if(cache_ptr->aux_ptr != NULL) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "resize/move in serialize occurred in parallel case") + if ( cache_ptr->aux_ptr != NULL ) + + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "resize/move in serialize occurred in parallel case") #endif /* If required, resize the buffer and update the entry and the cache - * data structures */ - if(serialize_flags & H5C__SERIALIZE_RESIZED_FLAG) { + * data structures + */ + if ( serialize_flags & H5C__SERIALIZE_RESIZED_FLAG ) { + /* Sanity check */ HDassert(new_len > 0); /* Allocate a new image buffer */ - if(NULL == (entry_ptr->image_ptr = H5MM_realloc(entry_ptr->image_ptr, new_len + H5C_IMAGE_EXTRA_SPACE))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for on disk image buffer") + if ( NULL == (entry_ptr->image_ptr = + H5MM_realloc(entry_ptr->image_ptr, + new_len + H5C_IMAGE_EXTRA_SPACE)) ) + + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, \ + "memory allocation failed for on disk image buffer") + #if H5C_DO_MEMORY_SANITY_CHECKS - H5MM_memcpy(((uint8_t *)entry_ptr->image_ptr) + new_len, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE); + H5MM_memcpy(((uint8_t *)entry_ptr->image_ptr) + new_len, + H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE); #endif /* H5C_DO_MEMORY_SANITY_CHECKS */ /* Update statistics for resizing the entry */ - H5C__UPDATE_STATS_FOR_ENTRY_SIZE_CHANGE(cache_ptr, entry_ptr, new_len); + H5C__UPDATE_STATS_FOR_ENTRY_SIZE_CHANGE(cache_ptr, entry_ptr, \ + new_len); /* Update the hash table for the size change */ - H5C__UPDATE_INDEX_FOR_SIZE_CHANGE(cache_ptr, entry_ptr->size, new_len, entry_ptr, !(entry_ptr->is_dirty)); + H5C__UPDATE_INDEX_FOR_SIZE_CHANGE(cache_ptr, entry_ptr->size, \ + new_len, entry_ptr, !(entry_ptr->is_dirty)); /* The entry can't be protected since we are in the process of * flushing it. Thus we must update the replacement policy data @@ -8598,25 +9469,32 @@ H5C__generate_image(H5F_t *f, H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr) /* As we haven't updated the cache data structures for * for the flush or flush destroy yet, the entry should - * be in the slist. Thus update it for the size change. + * be in the slist if the slist is enabled. Since + * H5C__UPDATE_SLIST_FOR_SIZE_CHANGE() is a no-op if the + * slist is enabled, call it un-conditionally. */ HDassert(entry_ptr->is_dirty); - HDassert(entry_ptr->in_slist); - H5C__UPDATE_SLIST_FOR_SIZE_CHANGE(cache_ptr, entry_ptr->size, new_len); + HDassert((entry_ptr->in_slist) || (!cache_ptr->slist_enabled)); + + H5C__UPDATE_SLIST_FOR_SIZE_CHANGE(cache_ptr, entry_ptr->size, \ + new_len); /* Finally, update the entry for its new size */ entry_ptr->size = new_len; + } /* end if */ /* If required, udate the entry and the cache data structures * for a move */ - if(serialize_flags & H5C__SERIALIZE_MOVED_FLAG) { + if ( serialize_flags & H5C__SERIALIZE_MOVED_FLAG ) { + /* Update stats and entries relocated counter */ H5C__UPDATE_STATS_FOR_MOVE(cache_ptr, entry_ptr) /* We must update cache data structures for the change in address */ - if(entry_ptr->addr == old_addr) { + if ( entry_ptr->addr == old_addr ) { + /* Delete the entry from the hash table and the slist */ H5C__DELETE_FROM_INDEX(cache_ptr, entry_ptr, FAIL); H5C__REMOVE_ENTRY_FROM_SLIST(cache_ptr, entry_ptr, FALSE); @@ -8627,18 +9505,26 @@ H5C__generate_image(H5F_t *f, H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr) /* And then reinsert in the index and slist */ H5C__INSERT_IN_INDEX(cache_ptr, entry_ptr, FAIL); H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, FAIL); + } /* end if */ - else /* move is already done for us -- just do sanity checks */ + else { /* move is already done for us -- just do sanity checks */ + HDassert(entry_ptr->addr == new_addr); + } } /* end if */ } /* end if(serialize_flags != H5C__SERIALIZE_NO_FLAGS_SET) */ /* Serialize object into buffer */ - if(entry_ptr->type->serialize(f, entry_ptr->image_ptr, entry_ptr->size, (void *)entry_ptr) < 0) + if ( entry_ptr->type->serialize(f, entry_ptr->image_ptr, entry_ptr->size, + (void *)entry_ptr) < 0 ) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to serialize entry") + #if H5C_DO_MEMORY_SANITY_CHECKS - HDassert(0 == HDmemcmp(((uint8_t *)entry_ptr->image_ptr) + entry_ptr->size, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE)); + HDassert(0 == HDmemcmp(((uint8_t *)entry_ptr->image_ptr) + entry_ptr->size,\ + H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE)); #endif /* H5C_DO_MEMORY_SANITY_CHECKS */ + entry_ptr->image_up_to_date = TRUE; /* Propagate the fact that the entry is serialized up the @@ -8648,9 +9534,14 @@ H5C__generate_image(H5F_t *f, H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr) * for flush dependency parents. */ HDassert(entry_ptr->flush_dep_nunser_children == 0); - if(entry_ptr->flush_dep_nparents > 0) - if(H5C__mark_flush_dep_serialized(entry_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "Can't propagate serialization status to fd parents") + + if ( entry_ptr->flush_dep_nparents > 0 ) { + + if ( H5C__mark_flush_dep_serialized(entry_ptr) < 0 ) + + HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, \ + "Can't propagate serialization status to fd parents") + } done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5CS.c b/src/H5CS.c index 3fccce4..324d383 100644 --- a/src/H5CS.c +++ b/src/H5CS.c @@ -123,8 +123,6 @@ H5CS__get_stack(void) * Programmer: Quincey Koziol * Thursday, February 6, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -214,8 +212,6 @@ H5CS_push(const char *func_name) * Programmer: Quincey Koziol * Thursday, February 6, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t diff --git a/src/H5CX.c b/src/H5CX.c index b78d9ec..6beaf56 100644 --- a/src/H5CX.c +++ b/src/H5CX.c @@ -11,7 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, February 19, 2018 * * Purpose: diff --git a/src/H5CXmodule.h b/src/H5CXmodule.h index f6a8f29..186f8aa 100644 --- a/src/H5CXmodule.h +++ b/src/H5CXmodule.h @@ -11,7 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Sunday, February 25, 2018 * * Purpose: This file contains declarations which define macros for the diff --git a/src/H5Cdbg.c b/src/H5Cdbg.c index d5599f2..ea27858 100644 --- a/src/H5Cdbg.c +++ b/src/H5Cdbg.c @@ -260,17 +260,24 @@ H5C_dump_cache_LRU(H5C_t *cache_ptr, const char *cache_name) /*------------------------------------------------------------------------- + * * Function: H5C_dump_cache_skip_list * * Purpose: Debugging routine that prints a summary of the contents of - * the skip list used by the metadata cache metadata cache to - * maintain an address sorted list of dirty entries. + * the skip list used by the metadata cache metadata cache to + * maintain an address sorted list of dirty entries. * * Return: Non-negative on success/Negative on failure * * Programmer: John Mainzer * 11/15/14 * + * Changes: Updated function for the slist_enabled field in H5C_t. + * Recall that to minimize slist overhead, the slist is + * empty and not maintained if cache_ptr->slist_enabled is + * false. + * JRM -- 5/6/20 + * *------------------------------------------------------------------------- */ #ifndef NDEBUG @@ -288,11 +295,16 @@ H5C_dump_cache_skip_list(H5C_t * cache_ptr, char * calling_fcn) HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); HDassert(calling_fcn != NULL); - HDfprintf(stdout, "\n\nDumping metadata cache skip list from %s.\n", calling_fcn); + HDfprintf(stdout, "\n\nDumping metadata cache skip list from %s.\n", + calling_fcn); + HDfprintf(stdout, " slist enabled = %d.\n", + (int)(cache_ptr->slist_enabled)); HDfprintf(stdout, " slist len = %u.\n", cache_ptr->slist_len); - HDfprintf(stdout, " slist size = %lld.\n", (long long)(cache_ptr->slist_size)); + HDfprintf(stdout, " slist size = %lld.\n", + (long long)(cache_ptr->slist_size)); if(cache_ptr->slist_len > 0) { + /* If we get this far, all entries in the cache are listed in the * skip list -- scan the skip list generating the desired output. */ @@ -300,13 +312,20 @@ H5C_dump_cache_skip_list(H5C_t * cache_ptr, char * calling_fcn) "Num: Addr: Len: Prot/Pind: Dirty: Type:\n"); i = 0; + node_ptr = H5SL_first(cache_ptr->slist_ptr); - if(node_ptr != NULL) + + if ( node_ptr != NULL ) { + entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr); - else + + } else { + entry_ptr = NULL; + } + + while ( entry_ptr != NULL ) { - while(entry_ptr != NULL) { HDassert( entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC ); HDfprintf(stdout, @@ -323,19 +342,27 @@ H5C_dump_cache_skip_list(H5C_t * cache_ptr, char * calling_fcn) node_ptr, H5SL_item(node_ptr)); /* increment node_ptr before we delete its target */ + node_ptr = H5SL_next(node_ptr); - if(node_ptr != NULL) + + if ( node_ptr != NULL ) { + entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr); - else + + } else { + entry_ptr = NULL; + } i++; + } /* end while */ } /* end if */ HDfprintf(stdout, "\n\n"); FUNC_LEAVE_NOAPI(ret_value) + } /* H5C_dump_cache_skip_list() */ #endif /* NDEBUG */ @@ -1086,74 +1113,6 @@ H5C_stats__reset(H5C_t H5_ATTR_UNUSED * cache_ptr) return; } /* H5C_stats__reset() */ -extern void -H5C__dump_entry(H5C_t *cache_ptr, const H5C_cache_entry_t *entry_ptr, - hbool_t dump_parents, const char *prefix, int indent); - -static void -H5C__dump_parents(H5C_t *cache_ptr, const H5C_cache_entry_t *entry_ptr, const char *prefix, int indent) -{ - unsigned u; - - for(u = 0; u < entry_ptr->flush_dep_nparents; u++) - H5C__dump_entry(cache_ptr, entry_ptr->flush_dep_parent[u], TRUE, prefix, indent + 2); -} - -typedef struct H5C__dump_child_ctx_t { - H5C_t *cache_ptr; - const H5C_cache_entry_t *parent; - hbool_t dump_parents; - const char *prefix; - int indent; -} H5C__dump_child_ctx_t; - -static int -H5C__dump_children_cb(H5C_cache_entry_t *entry_ptr, void *_ctx) -{ - H5C__dump_child_ctx_t *ctx = (H5C__dump_child_ctx_t *)_ctx; - - if(entry_ptr->tag_info->tag != entry_ptr->addr) { - unsigned u; - - HDassert(entry_ptr->flush_dep_nparents); - for(u = 0; u < entry_ptr->flush_dep_nparents; u++) - if(ctx->parent == entry_ptr->flush_dep_parent[u]) - H5C__dump_entry(ctx->cache_ptr, entry_ptr, ctx->dump_parents, ctx->prefix, ctx->indent + 2); - } /* end if */ - - return(H5_ITER_CONT); -} /* end H5C__dump_children_cb() */ - -static void -H5C__dump_children(H5C_t *cache_ptr, const H5C_cache_entry_t *entry_ptr, - hbool_t dump_parents, const char *prefix, int indent) -{ - H5C__dump_child_ctx_t ctx; - - HDassert(entry_ptr->tag_info); - - ctx.cache_ptr = cache_ptr; - ctx.parent = entry_ptr; - ctx.dump_parents = dump_parents; - ctx.prefix = prefix; - ctx.indent = indent; - H5C__iter_tagged_entries(cache_ptr, entry_ptr->tag_info->tag, FALSE, H5C__dump_children_cb, &ctx); -} /* end H5C__dump_children() */ - -void -H5C__dump_entry(H5C_t *cache_ptr, const H5C_cache_entry_t *entry_ptr, - hbool_t dump_parents, const char *prefix, int indent) -{ - HDassert(cache_ptr); - HDassert(entry_ptr); - - HDfprintf(stderr, "%*s%s: entry_ptr = (%a, '%s', %a, %t, %u, %u/%u)\n", indent, "", prefix, entry_ptr->addr, entry_ptr->type->name, entry_ptr->tag_info ? entry_ptr->tag_info->tag : HADDR_UNDEF, entry_ptr->is_dirty, entry_ptr->flush_dep_nparents, entry_ptr->flush_dep_nchildren, entry_ptr->flush_dep_ndirty_children); - if(dump_parents && entry_ptr->flush_dep_nparents) - H5C__dump_parents(cache_ptr, entry_ptr, "Parent", indent); - if(entry_ptr->flush_dep_nchildren) - H5C__dump_children(cache_ptr, entry_ptr, FALSE, "Child", indent); -} /* end H5C__dump_entry() */ - /*------------------------------------------------------------------------- * Function: H5C_flush_dependency_exists() diff --git a/src/H5Cimage.c b/src/H5Cimage.c index ee286d9..41e401e 100644 --- a/src/H5Cimage.c +++ b/src/H5Cimage.c @@ -431,36 +431,40 @@ done: * Function: H5C__deserialize_prefetched_entry() * * Purpose: Deserialize the supplied prefetched entry entry, and return - * a pointer to the deserialized entry in *entry_ptr_ptr. - * If successful, remove the prefetched entry from the cache, - * and free it. Insert the deserialized entry into the cache. - * - * Note that the on disk image of the entry is not freed -- - * a pointer to it is stored in the deserialized entries' - * image_ptr field, and its image_up_to_date field is set to - * TRUE unless the entry is dirtied by the deserialize call. - * - * If the prefetched entry is a flush dependency child, - * destroy that flush dependency prior to calling the - * deserialize callback. If appropriate, the flush dependency - * relationship will be recreated by the cache client. - * - * If the prefetched entry is a flush dependency parent, - * destroy the flush dependency relationship with all its - * children. As all these children must be prefetched entries, - * recreate these flush dependency relationships with - * deserialized entry after it is inserted in the cache. - * - * Since deserializing a prefetched entry is semantically - * equivalent to a load, issue an entry loaded nofification - * if the notify callback is defined. + * a pointer to the deserialized entry in *entry_ptr_ptr. + * If successful, remove the prefetched entry from the cache, + * and free it. Insert the deserialized entry into the cache. + * + * Note that the on disk image of the entry is not freed -- + * a pointer to it is stored in the deserialized entries' + * image_ptr field, and its image_up_to_date field is set to + * TRUE unless the entry is dirtied by the deserialize call. + * + * If the prefetched entry is a flush dependency child, + * destroy that flush dependency prior to calling the + * deserialize callback. If appropriate, the flush dependency + * relationship will be recreated by the cache client. + * + * If the prefetched entry is a flush dependency parent, + * destroy the flush dependency relationship with all its + * children. As all these children must be prefetched entries, + * recreate these flush dependency relationships with + * deserialized entry after it is inserted in the cache. + * + * Since deserializing a prefetched entry is semantically + * equivalent to a load, issue an entry loaded nofification + * if the notify callback is defined. * * Return: SUCCEED on success, and FAIL on failure. * - * Note that *entry_ptr_ptr is undefined on failure. + * Note that *entry_ptr_ptr is undefined on failure. * * Programmer: John Mainzer, 8/10/15 * + * Changes: Updated sanity checks for possibility that the slist + * is disabled. + * JRM -- 5/17/20 + * *------------------------------------------------------------------------- */ herr_t @@ -468,11 +472,11 @@ H5C__deserialize_prefetched_entry(H5F_t *f, H5C_t *cache_ptr, H5C_cache_entry_t **entry_ptr_ptr, const H5C_class_t *type, haddr_t addr, void *udata) { - hbool_t dirty = FALSE; /* Flag indicating whether thing was + hbool_t dirty = FALSE; /* Flag indicating whether thing was * dirtied during deserialize */ size_t len; /* Size of image in file */ - void * thing = NULL; /* Pointer to thing loaded */ + void * thing = NULL; /* Pointer to thing loaded */ H5C_cache_entry_t * pf_entry_ptr; /* pointer to the prefetched entry */ /* supplied in *entry_ptr_ptr. */ H5C_cache_entry_t * ds_entry_ptr; /* Alias for thing loaded, as cache @@ -484,8 +488,8 @@ H5C__deserialize_prefetched_entry(H5F_t *f, H5C_t *cache_ptr, /* the prefetched entry, or NULL if */ /* that array does not exist. */ unsigned flush_flags = (H5C__FLUSH_INVALIDATE_FLAG | - H5C__FLUSH_CLEAR_ONLY_FLAG); - int i; + H5C__FLUSH_CLEAR_ONLY_FLAG); + int i; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -604,73 +608,73 @@ H5C__deserialize_prefetched_entry(H5F_t *f, H5C_t *cache_ptr, HDassert( ( dirty == FALSE ) || ( type->id == 5 || type->id == 6) ); - ds_entry_ptr->magic = H5C__H5C_CACHE_ENTRY_T_MAGIC; - ds_entry_ptr->cache_ptr = f->shared->cache; - ds_entry_ptr->addr = addr; - ds_entry_ptr->size = len; + ds_entry_ptr->magic = H5C__H5C_CACHE_ENTRY_T_MAGIC; + ds_entry_ptr->cache_ptr = f->shared->cache; + ds_entry_ptr->addr = addr; + ds_entry_ptr->size = len; HDassert(ds_entry_ptr->size < H5C_MAX_ENTRY_SIZE); - ds_entry_ptr->image_ptr = pf_entry_ptr->image_ptr; - ds_entry_ptr->image_up_to_date = !dirty; - ds_entry_ptr->type = type; - ds_entry_ptr->is_dirty = dirty | pf_entry_ptr->is_dirty; - ds_entry_ptr->dirtied = FALSE; - ds_entry_ptr->is_protected = FALSE; - ds_entry_ptr->is_read_only = FALSE; - ds_entry_ptr->ro_ref_count = 0; - ds_entry_ptr->is_pinned = FALSE; - ds_entry_ptr->in_slist = FALSE; - ds_entry_ptr->flush_marker = FALSE; + ds_entry_ptr->image_ptr = pf_entry_ptr->image_ptr; + ds_entry_ptr->image_up_to_date = !dirty; + ds_entry_ptr->type = type; + ds_entry_ptr->is_dirty = dirty | pf_entry_ptr->is_dirty; + ds_entry_ptr->dirtied = FALSE; + ds_entry_ptr->is_protected = FALSE; + ds_entry_ptr->is_read_only = FALSE; + ds_entry_ptr->ro_ref_count = 0; + ds_entry_ptr->is_pinned = FALSE; + ds_entry_ptr->in_slist = FALSE; + ds_entry_ptr->flush_marker = FALSE; #ifdef H5_HAVE_PARALLEL - ds_entry_ptr->clear_on_unprotect = FALSE; - ds_entry_ptr->flush_immediately = FALSE; - ds_entry_ptr->coll_access = FALSE; + ds_entry_ptr->clear_on_unprotect = FALSE; + ds_entry_ptr->flush_immediately = FALSE; + ds_entry_ptr->coll_access = FALSE; #endif /* H5_HAVE_PARALLEL */ - ds_entry_ptr->flush_in_progress = FALSE; - ds_entry_ptr->destroy_in_progress = FALSE; + ds_entry_ptr->flush_in_progress = FALSE; + ds_entry_ptr->destroy_in_progress = FALSE; - ds_entry_ptr->ring = pf_entry_ptr->ring; + ds_entry_ptr->ring = pf_entry_ptr->ring; /* Initialize flush dependency height fields */ - ds_entry_ptr->flush_dep_parent = NULL; - ds_entry_ptr->flush_dep_nparents = 0; - ds_entry_ptr->flush_dep_parent_nalloc = 0; - ds_entry_ptr->flush_dep_nchildren = 0; - ds_entry_ptr->flush_dep_ndirty_children = 0; - ds_entry_ptr->flush_dep_nunser_children = 0; + ds_entry_ptr->flush_dep_parent = NULL; + ds_entry_ptr->flush_dep_nparents = 0; + ds_entry_ptr->flush_dep_parent_nalloc = 0; + ds_entry_ptr->flush_dep_nchildren = 0; + ds_entry_ptr->flush_dep_ndirty_children = 0; + ds_entry_ptr->flush_dep_nunser_children = 0; /* Initialize fields supporting the hash table: */ - ds_entry_ptr->ht_next = NULL; - ds_entry_ptr->ht_prev = NULL; - ds_entry_ptr->il_next = NULL; - ds_entry_ptr->il_prev = NULL; + ds_entry_ptr->ht_next = NULL; + ds_entry_ptr->ht_prev = NULL; + ds_entry_ptr->il_next = NULL; + ds_entry_ptr->il_prev = NULL; /* Initialize fields supporting replacement policies: */ - ds_entry_ptr->next = NULL; - ds_entry_ptr->prev = NULL; + ds_entry_ptr->next = NULL; + ds_entry_ptr->prev = NULL; #if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS - ds_entry_ptr->aux_next = NULL; - ds_entry_ptr->aux_prev = NULL; + ds_entry_ptr->aux_next = NULL; + ds_entry_ptr->aux_prev = NULL; #endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ #ifdef H5_HAVE_PARALLEL - pf_entry_ptr->coll_next = NULL; - pf_entry_ptr->coll_prev = NULL; + pf_entry_ptr->coll_next = NULL; + pf_entry_ptr->coll_prev = NULL; #endif /* H5_HAVE_PARALLEL */ /* Initialize cache image related fields */ - ds_entry_ptr->include_in_image = FALSE; - ds_entry_ptr->lru_rank = 0; - ds_entry_ptr->image_dirty = FALSE; - ds_entry_ptr->fd_parent_count = 0; - ds_entry_ptr->fd_parent_addrs = NULL; - ds_entry_ptr->fd_child_count = pf_entry_ptr->fd_child_count; - ds_entry_ptr->fd_dirty_child_count = 0; - ds_entry_ptr->image_fd_height = 0; - ds_entry_ptr->prefetched = FALSE; - ds_entry_ptr->prefetch_type_id = 0; - ds_entry_ptr->age = 0; - ds_entry_ptr->prefetched_dirty = pf_entry_ptr->prefetched_dirty; + ds_entry_ptr->include_in_image = FALSE; + ds_entry_ptr->lru_rank = 0; + ds_entry_ptr->image_dirty = FALSE; + ds_entry_ptr->fd_parent_count = 0; + ds_entry_ptr->fd_parent_addrs = NULL; + ds_entry_ptr->fd_child_count = pf_entry_ptr->fd_child_count; + ds_entry_ptr->fd_dirty_child_count = 0; + ds_entry_ptr->image_fd_height = 0; + ds_entry_ptr->prefetched = FALSE; + ds_entry_ptr->prefetch_type_id = 0; + ds_entry_ptr->age = 0; + ds_entry_ptr->prefetched_dirty = pf_entry_ptr->prefetched_dirty; #ifndef NDEBUG /* debugging field */ - ds_entry_ptr->serialization_count = 0; + ds_entry_ptr->serialization_count = 0; #endif /* NDEBUG */ H5C__RESET_CACHE_ENTRY_STATS(ds_entry_ptr); @@ -694,15 +698,20 @@ H5C__deserialize_prefetched_entry(H5F_t *f, H5C_t *cache_ptr, * * 1) Set pf_entry_ptr->image_ptr to NULL. Since we have already * transferred the buffer containing the image to *ds_entry_ptr, - * this is not a memory leak. + * this is not a memory leak. * * 2) Call H5C__flush_single_entry() with the H5C__FLUSH_INVALIDATE_FLAG * and H5C__FLUSH_CLEAR_ONLY_FLAG flags set. */ pf_entry_ptr->image_ptr = NULL; - if(pf_entry_ptr->is_dirty) { - HDassert(pf_entry_ptr->in_slist); + + if ( pf_entry_ptr->is_dirty ) { + + HDassert(((cache_ptr->slist_enabled) && (pf_entry_ptr->in_slist)) || \ + ((!cache_ptr->slist_enabled) && (!pf_entry_ptr->in_slist))); + flush_flags |= H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG; + } /* end if */ if(H5C__flush_single_entry(f, pf_entry_ptr, flush_flags) < 0) @@ -864,54 +873,6 @@ H5C__free_image_entries_array(H5C_t * cache_ptr) /*------------------------------------------------------------------------- - * Function: H5C_force_cache_image_load() - * - * Purpose: On rare occasions, it is necessary to run - * H5MF_tidy_self_referential_fsm_hack() prior to the first - * metadata cache access. This is a problem as if there is a - * cache image at the end of the file, that routine will - * discard it. - * - * We solve this issue by calling this function, which will - * load the cache image and then call - * H5MF_tidy_self_referential_fsm_hack() to discard it. - * - * Return: SUCCEED on success, and FAIL on failure. - * - * Programmer: John Mainzer - * 1/11/17 - * - *------------------------------------------------------------------------- - */ -herr_t -H5C_force_cache_image_load(H5F_t *f) -{ - H5C_t *cache_ptr; - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - /* Sanity checks */ - HDassert(f); - HDassert(f->shared); - cache_ptr = f->shared->cache; - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - HDassert(cache_ptr->load_image); - - /* Load the cache image, if requested */ - if(cache_ptr->load_image) { - cache_ptr->load_image = FALSE; - if(H5C__load_cache_image(f) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, FAIL, "can't load cache image") - } /* end if */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5C_force_cache_image_load() */ - - -/*------------------------------------------------------------------------- * Function: H5C_get_cache_image_config * * Purpose: Copy the current configuration for cache image generation diff --git a/src/H5Cmodule.h b/src/H5Cmodule.h index 534404d..5b23490 100644 --- a/src/H5Cmodule.h +++ b/src/H5Cmodule.h @@ -11,7 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, September 12, 2015 * * Purpose: This file contains declarations which define macros for the diff --git a/src/H5Cmpio.c b/src/H5Cmpio.c index 0ac4c4f..6e33eb1 100644 --- a/src/H5Cmpio.c +++ b/src/H5Cmpio.c @@ -34,14 +34,14 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ +#include "H5private.h" /* Generic Functions */ #include "H5ACprivate.h" /* Metadata cache */ -#include "H5Cpkg.h" /* Cache */ +#include "H5Cpkg.h" /* Cache */ #include "H5CXprivate.h" /* API Contexts */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fpkg.h" /* Files */ -#include "H5FDprivate.h" /* File drivers */ -#include "H5MMprivate.h" /* Memory management */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fpkg.h" /* Files */ +#include "H5FDprivate.h" /* File drivers */ +#include "H5MMprivate.h" /* Memory management */ #ifdef H5_HAVE_PARALLEL @@ -87,74 +87,74 @@ static herr_t H5C__flush_candidates_in_ring(H5F_t *f, H5C_ring_t ring, * * Purpose: Apply the supplied candidate list. * - * We used to do this by simply having each process write - * every mpi_size-th entry in the candidate list, starting - * at index mpi_rank, and mark all the others clean. + * We used to do this by simply having each process write + * every mpi_size-th entry in the candidate list, starting + * at index mpi_rank, and mark all the others clean. * - * However, this can cause unnecessary contention in a file - * system by increasing the number of processes writing to - * adjacent locations in the HDF5 file. + * However, this can cause unnecessary contention in a file + * system by increasing the number of processes writing to + * adjacent locations in the HDF5 file. * - * To attempt to minimize this, we now arange matters such - * that each process writes n adjacent entries in the - * candidate list, and marks all others clean. We must do - * this in such a fashion as to guarantee that each entry - * on the candidate list is written by exactly one process, - * and marked clean by all others. + * To attempt to minimize this, we now arange matters such + * that each process writes n adjacent entries in the + * candidate list, and marks all others clean. We must do + * this in such a fashion as to guarantee that each entry + * on the candidate list is written by exactly one process, + * and marked clean by all others. * - * To do this, first construct a table mapping mpi_rank - * to the index of the first entry in the candidate list to - * be written by the process of that mpi_rank, and then use - * the table to control which entries are written and which - * are marked as clean as a function of the mpi_rank. + * To do this, first construct a table mapping mpi_rank + * to the index of the first entry in the candidate list to + * be written by the process of that mpi_rank, and then use + * the table to control which entries are written and which + * are marked as clean as a function of the mpi_rank. * - * Note that the table must be identical on all processes, as - * all see the same candidate list, mpi_size, and mpi_rank -- - * the inputs used to construct the table. + * Note that the table must be identical on all processes, as + * all see the same candidate list, mpi_size, and mpi_rank -- + * the inputs used to construct the table. * - * We construct the table as follows. Let: + * We construct the table as follows. Let: * - * n = num_candidates / mpi_size; + * n = num_candidates / mpi_size; * - * m = num_candidates % mpi_size; + * m = num_candidates % mpi_size; * - * Now allocate an array of integers of length mpi_size + 1, - * and call this array candidate_assignment_table. + * Now allocate an array of integers of length mpi_size + 1, + * and call this array candidate_assignment_table. * - * Conceptually, if the number of candidates is a multiple - * of the mpi_size, we simply pass through the candidate list - * and assign n entries to each process to flush, with the - * index of the first entry to flush in the location in - * the candidate_assignment_table indicated by the mpi_rank - * of the process. + * Conceptually, if the number of candidates is a multiple + * of the mpi_size, we simply pass through the candidate list + * and assign n entries to each process to flush, with the + * index of the first entry to flush in the location in + * the candidate_assignment_table indicated by the mpi_rank + * of the process. * - * In the more common case in which the candidate list isn't - * isn't a multiple of the mpi_size, we pretend it is, and - * give num_candidates % mpi_size processes one extra entry - * each to make things work out. + * In the more common case in which the candidate list isn't + * isn't a multiple of the mpi_size, we pretend it is, and + * give num_candidates % mpi_size processes one extra entry + * each to make things work out. * - * Once the table is constructed, we determine the first and - * last entry this process is to flush as follows: + * Once the table is constructed, we determine the first and + * last entry this process is to flush as follows: * - * first_entry_to_flush = candidate_assignment_table[mpi_rank] + * first_entry_to_flush = candidate_assignment_table[mpi_rank] * - * last_entry_to_flush = - * candidate_assignment_table[mpi_rank + 1] - 1; + * last_entry_to_flush = + * candidate_assignment_table[mpi_rank + 1] - 1; * - * With these values determined, we simply scan through the - * candidate list, marking all entries in the range - * [first_entry_to_flush, last_entry_to_flush] for flush, - * and all others to be cleaned. + * With these values determined, we simply scan through the + * candidate list, marking all entries in the range + * [first_entry_to_flush, last_entry_to_flush] for flush, + * and all others to be cleaned. * - * Finally, we scan the LRU from tail to head, flushing - * or marking clean the candidate entries as indicated. - * If necessary, we scan the pinned list as well. + * Finally, we scan the LRU from tail to head, flushing + * or marking clean the candidate entries as indicated. + * If necessary, we scan the pinned list as well. * - * Note that this function will fail if any protected or - * clean entries appear on the candidate list. + * Note that this function will fail if any protected or + * clean entries appear on the candidate list. * - * This function is used in managing sync points, and - * shouldn't be used elsewhere. + * This function is used in managing sync points, and + * shouldn't be used elsewhere. * * Return: Success: SUCCEED * @@ -163,6 +163,10 @@ static herr_t H5C__flush_candidates_in_ring(H5F_t *f, H5C_ring_t ring, * Programmer: John Mainzer * 3/17/10 * + * Changes: Updated sanity checks to allow for the possibility that + * the slist is disabled. + * JRM -- 8/3/20 + * *------------------------------------------------------------------------- */ herr_t @@ -176,21 +180,24 @@ H5C_apply_candidate_list(H5F_t * f, int i; int m; unsigned n; - unsigned first_entry_to_flush; - unsigned last_entry_to_flush; - unsigned total_entries_to_clear = 0; - unsigned total_entries_to_flush = 0; + unsigned first_entry_to_flush; + unsigned last_entry_to_flush; + unsigned total_entries_to_clear = 0; + unsigned total_entries_to_flush = 0; unsigned * candidate_assignment_table = NULL; unsigned entries_to_flush[H5C_RING_NTYPES]; unsigned entries_to_clear[H5C_RING_NTYPES]; - haddr_t addr; - H5C_cache_entry_t * entry_ptr = NULL; + haddr_t addr; + H5C_cache_entry_t * entry_ptr = NULL; + #if H5C_DO_SANITY_CHECKS - haddr_t last_addr; + haddr_t last_addr; #endif /* H5C_DO_SANITY_CHECKS */ + #if H5C_APPLY_CANDIDATE_LIST__DEBUG - char tbl_buf[1024]; + char tbl_buf[1024]; #endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */ + unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ @@ -200,7 +207,8 @@ H5C_apply_candidate_list(H5F_t * f, HDassert(cache_ptr != NULL); HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); HDassert(num_candidates > 0); - HDassert(num_candidates <= cache_ptr->slist_len); + HDassert( ( ! cache_ptr->slist_enabled ) || + ( num_candidates <= cache_ptr->slist_len )); HDassert(candidates_list_ptr != NULL); HDassert(0 <= mpi_rank); HDassert(mpi_rank < mpi_size); @@ -410,13 +418,14 @@ done: /*------------------------------------------------------------------------- + * * Function: H5C_construct_candidate_list__clean_cache * * Purpose: Construct the list of entries that should be flushed to - * clean all entries in the cache. + * clean all entries in the cache. * - * This function is used in managing sync points, and - * shouldn't be used elsewhere. + * This function is used in managing sync points, and + * shouldn't be used elsewhere. * * Return: Success: SUCCEED * @@ -425,6 +434,16 @@ done: * Programmer: John Mainzer * 3/17/10 * + * Changes: With the slist optimization, the slist is not maintained + * unless a flush is in progress. Thus we can not longer use + * cache_ptr->slist_size to determine the total size of + * the entries we must insert in the candidate list. + * + * To address this, we now use cache_ptr->dirty_index_size + * instead. + * + * JRM -- 7/27/20 + * *------------------------------------------------------------------------- */ herr_t @@ -438,60 +457,82 @@ H5C_construct_candidate_list__clean_cache(H5C_t * cache_ptr) HDassert( cache_ptr != NULL ); HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); - /* As a sanity check, set space needed to the size of the skip list. - * This should be the sum total of the sizes of all the dirty entries - * in the metadata cache. + /* As a sanity check, set space needed to the dirty_index_size. This + * should be the sum total of the sizes of all the dirty entries + * in the metadata cache. Note that if the slist is enabled, + * cache_ptr->slist_size should equal cache_ptr->dirty_index_size. */ - space_needed = cache_ptr->slist_size; + space_needed = cache_ptr->dirty_index_size; + + HDassert( ( ! cache_ptr->slist_enabled ) || + ( space_needed == cache_ptr->slist_size ) ); + /* Recall that while we shouldn't have any protected entries at this * point, it is possible that some dirty entries may reside on the * pinned list at this point. */ - HDassert( cache_ptr->slist_size <= + HDassert( cache_ptr->dirty_index_size <= (cache_ptr->dLRU_list_size + cache_ptr->pel_size) ); - HDassert( cache_ptr->slist_len <= - (cache_ptr->dLRU_list_len + cache_ptr->pel_len) ); + HDassert( ( ! cache_ptr->slist_enabled ) || + ( cache_ptr->slist_len <= + (cache_ptr->dLRU_list_len + cache_ptr->pel_len) ) ); + if(space_needed > 0) { /* we have work to do */ + H5C_cache_entry_t *entry_ptr; unsigned nominated_entries_count = 0; size_t nominated_entries_size = 0; haddr_t nominated_addr; - HDassert( cache_ptr->slist_len > 0 ); + HDassert( ( ! cache_ptr->slist_enabled ) || + ( cache_ptr->slist_len > 0 ) ); /* Scan the dirty LRU list from tail forward and nominate sufficient * entries to free up the necessary space. */ entry_ptr = cache_ptr->dLRU_tail_ptr; - while((nominated_entries_size < space_needed) && - (nominated_entries_count < cache_ptr->slist_len) && - (entry_ptr != NULL)) { + + while ( ( nominated_entries_size < space_needed ) && + ( ( ! cache_ptr->slist_enabled ) || + ( nominated_entries_count < cache_ptr->slist_len ) ) && + ( entry_ptr != NULL ) ) { + HDassert( ! (entry_ptr->is_protected) ); HDassert( ! (entry_ptr->is_read_only) ); HDassert( entry_ptr->ro_ref_count == 0 ); HDassert( entry_ptr->is_dirty ); - HDassert( entry_ptr->in_slist ); + HDassert( ( ! cache_ptr->slist_enabled ) || + ( entry_ptr->in_slist ) ); nominated_addr = entry_ptr->addr; + if(H5AC_add_candidate((H5AC_t *)cache_ptr, nominated_addr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_add_candidate() failed") + + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "H5AC_add_candidate() failed") nominated_entries_size += entry_ptr->size; nominated_entries_count++; entry_ptr = entry_ptr->aux_prev; + } /* end while */ + HDassert( entry_ptr == NULL ); /* it is possible that there are some dirty entries on the * protected entry list as well -- scan it too if necessary */ entry_ptr = cache_ptr->pel_head_ptr; - while((nominated_entries_size < space_needed) && - (nominated_entries_count < cache_ptr->slist_len) && - (entry_ptr != NULL)) { + + while ( ( nominated_entries_size < space_needed ) && + ( ( ! cache_ptr->slist_enabled ) || + ( nominated_entries_count < cache_ptr->slist_len ) ) && + ( entry_ptr != NULL ) ) { + if(entry_ptr->is_dirty) { + HDassert( ! (entry_ptr->is_protected) ); HDassert( ! (entry_ptr->is_read_only) ); HDassert( entry_ptr->ro_ref_count == 0 ); @@ -499,22 +540,31 @@ H5C_construct_candidate_list__clean_cache(H5C_t * cache_ptr) HDassert( entry_ptr->in_slist ); nominated_addr = entry_ptr->addr; + if(H5AC_add_candidate((H5AC_t *)cache_ptr, nominated_addr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_add_candidate() failed") + + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "H5AC_add_candidate() failed") nominated_entries_size += entry_ptr->size; nominated_entries_count++; + } /* end if */ entry_ptr = entry_ptr->next; + } /* end while */ - HDassert( nominated_entries_count == cache_ptr->slist_len ); + HDassert( ( ! cache_ptr->slist_enabled ) || + ( nominated_entries_count == cache_ptr->slist_len ) ); HDassert( nominated_entries_size == space_needed ); + } /* end if */ done: + FUNC_LEAVE_NOAPI(ret_value) + } /* H5C_construct_candidate_list__clean_cache() */ @@ -522,10 +572,10 @@ done: * Function: H5C_construct_candidate_list__min_clean * * Purpose: Construct the list of entries that should be flushed to - * get the cache back within its min clean constraints. + * get the cache back within its min clean constraints. * - * This function is used in managing sync points, and - * shouldn't be used elsewhere. + * This function is used in managing sync points, and + * shouldn't be used elsewhere. * * Return: Success: SUCCEED * @@ -534,6 +584,12 @@ done: * Programmer: John Mainzer * 3/17/10 * + * Changes: With the slist optimization, the slist is not maintained + * unless a flush is in progress. Updated sanity checks to + * reflect this. + * + * JRM -- 7/27/20 + * *------------------------------------------------------------------------- */ herr_t @@ -551,54 +607,77 @@ H5C_construct_candidate_list__min_clean(H5C_t * cache_ptr) * cache back within its min clean constraints. */ if(cache_ptr->max_cache_size > cache_ptr->index_size) { - if(((cache_ptr->max_cache_size - cache_ptr->index_size) + - cache_ptr->cLRU_list_size) >= cache_ptr->min_clean_size) + + if ( ( (cache_ptr->max_cache_size - cache_ptr->index_size) + + cache_ptr->cLRU_list_size) >= cache_ptr->min_clean_size ) { + space_needed = 0; - else + + } else { + space_needed = cache_ptr->min_clean_size - ((cache_ptr->max_cache_size - cache_ptr->index_size) + cache_ptr->cLRU_list_size); + } } /* end if */ else { - if(cache_ptr->min_clean_size <= cache_ptr->cLRU_list_size) + + if(cache_ptr->min_clean_size <= cache_ptr->cLRU_list_size) { + space_needed = 0; - else + + } else { + space_needed = cache_ptr->min_clean_size - cache_ptr->cLRU_list_size; + } } /* end else */ if(space_needed > 0) { /* we have work to do */ + H5C_cache_entry_t *entry_ptr; unsigned nominated_entries_count = 0; size_t nominated_entries_size = 0; - HDassert( cache_ptr->slist_len > 0 ); + HDassert( ( ! cache_ptr->slist_enabled ) || + ( cache_ptr->slist_len > 0 ) ); /* Scan the dirty LRU list from tail forward and nominate sufficient * entries to free up the necessary space. */ entry_ptr = cache_ptr->dLRU_tail_ptr; - while((nominated_entries_size < space_needed) && - (nominated_entries_count < cache_ptr->slist_len) && - (entry_ptr != NULL) && - (!entry_ptr->flush_me_last)) { + + while ( ( nominated_entries_size < space_needed ) && + ( ( ! cache_ptr->slist_enabled ) || + ( nominated_entries_count < cache_ptr->slist_len ) ) && + ( entry_ptr != NULL ) && + ( ! entry_ptr->flush_me_last ) ) { + haddr_t nominated_addr; HDassert( ! (entry_ptr->is_protected) ); HDassert( ! (entry_ptr->is_read_only) ); HDassert( entry_ptr->ro_ref_count == 0 ); HDassert( entry_ptr->is_dirty ); - HDassert( entry_ptr->in_slist ); + HDassert( ( ! cache_ptr->slist_enabled ) || + ( entry_ptr->in_slist ) ); nominated_addr = entry_ptr->addr; + if(H5AC_add_candidate((H5AC_t *)cache_ptr, nominated_addr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_add_candidate() failed") + + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "H5AC_add_candidate() failed") nominated_entries_size += entry_ptr->size; nominated_entries_count++; entry_ptr = entry_ptr->aux_prev; + } /* end while */ - HDassert( nominated_entries_count <= cache_ptr->slist_len ); + + HDassert( ( ! cache_ptr->slist_enabled ) || + ( nominated_entries_count <= cache_ptr->slist_len ) ); + HDassert( nominated_entries_size <= cache_ptr->dirty_index_size ); HDassert( nominated_entries_size >= space_needed ); } /* end if */ @@ -612,24 +691,24 @@ done: * Function: H5C_mark_entries_as_clean * * Purpose: When the H5C code is used to implement the metadata caches - * in PHDF5, only the cache with MPI_rank 0 is allowed to - * actually write entries to disk -- all other caches must - * retain dirty entries until they are advised that the - * entries are clean. + * in PHDF5, only the cache with MPI_rank 0 is allowed to + * actually write entries to disk -- all other caches must + * retain dirty entries until they are advised that the + * entries are clean. * - * This function exists to allow the H5C code to receive these - * notifications. + * This function exists to allow the H5C code to receive these + * notifications. * - * The function receives a list of entry base addresses - * which must refer to dirty entries in the cache. If any - * of the entries are either clean or don't exist, the - * function flags an error. + * The function receives a list of entry base addresses + * which must refer to dirty entries in the cache. If any + * of the entries are either clean or don't exist, the + * function flags an error. * - * The function scans the list of entries and flushes all - * those that are currently unprotected with the - * H5C__FLUSH_CLEAR_ONLY_FLAG. Those that are currently - * protected are flagged for clearing when they are - * unprotected. + * The function scans the list of entries and flushes all + * those that are currently unprotected with the + * H5C__FLUSH_CLEAR_ONLY_FLAG. Those that are currently + * protected are flagged for clearing when they are + * unprotected. * * Return: Non-negative on success/Negative on failure * @@ -644,22 +723,22 @@ H5C_mark_entries_as_clean(H5F_t * f, haddr_t * ce_array_ptr) { H5C_t * cache_ptr; - unsigned entries_cleared; + unsigned entries_cleared; unsigned pinned_entries_cleared; hbool_t progress; - unsigned entries_examined; - unsigned initial_list_len; - haddr_t addr; - unsigned pinned_entries_marked = 0; + unsigned entries_examined; + unsigned initial_list_len; + haddr_t addr; + unsigned pinned_entries_marked = 0; #if H5C_DO_SANITY_CHECKS - unsigned protected_entries_marked = 0; - unsigned other_entries_marked = 0; - haddr_t last_addr; + unsigned protected_entries_marked = 0; + unsigned other_entries_marked = 0; + haddr_t last_addr; #endif /* H5C_DO_SANITY_CHECKS */ - H5C_cache_entry_t * clear_ptr = NULL; - H5C_cache_entry_t * entry_ptr = NULL; + H5C_cache_entry_t * clear_ptr = NULL; + H5C_cache_entry_t * entry_ptr = NULL; unsigned u; - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -706,7 +785,7 @@ H5C_mark_entries_as_clean(H5F_t * f, if(entry_ptr == NULL) { #if H5C_DO_SANITY_CHECKS - HDfprintf(stdout, + HDfprintf(stdout, "H5C_mark_entries_as_clean: entry[%u] = %a not in cache.\n", u, addr); @@ -715,7 +794,7 @@ H5C_mark_entries_as_clean(H5F_t * f, } /* end if */ else if(!entry_ptr->is_dirty) { #if H5C_DO_SANITY_CHECKS - HDfprintf(stdout, + HDfprintf(stdout, "H5C_mark_entries_as_clean: entry %a is not dirty!?!\n", addr); #endif /* H5C_DO_SANITY_CHECKS */ @@ -735,13 +814,13 @@ H5C_mark_entries_as_clean(H5F_t * f, } /* end if */ entry_ptr->clear_on_unprotect = TRUE; - if(entry_ptr->is_pinned) - pinned_entries_marked++; + if(entry_ptr->is_pinned) + pinned_entries_marked++; #if H5C_DO_SANITY_CHECKS - else if(entry_ptr->is_protected) - protected_entries_marked++; - else - other_entries_marked++; + else if(entry_ptr->is_protected) + protected_entries_marked++; + else + other_entries_marked++; #endif /* H5C_DO_SANITY_CHECKS */ } } @@ -769,7 +848,7 @@ H5C_mark_entries_as_clean(H5F_t * f, * of the pre_serialize / serialize routines, this may * cease to be the case -- requiring a review of this * point. - * JRM -- 4/7/15 + * JRM -- 4/7/15 */ entries_cleared = 0; entries_examined = 0; @@ -873,8 +952,8 @@ done: herr_t H5C_clear_coll_entries(H5C_t *cache_ptr, hbool_t partial) { - uint32_t clear_cnt; - H5C_cache_entry_t * entry_ptr = NULL; + uint32_t clear_cnt; + H5C_cache_entry_t * entry_ptr = NULL; herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI_NOINIT @@ -1084,7 +1163,7 @@ done: /*------------------------------------------------------------------------- * Function: H5C__flush_candidate_entries * - * Purpose: Flush or clear (as indicated) the candidate entries that + * Purpose: Flush or clear (as indicated) the candidate entries that * have been marked in the metadata cache. In so doing, * observe rings and flush dependencies. * @@ -1113,9 +1192,9 @@ done: * Return: Non-negative on success/Negative on failure. * * Programmer: John Mainzer - * 2/10/17 + * 2/10/17 * - * Changes: None. + * Changes: None. * *------------------------------------------------------------------------- */ @@ -1124,17 +1203,17 @@ H5C__flush_candidate_entries(H5F_t *f, unsigned entries_to_flush[H5C_RING_NTYPES unsigned entries_to_clear[H5C_RING_NTYPES]) { #if H5C_DO_SANITY_CHECKS - int i; - uint32_t index_len = 0; - size_t index_size = (size_t)0; - size_t clean_index_size = (size_t)0; - size_t dirty_index_size = (size_t)0; - size_t slist_size = (size_t)0; - uint32_t slist_len = 0; + int i; + uint32_t index_len = 0; + size_t index_size = (size_t)0; + size_t clean_index_size = (size_t)0; + size_t dirty_index_size = (size_t)0; + size_t slist_size = (size_t)0; + uint32_t slist_len = 0; #endif /* H5C_DO_SANITY_CHECKS */ - H5C_ring_t ring; + H5C_ring_t ring; H5C_t * cache_ptr; - herr_t ret_value = SUCCEED; + herr_t ret_value = SUCCEED; FUNC_ENTER_STATIC @@ -1164,7 +1243,7 @@ H5C__flush_candidate_entries(H5F_t *f, unsigned entries_to_flush[H5C_RING_NTYPES clean_index_size += cache_ptr->clean_index_ring_size[i]; dirty_index_size += cache_ptr->dirty_index_ring_size[i]; - slist_len += cache_ptr->slist_ring_len[i]; + slist_len += cache_ptr->slist_ring_len[i]; slist_size += cache_ptr->slist_ring_size[i]; } /* end for */ @@ -1206,7 +1285,7 @@ done: /*------------------------------------------------------------------------- * Function: H5C__flush_candidates_in_ring * - * Purpose: Flush or clear (as indicated) the candidate entries + * Purpose: Flush or clear (as indicated) the candidate entries * contained in the specified cache and ring. All candidate * entries in rings outside the specified ring must have been * flushed (or cleared) on entry. @@ -1235,7 +1314,7 @@ done: * Return: Non-negative on success/Negative on failure. * * Programmer: John Mainzer - * 2/10/17 + * 2/10/17 * *------------------------------------------------------------------------- */ diff --git a/src/H5Cpkg.h b/src/H5Cpkg.h index 8712af5..1226aa6 100644 --- a/src/H5Cpkg.h +++ b/src/H5Cpkg.h @@ -47,13 +47,22 @@ /* Number of epoch markers active */ #define H5C__MAX_EPOCH_MARKERS 10 + /* Cache configuration settings */ #define H5C__HASH_TABLE_LEN (64 * 1024) /* must be a power of 2 */ #define H5C__H5C_T_MAGIC 0x005CAC0E + /* Initial allocated size of the "flush_dep_parent" array */ #define H5C_FLUSH_DEP_PARENT_INIT 8 + +/* Set to TRUE to enable the slist optimization. If this field is TRUE, + * the slist is disabled whenever a flush is not in progress. + */ +#define H5C__SLIST_OPT_ENABLED TRUE + + /**************************************************************************** * * We maintain doubly linked lists of instances of H5C_cache_entry_t for a @@ -1568,49 +1577,82 @@ if ( ( (cache_ptr)->index_size != \ * Added code to maintain the cache_ptr->slist_ring_len * and cache_ptr->slist_ring_size arrays. * + * JRM -- 4/29/20 + * Reworked macro to support the slist_enabled field + * of H5C_t. If slist_enabled == TRUE, the macro + * functions as before. Otherwise, the macro is a no-op, + * and the slist must be empty. + * *------------------------------------------------------------------------- */ +/* NOTE: The H5C__INSERT_ENTRY_IN_SLIST() macro is set up so that + * + * H5C_DO_SANITY_CHECKS + * + * and + * + * H5C_DO_SLIST_SANITY_CHECKS + * + * can be selected independantly. This is easy to miss as the + * two #defines are easy to confuse. + */ + #if H5C_DO_SLIST_SANITY_CHECKS + #define ENTRY_IN_SLIST(cache_ptr, entry_ptr) \ H5C_entry_in_skip_list((cache_ptr), (entry_ptr)) + #else /* H5C_DO_SLIST_SANITY_CHECKS */ + #define ENTRY_IN_SLIST(cache_ptr, entry_ptr) FALSE + #endif /* H5C_DO_SLIST_SANITY_CHECKS */ + #if H5C_DO_SANITY_CHECKS #define H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, fail_val) \ { \ HDassert( (cache_ptr) ); \ HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ - HDassert( (entry_ptr) ); \ - HDassert( (entry_ptr)->size > 0 ); \ - HDassert( H5F_addr_defined((entry_ptr)->addr) ); \ - HDassert( !((entry_ptr)->in_slist) ); \ - HDassert( !ENTRY_IN_SLIST((cache_ptr), (entry_ptr)) ); \ - HDassert( (entry_ptr)->ring > H5C_RING_UNDEFINED ); \ - HDassert( (entry_ptr)->ring < H5C_RING_NTYPES ); \ - HDassert( (cache_ptr)->slist_ring_len[(entry_ptr)->ring] <= \ - (cache_ptr)->slist_len ); \ - HDassert( (cache_ptr)->slist_ring_size[(entry_ptr)->ring] <= \ - (cache_ptr)->slist_size ); \ \ - if(H5SL_insert((cache_ptr)->slist_ptr, entry_ptr, &(entry_ptr)->addr) < 0) \ - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, (fail_val), "can't insert entry in skip list") \ + if ( (cache_ptr)->slist_enabled ) { \ + \ + HDassert( (entry_ptr) ); \ + HDassert( (entry_ptr)->size > 0 ); \ + HDassert( H5F_addr_defined((entry_ptr)->addr) ); \ + HDassert( !((entry_ptr)->in_slist) ); \ + HDassert( ! ENTRY_IN_SLIST((cache_ptr), (entry_ptr)) ); \ + HDassert( (entry_ptr)->ring > H5C_RING_UNDEFINED ); \ + HDassert( (entry_ptr)->ring < H5C_RING_NTYPES ); \ + HDassert( (cache_ptr)->slist_ring_len[(entry_ptr)->ring] <= \ + (cache_ptr)->slist_len ); \ + HDassert( (cache_ptr)->slist_ring_size[(entry_ptr)->ring] <= \ + (cache_ptr)->slist_size ); \ + \ + if ( H5SL_insert((cache_ptr)->slist_ptr, entry_ptr, \ + &((entry_ptr)->addr)) < 0) \ + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, (fail_val), \ + "can't insert entry in skip list") \ + \ + (entry_ptr)->in_slist = TRUE; \ + (cache_ptr)->slist_changed = TRUE; \ + (cache_ptr)->slist_len++; \ + (cache_ptr)->slist_size += (entry_ptr)->size; \ + ((cache_ptr)->slist_ring_len[(entry_ptr)->ring])++; \ + ((cache_ptr)->slist_ring_size[(entry_ptr)->ring]) += (entry_ptr)->size;\ + (cache_ptr)->slist_len_increase++; \ + (cache_ptr)->slist_size_increase += (int64_t)((entry_ptr)->size); \ \ - (entry_ptr)->in_slist = TRUE; \ - (cache_ptr)->slist_changed = TRUE; \ - (cache_ptr)->slist_len++; \ - (cache_ptr)->slist_size += (entry_ptr)->size; \ - ((cache_ptr)->slist_ring_len[(entry_ptr)->ring])++; \ - ((cache_ptr)->slist_ring_size[(entry_ptr)->ring]) += (entry_ptr)->size; \ - (cache_ptr)->slist_len_increase++; \ - (cache_ptr)->slist_size_increase += (int64_t)((entry_ptr)->size); \ + HDassert( (cache_ptr)->slist_len > 0 ); \ + HDassert( (cache_ptr)->slist_size > 0 ); \ \ - HDassert( (cache_ptr)->slist_len > 0 ); \ - HDassert( (cache_ptr)->slist_size > 0 ); \ + } else { /* slist disabled */ \ \ + HDassert( (cache_ptr)->slist_len == 0 ); \ + HDassert( (cache_ptr)->slist_size == 0 ); \ + } \ } /* H5C__INSERT_ENTRY_IN_SLIST */ #else /* H5C_DO_SANITY_CHECKS */ @@ -1619,31 +1661,42 @@ if ( ( (cache_ptr)->index_size != \ { \ HDassert( (cache_ptr) ); \ HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ - HDassert( (entry_ptr) ); \ - HDassert( (entry_ptr)->size > 0 ); \ - HDassert( H5F_addr_defined((entry_ptr)->addr) ); \ - HDassert( !((entry_ptr)->in_slist) ); \ - HDassert( !ENTRY_IN_SLIST((cache_ptr), (entry_ptr)) ); \ - HDassert( (entry_ptr)->ring > H5C_RING_UNDEFINED ); \ - HDassert( (entry_ptr)->ring < H5C_RING_NTYPES ); \ - HDassert( (cache_ptr)->slist_ring_len[(entry_ptr)->ring] <= \ - (cache_ptr)->slist_len ); \ - HDassert( (cache_ptr)->slist_ring_size[(entry_ptr)->ring] <= \ - (cache_ptr)->slist_size ); \ \ - if(H5SL_insert((cache_ptr)->slist_ptr, entry_ptr, &(entry_ptr)->addr) < 0) \ - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, (fail_val), "can't insert entry in skip list") \ + if ( (cache_ptr)->slist_enabled ) { \ + \ + HDassert( (entry_ptr) ); \ + HDassert( (entry_ptr)->size > 0 ); \ + HDassert( ! ENTRY_IN_SLIST((cache_ptr), (entry_ptr)) ); \ + HDassert( H5F_addr_defined((entry_ptr)->addr) ); \ + HDassert( !((entry_ptr)->in_slist) ); \ + HDassert( (entry_ptr)->ring > H5C_RING_UNDEFINED ); \ + HDassert( (entry_ptr)->ring < H5C_RING_NTYPES ); \ + HDassert( (cache_ptr)->slist_ring_len[(entry_ptr)->ring] <= \ + (cache_ptr)->slist_len ); \ + HDassert( (cache_ptr)->slist_ring_size[(entry_ptr)->ring] <= \ + (cache_ptr)->slist_size ); \ + HDassert( (cache_ptr)->slist_ptr ); \ + \ + if ( H5SL_insert((cache_ptr)->slist_ptr, entry_ptr, \ + &((entry_ptr)->addr)) < 0) \ + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, (fail_val), \ + "can't insert entry in skip list") \ \ - (entry_ptr)->in_slist = TRUE; \ - (cache_ptr)->slist_changed = TRUE; \ - (cache_ptr)->slist_len++; \ - (cache_ptr)->slist_size += (entry_ptr)->size; \ - ((cache_ptr)->slist_ring_len[(entry_ptr)->ring])++; \ - ((cache_ptr)->slist_ring_size[(entry_ptr)->ring]) += (entry_ptr)->size; \ + (entry_ptr)->in_slist = TRUE; \ + (cache_ptr)->slist_changed = TRUE; \ + (cache_ptr)->slist_len++; \ + (cache_ptr)->slist_size += (entry_ptr)->size; \ + ((cache_ptr)->slist_ring_len[(entry_ptr)->ring])++; \ + ((cache_ptr)->slist_ring_size[(entry_ptr)->ring]) += (entry_ptr)->size;\ \ - HDassert( (cache_ptr)->slist_len > 0 ); \ - HDassert( (cache_ptr)->slist_size > 0 ); \ + HDassert( (cache_ptr)->slist_len > 0 ); \ + HDassert( (cache_ptr)->slist_size > 0 ); \ \ + } else { /* slist disabled */ \ + \ + HDassert( (cache_ptr)->slist_len == 0 ); \ + HDassert( (cache_ptr)->slist_size == 0 ); \ + } \ } /* H5C__INSERT_ENTRY_IN_SLIST */ #endif /* H5C_DO_SANITY_CHECKS */ @@ -1654,87 +1707,136 @@ if ( ( (cache_ptr)->index_size != \ * Function: H5C__REMOVE_ENTRY_FROM_SLIST * * Purpose: Remove the specified instance of H5C_cache_entry_t from the - * index skip list in the specified instance of H5C_t. Update - * the associated length and size fields. + * index skip list in the specified instance of H5C_t. Update + * the associated length and size fields. * * Return: N/A * * Programmer: John Mainzer, 5/10/04 * + * Modifications: + * + * JRM -- 7/21/04 + * Updated function for the addition of the hash table. + * + * JRM - 7/27/04 + * Converted from the function H5C_remove_entry_from_tree() + * to the macro H5C__REMOVE_ENTRY_FROM_TREE in the hopes of + * wringing a little more performance out of the cache. + * + * QAK -- 11/27/04 + * Switched over to using skip list routines. + * + * JRM -- 3/28/07 + * Updated sanity checks for the new is_read_only and + * ro_ref_count fields in H5C_cache_entry_t. + * + * JRM -- 12/13/14 + * Added code to set cache_ptr->slist_changed to TRUE + * when an entry is removed from the slist. + * + * JRM -- 4/29/20 + * Reworked macro to support the slist_enabled field + * of H5C_t. If slist_enabled == TRUE, the macro + * functions as before. Otherwise, the macro is a no-op, + * and the slist must be empty. + * *------------------------------------------------------------------------- */ #if H5C_DO_SANITY_CHECKS -#define H5C__REMOVE_ENTRY_FROM_SLIST(cache_ptr, entry_ptr, during_flush) \ -{ \ - HDassert( (cache_ptr) ); \ - HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ - HDassert( (entry_ptr) ); \ - HDassert( !((entry_ptr)->is_read_only) ); \ - HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \ - HDassert( (entry_ptr)->size > 0 ); \ - HDassert( (entry_ptr)->in_slist ); \ - HDassert( (cache_ptr)->slist_ptr ); \ - HDassert( (entry_ptr)->ring > H5C_RING_UNDEFINED ); \ - HDassert( (entry_ptr)->ring < H5C_RING_NTYPES ); \ - HDassert( (cache_ptr)->slist_ring_len[(entry_ptr)->ring] <= \ - (cache_ptr)->slist_len ); \ - HDassert( (cache_ptr)->slist_ring_size[(entry_ptr)->ring] <= \ - (cache_ptr)->slist_size ); \ - \ - if ( H5SL_remove((cache_ptr)->slist_ptr, &(entry_ptr)->addr) \ - != (entry_ptr) ) \ - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "can't delete entry from skip list") \ - \ - HDassert( (cache_ptr)->slist_len > 0 ); \ - if(!(during_flush)) \ - (cache_ptr)->slist_changed = TRUE; \ - (cache_ptr)->slist_len--; \ - HDassert( (cache_ptr)->slist_size >= (entry_ptr)->size ); \ - (cache_ptr)->slist_size -= (entry_ptr)->size; \ - ((cache_ptr)->slist_ring_len[(entry_ptr)->ring])--; \ - HDassert( (cache_ptr)->slist_ring_size[(entry_ptr->ring)] >= \ - (entry_ptr)->size ); \ - ((cache_ptr)->slist_ring_size[(entry_ptr)->ring]) -= (entry_ptr)->size; \ - (cache_ptr)->slist_len_increase--; \ - (cache_ptr)->slist_size_increase -= (int64_t)((entry_ptr)->size); \ - (entry_ptr)->in_slist = FALSE; \ +#define H5C__REMOVE_ENTRY_FROM_SLIST(cache_ptr, entry_ptr, during_flush) \ +{ \ + HDassert( (cache_ptr) ); \ + HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ + \ + if ( (cache_ptr)->slist_enabled ) { \ + \ + HDassert( (entry_ptr) ); \ + HDassert( !((entry_ptr)->is_read_only) ); \ + HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \ + HDassert( (entry_ptr)->size > 0 ); \ + HDassert( (entry_ptr)->in_slist ); \ + HDassert( (cache_ptr)->slist_ptr ); \ + HDassert( (entry_ptr)->ring > H5C_RING_UNDEFINED ); \ + HDassert( (entry_ptr)->ring < H5C_RING_NTYPES ); \ + HDassert( (cache_ptr)->slist_ring_len[(entry_ptr)->ring] <= \ + (cache_ptr)->slist_len ); \ + HDassert( (cache_ptr)->slist_ring_size[(entry_ptr)->ring] <= \ + (cache_ptr)->slist_size ); \ + HDassert( (cache_ptr)->slist_size >= (entry_ptr)->size ); \ + \ + if ( H5SL_remove((cache_ptr)->slist_ptr, &(entry_ptr)->addr) \ + != (entry_ptr) ) \ + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, \ + "can't delete entry from skip list") \ + \ + HDassert( (cache_ptr)->slist_len > 0 ); \ + if(!(during_flush)) \ + (cache_ptr)->slist_changed = TRUE; \ + (cache_ptr)->slist_len--; \ + HDassert( (cache_ptr)->slist_size >= (entry_ptr)->size ); \ + (cache_ptr)->slist_size -= (entry_ptr)->size; \ + ((cache_ptr)->slist_ring_len[(entry_ptr)->ring])--; \ + HDassert( (cache_ptr)->slist_ring_size[(entry_ptr->ring)] >= \ + (entry_ptr)->size ); \ + ((cache_ptr)->slist_ring_size[(entry_ptr)->ring]) -= (entry_ptr)->size;\ + (cache_ptr)->slist_len_increase--; \ + (cache_ptr)->slist_size_increase -= (int64_t)((entry_ptr)->size); \ + (entry_ptr)->in_slist = FALSE; \ + \ + } else { /* slist disabled */ \ + \ + HDassert( (cache_ptr)->slist_len == 0 ); \ + HDassert( (cache_ptr)->slist_size == 0 ); \ + } \ } /* H5C__REMOVE_ENTRY_FROM_SLIST */ #else /* H5C_DO_SANITY_CHECKS */ -#define H5C__REMOVE_ENTRY_FROM_SLIST(cache_ptr, entry_ptr, during_flush) \ -{ \ - HDassert( (cache_ptr) ); \ - HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ - HDassert( (entry_ptr) ); \ - HDassert( !((entry_ptr)->is_read_only) ); \ - HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \ - HDassert( (entry_ptr)->in_slist ); \ - HDassert( (cache_ptr)->slist_ptr ); \ - HDassert( (entry_ptr)->ring > H5C_RING_UNDEFINED ); \ - HDassert( (entry_ptr)->ring < H5C_RING_NTYPES ); \ - HDassert( (cache_ptr)->slist_ring_len[(entry_ptr)->ring] <= \ - (cache_ptr)->slist_len ); \ - HDassert( (cache_ptr)->slist_ring_size[(entry_ptr)->ring] <= \ - (cache_ptr)->slist_size ); \ - \ - if ( H5SL_remove((cache_ptr)->slist_ptr, &(entry_ptr)->addr) \ - != (entry_ptr) ) \ - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "can't delete entry from skip list") \ - \ - HDassert( (cache_ptr)->slist_len > 0 ); \ - if(!(during_flush)) \ - (cache_ptr)->slist_changed = TRUE; \ - (cache_ptr)->slist_len--; \ - HDassert( (cache_ptr)->slist_size >= (entry_ptr)->size ); \ - (cache_ptr)->slist_size -= (entry_ptr)->size; \ - ((cache_ptr)->slist_ring_len[(entry_ptr)->ring])--; \ - HDassert( (cache_ptr)->slist_ring_size[(entry_ptr->ring)] >= \ - (entry_ptr)->size ); \ - ((cache_ptr)->slist_ring_size[(entry_ptr)->ring]) -= (entry_ptr)->size; \ - (entry_ptr)->in_slist = FALSE; \ +#define H5C__REMOVE_ENTRY_FROM_SLIST(cache_ptr, entry_ptr, during_flush) \ +{ \ + HDassert( (cache_ptr) ); \ + HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ + \ + if ( (cache_ptr)->slist_enabled ) { \ + \ + HDassert( (entry_ptr) ); \ + HDassert( !((entry_ptr)->is_read_only) ); \ + HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \ + HDassert( (entry_ptr)->in_slist ); \ + HDassert( (cache_ptr)->slist_ptr ); \ + HDassert( (entry_ptr)->ring > H5C_RING_UNDEFINED ); \ + HDassert( (entry_ptr)->ring < H5C_RING_NTYPES ); \ + HDassert( (cache_ptr)->slist_ring_len[(entry_ptr)->ring] <= \ + (cache_ptr)->slist_len ); \ + HDassert( (cache_ptr)->slist_ring_size[(entry_ptr)->ring] <= \ + (cache_ptr)->slist_size ); \ + \ + if ( H5SL_remove((cache_ptr)->slist_ptr, &(entry_ptr)->addr) \ + != (entry_ptr) ) \ + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, \ + "can't delete entry from skip list") \ + \ + HDassert( (cache_ptr)->slist_len > 0 ); \ + if(!(during_flush)) \ + (cache_ptr)->slist_changed = TRUE; \ + (cache_ptr)->slist_len--; \ + HDassert( (cache_ptr)->slist_size >= (entry_ptr)->size ); \ + (cache_ptr)->slist_size -= (entry_ptr)->size; \ + ((cache_ptr)->slist_ring_len[(entry_ptr)->ring])--; \ + HDassert( (cache_ptr)->slist_ring_size[(entry_ptr->ring)] >= \ + (entry_ptr)->size ); \ + ((cache_ptr)->slist_ring_size[(entry_ptr)->ring]) -= (entry_ptr)->size;\ + (entry_ptr)->in_slist = FALSE; \ + \ + } else { /* slist disabled */ \ + \ + HDassert( (cache_ptr)->slist_len == 0 ); \ + HDassert( (cache_ptr)->slist_size == 0 ); \ + } \ } /* H5C__REMOVE_ENTRY_FROM_SLIST */ + #endif /* H5C_DO_SANITY_CHECKS */ @@ -1743,7 +1845,7 @@ if ( ( (cache_ptr)->index_size != \ * Function: H5C__UPDATE_SLIST_FOR_SIZE_CHANGE * * Purpose: Update cache_ptr->slist_size for a change in the size of - * and entry in the slist. + * and entry in the slist. * * Return: N/A * @@ -1751,24 +1853,30 @@ if ( ( (cache_ptr)->index_size != \ * * Modifications: * - * JRM -- 8/27/06 - * Added the H5C_DO_SANITY_CHECKS version of the macro. + * JRM -- 8/27/06 + * Added the H5C_DO_SANITY_CHECKS version of the macro. * - * This version maintains the slist_size_increase field - * that are used in sanity checks in the flush routines. + * This version maintains the slist_size_increase field + * that are used in sanity checks in the flush routines. * - * All this is needed as the fractal heap needs to be - * able to dirty, resize and/or move entries during the - * flush. + * All this is needed as the fractal heap needs to be + * able to dirty, resize and/or move entries during the + * flush. * - * JRM -- 12/13/14 - * Note that we do not set cache_ptr->slist_changed to TRUE - * in this case, as the structure of the slist is not - * modified. + * JRM -- 12/13/14 + * Note that we do not set cache_ptr->slist_changed to TRUE + * in this case, as the structure of the slist is not + * modified. * - * JRM -- 9/1/15 - * Added code to maintain the cache_ptr->slist_ring_len - * and cache_ptr->slist_ring_size arrays. + * JRM -- 9/1/15 + * Added code to maintain the cache_ptr->slist_ring_len + * and cache_ptr->slist_ring_size arrays. + * + * JRM -- 4/29/20 + * Reworked macro to support the slist_enabled field + * of H5C_t. If slist_enabled == TRUE, the macro + * functions as before. Otherwise, the macro is a no-op, + * and the slist must be empty. * *------------------------------------------------------------------------- */ @@ -1779,32 +1887,43 @@ if ( ( (cache_ptr)->index_size != \ { \ HDassert( (cache_ptr) ); \ HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ - HDassert( (old_size) > 0 ); \ - HDassert( (new_size) > 0 ); \ - HDassert( (old_size) <= (cache_ptr)->slist_size ); \ - HDassert( (cache_ptr)->slist_len > 0 ); \ - HDassert( ((cache_ptr)->slist_len > 1) || \ - ( (cache_ptr)->slist_size == (old_size) ) ); \ - HDassert( (entry_ptr)->ring > H5C_RING_UNDEFINED ); \ - HDassert( (entry_ptr)->ring < H5C_RING_NTYPES ); \ - HDassert( (cache_ptr)->slist_ring_len[(entry_ptr)->ring] <= \ - (cache_ptr)->slist_len ); \ - HDassert( (cache_ptr)->slist_ring_size[(entry_ptr)->ring] <= \ - (cache_ptr)->slist_size ); \ \ - (cache_ptr)->slist_size -= (old_size); \ - (cache_ptr)->slist_size += (new_size); \ + if ( (cache_ptr)->slist_enabled ) { \ + \ + HDassert( (old_size) > 0 ); \ + HDassert( (new_size) > 0 ); \ + HDassert( (old_size) <= (cache_ptr)->slist_size ); \ + HDassert( (cache_ptr)->slist_len > 0 ); \ + HDassert( ((cache_ptr)->slist_len > 1) || \ + ( (cache_ptr)->slist_size == (old_size) ) ); \ + HDassert( (entry_ptr)->ring > H5C_RING_UNDEFINED ); \ + HDassert( (entry_ptr)->ring < H5C_RING_NTYPES ); \ + HDassert( (cache_ptr)->slist_ring_len[(entry_ptr)->ring] <= \ + (cache_ptr)->slist_len ); \ + HDassert( (cache_ptr)->slist_ring_size[(entry_ptr)->ring] <= \ + (cache_ptr)->slist_size ); \ + \ + (cache_ptr)->slist_size -= (old_size); \ + (cache_ptr)->slist_size += (new_size); \ \ - HDassert( (cache_ptr)->slist_ring_size[(entry_ptr->ring)] >=(old_size) ); \ - ((cache_ptr)->slist_ring_size[(entry_ptr)->ring]) -= (old_size); \ - ((cache_ptr)->slist_ring_size[(entry_ptr)->ring]) += (new_size); \ + HDassert( (cache_ptr)->slist_ring_size[(entry_ptr->ring)] \ + >= (old_size) ); \ \ - (cache_ptr)->slist_size_increase -= (int64_t)(old_size); \ - (cache_ptr)->slist_size_increase += (int64_t)(new_size); \ + ((cache_ptr)->slist_ring_size[(entry_ptr)->ring]) -= (old_size); \ + ((cache_ptr)->slist_ring_size[(entry_ptr)->ring]) += (new_size); \ \ - HDassert( (new_size) <= (cache_ptr)->slist_size ); \ - HDassert( ( (cache_ptr)->slist_len > 1 ) || \ - ( (cache_ptr)->slist_size == (new_size) ) ); \ + (cache_ptr)->slist_size_increase -= (int64_t)(old_size); \ + (cache_ptr)->slist_size_increase += (int64_t)(new_size); \ + \ + HDassert( (new_size) <= (cache_ptr)->slist_size ); \ + HDassert( ( (cache_ptr)->slist_len > 1 ) || \ + ( (cache_ptr)->slist_size == (new_size) ) ); \ + \ + } else { /* slist disabled */ \ + \ + HDassert( (cache_ptr)->slist_len == 0 ); \ + HDassert( (cache_ptr)->slist_size == 0 ); \ + } \ } /* H5C__UPDATE_SLIST_FOR_SIZE_CHANGE */ #else /* H5C_DO_SANITY_CHECKS */ @@ -1813,29 +1932,39 @@ if ( ( (cache_ptr)->index_size != \ { \ HDassert( (cache_ptr) ); \ HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ - HDassert( (old_size) > 0 ); \ - HDassert( (new_size) > 0 ); \ - HDassert( (old_size) <= (cache_ptr)->slist_size ); \ - HDassert( (cache_ptr)->slist_len > 0 ); \ - HDassert( ((cache_ptr)->slist_len > 1) || \ - ( (cache_ptr)->slist_size == (old_size) ) ); \ - HDassert( (entry_ptr)->ring > H5C_RING_UNDEFINED ); \ - HDassert( (entry_ptr)->ring < H5C_RING_NTYPES ); \ - HDassert( (cache_ptr)->slist_ring_len[(entry_ptr)->ring] <= \ - (cache_ptr)->slist_len ); \ - HDassert( (cache_ptr)->slist_ring_size[(entry_ptr)->ring] <= \ - (cache_ptr)->slist_size ); \ \ - (cache_ptr)->slist_size -= (old_size); \ - (cache_ptr)->slist_size += (new_size); \ + if ( (cache_ptr)->slist_enabled ) { \ + \ + HDassert( (old_size) > 0 ); \ + HDassert( (new_size) > 0 ); \ + HDassert( (old_size) <= (cache_ptr)->slist_size ); \ + HDassert( (cache_ptr)->slist_len > 0 ); \ + HDassert( ((cache_ptr)->slist_len > 1) || \ + ( (cache_ptr)->slist_size == (old_size) ) ); \ + HDassert( (entry_ptr)->ring > H5C_RING_UNDEFINED ); \ + HDassert( (entry_ptr)->ring < H5C_RING_NTYPES ); \ + HDassert( (cache_ptr)->slist_ring_len[(entry_ptr)->ring] <= \ + (cache_ptr)->slist_len ); \ + HDassert( (cache_ptr)->slist_ring_size[(entry_ptr)->ring] <= \ + (cache_ptr)->slist_size ); \ + \ + (cache_ptr)->slist_size -= (old_size); \ + (cache_ptr)->slist_size += (new_size); \ \ - HDassert( (cache_ptr)->slist_ring_size[(entry_ptr->ring)] >=(old_size) ); \ - ((cache_ptr)->slist_ring_size[(entry_ptr)->ring]) -= (old_size); \ - ((cache_ptr)->slist_ring_size[(entry_ptr)->ring]) += (new_size); \ + HDassert( (cache_ptr)->slist_ring_size[(entry_ptr->ring)] >= \ + (old_size) ); \ + ((cache_ptr)->slist_ring_size[(entry_ptr)->ring]) -= (old_size); \ + ((cache_ptr)->slist_ring_size[(entry_ptr)->ring]) += (new_size); \ \ - HDassert( (new_size) <= (cache_ptr)->slist_size ); \ - HDassert( ( (cache_ptr)->slist_len > 1 ) || \ - ( (cache_ptr)->slist_size == (new_size) ) ); \ + HDassert( (new_size) <= (cache_ptr)->slist_size ); \ + HDassert( ( (cache_ptr)->slist_len > 1 ) || \ + ( (cache_ptr)->slist_size == (new_size) ) ); \ + \ + } else { /* slist disabled */ \ + \ + HDassert( (cache_ptr)->slist_len == 0 ); \ + HDassert( (cache_ptr)->slist_size == 0 ); \ + } \ } /* H5C__UPDATE_SLIST_FOR_SIZE_CHANGE */ #endif /* H5C_DO_SANITY_CHECKS */ @@ -3723,10 +3852,11 @@ typedef struct H5C_tag_info_t { * one. * * entry_watched_for_removal: Pointer to an instance of H5C_cache_entry_t - * which contains the 'next' entry for an iteration. Removing + * which contains the 'next' entry for an iteration. Removing * this entry must trigger a rescan of the iteration, so each * entry removed from the cache is compared against this pointer - * and the pointer is reset to NULL if the watched entry is removed. + * and the pointer is reset to NULL if the watched entry is + * removed. * (This functions similarly to a "dead man's switch") * * @@ -3740,6 +3870,36 @@ typedef struct H5C_tag_info_t { * are flushed. (this has been changed -- dirty entries are now removed from * the skip list as they are flushed. JRM - 10/25/05) * + * Update 4/21/20: + * + * Profiling indicates that the cost of maintaining the skip list is + * significant. As it is only used on flush and close, maintaining it + * only when needed is an obvious optimization. + * + * To do this, we add a flag to control maintenanace of the skip list. + * This flag is initially set to FALSE, which disables all operations + * on the skip list. + * + * At the beginning of either flush or close, we scan the index list, + * insert all dirtly entries in the skip list, and enable operations + * on skip list by setting above control flag to true. + * + * At the end of a complete flush, we verify that the skip list is empty, + * and set the control flag back to false, so as to avoid skip list + * maintenance overhead until the next flush or close. + * + * In the case of a partial flush (i.e. flush marked entries), we remove + * all remaining entries from the skip list, and then set the control flag + * back to false -- again avoiding skip list maintenance overhead until + * the next flush or close. + * + * slist_enabled: Boolean flag used to control operation of the skip + * list. If this filed is FALSE, operations on the + * slist are no-ops, and the slist must be empty. If + * it is TRUE, operations on the slist proceed as usual, + * and all dirty entries in the metadata cache must be + * listed in the slist. + * * slist_changed: Boolean flag used to indicate whether the contents of * the slist has changed since the last time this flag was * reset. This is used in the cache flush code to detect @@ -4649,6 +4809,7 @@ typedef struct H5C_tag_info_t { * NDEBUG is not #defined. * ****************************************************************************/ + struct H5C_t { uint32_t magic; hbool_t flush_in_progress; @@ -4664,7 +4825,7 @@ struct H5C_t { hbool_t evictions_enabled; hbool_t close_warning_received; - /* Fields for maintaining [hash table] index of entries */ + /* Fields for maintaining the [hash table] index of entries */ uint32_t index_len; size_t index_size; uint32_t index_ring_len[H5C_RING_NTYPES]; @@ -4685,6 +4846,7 @@ struct H5C_t { H5C_cache_entry_t * entry_watched_for_removal; /* Fields for maintaining list of in-order entries, for flushing */ + hbool_t slist_enabled; hbool_t slist_changed; uint32_t slist_len; size_t slist_size; @@ -4882,7 +5044,8 @@ struct H5C_t { #ifndef NDEBUG int64_t get_entry_ptr_from_addr_counter; #endif /* NDEBUG */ -}; + +}; /* H5C_t */ /* Define typedef for tagged cache entry iteration callbacks */ typedef int (*H5C_tag_iter_cb_t)(H5C_cache_entry_t *entry, void *ctx); @@ -4911,8 +5074,6 @@ H5_DLL herr_t H5C__mark_flush_dep_unserialized(H5C_cache_entry_t * entry_ptr); H5_DLL herr_t H5C__make_space_in_cache(H5F_t * f, size_t space_needed, hbool_t write_permitted); H5_DLL herr_t H5C__flush_marked_entries(H5F_t * f); -H5_DLL herr_t H5C__generate_image(H5F_t *f, H5C_t *cache_ptr, - H5C_cache_entry_t *entry_ptr); H5_DLL herr_t H5C__serialize_cache(H5F_t *f); H5_DLL herr_t H5C__iter_tagged_entries(H5C_t *cache, haddr_t tag, hbool_t match_global, H5C_tag_iter_cb_t cb, void *cb_ctx); diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h index 0ba0234..8934b95 100644 --- a/src/H5Cprivate.h +++ b/src/H5Cprivate.h @@ -20,8 +20,6 @@ * Purpose: Constants and typedefs available to the rest of the * library. * - * Modifications: - * *------------------------------------------------------------------------- */ @@ -2243,7 +2241,6 @@ H5_DLL herr_t H5C_expunge_entry(H5F_t *f, const H5C_class_t *type, haddr_t addr, unsigned flags); H5_DLL herr_t H5C_flush_cache(H5F_t *f, unsigned flags); H5_DLL herr_t H5C_flush_tagged_entries(H5F_t *f, haddr_t tag); -H5_DLL herr_t H5C_force_cache_image_load(H5F_t * f); H5_DLL herr_t H5C_evict_tagged_entries(H5F_t *f, haddr_t tag, hbool_t match_global); H5_DLL herr_t H5C_expunge_tag_type_metadata(H5F_t *f, haddr_t tag, int type_id, unsigned flags); H5_DLL herr_t H5C_get_tag(const void *thing, /*OUT*/ haddr_t *tag); @@ -2288,7 +2285,10 @@ H5_DLL herr_t H5C_resize_entry(void *thing, size_t new_size); H5_DLL herr_t H5C_set_cache_auto_resize_config(H5C_t *cache_ptr, H5C_auto_size_ctl_t *config_ptr); H5_DLL herr_t H5C_set_cache_image_config(const H5F_t *f, H5C_t *cache_ptr, H5C_cache_image_ctl_t *config_ptr); -H5_DLL herr_t H5C_set_evictions_enabled(H5C_t *cache_ptr, hbool_t evictions_enabled); +H5_DLL herr_t H5C_set_evictions_enabled(H5C_t *cache_ptr, + hbool_t evictions_enabled); +H5_DLL herr_t H5C_set_slist_enabled(H5C_t *cache_ptr, hbool_t slist_enabled, + hbool_t clear_slist); H5_DLL herr_t H5C_set_prefix(H5C_t *cache_ptr, char *prefix); H5_DLL herr_t H5C_stats(H5C_t *cache_ptr, const char *cache_name, hbool_t display_detailed_stats); diff --git a/src/H5Cpublic.h b/src/H5Cpublic.h index 62107d9..565f41b 100644 --- a/src/H5Cpublic.h +++ b/src/H5Cpublic.h @@ -19,8 +19,6 @@ * * Purpose: Public include file for cache functions. * - * Modifications: - * *------------------------------------------------------------------------- */ #ifndef _H5Cpublic_H diff --git a/src/H5Dbtree.c b/src/H5Dbtree.c index 098e01b..5b5ff4a 100644 --- a/src/H5Dbtree.c +++ b/src/H5Dbtree.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Robb Matzke +/* Programmer: Robb Matzke * Wednesday, October 8, 1997 * * Purpose: v1 B-tree indexed (chunked) I/O functions. The chunks are @@ -620,8 +620,7 @@ done: * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Pedro Vicente, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * March 28, 2002 * *------------------------------------------------------------------------- diff --git a/src/H5Dbtree2.c b/src/H5Dbtree2.c index ae98654..d233ce5 100644 --- a/src/H5Dbtree2.c +++ b/src/H5Dbtree2.c @@ -112,7 +112,7 @@ static herr_t H5D__bt2_found_cb(const void *nrecord, void *op_data); */ static herr_t H5D__bt2_remove_cb(const void *nrecord, void *_udata); -/* Callback for H5B2_modify() which is called in H5D__bt2_idx_insert() */ +/* Callback for H5B2_update() which is called in H5D__bt2_idx_insert() */ static herr_t H5D__bt2_mod_cb(void *_record, void *_op_data, hbool_t *changed); /* Chunked layout indexing callbacks for v2 B-tree indexing */ @@ -292,7 +292,7 @@ H5D__bt2_dst_context(void *_ctx) /* Free array for chunk dimension sizes */ if(ctx->dim) - (void)H5FL_ARR_FREE(uint32_t, ctx->dim); + H5FL_ARR_FREE(uint32_t, ctx->dim); /* Release callback context */ ctx = H5FL_FREE(H5D_bt2_ctx_t, ctx); @@ -837,7 +837,7 @@ H5D__bt2_idx_is_space_alloc(const H5O_storage_chunk_t *storage) * Function: H5D__bt2_mod_cb * * Purpose: Modify record for dataset chunk when it is found in a v2 B-tree. - * This is the callback for H5B2_modify() which is called in + * This is the callback for H5B2_update() which is called in * H5D__bt2_idx_insert(). * * Return: Success: non-negative @@ -1266,13 +1266,6 @@ done: * * Programmer: Vailin Choi; June 2010 * - * Modifications: - * Vailin Choi; March 2011 - * Initialize size of an unfiltered chunk. - * This is a fix for for the assertion failure in: - * [src/H5FSsection.c:968: H5FS_sect_link_size: Assertion `bin < sinfo->nbins' failed.] - * which is uncovered by test_unlink_chunked_dataset() in test/unlink.c - * *------------------------------------------------------------------------- */ static herr_t diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 5fda3c0..b2a9eb6 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol +/* Programmer: Quincey Koziol * Thursday, April 24, 2008 * * Purpose: Abstract indexed (chunked) I/O functions. The logical @@ -278,7 +278,7 @@ H5D__nonexistent_readvv(const H5D_io_info_t *io_info, size_t chunk_max_nseq, size_t *chunk_curr_seq, size_t chunk_len_arr[], hsize_t chunk_offset_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[]); -/* format convert cb */ +/* Format convert cb */ static int H5D__chunk_format_convert_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata); /* Helper routines */ @@ -300,9 +300,7 @@ static herr_t H5D__create_chunk_file_map_all(H5D_chunk_map_t *fm, const H5D_io_info_t *io_info); static herr_t H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t *io_info); - static herr_t H5D__create_chunk_mem_map_1d(const H5D_chunk_map_t *fm); - static herr_t H5D__create_chunk_mem_map_hyper(const H5D_chunk_map_t *fm); static herr_t H5D__chunk_file_cb(void *elem, const H5T_t *type, unsigned ndims, const hsize_t *coords, void *fm); @@ -327,8 +325,8 @@ static herr_t H5D__chunk_collective_fill(const H5D_t *dset, static int H5D__chunk_cmp_addr(const void *addr1, const void *addr2); #endif /* H5_HAVE_PARALLEL */ -static int -H5D__chunk_dump_index_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata); +/* Debugging helper routine callback */ +static int H5D__chunk_dump_index_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata); /*********************/ /* Package Variables */ @@ -999,7 +997,7 @@ H5D__chunk_init(H5F_t *f, const H5D_t * const dset, hid_t dapl_id) rdcc->scaled_dims[u] = (dset->shared->curr_dims[u] + dset->shared->layout.u.chunk.dim[u] - 1) / dset->shared->layout.u.chunk.dim[u]; - if( !(scaled_power2up = H5VM_power2up(rdcc->scaled_dims[u])) ) + if(!(scaled_power2up = H5VM_power2up(rdcc->scaled_dims[u]))) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get the next power of 2") /* Inital 'power2up' values for scaled dimensions */ @@ -1914,7 +1912,7 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t new_chunk_info->mspace_shared = FALSE; /* Copy the chunk's scaled coordinates */ - H5MM_memcpy(new_chunk_info->scaled, scaled, sizeof(hsize_t) * fm->f_ndims); + H5MM_memcpy(new_chunk_info->scaled, scaled, sizeof(hsize_t) * fm->f_ndims); new_chunk_info->scaled[fm->f_ndims] = 0; /* Insert the new chunk into the skip list */ @@ -2095,7 +2093,7 @@ H5D__create_chunk_mem_map_hyper(const H5D_chunk_map_t *fm) for(u = 0; u < fm->f_ndims; u++) { /* Compensate for the chunk offset */ H5_CHECK_OVERFLOW(coords[u], hsize_t, hssize_t); - chunk_adjust[u] = adjust[u] - (hssize_t)coords[u]; /*lint !e771 The adjust array will always be initialized */ + chunk_adjust[u] = adjust[u] - (hssize_t)coords[u]; } /* end for */ /* Adjust the selection */ @@ -2329,7 +2327,7 @@ H5D__chunk_mem_cb(void H5_ATTR_UNUSED *elem, const H5T_t H5_ATTR_UNUSED *type, u { H5D_chunk_map_t *fm = (H5D_chunk_map_t *)_fm; /* File<->memory chunk mapping info */ H5D_chunk_info_t *chunk_info; /* Chunk information for current chunk */ - hsize_t coords_in_mem[H5S_MAX_RANK]; /* Coordinates of element in memory */ + hsize_t coords_in_mem[H5S_MAX_RANK]; /* Coordinates of element in memory */ hsize_t chunk_index; /* Chunk index */ herr_t ret_value = SUCCEED; /* Return value */ @@ -2821,12 +2819,12 @@ H5D__chunk_flush(H5D_t *dset) /* Loop over all entries in the chunk cache */ for(ent = rdcc->head; ent; ent = next) { - next = ent->next; + next = ent->next; if(H5D__chunk_flush_entry(dset, ent, FALSE) < 0) nerrors++; } /* end for */ if(nerrors) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush one or more raw data chunks") + HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush one or more raw data chunks") done: FUNC_LEAVE_NOAPI(ret_value) @@ -2970,7 +2968,7 @@ H5D_chunk_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr) /* Reset index structures */ if((storage->ops->reset)(storage, reset_addr) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to reset chunk index info") + HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to reset chunk index info") done: FUNC_LEAVE_NOAPI(ret_value) @@ -2992,7 +2990,7 @@ done: static herr_t H5D__chunk_cinfo_cache_reset(H5D_chunk_cached_t *last) { - FUNC_ENTER_PACKAGE_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity check */ HDassert(last); @@ -3147,8 +3145,8 @@ done: /*------------------------------------------------------------------------- * Function: H5D__chunk_hash_val * - * Purpose: To calculate an index based on the dataset's scaled - * coordinates and sizes of the faster dimensions. + * Purpose: To calculate an index based on the dataset's scaled + * coordinates and sizes of the faster dimensions. * * Return: Hash value index * @@ -3615,14 +3613,14 @@ H5D__chunk_cache_evict(const H5D_t *dset, H5D_rdcc_ent_t *ent, hbool_t flush) static herr_t H5D__chunk_cache_prune(const H5D_t *dset, size_t size) { - const H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk); - size_t total = rdcc->nbytes_max; - const int nmeth = 2; /*number of methods */ - int w[1]; /*weighting as an interval */ - H5D_rdcc_ent_t *p[2], *cur; /*list pointers */ - H5D_rdcc_ent_t *n[2]; /*list next pointers */ - int nerrors = 0; /* Accumulated error count during preemptions */ - herr_t ret_value = SUCCEED; /* Return value */ + const H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk); + size_t total = rdcc->nbytes_max; + const int nmeth = 2; /* Number of methods */ + int w[1]; /* Weighting as an interval */ + H5D_rdcc_ent_t *p[2], *cur; /* List pointers */ + H5D_rdcc_ent_t *n[2]; /* List next pointers */ + int nerrors = 0; /* Accumulated error count during preemptions */ + herr_t ret_value = SUCCEED;/* Return value */ FUNC_ENTER_STATIC @@ -3643,62 +3641,62 @@ H5D__chunk_cache_prune(const H5D_t *dset, size_t size) while((p[0] || p[1]) && (rdcc->nbytes_used + size) > total) { int i; /* Local index variable */ - /* Introduce new pointers */ - for(i = 0; i < nmeth - 1; i++) + /* Introduce new pointers */ + for(i = 0; i < nmeth - 1; i++) if(0 == w[i]) p[i + 1] = rdcc->head; - /* Compute next value for each pointer */ - for(i = 0; i < nmeth; i++) + /* Compute next value for each pointer */ + for(i = 0; i < nmeth; i++) n[i] = p[i] ? p[i]->next : NULL; - /* Give each method a chance */ - for(i = 0; i < nmeth && (rdcc->nbytes_used + size) > total; i++) { - if(0 == i && p[0] && !p[0]->locked && + /* Give each method a chance */ + for(i = 0; i < nmeth && (rdcc->nbytes_used + size) > total; i++) { + if(0 == i && p[0] && !p[0]->locked && ((0 == p[0]->rd_count && 0 == p[0]->wr_count) || - (0 == p[0]->rd_count && dset->shared->layout.u.chunk.size == p[0]->wr_count) || - (dset->shared->layout.u.chunk.size == p[0]->rd_count && 0 == p[0]->wr_count))) { - /* - * Method 0: Preempt entries that have been completely written - * and/or completely read but not entries that are partially - * written or partially read. - */ - cur = p[0]; - } else if(1 == i && p[1] && !p[1]->locked) { - /* - * Method 1: Preempt the entry without regard to - * considerations other than being locked. This is the last - * resort preemption. - */ - cur = p[1]; - } else { - /* Nothing to preempt at this point */ - cur = NULL; - } + (0 == p[0]->rd_count && dset->shared->layout.u.chunk.size == p[0]->wr_count) || + (dset->shared->layout.u.chunk.size == p[0]->rd_count && 0 == p[0]->wr_count))) { + /* + * Method 0: Preempt entries that have been completely written + * and/or completely read but not entries that are partially + * written or partially read. + */ + cur = p[0]; + } else if(1 == i && p[1] && !p[1]->locked) { + /* + * Method 1: Preempt the entry without regard to + * considerations other than being locked. This is the last + * resort preemption. + */ + cur = p[1]; + } else { + /* Nothing to preempt at this point */ + cur = NULL; + } - if(cur) { + if(cur) { int j; /* Local index variable */ - for(j = 0; j < nmeth; j++) { - if(p[j] == cur) + for(j = 0; j < nmeth; j++) { + if(p[j] == cur) p[j] = NULL; - if(n[j] == cur) + if(n[j] == cur) n[j] = cur->next; - } /* end for */ - if(H5D__chunk_cache_evict(dset, cur, TRUE) < 0) + } /* end for */ + if(H5D__chunk_cache_evict(dset, cur, TRUE) < 0) nerrors++; - } /* end if */ - } /* end for */ + } /* end if */ + } /* end for */ - /* Advance pointers */ - for(i = 0; i < nmeth; i++) + /* Advance pointers */ + for(i = 0; i < nmeth; i++) p[i] = n[i]; - for(i = 0; i < nmeth - 1; i++) + for(i = 0; i < nmeth - 1; i++) w[i] -= 1; } /* end while */ if(nerrors) - HGOTO_ERROR(H5E_IO, H5E_CANTFLUSH, FAIL, "unable to preempt one or more raw data cache entry") + HGOTO_ERROR(H5E_IO, H5E_CANTFLUSH, FAIL, "unable to preempt one or more raw data cache entry") done: FUNC_LEAVE_NOAPI(ret_value) @@ -4347,7 +4345,7 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_ hbool_t unfilt_edge_chunk_dim[H5O_LAYOUT_NDIMS]; /* Whether there are unfiltered edge chunks at the edge of each dimension */ hsize_t edge_chunk_scaled[H5O_LAYOUT_NDIMS]; /* Offset of the unfiltered edge chunks at the edge of each dimension */ unsigned nunfilt_edge_chunk_dims = 0; /* Number of dimensions on an edge */ - const H5O_storage_chunk_t *sc = &(layout->storage.u.chunk); + H5O_storage_chunk_t *sc = &(layout->storage.u.chunk); /* Convenience variable */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -4556,9 +4554,8 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address") #ifndef NDEBUG /* None of the chunks should be allocated */ - if(H5D_CHUNK_IDX_NONE != sc->idx_type) { + if(H5D_CHUNK_IDX_NONE != sc->idx_type) HDassert(!H5F_addr_defined(udata.chunk_block.offset)); - } /* Make sure the chunk is really in the dataset and outside the * original dimensions */ @@ -4957,7 +4954,7 @@ H5D__chunk_collective_fill(const H5D_t *dset, H5D_chunk_coll_info_t *chunk_info, int blocks, leftover, block_len; /* converted to int for MPI */ MPI_Aint *chunk_disp_array = NULL; int *block_lens = NULL; - MPI_Datatype mem_type, file_type; + MPI_Datatype mem_type = MPI_BYTE, file_type = MPI_BYTE; H5FD_mpio_xfer_t prev_xfer_mode; /* Previous data xfer mode */ hbool_t have_xfer_mode = FALSE; /* Whether the previous xffer mode has been retrieved */ hbool_t need_addr_sort = FALSE; @@ -4983,9 +4980,9 @@ H5D__chunk_collective_fill(const H5D_t *dset, H5D_chunk_coll_info_t *chunk_info, HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "Resulted in division by zero") num_blocks = (size_t)(chunk_info->num_io / (size_t)mpi_size); /* value should be the same on all procs */ - /* after evenly distributing the blocks between processes, are - there any leftover blocks for each individual process - (round-robin) */ + /* After evenly distributing the blocks between processes, are there any + * leftover blocks for each individual process (round-robin)? + */ leftover_blocks = (size_t)(chunk_info->num_io % (size_t)mpi_size); /* Cast values to types needed by MPI */ @@ -4993,58 +4990,62 @@ H5D__chunk_collective_fill(const H5D_t *dset, H5D_chunk_coll_info_t *chunk_info, H5_CHECKED_ASSIGN(leftover, int, leftover_blocks, size_t); H5_CHECKED_ASSIGN(block_len, int, chunk_size, size_t); - /* Allocate buffers */ - /* (MSC - should not need block_lens if MPI_type_create_hindexed_block is working) */ - if(NULL == (block_lens = (int *)H5MM_malloc((size_t)(blocks + 1) * sizeof(int)))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate chunk lengths buffer") - if(NULL == (chunk_disp_array = (MPI_Aint *)H5MM_malloc((size_t)(blocks + 1) * sizeof(MPI_Aint)))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate chunk file displacement buffer") + /* Check if we have any chunks to write on this rank */ + if(num_blocks > 0 || (leftover && leftover > mpi_rank)) { + /* Allocate buffers */ + /* (MSC - should not need block_lens if MPI_type_create_hindexed_block is working) */ + if(NULL == (block_lens = (int *)H5MM_malloc((size_t)(blocks + 1) * sizeof(int)))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate chunk lengths buffer") + if(NULL == (chunk_disp_array = (MPI_Aint *)H5MM_malloc((size_t)(blocks + 1) * sizeof(MPI_Aint)))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate chunk file displacement buffer") - for(i = 0 ; i < blocks ; i++) { - /* store the chunk address as an MPI_Aint */ - chunk_disp_array[i] = (MPI_Aint)(chunk_info->addr[i + mpi_rank*blocks]); + for(i = 0 ; i < blocks ; i++) { + /* store the chunk address as an MPI_Aint */ + chunk_disp_array[i] = (MPI_Aint)(chunk_info->addr[i + (mpi_rank * blocks)]); - /* MSC - should not need this if MPI_type_create_hindexed_block is working */ - block_lens[i] = block_len; + /* MSC - should not need this if MPI_type_create_hindexed_block is working */ + block_lens[i] = block_len; - /* make sure that the addresses in the datatype are - monotonically non decreasing */ - if(i && (chunk_disp_array[i] < chunk_disp_array[i - 1])) - need_addr_sort = TRUE; - } /* end for */ + /* Make sure that the addresses in the datatype are + * monotonically non-decreasing + */ + if(i && (chunk_disp_array[i] < chunk_disp_array[i - 1])) + need_addr_sort = TRUE; + } /* end for */ - /* calculate if there are any leftover blocks after evenly - distributing. If there are, then round robin the distribution - to processes 0 -> leftover. */ - if(leftover && leftover > mpi_rank) { - chunk_disp_array[blocks] = (MPI_Aint)chunk_info->addr[blocks*mpi_size + mpi_rank]; - if(blocks && (chunk_disp_array[blocks] < chunk_disp_array[blocks - 1])) - need_addr_sort = TRUE; - block_lens[blocks] = block_len; - blocks++; - } + /* Calculate if there are any leftover blocks after evenly + * distributing. If there are, then round-robin the distribution + * to processes 0 -> leftover. + */ + if(leftover && leftover > mpi_rank) { + chunk_disp_array[blocks] = (MPI_Aint)chunk_info->addr[(blocks * mpi_size) + mpi_rank]; + if(blocks && (chunk_disp_array[blocks] < chunk_disp_array[blocks - 1])) + need_addr_sort = TRUE; + block_lens[blocks] = block_len; + blocks++; + } - /* - * Ensure that the blocks are sorted in monotonically non-decreasing - * order of offset in the file. - */ - if(need_addr_sort) - HDqsort(chunk_disp_array, blocks, sizeof(MPI_Aint), H5D__chunk_cmp_addr); + /* Ensure that the blocks are sorted in monotonically non-decreasing + * order of offset in the file. + */ + if(need_addr_sort) + HDqsort(chunk_disp_array, blocks, sizeof(MPI_Aint), H5D__chunk_cmp_addr); - /* MSC - should use this if MPI_type_create_hindexed block is working: - * mpi_code = MPI_Type_create_hindexed_block(blocks, block_len, chunk_disp_array, MPI_BYTE, &file_type); - */ - mpi_code = MPI_Type_create_hindexed(blocks, block_lens, chunk_disp_array, MPI_BYTE, &file_type); - if(mpi_code != MPI_SUCCESS) - HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed failed", mpi_code) - if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(&file_type))) - HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code) - - mpi_code = MPI_Type_create_hvector(blocks, block_len, 0, MPI_BYTE, &mem_type); - if(mpi_code != MPI_SUCCESS) - HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hvector failed", mpi_code) - if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(&mem_type))) - HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code) + /* MSC - should use this if MPI_type_create_hindexed block is working: + * mpi_code = MPI_Type_create_hindexed_block(blocks, block_len, chunk_disp_array, MPI_BYTE, &file_type); + */ + mpi_code = MPI_Type_create_hindexed(blocks, block_lens, chunk_disp_array, MPI_BYTE, &file_type); + if(mpi_code != MPI_SUCCESS) + HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed failed", mpi_code) + if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(&file_type))) + HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code) + + mpi_code = MPI_Type_create_hvector(blocks, block_len, 0, MPI_BYTE, &mem_type); + if(mpi_code != MPI_SUCCESS) + HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hvector failed", mpi_code) + if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(&mem_type))) + HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code) + } /* end if */ /* Set MPI-IO VFD properties */ @@ -5076,10 +5077,12 @@ done: HDONE_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set transfer mode") /* free things */ - if(MPI_SUCCESS != (mpi_code = MPI_Type_free(&file_type))) - HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code) - if(MPI_SUCCESS != (mpi_code = MPI_Type_free(&mem_type))) - HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code) + if(MPI_BYTE != file_type) + if(MPI_SUCCESS != (mpi_code = MPI_Type_free(&file_type))) + HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code) + if(MPI_BYTE != mem_type) + if(MPI_SUCCESS != (mpi_code = MPI_Type_free(&mem_type))) + HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code) H5MM_xfree(chunk_disp_array); H5MM_xfree(block_lens); @@ -5126,8 +5129,8 @@ H5D__chunk_cmp_addr(const void *addr1, const void *addr2) * * Return: Non-negative on success/Negative on failure * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * March 26, 2002 + * Programmer: Pedro Vicente + * March 26, 2002 * *------------------------------------------------------------------------- */ @@ -5252,7 +5255,7 @@ done: * * Return: Non-negative on success/Negative on failure * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * Algorithm: Robb Matzke * March 27, 2002 * @@ -5405,13 +5408,13 @@ H5D__chunk_prune_by_extent(H5D_t *dset, const hsize_t *old_dim) elmts_per_chunk = 1; for(u = 0; u < space_ndims; u++) { elmts_per_chunk *= layout->u.chunk.dim[u]; - chunk_dim[u] = layout->u.chunk.dim[u]; - shrunk_dim[u] = (space_dim[u] < old_dim[u]); + chunk_dim[u] = layout->u.chunk.dim[u]; + shrunk_dim[u] = (space_dim[u] < old_dim[u]); } /* end for */ /* Create a dataspace for a chunk & set the extent */ if(NULL == (chunk_space = H5S_create_simple(space_ndims, chunk_dim, NULL))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create simple dataspace") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create simple dataspace") /* Reset hyperslab start array */ /* (hyperslabs will always start from origin) */ @@ -5599,7 +5602,7 @@ H5D__chunk_prune_by_extent(H5D_t *dset, const hsize_t *old_dim) /* Remove the chunk from disk, if present */ if(H5F_addr_defined(chk_udata.chunk_block.offset)) { /* Update the offset in idx_udata */ - idx_udata.scaled = udata.common.scaled; + idx_udata.scaled = udata.common.scaled; /* Remove the chunk from disk */ if((sc->ops->remove)(&idx_info, &idx_udata) < 0) @@ -5989,9 +5992,9 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) if(pline && pline->nused) { must_filter = TRUE; if((udata->common.layout->flags & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS) && - H5D__chunk_is_partial_edge_chunk(udata->dset_ndims, udata->common.layout->dim, chunk_rec->scaled, udata->dset_dims)) + H5D__chunk_is_partial_edge_chunk(udata->dset_ndims, udata->common.layout->dim, chunk_rec->scaled, udata->dset_dims)) must_filter = FALSE; - } /* end if */ + } /* Check parameter for type conversion */ if(udata->do_convert) { @@ -6029,7 +6032,7 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) HDassert(!H5F_addr_defined(chunk_rec->chunk_addr)); H5MM_memcpy(buf, udata->chunk, nbytes); udata->chunk = NULL; - } /* end if */ + } else { H5D_rdcc_ent_t *ent = NULL; /* Cache entry */ unsigned idx; /* Index of chunk in cache, if present */ @@ -6062,13 +6065,13 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) H5_CHECKED_ASSIGN(nbytes, size_t, shared_fo->layout.u.chunk.size, uint32_t); H5MM_memcpy(buf, ent->chunk, nbytes); - } /* end if */ + } else { /* read chunk data from the source file */ if(H5F_block_read(udata->file_src, H5FD_MEM_DRAW, chunk_rec->chunk_addr, nbytes, buf) < 0) HGOTO_ERROR(H5E_IO, H5E_READERROR, H5_ITER_ERROR, "unable to read raw data chunk") - } /* end else */ - } /* end else */ + } + } /* Need to uncompress filtered variable-length & reference data elements that are not found in chunk cache */ if(must_filter && (is_vlen || fix_ref) && !udata->chunk_in_cache) { @@ -6932,9 +6935,9 @@ H5D__chunk_file_alloc(const H5D_chk_idx_info_t *idx_info, const H5F_block_t *old } /* end else */ } /* end if */ else { - HDassert(!H5F_addr_defined(new_chunk->offset)); - HDassert(new_chunk->length == idx_info->layout->size); - alloc_chunk = TRUE; + HDassert(!H5F_addr_defined(new_chunk->offset)); + HDassert(new_chunk->length == idx_info->layout->size); + alloc_chunk = TRUE; } /* end else */ /* Actually allocate space for the chunk in the file */ @@ -7201,7 +7204,7 @@ H5D__get_num_chunks(const H5D_t *dset, const H5S_t H5_ATTR_UNUSED *space, hsize_ if((dset->shared->layout.storage.u.chunk.ops->iterate)(&idx_info, H5D__get_num_chunks_cb, &num_chunks) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve allocated chunk information from index") *nchunks = num_chunks; - } /* end else */ + } done: FUNC_LEAVE_NOAPI_TAG(ret_value) @@ -7248,7 +7251,7 @@ H5D__get_chunk_info_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) /* Stop iterating */ ret_value = H5_ITER_STOP; - } /* end if */ + } /* Go to the next chunk */ else chunk_info->curr_idx++; diff --git a/src/H5Dcompact.c b/src/H5Dcompact.c index 809cdfc..1792fa2 100644 --- a/src/H5Dcompact.c +++ b/src/H5Dcompact.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Raymond Lu + * Programmer: Raymond Lu * August 5, 2002 * * Purpose: Compact dataset I/O functions. These routines are similar diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c index 655f660..662be69 100644 --- a/src/H5Dcontig.c +++ b/src/H5Dcontig.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, September 28, 2000 * * Purpose: diff --git a/src/H5Ddeprec.c b/src/H5Ddeprec.c index f4f4223..312bd4b 100644 --- a/src/H5Ddeprec.c +++ b/src/H5Ddeprec.c @@ -15,7 +15,7 @@ * * Created: H5Ddeprec.c * April 5 2007 - * Quincey Koziol + * Quincey Koziol * * Purpose: Deprecated functions from the H5D interface. These * functions are here for compatibility purposes and may be @@ -148,12 +148,12 @@ H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") - /* Create the dataset through the VOL */ + /* Create the dataset */ if(NULL == (dset = H5VL_dataset_create(vol_obj, &loc_params, name, H5P_LINK_CREATE_DEFAULT, type_id, space_id, dcpl_id, H5P_DATASET_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to create dataset") - /* Get an atom for the dataset */ + /* Register the new dataset to get an ID for it */ if((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->connector, TRUE)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataset") diff --git a/src/H5Dearray.c b/src/H5Dearray.c index eaa8c46..a53489e 100644 --- a/src/H5Dearray.c +++ b/src/H5Dearray.c @@ -11,10 +11,10 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol - * Tuesday, January 27, 2009 +/* Programmer: Quincey Koziol + * Tuesday, January 27, 2009 * - * Purpose: Extensible array indexed (chunked) I/O functions. The chunks + * Purpose: Extensible array indexed (chunked) I/O functions. The chunks * are given a single-dimensional index which is used as the * offset in an extensible array that maps a chunk coordinate to * a disk address. @@ -183,7 +183,7 @@ const H5EA_class_t H5EA_CLS_CHUNK[1]={{ H5D__earray_fill, /* Fill block of missing elements callback */ H5D__earray_encode, /* Element encoding callback */ H5D__earray_decode, /* Element decoding callback */ - H5D__earray_debug, /* Element debugging callback */ + H5D__earray_debug, /* Element debugging callback */ H5D__earray_crt_dbg_context, /* Create debugging context */ H5D__earray_dst_dbg_context /* Destroy debugging context */ }}; @@ -216,14 +216,14 @@ H5FL_DEFINE_STATIC(H5D_earray_ctx_ud_t); /*------------------------------------------------------------------------- - * Function: H5D__earray_crt_context + * Function: H5D__earray_crt_context * - * Purpose: Create context for callbacks + * Purpose: Create context for callbacks * - * Return: Success: non-NULL - * Failure: NULL + * Return: Success: non-NULL + * Failure: NULL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, January 29, 2009 * *------------------------------------------------------------------------- @@ -265,14 +265,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__earray_dst_context + * Function: H5D__earray_dst_context * - * Purpose: Destroy context for callbacks + * Purpose: Destroy context for callbacks * - * Return: Success: non-NULL - * Failure: NULL + * Return: Success: non-NULL + * Failure: NULL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, January 29, 2009 * *------------------------------------------------------------------------- @@ -295,14 +295,14 @@ H5D__earray_dst_context(void *_ctx) /*------------------------------------------------------------------------- - * Function: H5D__earray_fill + * Function: H5D__earray_fill * - * Purpose: Fill "missing elements" in block of elements + * Purpose: Fill "missing elements" in block of elements * - * Return: Success: non-negative - * Failure: negative + * Return: Success: non-negative + * Failure: negative * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, January 27, 2009 * *------------------------------------------------------------------------- @@ -325,14 +325,14 @@ H5D__earray_fill(void *nat_blk, size_t nelmts) /*------------------------------------------------------------------------- - * Function: H5D__earray_encode + * Function: H5D__earray_encode * - * Purpose: Encode an element from "native" to "raw" form + * Purpose: Encode an element from "native" to "raw" form * - * Return: Success: non-negative - * Failure: negative + * Return: Success: non-negative + * Failure: negative * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, January 27, 2009 * *------------------------------------------------------------------------- @@ -369,14 +369,14 @@ H5D__earray_encode(void *raw, const void *_elmt, size_t nelmts, void *_ctx) /*------------------------------------------------------------------------- - * Function: H5D__earray_decode + * Function: H5D__earray_decode * - * Purpose: Decode an element from "raw" to "native" form + * Purpose: Decode an element from "raw" to "native" form * - * Return: Success: non-negative - * Failure: negative + * Return: Success: non-negative + * Failure: negative * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, January 29, 2009 * *------------------------------------------------------------------------- @@ -413,14 +413,14 @@ H5D__earray_decode(const void *_raw, void *_elmt, size_t nelmts, void *_ctx) /*------------------------------------------------------------------------- - * Function: H5D__earray_debug + * Function: H5D__earray_debug * - * Purpose: Display an element for debugging + * Purpose: Display an element for debugging * - * Return: Success: non-negative - * Failure: negative + * Return: Success: non-negative + * Failure: negative * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, January 29, 2009 * *------------------------------------------------------------------------- @@ -447,14 +447,14 @@ H5D__earray_debug(FILE *stream, int indent, int fwidth, hsize_t idx, /*------------------------------------------------------------------------- - * Function: H5D__earray_filt_fill + * Function: H5D__earray_filt_fill * - * Purpose: Fill "missing elements" in block of elements + * Purpose: Fill "missing elements" in block of elements * - * Return: Success: non-negative - * Failure: negative + * Return: Success: non-negative + * Failure: negative * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, January 31, 2009 * *------------------------------------------------------------------------- @@ -478,14 +478,14 @@ H5D__earray_filt_fill(void *nat_blk, size_t nelmts) /*------------------------------------------------------------------------- - * Function: H5D__earray_filt_encode + * Function: H5D__earray_filt_encode * - * Purpose: Encode an element from "native" to "raw" form + * Purpose: Encode an element from "native" to "raw" form * - * Return: Success: non-negative - * Failure: negative + * Return: Success: non-negative + * Failure: negative * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, January 31, 2009 * *------------------------------------------------------------------------- @@ -525,14 +525,14 @@ H5D__earray_filt_encode(void *_raw, const void *_elmt, size_t nelmts, void *_ctx /*------------------------------------------------------------------------- - * Function: H5D__earray_filt_decode + * Function: H5D__earray_filt_decode * - * Purpose: Decode an element from "raw" to "native" form + * Purpose: Decode an element from "raw" to "native" form * - * Return: Success: non-negative - * Failure: negative + * Return: Success: non-negative + * Failure: negative * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, January 31, 2009 * *------------------------------------------------------------------------- @@ -571,14 +571,14 @@ H5D__earray_filt_decode(const void *_raw, void *_elmt, size_t nelmts, void *_ctx /*------------------------------------------------------------------------- - * Function: H5D__earray_filt_debug + * Function: H5D__earray_filt_debug * - * Purpose: Display an element for debugging + * Purpose: Display an element for debugging * - * Return: Success: non-negative - * Failure: negative + * Return: Success: non-negative + * Failure: negative * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, January 31, 2009 * *------------------------------------------------------------------------- @@ -606,15 +606,15 @@ H5D__earray_filt_debug(FILE *stream, int indent, int fwidth, hsize_t idx, /*------------------------------------------------------------------------- - * Function: H5D__earray_crt_dbg_context + * Function: H5D__earray_crt_dbg_context * - * Purpose: Create context for debugging callback - * (get the layout message in the specified object header) + * Purpose: Create context for debugging callback + * (get the layout message in the specified object header) * - * Return: Success: non-NULL - * Failure: NULL + * Return: Success: non-NULL + * Failure: NULL * - * Programmer: Vailin Choi; July 2010 + * Programmer: Vailin Choi; July 2010 * *------------------------------------------------------------------------- */ @@ -680,15 +680,15 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__earray_dst_dbg_context + * Function: H5D__earray_dst_dbg_context * - * Purpose: Destroy context for debugging callback - * (free the layout message from the specified object header) + * Purpose: Destroy context for debugging callback + * (free the layout message from the specified object header) * - * Return: Success: non-negative - * Failure: negative + * Return: Success: non-negative + * Failure: negative * - * Programmer: Vailin Choi; July 2010 + * Programmer: Vailin Choi; July 2010 * *------------------------------------------------------------------------- */ @@ -710,16 +710,16 @@ H5D__earray_dst_dbg_context(void *_dbg_ctx) /*------------------------------------------------------------------------- - * Function: H5D__earray_idx_depend + * Function: H5D__earray_idx_depend * - * Purpose: Create flush dependency between extensible array and dataset's + * Purpose: Create flush dependency between extensible array and dataset's * object header. * - * Return: Success: non-negative - * Failure: negative + * Return: Success: non-negative + * Failure: negative * - * Programmer: Quincey Koziol - * Tuesday, June 2, 2009 + * Programmer: Quincey Koziol + * Tuesday, June 2, 2009 * *------------------------------------------------------------------------- */ @@ -772,20 +772,20 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__earray_idx_open + * Function: H5D__earray_idx_open * - * Purpose: Opens an existing extensible array. + * Purpose: Opens an existing extensible array. * - * Note: This information is passively initialized from each index + * Note: This information is passively initialized from each index * operation callback because those abstract chunk index operations * are designed to work with the v1 B-tree chunk indices also, * which don't require an 'open' for the data structure. * - * Return: Success: non-negative - * Failure: negative + * Return: Success: non-negative + * Failure: negative * - * Programmer: Quincey Koziol - * Thursday, January 29, 2009 + * Programmer: Quincey Koziol + * Thursday, January 29, 2009 * *------------------------------------------------------------------------- */ @@ -814,7 +814,7 @@ H5D__earray_idx_open(const H5D_chk_idx_info_t *idx_info) /* Open the extensible array for the chunk index */ if(NULL == (idx_info->storage->u.earray.ea = H5EA_open(idx_info->f, idx_info->storage->idx_addr, &udata))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't open extensible array") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't open extensible array") /* Check for SWMR writes to the file */ if(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE) @@ -827,13 +827,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__earray_idx_init + * Function: H5D__earray_idx_init * - * Purpose: Initialize the indexing information for a dataset. + * Purpose: Initialize the indexing information for a dataset. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Wednesday, May 27, 2009 * *------------------------------------------------------------------------- @@ -862,7 +862,7 @@ H5D__earray_idx_init(const H5D_chk_idx_info_t *idx_info, const H5S_t *space, /* Get the dim info for dataset */ if((sndims = H5S_get_simple_extent_dims(space, NULL, max_dims)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataspace dimensions") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataspace dimensions") H5_CHECKED_ASSIGN(ndims, unsigned, sndims, int); /* Find the rank of the unlimited dimension */ @@ -895,20 +895,20 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__earray_idx_create + * Function: H5D__earray_idx_create * - * Purpose: Creates a new indexed-storage extensible array and initializes + * Purpose: Creates a new indexed-storage extensible array and initializes * the layout struct with information about the storage. The - * struct should be immediately written to the object header. + * struct should be immediately written to the object header. * - * This function must be called before passing LAYOUT to any of - * the other indexed storage functions! + * This function must be called before passing LAYOUT to any of + * the other indexed storage functions! * - * Return: Non-negative on success (with the LAYOUT argument initialized - * and ready to write to an object header). Negative on failure. + * Return: Non-negative on success (with the LAYOUT argument initialized + * and ready to write to an object header). Negative on failure. * - * Programmer: Quincey Koziol - * Tuesday, January 27, 2009 + * Programmer: Quincey Koziol + * Tuesday, January 27, 2009 * *------------------------------------------------------------------------- */ @@ -965,11 +965,11 @@ H5D__earray_idx_create(const H5D_chk_idx_info_t *idx_info) /* Create the extensible array for the chunk index */ if(NULL == (idx_info->storage->u.earray.ea = H5EA_create(idx_info->f, &cparam, &udata))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create extensible array") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create extensible array") /* Get the address of the extensible array in file */ if(H5EA_get_addr(idx_info->storage->u.earray.ea, &(idx_info->storage->idx_addr)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't query extensible array address") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't query extensible array address") /* Check for SWMR writes to the file */ if(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE) @@ -982,14 +982,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__earray_idx_is_space_alloc + * Function: H5D__earray_idx_is_space_alloc * - * Purpose: Query if space is allocated for index method + * Purpose: Query if space is allocated for index method * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, January 29, 2009 + * Programmer: Quincey Koziol + * Thursday, January 29, 2009 * *------------------------------------------------------------------------- */ @@ -1006,13 +1006,13 @@ H5D__earray_idx_is_space_alloc(const H5O_storage_chunk_t *storage) /*------------------------------------------------------------------------- - * Function: H5D__earray_idx_insert + * Function: H5D__earray_idx_insert * - * Purpose: Insert chunk address into the indexing structure. + * Purpose: Insert chunk address into the indexing structure. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi; May 2014 + * Programmer: Vailin Choi; May 2014 * *------------------------------------------------------------------------- */ @@ -1021,7 +1021,7 @@ H5D__earray_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata const H5D_t H5_ATTR_UNUSED *dset) { H5EA_t *ea; /* Pointer to extensible array structure */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -1046,26 +1046,26 @@ H5D__earray_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata ea = idx_info->storage->u.earray.ea; if(!H5F_addr_defined(udata->chunk_block.offset)) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "The chunk should have allocated already") + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "The chunk should have allocated already") if(udata->chunk_idx != (udata->chunk_idx & 0xffffffff)) /* negative value */ - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "chunk index must be less than 2^32") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "chunk index must be less than 2^32") /* Check for filters on chunks */ if(idx_info->pline->nused > 0) { - H5D_earray_filt_elmt_t elmt; /* Extensible array element */ + H5D_earray_filt_elmt_t elmt; /* Extensible array element */ - elmt.addr = udata->chunk_block.offset; + elmt.addr = udata->chunk_block.offset; H5_CHECKED_ASSIGN(elmt.nbytes, uint32_t, udata->chunk_block.length, hsize_t); - elmt.filter_mask = udata->filter_mask; + elmt.filter_mask = udata->filter_mask; - /* Set the info for the chunk */ - if(H5EA_set(ea, udata->chunk_idx, &elmt) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set chunk info") + /* Set the info for the chunk */ + if(H5EA_set(ea, udata->chunk_idx, &elmt) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set chunk info") } /* end if */ else { - /* Set the address for the chunk */ - if(H5EA_set(ea, udata->chunk_idx, &udata->chunk_block.offset) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set chunk address") + /* Set the address for the chunk */ + if(H5EA_set(ea, udata->chunk_idx, &udata->chunk_block.offset) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set chunk address") } /* end else */ done: @@ -1074,15 +1074,15 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__earray_idx_get_addr + * Function: H5D__earray_idx_get_addr * - * Purpose: Get the file address of a chunk if file space has been - * assigned. Save the retrieved information in the udata - * supplied. + * Purpose: Get the file address of a chunk if file space has been + * assigned. Save the retrieved information in the udata + * supplied. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, January 29, 2009 * *------------------------------------------------------------------------- @@ -1092,7 +1092,7 @@ H5D__earray_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *uda { H5EA_t *ea; /* Pointer to extensible array structure */ hsize_t idx; /* Array index of chunk */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -1118,13 +1118,13 @@ H5D__earray_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *uda /* Check for unlimited dim. not being the slowest-changing dim. */ if(idx_info->layout->u.earray.unlim_dim > 0) { - hsize_t swizzled_coords[H5O_LAYOUT_NDIMS]; /* swizzled chunk coordinates */ + hsize_t swizzled_coords[H5O_LAYOUT_NDIMS]; /* swizzled chunk coordinates */ unsigned ndims = (idx_info->layout->ndims - 1); /* Number of dimensions */ - unsigned u; + unsigned u; - /* Compute coordinate offset from scaled offset */ - for(u = 0; u < ndims; u++) - swizzled_coords[u] = udata->common.scaled[u] * idx_info->layout->dim[u]; + /* Compute coordinate offset from scaled offset */ + for(u = 0; u < ndims; u++) + swizzled_coords[u] = udata->common.scaled[u] * idx_info->layout->dim[u]; H5VM_swizzle_coords(hsize_t, swizzled_coords, idx_info->layout->u.earray.unlim_dim); @@ -1157,12 +1157,12 @@ H5D__earray_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *uda HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk address") /* Update the other (constant) information for the chunk */ - udata->chunk_block.length = idx_info->layout->size; + udata->chunk_block.length = idx_info->layout->size; udata->filter_mask = 0; } /* end else */ if(!H5F_addr_defined(udata->chunk_block.offset)) - udata->chunk_block.length = 0; + udata->chunk_block.length = 0; done: FUNC_LEAVE_NOAPI(ret_value) @@ -1170,14 +1170,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__earray_idx_resize + * Function: H5D__earray_idx_resize * - * Purpose: Calculate/setup the swizzled down chunk array, used for chunk + * Purpose: Calculate/setup the swizzled down chunk array, used for chunk * index calculations. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, July 23, 2009 * *------------------------------------------------------------------------- @@ -1224,13 +1224,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__earray_idx_iterate_cb + * Function: H5D__earray_idx_iterate_cb * - * Purpose: Callback routine for extensible array element iteration. + * Purpose: Callback routine for extensible array element iteration. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi; Feb 2015 + * Programmer: Vailin Choi; Feb 2015 * *------------------------------------------------------------------------- */ @@ -1257,8 +1257,8 @@ H5D__earray_idx_iterate_cb(hsize_t H5_ATTR_UNUSED idx, const void *_elmt, void * /* Make "generic chunk" callback */ if(H5F_addr_defined(udata->chunk_rec.chunk_addr)) - if((ret_value = (udata->cb)(&udata->chunk_rec, udata->udata)) < 0) - HERROR(H5E_DATASET, H5E_CALLBACK, "failure in generic chunk iterator callback"); + if((ret_value = (udata->cb)(&udata->chunk_rec, udata->udata)) < 0) + HERROR(H5E_DATASET, H5E_CALLBACK, "failure in generic chunk iterator callback"); /* Update coordinates of chunk in dataset */ ndims = udata->common.layout->ndims - 1; @@ -1283,18 +1283,18 @@ H5D__earray_idx_iterate_cb(hsize_t H5_ATTR_UNUSED idx, const void *_elmt, void * /*------------------------------------------------------------------------- - * Function: H5D__earray_idx_iterate + * Function: H5D__earray_idx_iterate * - * Purpose: Iterate over the chunks in an index, making a callback + * Purpose: Iterate over the chunks in an index, making a callback * for each one. * - * Note: This implementation is slow, particularly for sparse + * Note: This implementation is slow, particularly for sparse * extensible arrays, replace it with call to H5EA_iterate() * when that's available. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, January 29, 2009 * *------------------------------------------------------------------------- @@ -1332,27 +1332,27 @@ H5D__earray_idx_iterate(const H5D_chk_idx_info_t *idx_info, /* Get the extensible array statistics */ if(H5EA_get_stats(ea, &ea_stat) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't query extensible array statistics") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't query extensible array statistics") if(ea_stat.stored.max_idx_set > 0) { H5D_earray_it_ud_t udata; /* User data for iteration callback */ - /* Initialize userdata */ - HDmemset(&udata, 0, sizeof udata); - udata.common.layout = idx_info->layout; - udata.common.storage = idx_info->storage; + /* Initialize userdata */ + HDmemset(&udata, 0, sizeof udata); + udata.common.layout = idx_info->layout; + udata.common.storage = idx_info->storage; HDmemset(&udata.chunk_rec, 0, sizeof(udata.chunk_rec)); udata.filtered = (idx_info->pline->nused > 0); if(!udata.filtered) { udata.chunk_rec.nbytes = idx_info->layout->size; udata.chunk_rec.filter_mask = 0; } /* end if */ - udata.cb = chunk_cb; - udata.udata = chunk_udata; + udata.cb = chunk_cb; + udata.udata = chunk_udata; /* Iterate over the extensible array elements */ - if((ret_value = H5EA_iterate(ea, H5D__earray_idx_iterate_cb, &udata)) < 0) - HERROR(H5E_DATASET, H5E_BADITER, "unable to iterate over fixed array chunk index"); + if((ret_value = H5EA_iterate(ea, H5D__earray_idx_iterate_cb, &udata)) < 0) + HERROR(H5E_DATASET, H5E_BADITER, "unable to iterate over fixed array chunk index"); } /* end if */ done: @@ -1361,13 +1361,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__earray_idx_remove + * Function: H5D__earray_idx_remove * - * Purpose: Remove chunk from index. + * Purpose: Remove chunk from index. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, January 29, 2009 * *------------------------------------------------------------------------- @@ -1377,7 +1377,7 @@ H5D__earray_idx_remove(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t { H5EA_t *ea; /* Pointer to extensible array structure */ hsize_t idx; /* Array index of chunk */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -1404,13 +1404,13 @@ H5D__earray_idx_remove(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t /* Check for unlimited dim. not being the slowest-changing dim. */ if(idx_info->layout->u.earray.unlim_dim > 0) { - hsize_t swizzled_coords[H5O_LAYOUT_NDIMS]; /* swizzled chunk coordinates */ + hsize_t swizzled_coords[H5O_LAYOUT_NDIMS]; /* swizzled chunk coordinates */ unsigned ndims = (idx_info->layout->ndims - 1); /* Number of dimensions */ - unsigned u; + unsigned u; - /* Compute coordinate offset from scaled offset */ - for(u = 0; u < ndims; u++) - swizzled_coords[u] = udata->scaled[u] * idx_info->layout->dim[u]; + /* Compute coordinate offset from scaled offset */ + for(u = 0; u < ndims; u++) + swizzled_coords[u] = udata->scaled[u] * idx_info->layout->dim[u]; H5VM_swizzle_coords(hsize_t, swizzled_coords, idx_info->layout->u.earray.unlim_dim); @@ -1472,14 +1472,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__earray_idx_delete_cb + * Function: H5D__earray_idx_delete_cb * - * Purpose: Delete space for chunk in file + * Purpose: Delete space for chunk in file * - * Return: Success: Non-negative - * Failure: negative + * Return: Success: Non-negative + * Failure: negative * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, January 31, 2009 * *------------------------------------------------------------------------- @@ -1509,19 +1509,19 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__earray_idx_delete + * Function: H5D__earray_idx_delete * - * Purpose: Delete index and raw data storage for entire dataset + * Purpose: Delete index and raw data storage for entire dataset * (i.e. all chunks) * - * Note: This implementation is slow, particularly for sparse + * Note: This implementation is slow, particularly for sparse * extensible arrays, replace it with call to H5EA_iterate() * when that's available. * - * Return: Success: Non-negative - * Failure: negative + * Return: Success: Non-negative + * Failure: negative * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, January 29, 2009 * *------------------------------------------------------------------------- @@ -1571,13 +1571,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__earray_idx_copy_setup + * Function: H5D__earray_idx_copy_setup * - * Purpose: Set up any necessary information for copying chunks + * Purpose: Set up any necessary information for copying chunks * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, January 31, 2009 * *------------------------------------------------------------------------- @@ -1626,13 +1626,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__earray_idx_copy_shutdown + * Function: H5D__earray_idx_copy_shutdown * - * Purpose: Shutdown any information from copying chunks + * Purpose: Shutdown any information from copying chunks * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, January 31, 2009 * *------------------------------------------------------------------------- @@ -1704,7 +1704,7 @@ H5D__earray_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *index_size) /* Get the extensible array statistics */ if(H5EA_get_stats(ea, &ea_stat) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't query extensible array statistics") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't query extensible array statistics") /* Set the size of the extensible array */ *index_size = ea_stat.computed.hdr_size + ea_stat.computed.index_blk_size @@ -1722,13 +1722,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__earray_idx_reset + * Function: H5D__earray_idx_reset * - * Purpose: Reset indexing information. + * Purpose: Reset indexing information. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, January 31, 2009 * *------------------------------------------------------------------------- @@ -1743,7 +1743,7 @@ H5D__earray_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr) /* Reset index info */ if(reset_addr) { - storage->idx_addr = HADDR_UNDEF; + storage->idx_addr = HADDR_UNDEF; storage->u.earray.dset_ohdr_addr = HADDR_UNDEF; } /* end if */ storage->u.earray.ea = NULL; @@ -1753,13 +1753,13 @@ H5D__earray_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr) /*------------------------------------------------------------------------- - * Function: H5D__earray_idx_dump + * Function: H5D__earray_idx_dump * - * Purpose: Dump indexing information to a stream. + * Purpose: Dump indexing information to a stream. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, January 31, 2009 * *------------------------------------------------------------------------- @@ -1780,13 +1780,13 @@ H5D__earray_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream) /*------------------------------------------------------------------------- - * Function: H5D__earray_idx_dest + * Function: H5D__earray_idx_dest * - * Purpose: Release indexing information in memory. + * Purpose: Release indexing information in memory. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, January 31, 2009 * *------------------------------------------------------------------------- @@ -1806,7 +1806,7 @@ H5D__earray_idx_dest(const H5D_chk_idx_info_t *idx_info) /* Check if the extensible array is open */ if(idx_info->storage->u.earray.ea) { - /* Patch the top level file pointer contained in ea if needed */ + /* Patch the top level file pointer contained in ea if needed */ if(H5EA_patch_file(idx_info->storage->u.earray.ea, idx_info->f) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't patch earray file pointer") diff --git a/src/H5Defl.c b/src/H5Defl.c index 91caa61..79cec8c 100644 --- a/src/H5Defl.c +++ b/src/H5Defl.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, September 30, 2004 */ @@ -336,9 +336,6 @@ done: * Programmer: Robb Matzke * Wednesday, March 4, 1998 * - * Modifications: - * Robb Matzke, 1999-07-28 - * The ADDR argument is passed by value. *------------------------------------------------------------------------- */ static herr_t diff --git a/src/H5Dfarray.c b/src/H5Dfarray.c index 4eedf04..a9202c2 100644 --- a/src/H5Dfarray.c +++ b/src/H5Dfarray.c @@ -261,14 +261,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__farray_dst_context + * Function: H5D__farray_dst_context * - * Purpose: Destroy context for callbacks + * Purpose: Destroy context for callbacks * - * Return: Success: non-NULL - * Failure: NULL + * Return: Success: non-NULL + * Failure: NULL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -291,14 +291,14 @@ H5D__farray_dst_context(void *_ctx) /*------------------------------------------------------------------------- - * Function: H5D__farray_fill + * Function: H5D__farray_fill * - * Purpose: Fill "missing elements" in block of elements + * Purpose: Fill "missing elements" in block of elements * - * Return: Success: non-negative - * Failure: negative + * Return: Success: non-negative + * Failure: negative * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -321,14 +321,14 @@ H5D__farray_fill(void *nat_blk, size_t nelmts) /*------------------------------------------------------------------------- - * Function: H5D__farray_encode + * Function: H5D__farray_encode * - * Purpose: Encode an element from "native" to "raw" form + * Purpose: Encode an element from "native" to "raw" form * - * Return: Success: non-negative - * Failure: negative + * Return: Success: non-negative + * Failure: negative * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -365,14 +365,14 @@ H5D__farray_encode(void *raw, const void *_elmt, size_t nelmts, void *_ctx) /*------------------------------------------------------------------------- - * Function: H5D__farray_decode + * Function: H5D__farray_decode * - * Purpose: Decode an element from "raw" to "native" form + * Purpose: Decode an element from "raw" to "native" form * - * Return: Success: non-negative - * Failure: negative + * Return: Success: non-negative + * Failure: negative * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -409,14 +409,14 @@ H5D__farray_decode(const void *_raw, void *_elmt, size_t nelmts, void *_ctx) /*------------------------------------------------------------------------- - * Function: H5D__farray_debug + * Function: H5D__farray_debug * - * Purpose: Display an element for debugging + * Purpose: Display an element for debugging * - * Return: Success: non-negative - * Failure: negative + * Return: Success: non-negative + * Failure: negative * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -443,23 +443,23 @@ H5D__farray_debug(FILE *stream, int indent, int fwidth, hsize_t idx, /*------------------------------------------------------------------------- - * Function: H5D__farray_crt_dbg_context + * Function: H5D__farray_crt_dbg_context * - * Purpose: Create context for debugging callback - * (get the layout message in the specified object header) + * Purpose: Create context for debugging callback + * (get the layout message in the specified object header) * - * Return: Success: non-NULL - * Failure: NULL + * Return: Success: non-NULL + * Failure: NULL * - * Programmer: Vailin Choi - * 5th August, 2009 + * Programmer: Vailin Choi + * 5th August, 2009 * *------------------------------------------------------------------------- */ static void * H5D__farray_crt_dbg_context(H5F_t *f, haddr_t obj_addr) { - H5D_farray_ctx_ud_t *dbg_ctx = NULL; /* Context for fixed array callback */ + H5D_farray_ctx_ud_t *dbg_ctx = NULL; /* Context for fixed array callback */ H5O_loc_t obj_loc; /* Pointer to an object's location */ hbool_t obj_opened = FALSE; /* Flag to indicate that the object header was opened */ H5O_layout_t layout; /* Layout message */ @@ -518,16 +518,16 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__farray_dst_dbg_context + * Function: H5D__farray_dst_dbg_context * - * Purpose: Destroy context for debugging callback - * (free the layout message from the specified object header) + * Purpose: Destroy context for debugging callback + * (free the layout message from the specified object header) * - * Return: Success: non-negative - * Failure: negative + * Return: Success: non-negative + * Failure: negative * - * Programmer: Quincey Koziol - * 24th September, 2009 + * Programmer: Quincey Koziol + * 24th September, 2009 * *------------------------------------------------------------------------- */ @@ -549,14 +549,14 @@ H5D__farray_dst_dbg_context(void *_dbg_ctx) /*------------------------------------------------------------------------- - * Function: H5D__farray_filt_fill + * Function: H5D__farray_filt_fill * - * Purpose: Fill "missing elements" in block of elements + * Purpose: Fill "missing elements" in block of elements * - * Return: Success: non-negative - * Failure: negative + * Return: Success: non-negative + * Failure: negative * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -580,14 +580,14 @@ H5D__farray_filt_fill(void *nat_blk, size_t nelmts) /*------------------------------------------------------------------------- - * Function: H5D__farray_filt_encode + * Function: H5D__farray_filt_encode * - * Purpose: Encode an element from "native" to "raw" form + * Purpose: Encode an element from "native" to "raw" form * - * Return: Success: non-negative - * Failure: negative + * Return: Success: non-negative + * Failure: negative * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -627,14 +627,14 @@ H5D__farray_filt_encode(void *_raw, const void *_elmt, size_t nelmts, void *_ctx /*------------------------------------------------------------------------- - * Function: H5D__farray_filt_decode + * Function: H5D__farray_filt_decode * - * Purpose: Decode an element from "raw" to "native" form + * Purpose: Decode an element from "raw" to "native" form * - * Return: Success: non-negative - * Failure: negative + * Return: Success: non-negative + * Failure: negative * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -673,14 +673,14 @@ H5D__farray_filt_decode(const void *_raw, void *_elmt, size_t nelmts, void *_ctx /*------------------------------------------------------------------------- - * Function: H5D__farray_filt_debug + * Function: H5D__farray_filt_debug * - * Purpose: Display an element for debugging + * Purpose: Display an element for debugging * - * Return: Success: non-negative - * Failure: negative + * Return: Success: non-negative + * Failure: negative * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -708,15 +708,15 @@ H5D__farray_filt_debug(FILE *stream, int indent, int fwidth, hsize_t idx, /*------------------------------------------------------------------------- - * Function: H5D__farray_idx_depend + * Function: H5D__farray_idx_depend * - * Purpose: Create flush dependency between fixed array and dataset's + * Purpose: Create flush dependency between fixed array and dataset's * object header. * - * Return: Success: non-negative - * Failure: negative + * Return: Success: non-negative + * Failure: negative * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -798,15 +798,15 @@ H5D__farray_idx_init(const H5D_chk_idx_info_t *idx_info, const H5S_t H5_ATTR_UNU /*------------------------------------------------------------------------- - * Function: H5D__farray_idx_open + * Function: H5D__farray_idx_open * - * Purpose: Opens an existing fixed array and initializes + * Purpose: Opens an existing fixed array and initializes * the layout struct with information about the storage. * - * Return: Success: non-negative - * Failure: negative + * Return: Success: non-negative + * Failure: negative * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -849,19 +849,19 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__farray_idx_create + * Function: H5D__farray_idx_create * - * Purpose: Creates a new indexed-storage fixed array and initializes + * Purpose: Creates a new indexed-storage fixed array and initializes * the layout struct with information about the storage. The - * struct should be immediately written to the object header. + * struct should be immediately written to the object header. * - * This function must be called before passing LAYOUT to any of - * the other indexed storage functions! + * This function must be called before passing LAYOUT to any of + * the other indexed storage functions! * - * Return: Non-negative on success (with the LAYOUT argument initialized - * and ready to write to an object header). Negative on failure. + * Return: Non-negative on success (with the LAYOUT argument initialized + * and ready to write to an object header). Negative on failure. * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -869,9 +869,9 @@ done: static herr_t H5D__farray_idx_create(const H5D_chk_idx_info_t *idx_info) { - H5FA_create_t cparam; /* Fixed array creation parameters */ + H5FA_create_t cparam; /* Fixed array creation parameters */ H5D_farray_ctx_ud_t udata; /* User data for fixed array create call */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -930,13 +930,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__farray_idx_is_space_alloc + * Function: H5D__farray_idx_is_space_alloc * - * Purpose: Query if space is allocated for index method + * Purpose: Query if space is allocated for index method * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -954,13 +954,13 @@ H5D__farray_idx_is_space_alloc(const H5O_storage_chunk_t *storage) /*------------------------------------------------------------------------- - * Function: H5D__farray_idx_insert + * Function: H5D__farray_idx_insert * - * Purpose: Insert chunk address into the indexing structure. + * Purpose: Insert chunk address into the indexing structure. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi; 5 May 2014 + * Programmer: Vailin Choi; 5 May 2014 * *------------------------------------------------------------------------- */ @@ -968,8 +968,8 @@ static herr_t H5D__farray_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata, const H5D_t H5_ATTR_UNUSED *dset) { - H5FA_t *fa; /* Pointer to fixed array structure */ - herr_t ret_value = SUCCEED; /* Return value */ + H5FA_t *fa; /* Pointer to fixed array structure */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC diff --git a/src/H5Dfill.c b/src/H5Dfill.c index 94c7b1c..0efe98a 100644 --- a/src/H5Dfill.c +++ b/src/H5Dfill.c @@ -15,7 +15,7 @@ * * Created: H5Dfill.c * Jun 19 2007 - * Quincey Koziol + * Quincey Koziol * * Purpose: Fill value operations for datasets * @@ -647,7 +647,7 @@ done: static herr_t H5D__fill_release(H5D_fill_buf_info_t *fb_info) { - FUNC_ENTER_PACKAGE_NOERR + FUNC_ENTER_STATIC_NOERR /* Check args */ HDassert(fb_info); diff --git a/src/H5Dint.c b/src/H5Dint.c index c063bb9..f99aabb 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -97,6 +97,7 @@ static herr_t H5D__vlen_get_buf_size_cb(void *elem, hid_t type_id, unsigned ndim const hsize_t *point, void *op_data); static herr_t H5D__vlen_get_buf_size_gen_cb(void *elem, hid_t type_id, unsigned ndim, const hsize_t *point, void *op_data); +static herr_t H5D__check_filters(H5D_t *dataset); /*********************/ @@ -671,7 +672,7 @@ H5D__cache_dataspace_info(const H5D_t *dset) for(u = 0; u < dset->shared->ndims; u++) { hsize_t scaled_power2up; /* Scaled value, rounded to next power of 2 */ - if( !(scaled_power2up = H5VM_power2up(dset->shared->curr_dims[u])) ) + if(!(scaled_power2up = H5VM_power2up(dset->shared->curr_dims[u]))) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get the next power of 2") dset->shared->curr_power2up[u] = scaled_power2up; } @@ -908,7 +909,7 @@ H5D__prepare_minimized_oh(H5F_t *file, H5D_t *dset, H5O_loc_t *oloc) HDassert(dset); HDassert(oloc); - oh = H5O__create_ohdr(file, dset->shared->dcpl_id); + oh = H5O_create_ohdr(file, dset->shared->dcpl_id); if(NULL == oh) HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "can't instantiate object header") @@ -917,7 +918,7 @@ H5D__prepare_minimized_oh(H5F_t *file, H5D_t *dset, H5O_loc_t *oloc) HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "computed header size is invalid") /* Special allocation of space for compact datsets is handled by the call here. */ - if(H5O__apply_ohdr(file, oh, dset->shared->dcpl_id, ohdr_size, (size_t)1, oloc) == FAIL) + if(H5O_apply_ohdr(file, oh, dset->shared->dcpl_id, ohdr_size, (size_t)1, oloc) == FAIL) HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "can't apply object header to file") done: @@ -1022,7 +1023,8 @@ H5D__update_oh_info(H5F_t *file, H5D_t *dset, hid_t dapl_id) if(TRUE == use_minimized_header) { if(H5D__prepare_minimized_oh(file, dset, oloc) == FAIL) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create minimized dataset object header") - } else { + } /* end if */ + else { /* Add the dataset's raw data size to the size of the header, if the * raw data will be stored as compact */ @@ -1297,18 +1299,24 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, /* Check if the dataset has a non-default DCPL & get important values, if so */ if(new_dset->shared->dcpl_id != H5P_DATASET_CREATE_DEFAULT) { - H5O_layout_t *layout; /* Dataset's layout information */ - H5O_pline_t *pline; /* Dataset's I/O pipeline information */ - H5O_fill_t *fill; /* Dataset's fill value info */ - H5O_efl_t *efl; /* Dataset's external file list info */ + H5O_layout_t *layout; /* Dataset's layout information */ + H5O_pline_t *pline; /* Dataset's I/O pipeline information */ + H5O_fill_t *fill; /* Dataset's fill value info */ + H5O_efl_t *efl; /* Dataset's external file list info */ + htri_t ignore_filters = FALSE; /* Ignore optional filters or not */ - /* Check if the filters in the DCPL can be applied to this dataset */ - if(H5Z_can_apply(new_dset->shared->dcpl_id, new_dset->shared->type_id) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, NULL, "I/O filters can't operate on this dataset") + if((ignore_filters = H5Z_ignore_filters(new_dset->shared->dcpl_id, dt, space))<0) + HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, NULL, "H5Z_has_optional_filter() failed") - /* Make the "set local" filter callbacks for this dataset */ - if(H5Z_set_local(new_dset->shared->dcpl_id, new_dset->shared->type_id) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to set local filter parameters") + if(FALSE == ignore_filters) { + /* Check if the filters in the DCPL can be applied to this dataset */ + if(H5Z_can_apply(new_dset->shared->dcpl_id, new_dset->shared->type_id) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, NULL, "I/O filters can't operate on this dataset") + + /* Make the "set local" filter callbacks for this dataset */ + if(H5Z_set_local(new_dset->shared->dcpl_id, new_dset->shared->type_id) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to set local filter parameters") + } /* ignore_filters */ /* Get new dataset's property list object */ if(NULL == (dc_plist = (H5P_genplist_t *)H5I_object(new_dset->shared->dcpl_id))) @@ -1332,9 +1340,11 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't retrieve external file list") efl_copied = TRUE; - /* Check that chunked layout is used if filters are enabled */ - if(pline->nused > 0 && H5D_CHUNKED != layout->type) - HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, NULL, "filters can only be used with chunked layout") + if(FALSE == ignore_filters) { + /* Check that chunked layout is used if filters are enabled */ + if(pline->nused > 0 && H5D_CHUNKED != layout->type) + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, NULL, "filters can only be used with chunked layout") + } /* Check if the alloc_time is the default and error out */ if(fill->alloc_time == H5D_ALLOC_TIME_DEFAULT) @@ -2960,13 +2970,13 @@ done: * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- */ -herr_t +static herr_t H5D__check_filters(H5D_t *dataset) { H5O_fill_t *fill; /* Dataset's fill value */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE + FUNC_ENTER_STATIC /* Check args */ HDassert(dataset); diff --git a/src/H5Dio.c b/src/H5Dio.c index 84b7e7a..a972e00 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -149,7 +149,7 @@ done: * The PLIST_ID can be the constant H5P_DEFAULT in which * case the default data transfer properties are used. * - * Return: SUCCEED/FAIL + * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke * Thursday, December 4, 1997 @@ -271,7 +271,7 @@ done: * The PLIST_ID can be the constant H5P_DEFAULT in which * case the default data transfer properties are used. * - * Return: SUCCEED/FAIL + * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke * Thursday, December 4, 1997 @@ -280,7 +280,7 @@ done: */ herr_t H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, - hid_t file_space_id, hid_t dxpl_id, const void *buf) + hid_t file_space_id, hid_t dxpl_id, const void *buf) { H5VL_object_t *vol_obj = NULL; herr_t ret_value = SUCCEED; /* Return value */ @@ -410,7 +410,7 @@ H5D__read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, /* projected mem space must be discarded at the */ /* end of the function to avoid a memory leak. */ H5D_storage_t store; /* union of EFL and chunk pointer in file space */ - hsize_t nelmts; /* total number of elmts */ + hsize_t nelmts; /* total number of elmts */ hbool_t io_op_init = FALSE; /* Whether the I/O op has been initialized */ char fake_char; /* Temporary variable for NULL buffer pointers */ herr_t ret_value = SUCCEED; /* Return value */ @@ -621,7 +621,7 @@ H5D__write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, /* projected mem space must be discarded at the */ /* end of the function to avoid a memory leak. */ H5D_storage_t store; /* union of EFL and chunk pointer in file space */ - hsize_t nelmts; /* total number of elmts */ + hsize_t nelmts; /* total number of elmts */ hbool_t io_op_init = FALSE; /* Whether the I/O op has been initialized */ char fake_char; /* Temporary variable for NULL buffer pointers */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1153,10 +1153,7 @@ H5D__ioinfo_adjust(H5D_io_info_t *io_info, const H5D_t *dset, /* Append each of the "reason for breaking collective I/O" error messages to the * local and global no collective cause strings */ - for (cause = 1, idx = 0; - (cause < H5D_MPIO_NO_COLLECTIVE_MAX_CAUSE) && - (idx < cause_strings_len); - cause <<= 1, idx++) { + for (cause = 1, idx = 0; (cause < H5D_MPIO_NO_COLLECTIVE_MAX_CAUSE) && (idx < cause_strings_len); cause <<= 1, idx++) { size_t cause_strlen = HDstrlen(cause_strings[idx]); if (cause & local_no_collective_cause) { @@ -1166,8 +1163,7 @@ H5D__ioinfo_adjust(H5D_io_info_t *io_info, const H5D_t *dset, if(local_error_message_previously_written) HDstrncat(local_no_collective_cause_string, "; ", 2); - HDstrncat(local_no_collective_cause_string, - cause_strings[idx], cause_strlen); + HDstrncat(local_no_collective_cause_string, cause_strings[idx], cause_strlen); local_error_message_previously_written = TRUE; } /* end if */ @@ -1179,8 +1175,7 @@ H5D__ioinfo_adjust(H5D_io_info_t *io_info, const H5D_t *dset, if(global_error_message_previously_written) HDstrncat(global_no_collective_cause_string, "; ", 2); - HDstrncat(global_no_collective_cause_string, - cause_strings[idx], cause_strlen); + HDstrncat(global_no_collective_cause_string, cause_strings[idx], cause_strlen); global_error_message_previously_written = TRUE; } /* end if */ diff --git a/src/H5Dlayout.c b/src/H5Dlayout.c index e257140..679a33b 100644 --- a/src/H5Dlayout.c +++ b/src/H5Dlayout.c @@ -66,7 +66,7 @@ const unsigned H5O_layout_ver_bounds[] = { - + /*------------------------------------------------------------------------- * Function: H5D__layout_set_io_ops * @@ -153,7 +153,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__layout_set_io_ops() */ - + /*------------------------------------------------------------------------- * Function: H5D__layout_meta_size * @@ -284,7 +284,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__layout_meta_size() */ - + /*------------------------------------------------------------------------- * Function: H5D__layout_set_version * @@ -322,7 +322,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__layout_set_version() */ - + /*------------------------------------------------------------------------- * Function: H5D__layout_set_latest_indexing * @@ -362,7 +362,7 @@ H5D__layout_set_latest_indexing(H5O_layout_t *layout, const H5S_t *space, if(ndims > 0) { hsize_t max_dims[H5O_LAYOUT_NDIMS]; /* Maximum dimension sizes */ hsize_t cur_dims[H5O_LAYOUT_NDIMS]; /* Current dimension sizes */ - unsigned unlim_count = 0; /* Count of unlimited max. dimensions */ + unsigned unlim_count = 0; /* Count of unlimited max. dimensions */ hbool_t single = TRUE; /* Fulfill single chunk indexing */ unsigned u; /* Local index variable */ @@ -446,7 +446,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__layout_set_latest_indexing() */ - + /*------------------------------------------------------------------------- * Function: H5D__layout_oh_create * @@ -589,17 +589,17 @@ done: FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5D__layout_oh_create() */ - + /*------------------------------------------------------------------------- * Function: H5D__layout_oh_read * - * Purpose: Read layout/pline/efl information for dataset + * Purpose: Read layout/pline/efl information for dataset * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: Success: SUCCEED + * Failure: FAIL * - * Programmer: Quincey Koziol - * Monday, July 27, 2009 + * Programmer: Quincey Koziol + * Monday, July 27, 2009 * *------------------------------------------------------------------------- */ @@ -683,17 +683,17 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__layout_oh_read() */ - + /*------------------------------------------------------------------------- * Function: H5D__layout_oh_write * - * Purpose: Write layout information for dataset + * Purpose: Write layout information for dataset * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: Success: SUCCEED + * Failure: FAIL * - * Programmer: Quincey Koziol - * Monday, July 27, 2009 + * Programmer: Quincey Koziol + * Monday, July 27, 2009 * *------------------------------------------------------------------------- */ diff --git a/src/H5Dmodule.h b/src/H5Dmodule.h index b259b69..27ccf54 100644 --- a/src/H5Dmodule.h +++ b/src/H5Dmodule.h @@ -11,7 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, September 12, 2015 * * Purpose: This file contains declarations which define macros for the diff --git a/src/H5Dmpio.c b/src/H5Dmpio.c index 492902b..e56f341 100644 --- a/src/H5Dmpio.c +++ b/src/H5Dmpio.c @@ -1342,9 +1342,9 @@ H5D__link_chunk_filtered_collective_io(H5D_io_info_t *io_info, const H5D_type_in HDassert(fm); /* Obtain the current rank of the process and the number of processes */ - if ((mpi_rank = H5F_mpi_get_rank(io_info->dset->oloc.file)) < 0) + if((mpi_rank = H5F_mpi_get_rank(io_info->dset->oloc.file)) < 0) HGOTO_ERROR(H5E_IO, H5E_MPI, FAIL, "unable to obtain mpi rank") - if ((mpi_size = H5F_mpi_get_size(io_info->dset->oloc.file)) < 0) + if((mpi_size = H5F_mpi_get_size(io_info->dset->oloc.file)) < 0) HGOTO_ERROR(H5E_IO, H5E_MPI, FAIL, "unable to obtain mpi size") /* Set the actual-chunk-opt-mode property. */ @@ -1356,10 +1356,10 @@ H5D__link_chunk_filtered_collective_io(H5D_io_info_t *io_info, const H5D_type_in H5CX_set_mpio_actual_io_mode(H5D_MPIO_CHUNK_COLLECTIVE); /* Build a list of selected chunks in the collective io operation */ - if (H5D__construct_filtered_io_info_list(io_info, type_info, fm, &chunk_list, &chunk_list_num_entries) < 0) + if(H5D__construct_filtered_io_info_list(io_info, type_info, fm, &chunk_list, &chunk_list_num_entries) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "couldn't construct filtered I/O info list") - if (io_info->op_type == H5D_IO_OP_WRITE) { /* Filtered collective write */ + if(io_info->op_type == H5D_IO_OP_WRITE) { /* Filtered collective write */ H5D_chk_idx_info_t index_info; H5D_chunk_ud_t udata; hsize_t mpi_buf_count; @@ -1379,15 +1379,15 @@ H5D__link_chunk_filtered_collective_io(H5D_io_info_t *io_info, const H5D_type_in * updating each chunk with the data modifications from other processes, * then re-filtering the chunk. */ - for (i = 0; i < chunk_list_num_entries; i++) - if (mpi_rank == chunk_list[i].owners.new_owner) - if (H5D__filtered_collective_chunk_entry_io(&chunk_list[i], io_info, type_info, fm) < 0) + for(i = 0; i < chunk_list_num_entries; i++) + if(mpi_rank == chunk_list[i].owners.new_owner) + if(H5D__filtered_collective_chunk_entry_io(&chunk_list[i], io_info, type_info, fm) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "couldn't process chunk entry") /* Gather the new chunk sizes to all processes for a collective reallocation * of the chunks in the file. */ - if (H5D__mpio_array_gatherv(chunk_list, chunk_list_num_entries, sizeof(H5D_filtered_collective_io_info_t), + if(H5D__mpio_array_gatherv(chunk_list, chunk_list_num_entries, sizeof(H5D_filtered_collective_io_info_t), (void **) &collective_chunk_list, &collective_chunk_list_num_entries, true, 0, io_info->comm, NULL) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGATHER, FAIL, "couldn't gather new chunk sizes") @@ -1480,9 +1480,9 @@ done: H5MM_free(collective_chunk_list); /* Free the MPI buf and file types, if they were derived */ - if (mem_type_is_derived && MPI_SUCCESS != (mpi_code = MPI_Type_free(&mem_type))) + if(mem_type_is_derived && MPI_SUCCESS != (mpi_code = MPI_Type_free(&mem_type))) HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code) - if (file_type_is_derived && MPI_SUCCESS != (mpi_code = MPI_Type_free(&file_type))) + if(file_type_is_derived && MPI_SUCCESS != (mpi_code = MPI_Type_free(&file_type))) HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code) FUNC_LEAVE_NOAPI(ret_value) @@ -1770,9 +1770,9 @@ H5D__multi_chunk_filtered_collective_io(H5D_io_info_t *io_info, const H5D_type_i HDassert(fm); /* Obtain the current rank of the process and the number of processes */ - if ((mpi_rank = H5F_mpi_get_rank(io_info->dset->oloc.file)) < 0) + if((mpi_rank = H5F_mpi_get_rank(io_info->dset->oloc.file)) < 0) HGOTO_ERROR(H5E_IO, H5E_MPI, FAIL, "unable to obtain mpi rank") - if ((mpi_size = H5F_mpi_get_size(io_info->dset->oloc.file)) < 0) + if((mpi_size = H5F_mpi_get_size(io_info->dset->oloc.file)) < 0) HGOTO_ERROR(H5E_IO, H5E_MPI, FAIL, "unable to obtain mpi size") /* Set the actual chunk opt mode property */ @@ -1784,7 +1784,7 @@ H5D__multi_chunk_filtered_collective_io(H5D_io_info_t *io_info, const H5D_type_i H5CX_set_mpio_actual_io_mode(H5D_MPIO_CHUNK_COLLECTIVE); /* Build a list of selected chunks in the collective IO operation */ - if (H5D__construct_filtered_io_info_list(io_info, type_info, fm, &chunk_list, &chunk_list_num_entries) < 0) + if(H5D__construct_filtered_io_info_list(io_info, type_info, fm, &chunk_list, &chunk_list_num_entries) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "couldn't construct filtered I/O info list") /* Set up contiguous I/O info object */ @@ -1799,9 +1799,9 @@ H5D__multi_chunk_filtered_collective_io(H5D_io_info_t *io_info, const H5D_type_i /* Set dataset storage for I/O info */ io_info->store = &store; - if (io_info->op_type == H5D_IO_OP_READ) { /* Filtered collective read */ - for (i = 0; i < chunk_list_num_entries; i++) - if (H5D__filtered_collective_chunk_entry_io(&chunk_list[i], io_info, type_info, fm) < 0) + if(io_info->op_type == H5D_IO_OP_READ) { /* Filtered collective read */ + for(i = 0; i < chunk_list_num_entries; i++) + if(H5D__filtered_collective_chunk_entry_io(&chunk_list[i], io_info, type_info, fm) < 0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "couldn't process chunk entry") } /* end if */ else { /* Filtered collective write */ @@ -1852,14 +1852,14 @@ H5D__multi_chunk_filtered_collective_io(H5D_io_info_t *io_info, const H5D_type_i /* Check if this process has a chunk to work on for this iteration */ hbool_t have_chunk_to_process = (i < chunk_list_num_entries) && (mpi_rank == chunk_list[i].owners.new_owner); - if (have_chunk_to_process) - if (H5D__filtered_collective_chunk_entry_io(&chunk_list[i], io_info, type_info, fm) < 0) + if(have_chunk_to_process) + if(H5D__filtered_collective_chunk_entry_io(&chunk_list[i], io_info, type_info, fm) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "couldn't process chunk entry") /* Gather the new chunk sizes to all processes for a collective re-allocation * of the chunks in the file */ - if (H5D__mpio_array_gatherv(&chunk_list[i], have_chunk_to_process ? 1 : 0, sizeof(H5D_filtered_collective_io_info_t), + if(H5D__mpio_array_gatherv(&chunk_list[i], have_chunk_to_process ? 1 : 0, sizeof(H5D_filtered_collective_io_info_t), (void **) &collective_chunk_list, &collective_chunk_list_num_entries, true, 0, io_info->comm, NULL) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGATHER, FAIL, "couldn't gather new chunk sizes") @@ -3272,7 +3272,7 @@ H5D__filtered_collective_chunk_entry_io(H5D_filtered_collective_io_info_t *chunk if(H5S_close(dataspace) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "can't close dataspace") dataspace = NULL; - } /* end if */ + } H5MM_free(chunk_entry->async_info.receive_buffer_array[i]); } /* end for */ diff --git a/src/H5Dnone.c b/src/H5Dnone.c index 40ddcb8..751d067 100644 --- a/src/H5Dnone.c +++ b/src/H5Dnone.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Vailin Choi +/* Programmer: Vailin Choi * September 2010 * * Purpose: Implicit (Non Index) chunked I/O functions. diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index c46e38b6..5efcc9b 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, April 14, 2003 * * Purpose: This file contains declarations which are visible only within @@ -234,8 +234,8 @@ typedef struct H5D_io_info_t { typedef struct H5D_chk_idx_info_t { H5F_t *f; /* File pointer for operation */ const H5O_pline_t *pline; /* I/O pipeline info */ - H5O_layout_chunk_t *layout; /* Chunk layout description */ - H5O_storage_chunk_t *storage; /* Chunk storage description */ + H5O_layout_chunk_t *layout; /* Chunk layout description */ + H5O_storage_chunk_t *storage; /* Chunk storage description */ } H5D_chk_idx_info_t; /* @@ -566,7 +566,6 @@ H5_DLL herr_t H5D__get_chunk_info_by_coord(const H5D_t *dset, const hsize_t *coo H5_DLL haddr_t H5D__get_offset(const H5D_t *dset); H5_DLL herr_t H5D__vlen_get_buf_size(H5D_t *dset, hid_t type_id, hid_t space_id, hsize_t *size); H5_DLL herr_t H5D__vlen_get_buf_size_gen(H5VL_object_t *vol_obj, hid_t type_id, hid_t space_id, hsize_t *size); -H5_DLL herr_t H5D__check_filters(H5D_t *dataset); H5_DLL herr_t H5D__set_extent(H5D_t *dataset, const hsize_t *size); H5_DLL herr_t H5D__flush_sieve_buf(H5D_t *dataset); H5_DLL herr_t H5D__flush_real(H5D_t *dataset); diff --git a/src/H5Dselect.c b/src/H5Dselect.c index c5469c2..5a5c491 100644 --- a/src/H5Dselect.c +++ b/src/H5Dselect.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol +/* Programmer: Quincey Koziol * Thursday, September 30, 2004 * * Purpose: Dataspace I/O functions. diff --git a/src/H5Dsingle.c b/src/H5Dsingle.c index 33274bb..cd71e93 100644 --- a/src/H5Dsingle.c +++ b/src/H5Dsingle.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Vailin Choi +/* Programmer: Vailin Choi * May 2011; updated 10/2015 * * Purpose: Single Chunk I/O functions. diff --git a/src/H5Dtest.c b/src/H5Dtest.c index 916ec72..7c791d4 100644 --- a/src/H5Dtest.c +++ b/src/H5Dtest.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol +/* Programmer: Quincey Koziol * Thursday, May 27, 2004 * * Purpose: Dataset testing functions. diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c index e07f538..e997a33 100644 --- a/src/H5Dvirtual.c +++ b/src/H5Dvirtual.c @@ -11,7 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Neil Fortner + * Programmer: Neil Fortner * Wednesday, January 28, 2015 * * Purpose: @@ -313,6 +313,8 @@ done: herr_t H5D_virtual_update_min_dims(H5O_layout_t *layout, size_t idx) { + H5O_storage_virtual_t *virt = &layout->storage.u.virt; + H5O_storage_virtual_ent_t *ent = &virt->list[idx]; H5S_sel_type sel_type; int rank; hsize_t bounds_start[H5S_MAX_RANK]; @@ -324,10 +326,10 @@ H5D_virtual_update_min_dims(H5O_layout_t *layout, size_t idx) HDassert(layout); HDassert(layout->type == H5D_VIRTUAL); - HDassert(idx < layout->storage.u.virt.list_nalloc); + HDassert(idx < virt->list_nalloc); /* Get type of selection */ - if(H5S_SEL_ERROR == (sel_type = H5S_GET_SELECT_TYPE(layout->storage.u.virt.list[idx].source_dset.virtual_select))) + if(H5S_SEL_ERROR == (sel_type = H5S_GET_SELECT_TYPE(ent->source_dset.virtual_select))) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get selection type") /* Do not update min_dims for "all" or "none" selections */ @@ -335,19 +337,19 @@ H5D_virtual_update_min_dims(H5O_layout_t *layout, size_t idx) HGOTO_DONE(SUCCEED) /* Get rank of vspace */ - if((rank = H5S_GET_EXTENT_NDIMS(layout->storage.u.virt.list[idx].source_dset.virtual_select)) < 0) + if((rank = H5S_GET_EXTENT_NDIMS(ent->source_dset.virtual_select)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get number of dimensions") /* Get selection bounds */ - if(H5S_SELECT_BOUNDS(layout->storage.u.virt.list[idx].source_dset.virtual_select, bounds_start, bounds_end) < 0) + if(H5S_SELECT_BOUNDS(ent->source_dset.virtual_select, bounds_start, bounds_end) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get selection bounds") /* Update min_dims */ for(i = 0; i < rank; i++) /* Don't check unlimited dimensions in the selection */ - if((i != layout->storage.u.virt.list[idx].unlim_dim_virtual) - && (bounds_end[i] >= layout->storage.u.virt.min_dims[i])) - layout->storage.u.virt.min_dims[i] = bounds_end[i] + (hsize_t)1; + if((i != ent->unlim_dim_virtual) + && (bounds_end[i] >= virt->min_dims[i])) + virt->min_dims[i] = bounds_end[i] + (hsize_t)1; done: FUNC_LEAVE_NOAPI(ret_value) @@ -419,6 +421,7 @@ done: herr_t H5D__virtual_store_layout(H5F_t *f, H5O_layout_t *layout) { + H5O_storage_virtual_t *virt = &layout->storage.u.virt; uint8_t *heap_block = NULL; /* Block to add to heap */ size_t *str_size = NULL; /* Array for VDS entry string lengths */ uint8_t *heap_block_p; /* Pointer into the heap block, while encoding */ @@ -433,16 +436,16 @@ H5D__virtual_store_layout(H5F_t *f, H5O_layout_t *layout) /* Sanity checking */ HDassert(f); HDassert(layout); - HDassert(layout->storage.u.virt.serial_list_hobjid.addr == HADDR_UNDEF); + HDassert(virt->serial_list_hobjid.addr == HADDR_UNDEF); /* Create block if # of used entries > 0 */ - if(layout->storage.u.virt.list_nused > 0) { + if(virt->list_nused > 0) { /* Set the low/high bounds according to 'f' for the API context */ H5CX_set_libver_bounds(f); /* Allocate array for caching results of strlen */ - if(NULL == (str_size = (size_t *)H5MM_malloc(2 * layout->storage.u.virt.list_nused * sizeof(size_t)))) + if(NULL == (str_size = (size_t *)H5MM_malloc(2 * virt->list_nused * sizeof(size_t)))) HGOTO_ERROR(H5E_OHDR, H5E_RESOURCE, FAIL, "unable to allocate string length array") /* @@ -453,29 +456,30 @@ H5D__virtual_store_layout(H5F_t *f, H5O_layout_t *layout) block_size = (size_t)1 + H5F_SIZEOF_SIZE(f); /* Calculate size of each entry */ - for(i = 0; i < layout->storage.u.virt.list_nused; i++) { + for(i = 0; i < virt->list_nused; i++) { + H5O_storage_virtual_ent_t *ent = &virt->list[i]; hssize_t select_serial_size; /* Size of serialized selection */ - HDassert(layout->storage.u.virt.list[i].source_file_name); - HDassert(layout->storage.u.virt.list[i].source_dset_name); - HDassert(layout->storage.u.virt.list[i].source_select); - HDassert(layout->storage.u.virt.list[i].source_dset.virtual_select); + HDassert(ent->source_file_name); + HDassert(ent->source_dset_name); + HDassert(ent->source_select); + HDassert(ent->source_dset.virtual_select); /* Source file name */ - str_size[2 * i] = HDstrlen(layout->storage.u.virt.list[i].source_file_name) + (size_t)1; + str_size[2 * i] = HDstrlen(ent->source_file_name) + (size_t)1; block_size += str_size[2 * i]; /* Source dset name */ - str_size[(2 * i) + 1] = HDstrlen(layout->storage.u.virt.list[i].source_dset_name) + (size_t)1; + str_size[(2 * i) + 1] = HDstrlen(ent->source_dset_name) + (size_t)1; block_size += str_size[(2 * i) + 1]; /* Source selection */ - if((select_serial_size = H5S_SELECT_SERIAL_SIZE(layout->storage.u.virt.list[i].source_select)) < 0) + if((select_serial_size = H5S_SELECT_SERIAL_SIZE(ent->source_select)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to check dataspace selection size") block_size += (size_t)select_serial_size; /* Virtual dataset selection */ - if((select_serial_size = H5S_SELECT_SERIAL_SIZE(layout->storage.u.virt.list[i].source_dset.virtual_select)) < 0) + if((select_serial_size = H5S_SELECT_SERIAL_SIZE(ent->source_dset.virtual_select)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to check dataspace selection size") block_size += (size_t)select_serial_size; } /* end for */ @@ -498,25 +502,26 @@ H5D__virtual_store_layout(H5F_t *f, H5O_layout_t *layout) *heap_block_p++ = (uint8_t)H5O_LAYOUT_VDS_GH_ENC_VERS; /* Number of entries */ - tmp_nentries = (hsize_t)layout->storage.u.virt.list_nused; + tmp_nentries = (hsize_t)virt->list_nused; H5F_ENCODE_LENGTH(f, heap_block_p, tmp_nentries) /* Encode each entry */ - for(i = 0; i < layout->storage.u.virt.list_nused; i++) { + for(i = 0; i < virt->list_nused; i++) { + H5O_storage_virtual_ent_t *ent = &virt->list[i]; /* Source file name */ - H5MM_memcpy((char *)heap_block_p, layout->storage.u.virt.list[i].source_file_name, str_size[2 * i]); + H5MM_memcpy((char *)heap_block_p, ent->source_file_name, str_size[2 * i]); heap_block_p += str_size[2 * i]; /* Source dataset name */ - H5MM_memcpy((char *)heap_block_p, layout->storage.u.virt.list[i].source_dset_name, str_size[(2 * i) + 1]); + H5MM_memcpy((char *)heap_block_p, ent->source_dset_name, str_size[(2 * i) + 1]); heap_block_p += str_size[(2 * i) + 1]; /* Source selection */ - if(H5S_SELECT_SERIALIZE(layout->storage.u.virt.list[i].source_select, &heap_block_p) < 0) + if(H5S_SELECT_SERIALIZE(ent->source_select, &heap_block_p) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to serialize source selection") /* Virtual selection */ - if(H5S_SELECT_SERIALIZE(layout->storage.u.virt.list[i].source_dset.virtual_select, &heap_block_p) < 0) + if(H5S_SELECT_SERIALIZE(ent->source_dset.virtual_select, &heap_block_p) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to serialize virtual selection") } /* end for */ @@ -525,7 +530,7 @@ H5D__virtual_store_layout(H5F_t *f, H5O_layout_t *layout) UINT32ENCODE(heap_block_p, chksum) /* Insert block into global heap */ - if(H5HG_insert(f, block_size, heap_block, &(layout->storage.u.virt.serial_list_hobjid)) < 0) /* Casting away const OK --NAF */ + if(H5HG_insert(f, block_size, heap_block, &(virt->serial_list_hobjid)) < 0) /* Casting away const OK --NAF */ HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "unable to insert virtual dataset heap block") } /* end if */ @@ -556,6 +561,7 @@ herr_t H5D__virtual_copy_layout(H5O_layout_t *layout) { H5O_storage_virtual_ent_t *orig_list = NULL; + H5O_storage_virtual_t *virt = &layout->storage.u.virt; hid_t orig_source_fapl; hid_t orig_source_dapl; H5P_genplist_t *plist; @@ -569,127 +575,129 @@ H5D__virtual_copy_layout(H5O_layout_t *layout) /* Save original entry list and top-level property lists and reset in layout * so the originals aren't closed on error */ - orig_source_fapl = layout->storage.u.virt.source_fapl; - layout->storage.u.virt.source_fapl = -1; - orig_source_dapl = layout->storage.u.virt.source_dapl; - layout->storage.u.virt.source_dapl = -1; - orig_list = layout->storage.u.virt.list; - layout->storage.u.virt.list = NULL; + orig_source_fapl = virt->source_fapl; + virt->source_fapl = -1; + orig_source_dapl = virt->source_dapl; + virt->source_dapl = -1; + orig_list = virt->list; + virt->list = NULL; /* Copy entry list */ - if(layout->storage.u.virt.list_nused > 0) { + if(virt->list_nused > 0) { HDassert(orig_list); /* Allocate memory for the list */ - if(NULL == (layout->storage.u.virt.list = (H5O_storage_virtual_ent_t *)H5MM_calloc(layout->storage.u.virt.list_nused * sizeof(H5O_storage_virtual_ent_t)))) + if(NULL == (virt->list = H5MM_calloc(virt->list_nused * sizeof(virt->list[0])))) HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "unable to allocate memory for virtual dataset entry list") - layout->storage.u.virt.list_nalloc = layout->storage.u.virt.list_nused; + virt->list_nalloc = virt->list_nused; /* Copy the list entries, though set source_dset.dset and sub_dset to * NULL */ - for(i = 0; i < layout->storage.u.virt.list_nused; i++) { + for(i = 0; i < virt->list_nused; i++) { + H5O_storage_virtual_ent_t *ent = &virt->list[i]; + /* Copy virtual selection */ - if(NULL == (layout->storage.u.virt.list[i].source_dset.virtual_select + if(NULL == (ent->source_dset.virtual_select = H5S_copy(orig_list[i].source_dset.virtual_select, FALSE, TRUE))) HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy virtual selection") /* Copy original source names */ - if(NULL == (layout->storage.u.virt.list[i].source_file_name + if(NULL == (ent->source_file_name = H5MM_strdup(orig_list[i].source_file_name))) HGOTO_ERROR(H5E_DATASET, H5E_RESOURCE, FAIL, "unable to duplicate source file name") - if(NULL == (layout->storage.u.virt.list[i].source_dset_name + if(NULL == (ent->source_dset_name = H5MM_strdup(orig_list[i].source_dset_name))) HGOTO_ERROR(H5E_DATASET, H5E_RESOURCE, FAIL, "unable to duplicate source dataset name") /* Copy source selection */ - if(NULL == (layout->storage.u.virt.list[i].source_select + if(NULL == (ent->source_select = H5S_copy(orig_list[i].source_select, FALSE, TRUE))) HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy source selection") /* Initialize clipped selections */ if(orig_list[i].unlim_dim_virtual < 0) { - layout->storage.u.virt.list[i].source_dset.clipped_source_select = layout->storage.u.virt.list[i].source_select; - layout->storage.u.virt.list[i].source_dset.clipped_virtual_select = layout->storage.u.virt.list[i].source_dset.virtual_select; + ent->source_dset.clipped_source_select = ent->source_select; + ent->source_dset.clipped_virtual_select = ent->source_dset.virtual_select; } /* end if */ /* Copy parsed names */ - if(H5D__virtual_copy_parsed_name(&layout->storage.u.virt.list[i].parsed_source_file_name, orig_list[i].parsed_source_file_name) < 0) + if(H5D__virtual_copy_parsed_name(&ent->parsed_source_file_name, orig_list[i].parsed_source_file_name) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy parsed source file name") - layout->storage.u.virt.list[i].psfn_static_strlen = orig_list[i].psfn_static_strlen; - layout->storage.u.virt.list[i].psfn_nsubs = orig_list[i].psfn_nsubs; - if(H5D__virtual_copy_parsed_name(&layout->storage.u.virt.list[i].parsed_source_dset_name, orig_list[i].parsed_source_dset_name) < 0) + ent->psfn_static_strlen = orig_list[i].psfn_static_strlen; + ent->psfn_nsubs = orig_list[i].psfn_nsubs; + if(H5D__virtual_copy_parsed_name(&ent->parsed_source_dset_name, orig_list[i].parsed_source_dset_name) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy parsed source dataset name") - layout->storage.u.virt.list[i].psdn_static_strlen = orig_list[i].psdn_static_strlen; - layout->storage.u.virt.list[i].psdn_nsubs = orig_list[i].psdn_nsubs; + ent->psdn_static_strlen = orig_list[i].psdn_static_strlen; + ent->psdn_nsubs = orig_list[i].psdn_nsubs; /* Copy source names in source dset or add reference as appropriate */ if(orig_list[i].source_dset.file_name) { if(orig_list[i].source_dset.file_name == orig_list[i].source_file_name) - layout->storage.u.virt.list[i].source_dset.file_name = layout->storage.u.virt.list[i].source_file_name; + ent->source_dset.file_name = ent->source_file_name; else if(orig_list[i].parsed_source_file_name && (orig_list[i].source_dset.file_name != orig_list[i].parsed_source_file_name->name_segment)) { - HDassert(layout->storage.u.virt.list[i].parsed_source_file_name); - HDassert(layout->storage.u.virt.list[i].parsed_source_file_name->name_segment); - layout->storage.u.virt.list[i].source_dset.file_name = layout->storage.u.virt.list[i].parsed_source_file_name->name_segment; + HDassert(ent->parsed_source_file_name); + HDassert(ent->parsed_source_file_name->name_segment); + ent->source_dset.file_name = ent->parsed_source_file_name->name_segment; } /* end if */ else - if(NULL == (layout->storage.u.virt.list[i].source_dset.file_name + if(NULL == (ent->source_dset.file_name = H5MM_strdup(orig_list[i].source_dset.file_name))) HGOTO_ERROR(H5E_DATASET, H5E_RESOURCE, FAIL, "unable to duplicate source file name") } /* end if */ if(orig_list[i].source_dset.dset_name) { if(orig_list[i].source_dset.dset_name == orig_list[i].source_dset_name) - layout->storage.u.virt.list[i].source_dset.dset_name = layout->storage.u.virt.list[i].source_dset_name; + ent->source_dset.dset_name = ent->source_dset_name; else if(orig_list[i].parsed_source_dset_name && (orig_list[i].source_dset.dset_name != orig_list[i].parsed_source_dset_name->name_segment)) { - HDassert(layout->storage.u.virt.list[i].parsed_source_dset_name); - HDassert(layout->storage.u.virt.list[i].parsed_source_dset_name->name_segment); - layout->storage.u.virt.list[i].source_dset.dset_name = layout->storage.u.virt.list[i].parsed_source_dset_name->name_segment; + HDassert(ent->parsed_source_dset_name); + HDassert(ent->parsed_source_dset_name->name_segment); + ent->source_dset.dset_name = ent->parsed_source_dset_name->name_segment; } /* end if */ else - if(NULL == (layout->storage.u.virt.list[i].source_dset.dset_name + if(NULL == (ent->source_dset.dset_name = H5MM_strdup(orig_list[i].source_dset.dset_name))) HGOTO_ERROR(H5E_DATASET, H5E_RESOURCE, FAIL, "unable to duplicate source dataset name") } /* end if */ /* Copy other fields in entry */ - layout->storage.u.virt.list[i].unlim_dim_source = orig_list[i].unlim_dim_source; - layout->storage.u.virt.list[i].unlim_dim_virtual = orig_list[i].unlim_dim_virtual; - layout->storage.u.virt.list[i].unlim_extent_source = orig_list[i].unlim_extent_source; - layout->storage.u.virt.list[i].unlim_extent_virtual = orig_list[i].unlim_extent_virtual; - layout->storage.u.virt.list[i].clip_size_source = orig_list[i].clip_size_source; - layout->storage.u.virt.list[i].clip_size_virtual = orig_list[i].clip_size_virtual; - layout->storage.u.virt.list[i].source_space_status = orig_list[i].source_space_status; - layout->storage.u.virt.list[i].virtual_space_status = orig_list[i].virtual_space_status; + ent->unlim_dim_source = orig_list[i].unlim_dim_source; + ent->unlim_dim_virtual = orig_list[i].unlim_dim_virtual; + ent->unlim_extent_source = orig_list[i].unlim_extent_source; + ent->unlim_extent_virtual = orig_list[i].unlim_extent_virtual; + ent->clip_size_source = orig_list[i].clip_size_source; + ent->clip_size_virtual = orig_list[i].clip_size_virtual; + ent->source_space_status = orig_list[i].source_space_status; + ent->virtual_space_status = orig_list[i].virtual_space_status; } /* end for */ } /* end if */ else { /* Zero out other fields related to list, just to be sure */ - layout->storage.u.virt.list = NULL; - layout->storage.u.virt.list_nalloc = 0; + virt->list = NULL; + virt->list_nalloc = 0; } /* end else */ /* Copy property lists */ if(orig_source_fapl >= 0) { if(NULL == (plist = (H5P_genplist_t *)H5I_object_verify(orig_source_fapl, H5I_GENPROP_LST))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") - if((layout->storage.u.virt.source_fapl = H5P_copy_plist(plist, FALSE)) < 0) + if((virt->source_fapl = H5P_copy_plist(plist, FALSE)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy fapl") } /* end if */ if(orig_source_dapl >= 0) { if(NULL == (plist = (H5P_genplist_t *)H5I_object_verify(orig_source_dapl, H5I_GENPROP_LST))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") - if((layout->storage.u.virt.source_dapl = H5P_copy_plist(plist, FALSE)) < 0) + if((virt->source_dapl = H5P_copy_plist(plist, FALSE)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy dapl") } /* end if */ /* New layout is not fully initialized */ - layout->storage.u.virt.init = FALSE; + virt->init = FALSE; done: /* Release allocated resources on failure */ @@ -721,6 +729,7 @@ herr_t H5D__virtual_reset_layout(H5O_layout_t *layout) { size_t i, j; + H5O_storage_virtual_t *virt = &layout->storage.u.virt; herr_t ret_value = SUCCEED; FUNC_ENTER_PACKAGE @@ -731,53 +740,54 @@ H5D__virtual_reset_layout(H5O_layout_t *layout) /* Free the list entries. Note we always attempt to free everything even in * the case of a failure. Because of this, and because we free the list * afterwards, we do not need to zero out the memory in the list. */ - for(i = 0; i < layout->storage.u.virt.list_nused; i++) { + for(i = 0; i < virt->list_nused; i++) { + H5O_storage_virtual_ent_t *ent = &virt->list[i]; /* Free source_dset */ - if(H5D__virtual_reset_source_dset(&layout->storage.u.virt.list[i], &layout->storage.u.virt.list[i].source_dset) < 0) + if(H5D__virtual_reset_source_dset(ent, &ent->source_dset) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to reset source dataset") /* Free original source names */ - (void)H5MM_xfree(layout->storage.u.virt.list[i].source_file_name); - (void)H5MM_xfree(layout->storage.u.virt.list[i].source_dset_name); + (void)H5MM_xfree(ent->source_file_name); + (void)H5MM_xfree(ent->source_dset_name); /* Free sub_dset */ - for(j = 0; j < layout->storage.u.virt.list[i].sub_dset_nalloc; j++) - if(H5D__virtual_reset_source_dset(&layout->storage.u.virt.list[i], &layout->storage.u.virt.list[i].sub_dset[j]) < 0) + for(j = 0; j < ent->sub_dset_nalloc; j++) + if(H5D__virtual_reset_source_dset(ent, &ent->sub_dset[j]) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to reset source dataset") - layout->storage.u.virt.list[i].sub_dset = (H5O_storage_virtual_srcdset_t *)H5MM_xfree(layout->storage.u.virt.list[i].sub_dset); + ent->sub_dset = H5MM_xfree(ent->sub_dset); /* Free source_select */ - if(layout->storage.u.virt.list[i].source_select) - if(H5S_close(layout->storage.u.virt.list[i].source_select) < 0) + if(ent->source_select) + if(H5S_close(ent->source_select) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release source selection") /* Free parsed_source_file_name */ - H5D_virtual_free_parsed_name(layout->storage.u.virt.list[i].parsed_source_file_name); + H5D_virtual_free_parsed_name(ent->parsed_source_file_name); /* Free parsed_source_dset_name */ - H5D_virtual_free_parsed_name(layout->storage.u.virt.list[i].parsed_source_dset_name); - } /* end for */ + H5D_virtual_free_parsed_name(ent->parsed_source_dset_name); + } /* Free the list */ - layout->storage.u.virt.list = (H5O_storage_virtual_ent_t *)H5MM_xfree(layout->storage.u.virt.list); - layout->storage.u.virt.list_nalloc = (size_t)0; - layout->storage.u.virt.list_nused = (size_t)0; - (void)HDmemset(layout->storage.u.virt.min_dims, 0, sizeof(layout->storage.u.virt.min_dims)); + virt->list = H5MM_xfree(virt->list); + virt->list_nalloc = (size_t)0; + virt->list_nused = (size_t)0; + (void)HDmemset(virt->min_dims, 0, sizeof(virt->min_dims)); /* Close access property lists */ - if(layout->storage.u.virt.source_fapl >= 0) { - if(H5I_dec_ref(layout->storage.u.virt.source_fapl) < 0) + if(virt->source_fapl >= 0) { + if(H5I_dec_ref(virt->source_fapl) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't close source fapl") - layout->storage.u.virt.source_fapl = -1; - } /* end if */ - if(layout->storage.u.virt.source_dapl >= 0) { - if(H5I_dec_ref(layout->storage.u.virt.source_dapl) < 0) + virt->source_fapl = -1; + } + if(virt->source_dapl >= 0) { + if(H5I_dec_ref(virt->source_dapl) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't close source dapl") - layout->storage.u.virt.source_dapl = -1; - } /* end if */ + virt->source_dapl = -1; + } /* The list is no longer initialized */ - layout->storage.u.virt.init = FALSE; + virt->init = FALSE; /* Note the lack of a done: label. This is because there are no HGOTO_ERROR * calls. If one is added, a done: label must also be added */ @@ -2238,7 +2248,7 @@ H5D__virtual_is_data_cached(const H5D_shared_t *shared_dset) size_t i, j; /* Local index variables */ hbool_t ret_value = FALSE; /* Return value */ - FUNC_ENTER_PACKAGE_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity checks */ HDassert(shared_dset); @@ -2781,7 +2791,7 @@ H5D__virtual_write_one(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, * extent in the unlimited dimension. -NAF */ /* Project intersection of file space and mapping virtual space onto * mapping source space */ - if(H5S_select_project_intersection(source_dset->virtual_select, source_dset->clipped_source_select, file_space, &projected_src_space, TRUE) < 0) + if(H5S_select_project_intersection(source_dset->clipped_virtual_select, source_dset->clipped_source_select, file_space, &projected_src_space, TRUE) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "can't project virtual intersection onto source space") /* Perform write on source dataset */ diff --git a/src/H5E.c b/src/H5E.c index f204864..a56181d 100644 --- a/src/H5E.c +++ b/src/H5E.c @@ -50,7 +50,6 @@ /* Headers */ /***********/ #include "H5private.h" /* Generic Functions */ -#include "H5CXprivate.h" /* API Contexts */ #include "H5Epkg.h" /* Error handling */ #include "H5FLprivate.h" /* Free lists */ #include "H5Iprivate.h" /* IDs */ @@ -391,7 +390,7 @@ H5E__get_stack(void) /*------------------------------------------------------------------------- - * Function: H5E_free_class + * Function: H5E__free_class * * Purpose: Private function to free an error class. * @@ -403,9 +402,9 @@ H5E__get_stack(void) *------------------------------------------------------------------------- */ static herr_t -H5E_free_class(H5E_cls_t *cls) +H5E__free_class(H5E_cls_t *cls) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check arguments */ HDassert(cls); @@ -417,7 +416,7 @@ H5E_free_class(H5E_cls_t *cls) cls = H5FL_FREE(H5E_cls_t, cls); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5E_free_class() */ +} /* end H5E__free_class() */ /*------------------------------------------------------------------------- @@ -502,7 +501,7 @@ H5E__register_class(const char *cls_name, const char *lib_name, const char *vers done: if(!ret_value) - if(cls && H5E_free_class(cls) < 0) + if(cls && H5E__free_class(cls) < 0) HDONE_ERROR(H5E_ERROR, H5E_CANTRELEASE, NULL, "unable to free error class") FUNC_LEAVE_NOAPI(ret_value) @@ -514,9 +513,9 @@ done: * * Purpose: Closes an error class. * - * Return: SUCCEED/FAIL + * Return: Non-negative value on success/Negative on failure * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Friday, July 11, 2003 * *------------------------------------------------------------------------- @@ -572,7 +571,7 @@ H5E__unregister_class(H5E_cls_t *cls) HGOTO_ERROR(H5E_ERROR, H5E_BADITER, FAIL, "unable to free all messages in this error class") /* Free error class structure */ - if(H5E_free_class(cls) < 0) + if(H5E__free_class(cls) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTRELEASE, FAIL, "unable to free error class") done: @@ -1041,9 +1040,9 @@ done: * Purpose: Replaces current stack with specified stack. This closes the * stack ID also. * - * Return: SUCCEED/FAIL + * Return: Non-negative value on success/Negative on failure * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Friday, July 15, 2003 * *------------------------------------------------------------------------- @@ -1147,9 +1146,9 @@ done: * * Purpose: Closes an error stack. * - * Return: SUCCEED/FAIL + * Return: Non-negative value on success/Negative on failure * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Friday, July 14, 2003 * *------------------------------------------------------------------------- @@ -1285,9 +1284,9 @@ H5E__get_num(const H5E_t *estack) * * Purpose: Deletes some error messages from the top of error stack. * - * Return: SUCCEED/FAIL + * Return: Non-negative value on success/Negative on failure * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Friday, July 16, 2003 * *------------------------------------------------------------------------- @@ -1340,9 +1339,9 @@ done: * function name, file name, and error description strings must * be statically allocated. * - * Return: SUCCEED/FAIL + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, October 18, 1999 * * Notes: Basically a new public API wrapper around the H5E__push_stack @@ -1442,9 +1441,9 @@ done: * * Purpose: Clears the error stack for the specified error stack. * - * Return: SUCCEED/FAIL + * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Wednesday, July 16, 2003 * *------------------------------------------------------------------------- @@ -1487,9 +1486,9 @@ done: * prints error messages. Users are encouraged to write their * own more specific error handlers. * - * Return: SUCCEED/FAIL + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, February 27, 1998 * *------------------------------------------------------------------------- @@ -1532,9 +1531,9 @@ done: * Purpose: Walks the error stack for the current thread and calls some * function for each error along the way. * - * Return: SUCCEED/FAIL + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, February 27, 1998 * *------------------------------------------------------------------------- @@ -1582,7 +1581,7 @@ done: * Either (or both) arguments may be null in which case the * value is not returned. * - * Return: SUCCEED/FAIL + * Return: Non-negative value on success/Negative on failure * * Programmer: Robb Matzke * Saturday, February 28, 1998 @@ -1640,7 +1639,7 @@ done: * Automatic stack traversal is always in the H5E_WALK_DOWNWARD * direction. * - * Return: SUCCEED/FAIL + * Return: Non-negative value on success/Negative on failure * * Programmer: Robb Matzke * Friday, February 27, 1998 @@ -1699,7 +1698,7 @@ done: * or the H5E_auto_t typedef. The IS_STACK parameter is set * to 1 for the first case and 0 for the latter case. * - * Return: SUCCEED/FAIL + * Return: Non-negative value on success/Negative on failure * * Programmer: Quincey Koziol * Wednesday, September 8, 2004 diff --git a/src/H5EA.c b/src/H5EA.c index 56663dc..bf50452 100644 --- a/src/H5EA.c +++ b/src/H5EA.c @@ -15,7 +15,7 @@ * * Created: H5EA.c * Jun 17 2008 - * Quincey Koziol + * Quincey Koziol * * Purpose: Implements an "extensible array" for storing elements * in an array whose high bounds can extend and shrink. @@ -124,7 +124,6 @@ H5FL_BLK_DEFINE(ea_native_elmt); * NULL on failure * * Programmer: Quincey Koziol - * koziol@lbl.gov * Oct 10 2016 * *------------------------------------------------------------------------- @@ -190,7 +189,6 @@ END_FUNC(STATIC) /* end H5EA__new() */ * NULL on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jun 17 2008 * *------------------------------------------------------------------------- @@ -241,7 +239,6 @@ END_FUNC(PRIV) /* end H5EA_create() */ * NULL on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 28 2008 * *------------------------------------------------------------------------- @@ -283,7 +280,6 @@ END_FUNC(PRIV) /* end H5EA_open() */ * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 21 2008 * *------------------------------------------------------------------------- @@ -314,7 +310,6 @@ END_FUNC(PRIV) /* end H5EA_get_nelmts() */ * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 21 2008 * *------------------------------------------------------------------------- @@ -347,7 +342,6 @@ END_FUNC(PRIV) /* end H5EA_get_addr() */ * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 9 2008 * *------------------------------------------------------------------------- @@ -656,7 +650,6 @@ END_FUNC(STATIC) /* end H5EA__lookup_elmt() */ * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 9 2008 * *------------------------------------------------------------------------- @@ -721,7 +714,6 @@ END_FUNC(PRIV) /* end H5EA_set() */ * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 11 2008 * *------------------------------------------------------------------------- @@ -786,7 +778,6 @@ END_FUNC(PRIV) /* end H5EA_get() */ * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * May 27 2009 * *------------------------------------------------------------------------- @@ -836,7 +827,6 @@ END_FUNC(PRIV) /* end H5EA_depend() */ * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 21 2008 * *------------------------------------------------------------------------- @@ -937,7 +927,6 @@ END_FUNC(PRIV) /* end H5EA_close() */ * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 28 2008 * *------------------------------------------------------------------------- diff --git a/src/H5EAcache.c b/src/H5EAcache.c index affa127..f7534fb 100644 --- a/src/H5EAcache.c +++ b/src/H5EAcache.c @@ -15,7 +15,7 @@ * * Created: H5EAcache.c * Aug 26 2008 - * Quincey Koziol + * Quincey Koziol * * Purpose: Implement extensible array metadata cache methods. * @@ -239,7 +239,6 @@ const H5AC_class_t H5AC_EARRAY_DBLK_PAGE[1] = {{ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 16, 2013 * *------------------------------------------------------------------------- @@ -305,7 +304,6 @@ END_FUNC(STATIC) /* end H5EA__cache_hdr_verify_chksum() */ * Failure: NULL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 16, 2013 * *------------------------------------------------------------------------- @@ -429,7 +427,6 @@ END_FUNC(STATIC) /* end H5EA__cache_hdr_deserialize() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 16, 2013 * *------------------------------------------------------------------------- @@ -459,7 +456,6 @@ END_FUNC(STATIC) /* end H5EA__cache_hdr_image_len() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 16, 2013 * *------------------------------------------------------------------------- @@ -606,7 +602,6 @@ END_FUNC(STATIC) /* end H5EA__cache_hdr_notify() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 16, 2013 * *------------------------------------------------------------------------- @@ -635,7 +630,6 @@ END_FUNC(STATIC) /* end H5EA__cache_hdr_free_icr() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 17, 2013 * *------------------------------------------------------------------------- @@ -708,7 +702,6 @@ END_FUNC(STATIC) /* end H5EA__cache_iblock_verify_chksum() */ * Failure: NULL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 17, 2013 * *------------------------------------------------------------------------- @@ -815,7 +808,6 @@ END_FUNC(STATIC) /* end H5EA__cache_iblock_deserialize() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 17, 2013 * *------------------------------------------------------------------------- @@ -845,7 +837,6 @@ END_FUNC(STATIC) /* end H5EA__cache_iblock_image_len() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 17, 2013 * *------------------------------------------------------------------------- @@ -932,7 +923,6 @@ END_FUNC(STATIC) /* end H5EA__cache_iblock_serialize() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 17, 2013 * *------------------------------------------------------------------------- @@ -1001,7 +991,6 @@ END_FUNC(STATIC) /* end H5EA__cache_iblock_notify() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 17, 2013 * *------------------------------------------------------------------------- @@ -1030,7 +1019,6 @@ END_FUNC(STATIC) /* end H5EA__cache_iblock_free_icr() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 17, 2013 * *------------------------------------------------------------------------- @@ -1122,7 +1110,6 @@ END_FUNC(STATIC) /* end H5EA__cache_sblock_verify_chksum() */ * Failure: NULL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 17, 2013 * *------------------------------------------------------------------------- @@ -1226,7 +1213,6 @@ END_FUNC(STATIC) /* end H5EA__cache_sblock_deserialize() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 17, 2013 * *------------------------------------------------------------------------- @@ -1256,7 +1242,6 @@ END_FUNC(STATIC) /* end H5EA__cache_sblock_image_len() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 17, 2013 * *------------------------------------------------------------------------- @@ -1330,7 +1315,6 @@ END_FUNC(STATIC) /* end H5EA__cache_sblock_serialize() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Mar 31 2009 * *------------------------------------------------------------------------- @@ -1414,7 +1398,6 @@ END_FUNC(STATIC) /* end H5EA__cache_sblock_notify() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 17, 2013 * *------------------------------------------------------------------------- @@ -1443,7 +1426,6 @@ END_FUNC(STATIC) /* end H5EA__cache_sblock_free_icr() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 17, 2013 * *------------------------------------------------------------------------- @@ -1536,7 +1518,6 @@ END_FUNC(STATIC) /* end H5EA__cache_sblock_verify_chksum() */ * Failure: NULL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 17, 2013 * *------------------------------------------------------------------------- @@ -1639,7 +1620,6 @@ END_FUNC(STATIC) /* end H5EA__cache_dblock_deserialize() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 17, 2013 * *------------------------------------------------------------------------- @@ -1672,7 +1652,6 @@ END_FUNC(STATIC) /* end H5EA__cache_dblock_image_len() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 17, 2013 * *------------------------------------------------------------------------- @@ -1744,7 +1723,6 @@ END_FUNC(STATIC) /* end H5EA__cache_dblock_serialize() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Mar 31 2009 * *------------------------------------------------------------------------- @@ -1828,7 +1806,6 @@ END_FUNC(STATIC) /* end H5EA__cache_dblock_notify() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 17, 2013 * *------------------------------------------------------------------------- @@ -1904,7 +1881,6 @@ END_FUNC(STATIC) /* end H5EA__cache_dblock_fsf_size() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 17, 2013 * *------------------------------------------------------------------------- @@ -1970,7 +1946,6 @@ END_FUNC(STATIC) /* end H5EA__cache_dblk_page_verify_chksum() */ * Failure: NULL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 17, 2013 * *------------------------------------------------------------------------- @@ -2043,7 +2018,6 @@ END_FUNC(STATIC) /* end H5EA__cache_dblk_page_deserialize() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 17, 2013 * *------------------------------------------------------------------------- @@ -2073,7 +2047,6 @@ END_FUNC(STATIC) /* end H5EA__cache_dblk_page_image_len() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 17, 2013 * *------------------------------------------------------------------------- @@ -2125,7 +2098,6 @@ END_FUNC(STATIC) /* end H5EA__cache_dblk_page_serialize() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Mar 31 2009 * *------------------------------------------------------------------------- @@ -2209,7 +2181,6 @@ END_FUNC(STATIC) /* end H5EA__cache_dblk_page_notify() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 17, 2013 * *------------------------------------------------------------------------- diff --git a/src/H5EAdbg.c b/src/H5EAdbg.c index 3d6c2ed..e5b68be 100644 --- a/src/H5EAdbg.c +++ b/src/H5EAdbg.c @@ -13,11 +13,11 @@ /*------------------------------------------------------------------------- * - * Created: H5EAdbg.c - * Sep 11 2008 - * Quincey Koziol + * Created: H5EAdbg.c + * Sep 11 2008 + * Quincey Koziol * - * Purpose: Dump debugging information about an extensible array. + * Purpose: Dump debugging information about an extensible array. * *------------------------------------------------------------------------- */ @@ -37,9 +37,9 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5EApkg.h" /* Extensible Arrays */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5EApkg.h" /* Extensible Arrays */ /****************/ @@ -79,15 +79,14 @@ /*------------------------------------------------------------------------- - * Function: H5EA__hdr_debug + * Function: H5EA__hdr_debug * - * Purpose: Prints debugging info about a extensible array header. + * Purpose: Prints debugging info about a extensible array header. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Sep 11 2008 + * Programmer: Quincey Koziol + * Sep 11 2008 * *------------------------------------------------------------------------- */ @@ -97,7 +96,7 @@ H5EA__hdr_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, const H5EA_class_t *cls, haddr_t obj_addr)) /* Local variables */ - H5EA_hdr_t *hdr = NULL; /* Shared extensible array header */ + H5EA_hdr_t *hdr = NULL; /* Shared extensible array header */ void *dbg_ctx = NULL; /* Extensible array debugging context */ /* Check arguments */ @@ -117,73 +116,72 @@ H5EA__hdr_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, /* Load the extensible array header */ if(NULL == (hdr = H5EA__hdr_protect(f, addr, dbg_ctx, H5AC__READ_ONLY_FLAG))) - H5E_THROW(H5E_CANTPROTECT, "unable to load extensible array header") + H5E_THROW(H5E_CANTPROTECT, "unable to load extensible array header") /* Print opening message */ HDfprintf(stream, "%*sExtensible Array Header...\n", indent, ""); /* Print the values */ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, - "Array class ID:", hdr->cparam.cls->name); + "Array class ID:", hdr->cparam.cls->name); HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, - "Header size:", - hdr->size); + "Header size:", + hdr->size); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "Raw Element Size:", - (unsigned)hdr->cparam.raw_elmt_size); + "Raw Element Size:", + (unsigned)hdr->cparam.raw_elmt_size); HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, - "Native Element Size (on this platform):", - hdr->cparam.cls->nat_elmt_size); + "Native Element Size (on this platform):", + hdr->cparam.cls->nat_elmt_size); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "Log2(Max. # of elements in array):", - (unsigned)hdr->cparam.max_nelmts_bits); + "Log2(Max. # of elements in array):", + (unsigned)hdr->cparam.max_nelmts_bits); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "# of elements in index block:", - (unsigned)hdr->cparam.idx_blk_elmts); + "# of elements in index block:", + (unsigned)hdr->cparam.idx_blk_elmts); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "Min. # of elements per data block:", - (unsigned)hdr->cparam.data_blk_min_elmts); + "Min. # of elements per data block:", + (unsigned)hdr->cparam.data_blk_min_elmts); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "Min. # of data block pointers for a super block:", - (unsigned)hdr->cparam.sup_blk_min_data_ptrs); + "Min. # of data block pointers for a super block:", + (unsigned)hdr->cparam.sup_blk_min_data_ptrs); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "Log2(Max. # of elements in data block page):", - (unsigned)hdr->cparam.max_dblk_page_nelmts_bits); + "Log2(Max. # of elements in data block page):", + (unsigned)hdr->cparam.max_dblk_page_nelmts_bits); HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, - "Highest element index stored (+1):", - hdr->stats.stored.max_idx_set); + "Highest element index stored (+1):", + hdr->stats.stored.max_idx_set); HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, - "Number of super blocks created:", - hdr->stats.stored.nsuper_blks); + "Number of super blocks created:", + hdr->stats.stored.nsuper_blks); HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, - "Number of data blocks created:", - hdr->stats.stored.ndata_blks); + "Number of data blocks created:", + hdr->stats.stored.ndata_blks); HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, - "Number of elements 'realized':", - hdr->stats.stored.nelmts); + "Number of elements 'realized':", + hdr->stats.stored.nelmts); HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, - "Index Block Address:", - hdr->idx_blk_addr); + "Index Block Address:", + hdr->idx_blk_addr); CATCH if(dbg_ctx && cls->dst_dbg_ctx(dbg_ctx) < 0) H5E_THROW(H5E_CANTRELEASE, "unable to release extensible array debugging context") if(hdr && H5EA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header") + H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header") END_FUNC(PKG) /* end H5EA__hdr_debug() */ /*------------------------------------------------------------------------- - * Function: H5EA__iblock_debug + * Function: H5EA__iblock_debug * - * Purpose: Prints debugging info about a extensible array index block. + * Purpose: Prints debugging info about a extensible array index block. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Sep 11 2008 + * Programmer: Quincey Koziol + * Sep 11 2008 * *------------------------------------------------------------------------- */ @@ -215,7 +213,7 @@ H5EA__iblock_debug(H5F_t *f, haddr_t H5_ATTR_UNUSED addr, FILE *stream, int inde /* Load the extensible array header */ if(NULL == (hdr = H5EA__hdr_protect(f, hdr_addr, dbg_ctx, H5AC__READ_ONLY_FLAG))) - H5E_THROW(H5E_CANTPROTECT, "unable to load extensible array header") + H5E_THROW(H5E_CANTPROTECT, "unable to load extensible array header") /* Sanity check */ HDassert(H5F_addr_eq(hdr->idx_blk_addr, addr)); @@ -229,16 +227,16 @@ H5EA__iblock_debug(H5F_t *f, haddr_t H5_ATTR_UNUSED addr, FILE *stream, int inde /* Print the values */ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, - "Array class ID:", hdr->cparam.cls->name); + "Array class ID:", hdr->cparam.cls->name); HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, - "Index Block size:", - iblock->size); + "Index Block size:", + iblock->size); HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, - "# of data block addresses in index block:", - iblock->ndblk_addrs); + "# of data block addresses in index block:", + iblock->ndblk_addrs); HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, - "# of super block addresses in index block:", - iblock->nsblk_addrs); + "# of super block addresses in index block:", + iblock->nsblk_addrs); /* Check if there are any elements in index block */ if(hdr->cparam.idx_blk_elmts > 0) { @@ -293,21 +291,20 @@ CATCH if(iblock && H5EA__iblock_unprotect(iblock, H5AC__NO_FLAGS_SET) < 0) H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array index block") if(hdr && H5EA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header") + H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header") END_FUNC(PKG) /* end H5EA__iblock_debug() */ /*------------------------------------------------------------------------- - * Function: H5EA__sblock_debug + * Function: H5EA__sblock_debug * - * Purpose: Prints debugging info about a extensible array super block. + * Purpose: Prints debugging info about a extensible array super block. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Sep 30 2008 + * Programmer: Quincey Koziol + * Sep 30 2008 * *------------------------------------------------------------------------- */ @@ -339,7 +336,7 @@ H5EA__sblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, /* Load the extensible array header */ if(NULL == (hdr = H5EA__hdr_protect(f, hdr_addr, dbg_ctx, H5AC__READ_ONLY_FLAG))) - H5E_THROW(H5E_CANTPROTECT, "unable to load extensible array header") + H5E_THROW(H5E_CANTPROTECT, "unable to load extensible array header") /* Protect super block */ /* (Note: setting parent of super block to 'hdr' for this operation should be OK -QAK) */ @@ -351,16 +348,16 @@ H5EA__sblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, /* Print the values */ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, - "Array class ID:", hdr->cparam.cls->name); + "Array class ID:", hdr->cparam.cls->name); HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, - "Super Block size:", - sblock->size); + "Super Block size:", + sblock->size); HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, - "# of data block addresses in super block:", - sblock->ndblks); + "# of data block addresses in super block:", + sblock->ndblks); HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, - "# of elements in data blocks from this super block:", - sblock->dblk_nelmts); + "# of elements in data blocks from this super block:", + sblock->dblk_nelmts); /* Check if there are any data block addresses in super block */ if(sblock->ndblks > 0) { @@ -384,21 +381,20 @@ CATCH if(sblock && H5EA__sblock_unprotect(sblock, H5AC__NO_FLAGS_SET) < 0) H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array super block") if(hdr && H5EA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header") + H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header") END_FUNC(PKG) /* end H5EA__sblock_debug() */ /*------------------------------------------------------------------------- - * Function: H5EA__dblock_debug + * Function: H5EA__dblock_debug * - * Purpose: Prints debugging info about a extensible array data block. + * Purpose: Prints debugging info about a extensible array data block. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Sep 22 2008 + * Programmer: Quincey Koziol + * Sep 22 2008 * *------------------------------------------------------------------------- */ @@ -432,7 +428,7 @@ H5EA__dblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, /* Load the extensible array header */ if(NULL == (hdr = H5EA__hdr_protect(f, hdr_addr, dbg_ctx, H5AC__READ_ONLY_FLAG))) - H5E_THROW(H5E_CANTPROTECT, "unable to load extensible array header") + H5E_THROW(H5E_CANTPROTECT, "unable to load extensible array header") /* Protect data block */ /* (Note: setting parent of data block to 'hdr' for this operation should be OK -QAK) */ @@ -444,10 +440,10 @@ H5EA__dblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, /* Print the values */ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, - "Array class ID:", hdr->cparam.cls->name); + "Array class ID:", hdr->cparam.cls->name); HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, - "Data Block size:", - dblock->size); + "Data Block size:", + dblock->size); /* Print the elements in the index block */ @@ -466,7 +462,7 @@ CATCH if(dblock && H5EA__dblock_unprotect(dblock, H5AC__NO_FLAGS_SET) < 0) H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array data block") if(hdr && H5EA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header") + H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header") END_FUNC(PKG) /* end H5EA__dblock_debug() */ diff --git a/src/H5EAdblkpage.c b/src/H5EAdblkpage.c index 6dd2e98..ee5c904 100644 --- a/src/H5EAdblkpage.c +++ b/src/H5EAdblkpage.c @@ -15,7 +15,7 @@ * * Created: H5EAdblkpage.c * Nov 20 2008 - * Quincey Koziol + * Quincey Koziol * * Purpose: Data block page routines for extensible arrays. * @@ -91,7 +91,6 @@ H5FL_DEFINE_STATIC(H5EA_dblk_page_t); * Return: Non-NULL pointer to data block on success/NULL on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Nov 20 2008 * *------------------------------------------------------------------------- @@ -141,7 +140,6 @@ END_FUNC(PKG) /* end H5EA__dblk_page_alloc() */ * Return: Valid file address on success/HADDR_UNDEF on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Nov 20 2008 * *------------------------------------------------------------------------- @@ -206,7 +204,6 @@ END_FUNC(PKG) /* end H5EA__dblk_page_create() */ * Return: Non-NULL pointer to data block page on success/NULL on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Nov 20 2008 * *------------------------------------------------------------------------- @@ -267,7 +264,6 @@ END_FUNC(PKG) /* end H5EA__dblk_page_protect() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Nov 20 2008 * *------------------------------------------------------------------------- @@ -298,7 +294,6 @@ END_FUNC(PKG) /* end H5EA__dblk_page_unprotect() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Nov 20 2008 * *------------------------------------------------------------------------- diff --git a/src/H5EAdblock.c b/src/H5EAdblock.c index d926fd5..d540a3c 100644 --- a/src/H5EAdblock.c +++ b/src/H5EAdblock.c @@ -15,7 +15,7 @@ * * Created: H5EAdblock.c * Sep 11 2008 - * Quincey Koziol + * Quincey Koziol * * Purpose: Data block routines for extensible arrays. * @@ -92,7 +92,6 @@ H5FL_DEFINE_STATIC(H5EA_dblock_t); * Return: Non-NULL pointer to data block on success/NULL on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 11 2008 * *------------------------------------------------------------------------- @@ -153,7 +152,6 @@ END_FUNC(PKG) /* end H5EA__dblock_alloc() */ * Return: Valid file address on success/HADDR_UNDEF on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 9 2008 * *------------------------------------------------------------------------- @@ -248,7 +246,6 @@ END_FUNC(PKG) /* end H5EA__dblock_create() */ * Return: Super block index on success/Can't fail * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 11 2008 * *------------------------------------------------------------------------- @@ -285,7 +282,6 @@ END_FUNC(PKG) /* end H5EA__dblock_sblk_idx() */ * Return: Non-NULL pointer to data block on success/NULL on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 18 2008 * *------------------------------------------------------------------------- @@ -348,7 +344,6 @@ END_FUNC(PKG) /* end H5EA__dblock_protect() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 11 2008 * *------------------------------------------------------------------------- @@ -379,7 +374,6 @@ END_FUNC(PKG) /* end H5EA__dblock_unprotect() */ * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 22 2008 * *------------------------------------------------------------------------- @@ -442,7 +436,6 @@ END_FUNC(PKG) /* end H5EA__dblock_delete() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 11 2008 * *------------------------------------------------------------------------- diff --git a/src/H5EAhdr.c b/src/H5EAhdr.c index ec40298..8b4d5f7 100644 --- a/src/H5EAhdr.c +++ b/src/H5EAhdr.c @@ -15,7 +15,7 @@ * * Created: H5EAhdr.c * Aug 26 2008 - * Quincey Koziol + * Quincey Koziol * * Purpose: Array header routines for extensible arrays. * @@ -110,7 +110,6 @@ H5FL_SEQ_DEFINE_STATIC(H5EA_sblk_info_t); * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 26 2008 * *------------------------------------------------------------------------- @@ -180,7 +179,6 @@ END_FUNC(PKG) /* end H5EA__hdr_alloc() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 18 2008 * *------------------------------------------------------------------------- @@ -245,7 +243,6 @@ END_FUNC(PKG) /* end H5EA__hdr_init() */ * Return: Non-NULL pointer to buffer for elements on success/NULL on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 16 2008 * *------------------------------------------------------------------------- @@ -312,7 +309,6 @@ END_FUNC(PKG) /* end H5EA__hdr_alloc_elmts() */ * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 18 2008 * *------------------------------------------------------------------------- @@ -349,7 +345,6 @@ END_FUNC(PKG) /* end H5EA__hdr_free_elmts() */ * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jun 17 2008 * *------------------------------------------------------------------------- @@ -464,7 +459,6 @@ END_FUNC(PKG) /* end H5EA__hdr_create() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 26 2008 * *------------------------------------------------------------------------- @@ -497,7 +491,6 @@ END_FUNC(PKG) /* end H5EA__hdr_incr() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 26 2008 * *------------------------------------------------------------------------- @@ -533,7 +526,6 @@ END_FUNC(PKG) /* end H5EA__hdr_decr() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 26 2008 * *------------------------------------------------------------------------- @@ -559,7 +551,6 @@ END_FUNC(PKG) /* end H5EA__hdr_fuse_incr() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 26 2008 * *------------------------------------------------------------------------- @@ -589,7 +580,6 @@ END_FUNC(PKG) /* end H5EA__hdr_fuse_decr() */ * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 9 2008 * *------------------------------------------------------------------------- @@ -619,7 +609,6 @@ END_FUNC(PKG) /* end H5EA__hdr_modified() */ * Return: Non-NULL pointer to header on success/NULL on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jul 31 2013 * *------------------------------------------------------------------------- @@ -677,7 +666,6 @@ END_FUNC(PKG) /* end H5EA__hdr_protect() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 1 2013 * *------------------------------------------------------------------------- @@ -708,7 +696,6 @@ END_FUNC(PKG) /* end H5EA__hdr_unprotect() */ * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 26 2008 * *------------------------------------------------------------------------- @@ -765,7 +752,6 @@ END_FUNC(PKG) /* end H5EA__hdr_delete() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 11 2008 * *------------------------------------------------------------------------- diff --git a/src/H5EAiblock.c b/src/H5EAiblock.c index 1b5957a..c45d15a 100644 --- a/src/H5EAiblock.c +++ b/src/H5EAiblock.c @@ -15,7 +15,7 @@ * * Created: H5EAiblock.c * Sep 9 2008 - * Quincey Koziol + * Quincey Koziol * * Purpose: Index block routines for extensible arrays. * @@ -42,7 +42,7 @@ #include "H5EApkg.h" /* Extensible Arrays */ #include "H5FLprivate.h" /* Free Lists */ #include "H5MFprivate.h" /* File memory management */ -#include "H5VMprivate.h" /* Vectors and arrays */ +#include "H5VMprivate.h" /* Vectors and arrays */ /****************/ @@ -98,7 +98,6 @@ H5FL_SEQ_DEFINE_STATIC(haddr_t); * Return: Non-NULL pointer to index block on success/NULL on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 9 2008 * *------------------------------------------------------------------------- @@ -129,11 +128,6 @@ H5EA__iblock_alloc(H5EA_hdr_t *hdr)) iblock->nsblks = H5EA_SBLK_FIRST_IDX(hdr->cparam.sup_blk_min_data_ptrs); iblock->ndblk_addrs = 2 * ((size_t)hdr->cparam.sup_blk_min_data_ptrs - 1); iblock->nsblk_addrs = hdr->nsblks - iblock->nsblks; -#ifdef QAK -HDfprintf(stderr, "%s: iblock->nsblks = %u\n", FUNC, iblock->nsblks); -HDfprintf(stderr, "%s: iblock->ndblk_addrs = %Zu\n", FUNC, iblock->ndblk_addrs); -HDfprintf(stderr, "%s: iblock->nsblk_addrs = %Zu\n", FUNC, iblock->nsblk_addrs); -#endif /* QAK */ /* Allocate buffer for elements in index block */ if(hdr->cparam.idx_blk_elmts > 0) @@ -169,7 +163,6 @@ END_FUNC(PKG) /* end H5EA__iblock_alloc() */ * Return: Valid file address on success/HADDR_UNDEF on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 9 2008 * *------------------------------------------------------------------------- @@ -183,10 +176,6 @@ H5EA__iblock_create(H5EA_hdr_t *hdr, hbool_t *stats_changed)) haddr_t iblock_addr; /* Extensible array index block address */ hbool_t inserted = FALSE; /* Whether the header was inserted into cache */ -#ifdef QAK -HDfprintf(stderr, "%s: Called\n", FUNC); -#endif /* QAK */ - /* Sanity check */ HDassert(hdr); HDassert(stats_changed); @@ -197,9 +186,6 @@ HDfprintf(stderr, "%s: Called\n", FUNC); /* Set size of index block on disk */ iblock->size = H5EA_IBLOCK_SIZE(iblock); -#ifdef QAK -HDfprintf(stderr, "%s: iblock->size = %Zu\n", FUNC, iblock->size); -#endif /* QAK */ /* Allocate space for the index block on disk */ if(HADDR_UNDEF == (iblock_addr = H5MF_alloc(hdr->f, H5FD_MEM_EARRAY_IBLOCK, (hsize_t)iblock->size))) @@ -284,7 +270,6 @@ END_FUNC(PKG) /* end H5EA__iblock_create() */ * Return: Non-NULL pointer to index block on success/NULL on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 9 2008 * *------------------------------------------------------------------------- @@ -296,10 +281,6 @@ H5EA__iblock_protect(H5EA_hdr_t *hdr, unsigned flags)) /* Local variables */ H5EA_iblock_t *iblock = NULL; /* Pointer to index block */ -#ifdef QAK -HDfprintf(stderr, "%s: Called\n", FUNC); -#endif /* QAK */ - /* Sanity check */ HDassert(hdr); @@ -340,7 +321,6 @@ END_FUNC(PKG) /* end H5EA__iblock_protect() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 9 2008 * *------------------------------------------------------------------------- @@ -351,10 +331,6 @@ H5EA__iblock_unprotect(H5EA_iblock_t *iblock, unsigned cache_flags)) /* Local variables */ -#ifdef QAK -HDfprintf(stderr, "%s: Called\n", FUNC); -#endif /* QAK */ - /* Sanity check */ HDassert(iblock); @@ -375,7 +351,6 @@ END_FUNC(PKG) /* end H5EA__iblock_unprotect() */ * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 9 2008 * *------------------------------------------------------------------------- @@ -387,10 +362,6 @@ H5EA__iblock_delete(H5EA_hdr_t *hdr)) /* Local variables */ H5EA_iblock_t *iblock = NULL; /* Pointer to index block */ -#ifdef QAK -HDfprintf(stderr, "%s: Called\n", FUNC); -#endif /* QAK */ - /* Sanity check */ HDassert(hdr); HDassert(H5F_addr_defined(hdr->idx_blk_addr)); @@ -459,7 +430,6 @@ END_FUNC(PKG) /* end H5EA__iblock_delete() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 11 2008 * *------------------------------------------------------------------------- diff --git a/src/H5EAint.c b/src/H5EAint.c index 2baf1f4..ef8cd7a 100644 --- a/src/H5EAint.c +++ b/src/H5EAint.c @@ -15,7 +15,7 @@ * * Created: H5EAint.c * Jun 17 2008 - * Quincey Koziol + * Quincey Koziol * * Purpose: Internal routines for extnsible arrays. * @@ -86,7 +86,6 @@ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Mar 26 2009 * *------------------------------------------------------------------------- @@ -116,7 +115,6 @@ END_FUNC(PKG) /* end H5EA__create_flush_depend() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Mar 26 2009 * *------------------------------------------------------------------------- diff --git a/src/H5EAmodule.h b/src/H5EAmodule.h index d3e06b7..c3a4c7c 100644 --- a/src/H5EAmodule.h +++ b/src/H5EAmodule.h @@ -11,7 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, September 12, 2015 * * Purpose: This file contains declarations which define macros for the diff --git a/src/H5EApkg.h b/src/H5EApkg.h index bb3f39c..b70231d 100644 --- a/src/H5EApkg.h +++ b/src/H5EApkg.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, June 17, 2008 * * Purpose: This file contains declarations which are visible only diff --git a/src/H5EAprivate.h b/src/H5EAprivate.h index 1195256..af0ef3a 100644 --- a/src/H5EAprivate.h +++ b/src/H5EAprivate.h @@ -15,7 +15,7 @@ * * Created: H5EAprivate.h * Jun 17 2008 - * Quincey Koziol + * Quincey Koziol * * Purpose: Private header for library accessible extensible * array routines. diff --git a/src/H5EAsblock.c b/src/H5EAsblock.c index b4671f8..b5b9d94 100644 --- a/src/H5EAsblock.c +++ b/src/H5EAsblock.c @@ -15,7 +15,7 @@ * * Created: H5EAsblock.c * Sep 30 2008 - * Quincey Koziol + * Quincey Koziol * * Purpose: Super block routines for extensible arrays. * @@ -42,7 +42,7 @@ #include "H5EApkg.h" /* Extensible Arrays */ #include "H5FLprivate.h" /* Free Lists */ #include "H5MFprivate.h" /* File memory management */ -#include "H5VMprivate.h" /* Vectors and arrays */ +#include "H5VMprivate.h" /* Vectors and arrays */ /****************/ @@ -98,7 +98,6 @@ H5FL_BLK_DEFINE(page_init); * Return: Non-NULL pointer to super block on success/NULL on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 30 2008 * *------------------------------------------------------------------------- @@ -179,7 +178,6 @@ END_FUNC(PKG) /* end H5EA__sblock_alloc() */ * Return: Valid file address on success/HADDR_UNDEF on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 30 2008 * *------------------------------------------------------------------------- @@ -267,7 +265,6 @@ END_FUNC(PKG) /* end H5EA__sblock_create() */ * Return: Non-NULL pointer to data block on success/NULL on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 30 2008 * *------------------------------------------------------------------------- @@ -328,7 +325,6 @@ END_FUNC(PKG) /* end H5EA__sblock_protect() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 30 2008 * *------------------------------------------------------------------------- @@ -359,7 +355,6 @@ END_FUNC(PKG) /* end H5EA__sblock_unprotect() */ * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 30 2008 * *------------------------------------------------------------------------- @@ -408,7 +403,6 @@ END_FUNC(PKG) /* end H5EA__sblock_delete() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 30 2008 * *------------------------------------------------------------------------- diff --git a/src/H5EAstat.c b/src/H5EAstat.c index 509d3f8..68e0b1e 100644 --- a/src/H5EAstat.c +++ b/src/H5EAstat.c @@ -15,7 +15,7 @@ * * Created: H5EAstat.c * Sep 11 2008 - * Quincey Koziol + * Quincey Koziol * * Purpose: Extensible array metadata statistics functions. * @@ -87,7 +87,6 @@ * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 21 2008 * *------------------------------------------------------------------------- @@ -98,10 +97,6 @@ H5EA_get_stats(const H5EA_t *ea, H5EA_stat_t *stats)) /* Local variables */ -#ifdef QAK -HDfprintf(stderr, "%s: Called\n", FUNC); -#endif /* QAK */ - /* * Check arguments. */ diff --git a/src/H5EAtest.c b/src/H5EAtest.c index 8926d6a..a0802bc 100644 --- a/src/H5EAtest.c +++ b/src/H5EAtest.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol +/* Programmer: Quincey Koziol * Thursday, August 28, 2008 * * Purpose: Extensible array testing functions. @@ -38,7 +38,7 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5EApkg.h" /* Extensible Arrays */ #include "H5FLprivate.h" /* Free Lists */ -#include "H5VMprivate.h" /* Vector functions */ +#include "H5VMprivate.h" /* Vector functions */ /****************/ diff --git a/src/H5Edeprec.c b/src/H5Edeprec.c index 4462303..046830f 100644 --- a/src/H5Edeprec.c +++ b/src/H5Edeprec.c @@ -15,7 +15,7 @@ * * Created: H5Edeprec.c * April 11 2007 - * Quincey Koziol + * Quincey Koziol * * Purpose: Deprecated functions from the H5E interface. These * functions are here for compatibility purposes and may be @@ -36,7 +36,6 @@ /* Headers */ /***********/ #include "H5private.h" /* Generic Functions */ -#include "H5CXprivate.h" /* API Contexts */ #include "H5Epkg.h" /* Error handling */ #include "H5Iprivate.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ @@ -198,7 +197,7 @@ done: * same parameter as the old function, in contrary to * H5Epush2. * - * Return: SUCCEED/FAIL + * Return: Non-negative on success/Negative on failure * * Programmer: Raymond Lu * Tuesday, Sep 16, 2003 @@ -230,7 +229,7 @@ done: * Purpose: This function is for backward compatibility. * Clears the error stack for the specified error stack. * - * Return: SUCCEED/FAIL + * Return: Non-negative on success/Negative on failure * * Programmer: Raymond Lu * Wednesday, July 16, 2003 @@ -264,7 +263,7 @@ done: * prints error messages. Users are encouraged to write there * own more specific error handlers. * - * Return: SUCCEED/FAIL + * Return: Non-negative on success/Negative on failure * * Programmer: Raymond Lu * Sep 16, 2003 @@ -300,7 +299,7 @@ done: * Walks the error stack for the current thread and calls some * function for each error along the way. * - * Return: SUCCEED/FAIL + * Return: Non-negative on success/Negative on failure * * Programmer: Raymond Lu * Sep 16, 2003 @@ -341,7 +340,7 @@ done: * Either (or both) arguments may be null in which case the * value is not returned. * - * Return: SUCCEED/FAIL + * Return: Non-negative on success/Negative on failure * * Programmer: Raymond Lu * Sep 16, 2003 @@ -394,7 +393,7 @@ done: * Automatic stack traversal is always in the H5E_WALK_DOWNWARD * direction. * - * Return: SUCCEED/FAIL + * Return: Non-negative on success/Negative on failure * * Programmer: Raymond Lu * Sep 16, 2003 diff --git a/src/H5Eint.c b/src/H5Eint.c index fe72449..cf1d649 100644 --- a/src/H5Eint.c +++ b/src/H5Eint.c @@ -15,7 +15,7 @@ * * Created: H5Eint.c * April 11 2007 - * Quincey Koziol + * Quincey Koziol * * Purpose: General use, "internal" routines for error handling. * @@ -33,7 +33,6 @@ /* Headers */ /***********/ #include "H5private.h" /* Generic Functions */ -#include "H5CXprivate.h" /* API Contexts */ #include "H5Epkg.h" /* Error handling */ #include "H5Iprivate.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ @@ -576,7 +575,7 @@ H5E__walk(const H5E_t *estack, H5E_direction_t direction, const H5E_walk_op_t *o ret_value = (op->u.func2)((unsigned)(estack->nused - (size_t)(i + 1)), estack->slot + i, client_data); } /* end else */ - if(ret_value < 0) + if(ret_value < 0) HERROR(H5E_ERROR, H5E_CANTLIST, "can't walk error stack"); } /* end if */ } /* end else */ diff --git a/src/H5Emodule.h b/src/H5Emodule.h index 2d1bcd0..fbfc262 100644 --- a/src/H5Emodule.h +++ b/src/H5Emodule.h @@ -11,7 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, September 12, 2015 * * Purpose: This file contains declarations which define macros for the diff --git a/src/H5Epkg.h b/src/H5Epkg.h index 83f3816..eac5829 100644 --- a/src/H5Epkg.h +++ b/src/H5Epkg.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Wednesday, April 11, 2007 * * Purpose: This file contains declarations which are visible only within diff --git a/src/H5Eprivate.h b/src/H5Eprivate.h index 19ab729..130a8fd 100644 --- a/src/H5Eprivate.h +++ b/src/H5Eprivate.h @@ -180,7 +180,7 @@ extern int H5E_mpi_error_str_len; /* Library-private functions defined in H5E package */ H5_DLL herr_t H5E_init(void); H5_DLL herr_t H5E_printf_stack(H5E_t *estack, const char *file, const char *func, - unsigned line, hid_t cls_id, hid_t maj_id, hid_t min_id, const char *fmt, ...)H5_ATTR_FORMAT(printf, 8, 9); + unsigned line, hid_t cls_id, hid_t maj_id, hid_t min_id, const char *fmt, ...) H5_ATTR_FORMAT(printf, 8, 9); H5_DLL herr_t H5E_clear_stack(H5E_t *estack); H5_DLL herr_t H5E_dump_api_stack(hbool_t is_api); diff --git a/src/H5F.c b/src/H5F.c index 3dbd292..c6db109 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -73,8 +73,6 @@ typedef struct { /* Local Prototypes */ /********************/ -static herr_t H5F__close_cb(H5VL_object_t *file_vol_obj); - /* Callback for getting object counts in a file */ static int H5F__get_all_count_cb(void H5_ATTR_UNUSED *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, void *key); @@ -86,9 +84,6 @@ static int H5F__get_all_ids_cb(void H5_ATTR_UNUSED *obj_ptr, hid_t obj_id, void /* Package Variables */ /*********************/ -/* Package initialization variable */ -hbool_t H5_PKG_INIT_VAR = FALSE; - /*****************************/ /* Library Private Variables */ @@ -105,150 +100,6 @@ H5FL_EXTERN(H5VL_t); /* Declare a free list to manage the H5VL_object_t struct */ H5FL_EXTERN(H5VL_object_t); -/* File ID class */ -static const H5I_class_t H5I_FILE_CLS[1] = {{ - H5I_FILE, /* ID class value */ - 0, /* Class flags */ - 0, /* # of reserved IDs for class */ - (H5I_free_t)H5F__close_cb /* Callback routine for closing objects of this class */ -}}; - - - -/*------------------------------------------------------------------------- - * Function: H5F_init - * - * Purpose: Initialize the interface from some other layer. - * - * Return: Success: non-negative - * - * Failure: negative - *------------------------------------------------------------------------- - */ -herr_t -H5F_init(void) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - /* FUNC_ENTER() does all the work */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5F_init() */ - - -/*-------------------------------------------------------------------------- -NAME - H5F__init_package -- Initialize interface-specific information -USAGE - herr_t H5F__init_package() -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. - ---------------------------------------------------------------------------*/ -herr_t -H5F__init_package(void) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE - - /* - * Initialize the atom group for the file IDs. - */ - if(H5I_register_type(H5I_FILE_CLS) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to initialize interface") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5F__init_package() */ - - -/*------------------------------------------------------------------------- - * Function: H5F_term_package - * - * Purpose: Terminate this interface: free all memory and reset global - * variables to their initial values. Release all ID groups - * associated with this interface. - * - * Return: Success: Positive if anything was done that might - * have affected other interfaces; - * zero otherwise. - * - * Failure: Never fails - * - *------------------------------------------------------------------------- - */ -int -H5F_term_package(void) -{ - int n = 0; - - FUNC_ENTER_NOAPI_NOINIT_NOERR - - if(H5_PKG_INIT_VAR) { - if(H5I_nmembers(H5I_FILE) > 0) { - (void)H5I_clear_type(H5I_FILE, FALSE, FALSE); - n++; /*H5I*/ - } /* end if */ - else { - /* Make certain we've cleaned up all the shared file objects */ - H5F_sfile_assert_num(0); - - /* Destroy the file object id group */ - n += (H5I_dec_type_ref(H5I_FILE) > 0); - - /* Mark closed */ - if(0 == n) - H5_PKG_INIT_VAR = FALSE; - } /* end else */ - } /* end if */ - - FUNC_LEAVE_NOAPI(n) -} /* end H5F_term_package() */ - - -/*------------------------------------------------------------------------- - * Function: H5F__close_cb - * - * Purpose: Closes a file or causes the close operation to be pended. - * This function is called from the API and gets called - * by H5Fclose->H5I_dec_ref->H5F__close_cb when H5I_dec_ref() - * decrements the file ID reference count to zero. The file ID - * is removed from the H5I_FILE group by H5I_dec_ref() just - * before H5F__close_cb() is called. If there are open object - * headers then the close is pended by moving the file to the - * H5I_FILE_CLOSING ID group (the f->closing contains the ID - * assigned to file). - * - * Return: SUCCEED/FAIL - * - *------------------------------------------------------------------------- - */ -static herr_t -H5F__close_cb(H5VL_object_t *file_vol_obj) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC - - /* Sanity check */ - HDassert(file_vol_obj); - - /* Close the file */ - if(H5VL_file_close(file_vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close file") - - /* Free the VOL object */ - if(H5VL_free_object(file_vol_obj) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "unable to free VOL object") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5F__close_cb() */ /*------------------------------------------------------------------------- @@ -549,8 +400,8 @@ done: * Purpose: Returns a pointer to the file handle of the low-level file * driver. * - * Return: SUCCEED/FAIL - * + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t @@ -637,9 +488,7 @@ done: * the list of file creation and file access properties. * * Return: Success: A file ID - * * Failure: H5I_INVALID_HID - * *------------------------------------------------------------------------- */ hid_t @@ -739,9 +588,7 @@ done: * See Also: H5Fpublic.h for a list of possible values for FLAGS. * * Return: Success: A file ID - * * Failure: H5I_INVALID_HID - * *------------------------------------------------------------------------- */ hid_t @@ -820,7 +667,8 @@ done: * not remove them from the cache. The OBJECT_ID can be a file, * dataset, group, attribute, or named data type. * - * Return: Non-negative on success/Negative on failure + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t @@ -1008,7 +856,8 @@ done: * Purpose: Public API to retrieve the file's 'intent' flags passed * during H5Fopen() * - * Return: Non-negative on success/negative on failure + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t @@ -1079,9 +928,7 @@ done: * Purpose: Retrieves the amount of free space in the file. * * Return: Success: Amount of free space for type - * * Failure: -1 - * *------------------------------------------------------------------------- */ hssize_t @@ -1175,9 +1022,7 @@ done: * this now. * * Return: Success: Bytes copied / number of bytes needed - * * Failure: -1 - * *------------------------------------------------------------------------- */ ssize_t @@ -1212,8 +1057,8 @@ done: * filled in by the caller. This allows us to adapt for * obsolete versions of the structure. * - * Return: SUCCEED/FAIL - * + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t @@ -1249,8 +1094,8 @@ done: * configuration, using the contents of the instance of * H5AC_cache_config_t pointed to by config_ptr. * - * Return: SUCCEED/FAIL - * + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t @@ -1283,8 +1128,8 @@ done: * the hit rate statistics were reset either manually or * automatically. * - * Return: SUCCEED/FAIL - * + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t @@ -1320,8 +1165,8 @@ done: * the ptr parameters are NULL, the associated datum is * not returned. * - * Return: SUCCEED/FAIL - * + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t @@ -1360,8 +1205,8 @@ done: * you are controlling cache size from your program instead * of using our cache size control code. * - * Return: SUCCEED/FAIL - * + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t @@ -1402,9 +1247,7 @@ done: * not the actual name after resolving symlinks, etc. * * Return: Success: The length of the file name - * * Failure: -1 - * *------------------------------------------------------------------------- */ ssize_t @@ -1444,8 +1287,8 @@ done: * in the SOHM table if there is one. * 3. The amount of free space tracked in the file. * - * Return: SUCCEED/FAIL - * + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t @@ -1486,8 +1329,8 @@ done: * Purpose: To retrieve the collection of read retries for metadata * items with checksum. * - * Return: SUCCEED/FAIL - * + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t @@ -1525,9 +1368,7 @@ done: * sections. * * Return: Success: The total # of free space sections - * * Failure: -1 - * *------------------------------------------------------------------------- */ ssize_t @@ -1562,8 +1403,8 @@ done: * provided file, potentially closing any cached files * unless they are held open from somewhere\ else. * - * Return: SUCCEED/FAIL - * + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t @@ -1618,8 +1459,8 @@ done: * set up flush dependency/proxy even for file opened without * SWMR to resolve issues with opened objects. * - * Return: Non-negative on success/negative on failure - * + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t @@ -1654,7 +1495,8 @@ done: * Purpose: Start metadata cache logging operations for a file. * - Logging must have been set up via the fapl. * - * Return: Non-negative on success/Negative on errors + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t @@ -1686,7 +1528,8 @@ done: * - Does not close the log file. * - Logging must have been set up via the fapl. * - * Return: Non-negative on success/Negative on errors + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t @@ -1718,7 +1561,8 @@ done: * set up via the fapl. is_currently_logging determines if * log messages are being recorded at this time. * - * Return: Non-negative on success/Negative on errors + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t @@ -1752,7 +1596,8 @@ done: * H5Fset_latest_format() starting release 1.10.2. * See explanation for H5Fset_latest_format() in H5Fdeprec.c. * - * Return: Non-negative on success/Negative on failure + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t @@ -1788,7 +1633,8 @@ done: * downgrade persistent file space to non-persistent * for 1.8 library. * - * Return: Non-negative on success/Negative on failure + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t @@ -1822,7 +1668,8 @@ done: * * Purpose: Resets statistics for the page buffer layer. * - * Return: Non-negative on success/Negative on failure + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t @@ -1852,7 +1699,8 @@ done: * * Purpose: Retrieves statistics for the page buffer layer. * - * Return: Non-negative on success/Negative on failure + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t @@ -1890,7 +1738,8 @@ done: * image_len: --size of the on disk metadata cache image * --zero if no cache image * - * Return: Non-negative on success/Negative on failure + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t @@ -1918,14 +1767,12 @@ done: /*------------------------------------------------------------------------- * Function: H5Fget_eoa * - * Purpose: Returns the address of the first byte after the last + * Purpose: Gets the address of the first byte after the last * allocated memory in the file. * (See H5FDget_eoa() in H5FD.c) * - * Return: Success: First byte after allocated memory. - * Failure: HADDR_UNDEF - * - * Non-negative on success/Negative on failure + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t @@ -1958,7 +1805,8 @@ done: * * Purpose: Set the EOA for the file to the maximum of (EOA, EOF) + increment * - * Return: Non-negative on success/Negative on errors + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t @@ -1984,24 +1832,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5Fget_dset_no_attrs_hint - * - * Purpose: - * - * Get the file-level setting to create minimized dataset object headers. - * Result is stored at pointer `minimize`. - * - * Return: - * - * Success: SUCCEED (0) (non-negative value) - * Failure: FAIL (-1) (negative value) - * - * Programmer: + * Function: H5Fget_dset_no_attrs_hint * - * Jacob Smith - * 15 August 2018 + * Purpose: Get the file-level setting to create minimized dataset object headers. + * Result is stored at pointer `minimize`. * - * Changes: None. + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t @@ -2029,23 +1866,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5Fset_dset_no_attrs_hint - * - * Purpose: - * - * Set the file-level setting to create minimized dataset object headers. - * - * Return: + * Function: H5Fset_dset_no_attrs_hint * - * Success: SUCCEED (0) (non-negative value) - * Failure: FAIL (-1) (negative value) + * Purpose: Set the file-level setting to create minimized dataset object + * headers. * - * Programmer: - * - * Jacob Smith - * 15 August 2018 - * - * Changes: None. + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t diff --git a/src/H5FA.c b/src/H5FA.c index f8bb094..ee99bb2 100644 --- a/src/H5FA.c +++ b/src/H5FA.c @@ -15,7 +15,7 @@ * * Created: H5FA.c * April 2009 - * Vailin Choi + * Vailin Choi * * Purpose: Implements a Fixed Array for storing elements * of datasets with fixed dimensions. @@ -112,7 +112,6 @@ H5FL_BLK_DEFINE(fa_native_elmt); * NULL on failure * * Programmer: Quincey Koziol - * koziol@lbl.gov * Oct 17 2016 * *------------------------------------------------------------------------- diff --git a/src/H5FAcache.c b/src/H5FAcache.c index 8f5e696..90770fb 100644 --- a/src/H5FAcache.c +++ b/src/H5FAcache.c @@ -15,7 +15,7 @@ * * Created: H5FAcache.c * Jul 2 2009 - * Quincey Koziol + * Quincey Koziol * * Purpose: Implement fixed array metadata cache methods. * @@ -180,7 +180,6 @@ const H5AC_class_t H5AC_FARRAY_DBLK_PAGE[1] = {{ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 31, 2013 * *------------------------------------------------------------------------- @@ -246,7 +245,6 @@ END_FUNC(STATIC) /* end H5FA__cache_hdr_verify_chksum() */ * Failure: NULL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * August 12, 2013 * *------------------------------------------------------------------------- @@ -359,7 +357,6 @@ END_FUNC(STATIC) /* end H5FA__cache_hdr_deserialize() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * August 12, 2013 * *------------------------------------------------------------------------- @@ -389,7 +386,6 @@ END_FUNC(STATIC) /* end H5FA__cache_hdr_image_len() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * August 12, 2013 * *------------------------------------------------------------------------- @@ -527,7 +523,6 @@ END_FUNC(STATIC) /* end H5FA__cache_hdr_notify() */ * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * August 12, 2013 * *------------------------------------------------------------------------- @@ -556,7 +551,6 @@ END_FUNC(STATIC) /* end H5FA__cache_hdr_free_icr() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * August 12, 2013 * *------------------------------------------------------------------------- @@ -644,7 +638,6 @@ END_FUNC(STATIC) /* end H5FA__cache_dblock_verify_chksum() */ * Failure: NULL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * August 14, 2013 * *------------------------------------------------------------------------- @@ -744,7 +737,6 @@ END_FUNC(STATIC) /* end H5FA__cache_dblock_deserialize() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * August 14, 2013 * *------------------------------------------------------------------------- @@ -777,7 +769,6 @@ END_FUNC(STATIC) /* end H5FA__cache_dblock_image_len() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * August 14, 2013 * *------------------------------------------------------------------------- @@ -924,7 +915,6 @@ END_FUNC(STATIC) /* end H5FA__cache_dblock_notify() */ * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * August 14, 2013 * *------------------------------------------------------------------------- @@ -1001,7 +991,6 @@ END_FUNC(STATIC) /* end H5FA__cache_dblock_fsf_size() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * August 14, 2013 * *------------------------------------------------------------------------- @@ -1068,7 +1057,6 @@ END_FUNC(STATIC) /* end H5FA__cache_dblk_page_verify_chksum() */ * Failure: NULL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * August 14, 2013 * *------------------------------------------------------------------------- @@ -1141,7 +1129,6 @@ END_FUNC(STATIC) /* end H5FA__cache_dblk_page_deserialize() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * August 14, 2013 * *------------------------------------------------------------------------- @@ -1171,7 +1158,6 @@ END_FUNC(STATIC) /* end H5FA__cache_dblk_page_image_len() */ * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * August 14, 2013 * *------------------------------------------------------------------------- @@ -1223,7 +1209,6 @@ END_FUNC(STATIC) /* end H5FA__cache_dblk_page_serialize() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@lbl.gov * Oct 17 2016 * *------------------------------------------------------------------------- @@ -1286,7 +1271,6 @@ END_FUNC(STATIC) /* end H5FA__cache_dblk_page_notify() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * August 14, 2013 * *------------------------------------------------------------------------- diff --git a/src/H5FAhdr.c b/src/H5FAhdr.c index 506c767..b25d50b 100644 --- a/src/H5FAhdr.c +++ b/src/H5FAhdr.c @@ -414,7 +414,6 @@ END_FUNC(PKG) /* end H5FA__hdr_modified() */ * Return: Non-NULL pointer to header on success/NULL on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 12 2013 * *------------------------------------------------------------------------- @@ -471,7 +470,6 @@ END_FUNC(PKG) /* end H5FA__hdr_protect() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 12 2013 * *------------------------------------------------------------------------- @@ -491,7 +489,7 @@ H5FA__hdr_unprotect(H5FA_hdr_t *hdr, unsigned cache_flags)) CATCH -END_FUNC(PKG) /* end H5EA__hdr_unprotect() */ +END_FUNC(PKG) /* end H5FA__hdr_unprotect() */ /*------------------------------------------------------------------------- diff --git a/src/H5FAint.c b/src/H5FAint.c index 9d3bce8..3a1375a 100644 --- a/src/H5FAint.c +++ b/src/H5FAint.c @@ -15,7 +15,7 @@ * * Created: H5FAint.c * Fall 2012 - * Dana Robinson + * Dana Robinson * * Purpose: Internal routines for fixed arrays. * diff --git a/src/H5FAmodule.h b/src/H5FAmodule.h index f675faf..57a85b1 100644 --- a/src/H5FAmodule.h +++ b/src/H5FAmodule.h @@ -11,7 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, September 12, 2015 * * Purpose: This file contains declarations which define macros for the diff --git a/src/H5FAstat.c b/src/H5FAstat.c index 49a56a9..882da99 100644 --- a/src/H5FAstat.c +++ b/src/H5FAstat.c @@ -35,9 +35,9 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FApkg.h" /* Fixed Arrays */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FApkg.h" /* Fixed Arrays */ #include "H5MMprivate.h" /* Memory management */ diff --git a/src/H5FAtest.c b/src/H5FAtest.c index e55d408..2bcdc01 100644 --- a/src/H5FAtest.c +++ b/src/H5FAtest.c @@ -36,7 +36,7 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5FApkg.h" /* Fixed Arrays */ #include "H5FLprivate.h" /* Free Lists */ -#include "H5VMprivate.h" /* Vector functions */ +#include "H5VMprivate.h" /* Vector functions */ /****************/ diff --git a/src/H5FD.c b/src/H5FD.c index 39d30a0..e02535d 100644 --- a/src/H5FD.c +++ b/src/H5FD.c @@ -1436,7 +1436,7 @@ done: * constant H5P_DEFAULT). The bytes to be written come from the * buffer BUF. * - * Return: SNon-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * *------------------------------------------------------------------------- */ @@ -1793,7 +1793,7 @@ H5FDlock(H5FD_t *file, hbool_t rw) /* Call private function */ if(H5FD_lock(file, rw) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "file lock request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTLOCKFILE, FAIL, "file lock request failed") done: FUNC_LEAVE_API(ret_value) @@ -1823,7 +1823,7 @@ H5FD_lock(H5FD_t *file, hbool_t rw) /* Dispatch to driver */ if(file->cls->lock && (file->cls->lock)(file, rw) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTUPDATE, FAIL, "driver lock request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTLOCKFILE, FAIL, "driver lock request failed") done: FUNC_LEAVE_NOAPI(ret_value) @@ -1855,7 +1855,7 @@ H5FDunlock(H5FD_t *file) /* Call private function */ if(H5FD_unlock(file) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "file unlock request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTUNLOCKFILE, FAIL, "file unlock request failed") done: FUNC_LEAVE_API(ret_value) @@ -1884,7 +1884,7 @@ H5FD_unlock(H5FD_t *file) /* Dispatch to driver */ if(file->cls->unlock && (file->cls->unlock)(file) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTUPDATE, FAIL, "driver unlock request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTUNLOCKFILE, FAIL, "driver unlock request failed") done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5FDcore.c b/src/H5FDcore.c index 4e581bf..5a37d29 100644 --- a/src/H5FDcore.c +++ b/src/H5FDcore.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, August 10, 1999 * * Purpose: A driver which stores the HDF5 data in main memory using @@ -36,6 +36,9 @@ /* The driver identification number, initialized at runtime */ static hid_t H5FD_CORE_g = 0; +/* Whether to ignore file locks when disabled (env var value) */ +static htri_t ignore_disabled_file_locks_s = FAIL; + /* The skip list node type. Represents a region in the file. */ typedef struct H5FD_core_region_t { haddr_t start; /* Start address of the region */ @@ -56,6 +59,7 @@ typedef struct H5FD_core_t { hbool_t backing_store; /* write to file name on flush */ hbool_t write_tracking; /* Whether to track writes */ size_t bstore_page_size; /* backing store page size */ + hbool_t ignore_disabled_file_locks; int fd; /* backing store file descriptor */ /* Information for determining uniqueness of a file with a backing store */ #ifndef H5_HAVE_WIN32_API @@ -144,8 +148,8 @@ static herr_t H5FD__core_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, ha size_t size, const void *buf); static herr_t H5FD__core_flush(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); static herr_t H5FD__core_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); -static herr_t H5FD_core_lock(H5FD_t *_file, hbool_t rw); -static herr_t H5FD_core_unlock(H5FD_t *_file); +static herr_t H5FD__core_lock(H5FD_t *_file, hbool_t rw); +static herr_t H5FD__core_unlock(H5FD_t *_file); static const H5FD_class_t H5FD_core_g = { "core", /* name */ @@ -179,8 +183,8 @@ static const H5FD_class_t H5FD_core_g = { NULL, /* write_vector */ H5FD__core_flush, /* flush */ H5FD__core_truncate, /* truncate */ - H5FD_core_lock, /* lock */ - H5FD_core_unlock, /* unlock */ + H5FD__core_lock, /* lock */ + H5FD__core_unlock, /* unlock */ H5FD_FLMAP_DICHOTOMY /* fl_map */ }; @@ -347,7 +351,7 @@ H5FD__core_write_to_bstore(H5FD_core_t *file, haddr_t addr, size_t size) HDoff_t offset = (HDoff_t)addr; /* Offset to write at */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(file); @@ -414,9 +418,19 @@ done: static herr_t H5FD__init_package(void) { + char *lock_env_var = NULL; /* Environment variable pointer */ herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC + + /* Check the use disabled file locks environment variable */ + lock_env_var = HDgetenv("HDF5_USE_FILE_LOCKING"); + if(lock_env_var && !HDstrcmp(lock_env_var, "BEST_EFFORT")) + ignore_disabled_file_locks_s = TRUE; /* Override: Ignore disabled locks */ + else if(lock_env_var && (!HDstrcmp(lock_env_var, "TRUE") || !HDstrcmp(lock_env_var, "1"))) + ignore_disabled_file_locks_s = FALSE; /* Override: Don't ignore disabled locks */ + else + ignore_disabled_file_locks_s = FAIL; /* Environment variable not set, or not set correctly */ if(H5FD_core_init() < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to initialize core VFD") @@ -800,6 +814,16 @@ H5FD__core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr /* Save file image callbacks */ file->fi_callbacks = file_image_info.callbacks; + /* Check the file locking flags in the fapl */ + if(ignore_disabled_file_locks_s != FAIL) + /* The environment variable was set, so use that preferentially */ + file->ignore_disabled_file_locks = ignore_disabled_file_locks_s; + else { + /* Use the value in the property list */ + if(H5P_get(plist, H5F_ACS_IGNORE_DISABLED_FILE_LOCKS_NAME, &file->ignore_disabled_file_locks) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get ignore disabled file locks property") + } + if(fd >= 0) { /* Retrieve information for determining uniqueness of file */ #ifdef H5_HAVE_WIN32_API @@ -1583,7 +1607,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_core_lock + * Function: H5FD__core_lock * * Purpose: To place an advisory lock on a file. * The lock type to apply depends on the parameter "rw": @@ -1597,13 +1621,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_core_lock(H5FD_t *_file, hbool_t rw) +H5FD__core_lock(H5FD_t *_file, hbool_t rw) { H5FD_core_t *file = (H5FD_core_t*)_file; /* VFD file struct */ int lock_flags; /* file locking flags */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(file); @@ -1611,27 +1635,29 @@ H5FD_core_lock(H5FD_t *_file, hbool_t rw) * descriptor, this is a no-op. */ if(file->fd >= 0) { - /* Set exclusive or shared lock based on rw status */ lock_flags = rw ? LOCK_EX : LOCK_SH; /* Place a non-blocking lock on the file */ if(HDflock(file->fd, lock_flags | LOCK_NB) < 0) { - if(ENOSYS == errno) - HSYS_GOTO_ERROR(H5E_FILE, H5E_BADFILE, FAIL, "file locking disabled on this file system (use HDF5_USE_FILE_LOCKING environment variable to override)") + if(file->ignore_disabled_file_locks && ENOSYS == errno) { + /* When errno is set to ENOSYS, the file system does not support + * locking, so ignore it. + */ + errno = 0; + } else HSYS_GOTO_ERROR(H5E_FILE, H5E_BADFILE, FAIL, "unable to lock file") } /* end if */ - } /* end if */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_core_lock() */ +} /* end H5FD__core_lock() */ /*------------------------------------------------------------------------- - * Function: H5FD_core_unlock + * Function: H5FD__core_unlock * * Purpose: To remove the existing lock on the file * @@ -1642,27 +1668,28 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_core_unlock(H5FD_t *_file) +H5FD__core_unlock(H5FD_t *_file) { H5FD_core_t *file = (H5FD_core_t*)_file; /* VFD file struct */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(file); - if(file->fd >= 0) { - + if(file->fd >= 0) if(HDflock(file->fd, LOCK_UN) < 0) { - if(ENOSYS == errno) - HSYS_GOTO_ERROR(H5E_FILE, H5E_BADFILE, FAIL, "file locking disabled on this file system (use HDF5_USE_FILE_LOCKING environment variable to override)") + if(file->ignore_disabled_file_locks && ENOSYS == errno) { + /* When errno is set to ENOSYS, the file system does not support + * locking, so ignore it. + */ + errno = 0; + } else HSYS_GOTO_ERROR(H5E_FILE, H5E_BADFILE, FAIL, "unable to unlock file") - } /* end if */ - - } /* end if */ + } done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_core_unlock() */ +} /* end H5FD__core_unlock() */ diff --git a/src/H5FDcore.h b/src/H5FDcore.h index 5fe2912..63b6f27 100644 --- a/src/H5FDcore.h +++ b/src/H5FDcore.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, August 2, 1999 * * Purpose: The public header file for the core driver. diff --git a/src/H5FDdirect.c b/src/H5FDdirect.c index 3b82cce..fbc30b2 100644 --- a/src/H5FDdirect.c +++ b/src/H5FDdirect.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Wednesday, 20 September 2006 * * Purpose: The Direct I/O file driver forces the data to be written to @@ -23,21 +23,24 @@ #include "H5FDdrvr_module.h" /* This source code file is part of the H5FD driver module */ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fprivate.h" /* File access */ -#include "H5FDprivate.h" /* File drivers */ -#include "H5FDdirect.h" /* Direct file driver */ -#include "H5FLprivate.h" /* Free Lists */ -#include "H5Iprivate.h" /* IDs */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Pprivate.h" /* Property lists */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* File access */ +#include "H5FDprivate.h" /* File drivers */ +#include "H5FDdirect.h" /* Direct file driver */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Pprivate.h" /* Property lists */ #ifdef H5_HAVE_DIRECT /* The driver identification number, initialized at runtime */ static hid_t H5FD_DIRECT_g = 0; +/* Whether to ignore file locks when disabled (env var value) */ +static htri_t ignore_disabled_file_locks_s = FAIL; + /* File operations */ #define OP_UNKNOWN 0 #define OP_READ 1 @@ -71,6 +74,7 @@ typedef struct H5FD_direct_t { haddr_t pos; /*current file I/O position */ int op; /*last operation */ H5FD_direct_fapl_t fa; /*file access properties */ + hbool_t ignore_disabled_file_locks; #ifndef H5_HAVE_WIN32_API /* * On most systems the combination of device and i-node number uniquely @@ -109,71 +113,70 @@ typedef struct H5FD_direct_t { * which can be addressed entirely by the second * argument of the file seek function. */ -#define MAXADDR (((haddr_t)1<<(8*sizeof(HDoff_t)-1))-1) -#define ADDR_OVERFLOW(A) (HADDR_UNDEF==(A) || \ - ((A) & ~(haddr_t)MAXADDR)) +#define MAXADDR (((haddr_t)1 << (8 * sizeof(HDoff_t) - 1)) - 1) +#define ADDR_OVERFLOW(A) (HADDR_UNDEF == (A) || ((A) & ~(haddr_t)MAXADDR)) #define SIZE_OVERFLOW(Z) ((Z) & ~(hsize_t)MAXADDR) -#define REGION_OVERFLOW(A,Z) (ADDR_OVERFLOW(A) || SIZE_OVERFLOW(Z) || \ - HADDR_UNDEF==(A)+(Z) || \ - (HDoff_t)((A)+(Z))<(HDoff_t)(A)) +#define REGION_OVERFLOW(A,Z) (ADDR_OVERFLOW(A) || SIZE_OVERFLOW(Z) || \ + HADDR_UNDEF == (A) + (Z) || \ + (HDoff_t)((A) + (Z)) < (HDoff_t)(A)) /* Prototypes */ -static herr_t H5FD_direct_term(void); -static void *H5FD_direct_fapl_get(H5FD_t *file); -static void *H5FD_direct_fapl_copy(const void *_old_fa); -static H5FD_t *H5FD_direct_open(const char *name, unsigned flags, hid_t fapl_id, +static herr_t H5FD__direct_term(void); +static void *H5FD__direct_fapl_get(H5FD_t *file); +static void *H5FD__direct_fapl_copy(const void *_old_fa); +static H5FD_t *H5FD__direct_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr); -static herr_t H5FD_direct_close(H5FD_t *_file); -static int H5FD_direct_cmp(const H5FD_t *_f1, const H5FD_t *_f2); -static herr_t H5FD_direct_query(const H5FD_t *_f1, unsigned long *flags); -static haddr_t H5FD_direct_get_eoa(const H5FD_t *_file, H5FD_mem_t type); -static herr_t H5FD_direct_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr); -static haddr_t H5FD_direct_get_eof(const H5FD_t *_file, H5FD_mem_t type); -static herr_t H5FD_direct_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle); -static herr_t H5FD_direct_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, +static herr_t H5FD__direct_close(H5FD_t *_file); +static int H5FD__direct_cmp(const H5FD_t *_f1, const H5FD_t *_f2); +static herr_t H5FD__direct_query(const H5FD_t *_f1, unsigned long *flags); +static haddr_t H5FD__direct_get_eoa(const H5FD_t *_file, H5FD_mem_t type); +static herr_t H5FD__direct_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr); +static haddr_t H5FD__direct_get_eof(const H5FD_t *_file, H5FD_mem_t type); +static herr_t H5FD__direct_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle); +static herr_t H5FD__direct_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, void *buf); -static herr_t H5FD_direct_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, +static herr_t H5FD__direct_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, const void *buf); -static herr_t H5FD_direct_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); -static herr_t H5FD_direct_lock(H5FD_t *_file, hbool_t rw); -static herr_t H5FD_direct_unlock(H5FD_t *_file); +static herr_t H5FD__direct_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); +static herr_t H5FD__direct_lock(H5FD_t *_file, hbool_t rw); +static herr_t H5FD__direct_unlock(H5FD_t *_file); static const H5FD_class_t H5FD_direct_g = { - "direct", /*name */ - MAXADDR, /*maxaddr */ - H5F_CLOSE_WEAK, /* fc_degree */ - H5FD_direct_term, /*terminate */ - NULL, /*sb_size */ - NULL, /*sb_encode */ - NULL, /*sb_decode */ - sizeof(H5FD_direct_fapl_t), /*fapl_size */ - H5FD_direct_fapl_get, /*fapl_get */ - H5FD_direct_fapl_copy, /*fapl_copy */ - NULL, /*fapl_free */ - 0, /*dxpl_size */ - NULL, /*dxpl_copy */ - NULL, /*dxpl_free */ - H5FD_direct_open, /*open */ - H5FD_direct_close, /*close */ - H5FD_direct_cmp, /*cmp */ - H5FD_direct_query, /*query */ - NULL, /*get_type_map */ - NULL, /*alloc */ - NULL, /*free */ - H5FD_direct_get_eoa, /*get_eoa */ - H5FD_direct_set_eoa, /*set_eoa */ - H5FD_direct_get_eof, /*get_eof */ - H5FD_direct_get_handle, /*get_handle */ - H5FD_direct_read, /*read */ - H5FD_direct_write, /*write */ + "direct", /* name */ + MAXADDR, /* maxaddr */ + H5F_CLOSE_WEAK, /* fc_degree */ + H5FD__direct_term, /* terminate */ + NULL, /* sb_size */ + NULL, /* sb_encode */ + NULL, /* sb_decode */ + sizeof(H5FD_direct_fapl_t), /* fapl_size */ + H5FD__direct_fapl_get, /* fapl_get */ + H5FD__direct_fapl_copy, /* fapl_copy */ + NULL, /* fapl_free */ + 0, /* dxpl_size */ + NULL, /* dxpl_copy */ + NULL, /* dxpl_free */ + H5FD__direct_open, /* open */ + H5FD__direct_close, /* close */ + H5FD__direct_cmp, /* cmp */ + H5FD__direct_query, /* query */ + NULL, /* get_type_map */ + NULL, /* alloc */ + NULL, /* free */ + H5FD__direct_get_eoa, /* get_eoa */ + H5FD__direct_set_eoa, /* set_eoa */ + H5FD__direct_get_eof, /* get_eof */ + H5FD__direct_get_handle, /* get_handle */ + H5FD__direct_read, /* read */ + H5FD__direct_write, /* write */ NULL, /* read_vector */ NULL, /* write_vector */ - NULL, /*flush */ - H5FD_direct_truncate, /*truncate */ - H5FD_direct_lock, /*lock */ - H5FD_direct_unlock, /*unlock */ - H5FD_FLMAP_DICHOTOMY /*fl_map */ + NULL, /* flush */ + H5FD__direct_truncate, /* truncate */ + H5FD__direct_lock, /* lock */ + H5FD__direct_unlock, /* unlock */ + H5FD_FLMAP_DICHOTOMY /* fl_map */ }; /* Declare a free list to manage the H5FD_direct_t struct */ @@ -195,10 +198,20 @@ DESCRIPTION static herr_t H5FD__init_package(void) { + char *lock_env_var = NULL; /* Environment variable pointer */ herr_t ret_value = SUCCEED; FUNC_ENTER_STATIC + /* Check the use disabled file locks environment variable */ + lock_env_var = HDgetenv("HDF5_USE_FILE_LOCKING"); + if(lock_env_var && !HDstrcmp(lock_env_var, "BEST_EFFORT")) + ignore_disabled_file_locks_s = TRUE; /* Override: Ignore disabled locks */ + else if(lock_env_var && (!HDstrcmp(lock_env_var, "TRUE") || !HDstrcmp(lock_env_var, "1"))) + ignore_disabled_file_locks_s = FALSE; /* Override: Don't ignore disabled locks */ + else + ignore_disabled_file_locks_s = FAIL; /* Environment variable not set, or not set correctly */ + if(H5FD_direct_init() < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to initialize direct VFD") @@ -240,7 +253,7 @@ done: /*--------------------------------------------------------------------------- - * Function: H5FD_direct_term + * Function: H5FD__direct_term * * Purpose: Shut down the VFD * @@ -252,15 +265,15 @@ done: *--------------------------------------------------------------------------- */ static herr_t -H5FD_direct_term(void) +H5FD__direct_term(void) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Reset VFL ID */ H5FD_DIRECT_g=0; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5FD_direct_term() */ +} /* end H5FD__direct_term() */ /*------------------------------------------------------------------------- @@ -363,7 +376,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_direct_fapl_get + * Function: H5FD__direct_fapl_get * * Purpose: Returns a file access property list which indicates how the * specified file is being accessed. The return list could be @@ -377,28 +390,26 @@ done: * Programmer: Raymond Lu * Wednesday, 18 October 2006 * - * Modifications: - * *------------------------------------------------------------------------- */ static void * -H5FD_direct_fapl_get(H5FD_t *_file) +H5FD__direct_fapl_get(H5FD_t *_file) { H5FD_direct_t *file = (H5FD_direct_t*)_file; void *ret_value; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Set return value */ - ret_value= H5FD_direct_fapl_copy(&(file->fa)); + ret_value= H5FD__direct_fapl_copy(&(file->fa)); done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_direct_fapl_get() */ +} /* end H5FD__direct_fapl_get() */ /*------------------------------------------------------------------------- - * Function: H5FD_direct_fapl_copy + * Function: H5FD__direct_fapl_copy * * Purpose: Copies the direct-specific file access properties. * @@ -409,17 +420,15 @@ done: * Programmer: Raymond Lu * Wednesday, 18 October 2006 * - * Modifications: - * *------------------------------------------------------------------------- */ static void * -H5FD_direct_fapl_copy(const void *_old_fa) +H5FD__direct_fapl_copy(const void *_old_fa) { const H5FD_direct_fapl_t *old_fa = (const H5FD_direct_fapl_t*)_old_fa; H5FD_direct_fapl_t *new_fa = H5MM_calloc(sizeof(H5FD_direct_fapl_t)); - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(new_fa); @@ -427,11 +436,11 @@ H5FD_direct_fapl_copy(const void *_old_fa) H5MM_memcpy(new_fa, old_fa, sizeof(H5FD_direct_fapl_t)); FUNC_LEAVE_NOAPI(new_fa) -} /* end H5FD_direct_fapl_copy() */ +} /* end H5FD__direct_fapl_copy() */ /*------------------------------------------------------------------------- - * Function: H5FD_direct_open + * Function: H5FD__direct_open * * Purpose: Create and/or opens a Unix file for direct I/O as an HDF5 file. * @@ -444,12 +453,10 @@ H5FD_direct_fapl_copy(const void *_old_fa) * Programmer: Raymond Lu * Wednesday, 20 September 2006 * - * Modifications: - * *------------------------------------------------------------------------- */ static H5FD_t * -H5FD_direct_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) +H5FD__direct_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) { int o_flags; int fd=(-1); @@ -464,7 +471,7 @@ H5FD_direct_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxadd void *buf1, *buf2; H5FD_t *ret_value = NULL; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity check on file offsets */ HDassert(sizeof(HDoff_t)>=sizeof(size_t)); @@ -520,6 +527,16 @@ H5FD_direct_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxadd file->fa.fbsize = fa->fbsize; file->fa.cbsize = fa->cbsize; + /* Check the file locking flags in the fapl */ + if(ignore_disabled_file_locks_s != FAIL) + /* The environment variable was set, so use that preferentially */ + file->ignore_disabled_file_locks = ignore_disabled_file_locks_s; + else { + /* Use the value in the property list */ + if(H5P_get(plist, H5F_ACS_IGNORE_DISABLED_FILE_LOCKS_NAME, &file->ignore_disabled_file_locks) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get ignore disabled file locks property") + } + /* Try to decide if data alignment is required. The reason to check it here * is to handle correctly the case that the file is in a different file system * than the one where the program is running. @@ -579,7 +596,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_direct_close + * Function: H5FD__direct_close * * Purpose: Closes the file. * @@ -590,17 +607,15 @@ done: * Programmer: Raymond Lu * Wednesday, 20 September 2006 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5FD_direct_close(H5FD_t *_file) +H5FD__direct_close(H5FD_t *_file) { H5FD_direct_t *file = (H5FD_direct_t*)_file; herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if (HDclose(file->fd)<0) HSYS_GOTO_ERROR(H5E_IO, H5E_CANTCLOSEFILE, FAIL, "unable to close file") @@ -613,7 +628,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_direct_cmp + * Function: H5FD__direct_cmp * * Purpose: Compares two files belonging to this driver using an * arbitrary (but consistent) ordering. @@ -626,18 +641,16 @@ done: * Programmer: Raymond Lu * Thursday, 21 September 2006 * - * Modifications: - * *------------------------------------------------------------------------- */ static int -H5FD_direct_cmp(const H5FD_t *_f1, const H5FD_t *_f2) +H5FD__direct_cmp(const H5FD_t *_f1, const H5FD_t *_f2) { const H5FD_direct_t *f1 = (const H5FD_direct_t*)_f1; const H5FD_direct_t *f2 = (const H5FD_direct_t*)_f2; int ret_value=0; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR #ifdef H5_HAVE_WIN32_API if (f1->fileindexhi < f2->fileindexhi) HGOTO_DONE(-1) @@ -670,7 +683,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_direct_query + * Function: H5FD__direct_query * * Purpose: Set the flags that this VFL driver is capable of supporting. * (listed in H5FDpublic.h) @@ -682,14 +695,12 @@ done: * Programmer: Raymond Lu * Thursday, 21 September 2006 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5FD_direct_query(const H5FD_t H5_ATTR_UNUSED * _f, unsigned long *flags /* out */) +H5FD__direct_query(const H5FD_t H5_ATTR_UNUSED * _f, unsigned long *flags /* out */) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Set the VFL feature flags that this driver supports */ if(flags) { @@ -706,7 +717,7 @@ H5FD_direct_query(const H5FD_t H5_ATTR_UNUSED * _f, unsigned long *flags /* out /*------------------------------------------------------------------------- - * Function: H5FD_direct_get_eoa + * Function: H5FD__direct_get_eoa * * Purpose: Gets the end-of-address marker for the file. The EOA marker * is the first address past the last byte allocated in the @@ -719,26 +730,21 @@ H5FD_direct_query(const H5FD_t H5_ATTR_UNUSED * _f, unsigned long *flags /* out * Programmer: Raymond Lu * Wednesday, 20 September 2006 * - * Modifications: - * Raymond Lu - * 21 Dec. 2006 - * Added the parameter TYPE. It's only used for MULTI driver. - * *------------------------------------------------------------------------- */ static haddr_t -H5FD_direct_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) +H5FD__direct_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) { const H5FD_direct_t *file = (const H5FD_direct_t*)_file; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR FUNC_LEAVE_NOAPI(file->eoa) } /*------------------------------------------------------------------------- - * Function: H5FD_direct_set_eoa + * Function: H5FD__direct_set_eoa * * Purpose: Set the end-of-address marker for the file. This function is * called shortly after an existing HDF5 file is opened in order @@ -751,19 +757,14 @@ H5FD_direct_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) * Programmer: Raymond Lu * Wednesday, 20 September 2006 * - * Modifications: - * Raymond Lu - * 21 Dec. 2006 - * Added the parameter TYPE. It's only used for MULTI driver. - * *------------------------------------------------------------------------- */ static herr_t -H5FD_direct_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr) +H5FD__direct_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr) { H5FD_direct_t *file = (H5FD_direct_t*)_file; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR file->eoa = addr; @@ -772,7 +773,7 @@ H5FD_direct_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr) /*------------------------------------------------------------------------- - * Function: H5FD_direct_get_eof + * Function: H5FD__direct_get_eof * * Purpose: Returns the end-of-file marker, which is the greater of * either the Unix end-of-file or the HDF5 end-of-address @@ -787,16 +788,14 @@ H5FD_direct_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr) * Programmer: Raymond Lu * Wednesday, 20 September 2006 * - * Modifications: - * *------------------------------------------------------------------------- */ static haddr_t -H5FD_direct_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) +H5FD__direct_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) { const H5FD_direct_t *file = (const H5FD_direct_t*)_file; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC FUNC_LEAVE_NOAPI(file->eof) } @@ -812,17 +811,15 @@ H5FD_direct_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) * Programmer: Raymond Lu * 21 September 2006 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5FD_direct_get_handle(H5FD_t *_file, hid_t H5_ATTR_UNUSED fapl, void** file_handle) +H5FD__direct_get_handle(H5FD_t *_file, hid_t H5_ATTR_UNUSED fapl, void** file_handle) { H5FD_direct_t *file = (H5FD_direct_t *)_file; herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(!file_handle) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file handle not valid") @@ -834,7 +831,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_direct_read + * Function: H5FD__direct_read * * Purpose: Reads SIZE bytes of data from FILE beginning at address ADDR * into buffer BUF according to data transfer properties in @@ -848,12 +845,10 @@ done: * Programmer: Raymond Lu * Thursday, 21 September 2006 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5FD_direct_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t addr, +H5FD__direct_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t addr, size_t size, void *buf/*out*/) { H5FD_direct_t *file = (H5FD_direct_t*)_file; @@ -869,7 +864,7 @@ H5FD_direct_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UN size_t copy_size = size; /* Size remaining to read when using copy buffer */ size_t copy_offset; /* Offset into copy buffer of the requested data */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(file && file->pub.cls); HDassert(buf); @@ -1020,7 +1015,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_direct_write + * Function: H5FD__direct_write * * Purpose: Writes SIZE bytes of data to FILE beginning at address ADDR * from buffer BUF according to data transfer properties in @@ -1033,12 +1028,10 @@ done: * Programmer: Raymond Lu * Thursday, 21 September 2006 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5FD_direct_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t addr, +H5FD__direct_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t addr, size_t size, const void *buf) { H5FD_direct_t *file = (H5FD_direct_t*)_file; @@ -1057,7 +1050,7 @@ H5FD_direct_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_U size_t copy_size = size; /* Size remaining to write when using copy buffer */ size_t copy_offset; /* Offset into copy buffer of the data to write */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(file && file->pub.cls); HDassert(buf); @@ -1255,7 +1248,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_direct_truncate + * Function: H5FD__direct_truncate * * Purpose: Makes sure that the true file size is the same (or larger) * than the end-of-address. @@ -1270,12 +1263,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_direct_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_UNUSED closing) +H5FD__direct_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_UNUSED closing) { H5FD_direct_t *file = (H5FD_direct_t*)_file; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(file); @@ -1316,11 +1309,11 @@ H5FD_direct_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATT done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_direct_truncate() */ +} /* end H5FD__direct_truncate() */ /*------------------------------------------------------------------------- - * Function: H5FD_direct_lock + * Function: H5FD__direct_lock * * Purpose: To place an advisory lock on a file. * The lock type to apply depends on the parameter "rw": @@ -1334,27 +1327,38 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_direct_lock(H5FD_t *_file, hbool_t rw) +H5FD__direct_lock(H5FD_t *_file, hbool_t rw) { - H5FD_direct_t *file = (H5FD_direct_t*)_file; /* VFD file struct */ - const int lock = rw ? LOCK_EX : LOCK_SH; - herr_t ret_value = SUCCEED; /* Return value */ + H5FD_direct_t *file = (H5FD_direct_t*)_file; /* VFD file struct */ + int lock_flags; /* file locking flags */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(file); - /* Place the lock with non-blocking */ - if(HDflock(file->fd, lock | LOCK_NB) < 0) - HSYS_GOTO_ERROR(H5E_FILE, H5E_BADFILE, FAIL, "unable to flock file") + /* Set exclusive or shared lock based on rw status */ + lock_flags = rw ? LOCK_EX : LOCK_SH; + + /* Place a non-blocking lock on the file */ + if(HDflock(file->fd, lock_flags | LOCK_NB) < 0) { + if(file->ignore_disabled_file_locks && ENOSYS == errno) { + /* When errno is set to ENOSYS, the file system does not support + * locking, so ignore it. + */ + errno = 0; + } + else + HSYS_GOTO_ERROR(H5E_VFL, H5E_CANTLOCKFILE, FAIL, "unable to lock file") + } done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_direct_lock() */ +} /* end H5FD__direct_lock() */ /*------------------------------------------------------------------------- - * Function: H5FD_direct_unlock + * Function: H5FD__direct_unlock * * Purpose: To remove the existing lock on the file * @@ -1365,21 +1369,29 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_direct_unlock(H5FD_t *_file) +H5FD__direct_unlock(H5FD_t *_file) { H5FD_direct_t *file = (H5FD_direct_t*)_file; /* VFD file struct */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(file); - if(HDflock(file->fd, LOCK_UN) < 0) - HSYS_GOTO_ERROR(H5E_FILE, H5E_BADFILE, FAIL, "unable to flock (unlock) file") + if(HDflock(file->fd, LOCK_UN) < 0) { + if(file->ignore_disabled_file_locks && ENOSYS == errno) { + /* When errno is set to ENOSYS, the file system does not support + * locking, so ignore it. + */ + errno = 0; + } + else + HSYS_GOTO_ERROR(H5E_VFL, H5E_CANTUNLOCKFILE, FAIL, "unable to unlock file") + } done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_direct_unlock() */ +} /* end H5FD__direct_unlock() */ #endif /* H5_HAVE_DIRECT */ diff --git a/src/H5FDdirect.h b/src/H5FDdirect.h index 805f3be..630a1e6 100644 --- a/src/H5FDdirect.h +++ b/src/H5FDdirect.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Wednesday, 20 September 2006 * * Purpose: The public header file for the direct driver. diff --git a/src/H5FDdrvr_module.h b/src/H5FDdrvr_module.h index 59a419e..34beb32 100644 --- a/src/H5FDdrvr_module.h +++ b/src/H5FDdrvr_module.h @@ -11,7 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, September 12, 2015 * * Purpose: This file contains declarations which define macros for the diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c index 683f706..2537d86 100644 --- a/src/H5FDfamily.c +++ b/src/H5FDfamily.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, November 10, 1997 * * Purpose: Implements a family of files that acts as a single hdf5 @@ -79,69 +79,69 @@ typedef struct H5FD_family_fapl_t { } H5FD_family_fapl_t; /* Callback prototypes */ -static herr_t H5FD_family_term(void); -static void *H5FD_family_fapl_get(H5FD_t *_file); -static void *H5FD_family_fapl_copy(const void *_old_fa); -static herr_t H5FD_family_fapl_free(void *_fa); -static hsize_t H5FD_family_sb_size(H5FD_t *_file); -static herr_t H5FD_family_sb_encode(H5FD_t *_file, char *name/*out*/, +static herr_t H5FD__family_term(void); +static void *H5FD__family_fapl_get(H5FD_t *_file); +static void *H5FD__family_fapl_copy(const void *_old_fa); +static herr_t H5FD__family_fapl_free(void *_fa); +static hsize_t H5FD__family_sb_size(H5FD_t *_file); +static herr_t H5FD__family_sb_encode(H5FD_t *_file, char *name/*out*/, unsigned char *buf/*out*/); -static herr_t H5FD_family_sb_decode(H5FD_t *_file, const char *name, +static herr_t H5FD__family_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf); -static H5FD_t *H5FD_family_open(const char *name, unsigned flags, +static H5FD_t *H5FD__family_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr); -static herr_t H5FD_family_close(H5FD_t *_file); -static int H5FD_family_cmp(const H5FD_t *_f1, const H5FD_t *_f2); -static herr_t H5FD_family_query(const H5FD_t *_f1, unsigned long *flags); -static haddr_t H5FD_family_get_eoa(const H5FD_t *_file, H5FD_mem_t type); -static herr_t H5FD_family_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t eoa); -static haddr_t H5FD_family_get_eof(const H5FD_t *_file, H5FD_mem_t type); -static herr_t H5FD_family_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle); -static herr_t H5FD_family_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, +static herr_t H5FD__family_close(H5FD_t *_file); +static int H5FD__family_cmp(const H5FD_t *_f1, const H5FD_t *_f2); +static herr_t H5FD__family_query(const H5FD_t *_f1, unsigned long *flags); +static haddr_t H5FD__family_get_eoa(const H5FD_t *_file, H5FD_mem_t type); +static herr_t H5FD__family_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t eoa); +static haddr_t H5FD__family_get_eof(const H5FD_t *_file, H5FD_mem_t type); +static herr_t H5FD__family_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle); +static herr_t H5FD__family_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, void *_buf/*out*/); -static herr_t H5FD_family_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, +static herr_t H5FD__family_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, const void *_buf); -static herr_t H5FD_family_flush(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); -static herr_t H5FD_family_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); -static herr_t H5FD_family_lock(H5FD_t *_file, hbool_t rw); -static herr_t H5FD_family_unlock(H5FD_t *_file); +static herr_t H5FD__family_flush(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); +static herr_t H5FD__family_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); +static herr_t H5FD__family_lock(H5FD_t *_file, hbool_t rw); +static herr_t H5FD__family_unlock(H5FD_t *_file); /* The class struct */ static const H5FD_class_t H5FD_family_g = { - "family", /*name */ - HADDR_MAX, /*maxaddr */ - H5F_CLOSE_WEAK, /*fc_degree */ - H5FD_family_term, /*terminate */ - H5FD_family_sb_size, /*sb_size */ - H5FD_family_sb_encode, /*sb_encode */ - H5FD_family_sb_decode, /*sb_decode */ - sizeof(H5FD_family_fapl_t), /*fapl_size */ - H5FD_family_fapl_get, /*fapl_get */ - H5FD_family_fapl_copy, /*fapl_copy */ - H5FD_family_fapl_free, /*fapl_free */ - 0, /*dxpl_size */ - NULL, /*dxpl_copy */ - NULL, /*dxpl_free */ - H5FD_family_open, /*open */ - H5FD_family_close, /*close */ - H5FD_family_cmp, /*cmp */ - H5FD_family_query, /*query */ - NULL, /*get_type_map */ - NULL, /*alloc */ - NULL, /*free */ - H5FD_family_get_eoa, /*get_eoa */ - H5FD_family_set_eoa, /*set_eoa */ - H5FD_family_get_eof, /*get_eof */ - H5FD_family_get_handle, /*get_handle */ - H5FD_family_read, /*read */ - H5FD_family_write, /*write */ - NULL, /*read_vector */ - NULL, /*write_vector */ - H5FD_family_flush, /*flush */ - H5FD_family_truncate, /*truncate */ - H5FD_family_lock, /*lock */ - H5FD_family_unlock, /*unlock */ - H5FD_FLMAP_DICHOTOMY /*fl_map */ + "family", /* name */ + HADDR_MAX, /* maxaddr */ + H5F_CLOSE_WEAK, /* fc_degree */ + H5FD__family_term, /* terminate */ + H5FD__family_sb_size, /* sb_size */ + H5FD__family_sb_encode, /* sb_encode */ + H5FD__family_sb_decode, /* sb_decode */ + sizeof(H5FD_family_fapl_t), /* fapl_size */ + H5FD__family_fapl_get, /* fapl_get */ + H5FD__family_fapl_copy, /* fapl_copy */ + H5FD__family_fapl_free, /* fapl_free */ + 0, /* dxpl_size */ + NULL, /* dxpl_copy */ + NULL, /* dxpl_free */ + H5FD__family_open, /* open */ + H5FD__family_close, /* close */ + H5FD__family_cmp, /* cmp */ + H5FD__family_query, /* query */ + NULL, /* get_type_map */ + NULL, /* alloc */ + NULL, /* free */ + H5FD__family_get_eoa, /* get_eoa */ + H5FD__family_set_eoa, /* set_eoa */ + H5FD__family_get_eof, /* get_eof */ + H5FD__family_get_handle, /* get_handle */ + H5FD__family_read, /* read */ + H5FD__family_write, /* write */ + H5FD__family_flush, /* flush */ + NULL, /* read_vector */ + NULL, /* write_vector */ + H5FD__family_truncate, /* truncate */ + H5FD__family_lock, /* lock */ + H5FD__family_unlock, /* unlock */ + H5FD_FLMAP_DICHOTOMY /* fl_map */ }; @@ -205,7 +205,7 @@ done: /*--------------------------------------------------------------------------- - * Function: H5FD_family_term + * Function: H5FD__family_term * * Purpose: Shut down the VFD * @@ -217,15 +217,15 @@ done: *--------------------------------------------------------------------------- */ static herr_t -H5FD_family_term(void) +H5FD__family_term(void) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Reset VFL ID */ H5FD_FAMILY_g=0; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5FD_family_term() */ +} /* end H5FD__family_term() */ /*------------------------------------------------------------------------- @@ -244,13 +244,6 @@ H5FD_family_term(void) * Programmer: Robb Matzke * Wednesday, August 4, 1999 * - * Modifications: - * - * Raymond Lu - * Tuesday, Oct 23, 2001 - * Changed the file access list to the new generic property - * list. - * *------------------------------------------------------------------------- */ herr_t @@ -298,13 +291,6 @@ done: * Programmer: Robb Matzke * Wednesday, August 4, 1999 * - * Modifications: - * - * Raymond Lu - * Tuesday, Oct 23, 2001 - * Changed the file access list to the new generic property - * list. - * *------------------------------------------------------------------------- */ herr_t @@ -337,7 +323,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_family_fapl_get + * Function: H5FD__family_fapl_get * * Purpose: Gets a file access property list which could be used to * create an identical file. @@ -349,19 +335,17 @@ done: * Programmer: Robb Matzke * Friday, August 13, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ static void * -H5FD_family_fapl_get(H5FD_t *_file) +H5FD__family_fapl_get(H5FD_t *_file) { H5FD_family_t *file = (H5FD_family_t*)_file; H5FD_family_fapl_t *fa = NULL; H5P_genplist_t *plist; /* Property list pointer */ void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(NULL == (fa = (H5FD_family_fapl_t *)H5MM_calloc(sizeof(H5FD_family_fapl_t)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") @@ -375,16 +359,16 @@ H5FD_family_fapl_get(H5FD_t *_file) ret_value=fa; done: - if(ret_value==NULL) { + if(ret_value==NULL) if(fa!=NULL) H5MM_xfree(fa); - } /* end if */ + FUNC_LEAVE_NOAPI(ret_value) } /*------------------------------------------------------------------------- - * Function: H5FD_family_fapl_copy + * Function: H5FD__family_fapl_copy * * Purpose: Copies the family-specific file access properties. * @@ -395,19 +379,17 @@ done: * Programmer: Robb Matzke * Wednesday, August 4, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ static void * -H5FD_family_fapl_copy(const void *_old_fa) +H5FD__family_fapl_copy(const void *_old_fa) { const H5FD_family_fapl_t *old_fa = (const H5FD_family_fapl_t*)_old_fa; H5FD_family_fapl_t *new_fa = NULL; H5P_genplist_t *plist; /* Property list pointer */ void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(NULL == (new_fa = (H5FD_family_fapl_t *)H5MM_malloc(sizeof(H5FD_family_fapl_t)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") @@ -430,16 +412,16 @@ H5FD_family_fapl_copy(const void *_old_fa) ret_value=new_fa; done: - if(ret_value==NULL) { + if(ret_value==NULL) if(new_fa!=NULL) H5MM_xfree(new_fa); - } /* end if */ + FUNC_LEAVE_NOAPI(ret_value) } /*------------------------------------------------------------------------- - * Function: H5FD_family_fapl_free + * Function: H5FD__family_fapl_free * * Purpose: Frees the family-specific file access properties. * @@ -450,17 +432,15 @@ done: * Programmer: Robb Matzke * Wednesday, August 4, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5FD_family_fapl_free(void *_fa) +H5FD__family_fapl_free(void *_fa) { H5FD_family_fapl_t *fa = (H5FD_family_fapl_t*)_fa; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(H5I_dec_ref(fa->memb_fapl_id) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTDEC, FAIL, "can't close driver ID") @@ -472,7 +452,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_family_sb_size + * Function: H5FD__family_sb_size * * Purpose: Returns the size of the private information to be stored in * the superblock. @@ -484,14 +464,12 @@ done: * Programmer: Raymond Lu * Tuesday, May 10, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static hsize_t -H5FD_family_sb_size(H5FD_t H5_ATTR_UNUSED *_file) +H5FD__family_sb_size(H5FD_t H5_ATTR_UNUSED *_file) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* 8 bytes field for the size of member file size field should be * enough for now. */ @@ -500,7 +478,7 @@ H5FD_family_sb_size(H5FD_t H5_ATTR_UNUSED *_file) /*------------------------------------------------------------------------- - * Function: H5FD_family_sb_encode + * Function: H5FD__family_sb_encode * * Purpose: Encode driver information for the superblock. The NAME * argument is a nine-byte buffer which will be initialized with @@ -515,16 +493,14 @@ H5FD_family_sb_size(H5FD_t H5_ATTR_UNUSED *_file) * Programmer: Raymond Lu * Tuesday, May 10, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5FD_family_sb_encode(H5FD_t *_file, char *name/*out*/, unsigned char *buf/*out*/) +H5FD__family_sb_encode(H5FD_t *_file, char *name/*out*/, unsigned char *buf/*out*/) { H5FD_family_t *file = (H5FD_family_t*)_file; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Name and version number */ HDstrncpy(name, "NCSAfami", (size_t)9); @@ -534,18 +510,18 @@ H5FD_family_sb_encode(H5FD_t *_file, char *name/*out*/, unsigned char *buf/*out* * This is to guarantee backward compatibility. If a file is created with * v1.6 library and the driver info isn't saved in the superblock. We open * it with v1.8, the FILE->MEMB_SIZE will be the actual size of the first - * member file (see H5FD_family_open). So it isn't safe to use FILE->MEMB_SIZE. + * member file (see H5FD__family_open). So it isn't safe to use FILE->MEMB_SIZE. * If the file is created with v1.8, the correctness of FILE->PMEM_SIZE is - * checked in H5FD_family_sb_decode. SLU - 2009/3/21 + * checked in H5FD__family_sb_decode. SLU - 2009/3/21 */ UINT64ENCODE(buf, (uint64_t)file->pmem_size); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5FD_family_sb_encode() */ +} /* end H5FD__family_sb_encode() */ /*------------------------------------------------------------------------- - * Function: H5FD_family_sb_decode + * Function: H5FD__family_sb_decode * * Purpose: This function has 2 separate purpose. One is to decodes the * superblock information for this driver. The NAME argument is @@ -563,13 +539,13 @@ H5FD_family_sb_encode(H5FD_t *_file, char *name/*out*/, unsigned char *buf/*out* *------------------------------------------------------------------------- */ static herr_t -H5FD_family_sb_decode(H5FD_t *_file, const char H5_ATTR_UNUSED *name, const unsigned char *buf) +H5FD__family_sb_decode(H5FD_t *_file, const char H5_ATTR_UNUSED *name, const unsigned char *buf) { H5FD_family_t *file = (H5FD_family_t*)_file; uint64_t msize; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Read member file size. Skip name template for now although it's saved. */ UINT64DECODE(buf, msize); @@ -596,11 +572,11 @@ H5FD_family_sb_decode(H5FD_t *_file, const char H5_ATTR_UNUSED *name, const unsi done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_family_sb_decode() */ +} /* end H5FD__family_sb_decode() */ /*------------------------------------------------------------------------- - * Function: H5FD_family_open + * Function: H5FD__family_open * * Purpose: Creates and/or opens a family of files as an HDF5 file. * @@ -623,7 +599,7 @@ done: */ H5_GCC_DIAG_OFF(format-nonliteral) static H5FD_t * -H5FD_family_open(const char *name, unsigned flags, hid_t fapl_id, +H5FD__family_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) { H5FD_family_t *file = NULL; @@ -632,7 +608,7 @@ H5FD_family_open(const char *name, unsigned flags, hid_t fapl_id, unsigned t_flags = flags & ~H5F_ACC_CREAT; H5FD_t *ret_value = NULL; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments */ if(!name || !*name) @@ -771,12 +747,12 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_family_open() */ +} /* end H5FD__family_open() */ H5_GCC_DIAG_ON(format-nonliteral) /*------------------------------------------------------------------------- - * Function: H5FD_family_close + * Function: H5FD__family_close * * Purpose: Closes a family of files. * @@ -792,14 +768,14 @@ H5_GCC_DIAG_ON(format-nonliteral) *------------------------------------------------------------------------- */ static herr_t -H5FD_family_close(H5FD_t *_file) +H5FD__family_close(H5FD_t *_file) { H5FD_family_t *file = (H5FD_family_t*)_file; unsigned nerrors = 0; /* Number of errors while closing member files */ unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Close as many members as possible. Use private function here to avoid clearing * the error stack. We need the error message to indicate wrong member file size. */ @@ -824,11 +800,11 @@ H5FD_family_close(H5FD_t *_file) H5MM_xfree(file); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_family_close() */ +} /* end H5FD__family_close() */ /*------------------------------------------------------------------------- - * Function: H5FD_family_cmp + * Function: H5FD__family_cmp * * Purpose: Compares two file families to see if they are the same. It * does this by comparing the first member of the two families. @@ -841,18 +817,16 @@ H5FD_family_close(H5FD_t *_file) * Programmer: Robb Matzke * Wednesday, August 4, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ static int -H5FD_family_cmp(const H5FD_t *_f1, const H5FD_t *_f2) +H5FD__family_cmp(const H5FD_t *_f1, const H5FD_t *_f2) { const H5FD_family_t *f1 = (const H5FD_family_t*)_f1; const H5FD_family_t *f2 = (const H5FD_family_t*)_f2; int ret_value = 0; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(f1->nmembs >= 1 && f1->memb[0]); HDassert(f2->nmembs >= 1 && f2->memb[0]); @@ -860,11 +834,11 @@ H5FD_family_cmp(const H5FD_t *_f1, const H5FD_t *_f2) ret_value = H5FDcmp(f1->memb[0], f2->memb[0]); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_family_cmp() */ +} /* end H5FD__family_cmp() */ /*------------------------------------------------------------------------- - * Function: H5FD_family_query + * Function: H5FD__family_query * * Purpose: Set the flags that this VFL driver is capable of supporting. * (listed in H5FDpublic.h) @@ -878,11 +852,11 @@ H5FD_family_cmp(const H5FD_t *_f1, const H5FD_t *_f2) *------------------------------------------------------------------------- */ static herr_t -H5FD_family_query(const H5FD_t * _file, unsigned long *flags /* out */) +H5FD__family_query(const H5FD_t * _file, unsigned long *flags /* out */) { const H5FD_family_t *file = (const H5FD_family_t*)_file; /* Family VFD info */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Set the VFL feature flags that this driver supports */ if(flags) { @@ -898,11 +872,11 @@ H5FD_family_query(const H5FD_t * _file, unsigned long *flags /* out */) } /* end if */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5FD_family_query() */ +} /* end H5FD__family_query() */ /*------------------------------------------------------------------------- - * Function: H5FD_family_get_eoa + * Function: H5FD__family_get_eoa * * Purpose: Returns the end-of-address marker for the file. The EOA * marker is the first address past the last byte allocated in @@ -915,26 +889,21 @@ H5FD_family_query(const H5FD_t * _file, unsigned long *flags /* out */) * Programmer: Robb Matzke * Wednesday, August 4, 1999 * - * Modifications: - * Raymond Lu - * 21 Dec. 2006 - * Added the parameter TYPE. It's only used for MULTI driver. - * *------------------------------------------------------------------------- */ static haddr_t -H5FD_family_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) +H5FD__family_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) { const H5FD_family_t *file = (const H5FD_family_t*)_file; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR FUNC_LEAVE_NOAPI(file->eoa) } /*------------------------------------------------------------------------- - * Function: H5FD_family_set_eoa + * Function: H5FD__family_set_eoa * * Purpose: Set the end-of-address marker for the file. * @@ -945,11 +914,6 @@ H5FD_family_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) * Programmer: Robb Matzke * Wednesday, August 4, 1999 * - * Modifications: - * Raymond Lu - * 21 Dec. 2006 - * Added the parameter TYPE. It's only used for MULTI driver. - * *------------------------------------------------------------------------- */ /* Disable warning for "format not a string literal" here -QAK */ @@ -960,7 +924,7 @@ H5FD_family_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) */ H5_GCC_DIAG_OFF(format-nonliteral) static herr_t -H5FD_family_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t abs_eoa) +H5FD__family_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t abs_eoa) { H5FD_family_t *file = (H5FD_family_t*)_file; haddr_t addr = abs_eoa; @@ -968,7 +932,7 @@ H5FD_family_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t abs_eoa) unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Allocate space for the member name buffer */ if(NULL == (memb_name = (char *)H5MM_malloc(H5FD_FAM_MEMB_NAME_BUF_SIZE))) @@ -1029,7 +993,7 @@ H5_GCC_DIAG_ON(format-nonliteral) /*------------------------------------------------------------------------- - * Function: H5FD_family_get_eof + * Function: H5FD__family_get_eof * * Purpose: Returns the end-of-file marker, which is the greater of * either the total family size or the current EOA marker. @@ -1043,19 +1007,17 @@ H5_GCC_DIAG_ON(format-nonliteral) * Programmer: Robb Matzke * Wednesday, August 4, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ static haddr_t -H5FD_family_get_eof(const H5FD_t *_file, H5FD_mem_t type) +H5FD__family_get_eof(const H5FD_t *_file, H5FD_mem_t type) { const H5FD_family_t *file = (const H5FD_family_t*)_file; haddr_t eof=0; int i; /* Local index variable */ haddr_t ret_value = HADDR_UNDEF; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* * Find the last member that has a non-zero EOF and break out of the loop @@ -1087,7 +1049,7 @@ H5FD_family_get_eof(const H5FD_t *_file, H5FD_mem_t type) /*------------------------------------------------------------------------- - * Function: H5FD_family_get_handle + * Function: H5FD__family_get_handle * * Purpose: Returns the file handle of FAMILY file driver. * @@ -1096,12 +1058,10 @@ H5FD_family_get_eof(const H5FD_t *_file, H5FD_mem_t type) * Programmer: Raymond Lu * Sept. 16, 2002 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5FD_family_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle) +H5FD__family_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle) { H5FD_family_t *file = (H5FD_family_t *)_file; H5P_genplist_t *plist; @@ -1109,7 +1069,7 @@ H5FD_family_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle) int memb; herr_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Get the plist structure and family offset */ if(NULL == (plist = H5P_object_verify(fapl, H5P_FILE_ACCESS))) @@ -1129,7 +1089,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_family_read + * Function: H5FD__family_read * * Purpose: Reads SIZE bytes of data from FILE beginning at address ADDR * into buffer BUF according to data transfer properties in @@ -1143,12 +1103,10 @@ done: * Programmer: Robb Matzke * Wednesday, August 4, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5FD_family_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, +H5FD__family_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, void *_buf/*out*/) { H5FD_family_t *file = (H5FD_family_t*)_file; @@ -1160,7 +1118,7 @@ H5FD_family_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, si H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* * Get the member data transfer property list. If the transfer property @@ -1199,7 +1157,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_family_write + * Function: H5FD__family_write * * Purpose: Writes SIZE bytes of data to FILE beginning at address ADDR * from buffer BUF according to data transfer properties in @@ -1212,12 +1170,10 @@ done: * Programmer: Robb Matzke * Wednesday, August 4, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5FD_family_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, +H5FD__family_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, const void *_buf) { H5FD_family_t *file = (H5FD_family_t*)_file; @@ -1229,7 +1185,7 @@ H5FD_family_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, s H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* * Get the member data transfer property list. If the transfer property @@ -1268,7 +1224,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_family_flush + * Function: H5FD__family_flush * * Purpose: Flushes all family members. * @@ -1281,13 +1237,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_family_flush(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closing) +H5FD__family_flush(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closing) { H5FD_family_t *file = (H5FD_family_t*)_file; unsigned u, nerrors = 0; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC for(u = 0; u < file->nmembs; u++) if(file->memb[u] && H5FD_flush(file->memb[u], closing) < 0) @@ -1298,11 +1254,11 @@ H5FD_family_flush(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closing) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_family_flush() */ +} /* end H5FD__family_flush() */ /*------------------------------------------------------------------------- - * Function: H5FD_family_truncate + * Function: H5FD__family_truncate * * Purpose: Truncates all family members. * @@ -1316,13 +1272,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_family_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closing) +H5FD__family_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closing) { H5FD_family_t *file = (H5FD_family_t*)_file; unsigned u, nerrors = 0; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC for(u = 0; u < file->nmembs; u++) if(file->memb[u] && H5FD_truncate(file->memb[u], closing) < 0) @@ -1333,11 +1289,11 @@ H5FD_family_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closin done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_family_truncate() */ +} /* end H5FD__family_truncate() */ /*------------------------------------------------------------------------- - * Function: H5FD_family_lock + * Function: H5FD__family_lock * * Purpose: To place an advisory lock on a file. * The lock type to apply depends on the parameter "rw": @@ -1351,13 +1307,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_family_lock(H5FD_t *_file, hbool_t rw) +H5FD__family_lock(H5FD_t *_file, hbool_t rw) { H5FD_family_t *file = (H5FD_family_t *)_file; /* VFD file struct */ unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Place the lock on all the member files */ for(u = 0; u < file->nmembs; u++) @@ -1374,18 +1330,18 @@ H5FD_family_lock(H5FD_t *_file, hbool_t rw) for(v = 0; v < u; v++) { if(H5FD_unlock(file->memb[v]) < 0) /* Push error, but keep going */ - HDONE_ERROR(H5E_IO, H5E_CANTUNLOCK, FAIL, "unable to unlock member files") + HDONE_ERROR(H5E_IO, H5E_CANTUNLOCKFILE, FAIL, "unable to unlock member files") } /* end for */ - HGOTO_ERROR(H5E_IO, H5E_CANTLOCK, FAIL, "unable to lock member files") + HGOTO_ERROR(H5E_IO, H5E_CANTLOCKFILE, FAIL, "unable to lock member files") } /* end if */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_family_lock() */ +} /* end H5FD__family_lock() */ /*------------------------------------------------------------------------- - * Function: H5FD_family_unlock + * Function: H5FD__family_unlock * * Purpose: To remove the existing lock on the file * @@ -1396,21 +1352,21 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_family_unlock(H5FD_t *_file) +H5FD__family_unlock(H5FD_t *_file) { H5FD_family_t *file = (H5FD_family_t *)_file; /* VFD file struct */ unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Remove the lock on the member files */ for(u = 0; u < file->nmembs; u++) if(file->memb[u]) if(H5FD_unlock(file->memb[u]) < 0) - HGOTO_ERROR(H5E_IO, H5E_CANTUNLOCK, FAIL, "unable to unlock member files") + HGOTO_ERROR(H5E_IO, H5E_CANTUNLOCKFILE, FAIL, "unable to unlock member files") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_family_unlock() */ +} /* end H5FD__family_unlock() */ diff --git a/src/H5FDfamily.h b/src/H5FDfamily.h index 1584cf6..45bdccc 100644 --- a/src/H5FDfamily.h +++ b/src/H5FDfamily.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, August 4, 1999 * * Purpose: The public header file for the family driver. diff --git a/src/H5FDhdfs.c b/src/H5FDhdfs.c index b9f0527..780c926 100644 --- a/src/H5FDhdfs.c +++ b/src/H5FDhdfs.c @@ -20,9 +20,6 @@ * File System (HDFS). */ -/* This source code file is part of the H5FD driver module */ -#include "H5FDdrvr_module.h" - #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ #include "H5FDprivate.h" /* File drivers */ @@ -32,8 +29,12 @@ #include "H5MMprivate.h" /* Memory management */ #ifdef H5_HAVE_LIBHDFS + +/* This source code file is part of the H5FD driver module */ +#include "H5FDdrvr_module.h" + +/* HDFS routines */ #include "hdfs.h" -#endif /* toggle function call prints: 1 turns on */ #define HDFS_DEBUG 0 @@ -74,7 +75,7 @@ static hid_t H5FD_HDFS_g = 0; #define HDFS_STATS_POW(bin_i, out_ptr) { \ unsigned long long donotshadowresult = 1; \ unsigned donotshadowindex = 0; \ - for (donotshadowindex = 0; \ + for(donotshadowindex = 0; \ donotshadowindex < (((bin_i) * HDFS_STATS_INTERVAL) + \ HDFS_STATS_START_POWER); \ donotshadowindex++) \ @@ -118,8 +119,6 @@ static unsigned long long hdfs_stats_boundaries[HDFS_STATS_BIN_COUNT]; * * Programmer: Jacob Smith * - * Changes: None - * ***************************************************************************/ typedef struct { unsigned long long count; @@ -130,7 +129,6 @@ typedef struct { #endif /* HDFS_STATS */ -#ifdef H5_HAVE_LIBHDFS /* "unique" identifier for `hdfs_t` structures. * Randomly generated by unweighted dice rolls. @@ -146,9 +144,7 @@ typedef struct { * * Contain/retain information associated with a file hosted on Hadoop * Distributed File System (HDFS). Instantiated and populated via - * `H5FD_hdfs_handle_open()` and cleaned up via `H5FD_hdfs_handle_close()`. - * - * + * `H5FD__hdfs_handle_open()` and cleaned up via `H5FD__hdfs_handle_close()`. * * `magic` (unisgned long) * @@ -175,8 +171,6 @@ typedef struct { * Programmer: Jacob Smith * May 2018 * - * Changes: None - * *************************************************************************** */ typedef struct { @@ -187,194 +181,6 @@ typedef struct { } hdfs_t; -/*-------------------------------------------------------------------------- - * Function: H5FD_hdfs_handle_open - * - * Purpose: Create a HDFS file handle, 'opening' the target file. - * - * Return: Success: Pointer to HDFS container/handle of opened file. - * Failure: NULL - * - * Programmer: Gerd Herber - * May 2018 - * - * Changes: None. - *-------------------------------------------------------------------------- - */ -static hdfs_t * -H5FD_hdfs_handle_open( - const char *path, - const char *namenode_name, - const int32_t namenode_port, - const char *user_name, - const char *kerberos_ticket_cache, - const int32_t stream_buffer_size) -{ - struct hdfsBuilder *builder = NULL; - hdfs_t *handle = NULL; - hdfs_t *ret_value = NULL; - - FUNC_ENTER_NOAPI_NOINIT - -#if HDFS_DEBUG - HDfprintf(stdout, "called H5FD_hdfs_handle_open.\n"); -#endif - - if (path == NULL || path[0] == '\0') { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "path cannot be null.\n") - } - if (namenode_name == NULL /* || namenode_name[0] == '\0' */ ) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "namenode name cannot be null.\n") - } - if (namenode_port < 0 || namenode_port > 65535) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "namenode port must be non-negative and <= 65535.\n") - } - if (stream_buffer_size < 0) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "buffer size must non-negative.\n") - } - - handle = (hdfs_t *)H5MM_malloc(sizeof(hdfs_t)); - if (handle == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, NULL, - "could not malloc space for handle.\n") - } - - handle->magic = (unsigned long)HDFS_HDFST_MAGIC; - handle->filesystem = NULL; /* TODO: not a pointer; NULL may cause bug */ - handle->fileinfo = NULL; - handle->file = NULL; /* TODO: not a pointer; NULL may cause bug */ - - builder = hdfsNewBuilder(); - if (!builder) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "(hdfs) failed to create builder") - } - hdfsBuilderSetNameNode(builder, namenode_name); - hdfsBuilderSetNameNodePort(builder, (tPort)namenode_port); - if (user_name != NULL && user_name[0] != '\0') { - hdfsBuilderSetUserName(builder, user_name); - } - if (kerberos_ticket_cache != NULL && kerberos_ticket_cache[0] != '\0') { - hdfsBuilderSetKerbTicketCachePath(builder, kerberos_ticket_cache); - } - /* Call to `hdfsBuilderConnect` releases builder, regardless of success. */ - handle->filesystem = hdfsBuilderConnect(builder); - if (!handle->filesystem) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "(hdfs) could not connect to default namenode") - } - handle->fileinfo = hdfsGetPathInfo(handle->filesystem, path); - if (!handle->fileinfo) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "hdfsGetPathInfo failed") - } - handle->file = hdfsOpenFile( - handle->filesystem, - path, - O_RDONLY, - stream_buffer_size, - 0, - 0); - if (!handle->file) { - HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, - "(hdfs) could not open") - } - - ret_value = handle; - -done: - if (ret_value == NULL && handle != NULL) { - /* error; clean up */ - HDassert(handle->magic == HDFS_HDFST_MAGIC); - handle->magic++; - if (handle->file != NULL) { - if (FAIL == (hdfsCloseFile(handle->filesystem, handle->file))) { - HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, NULL, - "unable to close hdfs file handle") - } - } - if (handle->fileinfo != NULL) { - hdfsFreeFileInfo(handle->fileinfo, 1); - } - if (handle->filesystem != NULL) { - if (FAIL == (hdfsDisconnect(handle->filesystem))) { - HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, NULL, - "unable to disconnect from hdfs") - } - } - H5MM_xfree(handle); - } - - FUNC_LEAVE_NOAPI(ret_value) - -} /* H5FD_hdfs_handle_open() */ - - -/*-------------------------------------------------------------------------- - * Function: H5FD_hdfs_handle_close - * - * Purpose: 'Close' an HDFS file container/handle, releasing underlying - * resources. - * - * Return: Success: `SUCCEED` (0) - * Failure: `FAIL` (-1) - * - * Programmer: Gerd Herber - * May 2018 - * - * Changes: None. - *-------------------------------------------------------------------------- - */ -static herr_t -H5FD_hdfs_handle_close(hdfs_t *handle) -{ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI_NOINIT - -#if HDFS_DEBUG - HDfprintf(stdout, "called H5FD_hdfs_close.\n"); -#endif - - if (handle == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "handle cannot be null.\n") - } - if (handle->magic != HDFS_HDFST_MAGIC) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "handle has invalid magic.\n") - } - - handle->magic++; - if (handle->file != NULL) { - if (FAIL == (hdfsCloseFile(handle->filesystem, handle->file))) { - HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, - "unable to close hdfs file handle") - } - } - if (handle->fileinfo != NULL) { - hdfsFreeFileInfo(handle->fileinfo, 1); - } - if (handle->filesystem != NULL) { - if (FAIL == (hdfsDisconnect(handle->filesystem))) { - HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, - "unable to disconnect hdfs file system") - } - } - - H5MM_xfree(handle); - -done: - FUNC_LEAVE_NOAPI(ret_value) - -} /* H5FD_hdfs_close() */ - -#endif /* H5_HAVE_LIBHDFS */ - /*************************************************************************** * @@ -432,17 +238,13 @@ done: * * Programmer: Jacob Smith * - * Changes: None. - * *************************************************************************** */ typedef struct H5FD_hdfs_t { H5FD_t pub; H5FD_hdfs_fapl_t fa; haddr_t eoa; -#ifdef H5_HAVE_LIBHDFS hdfs_t *hdfs_handle; -#endif #if HDFS_STATS hdfs_statsbin meta[HDFS_STATS_BIN_COUNT + 1]; hdfs_statsbin raw[HDFS_STATS_BIN_COUNT + 1]; @@ -459,77 +261,74 @@ typedef struct H5FD_hdfs_t { * Only included if HDFS code should compile. * */ -#define MAXADDR (((haddr_t)1<<(8*sizeof(HDoff_t)-1))-1) -#ifdef H5_HAVE_LIBHDFS +#define MAXADDR (((haddr_t)1 << (8 * sizeof(HDoff_t) - 1)) - 1) #define ADDR_OVERFLOW(A) (HADDR_UNDEF==(A) || ((A) & ~(haddr_t)MAXADDR)) -#endif /* H5_HAVE_LIBHDFS */ /* Prototypes */ -static herr_t H5FD_hdfs_term(void); -static void *H5FD_hdfs_fapl_get(H5FD_t *_file); -static void *H5FD_hdfs_fapl_copy(const void *_old_fa); -static herr_t H5FD_hdfs_fapl_free(void *_fa); -static H5FD_t *H5FD_hdfs_open(const char *name, unsigned flags, hid_t fapl_id, +static herr_t H5FD__hdfs_term(void); +static void *H5FD__hdfs_fapl_get(H5FD_t *_file); +static void *H5FD__hdfs_fapl_copy(const void *_old_fa); +static herr_t H5FD__hdfs_fapl_free(void *_fa); +static H5FD_t *H5FD__hdfs_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr); -static herr_t H5FD_hdfs_close(H5FD_t *_file); -static int H5FD_hdfs_cmp(const H5FD_t *_f1, const H5FD_t *_f2); -static herr_t H5FD_hdfs_query(const H5FD_t *_f1, unsigned long *flags); -static haddr_t H5FD_hdfs_get_eoa(const H5FD_t *_file, H5FD_mem_t type); -static herr_t H5FD_hdfs_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr); -static haddr_t H5FD_hdfs_get_eof(const H5FD_t *_file, H5FD_mem_t type); -static herr_t H5FD_hdfs_get_handle(H5FD_t *_file, hid_t fapl, +static herr_t H5FD__hdfs_close(H5FD_t *_file); +static int H5FD__hdfs_cmp(const H5FD_t *_f1, const H5FD_t *_f2); +static herr_t H5FD__hdfs_query(const H5FD_t *_f1, unsigned long *flags); +static haddr_t H5FD__hdfs_get_eoa(const H5FD_t *_file, H5FD_mem_t type); +static herr_t H5FD__hdfs_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr); +static haddr_t H5FD__hdfs_get_eof(const H5FD_t *_file, H5FD_mem_t type); +static herr_t H5FD__hdfs_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle); -static herr_t H5FD_hdfs_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, +static herr_t H5FD__hdfs_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, void *buf); -static herr_t H5FD_hdfs_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, +static herr_t H5FD__hdfs_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, const void *buf); -static herr_t H5FD_hdfs_truncate(H5FD_t *_file, hid_t dxpl_id, +static herr_t H5FD__hdfs_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); -static herr_t H5FD_hdfs_lock(H5FD_t *_file, hbool_t rw); -static herr_t H5FD_hdfs_unlock(H5FD_t *_file); -static herr_t H5FD_hdfs_validate_config(const H5FD_hdfs_fapl_t * fa); +static herr_t H5FD__hdfs_lock(H5FD_t *_file, hbool_t rw); +static herr_t H5FD__hdfs_unlock(H5FD_t *_file); + +static herr_t H5FD__hdfs_validate_config(const H5FD_hdfs_fapl_t * fa); static const H5FD_class_t H5FD_hdfs_g = { "hdfs", /* name */ MAXADDR, /* maxaddr */ H5F_CLOSE_WEAK, /* fc_degree */ - H5FD_hdfs_term, /* terminate */ + H5FD__hdfs_term, /* terminate */ NULL, /* sb_size */ NULL, /* sb_encode */ NULL, /* sb_decode */ sizeof(H5FD_hdfs_fapl_t), /* fapl_size */ - H5FD_hdfs_fapl_get, /* fapl_get */ - H5FD_hdfs_fapl_copy, /* fapl_copy */ - H5FD_hdfs_fapl_free, /* fapl_free */ + H5FD__hdfs_fapl_get, /* fapl_get */ + H5FD__hdfs_fapl_copy, /* fapl_copy */ + H5FD__hdfs_fapl_free, /* fapl_free */ 0, /* dxpl_size */ NULL, /* dxpl_copy */ NULL, /* dxpl_free */ - H5FD_hdfs_open, /* open */ - H5FD_hdfs_close, /* close */ - H5FD_hdfs_cmp, /* cmp */ - H5FD_hdfs_query, /* query */ + H5FD__hdfs_open, /* open */ + H5FD__hdfs_close, /* close */ + H5FD__hdfs_cmp, /* cmp */ + H5FD__hdfs_query, /* query */ NULL, /* get_type_map */ NULL, /* alloc */ NULL, /* free */ - H5FD_hdfs_get_eoa, /* get_eoa */ - H5FD_hdfs_set_eoa, /* set_eoa */ - H5FD_hdfs_get_eof, /* get_eof */ - H5FD_hdfs_get_handle, /* get_handle */ - H5FD_hdfs_read, /* read */ - H5FD_hdfs_write, /* write */ + H5FD__hdfs_get_eoa, /* get_eoa */ + H5FD__hdfs_set_eoa, /* set_eoa */ + H5FD__hdfs_get_eof, /* get_eof */ + H5FD__hdfs_get_handle, /* get_handle */ + H5FD__hdfs_read, /* read */ + H5FD__hdfs_write, /* write */ NULL, /* read_vector */ NULL, /* write_vector */ NULL, /* flush */ - H5FD_hdfs_truncate, /* truncate */ - H5FD_hdfs_lock, /* lock */ - H5FD_hdfs_unlock, /* unlock */ + H5FD__hdfs_truncate, /* truncate */ + H5FD__hdfs_lock, /* lock */ + H5FD__hdfs_unlock, /* unlock */ H5FD_FLMAP_DICHOTOMY /* fl_map */ }; -#ifdef H5_HAVE_LIBHDFS /* Declare a free list to manage the H5FD_hdfs_t struct */ H5FL_DEFINE_STATIC(H5FD_hdfs_t); -#endif /* H5_HAVE_LIBHDFS */ /*------------------------------------------------------------------------- @@ -539,9 +338,6 @@ H5FL_DEFINE_STATIC(H5FD_hdfs_t); * * Return: Non-negative on success/Negative on failure * - * Changes: Rename as appropriate for hdfs vfd. - * Jacob Smith 2018 - * *------------------------------------------------------------------------- */ static herr_t @@ -551,14 +347,11 @@ H5FD__init_package(void) FUNC_ENTER_STATIC - if (H5FD_hdfs_init() < 0) { - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, - "unable to initialize hdfs VFD") - } + if(H5FD_hdfs_init() < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to initialize hdfs VFD") done: FUNC_LEAVE_NOAPI(ret_value) - } /* H5FD__init_package() */ @@ -586,11 +379,11 @@ H5FD_hdfs_init(void) FUNC_ENTER_NOAPI(FAIL) #if HDFS_DEBUG - HDfprintf(stdout, "H5FD_hdfs_init() called.\n"); + HDfprintf(stdout, "called %s.\n", FUNC); #endif if(H5I_VFL != H5I_get_type(H5FD_HDFS_g)) - H5FD_HDFS_g = H5FD_register( &H5FD_hdfs_g, sizeof(H5FD_class_t), FALSE); + H5FD_HDFS_g = H5FD_register(&H5FD_hdfs_g, sizeof(H5FD_class_t), FALSE); #if HDFS_STATS /* pre-compute statsbin boundaries @@ -611,7 +404,7 @@ done: /*--------------------------------------------------------------------------- - * Function: H5FD_hdfs_term + * Function: H5FD__hdfs_term * * Purpose: Shut down the VFD * @@ -620,82 +413,162 @@ done: * Programmer: Quincey Koziol * Friday, Jan 30, 2004 * - * Changes: Rename as appropriate for hdfs vfd. - * Jacob Smith 2018 - * *--------------------------------------------------------------------------- */ static herr_t -H5FD_hdfs_term(void) +H5FD__hdfs_term(void) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR #if HDFS_DEBUG - HDfprintf(stdout, "H5FD_hdfs_term() called.\n"); + HDfprintf(stdout, "called %s.\n", FUNC); #endif /* Reset VFL ID */ H5FD_HDFS_g = 0; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5FD_hdfs_term() */ +} /* end H5FD__hdfs_term() */ -/*------------------------------------------------------------------------- - * Function: H5Pset_fapl_hdfs - * - * Purpose: Modify the file access property list to use the H5FD_HDFS - * driver defined in this source file. All driver specfic - * properties are passed in as a pointer to a suitably - * initialized instance of H5FD_hdfs_fapl_t +/*-------------------------------------------------------------------------- + * Function: H5FD__hdfs_handle_open * - * Return: SUCCEED/FAIL + * Purpose: Create a HDFS file handle, 'opening' the target file. * - * Programmer: John Mainzer - * 9/10/17 + * Return: Success: Pointer to HDFS container/handle of opened file. + * Failure: NULL * - * Changes: Rename as appropriate for hdfs vfd. - * Jacob Smith 2018 + * Programmer: Gerd Herber + * May 2018 * - *------------------------------------------------------------------------- + *-------------------------------------------------------------------------- */ -herr_t -H5Pset_fapl_hdfs(hid_t fapl_id, - H5FD_hdfs_fapl_t *fa) +static hdfs_t * +H5FD__hdfs_handle_open(const char *path, const char *namenode_name, + const int32_t namenode_port, const char *user_name, + const char *kerberos_ticket_cache, const int32_t stream_buffer_size) { - H5P_genplist_t *plist = NULL; /* Property list pointer */ - herr_t ret_value = FAIL; - - FUNC_ENTER_API(FAIL) - H5TRACE2("e", "i*x", fapl_id, fa); + struct hdfsBuilder *builder = NULL; + hdfs_t *handle = NULL; + hdfs_t *ret_value = NULL; - HDassert(fa != NULL); + FUNC_ENTER_STATIC #if HDFS_DEBUG - HDfprintf(stdout, "H5Pset_fapl_hdfs() called.\n"); + HDfprintf(stdout, "called %s.\n", FUNC); #endif - plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS); - if (plist == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, \ - "not a file access property list") - } + if(path == NULL || path[0] == '\0') + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "path cannot be null") + if(namenode_name == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "namenode name cannot be null") + if(namenode_port < 0 || namenode_port > 65535) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "namenode port must be non-negative and <= 65535") + if(stream_buffer_size < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "buffer size must non-negative") - if (FAIL == H5FD_hdfs_validate_config(fa)) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "invalid hdfs config") - } + handle = (hdfs_t *)H5MM_malloc(sizeof(hdfs_t)); + if(handle == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, NULL, "could not malloc space for handle") - ret_value = H5P_set_driver(plist, H5FD_HDFS, (void *)fa); + handle->magic = (unsigned long)HDFS_HDFST_MAGIC; + handle->filesystem = NULL; /* TODO: not a pointer; NULL may cause bug */ + handle->fileinfo = NULL; + handle->file = NULL; /* TODO: not a pointer; NULL may cause bug */ + + builder = hdfsNewBuilder(); + if(!builder) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "(hdfs) failed to create builder") + hdfsBuilderSetNameNode(builder, namenode_name); + hdfsBuilderSetNameNodePort(builder, (tPort)namenode_port); + if(user_name != NULL && user_name[0] != '\0') + hdfsBuilderSetUserName(builder, user_name); + if(kerberos_ticket_cache != NULL && kerberos_ticket_cache[0] != '\0') + hdfsBuilderSetKerbTicketCachePath(builder, kerberos_ticket_cache); + + /* Call to `hdfsBuilderConnect` releases builder, regardless of success. */ + handle->filesystem = hdfsBuilderConnect(builder); + if(!handle->filesystem) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "(hdfs) could not connect to default namenode") + handle->fileinfo = hdfsGetPathInfo(handle->filesystem, path); + if(!handle->fileinfo) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "hdfsGetPathInfo failed") + handle->file = hdfsOpenFile(handle->filesystem, path, O_RDONLY, stream_buffer_size, 0, 0); + if(!handle->file) + HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, "(hdfs) could not open") + + ret_value = handle; done: - FUNC_LEAVE_API(ret_value) + if(ret_value == NULL && handle != NULL) { + /* error; clean up */ + HDassert(handle->magic == HDFS_HDFST_MAGIC); + handle->magic++; + if(handle->file != NULL) + if(FAIL == (hdfsCloseFile(handle->filesystem, handle->file))) + HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, NULL, "unable to close hdfs file handle") + if(handle->fileinfo != NULL) + hdfsFreeFileInfo(handle->fileinfo, 1); + if(handle->filesystem != NULL) + if(FAIL == (hdfsDisconnect(handle->filesystem))) + HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, NULL, "unable to disconnect from hdfs") + H5MM_xfree(handle); + } -} /* H5Pset_fapl_hdfs() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* H5FD__hdfs_handle_open() */ + + +/*-------------------------------------------------------------------------- + * Function: H5FD__hdfs_handle_close + * + * Purpose: 'Close' an HDFS file container/handle, releasing underlying + * resources. + * + * Return: Success: `SUCCEED` (0) + * Failure: `FAIL` (-1) + * + * Programmer: Gerd Herber + * May 2018 + * + *-------------------------------------------------------------------------- + */ +static herr_t +H5FD__hdfs_handle_close(hdfs_t *handle) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + +#if HDFS_DEBUG + HDfprintf(stdout, "called %s.\n", FUNC); +#endif + + if(handle == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle cannot be null") + if(handle->magic != HDFS_HDFST_MAGIC) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle has invalid magic") + + handle->magic++; + if(handle->file != NULL) + if(FAIL == (hdfsCloseFile(handle->filesystem, handle->file))) + HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "unable to close hdfs file handle") + if(handle->fileinfo != NULL) + hdfsFreeFileInfo(handle->fileinfo, 1); + if(handle->filesystem != NULL) + if(FAIL == (hdfsDisconnect(handle->filesystem))) + HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "unable to disconnect hdfs file system") + + H5MM_xfree(handle); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5FD__hdfs_handle_close() */ /*------------------------------------------------------------------------- - * Function: H5FD_hdfs_validate_config() + * Function: H5FD__hdfs_validate_config() * * Purpose: Test to see if the supplied instance of H5FD_hdfs_fapl_t * contains internally consistant data. Return SUCCEED if so, @@ -712,37 +585,70 @@ done: * Programmer: Jacob Smith * 9/10/17 * - * Changes: None. - * *------------------------------------------------------------------------- */ static herr_t -H5FD_hdfs_validate_config(const H5FD_hdfs_fapl_t * fa) +H5FD__hdfs_validate_config(const H5FD_hdfs_fapl_t * fa) { herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(fa != NULL); - if ( fa->version != H5FD__CURR_HDFS_FAPL_T_VERSION ) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "Unknown H5FD_hdfs_fapl_t version"); - } - - if ( fa->namenode_port > 65535 ) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "Invalid namenode port number"); - } - if ( fa->namenode_port < 0 ) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "Invalid namenode port number"); - } + if(fa->version != H5FD__CURR_HDFS_FAPL_T_VERSION) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Unknown H5FD_hdfs_fapl_t version"); + if(fa->namenode_port > 65535) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Invalid namenode port number"); + if(fa->namenode_port < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Invalid namenode port number"); done: FUNC_LEAVE_NOAPI(ret_value) +} /* H5FD__hdfs_validate_config() */ + + +/*------------------------------------------------------------------------- + * Function: H5Pset_fapl_hdfs + * + * Purpose: Modify the file access property list to use the H5FD_HDFS + * driver defined in this source file. All driver specfic + * properties are passed in as a pointer to a suitably + * initialized instance of H5FD_hdfs_fapl_t + * + * Return: SUCCEED/FAIL + * + * Programmer: John Mainzer + * 9/10/17 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pset_fapl_hdfs(hid_t fapl_id, H5FD_hdfs_fapl_t *fa) +{ + H5P_genplist_t *plist = NULL; /* Property list pointer */ + herr_t ret_value = FAIL; -} /* H5FD_hdfs_validate_config() */ + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "i*x", fapl_id, fa); + + HDassert(fa != NULL); + +#if HDFS_DEBUG + HDfprintf(stdout, "called %s.\n", FUNC); +#endif + + plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS); + if(plist == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") + if(FAIL == H5FD__hdfs_validate_config(fa)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid hdfs config") + + ret_value = H5P_set_driver(plist, H5FD_HDFS, (void *)fa); + +done: + FUNC_LEAVE_API(ret_value) +} /* H5Pset_fapl_hdfs() */ /*------------------------------------------------------------------------- @@ -758,13 +664,10 @@ done: * Programmer: John Mainzer * 9/10/17 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t -H5Pget_fapl_hdfs(hid_t fapl_id, - H5FD_hdfs_fapl_t *fa_out) +H5Pget_fapl_hdfs(hid_t fapl_id, H5FD_hdfs_fapl_t *fa_out) { const H5FD_hdfs_fapl_t *fa = NULL; H5P_genplist_t *plist = NULL; @@ -774,40 +677,31 @@ H5Pget_fapl_hdfs(hid_t fapl_id, H5TRACE2("e", "i*x", fapl_id, fa_out); #if HDFS_DEBUG - HDfprintf(stdout, "H5Pget_fapl_hdfs() called.\n"); + HDfprintf(stdout, "called %s.\n", FUNC); #endif - if (fa_out == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "fa_out is NULL") - } + if(fa_out == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "fa_out is NULL") plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS); - if (plist == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, - "not a file access list") - } - if (H5FD_HDFS != H5P_peek_driver(plist)) { - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, - "incorrect VFL driver") - } + if(plist == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access list") + if(H5FD_HDFS != H5P_peek_driver(plist)) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver") fa = (const H5FD_hdfs_fapl_t *)H5P_peek_driver_info(plist); - if (fa == NULL) { - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, - "bad VFL driver info") - } + if(fa == NULL) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info") /* Copy the hdfs fapl data out */ HDmemcpy(fa_out, fa, sizeof(H5FD_hdfs_fapl_t)); done: FUNC_LEAVE_API(ret_value) - } /* H5Pget_fapl_hdfs() */ /*------------------------------------------------------------------------- - * Function: H5FD_hdfs_fapl_get + * Function: H5FD__hdfs_fapl_get * * Purpose: Gets a file access property list which could be used to * create an identical file. @@ -819,24 +713,20 @@ done: * Programmer: John Mainzer * 9/8/17 * - * Modifications: - * *------------------------------------------------------------------------- */ static void * -H5FD_hdfs_fapl_get(H5FD_t *_file) +H5FD__hdfs_fapl_get(H5FD_t *_file) { H5FD_hdfs_t *file = (H5FD_hdfs_t*)_file; H5FD_hdfs_fapl_t *fa = NULL; void *ret_value = NULL; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC fa = (H5FD_hdfs_fapl_t *)H5MM_calloc(sizeof(H5FD_hdfs_fapl_t)); - if (fa == NULL) { - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, - "memory allocation failed") - } + if(fa == NULL) + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "memory allocation failed") /* Copy the fields of the structure */ HDmemcpy(fa, &(file->fa), sizeof(H5FD_hdfs_fapl_t)); @@ -844,17 +734,15 @@ H5FD_hdfs_fapl_get(H5FD_t *_file) ret_value = fa; done: - if (ret_value == NULL && fa != NULL) { + if(ret_value == NULL && fa != NULL) H5MM_xfree(fa); /* clean up on error */ - } FUNC_LEAVE_NOAPI(ret_value) - -} /* H5FD_hdfs_fapl_get() */ +} /* H5FD__hdfs_fapl_get() */ /*------------------------------------------------------------------------- - * Function: H5FD_hdfs_fapl_copy + * Function: H5FD__hdfs_fapl_copy * * Purpose: Copies the hdfs-specific file access properties. * @@ -865,40 +753,34 @@ done: * Programmer: John Mainzer * 9/8/17 * - * Modifications: - * *------------------------------------------------------------------------- */ static void * -H5FD_hdfs_fapl_copy(const void *_old_fa) +H5FD__hdfs_fapl_copy(const void *_old_fa) { const H5FD_hdfs_fapl_t *old_fa = (const H5FD_hdfs_fapl_t*)_old_fa; H5FD_hdfs_fapl_t *new_fa = NULL; void *ret_value = NULL; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC new_fa = (H5FD_hdfs_fapl_t *)H5MM_malloc(sizeof(H5FD_hdfs_fapl_t)); - if (new_fa == NULL) { - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, - "memory allocation failed") - } + if(new_fa == NULL) + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "memory allocation failed") HDmemcpy(new_fa, old_fa, sizeof(H5FD_hdfs_fapl_t)); ret_value = new_fa; done: - if (ret_value == NULL && new_fa != NULL) { + if(ret_value == NULL && new_fa != NULL) H5MM_xfree(new_fa); /* clean up on error */ - } FUNC_LEAVE_NOAPI(ret_value) - -} /* H5FD_hdfs_fapl_copy() */ +} /* H5FD__hdfs_fapl_copy() */ /*------------------------------------------------------------------------- - * Function: H5FD_hdfs_fapl_free + * Function: H5FD__hdfs_fapl_free * * Purpose: Frees the hdfs-specific file access properties. * @@ -907,30 +789,27 @@ done: * Programmer: John Mainzer * 9/8/17 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5FD_hdfs_fapl_free(void *_fa) +H5FD__hdfs_fapl_free(void *_fa) { H5FD_hdfs_fapl_t *fa = (H5FD_hdfs_fapl_t*)_fa; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(fa != NULL); /* sanity check */ H5MM_xfree(fa); FUNC_LEAVE_NOAPI(SUCCEED) +} /* H5FD__hdfs_fapl_free() */ -} /* H5FD_hdfs_fapl_free() */ #if HDFS_STATS - /*---------------------------------------------------------------------------- * - * Function: hdfs_reset_stats() + * Function: hdfs__reset_stats() * * Purpose: * @@ -947,28 +826,24 @@ H5FD_hdfs_fapl_free(void *_fa) * Programmer: Jacob Smith * 2017-12-08 * - * Changes: None. - * *---------------------------------------------------------------------------- */ static herr_t -hdfs_reset_stats(H5FD_hdfs_t *file) +hdfs__reset_stats(H5FD_hdfs_t *file) { unsigned i = 0; herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC #if HDFS_DEBUG - HDprintf("hdfs_reset_stats() called\n"); + HDprintf("hdfs__reset_stats() called\n"); #endif - if (file == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "file was null") - } + if(file == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file was null") - for (i = 0; i <= HDFS_STATS_BIN_COUNT; i++) { + for(i = 0; i <= HDFS_STATS_BIN_COUNT; i++) { file->raw[i].bytes = 0; file->raw[i].count = 0; file->raw[i].min = (unsigned long long)HDFS_STATS_STARTING_MIN; @@ -983,13 +858,13 @@ hdfs_reset_stats(H5FD_hdfs_t *file) done: FUNC_LEAVE_NOAPI(ret_value); -} /* hdfs_reset_stats */ +} /* hdfs__reset_stats */ #endif /* HDFS_STATS */ /*------------------------------------------------------------------------- * - * Function: H5FD_hdfs_open() + * Function: H5FD__hdfs_open() * * Purpose: * @@ -1008,137 +883,78 @@ done: * Programmer: Jacob Smith * 2017-11-02 * - * Changes: None. - * *------------------------------------------------------------------------- */ -#ifdef H5_HAVE_LIBHDFS static H5FD_t * -H5FD_hdfs_open( - const char *path, - unsigned flags, - hid_t fapl_id, - haddr_t maxaddr) +H5FD__hdfs_open(const char *path, unsigned flags, hid_t fapl_id, haddr_t maxaddr) { H5FD_t *ret_value = NULL; H5FD_hdfs_t *file = NULL; hdfs_t *handle = NULL; H5FD_hdfs_fapl_t fa; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC #if HDFS_DEBUG - HDfprintf(stdout, "H5FD_hdfs_open() called.\n"); + HDfprintf(stdout, "called %s.\n", FUNC); #endif /* HDFS_DEBUG */ /* Sanity check on file offsets */ HDcompile_assert(sizeof(HDoff_t) >= sizeof(size_t)); /* Check arguments */ - if (!path || !*path) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "invalid file name") - } - if (0 == maxaddr || HADDR_UNDEF == maxaddr) { - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, - "bogus maxaddr") - } - if (ADDR_OVERFLOW(maxaddr)) { - HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, NULL, - "bogus maxaddr") - } - if (flags != H5F_ACC_RDONLY) { - HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, NULL, - "only Read-Only access allowed") - } - if (fapl_id == H5P_DEFAULT || fapl_id == H5P_FILE_ACCESS_DEFAULT) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "fapl cannot be H5P_DEFAULT") - } - if (FAIL == H5Pget_fapl_hdfs(fapl_id, &fa)) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "can't get property list") - } - - handle = H5FD_hdfs_handle_open( - path, - fa.namenode_name, - fa.namenode_port, - fa.user_name, - fa.kerberos_ticket_cache, - fa.stream_buffer_size); - - if (handle == NULL) { - HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, - "could not open") - } + if(!path || !*path) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid file name") + if(0 == maxaddr || HADDR_UNDEF == maxaddr) + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "bogus maxaddr") + if(ADDR_OVERFLOW(maxaddr)) + HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, NULL, "bogus maxaddr") + if(flags != H5F_ACC_RDONLY) + HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, NULL, "only Read-Only access allowed") + if(fapl_id == H5P_DEFAULT || fapl_id == H5P_FILE_ACCESS_DEFAULT) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "fapl cannot be H5P_DEFAULT") + if(FAIL == H5Pget_fapl_hdfs(fapl_id, &fa)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "can't get property list") + + handle = H5FD__hdfs_handle_open(path, fa.namenode_name, fa.namenode_port, + fa.user_name, fa.kerberos_ticket_cache, fa.stream_buffer_size); + if(handle == NULL) + HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, "could not open") HDassert(handle->magic == HDFS_HDFST_MAGIC); - /* create new file struct - */ + /* Create new file struct */ file = H5FL_CALLOC(H5FD_hdfs_t); - if (file == NULL) { - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, - "unable to allocate file struct") - } + if(file == NULL) + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "unable to allocate file struct") file->hdfs_handle = handle; HDmemcpy(&(file->fa), &fa, sizeof(H5FD_hdfs_fapl_t)); #if HDFS_STATS - if (FAIL == hdfs_reset_stats(file)) { - HGOTO_ERROR(H5E_INTERNAL, H5E_UNINITIALIZED, NULL, - "unable to reset file statistics") - } + if(FAIL == hdfs__reset_stats(file)) + HGOTO_ERROR(H5E_INTERNAL, H5E_UNINITIALIZED, NULL, "unable to reset file statistics") #endif /* HDFS_STATS */ ret_value = (H5FD_t*)file; done: - if (ret_value == NULL) { - if (handle != NULL) { - if (FAIL == H5FD_hdfs_handle_close(handle)) { - HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, NULL, - "unable to close HDFS file handle") - } - } - if (file != NULL) { + if(ret_value == NULL) { + if(handle != NULL) + if(FAIL == H5FD__hdfs_handle_close(handle)) + HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, NULL, "unable to close HDFS file handle") + if(file != NULL) file = H5FL_FREE(H5FD_hdfs_t, file); - } } /* end if null return value (error) */ FUNC_LEAVE_NOAPI(ret_value) +} /* H5FD__hdfs_open() */ -} /* H5FD_hdfs_open() */ - -#else /* H5_HAVE_LIBHDFS not defined */ - -static H5FD_t * -H5FD_hdfs_open( - const char H5_ATTR_UNUSED *path, - unsigned H5_ATTR_UNUSED flags, - hid_t H5_ATTR_UNUSED fapl_id, - haddr_t H5_ATTR_UNUSED maxaddr) -{ - H5FD_t *ret_value = NULL; - - FUNC_ENTER_NOAPI_NOINIT - - HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, NULL, - "Illegal open of unsupported virtual file (hdfs)"); - -done: - FUNC_LEAVE_NOAPI(ret_value) - -} /* H5FD_hdfs_open() */ - -#endif /* H5_HAVE_LIBHDFS */ #if HDFS_STATS /*---------------------------------------------------------------------------- * - * Function: hdfs_fprint_stats() + * Function: hdfs__fprint_stats() * * Purpose: * @@ -1188,14 +1004,10 @@ done: * * Programmer: Jacob Smith * - * Changes: None. - * *---------------------------------------------------------------------------- */ static herr_t -hdfs_fprint_stats( - FILE *stream, - const H5FD_hdfs_t *file) +hdfs__fprint_stats(FILE *stream, const H5FD_hdfs_t *file) { herr_t ret_value = SUCCEED; parsed_url_t *purl = NULL; @@ -1214,49 +1026,43 @@ hdfs_fprint_stats( unsigned suffix_i = 0; const char suffixes[] = { ' ', 'K', 'M', 'G', 'T', 'P' }; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC - if (stream == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "file stream cannot be null" ) - } - if (file == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "file cannot be null") - } - if (file->hdfs_handle == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "hdfs handle cannot be null") - } - if (file->hdfs_handle->magic != HDFS_HDFST_MAGIC) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "hdfs handle has invalid magic") - } + if(stream == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file stream cannot be null") + if(file == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file cannot be null") + if(file->hdfs_handle == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "hdfs handle cannot be null") + if(file->hdfs_handle->magic != HDFS_HDFST_MAGIC) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "hdfs handle has invalid magic") /******************* * AGGREGATE STATS * *******************/ - for (i = 0; i <= HDFS_STATS_BIN_COUNT; i++) { + for(i = 0; i <= HDFS_STATS_BIN_COUNT; i++) { const hdfs_statsbin *r = &file->raw[i]; const hdfs_statsbin *m = &file->meta[i]; - if (m->min < min_meta) { min_meta = m->min; } - if (r->min < min_raw) { min_raw = r->min; } - if (m->max > max_meta) { max_meta = m->max; } - if (r->max > max_raw) { max_raw = r->max; } + if(m->min < min_meta) + min_meta = m->min; + if(r->min < min_raw) + min_raw = r->min; + if(m->max > max_meta) + max_meta = m->max; + if(r->max > max_raw) + max_raw = r->max; count_raw += r->count; count_meta += m->count; bytes_raw += r->bytes; bytes_meta += m->bytes; } - if (count_raw > 0) { + if(count_raw > 0) average_raw = (double)bytes_raw / (double)count_raw; - } - if (count_meta > 0) { + if(count_meta > 0) average_meta = (double)bytes_meta / (double)count_meta; - } /****************** * PRINT OVERVIEW * @@ -1267,9 +1073,8 @@ hdfs_fprint_stats( HDfprintf(stream, "TOTAL BYTES: %llu (%llu meta, %llu raw)\n", bytes_raw + bytes_meta, bytes_meta, bytes_raw); - if (count_raw + count_meta == 0) { + if(count_raw + count_meta == 0) goto done; - } /************************* * PRINT AGGREGATE STATS * @@ -1277,55 +1082,49 @@ hdfs_fprint_stats( HDfprintf(stream, "SIZES meta raw\n"); HDfprintf(stream, " min "); - if (count_meta == 0) { + if(count_meta == 0) HDfprintf(stream, " 0.000 "); - } else { + else { re_dub = (double)min_meta; - for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) { + for(suffix_i = 0; re_dub >= 1024.0; suffix_i++) re_dub /= 1024.0; - } HDassert(suffix_i < sizeof(suffixes)); HDfprintf(stream, "%8.3lf%c ", re_dub, suffixes[suffix_i]); } - if (count_raw == 0) { + if(count_raw == 0) HDfprintf(stream, " 0.000 \n"); - } else { + else { re_dub = (double)min_raw; - for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) { + for(suffix_i = 0; re_dub >= 1024.0; suffix_i++) re_dub /= 1024.0; - } HDassert(suffix_i < sizeof(suffixes)); HDfprintf(stream, "%8.3lf%c\n", re_dub, suffixes[suffix_i]); } HDfprintf(stream, " avg "); re_dub = (double)average_meta; - for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) { + for(suffix_i = 0; re_dub >= 1024.0; suffix_i++) re_dub /= 1024.0; - } HDassert(suffix_i < sizeof(suffixes)); HDfprintf(stream, "%8.3lf%c ", re_dub, suffixes[suffix_i]); re_dub = (double)average_raw; - for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) { + for(suffix_i = 0; re_dub >= 1024.0; suffix_i++) re_dub /= 1024.0; - } HDassert(suffix_i < sizeof(suffixes)); HDfprintf(stream, "%8.3lf%c\n", re_dub, suffixes[suffix_i]); HDfprintf(stream, " max "); re_dub = (double)max_meta; - for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) { + for(suffix_i = 0; re_dub >= 1024.0; suffix_i++) re_dub /= 1024.0; - } HDassert(suffix_i < sizeof(suffixes)); HDfprintf(stream, "%8.3lf%c ", re_dub, suffixes[suffix_i]); re_dub = (double)max_raw; - for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) { + for(suffix_i = 0; re_dub >= 1024.0; suffix_i++) re_dub /= 1024.0; - } HDassert(suffix_i < sizeof(suffixes)); HDfprintf(stream, "%8.3lf%c\n", re_dub, suffixes[suffix_i]); @@ -1338,7 +1137,7 @@ hdfs_fprint_stats( HDfprintf(stream, " up-to meta raw meta raw meta raw\n"); - for (i = 0; i <= HDFS_STATS_BIN_COUNT; i++) { + for(i = 0; i <= HDFS_STATS_BIN_COUNT; i++) { const hdfs_statsbin *m; const hdfs_statsbin *r; unsigned long long range_end = 0; @@ -1353,55 +1152,47 @@ hdfs_fprint_stats( m = &file->meta[i]; r = &file->raw[i]; - if (r->count == 0 && m->count == 0) { + if(r->count == 0 && m->count == 0) continue; - } range_end = hdfs_stats_boundaries[i]; - if (i == HDFS_STATS_BIN_COUNT) { + if(i == HDFS_STATS_BIN_COUNT) { range_end = hdfs_stats_boundaries[i-1]; HDfprintf(stream, ">"); - } else { - HDfprintf(stream, " "); } + else + HDfprintf(stream, " "); bm_val = (double)m->bytes; - for (suffix_i = 0; bm_val >= 1024.0; suffix_i++) { + for(suffix_i = 0; bm_val >= 1024.0; suffix_i++) bm_val /= 1024.0; - } HDassert(suffix_i < sizeof(suffixes)); bm_suffix = suffixes[suffix_i]; br_val = (double)r->bytes; - for (suffix_i = 0; br_val >= 1024.0; suffix_i++) { + for(suffix_i = 0; br_val >= 1024.0; suffix_i++) br_val /= 1024.0; - } HDassert(suffix_i < sizeof(suffixes)); br_suffix = suffixes[suffix_i]; - if (m->count > 0) { + if(m->count > 0) am_val = (double)(m->bytes) / (double)(m->count); - } - for (suffix_i = 0; am_val >= 1024.0; suffix_i++) { + for(suffix_i = 0; am_val >= 1024.0; suffix_i++) am_val /= 1024.0; - } HDassert(suffix_i < sizeof(suffixes)); am_suffix = suffixes[suffix_i]; - if (r->count > 0) { + if(r->count > 0) ar_val = (double)(r->bytes) / (double)(r->count); - } - for (suffix_i = 0; ar_val >= 1024.0; suffix_i++) { + for(suffix_i = 0; ar_val >= 1024.0; suffix_i++) ar_val /= 1024.0; - } HDassert(suffix_i < sizeof(suffixes)); ar_suffix = suffixes[suffix_i]; re_dub = (double)range_end; - for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) { + for(suffix_i = 0; re_dub >= 1024.0; suffix_i++) re_dub /= 1024.0; - } HDassert(suffix_i < sizeof(suffixes)); HDfprintf( @@ -1414,18 +1205,18 @@ hdfs_fprint_stats( br_val, br_suffix, /* rawdata bytes */ am_val, am_suffix, /* metadata average */ ar_val, ar_suffix); /* rawdata average */ - fflush(stream); + HDfflush(stream); } done: FUNC_LEAVE_NOAPI(ret_value); -} /* hdfs_fprint_stats */ +} /* hdfs__fprint_stats */ #endif /* HDFS_STATS */ /*------------------------------------------------------------------------- * - * Function: H5FD_hdfs_close() + * Function: H5FD__hdfs_close() * * Purpose: * @@ -1438,77 +1229,47 @@ done: * Programmer: Jacob Smith * 2017-11-02 * - * Changes: None. - * *------------------------------------------------------------------------- */ -#ifdef H5_HAVE_LIBHDFS - static herr_t -H5FD_hdfs_close(H5FD_t *_file) +H5FD__hdfs_close(H5FD_t *_file) { herr_t ret_value = SUCCEED; H5FD_hdfs_t *file = (H5FD_hdfs_t *)_file; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC #if HDFS_DEBUG - HDfprintf(stdout, "H5FD_hdfs_close() called.\n"); + HDfprintf(stdout, "called %s.\n", FUNC); #endif - /* Sanity checks - */ + /* Sanity checks */ HDassert(file != NULL); HDassert(file->hdfs_handle != NULL); HDassert(file->hdfs_handle->magic == HDFS_HDFST_MAGIC); - /* Close the underlying request handle - */ - if (file->hdfs_handle != NULL) { - if (FAIL == H5FD_hdfs_handle_close(file->hdfs_handle)) { - HGOTO_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, - "unable to close HDFS file handle") - } - } + /* Close the underlying request handle */ + if(file->hdfs_handle != NULL) + if(FAIL == H5FD__hdfs_handle_close(file->hdfs_handle)) + HGOTO_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "unable to close HDFS file handle") #if HDFS_STATS /* TODO: mechanism to re-target stats printout */ - if (FAIL == hdfs_fprint_stats(stdout, file)) { - HGOTO_ERROR(H5E_INTERNAL, H5E_ERROR, FAIL, - "problem while writing file statistics") - } + if(FAIL == hdfs__fprint_stats(stdout, file)) + HGOTO_ERROR(H5E_INTERNAL, H5E_ERROR, FAIL, "problem while writing file statistics") #endif /* HDFS_STATS */ - /* Release the file info - */ + /* Release the file info */ file = H5FL_FREE(H5FD_hdfs_t, file); done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_hdfs_close() */ - -#else /* H5_HAVE_LIBHDFS not defined */ - -static herr_t -H5FD_hdfs_close(H5FD_t H5_ATTR_UNUSED *_file) -{ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI_NOINIT - - HGOTO_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, - "Illegal close of unsupported Virtual File (hdfs)") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_hdfs_close() */ - -#endif /* H5_HAVE_LIBHDFS */ +} /* end H5FD__hdfs_close() */ /*------------------------------------------------------------------------- * - * Function: H5FD_hdfs_cmp() + * Function: H5FD__hdfs_cmp() * * Purpose: * @@ -1522,19 +1283,10 @@ done: * Programmer: Gerd Herber * May 2018 * - * Changes: - * - * + Replace `if (ret_value == 0)` chain with `HGOTO_DONE` jumps. - * Jacob Smith 17 May 2018 - * *------------------------------------------------------------------------- */ -#ifdef H5_HAVE_LIBHDFS - static int -H5FD_hdfs_cmp( - const H5FD_t *_f1, - const H5FD_t *_f2) +H5FD__hdfs_cmp(const H5FD_t *_f1, const H5FD_t *_f2) { int ret_value = 0; const H5FD_hdfs_t *f1 = (const H5FD_hdfs_t *)_f1; @@ -1542,10 +1294,10 @@ H5FD_hdfs_cmp( hdfsFileInfo *finfo1 = NULL; hdfsFileInfo *finfo2 = NULL; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR #if HDFS_DEBUG - HDfprintf(stdout, "H5FD_hdfs_cmp() called.\n"); + HDfprintf(stdout, "called %s.\n", FUNC); #endif /* HDFS_DEBUG */ HDassert(f1->hdfs_handle != NULL); @@ -1558,40 +1310,24 @@ H5FD_hdfs_cmp( HDassert(finfo1 != NULL); HDassert(finfo2 != NULL); - if (finfo1->mKind != finfo2->mKind) { HGOTO_DONE(-1); } - if (finfo1->mName != finfo2->mName) { HGOTO_DONE(-1); } - if (finfo1->mLastMod != finfo2->mLastMod) { HGOTO_DONE(-1); } - if (finfo1->mSize != finfo2->mSize) { HGOTO_DONE(-1); } - if (finfo1->mReplication != finfo2->mReplication) { HGOTO_DONE(-1); } - if (finfo1->mBlockSize != finfo2->mBlockSize) { HGOTO_DONE(-1); } - if (strcmp(finfo1->mOwner, finfo2->mOwner)) { HGOTO_DONE(-1); } - if (strcmp(finfo1->mGroup, finfo2->mGroup)) { HGOTO_DONE(-1); } - if (finfo1->mPermissions != finfo2->mPermissions) { HGOTO_DONE(-1); } - if (finfo1->mLastAccess != finfo2->mLastAccess) { HGOTO_DONE(-1); } + if(finfo1->mKind != finfo2->mKind) { HGOTO_DONE(-1); } + if(finfo1->mName != finfo2->mName) { HGOTO_DONE(-1); } + if(finfo1->mLastMod != finfo2->mLastMod) { HGOTO_DONE(-1); } + if(finfo1->mSize != finfo2->mSize) { HGOTO_DONE(-1); } + if(finfo1->mReplication != finfo2->mReplication) { HGOTO_DONE(-1); } + if(finfo1->mBlockSize != finfo2->mBlockSize) { HGOTO_DONE(-1); } + if(HDstrcmp(finfo1->mOwner, finfo2->mOwner)) { HGOTO_DONE(-1); } + if(HDstrcmp(finfo1->mGroup, finfo2->mGroup)) { HGOTO_DONE(-1); } + if(finfo1->mPermissions != finfo2->mPermissions) { HGOTO_DONE(-1); } + if(finfo1->mLastAccess != finfo2->mLastAccess) { HGOTO_DONE(-1); } done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5FD_hdfs_cmp() */ - -#else /* H5_HAVE_LIBHDFS not defined */ - -static int -H5FD_hdfs_cmp( - const H5FD_t H5_ATTR_UNUSED *_f1, - const H5FD_t H5_ATTR_UNUSED *_f2) -{ - int ret_value = 0; - - FUNC_ENTER_NOAPI_NOINIT_NOERR - - FUNC_LEAVE_NOAPI(ret_value) -} /* H5FD_hdfs_cmp() */ - -#endif /* H5_HAVE_LIBHDFS */ +} /* H5FD__hdfs_cmp() */ /*------------------------------------------------------------------------- - * Function: H5FD_hdfs_query + * Function: H5FD__hdfs_query * * Purpose: Set the flags that this VFL driver is capable of supporting. * (listed in H5FDpublic.h) @@ -1610,28 +1346,26 @@ H5FD_hdfs_cmp( *------------------------------------------------------------------------- */ static herr_t -H5FD_hdfs_query( - const H5FD_t H5_ATTR_UNUSED *_file, - unsigned long *flags) /* out variable */ +H5FD__hdfs_query(const H5FD_t H5_ATTR_UNUSED *_file, unsigned long *flags) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR #if HDFS_DEBUG - HDfprintf(stdout, "H5FD_hdfs_query() called.\n"); + HDfprintf(stdout, "called %s.\n", FUNC); #endif - if (flags) { + if(flags) { *flags = 0; *flags |= H5FD_FEAT_DATA_SIEVE; } FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5FD_hdfs_query() */ +} /* H5FD__hdfs_query() */ /*------------------------------------------------------------------------- * - * Function: H5FD_hdfs_get_eoa() + * Function: H5FD__hdfs_get_eoa() * * Purpose: * @@ -1646,50 +1380,26 @@ H5FD_hdfs_query( * Programmer: Jacob Smith * 2017-11-02 * - * Changes: None. - * *------------------------------------------------------------------------- */ -#ifdef H5_HAVE_LIBHDFS - static haddr_t -H5FD_hdfs_get_eoa( - const H5FD_t *_file, - H5FD_mem_t H5_ATTR_UNUSED type) +H5FD__hdfs_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) { const H5FD_hdfs_t *file = (const H5FD_hdfs_t *)_file; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR #if HDFS_DEBUG - HDfprintf(stdout, "H5FD_hdfs_get_eoa() called.\n"); + HDfprintf(stdout, "called %s.\n", FUNC); #endif FUNC_LEAVE_NOAPI(file->eoa) -} /* end H5FD_hdfs_get_eoa() */ - -#else /* H5_HAVE_LIBHDFS not defined */ - -static haddr_t -H5FD_hdfs_get_eoa( - const H5FD_t H5_ATTR_UNUSED *_file, - H5FD_mem_t H5_ATTR_UNUSED type) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - -#if HDFS_DEBUG - HDfprintf(stdout, "H5FD_hdfs_get_eoa() called.\n"); -#endif - - FUNC_LEAVE_NOAPI(0) -} /* end H5FD_hdfs_get_eoa() */ - -#endif /* H5_HAVE_LIBHDFS */ +} /* end H5FD__hdfs_get_eoa() */ /*------------------------------------------------------------------------- * - * Function: H5FD_hdfs_set_eoa() + * Function: H5FD__hdfs_set_eoa() * * Purpose: * @@ -1702,54 +1412,28 @@ H5FD_hdfs_get_eoa( * Programmer: Jacob Smith * 2017-11-03 * - * Changes: None. - * *------------------------------------------------------------------------- */ -#ifdef H5_HAVE_LIBHDFS - static herr_t -H5FD_hdfs_set_eoa( - H5FD_t *_file, - H5FD_mem_t H5_ATTR_UNUSED type, - haddr_t addr) +H5FD__hdfs_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr) { H5FD_hdfs_t *file = (H5FD_hdfs_t *)_file; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR #if HDFS_DEBUG - HDfprintf(stdout, "H5FD_hdfs_set_eoa() called.\n"); + HDfprintf(stdout, "called %s.\n", FUNC); #endif file->eoa = addr; FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5FD_hdfs_set_eoa() */ - -#else /* H5_HAVE_LIBHDFS not defined */ - -static herr_t -H5FD_hdfs_set_eoa( - H5FD_t H5_ATTR_UNUSED *_file, - H5FD_mem_t H5_ATTR_UNUSED type, - haddr_t H5_ATTR_UNUSED addr) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - -#if HDFS_DEBUG - HDfprintf(stdout, "H5FD_hdfs_set_eoa() called.\n"); -#endif - - FUNC_LEAVE_NOAPI(FAIL) -} /* H5FD_hdfs_set_eoa() */ - -#endif /* H5_HAVE_LIBHDFS */ +} /* H5FD__hdfs_set_eoa() */ /*------------------------------------------------------------------------- * - * Function: H5FD_hdfs_get_eof() + * Function: H5FD__hdfs_get_eof() * * Purpose: * @@ -1765,49 +1449,27 @@ H5FD_hdfs_set_eoa( * *------------------------------------------------------------------------- */ -#ifdef H5_HAVE_LIBHDFS - static haddr_t -H5FD_hdfs_get_eof( - const H5FD_t *_file, - H5FD_mem_t H5_ATTR_UNUSED type) +H5FD__hdfs_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) { const H5FD_hdfs_t *file = (const H5FD_hdfs_t *)_file; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR #if HDFS_DEBUG - HDfprintf(stdout, "H5FD_hdfs_get_eof() called.\n"); + HDfprintf(stdout, "called %s.\n", FUNC); #endif HDassert(file->hdfs_handle != NULL); HDassert(file->hdfs_handle->magic == HDFS_HDFST_MAGIC); FUNC_LEAVE_NOAPI((size_t) file->hdfs_handle->fileinfo->mSize) -} /* end H5FD_hdfs_get_eof() */ - -#else /* H5_HAVE_LIBHDFS not defined */ - -static haddr_t -H5FD_hdfs_get_eof( - const H5FD_t H5_ATTR_UNUSED *_file, - H5FD_mem_t H5_ATTR_UNUSED type) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - -#if HDFS_DEBUG - HDfprintf(stdout, "H5FD_hdfs_get_eof() called.\n"); -#endif - - FUNC_LEAVE_NOAPI((size_t)0) -} /* end H5FD_hdfs_get_eof() */ - -#endif /* H5_HAVE_LIBHDFS */ +} /* end H5FD__hdfs_get_eof() */ /*------------------------------------------------------------------------- * - * Function: H5FD_hdfs_get_handle() + * Function: H5FD__hdfs_get_handle() * * Purpose: * @@ -1820,67 +1482,33 @@ H5FD_hdfs_get_eof( * Programmer: Jacob Smith * 2017-11-02 * - * Changes: None. - * *------------------------------------------------------------------------- */ -#ifdef H5_HAVE_LIBHDFS - static herr_t -H5FD_hdfs_get_handle( - H5FD_t *_file, - hid_t H5_ATTR_UNUSED fapl, - void **file_handle) +H5FD__hdfs_get_handle(H5FD_t *_file, hid_t H5_ATTR_UNUSED fapl, void **file_handle) { herr_t ret_value = SUCCEED; H5FD_hdfs_t *file = (H5FD_hdfs_t *)_file; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC #if HDFS_DEBUG - HDfprintf(stdout, "H5FD_hdfs_get_handle() called.\n"); + HDfprintf(stdout, "called %s.\n", FUNC); #endif /* HDFS_DEBUG */ - if (!file_handle) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "file handle not valid") - } + if(!file_handle) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file handle not valid") *file_handle = file->hdfs_handle; done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_hdfs_get_handle() */ - -#else /* H5_HAVE_LIBHDFS not defined */ - -static herr_t -H5FD_hdfs_get_handle( - H5FD_t H5_ATTR_UNUSED *_file, - hid_t H5_ATTR_UNUSED fapl, - void H5_ATTR_UNUSED **file_handle) -{ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI_NOINIT - -#if HDFS_DEBUG - HDfprintf(stdout, "H5FD_hdfs_get_handle() called.\n"); -#endif /* HDFS_DEBUG */ - - HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, - "Illegal get-handle of unsupported virtual file (hdfs)"); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_hdfs_get_handle() */ - -#endif /* H5_HAVE_LIBHDFS */ +} /* end H5FD__hdfs_get_handle() */ /*------------------------------------------------------------------------- * - * Function: H5FD_hdfs_read() + * Function: H5FD__hdfs_read() * * Purpose: * @@ -1898,20 +1526,11 @@ done: * Programmer: Jacob Smith * 2017-11-?? * - * Changes: None. - * *------------------------------------------------------------------------- */ -#ifdef H5_HAVE_LIBHDFS - static herr_t -H5FD_hdfs_read( - H5FD_t *_file, - H5FD_mem_t H5_ATTR_UNUSED type, - hid_t H5_ATTR_UNUSED dxpl_id, - haddr_t addr, /* start offset */ - size_t size, /* length of read */ - void *buf) /* out */ +H5FD__hdfs_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, + hid_t H5_ATTR_UNUSED dxpl_id, haddr_t addr, size_t size, void *buf) { herr_t ret_value = SUCCEED; H5FD_hdfs_t *file = (H5FD_hdfs_t *)_file; @@ -1922,10 +1541,10 @@ H5FD_hdfs_read( unsigned bin_i = 0; #endif /* HDFS_STATS */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC #if HDFS_DEBUG - HDfprintf(stdout, "H5FD_hdfs_read() called.\n"); + HDfprintf(stdout, "called %s.\n", FUNC); #endif /* HDFS_DEBUG */ HDassert(file != NULL); @@ -1935,44 +1554,33 @@ H5FD_hdfs_read( filesize = (size_t) file->hdfs_handle->fileinfo->mSize; - if ((addr > filesize) || ((addr + size) > filesize)) { - HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, - "range exceeds file address") - } + if((addr > filesize) || ((addr + size) > filesize)) + HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "range exceeds file address") - if (FAIL == hdfsPread( - file->hdfs_handle->filesystem, - file->hdfs_handle->file, - (tOffset)addr, - buf, - (tSize)size)) - { - HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, - "unable to execute read") - } + if(FAIL == hdfsPread(file->hdfs_handle->filesystem, file->hdfs_handle->file, + (tOffset)addr, buf, (tSize)size)) + HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "unable to execute read") #if HDFS_STATS - /* Find which "bin" this read fits in. Can be "overflow" bin. - */ - for (bin_i = 0; bin_i < HDFS_STATS_BIN_COUNT; bin_i++) { - if ((unsigned long long)size < hdfs_stats_boundaries[bin_i]) { + /* Find which "bin" this read fits in. Can be "overflow" bin. */ + for(bin_i = 0; bin_i < HDFS_STATS_BIN_COUNT; bin_i++) + if((unsigned long long)size < hdfs_stats_boundaries[bin_i]) break; - } - } bin = (type == H5FD_MEM_DRAW) ? &file->raw[bin_i] : &file->meta[bin_i]; - /* Store collected stats in appropriate bin - */ - if (bin->count == 0) { + /* Store collected stats in appropriate bin */ + if(bin->count == 0) { bin->min = size; bin->max = size; } else { - if (size < bin->min) { bin->min = size; } - if (size > bin->max) { bin->max = size; } + if(size < bin->min) + bin->min = size; + if(size > bin->max) + bin->max = size; } bin->count++; bin->bytes += (unsigned long long)size; @@ -1981,40 +1589,12 @@ H5FD_hdfs_read( done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_hdfs_read() */ - -#else /* H5_HAVE_LIBHDFS not defined */ - -static herr_t -H5FD_hdfs_read( - H5FD_t H5_ATTR_UNUSED *_file, - H5FD_mem_t H5_ATTR_UNUSED type, - hid_t H5_ATTR_UNUSED dxpl_id, - haddr_t H5_ATTR_UNUSED addr, - size_t H5_ATTR_UNUSED size, - void H5_ATTR_UNUSED *buf) -{ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI_NOINIT - -#if HDFS_DEBUG - HDfprintf(stdout, "H5FD_hdfs_read() called.\n"); -#endif /* HDFS_DEBUG */ - - HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, - "Illegal get-handle of unsupported virtual file (hdfs)"); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_hdfs_read() */ - -#endif /* H5_HAVE_LIBHDFS */ +} /* end H5FD__hdfs_read() */ /*------------------------------------------------------------------------- * - * Function: H5FD_hdfs_write() + * Function: H5FD__hdfs_write() * * Purpose: * @@ -2028,38 +1608,31 @@ done: * Programmer: Jacob Smith * 2017-10-23 * - * Changes: None. - * *------------------------------------------------------------------------- */ static herr_t -H5FD_hdfs_write( - H5FD_t H5_ATTR_UNUSED *_file, - H5FD_mem_t H5_ATTR_UNUSED type, - hid_t H5_ATTR_UNUSED dxpl_id, - haddr_t H5_ATTR_UNUSED addr, - size_t H5_ATTR_UNUSED size, - const void H5_ATTR_UNUSED *buf) +H5FD__hdfs_write(H5FD_t H5_ATTR_UNUSED *_file, H5FD_mem_t H5_ATTR_UNUSED type, + hid_t H5_ATTR_UNUSED dxpl_id, haddr_t H5_ATTR_UNUSED addr, size_t H5_ATTR_UNUSED size, + const void H5_ATTR_UNUSED *buf) { herr_t ret_value = FAIL; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC #if HDFS_DEBUG - HDfprintf(stdout, "H5FD_hdfs_write() called.\n"); + HDfprintf(stdout, "called %s.\n", FUNC); #endif - HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, - "cannot write to read-only file.") + HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "cannot write to read-only file") done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5FD_hdfs_write() */ +} /* H5FD__hdfs_write() */ /*------------------------------------------------------------------------- * - * Function: H5FD_hdfs_truncate() + * Function: H5FD__hdfs_truncate() * * Purpose: * @@ -2075,35 +1648,30 @@ done: * Programmer: Jacob Smith * 2017-10-23 * - * Changes: None. - * *------------------------------------------------------------------------- */ static herr_t -H5FD_hdfs_truncate( - H5FD_t H5_ATTR_UNUSED *_file, - hid_t H5_ATTR_UNUSED dxpl_id, - hbool_t H5_ATTR_UNUSED closing) +H5FD__hdfs_truncate(H5FD_t H5_ATTR_UNUSED *_file, hid_t H5_ATTR_UNUSED dxpl_id, + hbool_t H5_ATTR_UNUSED closing) { herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC #if HDFS_DEBUG - HDfprintf(stdout, "H5FD_hdfs_truncate() called.\n"); + HDfprintf(stdout, "called %s.\n", FUNC); #endif - HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, - "cannot truncate read-only file.") + HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "cannot truncate read-only file") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_hdfs_truncate() */ +} /* end H5FD__hdfs_truncate() */ /*------------------------------------------------------------------------- * - * Function: H5FD_hdfs_lock() + * Function: H5FD__hdfs_lock() * * Purpose: * @@ -2120,23 +1688,22 @@ done: * Programmer: Jacob Smith * 2017-11-03 * - * Changes: None. - * *------------------------------------------------------------------------- */ static herr_t -H5FD_hdfs_lock( +H5FD__hdfs_lock( H5FD_t H5_ATTR_UNUSED *_file, hbool_t H5_ATTR_UNUSED rw) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR + FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5FD_hdfs_lock() */ +} /* end H5FD__hdfs_lock() */ /*------------------------------------------------------------------------- * - * Function: H5FD_hdfs_unlock() + * Function: H5FD__hdfs_unlock() * * Purpose: * @@ -2150,14 +1717,14 @@ H5FD_hdfs_lock( * Programmer: Jacob Smith * 2017-11-03 * - * Changes: None. - * *------------------------------------------------------------------------- */ static herr_t -H5FD_hdfs_unlock(H5FD_t H5_ATTR_UNUSED *_file) +H5FD__hdfs_unlock(H5FD_t H5_ATTR_UNUSED *_file) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR + FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5FD_hdfs_unlock() */ +} /* end H5FD__hdfs_unlock() */ +#endif /* H5_HAVE_LIBHDFS */ diff --git a/src/H5FDhdfs.h b/src/H5FDhdfs.h index 37252f0..d67ab9e 100644 --- a/src/H5FDhdfs.h +++ b/src/H5FDhdfs.h @@ -22,8 +22,13 @@ #ifndef H5FDhdfs_H #define H5FDhdfs_H -#define H5FD_HDFS (H5FD_hdfs_init()) +#ifdef H5_HAVE_LIBHDFS +#define H5FD_HDFS (H5FD_hdfs_init()) +#else /* H5_HAVE_LIBHDFS */ +#define H5FD_HDFS (-1) +#endif /* H5_HAVE_LIBHDFS */ +#ifdef H5_HAVE_LIBHDFS #ifdef __cplusplus extern "C" { #endif @@ -90,8 +95,6 @@ extern "C" { * Programmer: Jacob Smith * 2018-04-23 * - * Changes: None - * ****************************************************************************/ #define H5FD__CURR_HDFS_FAPL_T_VERSION 1 @@ -116,7 +119,7 @@ H5_DLL herr_t H5Pset_fapl_hdfs(hid_t fapl_id, H5FD_hdfs_fapl_t *fa); #ifdef __cplusplus } #endif +#endif /* H5_HAVE_LIBHDFS */ #endif /* ifndef H5FDhdfs_H */ - diff --git a/src/H5FDlog.c b/src/H5FDlog.c index 3a563d0..b72b656 100644 --- a/src/H5FDlog.c +++ b/src/H5FDlog.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, April 17, 2000 * * Purpose: The POSIX unbuffered file driver using only the HDF5 public @@ -40,6 +40,9 @@ /* The driver identification number, initialized at runtime */ static hid_t H5FD_LOG_g = 0; +/* Whether to ignore file locks when disabled (env var value) */ +static htri_t ignore_disabled_file_locks_s = FAIL; + /* Driver-specific file access properties */ typedef struct H5FD_log_fapl_t { char *logfile; /* Allocated log file name */ @@ -80,6 +83,7 @@ typedef struct H5FD_log_t { haddr_t eof; /* end of file; current file size */ haddr_t pos; /* current file I/O position */ H5FD_file_op_t op; /* last operation */ + hbool_t ignore_disabled_file_locks; char filename[H5FD_MAX_FILENAME_LEN]; /* Copy of file name from open operation */ #ifndef H5_HAVE_WIN32_API /* On most systems the combination of device and i-node number uniquely @@ -151,73 +155,73 @@ typedef struct H5FD_log_t { * which can be addressed entirely by the second * argument of the file seek function. */ -#define MAXADDR (((haddr_t)1<<(8*sizeof(HDoff_t)-1))-1) -#define ADDR_OVERFLOW(A) (HADDR_UNDEF==(A) || ((A) & ~(haddr_t)MAXADDR)) +#define MAXADDR (((haddr_t)1 << (8 * sizeof(HDoff_t) - 1)) - 1) +#define ADDR_OVERFLOW(A) (HADDR_UNDEF == (A) || ((A) & ~(haddr_t)MAXADDR)) #define SIZE_OVERFLOW(Z) ((Z) & ~(hsize_t)MAXADDR) #define REGION_OVERFLOW(A,Z) (ADDR_OVERFLOW(A) || SIZE_OVERFLOW(Z) || \ - HADDR_UNDEF==(A)+(Z) || \ - (HDoff_t)((A)+(Z))<(HDoff_t)(A)) + HADDR_UNDEF == (A) + (Z) || \ + (HDoff_t)((A) + (Z)) < (HDoff_t)(A)) /* Prototypes */ -static herr_t H5FD_log_term(void); -static void *H5FD_log_fapl_get(H5FD_t *file); -static void *H5FD_log_fapl_copy(const void *_old_fa); -static herr_t H5FD_log_fapl_free(void *_fa); -static H5FD_t *H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id, +static herr_t H5FD__log_term(void); +static void *H5FD__log_fapl_get(H5FD_t *file); +static void *H5FD__log_fapl_copy(const void *_old_fa); +static herr_t H5FD__log_fapl_free(void *_fa); +static H5FD_t *H5FD__log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr); -static herr_t H5FD_log_close(H5FD_t *_file); -static int H5FD_log_cmp(const H5FD_t *_f1, const H5FD_t *_f2); -static herr_t H5FD_log_query(const H5FD_t *_f1, unsigned long *flags); -static haddr_t H5FD_log_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size); +static herr_t H5FD__log_close(H5FD_t *_file); +static int H5FD__log_cmp(const H5FD_t *_f1, const H5FD_t *_f2); +static herr_t H5FD__log_query(const H5FD_t *_f1, unsigned long *flags); +static haddr_t H5FD__log_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size); static herr_t H5FD__log_free(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t size); -static haddr_t H5FD_log_get_eoa(const H5FD_t *_file, H5FD_mem_t type); -static herr_t H5FD_log_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr); -static haddr_t H5FD_log_get_eof(const H5FD_t *_file, H5FD_mem_t type); -static herr_t H5FD_log_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle); -static herr_t H5FD_log_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, +static haddr_t H5FD__log_get_eoa(const H5FD_t *_file, H5FD_mem_t type); +static herr_t H5FD__log_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr); +static haddr_t H5FD__log_get_eof(const H5FD_t *_file, H5FD_mem_t type); +static herr_t H5FD__log_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle); +static herr_t H5FD__log_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, void *buf); -static herr_t H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, +static herr_t H5FD__log_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, const void *buf); -static herr_t H5FD_log_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); -static herr_t H5FD_log_lock(H5FD_t *_file, hbool_t rw); -static herr_t H5FD_log_unlock(H5FD_t *_file); +static herr_t H5FD__log_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); +static herr_t H5FD__log_lock(H5FD_t *_file, hbool_t rw); +static herr_t H5FD__log_unlock(H5FD_t *_file); static const H5FD_class_t H5FD_log_g = { - "log", /*name */ - MAXADDR, /*maxaddr */ - H5F_CLOSE_WEAK, /* fc_degree */ - H5FD_log_term, /*terminate */ - NULL, /*sb_size */ - NULL, /*sb_encode */ - NULL, /*sb_decode */ - sizeof(H5FD_log_fapl_t), /*fapl_size */ - H5FD_log_fapl_get, /*fapl_get */ - H5FD_log_fapl_copy, /*fapl_copy */ - H5FD_log_fapl_free, /*fapl_free */ - 0, /*dxpl_size */ - NULL, /*dxpl_copy */ - NULL, /*dxpl_free */ - H5FD_log_open, /*open */ - H5FD_log_close, /*close */ - H5FD_log_cmp, /*cmp */ - H5FD_log_query, /*query */ - NULL, /*get_type_map */ - H5FD_log_alloc, /*alloc */ - H5FD__log_free, /*free */ - H5FD_log_get_eoa, /*get_eoa */ - H5FD_log_set_eoa, /*set_eoa */ - H5FD_log_get_eof, /*get_eof */ - H5FD_log_get_handle, /*get_handle */ - H5FD_log_read, /*read */ - H5FD_log_write, /*write */ - NULL, /*read_vector */ - NULL, /*write_vector */ - NULL, /*flush */ - H5FD_log_truncate, /*truncate */ - H5FD_log_lock, /*lock */ - H5FD_log_unlock, /*unlock */ - H5FD_FLMAP_DICHOTOMY /*fl_map */ + "log", /* name */ + MAXADDR, /* maxaddr */ + H5F_CLOSE_WEAK, /* fc_degree */ + H5FD__log_term, /* terminate */ + NULL, /* sb_size */ + NULL, /* sb_encode */ + NULL, /* sb_decode */ + sizeof(H5FD_log_fapl_t), /* fapl_size */ + H5FD__log_fapl_get, /* fapl_get */ + H5FD__log_fapl_copy, /* fapl_copy */ + H5FD__log_fapl_free, /* fapl_free */ + 0, /* dxpl_size */ + NULL, /* dxpl_copy */ + NULL, /* dxpl_free */ + H5FD__log_open, /* open */ + H5FD__log_close, /* close */ + H5FD__log_cmp, /* cmp */ + H5FD__log_query, /* query */ + NULL, /* get_type_map */ + H5FD__log_alloc, /* alloc */ + H5FD__log_free, /* free */ + H5FD__log_get_eoa, /* get_eoa */ + H5FD__log_set_eoa, /* set_eoa */ + H5FD__log_get_eof, /* get_eof */ + H5FD__log_get_handle, /* get_handle */ + H5FD__log_read, /* read */ + H5FD__log_write, /* write */ + NULL, /* read vector */ + NULL, /* write vector */ + NULL, /* flush */ + H5FD__log_truncate, /* truncate */ + H5FD__log_lock, /* lock */ + H5FD__log_unlock, /* unlock */ + H5FD_FLMAP_DICHOTOMY /* fl_map */ }; /* Declare a free list to manage the H5FD_log_t struct */ @@ -236,10 +240,20 @@ H5FL_DEFINE_STATIC(H5FD_log_t); static herr_t H5FD__init_package(void) { + char *lock_env_var = NULL; /* Environment variable pointer */ herr_t ret_value = SUCCEED; FUNC_ENTER_STATIC + /* Check the use disabled file locks environment variable */ + lock_env_var = HDgetenv("HDF5_USE_FILE_LOCKING"); + if(lock_env_var && !HDstrcmp(lock_env_var, "BEST_EFFORT")) + ignore_disabled_file_locks_s = TRUE; /* Override: Ignore disabled locks */ + else if(lock_env_var && (!HDstrcmp(lock_env_var, "TRUE") || !HDstrcmp(lock_env_var, "1"))) + ignore_disabled_file_locks_s = FALSE; /* Override: Don't ignore disabled locks */ + else + ignore_disabled_file_locks_s = FAIL; /* Environment variable not set, or not set correctly */ + if(H5FD_log_init() < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to initialize log VFD") @@ -281,7 +295,7 @@ done: /*--------------------------------------------------------------------------- - * Function: H5FD_log_term + * Function: H5FD__log_term * * Purpose: Shut down the VFD * @@ -293,15 +307,15 @@ done: *--------------------------------------------------------------------------- */ static herr_t -H5FD_log_term(void) +H5FD__log_term(void) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Reset VFL ID */ H5FD_LOG_g = 0; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5FD_log_term() */ +} /* end H5FD__log_term() */ /*------------------------------------------------------------------------- @@ -354,7 +368,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_log_fapl_get + * Function: H5FD__log_fapl_get * * Purpose: Returns a file access property list which indicates how the * specified file is being accessed. The return list could be @@ -370,22 +384,22 @@ done: *------------------------------------------------------------------------- */ static void * -H5FD_log_fapl_get(H5FD_t *_file) +H5FD__log_fapl_get(H5FD_t *_file) { H5FD_log_t *file = (H5FD_log_t *)_file; void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Set return value */ - ret_value = H5FD_log_fapl_copy(&(file->fa)); + ret_value = H5FD__log_fapl_copy(&(file->fa)); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_log_fapl_get() */ +} /* end H5FD__log_fapl_get() */ /*------------------------------------------------------------------------- - * Function: H5FD_log_fapl_copy + * Function: H5FD__log_fapl_copy * * Purpose: Copies the log-specific file access properties. * @@ -398,13 +412,13 @@ H5FD_log_fapl_get(H5FD_t *_file) *------------------------------------------------------------------------- */ static void * -H5FD_log_fapl_copy(const void *_old_fa) +H5FD__log_fapl_copy(const void *_old_fa) { const H5FD_log_fapl_t *old_fa = (const H5FD_log_fapl_t*)_old_fa; H5FD_log_fapl_t *new_fa = NULL; /* New FAPL info */ void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(old_fa); @@ -432,11 +446,11 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_log_fapl_copy() */ +} /* end H5FD__log_fapl_copy() */ /*------------------------------------------------------------------------- - * Function: H5FD_log_fapl_free + * Function: H5FD__log_fapl_free * * Purpose: Frees the log-specific file access properties. * @@ -448,11 +462,11 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_log_fapl_free(void *_fa) +H5FD__log_fapl_free(void *_fa) { H5FD_log_fapl_t *fa = (H5FD_log_fapl_t*)_fa; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Free the fapl information */ if(fa->logfile) @@ -460,11 +474,11 @@ H5FD_log_fapl_free(void *_fa) H5MM_xfree(fa); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5FD_log_fapl_free() */ +} /* end H5FD__log_fapl_free() */ /*------------------------------------------------------------------------- - * Function: H5FD_log_open + * Function: H5FD__log_open * * Purpose: Create and/or opens a file as an HDF5 file. * @@ -479,7 +493,7 @@ H5FD_log_fapl_free(void *_fa) *------------------------------------------------------------------------- */ static H5FD_t * -H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) +H5FD__log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) { H5FD_log_t *file = NULL; H5P_genplist_t *plist; /* Property list */ @@ -489,15 +503,12 @@ H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) #ifdef H5_HAVE_WIN32_API struct _BY_HANDLE_FILE_INFORMATION fileinfo; #endif -#ifdef H5_HAVE_GETTIMEOFDAY - struct timeval timeval_start; - struct timeval open_timeval_diff; - struct timeval stat_timeval_diff; -#endif /* H5_HAVE_GETTIMEOFDAY */ + H5_timer_t open_timer; /* Timer for open() call */ + H5_timer_t stat_timer; /* Timer for stat() call */ h5_stat_t sb; H5FD_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity check on file offsets */ HDcompile_assert(sizeof(HDoff_t) >= sizeof(size_t)); @@ -525,54 +536,36 @@ H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) if(NULL == (fa = (const H5FD_log_fapl_t *)H5P_peek_driver_info(plist))) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, NULL, "bad VFL driver info") -#ifdef H5_HAVE_GETTIMEOFDAY - if(fa->flags & H5FD_LOG_TIME_OPEN) - HDgettimeofday(&timeval_start, NULL); -#endif /* H5_HAVE_GETTIMEOFDAY */ + /* Start timer for open() call */ + if(fa->flags & H5FD_LOG_TIME_OPEN) { + H5_timer_init(&open_timer); + H5_timer_start(&open_timer); + } /* end if */ + /* Open the file */ if((fd = HDopen(name, o_flags, H5_POSIX_CREATE_MODE_RW)) < 0) { int myerrno = errno; HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file: name = '%s', errno = %d, error message = '%s', flags = %x, o_flags = %x", name, myerrno, HDstrerror(myerrno), flags, (unsigned)o_flags); } /* end if */ -#ifdef H5_HAVE_GETTIMEOFDAY - if(fa->flags & H5FD_LOG_TIME_OPEN) { - struct timeval timeval_stop; - HDgettimeofday(&timeval_stop, NULL); + /* Stop timer for open() call */ + if(fa->flags & H5FD_LOG_TIME_OPEN) + H5_timer_stop(&open_timer); - /* Calculate the elapsed gettimeofday time */ - open_timeval_diff.tv_usec = timeval_stop.tv_usec - timeval_start.tv_usec; - open_timeval_diff.tv_sec = timeval_stop.tv_sec - timeval_start.tv_sec; - if(open_timeval_diff.tv_usec < 0) { - open_timeval_diff.tv_usec += 1000000; - open_timeval_diff.tv_sec--; - } /* end if */ + /* Start timer for stat() call */ + if(fa->flags & H5FD_LOG_TIME_STAT) { + H5_timer_init(&stat_timer); + H5_timer_start(&stat_timer); } /* end if */ -#endif /* H5_HAVE_GETTIMEOFDAY */ -#ifdef H5_HAVE_GETTIMEOFDAY - if(fa->flags & H5FD_LOG_TIME_STAT) - HDgettimeofday(&timeval_start, NULL); -#endif /* H5_HAVE_GETTIMEOFDAY */ /* Get the file stats */ if(HDfstat(fd, &sb) < 0) HSYS_GOTO_ERROR(H5E_FILE, H5E_BADFILE, NULL, "unable to fstat file") -#ifdef H5_HAVE_GETTIMEOFDAY - if(fa->flags & H5FD_LOG_TIME_STAT) { - struct timeval timeval_stop; - HDgettimeofday(&timeval_stop, NULL); - - /* Calculate the elapsed gettimeofday time */ - stat_timeval_diff.tv_usec = timeval_stop.tv_usec - timeval_start.tv_usec; - stat_timeval_diff.tv_sec = timeval_stop.tv_sec - timeval_start.tv_sec; - if(stat_timeval_diff.tv_usec < 0) { - stat_timeval_diff.tv_usec += 1000000; - stat_timeval_diff.tv_sec--; - } /* end if */ - } /* end if */ -#endif /* H5_HAVE_GETTIMEOFDAY */ + /* Stop timer for stat() call */ + if(fa->flags & H5FD_LOG_TIME_STAT) + H5_timer_stop(&stat_timer); /* Create the new file struct */ if(NULL == (file = H5FL_CALLOC(H5FD_log_t))) @@ -633,15 +626,31 @@ H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) else file->logfp = stderr; -#ifdef H5_HAVE_GETTIMEOFDAY - if(file->fa.flags & H5FD_LOG_TIME_OPEN) - HDfprintf(file->logfp, "Open took: (%f s)\n", (double)open_timeval_diff.tv_sec + ((double)open_timeval_diff.tv_usec / (double)1000000.0f)); - if(file->fa.flags & H5FD_LOG_TIME_STAT) - HDfprintf(file->logfp, "Stat took: (%f s)\n", (double)stat_timeval_diff.tv_sec + ((double)stat_timeval_diff.tv_usec / (double)1000000.0f)); -#endif /* H5_HAVE_GETTIMEOFDAY */ + /* Log the timer values */ + if(file->fa.flags & H5FD_LOG_TIME_OPEN) { + H5_timevals_t open_times; /* Elapsed time for open() call */ + + H5_timer_get_times(open_timer, &open_times); + HDfprintf(file->logfp, "Open took: (%f s)\n", open_times.elapsed); + } /* end if */ + if(file->fa.flags & H5FD_LOG_TIME_STAT) { + H5_timevals_t stat_times; /* Elapsed time for stat() call */ + H5_timer_get_times(stat_timer, &stat_times); + HDfprintf(file->logfp, "Stat took: (%f s)\n", stat_times.elapsed); + } /* end if */ } /* end if */ + /* Check the file locking flags in the fapl */ + if(ignore_disabled_file_locks_s != FAIL) + /* The environment variable was set, so use that preferentially */ + file->ignore_disabled_file_locks = ignore_disabled_file_locks_s; + else { + /* Use the value in the property list */ + if(H5P_get(plist, H5F_ACS_IGNORE_DISABLED_FILE_LOCKS_NAME, &file->ignore_disabled_file_locks) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get ignore disabled file locks property") + } + /* Check for non-default FAPL */ if(H5P_FILE_ACCESS_DEFAULT != fapl_id) { /* This step is for h5repart tool only. If user wants to change file driver from @@ -666,11 +675,11 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_log_open() */ +} /* end H5FD__log_open() */ /*------------------------------------------------------------------------- - * Function: H5FD_log_close + * Function: H5FD__log_close * * Purpose: Closes an HDF5 file. * @@ -683,30 +692,30 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_log_close(H5FD_t *_file) +H5FD__log_close(H5FD_t *_file) { H5FD_log_t *file = (H5FD_log_t *)_file; -#ifdef H5_HAVE_GETTIMEOFDAY - struct timeval timeval_start, timeval_stop; -#endif /* H5_HAVE_GETTIMEOFDAY */ - herr_t ret_value = SUCCEED; /* Return value */ + H5_timer_t close_timer; /* Timer for close() call */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity check */ HDassert(file); -#ifdef H5_HAVE_GETTIMEOFDAY - if(file->fa.flags&H5FD_LOG_TIME_CLOSE) - HDgettimeofday(&timeval_start, NULL); -#endif /* H5_HAVE_GETTIMEOFDAY */ + /* Start timer for close() call */ + if(file->fa.flags & H5FD_LOG_TIME_CLOSE) { + H5_timer_init(&close_timer); + H5_timer_start(&close_timer); + } /* end if */ + /* Close the underlying file */ if(HDclose(file->fd) < 0) HSYS_GOTO_ERROR(H5E_IO, H5E_CANTCLOSEFILE, FAIL, "unable to close file") -#ifdef H5_HAVE_GETTIMEOFDAY + + /* Stop timer for close() call */ if(file->fa.flags&H5FD_LOG_TIME_CLOSE) - HDgettimeofday(&timeval_stop, NULL); -#endif /* H5_HAVE_GETTIMEOFDAY */ + H5_timer_stop(&close_timer); /* Dump I/O information */ if(file->fa.flags != 0) { @@ -714,20 +723,12 @@ H5FD_log_close(H5FD_t *_file) haddr_t last_addr; unsigned char last_val; -#ifdef H5_HAVE_GETTIMEOFDAY if(file->fa.flags & H5FD_LOG_TIME_CLOSE) { - struct timeval timeval_diff; - - /* Calculate the elapsed gettimeofday time */ - timeval_diff.tv_usec = timeval_stop.tv_usec - timeval_start.tv_usec; - timeval_diff.tv_sec = timeval_stop.tv_sec - timeval_start.tv_sec; - if(timeval_diff.tv_usec < 0) { - timeval_diff.tv_usec += 1000000; - timeval_diff.tv_sec--; - } /* end if */ - HDfprintf(file->logfp, "Close took: (%f s)\n", (double)timeval_diff.tv_sec + ((double)timeval_diff.tv_usec / (double)1000000.0f)); + H5_timevals_t close_times; /* Elapsed time for close() call */ + + H5_timer_get_times(close_timer, &close_times); + HDfprintf(file->logfp, "Close took: (%f s)\n", close_times.elapsed); } /* end if */ -#endif /* H5_HAVE_GETTIMEOFDAY */ /* Dump the total number of seek/read/write operations */ if(file->fa.flags & H5FD_LOG_NUM_READ) @@ -819,11 +820,11 @@ H5FD_log_close(H5FD_t *_file) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_log_close() */ +} /* end H5FD__log_close() */ /*------------------------------------------------------------------------- - * Function: H5FD_log_cmp + * Function: H5FD__log_cmp * * Purpose: Compares two files belonging to this driver using an * arbitrary (but consistent) ordering. @@ -838,13 +839,13 @@ done: *------------------------------------------------------------------------- */ static int -H5FD_log_cmp(const H5FD_t *_f1, const H5FD_t *_f2) +H5FD__log_cmp(const H5FD_t *_f1, const H5FD_t *_f2) { const H5FD_log_t *f1 = (const H5FD_log_t *)_f1; const H5FD_log_t *f2 = (const H5FD_log_t *)_f2; int ret_value = 0; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR #ifdef H5_HAVE_WIN32_API if(f1->dwVolumeSerialNumber < f2->dwVolumeSerialNumber) HGOTO_DONE(-1) @@ -875,11 +876,11 @@ H5FD_log_cmp(const H5FD_t *_f1, const H5FD_t *_f2) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_log_cmp() */ +} /* end H5FD__log_cmp() */ /*------------------------------------------------------------------------- - * Function: H5FD_log_query + * Function: H5FD__log_query * * Purpose: Set the flags that this VFL driver is capable of supporting. * (listed in H5FDpublic.h) @@ -892,11 +893,11 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_log_query(const H5FD_t *_file, unsigned long *flags /* out */) +H5FD__log_query(const H5FD_t *_file, unsigned long *flags /* out */) { const H5FD_log_t *file = (const H5FD_log_t *)_file; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Set the VFL feature flags that this driver supports */ if(flags) { @@ -915,11 +916,11 @@ H5FD_log_query(const H5FD_t *_file, unsigned long *flags /* out */) } /* end if */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5FD_log_query() */ +} /* end H5FD__log_query() */ /*------------------------------------------------------------------------- - * Function: H5FD_log_alloc + * Function: H5FD__log_alloc * * Purpose: Allocate file memory. * @@ -932,13 +933,13 @@ H5FD_log_query(const H5FD_t *_file, unsigned long *flags /* out */) *------------------------------------------------------------------------- */ static haddr_t -H5FD_log_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, hsize_t size) +H5FD__log_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, hsize_t size) { H5FD_log_t *file = (H5FD_log_t *)_file; haddr_t addr; haddr_t ret_value = HADDR_UNDEF; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Compute the address for the block to allocate */ addr = file->eoa; @@ -962,7 +963,7 @@ H5FD_log_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, hsi ret_value = addr; FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_log_alloc() */ +} /* end H5FD__log_alloc() */ /*------------------------------------------------------------------------- @@ -1003,7 +1004,7 @@ H5FD__log_free(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, /*------------------------------------------------------------------------- - * Function: H5FD_log_get_eoa + * Function: H5FD__log_get_eoa * * Purpose: Gets the end-of-address marker for the file. The EOA marker * is the first address past the last byte allocated in the @@ -1018,18 +1019,18 @@ H5FD__log_free(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, *------------------------------------------------------------------------- */ static haddr_t -H5FD_log_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) +H5FD__log_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) { const H5FD_log_t *file = (const H5FD_log_t *)_file; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR FUNC_LEAVE_NOAPI(file->eoa) -} /* end H5FD_log_get_eoa() */ +} /* end H5FD__log_get_eoa() */ /*------------------------------------------------------------------------- - * Function: H5FD_log_set_eoa + * Function: H5FD__log_set_eoa * * Purpose: Set the end-of-address marker for the file. This function is * called shortly after an existing HDF5 file is opened in order @@ -1043,11 +1044,11 @@ H5FD_log_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) *------------------------------------------------------------------------- */ static herr_t -H5FD_log_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr) +H5FD__log_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr) { H5FD_log_t *file = (H5FD_log_t *)_file; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR if(file->fa.flags != 0) { /* Check for increasing file size */ @@ -1086,11 +1087,11 @@ H5FD_log_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr) file->eoa = addr; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5FD_log_set_eoa() */ +} /* end H5FD__log_set_eoa() */ /*------------------------------------------------------------------------- - * Function: H5FD_log_get_eof + * Function: H5FD__log_get_eof * * Purpose: Returns the end-of-file marker, which is the greater of * either the filesystem end-of-file or the HDF5 end-of-address @@ -1107,18 +1108,18 @@ H5FD_log_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr) *------------------------------------------------------------------------- */ static haddr_t -H5FD_log_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) +H5FD__log_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) { const H5FD_log_t *file = (const H5FD_log_t *)_file; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR FUNC_LEAVE_NOAPI(file->eof) -} /* end H5FD_log_get_eof() */ +} /* end H5FD__log_get_eof() */ /*------------------------------------------------------------------------- - * Function: H5FD_log_get_handle + * Function: H5FD__log_get_handle * * Purpose: Returns the file handle of LOG file driver. * @@ -1130,12 +1131,12 @@ H5FD_log_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) *------------------------------------------------------------------------- */ static herr_t -H5FD_log_get_handle(H5FD_t *_file, hid_t H5_ATTR_UNUSED fapl, void **file_handle) +H5FD__log_get_handle(H5FD_t *_file, hid_t H5_ATTR_UNUSED fapl, void **file_handle) { H5FD_log_t *file = (H5FD_log_t *)_file; herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(!file_handle) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file handle not valid") @@ -1144,11 +1145,11 @@ H5FD_log_get_handle(H5FD_t *_file, hid_t H5_ATTR_UNUSED fapl, void **file_handle done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_log_get_handle() */ +} /* end H5FD__log_get_handle() */ /*------------------------------------------------------------------------- - * Function: H5FD_log_read + * Function: H5FD__log_read * * Purpose: Reads SIZE bytes of data from FILE beginning at address ADDR * into buffer BUF according to data transfer properties in @@ -1164,19 +1165,22 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t addr, +H5FD__log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t addr, size_t size, void *buf/*out*/) { H5FD_log_t *file = (H5FD_log_t *)_file; size_t orig_size = size; /* Save the original size for later */ haddr_t orig_addr = addr; -#ifdef H5_HAVE_GETTIMEOFDAY - struct timeval timeval_start, timeval_stop; -#endif /* H5_HAVE_GETTIMEOFDAY */ + H5_timer_t read_timer; /* Timer for read operation */ + H5_timevals_t read_times; /* Elapsed time for read operation */ +#ifndef H5_HAVE_PREADWRITE + H5_timer_t seek_timer; /* Timer for seek operation */ + H5_timevals_t seek_times; /* Elapsed time for seek operation */ +#endif /* H5_HAVE_PREADWRITE */ HDoff_t offset = (HDoff_t)addr; - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(file && file->pub.cls); HDassert(buf); @@ -1203,59 +1207,56 @@ H5FD_log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, hadd #ifndef H5_HAVE_PREADWRITE /* Seek to the correct location (if we don't have pread) */ if(addr != file->pos || OP_READ != file->op) { -#ifdef H5_HAVE_GETTIMEOFDAY - if(file->fa.flags & H5FD_LOG_TIME_SEEK) - HDgettimeofday(&timeval_start, NULL); -#endif /* H5_HAVE_GETTIMEOFDAY */ + /* Start timer for seek() call */ + if(file->fa.flags & H5FD_LOG_TIME_SEEK) { + H5_timer_init(&seek_timer); + H5_timer_start(&seek_timer); + } /* end if */ + if(HDlseek(file->fd, (HDoff_t)addr, SEEK_SET) < 0) HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position") -#ifdef H5_HAVE_GETTIMEOFDAY + + /* Stop timer for seek() call */ if(file->fa.flags & H5FD_LOG_TIME_SEEK) - HDgettimeofday(&timeval_stop, NULL); -#endif /* H5_HAVE_GETTIMEOFDAY */ + H5_timer_stop(&seek_timer); - /* Log information about the seek */ + /* Add to the number of seeks, when tracking that */ if(file->fa.flags & H5FD_LOG_NUM_SEEK) file->total_seek_ops++; + + /* Add to the total seek time, when tracking that */ + if(file->fa.flags & H5FD_LOG_TIME_SEEK) { + H5_timer_get_times(seek_timer, &seek_times); + file->total_seek_time += seek_times.elapsed; + } /* end if */ + + /* Emit log string if we're tracking individual seek events. */ if(file->fa.flags & H5FD_LOG_LOC_SEEK) { HDfprintf(file->logfp, "Seek: From %10a To %10a", file->pos, addr); -#ifdef H5_HAVE_GETTIMEOFDAY - if(file->fa.flags & H5FD_LOG_TIME_SEEK) { - struct timeval timeval_diff; - double time_diff; - - /* Calculate the elapsed gettimeofday time */ - timeval_diff.tv_usec = timeval_stop.tv_usec - timeval_start.tv_usec; - timeval_diff.tv_sec = timeval_stop.tv_sec - timeval_start.tv_sec; - if(timeval_diff.tv_usec < 0) { - timeval_diff.tv_usec += 1000000; - timeval_diff.tv_sec--; - } /* end if */ - time_diff = (double)timeval_diff.tv_sec + ((double)timeval_diff.tv_usec / (double)1000000.0f); - HDfprintf(file->logfp, " (%fs @ %.6lu.%.6llu)\n", time_diff, (unsigned long long)timeval_start.tv_sec, (unsigned long long)timeval_start.tv_usec); - /* Add to total seek time */ - file->total_seek_time += time_diff; - } /* end if */ - else - HDfprintf(file->logfp, "\n"); -#else /* H5_HAVE_GETTIMEOFDAY */ - HDfprintf(file->logfp, "\n"); -#endif /* H5_HAVE_GETTIMEOFDAY */ + /* Add the seek time, if we're tracking that. + * Note that the seek time is NOT emitted for when just H5FD_LOG_TIME_SEEK + * is set. + */ + if(file->fa.flags & H5FD_LOG_TIME_SEEK) + HDfprintf(file->logfp, " (%fs @ %f)\n", seek_times.elapsed, seek_timer.initial.elapsed); + else + HDfprintf(file->logfp, "\n"); } /* end if */ } /* end if */ #endif /* H5_HAVE_PREADWRITE */ + /* Start timer for read operation */ + if(file->fa.flags & H5FD_LOG_TIME_READ) { + H5_timer_init(&read_timer); + H5_timer_start(&read_timer); + } /* end if */ + /* * Read data, being careful of interrupted system calls, partial results, * and the end of the file. */ -#ifdef H5_HAVE_GETTIMEOFDAY - if(file->fa.flags & H5FD_LOG_TIME_READ) - HDgettimeofday(&timeval_start, NULL); -#endif /* H5_HAVE_GETTIMEOFDAY */ while(size > 0) { - h5_posix_io_t bytes_in = 0; /* # of bytes to read */ h5_posix_io_ret_t bytes_read = -1; /* # of bytes actually read */ @@ -1303,14 +1304,22 @@ H5FD_log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, hadd buf = (char *)buf + bytes_read; } /* end while */ -#ifdef H5_HAVE_GETTIMEOFDAY + + /* Stop timer for read operation */ if(file->fa.flags & H5FD_LOG_TIME_READ) - HDgettimeofday(&timeval_stop, NULL); -#endif /* H5_HAVE_GETTIMEOFDAY */ + H5_timer_stop(&read_timer); - /* Log information about the read */ + /* Add to the number of reads, when tracking that */ if(file->fa.flags & H5FD_LOG_NUM_READ) file->total_read_ops++; + + /* Add to the total read time, when tracking that */ + if(file->fa.flags & H5FD_LOG_TIME_READ) { + H5_timer_get_times(read_timer, &read_times); + file->total_read_time += read_times.elapsed; + } /* end if */ + + /* Log information about the read */ if(file->fa.flags & H5FD_LOG_LOC_READ) { HDfprintf(file->logfp, "%10a-%10a (%10Zu bytes) (%s) Read", orig_addr, (orig_addr + orig_size) - 1, orig_size, flavors[type]); @@ -1320,30 +1329,14 @@ H5FD_log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, hadd HDassert(type == H5FD_MEM_DEFAULT || type == (H5FD_mem_t)file->flavor[(orig_addr + orig_size) - 1] || (H5FD_mem_t)file->flavor[(orig_addr + orig_size) - 1] == H5FD_MEM_DEFAULT); } /* end if */ - -#ifdef H5_HAVE_GETTIMEOFDAY - if(file->fa.flags & H5FD_LOG_TIME_READ) { - struct timeval timeval_diff; - double time_diff; - - /* Calculate the elapsed gettimeofday time */ - timeval_diff.tv_usec = timeval_stop.tv_usec - timeval_start.tv_usec; - timeval_diff.tv_sec = timeval_stop.tv_sec - timeval_start.tv_sec; - if(timeval_diff.tv_usec < 0) { - timeval_diff.tv_usec += 1000000; - timeval_diff.tv_sec--; - } /* end if */ - time_diff = (double)timeval_diff.tv_sec + ((double)timeval_diff.tv_usec / (double)1000000.0f); - HDfprintf(file->logfp, " (%fs @ %.6lu.%.6llu)\n", time_diff, (unsigned long long)timeval_start.tv_sec, (unsigned long long)timeval_start.tv_usec); - - /* Add to total read time */ - file->total_read_time += time_diff; - } /* end if */ + /* Add the read time, if we're tracking that. + * Note that the read time is NOT emitted for when just H5FD_LOG_TIME_READ + * is set. + */ + if(file->fa.flags & H5FD_LOG_TIME_READ) + HDfprintf(file->logfp, " (%fs @ %f)\n", read_times.elapsed, read_timer.initial.elapsed); else HDfprintf(file->logfp, "\n"); -#else /* H5_HAVE_GETTIMEOFDAY */ - HDfprintf(file->logfp, "\n"); -#endif /* H5_HAVE_GETTIMEOFDAY */ } /* end if */ /* Update current position */ @@ -1358,11 +1351,11 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_log_read() */ +} /* end H5FD__log_read() */ /*------------------------------------------------------------------------- - * Function: H5FD_log_write + * Function: H5FD__log_write * * Purpose: Writes SIZE bytes of data to FILE beginning at address ADDR * from buffer BUF according to data transfer properties in @@ -1376,19 +1369,22 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t addr, +H5FD__log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t addr, size_t size, const void *buf) { H5FD_log_t *file = (H5FD_log_t *)_file; size_t orig_size = size; /* Save the original size for later */ haddr_t orig_addr = addr; -#ifdef H5_HAVE_GETTIMEOFDAY - struct timeval timeval_start, timeval_stop; -#endif /* H5_HAVE_GETTIMEOFDAY */ + H5_timer_t write_timer; /* Timer for write operation */ + H5_timevals_t write_times; /* Elapsed time for write operation */ +#ifndef H5_HAVE_PREADWRITE + H5_timer_t seek_timer; /* Timer for seek operation */ + H5_timevals_t seek_times; /* Elapsed time for seek operation */ +#endif /* H5_HAVE_PREADWRITE */ HDoff_t offset = (HDoff_t)addr; - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(file && file->pub.cls); HDassert(size > 0); @@ -1420,59 +1416,56 @@ H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had #ifndef H5_HAVE_PREADWRITE /* Seek to the correct location (if we don't have pwrite) */ if(addr != file->pos || OP_WRITE != file->op) { -#ifdef H5_HAVE_GETTIMEOFDAY - if(file->fa.flags & H5FD_LOG_TIME_SEEK) - HDgettimeofday(&timeval_start, NULL); -#endif /* H5_HAVE_GETTIMEOFDAY */ + /* Start timer for seek() call */ + if(file->fa.flags & H5FD_LOG_TIME_SEEK) { + H5_timer_init(&seek_timer); + H5_timer_start(&seek_timer); + } /* end if */ + if(HDlseek(file->fd, (HDoff_t)addr, SEEK_SET) < 0) HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position") -#ifdef H5_HAVE_GETTIMEOFDAY + + /* Stop timer for seek() call */ if(file->fa.flags & H5FD_LOG_TIME_SEEK) - HDgettimeofday(&timeval_stop, NULL); -#endif /* H5_HAVE_GETTIMEOFDAY */ + H5_timer_stop(&seek_timer); - /* Log information about the seek */ + /* Add to the number of seeks, when tracking that */ if(file->fa.flags & H5FD_LOG_NUM_SEEK) file->total_seek_ops++; + + /* Add to the total seek time, when tracking that */ + if(file->fa.flags & H5FD_LOG_TIME_SEEK) { + H5_timer_get_times(seek_timer, &seek_times); + file->total_seek_time += seek_times.elapsed; + } /* end if */ + + /* Emit log string if we're tracking individual seek events. */ if(file->fa.flags & H5FD_LOG_LOC_SEEK) { HDfprintf(file->logfp, "Seek: From %10a To %10a", file->pos, addr); -#ifdef H5_HAVE_GETTIMEOFDAY - if(file->fa.flags & H5FD_LOG_TIME_SEEK) { - struct timeval timeval_diff; - double time_diff; - - /* Calculate the elapsed gettimeofday time */ - timeval_diff.tv_usec = timeval_stop.tv_usec - timeval_start.tv_usec; - timeval_diff.tv_sec = timeval_stop.tv_sec - timeval_start.tv_sec; - if(timeval_diff.tv_usec < 0) { - timeval_diff.tv_usec += 1000000; - timeval_diff.tv_sec--; - } /* end if */ - time_diff = (double)timeval_diff.tv_sec + ((double)timeval_diff.tv_usec / (double)1000000.0f); - HDfprintf(file->logfp, " (%fs @ %.6lu.%.6llu)\n", time_diff, (unsigned long long)timeval_start.tv_sec, (unsigned long long)timeval_start.tv_usec); - /* Add to total seek time */ - file->total_seek_time += time_diff; - } /* end if */ - else - HDfprintf(file->logfp, "\n"); -#else /* H5_HAVE_GETTIMEOFDAY */ - HDfprintf(file->logfp, "\n"); -#endif /* H5_HAVE_GETTIMEOFDAY */ + /* Add the seek time, if we're tracking that. + * Note that the seek time is NOT emitted for when just H5FD_LOG_TIME_SEEK + * is set. + */ + if(file->fa.flags & H5FD_LOG_TIME_SEEK) + HDfprintf(file->logfp, " (%fs @ %f)\n", seek_times.elapsed, seek_timer.initial.elapsed); + else + HDfprintf(file->logfp, "\n"); } /* end if */ } /* end if */ #endif /* H5_HAVE_PREADWRITE */ + /* Start timer for write operation */ + if(file->fa.flags&H5FD_LOG_TIME_WRITE) { + H5_timer_init(&write_timer); + H5_timer_start(&write_timer); + } /* end if */ + /* * Write the data, being careful of interrupted system calls and partial * results */ -#ifdef H5_HAVE_GETTIMEOFDAY - if(file->fa.flags&H5FD_LOG_TIME_WRITE) - HDgettimeofday(&timeval_start, NULL); -#endif /* H5_HAVE_GETTIMEOFDAY */ while(size > 0) { - h5_posix_io_t bytes_in = 0; /* # of bytes to write */ h5_posix_io_ret_t bytes_wrote = -1; /* # of bytes written */ @@ -1513,14 +1506,22 @@ H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had addr += (haddr_t)bytes_wrote; buf = (const char *)buf + bytes_wrote; } /* end while */ -#ifdef H5_HAVE_GETTIMEOFDAY + + /* Stop timer for write operation */ if(file->fa.flags & H5FD_LOG_TIME_WRITE) - HDgettimeofday(&timeval_stop, NULL); -#endif /* H5_HAVE_GETTIMEOFDAY */ + H5_timer_stop(&write_timer); - /* Log information about the write */ + /* Add to the number of writes, when tracking that */ if(file->fa.flags & H5FD_LOG_NUM_WRITE) file->total_write_ops++; + + /* Add to the total write time, when tracking that */ + if(file->fa.flags & H5FD_LOG_TIME_WRITE) { + H5_timer_get_times(write_timer, &write_times); + file->total_write_time += write_times.elapsed; + } /* end if */ + + /* Log information about the write */ if(file->fa.flags & H5FD_LOG_LOC_WRITE) { HDfprintf(file->logfp, "%10a-%10a (%10Zu bytes) (%s) Written", orig_addr, (orig_addr + orig_size) - 1, orig_size, flavors[type]); @@ -1532,29 +1533,14 @@ H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had } /* end if */ } /* end if */ -#ifdef H5_HAVE_GETTIMEOFDAY - if(file->fa.flags & H5FD_LOG_TIME_WRITE) { - struct timeval timeval_diff; - double time_diff; - - /* Calculate the elapsed gettimeofday time */ - timeval_diff.tv_usec = timeval_stop.tv_usec - timeval_start.tv_usec; - timeval_diff.tv_sec = timeval_stop.tv_sec - timeval_start.tv_sec; - if(timeval_diff.tv_usec < 0) { - timeval_diff.tv_usec += 1000000; - timeval_diff.tv_sec--; - } /* end if */ - time_diff = (double)timeval_diff.tv_sec + ((double)timeval_diff.tv_usec / (double)1000000.0f); - HDfprintf(file->logfp, " (%fs @ %.6lu.%.6llu)\n", time_diff, (unsigned long long)timeval_start.tv_sec, (unsigned long long)timeval_start.tv_usec); - - /* Add to total write time */ - file->total_write_time += time_diff; - } /* end if */ - else - HDfprintf(file->logfp, "\n"); -#else /* H5_HAVE_GETTIMEOFDAY */ - HDfprintf(file->logfp, "\n"); -#endif /* H5_HAVE_GETTIMEOFDAY */ + /* Add the write time, if we're tracking that. + * Note that the write time is NOT emitted for when just H5FD_LOG_TIME_WRITE + * is set. + */ + if(file->fa.flags & H5FD_LOG_TIME_WRITE) + HDfprintf(file->logfp, " (%fs @ %f)\n", write_times.elapsed, write_timer.initial.elapsed); + else + HDfprintf(file->logfp, "\n"); } /* end if */ /* Update current position and eof */ @@ -1571,11 +1557,11 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_log_write() */ +} /* end H5FD__log_write() */ /*------------------------------------------------------------------------- - * Function: H5FD_log_truncate + * Function: H5FD__log_truncate * * Purpose: Makes sure that the true file size is the same (or larger) * than the end-of-address. @@ -1588,34 +1574,33 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_log_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_UNUSED closing) +H5FD__log_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_UNUSED closing) { H5FD_log_t *file = (H5FD_log_t *)_file; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(file); /* Extend the file to make sure it's large enough */ if(!H5F_addr_eq(file->eoa, file->eof)) { -#ifdef H5_HAVE_GETTIMEOFDAY - struct timeval timeval_start, timeval_stop; -#endif /* H5_HAVE_GETTIMEOFDAY */ + H5_timer_t trunc_timer; /* Timer for truncate operation */ + H5_timevals_t trunc_times; /* Elapsed time for truncate operation */ + + /* Start timer for truncate operation */ + if(file->fa.flags & H5FD_LOG_TIME_TRUNCATE) { + H5_timer_init(&trunc_timer); + H5_timer_start(&trunc_timer); + } /* end if */ + #ifdef H5_HAVE_WIN32_API +{ LARGE_INTEGER li; /* 64-bit (union) integer for SetFilePointer() call */ DWORD dwPtrLow; /* Low-order pointer bits from SetFilePointer() * Only used as an error code here. */ - DWORD dwError; /* DWORD error code from GetLastError() */ - BOOL bError; /* Boolean error flag */ -#endif /* H5_HAVE_WIN32_API */ -#ifdef H5_HAVE_GETTIMEOFDAY - if(file->fa.flags & H5FD_LOG_TIME_TRUNCATE) - HDgettimeofday(&timeval_start, NULL); -#endif /* H5_HAVE_GETTIMEOFDAY */ -#ifdef H5_HAVE_WIN32_API /* Windows uses this odd QuadPart union for 32/64-bit portability */ li.QuadPart = (__int64)file->eoa; @@ -1626,51 +1611,48 @@ H5FD_log_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_U */ dwPtrLow = SetFilePointer(file->hFile, li.LowPart, &li.HighPart, FILE_BEGIN); if(INVALID_SET_FILE_POINTER == dwPtrLow) { + DWORD dwError; /* DWORD error code from GetLastError() */ + dwError = GetLastError(); if(dwError != NO_ERROR ) HGOTO_ERROR(H5E_FILE, H5E_FILEOPEN, FAIL, "unable to set file pointer") - } + } /* end if */ - bError = SetEndOfFile(file->hFile); - if(0 == bError) + if(0 == SetEndOfFile(file->hFile)) HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to extend file properly") +} #else /* H5_HAVE_WIN32_API */ + /* Truncate/extend the file */ if(-1 == HDftruncate(file->fd, (HDoff_t)file->eoa)) HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to extend file properly") #endif /* H5_HAVE_WIN32_API */ -#ifdef H5_HAVE_GETTIMEOFDAY + + /* Stop timer for truncate operation */ if(file->fa.flags & H5FD_LOG_TIME_TRUNCATE) - HDgettimeofday(&timeval_stop, NULL); -#endif /* H5_HAVE_GETTIMEOFDAY */ + H5_timer_stop(&trunc_timer); - /* Log information about the truncate */ + /* Add to the number of truncates, when tracking that */ if(file->fa.flags & H5FD_LOG_NUM_TRUNCATE) file->total_truncate_ops++; + + /* Add to the total truncate time, when tracking that */ + if(file->fa.flags & H5FD_LOG_TIME_TRUNCATE) { + H5_timer_get_times(trunc_timer, &trunc_times); + file->total_truncate_time += trunc_times.elapsed; + } /* end if */ + + /* Emit log string if we're tracking individual truncate events. */ if(file->fa.flags & H5FD_LOG_TRUNCATE) { HDfprintf(file->logfp, "Truncate: To %10a", file->eoa); -#ifdef H5_HAVE_GETTIMEOFDAY - if(file->fa.flags & H5FD_LOG_TIME_TRUNCATE) { - struct timeval timeval_diff; - double time_diff; - - /* Calculate the elapsed gettimeofday time */ - timeval_diff.tv_usec = timeval_stop.tv_usec - timeval_start.tv_usec; - timeval_diff.tv_sec = timeval_stop.tv_sec - timeval_start.tv_sec; - if(timeval_diff.tv_usec < 0) { - timeval_diff.tv_usec += 1000000; - timeval_diff.tv_sec--; - } /* end if */ - time_diff = (double)timeval_diff.tv_sec + ((double)timeval_diff.tv_usec / (double)1000000.0f); - HDfprintf(file->logfp, " (%fs @ %.6lu.%.6llu)\n", time_diff, (unsigned long long)timeval_start.tv_sec, (unsigned long long)timeval_start.tv_usec); - /* Add to total truncate time */ - file->total_truncate_time += time_diff; - } /* end if */ - else - HDfprintf(file->logfp, "\n"); -#else /* H5_HAVE_GETTIMEOFDAY */ - HDfprintf(file->logfp, "\n"); -#endif /* H5_HAVE_GETTIMEOFDAY */ + /* Add the truncate time, if we're tracking that. + * Note that the truncate time is NOT emitted for when just H5FD_LOG_TIME_TRUNCATE + * is set. + */ + if(file->fa.flags & H5FD_LOG_TIME_TRUNCATE) + HDfprintf(file->logfp, " (%fs @ %f)\n", trunc_times.elapsed, trunc_timer.initial.elapsed); + else + HDfprintf(file->logfp, "\n"); } /* end if */ /* Update the eof value */ @@ -1683,11 +1665,11 @@ H5FD_log_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_U done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_log_truncate() */ +} /* end H5FD__log_truncate() */ /*------------------------------------------------------------------------- - * Function: H5FD_log_lock + * Function: H5FD__log_lock * * Purpose: Place a lock on the file * @@ -1699,13 +1681,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_log_lock(H5FD_t *_file, hbool_t rw) +H5FD__log_lock(H5FD_t *_file, hbool_t rw) { H5FD_log_t *file = (H5FD_log_t *)_file; /* VFD file struct */ int lock_flags; /* file locking flags */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity check */ HDassert(file); @@ -1715,19 +1697,23 @@ H5FD_log_lock(H5FD_t *_file, hbool_t rw) /* Place a non-blocking lock on the file */ if(HDflock(file->fd, lock_flags | LOCK_NB) < 0) { - if(ENOSYS == errno) - HSYS_GOTO_ERROR(H5E_FILE, H5E_BADFILE, FAIL, "file locking disabled on this file system (use HDF5_USE_FILE_LOCKING environment variable to override)") + if(file->ignore_disabled_file_locks && ENOSYS == errno) { + /* When errno is set to ENOSYS, the file system does not support + * locking, so ignore it. + */ + errno = 0; + } else - HSYS_GOTO_ERROR(H5E_FILE, H5E_BADFILE, FAIL, "unable to lock file") - } /* end if */ + HSYS_GOTO_ERROR(H5E_VFL, H5E_CANTLOCKFILE, FAIL, "unable to lock file") + } done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_log_lock() */ +} /* end H5FD__log_lock() */ /*------------------------------------------------------------------------- - * Function: H5FD_log_unlock + * Function: H5FD__log_unlock * * Purpose: Remove the existing lock on the file * @@ -1738,23 +1724,27 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_log_unlock(H5FD_t *_file) +H5FD__log_unlock(H5FD_t *_file) { H5FD_log_t *file = (H5FD_log_t *)_file; /* VFD file struct */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(file); if(HDflock(file->fd, LOCK_UN) < 0) { - if(ENOSYS == errno) - HSYS_GOTO_ERROR(H5E_FILE, H5E_BADFILE, FAIL, "file locking disabled on this file system (use HDF5_USE_FILE_LOCKING environment variable to override)") + if(file->ignore_disabled_file_locks && ENOSYS == errno) { + /* When errno is set to ENOSYS, the file system does not support + * locking, so ignore it. + */ + errno = 0; + } else - HSYS_GOTO_ERROR(H5E_FILE, H5E_BADFILE, FAIL, "unable to unlock file") - } /* end if */ + HSYS_GOTO_ERROR(H5E_VFL, H5E_CANTUNLOCKFILE, FAIL, "unable to unlock file") + } done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_log_unlock() */ +} /* end H5FD__log_unlock() */ diff --git a/src/H5FDlog.h b/src/H5FDlog.h index a69bb18..db51f3d 100644 --- a/src/H5FDlog.h +++ b/src/H5FDlog.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, April 17, 2000 * * Purpose: The public header file for the log driver. diff --git a/src/H5FDmirror.c b/src/H5FDmirror.c index 1ed3372..02f2e44 100644 --- a/src/H5FDmirror.c +++ b/src/H5FDmirror.c @@ -25,6 +25,7 @@ #include "H5Fprivate.h" /* File access */ #include "H5FDprivate.h" /* File drivers */ #include "H5FDmirror.h" /* "Mirror" definitions */ +#include "H5FDmirror_priv.h" /* Private header for the mirror VFD */ #include "H5FLprivate.h" /* Free Lists */ #include "H5Iprivate.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ @@ -136,32 +137,32 @@ typedef struct H5FD_mirror_t { #if MIRROR_DEBUG_OP_CALLS #define LOG_OP_CALL(name) do { \ HDprintf("called %s()\n", (name)); \ - fflush(stdout); \ + HDfflush(stdout); \ } while (0) #else #define LOG_OP_CALL(name) /* no-op */ #endif /* MIRROR_DEBUG_OP_CALLS */ /* Prototypes */ -static herr_t H5FD_mirror_term(void); -static void *H5FD_mirror_fapl_get(H5FD_t *_file); -static void *H5FD_mirror_fapl_copy(const void *_old_fa); -static herr_t H5FD_mirror_fapl_free(void *_fa); -static haddr_t H5FD_mirror_get_eoa(const H5FD_t *_file, H5FD_mem_t type); -static herr_t H5FD_mirror_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr); -static haddr_t H5FD_mirror_get_eof(const H5FD_t *_file, H5FD_mem_t type); -static H5FD_t *H5FD_mirror_open(const char *name, unsigned flags, \ +static herr_t H5FD__mirror_term(void); +static void *H5FD__mirror_fapl_get(H5FD_t *_file); +static void *H5FD__mirror_fapl_copy(const void *_old_fa); +static herr_t H5FD__mirror_fapl_free(void *_fa); +static haddr_t H5FD__mirror_get_eoa(const H5FD_t *_file, H5FD_mem_t type); +static herr_t H5FD__mirror_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr); +static haddr_t H5FD__mirror_get_eof(const H5FD_t *_file, H5FD_mem_t type); +static H5FD_t *H5FD__mirror_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr); -static herr_t H5FD_mirror_close(H5FD_t *_file); -static herr_t H5FD_mirror_query(const H5FD_t *_file, unsigned long *flags); -static herr_t H5FD_mirror_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, \ +static herr_t H5FD__mirror_close(H5FD_t *_file); +static herr_t H5FD__mirror_query(const H5FD_t *_file, unsigned long *flags); +static herr_t H5FD__mirror_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, const void *buf); -static herr_t H5FD_mirror_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, +static herr_t H5FD__mirror_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, void *buf); -static herr_t H5FD_mirror_truncate(H5FD_t *_file, hid_t dxpl_id, \ +static herr_t H5FD__mirror_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); -static herr_t H5FD_mirror_lock(H5FD_t *_file, hbool_t rw); -static herr_t H5FD_mirror_unlock(H5FD_t *_file); +static herr_t H5FD__mirror_lock(H5FD_t *_file, hbool_t rw); +static herr_t H5FD__mirror_unlock(H5FD_t *_file); static herr_t H5FD__mirror_verify_reply(H5FD_mirror_t *file); @@ -169,42 +170,48 @@ static const H5FD_class_t H5FD_mirror_g = { "mirror", /* name */ MAXADDR, /* maxaddr */ H5F_CLOSE_WEAK, /* fc_degree */ - H5FD_mirror_term, /* terminate */ + H5FD__mirror_term, /* terminate */ NULL, /* sb_size */ NULL, /* sb_encode */ NULL, /* sb_decode */ 0, /* fapl_size */ - H5FD_mirror_fapl_get, /* fapl_get */ - H5FD_mirror_fapl_copy, /* fapl_copy */ - H5FD_mirror_fapl_free, /* fapl_free */ + H5FD__mirror_fapl_get, /* fapl_get */ + H5FD__mirror_fapl_copy, /* fapl_copy */ + H5FD__mirror_fapl_free, /* fapl_free */ 0, /* dxpl_size */ NULL, /* dxpl_copy */ NULL, /* dxpl_free */ - H5FD_mirror_open, /* open */ - H5FD_mirror_close, /* close */ + H5FD__mirror_open, /* open */ + H5FD__mirror_close, /* close */ NULL, /* cmp */ - H5FD_mirror_query, /* query */ + H5FD__mirror_query, /* query */ NULL, /* get_type_map */ NULL, /* alloc */ NULL, /* free */ - H5FD_mirror_get_eoa, /* get_eoa */ - H5FD_mirror_set_eoa, /* set_eoa */ - H5FD_mirror_get_eof, /* get_eof */ + H5FD__mirror_get_eoa, /* get_eoa */ + H5FD__mirror_set_eoa, /* set_eoa */ + H5FD__mirror_get_eof, /* get_eof */ NULL, /* get_handle */ - H5FD_mirror_read, /* read */ - H5FD_mirror_write, /* write */ + H5FD__mirror_read, /* read */ + H5FD__mirror_write, /* write */ NULL, /* read_vector */ NULL, /* write_vector */ NULL, /* flush */ - H5FD_mirror_truncate, /* truncate */ - H5FD_mirror_lock, /* lock */ - H5FD_mirror_unlock, /* unlock */ + H5FD__mirror_truncate, /* truncate */ + H5FD__mirror_lock, /* lock */ + H5FD__mirror_unlock, /* unlock */ H5FD_FLMAP_DICHOTOMY /* fl_map */ }; +/* Declare a free list to manage the transmission buffers */ +H5FL_BLK_DEFINE_STATIC(xmit); + /* Declare a free list to manage the H5FD_mirror_t struct */ H5FL_DEFINE_STATIC(H5FD_mirror_t); +/* Declare a free list to manage the H5FD_mirror_xmit_open_t struct */ +H5FL_DEFINE_STATIC(H5FD_mirror_xmit_open_t); + /*------------------------------------------------------------------------- * Function: H5FD__init_package @@ -221,12 +228,10 @@ H5FD__init_package(void) FUNC_ENTER_STATIC - LOG_OP_CALL("H5FD__init_package"); + LOG_OP_CALL(FUNC); - if (H5FD_mirror_init() < 0) { - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, - "unable to initialize mirror VFD"); - } + if(H5FD_mirror_init() < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to initialize mirror VFD"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -250,12 +255,10 @@ H5FD_mirror_init(void) FUNC_ENTER_NOAPI(FAIL) - LOG_OP_CALL("H5FD_mirror_init"); + LOG_OP_CALL(FUNC); - if (H5I_VFL != H5I_get_type(H5FD_MIRROR_g)) { - H5FD_MIRROR_g = H5FD_register(&H5FD_mirror_g, sizeof(H5FD_class_t), - FALSE); - } + if(H5I_VFL != H5I_get_type(H5FD_MIRROR_g)) + H5FD_MIRROR_g = H5FD_register(&H5FD_mirror_g, sizeof(H5FD_class_t), FALSE); ret_value = H5FD_MIRROR_g; @@ -265,7 +268,7 @@ done: /* --------------------------------------------------------------------------- - * Function: H5FD_mirror_term + * Function: H5FD__mirror_term * * Purpose: Shut down the VFD * @@ -273,17 +276,17 @@ done: * --------------------------------------------------------------------------- */ static herr_t -H5FD_mirror_term(void) +H5FD__mirror_term(void) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Reset VFL ID */ H5FD_MIRROR_g = 0; - LOG_OP_CALL("H5FD_mirror_term"); + LOG_OP_CALL(FUNC); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5FD_mirror_term() */ +} /* end H5FD__mirror_term() */ /* --------------------------------------------------------------------------- @@ -303,10 +306,14 @@ size_t H5FD__mirror_xmit_decode_uint16(uint16_t *out, const unsigned char *_buf) { uint16_t n = 0; - LOG_OP_CALL("H5FD__mirror_xmit_decode_uint16"); + + LOG_OP_CALL(__func__); + HDassert(_buf && out); + HDmemcpy(&n, _buf, sizeof(n)); *out = (uint16_t)HDntohs(n); + return 2; /* number of bytes eaten */ } /* end H5FD__mirror_xmit_decode_uint16() */ @@ -328,14 +335,17 @@ size_t H5FD__mirror_xmit_decode_uint32(uint32_t *out, const unsigned char *_buf) { uint32_t n = 0; - LOG_OP_CALL("H5FD__mirror_xmit_decode_uint32"); + + LOG_OP_CALL(__func__); + HDassert(_buf && out); + HDmemcpy(&n, _buf, sizeof(n)); *out = (uint32_t)HDntohl(n); + return 4; /* number of bytes eaten */ } /* end H5FD__mirror_xmit_decode_uint32() */ - /* --------------------------------------------------------------------------- * Function: is_host_little_endian @@ -359,12 +369,11 @@ is_host_little_endian(void) uint8_t u8[4]; } echeck; echeck.u32 = 0xA1B2C3D4; - if (echeck.u8[0] == 0xD4) { + + if(echeck.u8[0] == 0xD4) return TRUE; - } - else { + else return FALSE; - } } /* end is_host_little_endian() */ @@ -387,15 +396,17 @@ size_t H5FD__mirror_xmit_decode_uint64(uint64_t *out, const unsigned char *_buf) { uint64_t n = 0; - LOG_OP_CALL("H5FD__mirror_xmit_decode_uint64"); + + LOG_OP_CALL(__func__); + HDassert(_buf && out); + HDmemcpy(&n, _buf, sizeof(n)); - if (TRUE == is_host_little_endian()) { + if(TRUE == is_host_little_endian()) *out = BSWAP_64(n); - } - else { + else *out = n; - } + return 8; } /* end H5FD__mirror_xmit_decode_uint64() */ @@ -414,9 +425,12 @@ H5FD__mirror_xmit_decode_uint64(uint64_t *out, const unsigned char *_buf) size_t H5FD__mirror_xmit_decode_uint8(uint8_t *out, const unsigned char *_buf) { - LOG_OP_CALL("H5FD__mirror_xmit_decode_uint8"); + LOG_OP_CALL(__func__); + HDassert(_buf && out); + HDmemcpy(out, _buf, sizeof(uint8_t)); + return 1; /* number of bytes eaten */ } /* end H5FD__mirror_xmit_decode_uint8() */ @@ -437,10 +451,14 @@ size_t H5FD__mirror_xmit_encode_uint16(unsigned char *_dest, uint16_t v) { uint16_t n = 0; - LOG_OP_CALL("H5FD__mirror_xmit_encode_uint16"); + + LOG_OP_CALL(__func__); + HDassert(_dest); + n = (uint16_t)HDhtons(v); HDmemcpy(_dest, &n, sizeof(n)); + return 2; } /* end H5FD__mirror_xmit_encode_uint16() */ @@ -461,10 +479,14 @@ size_t H5FD__mirror_xmit_encode_uint32(unsigned char *_dest, uint32_t v) { uint32_t n = 0; - LOG_OP_CALL("H5FD__mirror_xmit_encode_uint32"); + + LOG_OP_CALL(__func__); + HDassert(_dest); + n = (uint32_t)HDhtonl(v); HDmemcpy(_dest, &n, sizeof(n)); + return 4; } /* end H5FD__mirror_xmit_encode_uint32() */ @@ -485,12 +507,15 @@ size_t H5FD__mirror_xmit_encode_uint64(unsigned char *_dest, uint64_t v) { uint64_t n = v; - LOG_OP_CALL("H5FD__mirror_xmit_decode_uint64"); + + LOG_OP_CALL(__func__); + HDassert(_dest); - if (TRUE == is_host_little_endian()) { + + if(TRUE == is_host_little_endian()) n = BSWAP_64(v); - } HDmemcpy(_dest, &n, sizeof(n)); + return 8; } /* H5FD__mirror_xmit_encode_uint64() */ @@ -511,9 +536,12 @@ H5FD__mirror_xmit_encode_uint64(unsigned char *_dest, uint64_t v) size_t H5FD__mirror_xmit_encode_uint8(unsigned char *dest, uint8_t v) { - LOG_OP_CALL("H5FD__mirror_xmit_encode_uint8"); + LOG_OP_CALL(__func__); + HDassert(dest); + HDmemcpy(dest, &v, sizeof(v)); + return 1; } /* end H5FD__mirror_xmit_encode_uint8() */ @@ -542,8 +570,11 @@ H5FD_mirror_xmit_decode_header(H5FD_mirror_xmit_t *out, const unsigned char *buf) { size_t n_eaten = 0; - LOG_OP_CALL("H5FD_mirror_xmit_decode_header"); + + LOG_OP_CALL(__func__); + HDassert(out && buf); + n_eaten += H5FD__mirror_xmit_decode_uint32(&(out->magic), &buf[n_eaten]); n_eaten += H5FD__mirror_xmit_decode_uint8(&(out->version), &buf[n_eaten]); n_eaten += H5FD__mirror_xmit_decode_uint32(&(out->session_token), @@ -552,6 +583,7 @@ H5FD_mirror_xmit_decode_header(H5FD_mirror_xmit_t *out, &buf[n_eaten]); n_eaten += H5FD__mirror_xmit_decode_uint8(&(out->op), &buf[n_eaten]); HDassert(n_eaten == H5FD_MIRROR_XMIT_HEADER_SIZE); + return n_eaten; } /* end H5FD_mirror_xmit_decode_header() */ @@ -580,11 +612,15 @@ H5FD_mirror_xmit_decode_lock(H5FD_mirror_xmit_lock_t *out, const unsigned char *buf) { size_t n_eaten = 0; - LOG_OP_CALL("H5FD_mirror_xmit_decode_lock"); + + LOG_OP_CALL(__func__); + HDassert(out && buf); + n_eaten += H5FD_mirror_xmit_decode_header(&(out->pub), buf); n_eaten += H5FD__mirror_xmit_decode_uint64(&(out->rw), &buf[n_eaten]); HDassert(n_eaten == H5FD_MIRROR_XMIT_LOCK_SIZE); + return n_eaten; } /* end H5FD_mirror_xmit_decode_lock() */ @@ -614,8 +650,11 @@ H5FD_mirror_xmit_decode_open(H5FD_mirror_xmit_open_t *out, const unsigned char *buf) { size_t n_eaten = 0; - LOG_OP_CALL("H5FD_mirror_xmit_decode_open"); + + LOG_OP_CALL(__func__); + HDassert(out && buf); + n_eaten += H5FD_mirror_xmit_decode_header(&(out->pub), buf); n_eaten += H5FD__mirror_xmit_decode_uint32(&(out->flags), &buf[n_eaten]); n_eaten += H5FD__mirror_xmit_decode_uint64(&(out->maxaddr), &buf[n_eaten]); @@ -624,8 +663,9 @@ H5FD_mirror_xmit_decode_open(H5FD_mirror_xmit_open_t *out, HDassert((H5FD_MIRROR_XMIT_OPEN_SIZE - H5FD_MIRROR_XMIT_FILEPATH_MAX) == n_eaten); HDstrncpy(out->filename, (const char *)&buf[n_eaten], - H5FD_MIRROR_XMIT_FILEPATH_MAX-1); - out->filename[H5FD_MIRROR_XMIT_FILEPATH_MAX-1] = 0; /* force final NULL */ + H5FD_MIRROR_XMIT_FILEPATH_MAX - 1); + out->filename[H5FD_MIRROR_XMIT_FILEPATH_MAX - 1] = 0; /* force final NULL */ + return H5FD_MIRROR_XMIT_OPEN_SIZE; } /* end H5FD_mirror_xmit_decode_open() */ @@ -655,15 +695,19 @@ H5FD_mirror_xmit_decode_reply(H5FD_mirror_xmit_reply_t *out, const unsigned char *buf) { size_t n_eaten = 0; - LOG_OP_CALL("H5FD_mirror_xmit_decode_reply"); + + LOG_OP_CALL(__func__); + HDassert(out && buf); + n_eaten += H5FD_mirror_xmit_decode_header(&(out->pub), buf); n_eaten += H5FD__mirror_xmit_decode_uint32(&(out->status), &buf[n_eaten]); HDassert((H5FD_MIRROR_XMIT_REPLY_SIZE - H5FD_MIRROR_STATUS_MESSAGE_MAX) == n_eaten); HDstrncpy(out->message, (const char *)&buf[n_eaten], - H5FD_MIRROR_STATUS_MESSAGE_MAX-1); - out->message[H5FD_MIRROR_STATUS_MESSAGE_MAX-1] = 0; /* force NULL term */ + H5FD_MIRROR_STATUS_MESSAGE_MAX - 1); + out->message[H5FD_MIRROR_STATUS_MESSAGE_MAX - 1] = 0; /* force NULL term */ + return H5FD_MIRROR_XMIT_REPLY_SIZE; } /* end H5FD_mirror_xmit_decode_reply() */ @@ -692,12 +736,16 @@ H5FD_mirror_xmit_decode_set_eoa(H5FD_mirror_xmit_eoa_t *out, const unsigned char *buf) { size_t n_eaten = 0; - LOG_OP_CALL("H5FD_mirror_xmit_decode_set_eoa"); + + LOG_OP_CALL(__func__); + HDassert(out && buf); + n_eaten += H5FD_mirror_xmit_decode_header(&(out->pub), buf); n_eaten += H5FD__mirror_xmit_decode_uint8(&(out->type), &buf[n_eaten]); n_eaten += H5FD__mirror_xmit_decode_uint64(&(out->eoa_addr), &buf[n_eaten]); HDassert(n_eaten == H5FD_MIRROR_XMIT_EOA_SIZE); + return n_eaten; } /* end H5FD_mirror_xmit_decode_set_eoa() */ @@ -726,13 +774,17 @@ H5FD_mirror_xmit_decode_write(H5FD_mirror_xmit_write_t *out, const unsigned char *buf) { size_t n_eaten = 0; - LOG_OP_CALL("H5FD_mirror_xmit_decode_write"); + + LOG_OP_CALL(__func__); + HDassert(out && buf); + n_eaten += H5FD_mirror_xmit_decode_header(&(out->pub), buf); n_eaten += H5FD__mirror_xmit_decode_uint8(&(out->type), &buf[n_eaten]); n_eaten += H5FD__mirror_xmit_decode_uint64(&(out->offset), &buf[n_eaten]); n_eaten += H5FD__mirror_xmit_decode_uint64(&(out->size), &buf[n_eaten]); HDassert(n_eaten == H5FD_MIRROR_XMIT_WRITE_SIZE); + return n_eaten; } /* end H5FD_mirror_xmit_decode_write() */ @@ -756,14 +808,18 @@ H5FD_mirror_xmit_encode_header(unsigned char *dest, const H5FD_mirror_xmit_t *x) { size_t n_writ = 0; - LOG_OP_CALL("H5FD_mirror_xmit_encode_header"); + + LOG_OP_CALL(__func__); + HDassert(dest && x); + n_writ += H5FD__mirror_xmit_encode_uint32((dest+n_writ), x->magic); n_writ += H5FD__mirror_xmit_encode_uint8((dest+n_writ), x->version); n_writ += H5FD__mirror_xmit_encode_uint32((dest+n_writ), x->session_token); n_writ += H5FD__mirror_xmit_encode_uint32((dest+n_writ), x->xmit_count); n_writ += H5FD__mirror_xmit_encode_uint8((dest+n_writ), x->op); HDassert(n_writ == H5FD_MIRROR_XMIT_HEADER_SIZE); + return n_writ; } /* end H5FD_mirror_xmit_encode_header() */ @@ -786,12 +842,16 @@ H5FD_mirror_xmit_encode_lock(unsigned char *dest, const H5FD_mirror_xmit_lock_t *x) { size_t n_writ = 0; - LOG_OP_CALL("H5FD_mirror_xmit_encode_lock"); + + LOG_OP_CALL(__func__); + HDassert(dest && x); + n_writ += H5FD_mirror_xmit_encode_header(dest, (const H5FD_mirror_xmit_t *)&(x->pub)); n_writ += H5FD__mirror_xmit_encode_uint64(&dest[n_writ], x->rw); HDassert(n_writ == H5FD_MIRROR_XMIT_LOCK_SIZE); + return n_writ; } /* end H5FD_mirror_xmit_encode_lock() */ @@ -815,13 +875,14 @@ H5FD_mirror_xmit_encode_open(unsigned char *dest, const H5FD_mirror_xmit_open_t *x) { size_t n_writ = 0; - LOG_OP_CALL("H5FD_mirror_xmit_encode_open"); + + LOG_OP_CALL(__func__); + HDassert(dest && x); + /* clear entire structure, but especially its filepath string area */ - for (n_writ = 0; n_writ < H5FD_MIRROR_XMIT_OPEN_SIZE; n_writ++) { - *(dest+n_writ) = 0; - } - n_writ = 0; + HDmemset(dest, 0, H5FD_MIRROR_XMIT_OPEN_SIZE); + n_writ += H5FD_mirror_xmit_encode_header(dest, (const H5FD_mirror_xmit_t *)&(x->pub)); n_writ += H5FD__mirror_xmit_encode_uint32(&dest[n_writ], x->flags); @@ -829,8 +890,8 @@ H5FD_mirror_xmit_encode_open(unsigned char *dest, n_writ += H5FD__mirror_xmit_encode_uint64(&dest[n_writ], x->size_t_blob); HDassert((H5FD_MIRROR_XMIT_OPEN_SIZE - H5FD_MIRROR_XMIT_FILEPATH_MAX) == n_writ); - HDstrncpy((char *)&dest[n_writ], x->filename, - H5FD_MIRROR_XMIT_FILEPATH_MAX); + HDstrncpy((char *)&dest[n_writ], x->filename, H5FD_MIRROR_XMIT_FILEPATH_MAX); + return H5FD_MIRROR_XMIT_OPEN_SIZE; } /* end H5FD_mirror_xmit_encode_open() */ @@ -855,20 +916,21 @@ H5FD_mirror_xmit_encode_reply(unsigned char *dest, const H5FD_mirror_xmit_reply_t *x) { size_t n_writ = 0; - LOG_OP_CALL("H5FD_mirror_xmit_encode_reply"); + + LOG_OP_CALL(__func__); + HDassert(dest && x); + /* clear entire structure, but especially its message string area */ - for (n_writ = 0; n_writ < H5FD_MIRROR_XMIT_REPLY_SIZE; n_writ++) { - *(dest+n_writ) = 0; - } - n_writ = 0; + HDmemset(dest, 0, H5FD_MIRROR_XMIT_REPLY_SIZE); + n_writ += H5FD_mirror_xmit_encode_header(dest, (const H5FD_mirror_xmit_t *)&(x->pub)); n_writ += H5FD__mirror_xmit_encode_uint32(&dest[n_writ], x->status); HDassert((H5FD_MIRROR_XMIT_REPLY_SIZE - H5FD_MIRROR_STATUS_MESSAGE_MAX) == n_writ); - HDstrncpy((char *)&dest[n_writ], x->message, - H5FD_MIRROR_STATUS_MESSAGE_MAX); + HDstrncpy((char *)&dest[n_writ], x->message, H5FD_MIRROR_STATUS_MESSAGE_MAX); + return H5FD_MIRROR_XMIT_REPLY_SIZE; } /* end H5FD_mirror_xmit_encode_reply() */ @@ -892,13 +954,17 @@ H5FD_mirror_xmit_encode_set_eoa(unsigned char *dest, const H5FD_mirror_xmit_eoa_t *x) { size_t n_writ = 0; - LOG_OP_CALL("H5FD_mirror_xmit_encode_set_eoa"); + + LOG_OP_CALL(__func__); + HDassert(dest && x); + n_writ += H5FD_mirror_xmit_encode_header(dest, (const H5FD_mirror_xmit_t *)&(x->pub)); n_writ += H5FD__mirror_xmit_encode_uint8(&dest[n_writ], x->type); n_writ += H5FD__mirror_xmit_encode_uint64(&dest[n_writ], x->eoa_addr); HDassert(n_writ == H5FD_MIRROR_XMIT_EOA_SIZE); + return n_writ; } /* end H5FD_mirror_xmit_encode_set_eoa() */ @@ -922,14 +988,18 @@ H5FD_mirror_xmit_encode_write(unsigned char *dest, const H5FD_mirror_xmit_write_t *x) { size_t n_writ = 0; - LOG_OP_CALL("H5FD_mirror_xmit_encode_write"); + + LOG_OP_CALL(__func__); + HDassert(dest && x); + n_writ += H5FD_mirror_xmit_encode_header(dest, (const H5FD_mirror_xmit_t *)&(x->pub)); n_writ += H5FD__mirror_xmit_encode_uint8(&dest[n_writ], x->type); n_writ += H5FD__mirror_xmit_encode_uint64(&dest[n_writ], x->offset); n_writ += H5FD__mirror_xmit_encode_uint64(&dest[n_writ], x->size); HDassert(n_writ == H5FD_MIRROR_XMIT_WRITE_SIZE); + return n_writ; } /* end H5FD_mirror_xmit_encode_write() */ @@ -944,16 +1014,16 @@ H5FD_mirror_xmit_encode_write(unsigned char *dest, * Return: TRUE if valid; else FALSE. * --------------------------------------------------------------------------- */ -hbool_t +H5_ATTR_PURE hbool_t H5FD_mirror_xmit_is_close(const H5FD_mirror_xmit_t *xmit) { - LOG_OP_CALL("H5FD_mirror_xmit_is_close"); + LOG_OP_CALL(__func__); + HDassert(xmit); - if ( (TRUE == H5FD_mirror_xmit_is_xmit(xmit)) && - (H5FD_MIRROR_OP_CLOSE == xmit->op) ) - { + + if((TRUE == H5FD_mirror_xmit_is_xmit(xmit)) && (H5FD_MIRROR_OP_CLOSE == xmit->op)) return TRUE; - } + return FALSE; } /* end H5FD_mirror_xmit_is_close() */ @@ -968,16 +1038,16 @@ H5FD_mirror_xmit_is_close(const H5FD_mirror_xmit_t *xmit) * Return: TRUE if valid; else FALSE. * --------------------------------------------------------------------------- */ -hbool_t +H5_ATTR_PURE hbool_t H5FD_mirror_xmit_is_lock(const H5FD_mirror_xmit_lock_t *xmit) { - LOG_OP_CALL("H5FD_mirror_xmit_is_lock"); + LOG_OP_CALL(__func__); + HDassert(xmit); - if ( (TRUE == H5FD_mirror_xmit_is_xmit(&(xmit->pub))) && - (H5FD_MIRROR_OP_LOCK == xmit->pub.op) ) - { + + if((TRUE == H5FD_mirror_xmit_is_xmit(&(xmit->pub))) && (H5FD_MIRROR_OP_LOCK == xmit->pub.op)) return TRUE; - } + return FALSE; } /* end H5FD_mirror_xmit_is_lock() */ @@ -992,16 +1062,17 @@ H5FD_mirror_xmit_is_lock(const H5FD_mirror_xmit_lock_t *xmit) * Return: TRUE if valid; else FALSE. * --------------------------------------------------------------------------- */ -hbool_t +H5_ATTR_PURE hbool_t H5FD_mirror_xmit_is_open(const H5FD_mirror_xmit_open_t *xmit) { - LOG_OP_CALL("H5FD_mirror_xmit_is_open"); + LOG_OP_CALL(__func__); + HDassert(xmit); - if ( (TRUE == H5FD_mirror_xmit_is_xmit(&(xmit->pub))) && - (H5FD_MIRROR_OP_OPEN == xmit->pub.op) ) - { + + if((TRUE == H5FD_mirror_xmit_is_xmit(&(xmit->pub))) && (H5FD_MIRROR_OP_OPEN == xmit->pub.op)) + return TRUE; - } + return FALSE; } /* end H5FD_mirror_xmit_is_open() */ @@ -1016,16 +1087,16 @@ H5FD_mirror_xmit_is_open(const H5FD_mirror_xmit_open_t *xmit) * Return: TRUE if valid; else FALSE. * --------------------------------------------------------------------------- */ -hbool_t +H5_ATTR_PURE hbool_t H5FD_mirror_xmit_is_set_eoa(const H5FD_mirror_xmit_eoa_t *xmit) { - LOG_OP_CALL("H5FD_mirror_xmit_is_set_eoa"); + LOG_OP_CALL(__func__); + HDassert(xmit); - if ( (TRUE == H5FD_mirror_xmit_is_xmit(&(xmit->pub))) && - (H5FD_MIRROR_OP_SET_EOA == xmit->pub.op) ) - { + + if((TRUE == H5FD_mirror_xmit_is_xmit(&(xmit->pub))) && (H5FD_MIRROR_OP_SET_EOA == xmit->pub.op)) return TRUE; - } + return FALSE; } /* end H5FD_mirror_xmit_is_eoa() */ @@ -1040,16 +1111,16 @@ H5FD_mirror_xmit_is_set_eoa(const H5FD_mirror_xmit_eoa_t *xmit) * Return: TRUE if valid; else FALSE. * --------------------------------------------------------------------------- */ -hbool_t +H5_ATTR_PURE hbool_t H5FD_mirror_xmit_is_reply(const H5FD_mirror_xmit_reply_t *xmit) { - LOG_OP_CALL("H5FD_mirror_xmit_is_reply"); + LOG_OP_CALL(__func__); + HDassert(xmit); - if ( (TRUE == H5FD_mirror_xmit_is_xmit(&(xmit->pub))) && - (H5FD_MIRROR_OP_REPLY == xmit->pub.op) ) - { + + if((TRUE == H5FD_mirror_xmit_is_xmit(&(xmit->pub))) && (H5FD_MIRROR_OP_REPLY == xmit->pub.op)) return TRUE; - } + return FALSE; } /* end H5FD_mirror_xmit_is_reply() */ @@ -1064,16 +1135,16 @@ H5FD_mirror_xmit_is_reply(const H5FD_mirror_xmit_reply_t *xmit) * Return: TRUE if valid; else FALSE. * --------------------------------------------------------------------------- */ -hbool_t +H5_ATTR_PURE hbool_t H5FD_mirror_xmit_is_write(const H5FD_mirror_xmit_write_t *xmit) { - LOG_OP_CALL("H5FD_mirror_xmit_is_write"); + LOG_OP_CALL(__func__); + HDassert(xmit); - if ( (TRUE == H5FD_mirror_xmit_is_xmit(&(xmit->pub))) && - (H5FD_MIRROR_OP_WRITE == xmit->pub.op) ) - { + + if((TRUE == H5FD_mirror_xmit_is_xmit(&(xmit->pub))) && (H5FD_MIRROR_OP_WRITE == xmit->pub.op)) return TRUE; - } + return FALSE; } /* end H5FD_mirror_xmit_is_write() */ @@ -1088,16 +1159,16 @@ H5FD_mirror_xmit_is_write(const H5FD_mirror_xmit_write_t *xmit) * Return: TRUE if valid; else FALSE. * --------------------------------------------------------------------------- */ -hbool_t +H5_ATTR_PURE hbool_t H5FD_mirror_xmit_is_xmit(const H5FD_mirror_xmit_t *xmit) { - LOG_OP_CALL("H5FD_mirror_xmit_is_xmit"); + LOG_OP_CALL(__func__); + HDassert(xmit); - if ( (H5FD_MIRROR_XMIT_MAGIC != xmit->magic) || - (H5FD_MIRROR_XMIT_CURR_VERSION != xmit->version) ) - { + + if((H5FD_MIRROR_XMIT_MAGIC != xmit->magic) || (H5FD_MIRROR_XMIT_CURR_VERSION != xmit->version)) return FALSE; - } + return TRUE; } /* end H5FD_mirror_xmit_is_xmit() */ @@ -1113,60 +1184,55 @@ H5FD_mirror_xmit_is_xmit(const H5FD_mirror_xmit_t *xmit) * Return: SUCCEED if ok, else FAIL. * ---------------------------------------------------------------------------- */ -herr_t +static herr_t H5FD__mirror_verify_reply(H5FD_mirror_t *file) { - char xmit_buf[H5FD_MIRROR_XMIT_REPLY_SIZE]; + unsigned char *xmit_buf = NULL; struct H5FD_mirror_xmit_reply_t reply; ssize_t read_ret = 0; herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT; + FUNC_ENTER_STATIC - LOG_OP_CALL("H5FD__mirror_verify_reply"); + LOG_OP_CALL(FUNC); HDassert(file && file->sock_fd); + xmit_buf = H5FL_BLK_MALLOC(xmit, H5FD_MIRROR_XMIT_BUFFER_MAX); + if(NULL == xmit_buf) + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "unable to allocate xmit buffer"); + read_ret = HDread(file->sock_fd, xmit_buf, H5FD_MIRROR_XMIT_REPLY_SIZE); - if (read_ret < 0) { + if(read_ret < 0) HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "unable to read reply"); - } - if (read_ret != H5FD_MIRROR_XMIT_REPLY_SIZE) { + if(read_ret != H5FD_MIRROR_XMIT_REPLY_SIZE) HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "unexpected read size"); - } LOG_XMIT_BYTES("reply", xmit_buf, read_ret); - if (H5FD_mirror_xmit_decode_reply(&reply, (const unsigned char *)xmit_buf) - != H5FD_MIRROR_XMIT_REPLY_SIZE) - { + if(H5FD_mirror_xmit_decode_reply(&reply, xmit_buf) != H5FD_MIRROR_XMIT_REPLY_SIZE) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "unable to decode reply xmit"); - } - if (H5FD_mirror_xmit_is_reply(&reply) != TRUE) { + if(H5FD_mirror_xmit_is_reply(&reply) != TRUE) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "xmit op code was not REPLY"); - } - if (reply.pub.session_token != file->xmit.session_token) { + if(reply.pub.session_token != file->xmit.session_token) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "wrong session"); - } - - if (reply.pub.xmit_count != (file->xmit_i)++) { + if(reply.pub.xmit_count != (file->xmit_i)++) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "xmit out of sync"); - } - - if (reply.status != H5FD_MIRROR_STATUS_OK) { - HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, - "%s", (const char *)(reply.message)); - } + if(reply.status != H5FD_MIRROR_STATUS_OK) + HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "%s", (const char *)(reply.message)); done: + if(xmit_buf) + xmit_buf = H5FL_BLK_FREE(xmit, xmit_buf); + FUNC_LEAVE_NOAPI(ret_value); } /* end H5FD__mirror_verify_reply() */ /* ------------------------------------------------------------------------- - * Function: H5FD_mirror_fapl_get + * Function: H5FD__mirror_fapl_get * * Purpose: Get the file access propety list which could be used to create * an identical file. @@ -1176,37 +1242,35 @@ done: * ------------------------------------------------------------------------- */ static void * -H5FD_mirror_fapl_get(H5FD_t *_file) +H5FD__mirror_fapl_get(H5FD_t *_file) { H5FD_mirror_t *file = (H5FD_mirror_t *)_file; H5FD_mirror_fapl_t *fa = NULL; void *ret_value = NULL; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC - LOG_OP_CALL("H5FD_mirror_fapl_get"); + LOG_OP_CALL(FUNC); fa = (H5FD_mirror_fapl_t *)H5MM_calloc(sizeof(H5FD_mirror_fapl_t)); - if (NULL == fa) { - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "calloc failed"); - } + if(NULL == fa) + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "calloc failed"); HDmemcpy(fa, &(file->fa), sizeof(H5FD_mirror_fapl_t)); ret_value = fa; done: - if (ret_value == NULL) { - if (fa != NULL) { + if(ret_value == NULL) + if(fa != NULL) H5MM_xfree(fa); - } - } + FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_mirror_fapl_get() */ +} /* end H5FD__mirror_fapl_get() */ /* ------------------------------------------------------------------------- - * Function: H5FD_mirror_fapl_copy + * Function: H5FD__mirror_fapl_copy * * Purpose: Copies the mirror vfd-specific file access properties. * @@ -1215,37 +1279,34 @@ done: * ------------------------------------------------------------------------- */ static void * -H5FD_mirror_fapl_copy(const void *_old_fa) +H5FD__mirror_fapl_copy(const void *_old_fa) { const H5FD_mirror_fapl_t *old_fa = (const H5FD_mirror_fapl_t *)_old_fa; H5FD_mirror_fapl_t *new_fa = NULL; void *ret_value = NULL; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC - LOG_OP_CALL("H5FD_mirror_fapl_copy"); + LOG_OP_CALL(FUNC); new_fa = (H5FD_mirror_fapl_t *)H5MM_malloc(sizeof(H5FD_mirror_fapl_t)); - if (new_fa == NULL) { - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, - "memory allocation failed"); - } + if(new_fa == NULL) + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "memory allocation failed"); HDmemcpy(new_fa, old_fa, sizeof(H5FD_mirror_fapl_t)); ret_value = new_fa; done: - if (ret_value == NULL) { - if (new_fa != NULL) { + if(ret_value == NULL) + if(new_fa != NULL) H5MM_xfree(new_fa); - } - } + FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_mirror_fapl_copy() */ +} /* end H5FD__mirror_fapl_copy() */ /*------------------------------------------------------------------------- - * Function: H5FD_mirror_fapl_free + * Function: H5FD__mirror_fapl_free * * Purpose: Frees the mirror VFD-specific file access properties. * @@ -1253,13 +1314,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_mirror_fapl_free(void *_fa) +H5FD__mirror_fapl_free(void *_fa) { H5FD_mirror_fapl_t *fa = (H5FD_mirror_fapl_t*)_fa; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR - LOG_OP_CALL("H5FD_mirror_fapl_free"); + LOG_OP_CALL(FUNC); /* sanity check */ HDassert(fa != NULL); @@ -1269,7 +1330,7 @@ H5FD_mirror_fapl_free(void *_fa) H5MM_xfree(fa); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5FD_mirror_fapl_free() */ +} /* end H5FD__mirror_fapl_free() */ /* ------------------------------------------------------------------------- @@ -1291,26 +1352,20 @@ H5Pget_fapl_mirror(hid_t fapl_id, H5FD_mirror_fapl_t *fa_out) FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*x", fapl_id, fa_out); - LOG_OP_CALL("H5Pget_fapl_mirror"); + LOG_OP_CALL(FUNC); - if (NULL == fa_out) { + if(NULL == fa_out) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "fa_out is NULL"); - } plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS); - if (NULL == plist) { - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, - "not a file access property list"); - } - - if (H5P_peek_driver(plist) != H5FD_MIRROR) { + if(NULL == plist) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); + if(H5P_peek_driver(plist) != H5FD_MIRROR) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver"); - } fa = (const H5FD_mirror_fapl_t *)H5P_peek_driver_info(plist); - if (NULL == fa) { + if(NULL == fa) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info"); - } HDassert(fa->magic == H5FD_MIRROR_FAPL_MAGIC); /* sanity check */ @@ -1339,22 +1394,17 @@ H5Pset_fapl_mirror(hid_t fapl_id, H5FD_mirror_fapl_t *fa) FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*x", fapl_id, fa); - LOG_OP_CALL("H5Pset_fapl_mirror"); + LOG_OP_CALL(FUNC); plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS); - if (NULL == plist) { - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, - "not a file access property list"); - } - if (NULL == fa) { + if(NULL == plist) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); + if(NULL == fa) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "null fapl_t pointer"); - } - if (H5FD_MIRROR_FAPL_MAGIC != fa->magic) { + if(H5FD_MIRROR_FAPL_MAGIC != fa->magic) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fapl_t magic"); - } - if (H5FD_MIRROR_CURR_FAPL_T_VERSION != fa->version) { + if(H5FD_MIRROR_CURR_FAPL_T_VERSION != fa->version) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown fapl_t version"); - } ret_value = H5P_set_driver(plist, H5FD_MIRROR, (const void *)fa); @@ -1364,7 +1414,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_mirror_open + * Function: H5FD__mirror_open * * Purpose: Create and/or opens a file as an HDF5 file. * @@ -1378,64 +1428,51 @@ done: *------------------------------------------------------------------------- */ static H5FD_t * -H5FD_mirror_open(const char *name, +H5FD__mirror_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) { -#define MIRR_OPEN_MAXBUF 16 /* local symbol to give meaning to magic number */ - /* #defined because it is needed at compile time */ - /* Large enough to hold a port number string */ int live_socket = -1; struct sockaddr_in target_addr; socklen_t addr_size; - char xmit_buf[H5FD_MIRROR_XMIT_OPEN_SIZE]; + unsigned char *xmit_buf = NULL; H5FD_mirror_fapl_t fa; H5FD_mirror_t *file = NULL; - H5FD_mirror_xmit_open_t open_xmit; + H5FD_mirror_xmit_open_t *open_xmit = NULL; H5FD_t *ret_value = NULL; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC - LOG_OP_CALL("H5FD_mirror_open"); + LOG_OP_CALL(FUNC); /* --------------- */ /* Check arguments */ /* --------------- */ - if (!name || !*name) { + if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid file name"); - } - if (HDstrlen(name) >= H5FD_MIRROR_XMIT_FILEPATH_MAX) { + if(HDstrlen(name) >= H5FD_MIRROR_XMIT_FILEPATH_MAX) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "filename is too long"); - } - if (0 == maxaddr || HADDR_UNDEF == maxaddr) { + if(0 == maxaddr || HADDR_UNDEF == maxaddr) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "bogus maxaddr"); - } - if (ADDR_OVERFLOW(maxaddr)) { + if(ADDR_OVERFLOW(maxaddr)) HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, NULL, "bogus maxaddr"); - } - if (H5Pget_fapl_mirror(fapl_id, &fa) == FAIL) { + if(H5Pget_fapl_mirror(fapl_id, &fa) == FAIL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "can't get config info"); - } - - if (H5FD_MIRROR_FAPL_MAGIC != fa.magic) { + if(H5FD_MIRROR_FAPL_MAGIC != fa.magic) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid fapl magic"); - } - - if (H5FD_MIRROR_CURR_FAPL_T_VERSION != fa.version) { + if(H5FD_MIRROR_CURR_FAPL_T_VERSION != fa.version) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid fapl version"); - } /* --------------------- */ /* Handshake with remote */ /* --------------------- */ live_socket = HDsocket(AF_INET, SOCK_STREAM, 0); - if (live_socket < 0) { + if(live_socket < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "can't create socket"); - } target_addr.sin_family = AF_INET; target_addr.sin_port = HDhtons((uint16_t)fa.handshake_port); @@ -1443,21 +1480,16 @@ H5FD_mirror_open(const char *name, HDmemset(target_addr.sin_zero, '\0', sizeof target_addr.sin_zero); addr_size = sizeof(target_addr); - if (HDconnect(live_socket, (struct sockaddr *)&target_addr, addr_size) < 0) - { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "can't connect to remote server"); - } + if(HDconnect(live_socket, (struct sockaddr *)&target_addr, addr_size) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "can't connect to remote server"); /* ------------- */ /* Open the file */ /* ------------- */ file = (H5FD_mirror_t *)H5FL_CALLOC(H5FD_mirror_t); - if (NULL == file) { - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, - "unable to allocate file struct"); - } + if(NULL == file) + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "unable to allocate file struct"); file->sock_fd = live_socket; file->xmit_i = 0; @@ -1468,49 +1500,53 @@ H5FD_mirror_open(const char *name, file->xmit.session_token = (uint32_t)(0x01020304 ^ file->sock_fd); /* TODO: hashing? */ /* int --> uint32_t may truncate on some systems... shouldn't matter? */ + open_xmit = (H5FD_mirror_xmit_open_t *)H5FL_CALLOC(H5FD_mirror_xmit_open_t); + if(NULL == open_xmit) + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "unable to allocate open_xmit struct"); + file->xmit.op = H5FD_MIRROR_OP_OPEN; - open_xmit.pub = file->xmit; - open_xmit.flags = (uint32_t)flags; - open_xmit.maxaddr = (uint64_t)maxaddr; - open_xmit.size_t_blob = (uint64_t)((size_t)(-1)); - HDsnprintf(open_xmit.filename, H5FD_MIRROR_XMIT_FILEPATH_MAX-1, "%s", name); - - if (H5FD_mirror_xmit_encode_open((unsigned char *)xmit_buf, - (const H5FD_mirror_xmit_open_t *)&open_xmit) - != H5FD_MIRROR_XMIT_OPEN_SIZE) - { + open_xmit->pub = file->xmit; + open_xmit->flags = (uint32_t)flags; + open_xmit->maxaddr = (uint64_t)maxaddr; + open_xmit->size_t_blob = (uint64_t)((size_t)(-1)); + HDsnprintf(open_xmit->filename, H5FD_MIRROR_XMIT_FILEPATH_MAX-1, "%s", name); + + xmit_buf = H5FL_BLK_MALLOC(xmit, H5FD_MIRROR_XMIT_BUFFER_MAX); + if(NULL == xmit_buf) + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "unable to allocate xmit buffer"); + + if(H5FD_mirror_xmit_encode_open(xmit_buf, open_xmit) != H5FD_MIRROR_XMIT_OPEN_SIZE) HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, NULL, "unable to encode open"); - } LOG_XMIT_BYTES("open", xmit_buf, H5FD_MIRROR_XMIT_OPEN_SIZE); - if (HDwrite(file->sock_fd, xmit_buf, H5FD_MIRROR_XMIT_OPEN_SIZE) < 0) { + if(HDwrite(file->sock_fd, xmit_buf, H5FD_MIRROR_XMIT_OPEN_SIZE) < 0) HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, NULL, "unable to transmit open"); - } - if (H5FD__mirror_verify_reply(file) == FAIL) { + if(H5FD__mirror_verify_reply(file) == FAIL) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "invalid reply"); - } ret_value = (H5FD_t *)file; done: - if (NULL == ret_value) { - if (file) { + if(NULL == ret_value) { + if(file) file = H5FL_FREE(H5FD_mirror_t, file); - } - if (live_socket >= 0 && HDclose(live_socket) < 0) { - HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, NULL, - "can't close socket"); - } + if(live_socket >= 0 && HDclose(live_socket) < 0) + HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, NULL, "can't close socket"); } + + if(open_xmit) + open_xmit = H5FL_FREE(H5FD_mirror_xmit_open_t, open_xmit); + if(xmit_buf) + xmit_buf = H5FL_BLK_FREE(xmit, xmit_buf); + FUNC_LEAVE_NOAPI(ret_value) -#undef MIRR_OPEN_MAXBUF -} /* end H5FD_mirror_open() */ +} /* end H5FD__mirror_open() */ /*------------------------------------------------------------------------- - * Function: H5FD_mirror_close + * Function: H5FD__mirror_close * * Purpose: Closes the HDF5 file. * @@ -1525,16 +1561,16 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_mirror_close(H5FD_t *_file) +H5FD__mirror_close(H5FD_t *_file) { H5FD_mirror_t *file = (H5FD_mirror_t *)_file; - unsigned char xmit_buf[H5FD_MIRROR_XMIT_HEADER_SIZE]; + unsigned char *xmit_buf = NULL; int xmit_encoded = 0; /* monitor point of failure */ herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC - LOG_OP_CALL("H5FD_mirror_close"); + LOG_OP_CALL(FUNC); /* Sanity check */ HDassert(file); @@ -1543,68 +1579,59 @@ H5FD_mirror_close(H5FD_t *_file) file->xmit.xmit_count = (file->xmit_i)++; file->xmit.op = H5FD_MIRROR_OP_CLOSE; - if (H5FD_mirror_xmit_encode_header(xmit_buf, - (const H5FD_mirror_xmit_t *)&(file->xmit)) - != H5FD_MIRROR_XMIT_HEADER_SIZE) - { + xmit_buf = H5FL_BLK_MALLOC(xmit, H5FD_MIRROR_XMIT_BUFFER_MAX); + if(NULL == xmit_buf) + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "unable to allocate xmit buffer"); + + if(H5FD_mirror_xmit_encode_header(xmit_buf, &(file->xmit)) != H5FD_MIRROR_XMIT_HEADER_SIZE) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to encode close"); - } xmit_encoded = 1; LOG_XMIT_BYTES("close", xmit_buf, H5FD_MIRROR_XMIT_HEADER_SIZE); - if (HDwrite(file->sock_fd, xmit_buf, H5FD_MIRROR_XMIT_HEADER_SIZE) < 0) { + if(HDwrite(file->sock_fd, xmit_buf, H5FD_MIRROR_XMIT_HEADER_SIZE) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to transmit close"); - } - if (H5FD__mirror_verify_reply(file) == FAIL) { + if(H5FD__mirror_verify_reply(file) == FAIL) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "invalid reply"); - } - if (HDclose(file->sock_fd) < 0) { + if(HDclose(file->sock_fd) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "can't close socket"); - } done: - if (ret_value == FAIL) { - if (xmit_encoded == 0) { + if(ret_value == FAIL) { + if(xmit_encoded == 0) { /* Encode failed; send GOODBYE to force writer halt. * We can ignore any response from the writer, if we receive * any reply at all. */ - if (HDwrite(file->sock_fd, "GOODBYE", HDstrlen("GOODBYE")) < 0) { - HDONE_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "unable to transmit close"); - if (HDclose(file->sock_fd) < 0) { - HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, - "can't close socket"); - } + if(HDwrite(file->sock_fd, "GOODBYE", HDstrlen("GOODBYE")) < 0) { + HDONE_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to transmit close"); + if(HDclose(file->sock_fd) < 0) + HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "can't close socket"); file->sock_fd = -1; /* invalidate for later */ } /* end if problem writing goodbye; go down hard */ else - if (HDshutdown(file->sock_fd, SHUT_WR) < 0) { - HDONE_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, - "can't shutdown socket write: %s", - HDstrerror(errno)); - } /* end else-if problem shutting down socket */ + if(HDshutdown(file->sock_fd, SHUT_WR) < 0) + HDONE_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "can't shutdown socket write: %s", HDstrerror(errno)); } /* end if xmit encode failed */ - if (file->sock_fd >= 0) { - if (HDclose(file->sock_fd) < 0) { - HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, - "can't close socket"); - } - } /* end if socket not closed by going down hard */ + if(file->sock_fd >= 0) + if(HDclose(file->sock_fd) < 0) + HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "can't close socket"); } /* end if error */ file = H5FL_FREE(H5FD_mirror_t, file); /* always release resources */ + if(xmit_buf) + xmit_buf = H5FL_BLK_FREE(xmit, xmit_buf); + FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_mirror_close() */ +} /* end H5FD__mirror_close() */ /*------------------------------------------------------------------------- - * Function: H5FD_mirror_query + * Function: H5FD__mirror_query * * Purpose: Get the driver feature flags implemented by the driver. * @@ -1612,11 +1639,11 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_mirror_query(const H5FD_t H5_ATTR_UNUSED *_file, unsigned long *flags) +H5FD__mirror_query(const H5FD_t H5_ATTR_UNUSED *_file, unsigned long *flags) { - FUNC_ENTER_NOAPI_NOINIT_NOERR; + FUNC_ENTER_STATIC_NOERR; - LOG_OP_CALL("H5FD_mirror_query"); + LOG_OP_CALL(FUNC); /* Notice: the Mirror VFD Writer currently uses only the Sec2 driver as * the underying driver -- as such, the Mirror VFD implementation copies @@ -1626,23 +1653,21 @@ H5FD_mirror_query(const H5FD_t H5_ATTR_UNUSED *_file, unsigned long *flags) * is never included. * -- JOS 2020-01-13 */ - if (flags) { - *flags = 0 \ - | H5FD_FEAT_AGGREGATE_METADATA \ + if(flags) + *flags = H5FD_FEAT_AGGREGATE_METADATA \ | H5FD_FEAT_ACCUMULATE_METADATA \ | H5FD_FEAT_DATA_SIEVE \ | H5FD_FEAT_AGGREGATE_SMALLDATA \ | H5FD_FEAT_POSIX_COMPAT_HANDLE \ | H5FD_FEAT_SUPPORTS_SWMR_IO \ | H5FD_FEAT_DEFAULT_VFD_COMPATIBLE; - } FUNC_LEAVE_NOAPI(SUCCEED); -} /* end H5FD_mirror_query() */ +} /* end H5FD__mirror_query() */ /*------------------------------------------------------------------------- - * Function: H5FD_mirror_get_eoa + * Function: H5FD__mirror_get_eoa * * Purpose: Gets the end-of-address marker for the file. The EOA marker * is the first address past the last byte allocated in the @@ -1654,22 +1679,22 @@ H5FD_mirror_query(const H5FD_t H5_ATTR_UNUSED *_file, unsigned long *flags) *------------------------------------------------------------------------- */ static haddr_t -H5FD_mirror_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) +H5FD__mirror_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) { const H5FD_mirror_t *file = (const H5FD_mirror_t *)_file; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR - LOG_OP_CALL("H5FD_mirror_get_eoa"); + LOG_OP_CALL(FUNC); HDassert(file); FUNC_LEAVE_NOAPI(file->eoa) -} /* end H5FD_mirror_get_eoa() */ +} /* end H5FD__mirror_get_eoa() */ /*------------------------------------------------------------------------- - * Function: H5FD_mirror_set_eoa + * Function: H5FD__mirror_set_eoa * * Purpose: Set the end-of-address marker for the file. This function is * called shortly after an existing HDF5 file is opened in order @@ -1679,16 +1704,16 @@ H5FD_mirror_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) *------------------------------------------------------------------------- */ static herr_t -H5FD_mirror_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr) +H5FD__mirror_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr) { H5FD_mirror_xmit_eoa_t xmit_eoa; - unsigned char xmit_buf[H5FD_MIRROR_XMIT_EOA_SIZE]; + unsigned char *xmit_buf = NULL; H5FD_mirror_t *file = (H5FD_mirror_t *)_file; herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC - LOG_OP_CALL("H5FD_mirror_set_eoa"); + LOG_OP_CALL(FUNC); HDassert(file); @@ -1701,31 +1726,31 @@ H5FD_mirror_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr) xmit_eoa.type = (uint8_t)type; xmit_eoa.eoa_addr = (uint64_t)addr; - if (H5FD_mirror_xmit_encode_set_eoa(xmit_buf, - (const H5FD_mirror_xmit_eoa_t *)&xmit_eoa) - != H5FD_MIRROR_XMIT_EOA_SIZE) - { + xmit_buf = H5FL_BLK_MALLOC(xmit, H5FD_MIRROR_XMIT_BUFFER_MAX); + if(NULL == xmit_buf) + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "unable to allocate xmit buffer"); + + if(H5FD_mirror_xmit_encode_set_eoa(xmit_buf, &xmit_eoa) != H5FD_MIRROR_XMIT_EOA_SIZE) HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "unable to encode set-eoa"); - } LOG_XMIT_BYTES("set-eoa", xmit_buf, H5FD_MIRROR_XMIT_EOA_SIZE); - if (HDwrite(file->sock_fd, xmit_buf, H5FD_MIRROR_XMIT_EOA_SIZE) < 0) { - HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, - "unable to transmit set-eoa"); - } + if(HDwrite(file->sock_fd, xmit_buf, H5FD_MIRROR_XMIT_EOA_SIZE) < 0) + HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "unable to transmit set-eoa"); - if (H5FD__mirror_verify_reply(file) == FAIL) { + if(H5FD__mirror_verify_reply(file) == FAIL) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "invalid reply"); - } done: + if(xmit_buf) + xmit_buf = H5FL_BLK_FREE(xmit, xmit_buf); + FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_mirror_set_eoa() */ +} /* end H5FD__mirror_set_eoa() */ /*------------------------------------------------------------------------- - * Function: H5FD_mirror_get_eof + * Function: H5FD__mirror_get_eof * * Purpose: Returns the end-of-file marker, which is the greater of * either the filesystem end-of-file or the HDF5 end-of-address @@ -1738,49 +1763,43 @@ done: *------------------------------------------------------------------------- */ static haddr_t -H5FD_mirror_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) +H5FD__mirror_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) { const H5FD_mirror_t *file = (const H5FD_mirror_t *)_file; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR - LOG_OP_CALL("H5FD_mirror_get_eof"); + LOG_OP_CALL(FUNC); HDassert(file); FUNC_LEAVE_NOAPI(file->eof) -} /* end H5FD_mirror_get_eof() */ +} /* end H5FD__mirror_get_eof() */ /*------------------------------------------------------------------------- - * Function: H5FD_mirror_read + * Function: H5FD__mirror_read * - * Purpose: Required to register the driver. - * If called, MUST fail. + * Purpose: Required to register the driver, but if called, MUST fail. * * Return: FAIL *------------------------------------------------------------------------- */ static herr_t -H5FD_mirror_read(H5FD_t H5_ATTR_UNUSED *_file, - H5FD_mem_t H5_ATTR_UNUSED type, - hid_t H5_ATTR_UNUSED fapl_id, - haddr_t H5_ATTR_UNUSED addr, - size_t H5_ATTR_UNUSED size, - void H5_ATTR_UNUSED *buf) +H5FD__mirror_read(H5FD_t H5_ATTR_UNUSED *_file, H5FD_mem_t H5_ATTR_UNUSED type, + hid_t H5_ATTR_UNUSED fapl_id, haddr_t H5_ATTR_UNUSED addr, + size_t H5_ATTR_UNUSED size, void H5_ATTR_UNUSED *buf) { - herr_t ret_value = FAIL; + FUNC_ENTER_STATIC_NOERR - FUNC_ENTER_NOAPI_NOINIT_NOERR + LOG_OP_CALL(FUNC); - LOG_OP_CALL("H5FD_mirror_read"); - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_mirror_read() */ + FUNC_LEAVE_NOAPI(FAIL) +} /* end H5FD__mirror_read() */ /*------------------------------------------------------------------------- - * Function: H5FD_mirror_write + * Function: H5FD__mirror_write * * Purpose: Writes SIZE bytes of data to FILE beginning at address ADDR * from buffer BUF according to data transfer properties in @@ -1797,21 +1816,17 @@ H5FD_mirror_read(H5FD_t H5_ATTR_UNUSED *_file, *------------------------------------------------------------------------- */ static herr_t -H5FD_mirror_write(H5FD_t *_file, - H5FD_mem_t type, - hid_t H5_ATTR_UNUSED dxpl_id, - haddr_t addr, - size_t size, - const void *buf) +H5FD__mirror_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, + haddr_t addr, size_t size, const void *buf) { H5FD_mirror_xmit_write_t xmit_write; - unsigned char xmit_buf[H5FD_MIRROR_XMIT_WRITE_SIZE]; + unsigned char *xmit_buf = NULL; H5FD_mirror_t *file = (H5FD_mirror_t *)_file; herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC - LOG_OP_CALL("H5FD_mirror_write"); + LOG_OP_CALL(FUNC); HDassert(file); HDassert(buf); @@ -1824,43 +1839,41 @@ H5FD_mirror_write(H5FD_t *_file, xmit_write.offset = (uint64_t)addr; xmit_write.type = (uint8_t)type; + xmit_buf = H5FL_BLK_MALLOC(xmit, H5FD_MIRROR_XMIT_BUFFER_MAX); + if(NULL == xmit_buf) + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "unable to allocate xmit buffer"); /* Notify Writer of incoming data to write. */ - if (H5FD_mirror_xmit_encode_write(xmit_buf, - (const H5FD_mirror_xmit_write_t *)&xmit_write) - != H5FD_MIRROR_XMIT_WRITE_SIZE) - { + if(H5FD_mirror_xmit_encode_write(xmit_buf, &xmit_write) != H5FD_MIRROR_XMIT_WRITE_SIZE) HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "unable to encode write"); - } LOG_XMIT_BYTES("write", xmit_buf, H5FD_MIRROR_XMIT_WRITE_SIZE); - if (HDwrite(file->sock_fd, xmit_buf, H5FD_MIRROR_XMIT_WRITE_SIZE) < 0) { + if(HDwrite(file->sock_fd, xmit_buf, H5FD_MIRROR_XMIT_WRITE_SIZE) < 0) HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "unable to transmit write"); - } /* Check that our write xmission was received */ - if (H5FD__mirror_verify_reply(file) == FAIL) { + if(H5FD__mirror_verify_reply(file) == FAIL) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "invalid reply"); - } /* Send the data to be written */ - if (HDwrite(file->sock_fd, buf, size) < 0) { + if(HDwrite(file->sock_fd, buf, size) < 0) HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "unable to transmit data"); - } /* Writer should reply that it got the data and is still okay/ready */ - if (H5FD__mirror_verify_reply(file) == FAIL) { + if(H5FD__mirror_verify_reply(file) == FAIL) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "invalid reply"); - } done: + if(xmit_buf) + xmit_buf = H5FL_BLK_FREE(xmit, xmit_buf); + FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_mirror_write() */ +} /* end H5FD__mirror_write() */ /*------------------------------------------------------------------------- - * Function: H5FD_mirror_truncate + * Function: H5FD__mirror_truncate * * Purpose: Makes sure that the true file size is the same (or larger) * than the end-of-address. @@ -1869,45 +1882,45 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_mirror_truncate(H5FD_t *_file, - hid_t H5_ATTR_UNUSED dxpl_id, - hbool_t H5_ATTR_UNUSED closing) +H5FD__mirror_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, + hbool_t H5_ATTR_UNUSED closing) { - unsigned char xmit_buf[H5FD_MIRROR_XMIT_HEADER_SIZE]; + unsigned char *xmit_buf = NULL; H5FD_mirror_t *file = (H5FD_mirror_t *)_file; herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC - LOG_OP_CALL("H5FD_mirror_truncate"); + LOG_OP_CALL(FUNC); file->xmit.xmit_count = (file->xmit_i)++; file->xmit.op = H5FD_MIRROR_OP_TRUNCATE; - if (H5FD_mirror_xmit_encode_header(xmit_buf, &(file->xmit)) - != H5FD_MIRROR_XMIT_HEADER_SIZE) - { + xmit_buf = H5FL_BLK_MALLOC(xmit, H5FD_MIRROR_XMIT_BUFFER_MAX); + if(NULL == xmit_buf) + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "unable to allocate xmit buffer"); + + if(H5FD_mirror_xmit_encode_header(xmit_buf, &(file->xmit)) != H5FD_MIRROR_XMIT_HEADER_SIZE) HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "unable to encode truncate"); - } LOG_XMIT_BYTES("truncate", xmit_buf, H5FD_MIRROR_XMIT_HEADER_SIZE); - if (HDwrite(file->sock_fd, xmit_buf, H5FD_MIRROR_XMIT_HEADER_SIZE) < 0) { - HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, - "unable to transmit truncate"); - } + if(HDwrite(file->sock_fd, xmit_buf, H5FD_MIRROR_XMIT_HEADER_SIZE) < 0) + HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "unable to transmit truncate"); - if (H5FD__mirror_verify_reply(file) == FAIL) { + if(H5FD__mirror_verify_reply(file) == FAIL) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "invalid reply"); - } done: + if(xmit_buf) + xmit_buf = H5FL_BLK_FREE(xmit, xmit_buf); + FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_mirror_truncate() */ +} /* end H5FD__mirror_truncate() */ /*------------------------------------------------------------------------- - * Function: H5FD_mirror_lock + * Function: H5FD__mirror_lock * * Purpose: To place an advisory lock on a file. * The lock type to apply depends on the parameter "rw": @@ -1918,16 +1931,16 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_mirror_lock(H5FD_t *_file, hbool_t rw) +H5FD__mirror_lock(H5FD_t *_file, hbool_t rw) { H5FD_mirror_xmit_lock_t xmit_lock; - unsigned char xmit_buf[H5FD_MIRROR_XMIT_LOCK_SIZE]; + unsigned char *xmit_buf = NULL; H5FD_mirror_t *file = (H5FD_mirror_t *)_file; herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT; + FUNC_ENTER_STATIC - LOG_OP_CALL("H5FD_mirror_lock"); + LOG_OP_CALL(FUNC); file->xmit.xmit_count = (file->xmit_i)++; file->xmit.op = H5FD_MIRROR_OP_LOCK; @@ -1935,30 +1948,31 @@ H5FD_mirror_lock(H5FD_t *_file, hbool_t rw) xmit_lock.pub = file->xmit; xmit_lock.rw = (uint64_t)rw; - if (H5FD_mirror_xmit_encode_lock(xmit_buf, - (const H5FD_mirror_xmit_lock_t *)&xmit_lock) - != H5FD_MIRROR_XMIT_LOCK_SIZE) - { + xmit_buf = H5FL_BLK_MALLOC(xmit, H5FD_MIRROR_XMIT_BUFFER_MAX); + if(NULL == xmit_buf) + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "unable to allocate xmit buffer"); + + if(H5FD_mirror_xmit_encode_lock(xmit_buf, &xmit_lock) != H5FD_MIRROR_XMIT_LOCK_SIZE) HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "unable to encode lock"); - } LOG_XMIT_BYTES("lock", xmit_buf, H5FD_MIRROR_XMIT_LOCK_SIZE); - if (HDwrite(file->sock_fd, xmit_buf, H5FD_MIRROR_XMIT_LOCK_SIZE) < 0) { + if(HDwrite(file->sock_fd, xmit_buf, H5FD_MIRROR_XMIT_LOCK_SIZE) < 0) HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "unable to transmit lock"); - } - if (H5FD__mirror_verify_reply(file) == FAIL) { + if(H5FD__mirror_verify_reply(file) == FAIL) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "invalid reply"); - } done: + if(xmit_buf) + xmit_buf = H5FL_BLK_FREE(xmit, xmit_buf); + FUNC_LEAVE_NOAPI(ret_value); -} /* end H5FD_mirror_lock */ +} /* end H5FD__mirror_lock */ /*------------------------------------------------------------------------- - * Function: H5FD_mirror_unlock + * Function: H5FD__mirror_unlock * * Purpose: Remove the existing lock on the file. * @@ -1966,38 +1980,40 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_mirror_unlock(H5FD_t *_file) +H5FD__mirror_unlock(H5FD_t *_file) { - unsigned char xmit_buf[H5FD_MIRROR_XMIT_HEADER_SIZE]; + unsigned char *xmit_buf = NULL; H5FD_mirror_t *file = (H5FD_mirror_t *)_file; herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT; + FUNC_ENTER_STATIC - LOG_OP_CALL("H5FD_mirror_unlock"); + LOG_OP_CALL(FUNC); file->xmit.xmit_count = (file->xmit_i)++; file->xmit.op = H5FD_MIRROR_OP_UNLOCK; - if (H5FD_mirror_xmit_encode_header(xmit_buf, &(file->xmit)) - != H5FD_MIRROR_XMIT_HEADER_SIZE) - { + xmit_buf = H5FL_BLK_MALLOC(xmit, H5FD_MIRROR_XMIT_BUFFER_MAX); + if(NULL == xmit_buf) + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "unable to allocate xmit buffer"); + + if(H5FD_mirror_xmit_encode_header(xmit_buf, &(file->xmit)) != H5FD_MIRROR_XMIT_HEADER_SIZE) HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "unable to encode unlock"); - } LOG_XMIT_BYTES("unlock", xmit_buf, H5FD_MIRROR_XMIT_HEADER_SIZE); - if (HDwrite(file->sock_fd, xmit_buf, H5FD_MIRROR_XMIT_HEADER_SIZE) < 0) { + if(HDwrite(file->sock_fd, xmit_buf, H5FD_MIRROR_XMIT_HEADER_SIZE) < 0) HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "unable to transmit unlock"); - } - if (H5FD__mirror_verify_reply(file) == FAIL) { + if(H5FD__mirror_verify_reply(file) == FAIL) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "invalid reply"); - } done: + if(xmit_buf) + xmit_buf = H5FL_BLK_FREE(xmit, xmit_buf); + FUNC_LEAVE_NOAPI(ret_value); -} /* end H5FD_mirror_unlock */ +} /* end H5FD__mirror_unlock */ #endif /* H5_HAVE_MIRROR_VFD */ diff --git a/src/H5FDmirror.h b/src/H5FDmirror.h index fb66b7b..7d15c1b 100644 --- a/src/H5FDmirror.h +++ b/src/H5FDmirror.h @@ -65,297 +65,6 @@ H5_DLL hid_t H5FD_mirror_init(void); H5_DLL herr_t H5Pget_fapl_mirror(hid_t fapl_id, H5FD_mirror_fapl_t *fa_out); H5_DLL herr_t H5Pset_fapl_mirror(hid_t fapl_id, H5FD_mirror_fapl_t *fa); -/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = - * IPC - Mirror VFD and Remote Worker application. - * = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = - */ - - -/* The maximum allowed size for a receiving buffer when accepting bytes to - * write. Writes larger than this size are performed by multiple accept-write - * steps by the Writer. */ -#define H5FD_MIRROR_DATA_BUFFER_MAX H5_GB /* 1 Gigabyte */ - -#define H5FD_MIRROR_XMIT_CURR_VERSION 1 -#define H5FD_MIRROR_XMIT_MAGIC 0x87F8005B - -#define H5FD_MIRROR_OP_OPEN 1 -#define H5FD_MIRROR_OP_CLOSE 2 -#define H5FD_MIRROR_OP_WRITE 3 -#define H5FD_MIRROR_OP_TRUNCATE 4 -#define H5FD_MIRROR_OP_REPLY 5 -#define H5FD_MIRROR_OP_SET_EOA 6 -#define H5FD_MIRROR_OP_LOCK 7 -#define H5FD_MIRROR_OP_UNLOCK 8 - -#define H5FD_MIRROR_STATUS_OK 0 -#define H5FD_MIRROR_STATUS_ERROR 1 -#define H5FD_MIRROR_STATUS_MESSAGE_MAX 256 /* Dedicated error message size */ - -/* Maximum length of a path/filename string, including the NULL-terminator. - * Must not be smaller than H5FD_SPLITTER_PATH_MAX. */ -#define H5FD_MIRROR_XMIT_FILEPATH_MAX 4097 - -/* Define the exact sizes of the various xmit blobs as sent over the wire. - * This is used to minimize the number of bytes transmitted as well as to - * sanity-check received bytes. - * Any modifications to the xmit structures and/or the encode/decode functions - * must be reflected here. - * */ -#define H5FD_MIRROR_XMIT_HEADER_SIZE 14 -#define H5FD_MIRROR_XMIT_EOA_SIZE (H5FD_MIRROR_XMIT_HEADER_SIZE + 9) -#define H5FD_MIRROR_XMIT_LOCK_SIZE (H5FD_MIRROR_XMIT_HEADER_SIZE + 8) -#define H5FD_MIRROR_XMIT_OPEN_SIZE (H5FD_MIRROR_XMIT_HEADER_SIZE + 20 + H5FD_MIRROR_XMIT_FILEPATH_MAX) -#define H5FD_MIRROR_XMIT_REPLY_SIZE (H5FD_MIRROR_XMIT_HEADER_SIZE + 4 + H5FD_MIRROR_STATUS_MESSAGE_MAX) -#define H5FD_MIRROR_XMIT_WRITE_SIZE (H5FD_MIRROR_XMIT_HEADER_SIZE + 17) - -/* Maximum length of any xmit. */ -#define H5FD_MIRROR_XMIT_BUFFER_MAX MAX2( MAX3(H5FD_MIRROR_XMIT_HEADER_SIZE, \ - H5FD_MIRROR_XMIT_EOA_SIZE, \ - H5FD_MIRROR_XMIT_LOCK_SIZE), \ - MAX3(H5FD_MIRROR_XMIT_OPEN_SIZE, \ - H5FD_MIRROR_XMIT_REPLY_SIZE, \ - H5FD_MIRROR_XMIT_WRITE_SIZE) ) \ - -/* --------------------------------------------------------------------------- - * Structure: H5FD_mirror_xmit_t - * - * Common structure 'header' for all mirror VFD/worker IPC. - * Must be the first component of a derived operation xmit structure, - * such as file-open or write command. - * - * `magic` (uint32_t) - * A "unique" number identifying the structure and endianness of - * transmitting maching. - * Must be set to H5FD_MIRROR_XMIT_MAGIC native to the VFD "sender". - * - * `version` (uint8_t) - * Number used to identify the structure membership. - * Allows sane modifications to this structure in the future. - * Must be set to H5FD_MIRROR_XMIT_CURR_VERSION. - * - * `session_token` (uint32_t) - * A "unique" number identifying the session between VFD sender and - * remote receiver/worker/writer. Exists to help sanity-check. - * - * `xmit_count` (uint32_t) - * Which transmission this is since the session began. - * Used to sanity-check transmission errors. - * First xmit (file-open) must be 0. - * - * `op` (uint8_t) - * Number identifying which operation to perform. - * Corresponds with the extended structure outside of this xmit header. - * Possible values are all defined H5FD_MIRROR_OP_* constants. - * - * --------------------------------------------------------------------------- - */ -typedef struct H5FD_mirror_xmit_t { - uint32_t magic; - uint8_t version; - uint32_t session_token; - uint32_t xmit_count; - uint8_t op; -} H5FD_mirror_xmit_t; - -/* --------------------------------------------------------------------------- - * Structure: H5FD_mirror_xmit_eoa_t - * - * Structure containing eoa-set information from VFD sender. - * - * `pub` (H5FD_mirror_xmit_t) - * Common transmission header, containing session information. - * Must be first. - * - * `type` (uint8_t) - * System-independent alias for H5F[D]_mem_t. - * Specifies datatype to be written. - * - * `eoa_addr` (uint64_t) - * New address for eoa. - * (Natively 'haddr_t', always a 64-bit field) - * - * --------------------------------------------------------------------------- - */ -typedef struct H5FD_mirror_xmit_eoa_t { - H5FD_mirror_xmit_t pub; - uint8_t type; - uint64_t eoa_addr; -} H5FD_mirror_xmit_eoa_t; - -/* --------------------------------------------------------------------------- - * Structure: H5FD_mirror_xmit_lock_t - * - * Structure containing eoa-set information from VFD sender. - * - * `pub` (H5FD_mirror_xmit_t) - * Common transmission header, containing session information. - * Must be first. - * - * `rw` (uint64_t) - * The Read/Write mode flag passed into H5FDlock(). - * (Natively `hbool_t`, an 'int') TODO: native int may be 64-bit? - * - * --------------------------------------------------------------------------- - */ -typedef struct H5FD_mirror_xmit_lock_t { - H5FD_mirror_xmit_t pub; - uint64_t rw; -} H5FD_mirror_xmit_lock_t; - -/* --------------------------------------------------------------------------- - * Structure: H5FD_mirror_xmit_open_t - * - * Structure containing file-open information from the VFD sender. - * - * `pub` (H5FD_mirror_xmit_t) - * Common transmission header, containing session information. - * Must be first. - * - * `flags` (uint32_t) - * VFL-layer file-open flags passed directly to H5FDopen(). - * (Natively 'unsigned [int]') TODO: native int may be 64-bit? - * - * `maxaddr` (uint64_t) - * VFL-layer maximum allowed address space for the file to open passed - * directly to H5FDopen(). - * (Natively 'haddr_t', always a 64-bit field) - * - * `size_t_blob` (uint64_t) - * A number indicating how large a size_t is on the sending system. - * Must be set to (uint64_t)((size_t)(-1)) - * (maximum possible value of size_t, cast to uint64_t). - * The receiving system inspects this value -- if the local (remote) - * size_t is smaller than that of the Sender, issues a warning. - * Not an error, as: - * 1. It is assumed that underlying file systems/drivers have become - * smart enough to handle file sizes that otherwise might be - * constrained. - * 2. The Mirror Writer ingests bytes to write multiple 'slices' if the - * size is greater than H5FD_MIRROR_DATA_BUFFER_MAX, regardless of - * any size_t storage size disparity. - * - * `filename` (char[]) - * String giving the filename and path of file to open. - * - * --------------------------------------------------------------------------- - */ -typedef struct H5FD_mirror_xmit_open_t { - H5FD_mirror_xmit_t pub; - uint32_t flags; - uint64_t maxaddr; - uint64_t size_t_blob; - char filename[H5FD_MIRROR_XMIT_FILEPATH_MAX]; -} H5FD_mirror_xmit_open_t; - -/* --------------------------------------------------------------------------- - * Structure: H5FD_mirror_xmit_reply_t - * - * Structure used by the remote receiver/worker/writer to respond to - * a command from the VFD sender. - * - * `pub` (H5FD_mirror_xmit_t) - * Common transmission header, containing session information. - * Must be first. - * - * `status` (uint32_t) - * Number indicating whether the command was successful or if an - * occured. - * Allowed values are H5FD_MIRROR_STATUS_OK and - * H5FD_MIRROR_STATUS_ERROR. - * - * `message` (char[]) - * Error message. Populated if and only if there was a problem. - * It is possible that a message may reach the end of the alloted - * space without a NULL terminator -- the onus is on the programmer to - * handle this situation. - * - * --------------------------------------------------------------------------- - */ -typedef struct H5FD_mirror_xmit_reply_t { - H5FD_mirror_xmit_t pub; - uint32_t status; - char message[H5FD_MIRROR_STATUS_MESSAGE_MAX]; -} H5FD_mirror_xmit_reply_t; - -/* --------------------------------------------------------------------------- - * Structure: H5FD_mirror_xmit_write_t - * - * Structure containing data-write information from VFD sender. - * - * The data to be written is transmitted in subsequent, packets - * and may be broken up into more than one transmission buffer. - * The VFD sender and remote receiver/worker/writer must coordinate - * the receipt of data. - * - * `pub` (H5FD_mirror_xmit_t) - * Common transmission header, containing session information. - * Must be first. - * - * `type` (uint8_t) - * Specifies datatype to be written. - * (Natively 'H5FD_mem_t', an enumerated type in H5Fpublic.h) - * - * `offset` (uint64_t) - * Start location of write in file. - * (Natively 'haddr_t', always a 64-bit field) - * - * `size` (uint64_t) - * Size of the data to be written, in bytes. - * (Natively 'size_t', accommodate the largest possible as 64-bits) - * - * --------------------------------------------------------------------------- - */ -typedef struct H5FD_mirror_xmit_write_t { - H5FD_mirror_xmit_t pub; - uint8_t type; - uint64_t offset; - uint64_t size; -} H5FD_mirror_xmit_write_t; - - - -/* Encode/decode routines are required to "pack" the xmit data into a known - * byte format for transmission over the wire. - * - * All component numbers must be stored in "network" word order (Big-Endian). - * - * All components must be packed in the order given in the structure definition. - * - * All components must be packed with zero padding between. - */ - -H5_DLL size_t H5FD__mirror_xmit_decode_uint16(uint16_t *out, const unsigned char *buf); -H5_DLL size_t H5FD__mirror_xmit_decode_uint32(uint32_t *out, const unsigned char *buf); -H5_DLL size_t H5FD__mirror_xmit_decode_uint64(uint64_t *out, const unsigned char *buf); -H5_DLL size_t H5FD__mirror_xmit_decode_uint8(uint8_t *out, const unsigned char *buf); -H5_DLL size_t H5FD__mirror_xmit_encode_uint16(unsigned char *dest, uint16_t v); -H5_DLL size_t H5FD__mirror_xmit_encode_uint32(unsigned char *dest, uint32_t v); -H5_DLL size_t H5FD__mirror_xmit_encode_uint64(unsigned char *dest, uint64_t v); -H5_DLL size_t H5FD__mirror_xmit_encode_uint8(unsigned char *dest, uint8_t v); - -H5_DLL size_t H5FD_mirror_xmit_decode_header(H5FD_mirror_xmit_t *out, const unsigned char *buf); -H5_DLL size_t H5FD_mirror_xmit_decode_lock(H5FD_mirror_xmit_lock_t *out, const unsigned char *buf); -H5_DLL size_t H5FD_mirror_xmit_decode_open(H5FD_mirror_xmit_open_t *out, const unsigned char *buf); -H5_DLL size_t H5FD_mirror_xmit_decode_reply(H5FD_mirror_xmit_reply_t *out, const unsigned char *buf); -H5_DLL size_t H5FD_mirror_xmit_decode_set_eoa(H5FD_mirror_xmit_eoa_t *out, const unsigned char *buf); -H5_DLL size_t H5FD_mirror_xmit_decode_write(H5FD_mirror_xmit_write_t *out, const unsigned char *buf); - -H5_DLL size_t H5FD_mirror_xmit_encode_header(unsigned char *dest, const H5FD_mirror_xmit_t *x); -H5_DLL size_t H5FD_mirror_xmit_encode_lock(unsigned char *dest, const H5FD_mirror_xmit_lock_t *x); -H5_DLL size_t H5FD_mirror_xmit_encode_open(unsigned char *dest, const H5FD_mirror_xmit_open_t *x); -H5_DLL size_t H5FD_mirror_xmit_encode_reply(unsigned char *dest, const H5FD_mirror_xmit_reply_t *x); -H5_DLL size_t H5FD_mirror_xmit_encode_set_eoa(unsigned char *dest, const H5FD_mirror_xmit_eoa_t *x); -H5_DLL size_t H5FD_mirror_xmit_encode_write(unsigned char *dest, const H5FD_mirror_xmit_write_t *x); - -H5_DLL hbool_t H5FD_mirror_xmit_is_close(const H5FD_mirror_xmit_t *xmit); -H5_DLL hbool_t H5FD_mirror_xmit_is_lock(const H5FD_mirror_xmit_lock_t *xmit); -H5_DLL hbool_t H5FD_mirror_xmit_is_open(const H5FD_mirror_xmit_open_t *xmit); -H5_DLL hbool_t H5FD_mirror_xmit_is_reply(const H5FD_mirror_xmit_reply_t *xmit); -H5_DLL hbool_t H5FD_mirror_xmit_is_set_eoa(const H5FD_mirror_xmit_eoa_t *xmit); -H5_DLL hbool_t H5FD_mirror_xmit_is_write(const H5FD_mirror_xmit_write_t *xmit); -H5_DLL hbool_t H5FD_mirror_xmit_is_xmit(const H5FD_mirror_xmit_t *xmit); - #ifdef __cplusplus } #endif @@ -368,4 +77,3 @@ H5_DLL hbool_t H5FD_mirror_xmit_is_xmit(const H5FD_mirror_xmit_t *xmit); #endif /* H5FDmirror_H */ - diff --git a/src/H5FDmirror_priv.h b/src/H5FDmirror_priv.h new file mode 100644 index 0000000..dc15441 --- /dev/null +++ b/src/H5FDmirror_priv.h @@ -0,0 +1,323 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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 COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Purpose: Public, shared definitions for Mirror VFD & remote Writer. + */ + +#ifndef H5FDmirror_priv_H +#define H5FDmirror_priv_H + +#ifdef H5_HAVE_MIRROR_VFD + +#ifdef __cplusplus +extern "C" { +#endif + +/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = + * IPC - Mirror VFD and Remote Worker application. + * = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = + */ + +/* The maximum allowed size for a receiving buffer when accepting bytes to + * write. Writes larger than this size are performed by multiple accept-write + * steps by the Writer. */ +#define H5FD_MIRROR_DATA_BUFFER_MAX H5_GB /* 1 Gigabyte */ + +#define H5FD_MIRROR_XMIT_CURR_VERSION 1 +#define H5FD_MIRROR_XMIT_MAGIC 0x87F8005B + +#define H5FD_MIRROR_OP_OPEN 1 +#define H5FD_MIRROR_OP_CLOSE 2 +#define H5FD_MIRROR_OP_WRITE 3 +#define H5FD_MIRROR_OP_TRUNCATE 4 +#define H5FD_MIRROR_OP_REPLY 5 +#define H5FD_MIRROR_OP_SET_EOA 6 +#define H5FD_MIRROR_OP_LOCK 7 +#define H5FD_MIRROR_OP_UNLOCK 8 + +#define H5FD_MIRROR_STATUS_OK 0 +#define H5FD_MIRROR_STATUS_ERROR 1 +#define H5FD_MIRROR_STATUS_MESSAGE_MAX 256 /* Dedicated error message size */ + +/* Maximum length of a path/filename string, including the NULL-terminator. + * Must not be smaller than H5FD_SPLITTER_PATH_MAX. */ +#define H5FD_MIRROR_XMIT_FILEPATH_MAX 4097 + +/* Define the exact sizes of the various xmit blobs as sent over the wire. + * This is used to minimize the number of bytes transmitted as well as to + * sanity-check received bytes. + * Any modifications to the xmit structures and/or the encode/decode functions + * must be reflected here. + * */ +#define H5FD_MIRROR_XMIT_HEADER_SIZE 14 +#define H5FD_MIRROR_XMIT_EOA_SIZE (H5FD_MIRROR_XMIT_HEADER_SIZE + 9) +#define H5FD_MIRROR_XMIT_LOCK_SIZE (H5FD_MIRROR_XMIT_HEADER_SIZE + 8) +#define H5FD_MIRROR_XMIT_OPEN_SIZE (H5FD_MIRROR_XMIT_HEADER_SIZE + 20 + H5FD_MIRROR_XMIT_FILEPATH_MAX) +#define H5FD_MIRROR_XMIT_REPLY_SIZE (H5FD_MIRROR_XMIT_HEADER_SIZE + 4 + H5FD_MIRROR_STATUS_MESSAGE_MAX) +#define H5FD_MIRROR_XMIT_WRITE_SIZE (H5FD_MIRROR_XMIT_HEADER_SIZE + 17) + +/* Maximum length of any xmit. */ +#define H5FD_MIRROR_XMIT_BUFFER_MAX MAX2( MAX3(H5FD_MIRROR_XMIT_HEADER_SIZE, \ + H5FD_MIRROR_XMIT_EOA_SIZE, \ + H5FD_MIRROR_XMIT_LOCK_SIZE), \ + MAX3(H5FD_MIRROR_XMIT_OPEN_SIZE, \ + H5FD_MIRROR_XMIT_REPLY_SIZE, \ + H5FD_MIRROR_XMIT_WRITE_SIZE) ) \ + +/* --------------------------------------------------------------------------- + * Structure: H5FD_mirror_xmit_t + * + * Common structure 'header' for all mirror VFD/worker IPC. + * Must be the first component of a derived operation xmit structure, + * such as file-open or write command. + * + * `magic` (uint32_t) + * A "unique" number identifying the structure and endianness of + * transmitting maching. + * Must be set to H5FD_MIRROR_XMIT_MAGIC native to the VFD "sender". + * + * `version` (uint8_t) + * Number used to identify the structure membership. + * Allows sane modifications to this structure in the future. + * Must be set to H5FD_MIRROR_XMIT_CURR_VERSION. + * + * `session_token` (uint32_t) + * A "unique" number identifying the session between VFD sender and + * remote receiver/worker/writer. Exists to help sanity-check. + * + * `xmit_count` (uint32_t) + * Which transmission this is since the session began. + * Used to sanity-check transmission errors. + * First xmit (file-open) must be 0. + * + * `op` (uint8_t) + * Number identifying which operation to perform. + * Corresponds with the extended structure outside of this xmit header. + * Possible values are all defined H5FD_MIRROR_OP_* constants. + * + * --------------------------------------------------------------------------- + */ +typedef struct H5FD_mirror_xmit_t { + uint32_t magic; + uint8_t version; + uint32_t session_token; + uint32_t xmit_count; + uint8_t op; +} H5FD_mirror_xmit_t; + +/* --------------------------------------------------------------------------- + * Structure: H5FD_mirror_xmit_eoa_t + * + * Structure containing eoa-set information from VFD sender. + * + * `pub` (H5FD_mirror_xmit_t) + * Common transmission header, containing session information. + * Must be first. + * + * `type` (uint8_t) + * System-independent alias for H5F[D]_mem_t. + * Specifies datatype to be written. + * + * `eoa_addr` (uint64_t) + * New address for eoa. + * (Natively 'haddr_t', always a 64-bit field) + * + * --------------------------------------------------------------------------- + */ +typedef struct H5FD_mirror_xmit_eoa_t { + H5FD_mirror_xmit_t pub; + uint8_t type; + uint64_t eoa_addr; +} H5FD_mirror_xmit_eoa_t; + +/* --------------------------------------------------------------------------- + * Structure: H5FD_mirror_xmit_lock_t + * + * Structure containing eoa-set information from VFD sender. + * + * `pub` (H5FD_mirror_xmit_t) + * Common transmission header, containing session information. + * Must be first. + * + * `rw` (uint64_t) + * The Read/Write mode flag passed into H5FDlock(). + * (Natively `hbool_t`, an 'int') TODO: native int may be 64-bit? + * + * --------------------------------------------------------------------------- + */ +typedef struct H5FD_mirror_xmit_lock_t { + H5FD_mirror_xmit_t pub; + uint64_t rw; +} H5FD_mirror_xmit_lock_t; + +/* --------------------------------------------------------------------------- + * Structure: H5FD_mirror_xmit_open_t + * + * Structure containing file-open information from the VFD sender. + * + * `pub` (H5FD_mirror_xmit_t) + * Common transmission header, containing session information. + * Must be first. + * + * `flags` (uint32_t) + * VFL-layer file-open flags passed directly to H5FDopen(). + * (Natively 'unsigned [int]') TODO: native int may be 64-bit? + * + * `maxaddr` (uint64_t) + * VFL-layer maximum allowed address space for the file to open passed + * directly to H5FDopen(). + * (Natively 'haddr_t', always a 64-bit field) + * + * `size_t_blob` (uint64_t) + * A number indicating how large a size_t is on the sending system. + * Must be set to (uint64_t)((size_t)(-1)) + * (maximum possible value of size_t, cast to uint64_t). + * The receiving system inspects this value -- if the local (remote) + * size_t is smaller than that of the Sender, issues a warning. + * Not an error, as: + * 1. It is assumed that underlying file systems/drivers have become + * smart enough to handle file sizes that otherwise might be + * constrained. + * 2. The Mirror Writer ingests bytes to write multiple 'slices' if the + * size is greater than H5FD_MIRROR_DATA_BUFFER_MAX, regardless of + * any size_t storage size disparity. + * + * `filename` (char[]) + * String giving the filename and path of file to open. + * + * --------------------------------------------------------------------------- + */ +typedef struct H5FD_mirror_xmit_open_t { + H5FD_mirror_xmit_t pub; + uint32_t flags; + uint64_t maxaddr; + uint64_t size_t_blob; + char filename[H5FD_MIRROR_XMIT_FILEPATH_MAX]; +} H5FD_mirror_xmit_open_t; + +/* --------------------------------------------------------------------------- + * Structure: H5FD_mirror_xmit_reply_t + * + * Structure used by the remote receiver/worker/writer to respond to + * a command from the VFD sender. + * + * `pub` (H5FD_mirror_xmit_t) + * Common transmission header, containing session information. + * Must be first. + * + * `status` (uint32_t) + * Number indicating whether the command was successful or if an + * occured. + * Allowed values are H5FD_MIRROR_STATUS_OK and + * H5FD_MIRROR_STATUS_ERROR. + * + * `message` (char[]) + * Error message. Populated if and only if there was a problem. + * It is possible that a message may reach the end of the alloted + * space without a NULL terminator -- the onus is on the programmer to + * handle this situation. + * + * --------------------------------------------------------------------------- + */ +typedef struct H5FD_mirror_xmit_reply_t { + H5FD_mirror_xmit_t pub; + uint32_t status; + char message[H5FD_MIRROR_STATUS_MESSAGE_MAX]; +} H5FD_mirror_xmit_reply_t; + +/* --------------------------------------------------------------------------- + * Structure: H5FD_mirror_xmit_write_t + * + * Structure containing data-write information from VFD sender. + * + * The data to be written is transmitted in subsequent, packets + * and may be broken up into more than one transmission buffer. + * The VFD sender and remote receiver/worker/writer must coordinate + * the receipt of data. + * + * `pub` (H5FD_mirror_xmit_t) + * Common transmission header, containing session information. + * Must be first. + * + * `type` (uint8_t) + * Specifies datatype to be written. + * (Natively 'H5FD_mem_t', an enumerated type in H5Fpublic.h) + * + * `offset` (uint64_t) + * Start location of write in file. + * (Natively 'haddr_t', always a 64-bit field) + * + * `size` (uint64_t) + * Size of the data to be written, in bytes. + * (Natively 'size_t', accommodate the largest possible as 64-bits) + * + * --------------------------------------------------------------------------- + */ +typedef struct H5FD_mirror_xmit_write_t { + H5FD_mirror_xmit_t pub; + uint8_t type; + uint64_t offset; + uint64_t size; +} H5FD_mirror_xmit_write_t; + + + +/* Encode/decode routines are required to "pack" the xmit data into a known + * byte format for transmission over the wire. + * + * All component numbers must be stored in "network" word order (Big-Endian). + * + * All components must be packed in the order given in the structure definition. + * + * All components must be packed with zero padding between. + */ + +H5_DLL size_t H5FD__mirror_xmit_decode_uint16(uint16_t *out, const unsigned char *buf); +H5_DLL size_t H5FD__mirror_xmit_decode_uint32(uint32_t *out, const unsigned char *buf); +H5_DLL size_t H5FD__mirror_xmit_decode_uint64(uint64_t *out, const unsigned char *buf); +H5_DLL size_t H5FD__mirror_xmit_decode_uint8(uint8_t *out, const unsigned char *buf); +H5_DLL size_t H5FD__mirror_xmit_encode_uint16(unsigned char *dest, uint16_t v); +H5_DLL size_t H5FD__mirror_xmit_encode_uint32(unsigned char *dest, uint32_t v); +H5_DLL size_t H5FD__mirror_xmit_encode_uint64(unsigned char *dest, uint64_t v); +H5_DLL size_t H5FD__mirror_xmit_encode_uint8(unsigned char *dest, uint8_t v); + +H5_DLL size_t H5FD_mirror_xmit_decode_header(H5FD_mirror_xmit_t *out, const unsigned char *buf); +H5_DLL size_t H5FD_mirror_xmit_decode_lock(H5FD_mirror_xmit_lock_t *out, const unsigned char *buf); +H5_DLL size_t H5FD_mirror_xmit_decode_open(H5FD_mirror_xmit_open_t *out, const unsigned char *buf); +H5_DLL size_t H5FD_mirror_xmit_decode_reply(H5FD_mirror_xmit_reply_t *out, const unsigned char *buf); +H5_DLL size_t H5FD_mirror_xmit_decode_set_eoa(H5FD_mirror_xmit_eoa_t *out, const unsigned char *buf); +H5_DLL size_t H5FD_mirror_xmit_decode_write(H5FD_mirror_xmit_write_t *out, const unsigned char *buf); + +H5_DLL size_t H5FD_mirror_xmit_encode_header(unsigned char *dest, const H5FD_mirror_xmit_t *x); +H5_DLL size_t H5FD_mirror_xmit_encode_lock(unsigned char *dest, const H5FD_mirror_xmit_lock_t *x); +H5_DLL size_t H5FD_mirror_xmit_encode_open(unsigned char *dest, const H5FD_mirror_xmit_open_t *x); +H5_DLL size_t H5FD_mirror_xmit_encode_reply(unsigned char *dest, const H5FD_mirror_xmit_reply_t *x); +H5_DLL size_t H5FD_mirror_xmit_encode_set_eoa(unsigned char *dest, const H5FD_mirror_xmit_eoa_t *x); +H5_DLL size_t H5FD_mirror_xmit_encode_write(unsigned char *dest, const H5FD_mirror_xmit_write_t *x); + +H5_DLL hbool_t H5FD_mirror_xmit_is_close(const H5FD_mirror_xmit_t *xmit); +H5_DLL hbool_t H5FD_mirror_xmit_is_lock(const H5FD_mirror_xmit_lock_t *xmit); +H5_DLL hbool_t H5FD_mirror_xmit_is_open(const H5FD_mirror_xmit_open_t *xmit); +H5_DLL hbool_t H5FD_mirror_xmit_is_reply(const H5FD_mirror_xmit_reply_t *xmit); +H5_DLL hbool_t H5FD_mirror_xmit_is_set_eoa(const H5FD_mirror_xmit_eoa_t *xmit); +H5_DLL hbool_t H5FD_mirror_xmit_is_write(const H5FD_mirror_xmit_write_t *xmit); +H5_DLL hbool_t H5FD_mirror_xmit_is_xmit(const H5FD_mirror_xmit_t *xmit); + +#ifdef __cplusplus +} +#endif + +#endif /* H5_HAVE_MIRROR_VFD */ + +#endif /* H5FDmirror_priv_H */ + diff --git a/src/H5FDmodule.h b/src/H5FDmodule.h index ea1a9fd..11686be 100644 --- a/src/H5FDmodule.h +++ b/src/H5FDmodule.h @@ -11,7 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, September 12, 2015 * * Purpose: This file contains declarations which define macros for the diff --git a/src/H5FDmpi.c b/src/H5FDmpi.c index b2959a5..43fa340 100644 --- a/src/H5FDmpi.c +++ b/src/H5FDmpi.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Friday, January 30, 2004 * * Purpose: Common routines for all MPI-based VFL drivers. @@ -43,8 +43,6 @@ * Programmer: Quincey Koziol * Friday, January 30, 2004 * - * Modifications: - * *------------------------------------------------------------------------- */ int @@ -82,8 +80,6 @@ done: * Programmer: Quincey Koziol * Friday, January 30, 2004 * - * Modifications: - * *------------------------------------------------------------------------- */ int @@ -120,8 +116,6 @@ done: * Programmer: Quincey Koziol * Friday, January 30, 2004 * - * Modifications: - * *------------------------------------------------------------------------- */ MPI_Comm @@ -158,8 +152,6 @@ done: * Programmer: John Mainzer * 4/4/17 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -197,13 +189,6 @@ done: * Programmer: Unknown * January 30, 1998 * - * Modifications: - * Robb Matzke, 1999-04-23 - * An error is reported for address overflows. The ADDR output - * argument is optional. - * - * Robb Matzke, 1999-08-06 - * Modified to work with the virtual file layer. *------------------------------------------------------------------------- */ haddr_t @@ -235,16 +220,6 @@ H5FD_mpi_MPIOff_to_haddr(MPI_Offset mpi_off) * Programmer: Unknown * January 30, 1998 * - * Modifications: - * Robb Matzke, 1999-04-23 - * An error is reported for address overflows. The ADDR output - * argument is optional. - * - * Robb Matzke, 1999-07-28 - * The ADDR argument is passed by value. - * - * Robb Matzke, 1999-08-06 - * Modified to work with the virtual file layer. *------------------------------------------------------------------------- */ herr_t @@ -290,9 +265,6 @@ H5FD_mpi_haddr_to_MPIOff(haddr_t addr, MPI_Offset *mpi_off/*out*/) * Programmer: rky * 19981207 * - * Modifications: - * Robb Matzke, 1999-08-09 - * Modified to work with the virtual file layer. *------------------------------------------------------------------------- */ herr_t @@ -345,9 +317,6 @@ done: * Programmer: rky * 19981207 * - * Modifications: - * Robb Matzke, 1999-08-09 - * Modified to work with the virtual file layer. *------------------------------------------------------------------------- */ herr_t diff --git a/src/H5FDmpi.h b/src/H5FDmpi.h index 2d62c79..da9f59b 100644 --- a/src/H5FDmpi.h +++ b/src/H5FDmpi.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Friday, January 30, 2004 * * Purpose: The public header file for common items for all MPI VFL drivers diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index e85a8c2..e1568a5 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, July 29, 1999 * * Purpose: This is the MPI-2 I/O driver. diff --git a/src/H5FDmpio.h b/src/H5FDmpio.h index 6ee0a1a..9d02153 100644 --- a/src/H5FDmpio.h +++ b/src/H5FDmpio.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, August 2, 1999 * * Purpose: The public header file for the mpio driver. diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c index 3c31d72..ec6206b 100644 --- a/src/H5FDmulti.c +++ b/src/H5FDmulti.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, November 10, 1997 * * Purpose: Implements a file driver which dispatches I/O requests to @@ -1236,14 +1236,6 @@ H5FD_multi_get_type_map(const H5FD_t *_file, H5FD_mem_t *type_map) * Programmer: Robb Matzke * Wednesday, August 4, 1999 * - * Modifications: - * Raymond Lu - * 21 Dec. 2006 - * Added the parameter TYPE. It's only used for MULTI driver. - * If the TYPE is H5FD_MEM_DEFAULT, simply find the biggest - * EOA of individual file because the EOA for the whole file - * is meaningless. - * *------------------------------------------------------------------------- */ static haddr_t @@ -1336,17 +1328,6 @@ H5FD_multi_get_eoa(const H5FD_t *_file, H5FD_mem_t type) * Programmer: Robb Matzke * Wednesday, August 4, 1999 * - * Modifications: - * Raymond Lu - * 10 January 2007 - * EOA for the whole file is discarded because it's meaningless - * for MULTI file. This function only sets eoa for individual - * file. - * - * Raymond Lu - * 21 June 2011 - * Backward compatibility of EOA. Please the comment in the - * code. *------------------------------------------------------------------------- */ static herr_t @@ -1858,7 +1839,7 @@ H5FD_multi_lock(H5FD_t *_file, hbool_t rw) } /* end if */ if(nerrors) - H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "error locking member files", -1) + H5Epush_ret(func, H5E_ERR_CLS, H5E_VFL, H5E_CANTLOCKFILE, "error locking member files", -1) return 0; } /* H5FD_multi_lock() */ @@ -1895,7 +1876,7 @@ H5FD_multi_unlock(H5FD_t *_file) } END_MEMBERS; if(nerrors) - H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "error unlocking member files", -1) + H5Epush_ret(func, H5E_ERR_CLS, H5E_VFL, H5E_CANTUNLOCKFILE, "error unlocking member files", -1) return 0; } /* H5FD_multi_unlock() */ diff --git a/src/H5FDmulti.h b/src/H5FDmulti.h index 0bd5718..b3c3c62 100644 --- a/src/H5FDmulti.h +++ b/src/H5FDmulti.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, August 2, 1999 * * Purpose: The public header file for the "multi" driver. diff --git a/src/H5FDpkg.h b/src/H5FDpkg.h index 22b5d17..8ffffd1 100644 --- a/src/H5FDpkg.h +++ b/src/H5FDpkg.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, January 3, 2008 * * Purpose: This file contains declarations which are visible only within diff --git a/src/H5FDprivate.h b/src/H5FDprivate.h index 3bea38b..6187b15 100644 --- a/src/H5FDprivate.h +++ b/src/H5FDprivate.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, July 26, 1999 */ #ifndef _H5FDprivate_H diff --git a/src/H5FDpublic.h b/src/H5FDpublic.h index b740899..bfd385c 100644 --- a/src/H5FDpublic.h +++ b/src/H5FDpublic.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, July 26, 1999 */ #ifndef _H5FDpublic_H diff --git a/src/H5FDros3.c b/src/H5FDros3.c index 1432e02..0aa419d 100644 --- a/src/H5FDros3.c +++ b/src/H5FDros3.c @@ -13,7 +13,7 @@ /* * Read-Only S3 Virtual File Driver (VFD) * - * Programmer: Jacob Smith + * Programmer: Jacob Smith * 2017-10-13 * * Purpose: @@ -212,68 +212,69 @@ typedef struct H5FD_ros3_t { * Only included if it may be used -- ROS3 VFD is enabled. * */ -#define MAXADDR (((haddr_t)1<<(8*sizeof(HDoff_t)-1))-1) +#define MAXADDR (((haddr_t)1 << (8 * sizeof(HDoff_t) - 1)) - 1) #define ADDR_OVERFLOW(A) (HADDR_UNDEF==(A) || ((A) & ~(haddr_t)MAXADDR)) /* Prototypes */ -static herr_t H5FD_ros3_term(void); -static void *H5FD_ros3_fapl_get(H5FD_t *_file); -static void *H5FD_ros3_fapl_copy(const void *_old_fa); -static herr_t H5FD_ros3_fapl_free(void *_fa); -static H5FD_t *H5FD_ros3_open(const char *name, unsigned flags, hid_t fapl_id, +static herr_t H5FD__ros3_term(void); +static void *H5FD__ros3_fapl_get(H5FD_t *_file); +static void *H5FD__ros3_fapl_copy(const void *_old_fa); +static herr_t H5FD__ros3_fapl_free(void *_fa); +static H5FD_t *H5FD__ros3_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr); -static herr_t H5FD_ros3_close(H5FD_t *_file); -static int H5FD_ros3_cmp(const H5FD_t *_f1, const H5FD_t *_f2); -static herr_t H5FD_ros3_query(const H5FD_t *_f1, unsigned long *flags); -static haddr_t H5FD_ros3_get_eoa(const H5FD_t *_file, H5FD_mem_t type); -static herr_t H5FD_ros3_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr); -static haddr_t H5FD_ros3_get_eof(const H5FD_t *_file, H5FD_mem_t type); -static herr_t H5FD_ros3_get_handle(H5FD_t *_file, hid_t fapl, +static herr_t H5FD__ros3_close(H5FD_t *_file); +static int H5FD__ros3_cmp(const H5FD_t *_f1, const H5FD_t *_f2); +static herr_t H5FD__ros3_query(const H5FD_t *_f1, unsigned long *flags); +static haddr_t H5FD__ros3_get_eoa(const H5FD_t *_file, H5FD_mem_t type); +static herr_t H5FD__ros3_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr); +static haddr_t H5FD__ros3_get_eof(const H5FD_t *_file, H5FD_mem_t type); +static herr_t H5FD__ros3_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle); -static herr_t H5FD_ros3_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, +static herr_t H5FD__ros3_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, void *buf); -static herr_t H5FD_ros3_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, +static herr_t H5FD__ros3_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, const void *buf); -static herr_t H5FD_ros3_truncate(H5FD_t *_file, hid_t dxpl_id, +static herr_t H5FD__ros3_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); -static herr_t H5FD_ros3_lock(H5FD_t *_file, hbool_t rw); -static herr_t H5FD_ros3_unlock(H5FD_t *_file); -static herr_t H5FD_ros3_validate_config(const H5FD_ros3_fapl_t * fa); +static herr_t H5FD__ros3_lock(H5FD_t *_file, hbool_t rw); +static herr_t H5FD__ros3_unlock(H5FD_t *_file); + +static herr_t H5FD__ros3_validate_config(const H5FD_ros3_fapl_t * fa); static const H5FD_class_t H5FD_ros3_g = { "ros3", /* name */ MAXADDR, /* maxaddr */ H5F_CLOSE_WEAK, /* fc_degree */ - H5FD_ros3_term, /* terminate */ + H5FD__ros3_term, /* terminate */ NULL, /* sb_size */ NULL, /* sb_encode */ NULL, /* sb_decode */ sizeof(H5FD_ros3_fapl_t), /* fapl_size */ - H5FD_ros3_fapl_get, /* fapl_get */ - H5FD_ros3_fapl_copy, /* fapl_copy */ - H5FD_ros3_fapl_free, /* fapl_free */ + H5FD__ros3_fapl_get, /* fapl_get */ + H5FD__ros3_fapl_copy, /* fapl_copy */ + H5FD__ros3_fapl_free, /* fapl_free */ 0, /* dxpl_size */ NULL, /* dxpl_copy */ NULL, /* dxpl_free */ - H5FD_ros3_open, /* open */ - H5FD_ros3_close, /* close */ - H5FD_ros3_cmp, /* cmp */ - H5FD_ros3_query, /* query */ + H5FD__ros3_open, /* open */ + H5FD__ros3_close, /* close */ + H5FD__ros3_cmp, /* cmp */ + H5FD__ros3_query, /* query */ NULL, /* get_type_map */ NULL, /* alloc */ NULL, /* free */ - H5FD_ros3_get_eoa, /* get_eoa */ - H5FD_ros3_set_eoa, /* set_eoa */ - H5FD_ros3_get_eof, /* get_eof */ - H5FD_ros3_get_handle, /* get_handle */ - H5FD_ros3_read, /* read */ - H5FD_ros3_write, /* write */ + H5FD__ros3_get_eoa, /* get_eoa */ + H5FD__ros3_set_eoa, /* set_eoa */ + H5FD__ros3_get_eof, /* get_eof */ + H5FD__ros3_get_handle, /* get_handle */ + H5FD__ros3_read, /* read */ + H5FD__ros3_write, /* write */ NULL, /* read_vector */ NULL, /* write_vector */ NULL, /* flush */ - H5FD_ros3_truncate, /* truncate */ - H5FD_ros3_lock, /* lock */ - H5FD_ros3_unlock, /* unlock */ + H5FD__ros3_truncate, /* truncate */ + H5FD__ros3_lock, /* lock */ + H5FD__ros3_unlock, /* unlock */ H5FD_FLMAP_DICHOTOMY /* fl_map */ }; @@ -299,14 +300,11 @@ H5FD__init_package(void) FUNC_ENTER_STATIC - if (H5FD_ros3_init() < 0) { - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, - "unable to initialize ros3 VFD") - } + if(H5FD_ros3_init() < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to initialize ros3 VFD") done: FUNC_LEAVE_NOAPI(ret_value) - } /* end H5FD__init_package() */ @@ -337,7 +335,7 @@ H5FD_ros3_init(void) HDfprintf(stdout, "H5FD_ros3_init() called.\n"); #endif - if (H5I_VFL != H5I_get_type(H5FD_ROS3_g)) + if(H5I_VFL != H5I_get_type(H5FD_ROS3_g)) H5FD_ROS3_g = H5FD_register(&H5FD_ros3_g, sizeof(H5FD_class_t), FALSE); #if ROS3_STATS @@ -345,6 +343,7 @@ H5FD_ros3_init(void) */ for (bin_i = 0; bin_i < ROS3_STATS_BIN_COUNT; bin_i++) { unsigned long long value = 0; + ROS3_STATS_POW(bin_i, &value) ros3_stats_boundaries[bin_i] = value; } @@ -355,12 +354,11 @@ H5FD_ros3_init(void) done: FUNC_LEAVE_NOAPI(ret_value) - } /* end H5FD_ros3_init() */ /*--------------------------------------------------------------------------- - * Function: H5FD_ros3_term + * Function: H5FD__ros3_term * * Purpose: Shut down the VFD * @@ -371,20 +369,19 @@ done: *--------------------------------------------------------------------------- */ static herr_t -H5FD_ros3_term(void) +H5FD__ros3_term(void) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR #if ROS3_DEBUG - HDfprintf(stdout, "H5FD_ros3_term() called.\n"); + HDfprintf(stdout, "H5FD__ros3_term() called.\n"); #endif /* Reset VFL ID */ H5FD_ROS3_g = 0; FUNC_LEAVE_NOAPI(SUCCEED) - -} /* end H5FD_ros3_term() */ +} /* end H5FD__ros3_term() */ /*------------------------------------------------------------------------- @@ -403,8 +400,7 @@ H5FD_ros3_term(void) *------------------------------------------------------------------------- */ herr_t -H5Pset_fapl_ros3(hid_t fapl_id, - H5FD_ros3_fapl_t *fa) +H5Pset_fapl_ros3(hid_t fapl_id, H5FD_ros3_fapl_t *fa) { H5P_genplist_t *plist = NULL; /* Property list pointer */ herr_t ret_value = FAIL; @@ -419,25 +415,21 @@ H5Pset_fapl_ros3(hid_t fapl_id, #endif plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS); - if (plist == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, \ - "not a file access property list") - } + if(plist == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") - if (FAIL == H5FD_ros3_validate_config(fa)) { + if(FAIL == H5FD__ros3_validate_config(fa)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid ros3 config") - } ret_value = H5P_set_driver(plist, H5FD_ROS3, (void *)fa); done: FUNC_LEAVE_API(ret_value) - } /* end H5Pset_fapl_ros3() */ /*------------------------------------------------------------------------- - * Function: H5FD_ros3_validate_config() + * Function: H5FD__ros3_validate_config() * * Purpose: Test to see if the supplied instance of H5FD_ros3_fapl_t * contains internally consistant data. Return SUCCEED if so, @@ -457,34 +449,25 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_ros3_validate_config(const H5FD_ros3_fapl_t * fa) +H5FD__ros3_validate_config(const H5FD_ros3_fapl_t * fa) { herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(fa != NULL); - if ( fa->version != H5FD_CURR_ROS3_FAPL_T_VERSION ) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "Unknown H5FD_ros3_fapl_t version"); - } + if(fa->version != H5FD_CURR_ROS3_FAPL_T_VERSION) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Unknown H5FD_ros3_fapl_t version"); - /* if set to authenticate, region and id cannot be empty strings - */ - if (fa->authenticate == TRUE) { - if ((fa->aws_region[0] == '\0') || - (fa->secret_id[0] == '\0')) - { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "Inconsistent authentication information"); - } - } + /* if set to authenticate, region and id cannot be empty strings */ + if(fa->authenticate == TRUE) + if((fa->aws_region[0] == '\0') || (fa->secret_id[0] == '\0')) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Inconsistent authentication information"); done: FUNC_LEAVE_NOAPI(ret_value) - -} /* end H5FD_ros3_validate_config() */ +} /* end H5FD__ros3_validate_config() */ /*------------------------------------------------------------------------- @@ -500,13 +483,10 @@ done: * Programmer: John Mainzer * 9/10/17 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t -H5Pget_fapl_ros3(hid_t fapl_id, - H5FD_ros3_fapl_t *fa_out) +H5Pget_fapl_ros3(hid_t fapl_id, H5FD_ros3_fapl_t *fa_out) { const H5FD_ros3_fapl_t *fa = NULL; H5P_genplist_t *plist = NULL; @@ -519,35 +499,30 @@ H5Pget_fapl_ros3(hid_t fapl_id, HDfprintf(stdout, "H5Pget_fapl_ros3() called.\n"); #endif - if (fa_out == NULL) { + if(fa_out == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "fa_out is NULL") - } plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS); - if (plist == NULL) { + if(plist == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access list") - } - if (H5FD_ROS3 != H5P_peek_driver(plist)) { + if(H5FD_ROS3 != H5P_peek_driver(plist)) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver") - } fa = (const H5FD_ros3_fapl_t *)H5P_peek_driver_info(plist); - if (fa == NULL) { + if(fa == NULL) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info") - } /* Copy the ros3 fapl data out */ HDmemcpy(fa_out, fa, sizeof(H5FD_ros3_fapl_t)); done: FUNC_LEAVE_API(ret_value) - } /* end H5Pget_fapl_ros3() */ /*------------------------------------------------------------------------- - * Function: H5FD_ros3_fapl_get + * Function: H5FD__ros3_fapl_get * * Purpose: Gets a file access property list which could be used to * create an identical file. @@ -559,24 +534,20 @@ done: * Programmer: John Mainzer * 9/8/17 * - * Modifications: - * *------------------------------------------------------------------------- */ static void * -H5FD_ros3_fapl_get(H5FD_t *_file) +H5FD__ros3_fapl_get(H5FD_t *_file) { H5FD_ros3_t *file = (H5FD_ros3_t*)_file; H5FD_ros3_fapl_t *fa = NULL; void *ret_value = NULL; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC fa = (H5FD_ros3_fapl_t *)H5MM_calloc(sizeof(H5FD_ros3_fapl_t)); - if (fa == NULL) { - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, - "memory allocation failed") - } + if(fa == NULL) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Copy the fields of the structure */ HDmemcpy(fa, &(file->fa), sizeof(H5FD_ros3_fapl_t)); @@ -585,18 +556,16 @@ H5FD_ros3_fapl_get(H5FD_t *_file) ret_value = fa; done: - if (ret_value == NULL) { - if (fa != NULL) { + if(ret_value == NULL) + if(fa != NULL) H5MM_xfree(fa); - } - } - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_ros3_fapl_get() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FD__ros3_fapl_get() */ /*------------------------------------------------------------------------- - * Function: H5FD_ros3_fapl_copy + * Function: H5FD__ros3_fapl_copy * * Purpose: Copies the ros3-specific file access properties. * @@ -607,41 +576,35 @@ done: * Programmer: John Mainzer * 9/8/17 * - * Modifications: - * *------------------------------------------------------------------------- */ static void * -H5FD_ros3_fapl_copy(const void *_old_fa) +H5FD__ros3_fapl_copy(const void *_old_fa) { const H5FD_ros3_fapl_t *old_fa = (const H5FD_ros3_fapl_t*)_old_fa; H5FD_ros3_fapl_t *new_fa = NULL; void *ret_value = NULL; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC new_fa = (H5FD_ros3_fapl_t *)H5MM_malloc(sizeof(H5FD_ros3_fapl_t)); - if (new_fa == NULL) { - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, - "memory allocation failed"); - } + if(new_fa == NULL) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); HDmemcpy(new_fa, old_fa, sizeof(H5FD_ros3_fapl_t)); ret_value = new_fa; done: - if (ret_value == NULL) { - if (new_fa != NULL) { + if(ret_value == NULL) + if(new_fa != NULL) H5MM_xfree(new_fa); - } - } - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_ros3_fapl_copy() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FD__ros3_fapl_copy() */ /*------------------------------------------------------------------------- - * Function: H5FD_ros3_fapl_free + * Function: H5FD__ros3_fapl_free * * Purpose: Frees the ros3-specific file access properties. * @@ -650,27 +613,23 @@ done: * Programmer: John Mainzer * 9/8/17 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5FD_ros3_fapl_free(void *_fa) +H5FD__ros3_fapl_free(void *_fa) { H5FD_ros3_fapl_t *fa = (H5FD_ros3_fapl_t*)_fa; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(fa != NULL); /* sanity check */ H5MM_xfree(fa); FUNC_LEAVE_NOAPI(SUCCEED) - -} /* end H5FD_ros3_fapl_free() */ +} /* end H5FD__ros3_fapl_free() */ #if ROS3_STATS - /*---------------------------------------------------------------------------- * * Function: ros3_reset_stats() @@ -698,18 +657,16 @@ ros3_reset_stats(H5FD_ros3_t *file) unsigned i = 0; herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC #if ROS3_DEBUG HDprintf("ros3_reset_stats() called\n"); #endif - if (file == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "file was null"); - } + if(file == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file was null"); - for (i = 0; i <= ROS3_STATS_BIN_COUNT; i++) { + for(i = 0; i <= ROS3_STATS_BIN_COUNT; i++) { file->raw[i].bytes = 0; file->raw[i].count = 0; file->raw[i].min = (unsigned long long)ROS3_STATS_STARTING_MIN; @@ -723,15 +680,13 @@ ros3_reset_stats(H5FD_ros3_t *file) done: FUNC_LEAVE_NOAPI(ret_value); - } /* end ros3_reset_stats() */ - #endif /* ROS3_STATS */ /*------------------------------------------------------------------------- * - * Function: H5FD_ros3_open() + * Function: H5FD__ros3_open() * * Purpose: * @@ -761,11 +716,7 @@ done: *------------------------------------------------------------------------- */ static H5FD_t * -H5FD_ros3_open( - const char *url, - unsigned flags, - hid_t fapl_id, - haddr_t maxaddr) +H5FD__ros3_open(const char *url, unsigned flags, hid_t fapl_id, haddr_t maxaddr) { H5FD_ros3_t *file = NULL; struct tm *now = NULL; @@ -775,117 +726,89 @@ H5FD_ros3_open( H5FD_ros3_fapl_t fa; H5FD_t *ret_value = NULL; - - - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC #if ROS3_DEBUG - HDfprintf(stdout, "H5FD_ros3_open() called.\n"); + HDfprintf(stdout, "H5FD__ros3_open() called.\n"); #endif /* Sanity check on file offsets */ HDcompile_assert(sizeof(HDoff_t) >= sizeof(size_t)); /* Check arguments */ - if (!url || !*url) + if(!url || !*url) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid file name") - if (0 == maxaddr || HADDR_UNDEF == maxaddr) + if(0 == maxaddr || HADDR_UNDEF == maxaddr) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "bogus maxaddr") - if (ADDR_OVERFLOW(maxaddr)) + if(ADDR_OVERFLOW(maxaddr)) HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, NULL, "bogus maxaddr") - if (flags != H5F_ACC_RDONLY) - HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, NULL, - "only Read-Only access allowed") + if(flags != H5F_ACC_RDONLY) + HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, NULL, "only Read-Only access allowed") - if (FAIL == H5Pget_fapl_ros3(fapl_id, &fa)) { + if(FAIL == H5Pget_fapl_ros3(fapl_id, &fa)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "can't get property list") - } - if (CURLE_OK != curl_global_init(CURL_GLOBAL_DEFAULT)) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "unable to initialize curl global (placeholder flags)") - } + if(CURLE_OK != curl_global_init(CURL_GLOBAL_DEFAULT)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "unable to initialize curl global (placeholder flags)") /* open file; procedure depends on whether or not the fapl instructs to * authenticate requests or not. */ - if (fa.authenticate == TRUE) { + if(fa.authenticate == TRUE) { /* compute signing key (part of AWS/S3 REST API) * can be re-used by user/key for 7 days after creation. * find way to re-use/share */ now = gmnow(); HDassert( now != NULL ); - if (ISO8601NOW(iso8601now, now) != (ISO8601_SIZE - 1)) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "problem while writing iso8601 timestamp") - } - if (FAIL == H5FD_s3comms_signing_key(signing_key, - (const char *)fa.secret_key, - (const char *)fa.aws_region, - (const char *)iso8601now) ) - { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "problem while computing signing key") - } - - handle = H5FD_s3comms_s3r_open( - url, - (const char *)fa.aws_region, - (const char *)fa.secret_id, - (const unsigned char *)signing_key); - } else { + if(ISO8601NOW(iso8601now, now) != (ISO8601_SIZE - 1)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "problem while writing iso8601 timestamp") + if(FAIL == H5FD_s3comms_signing_key(signing_key, (const char *)fa.secret_key, + (const char *)fa.aws_region, (const char *)iso8601now)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "problem while computing signing key") + + handle = H5FD_s3comms_s3r_open( url, (const char *)fa.aws_region, + (const char *)fa.secret_id, (const unsigned char *)signing_key); + } + else handle = H5FD_s3comms_s3r_open(url, NULL, NULL, NULL); - } /* if/else should authenticate */ - if (handle == NULL) { + if(handle == NULL) /* If we want to check CURL's say on the matter in a controlled * fashion, this is the place to do it, but would need to make a * few minor changes to s3comms `s3r_t` and `s3r_read()`. */ HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, "could not open"); - } - /* create new file struct - */ + /* create new file struct */ file = H5FL_CALLOC(H5FD_ros3_t); - if (file == NULL) { - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, - "unable to allocate file struct") - } + if(file == NULL) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate file struct") file->s3r_handle = handle; HDmemcpy(&(file->fa), &fa, sizeof(H5FD_ros3_fapl_t)); #if ROS3_STATS - if (FAIL == ros3_reset_stats(file)) { - HGOTO_ERROR(H5E_INTERNAL, H5E_UNINITIALIZED, NULL, - "unable to reset file statistics") - } + if(FAIL == ros3_reset_stats(file)) + HGOTO_ERROR(H5E_INTERNAL, H5E_UNINITIALIZED, NULL, "unable to reset file statistics") #endif /* ROS3_STATS */ ret_value = (H5FD_t*)file; done: - if (ret_value == NULL) { - if (handle != NULL) { - if (FAIL == H5FD_s3comms_s3r_close(handle)) { - HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, NULL, - "unable to close s3 file handle") - } - } - if (file != NULL) { + if(ret_value == NULL) { + if(handle != NULL) + if(FAIL == H5FD_s3comms_s3r_close(handle)) + HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, NULL, "unable to close s3 file handle") + if(file != NULL) file = H5FL_FREE(H5FD_ros3_t, file); - } curl_global_cleanup(); /* early cleanup because open failed */ } /* end if null return value (error) */ FUNC_LEAVE_NOAPI(ret_value) - -} /* end H5FD_ros3_open() */ +} /* end H5FD__ros3_open() */ #if ROS3_STATS - /*---------------------------------------------------------------------------- * * Function: ros3_fprint_stats() @@ -941,8 +864,7 @@ done: *---------------------------------------------------------------------------- */ static herr_t -ros3_fprint_stats(FILE *stream, - const H5FD_ros3_t *file) +ros3_fprint_stats(FILE *stream, const H5FD_ros3_t *file) { herr_t ret_value = SUCCEED; parsed_url_t *purl = NULL; @@ -961,26 +883,16 @@ ros3_fprint_stats(FILE *stream, unsigned suffix_i = 0; const char suffixes[] = { ' ', 'K', 'M', 'G', 'T', 'P' }; + FUNC_ENTER_STATIC - - FUNC_ENTER_NOAPI_NOINIT - - if (stream == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "file stream cannot be null" ); - } - if (file == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "file cannot be null"); - } - if (file->s3r_handle == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "s3 request handle cannot be null"); - } - if (file->s3r_handle->purl == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "parsed url structure cannot be null"); - } + if(stream == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file stream cannot be null" ); + if(file == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file cannot be null"); + if(file->s3r_handle == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "s3 request handle cannot be null"); + if(file->s3r_handle->purl == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "parsed url structure cannot be null"); purl = file->s3r_handle->purl; /****************** @@ -988,9 +900,9 @@ ros3_fprint_stats(FILE *stream, ******************/ HDfprintf(stream, "stats for %s://%s", purl->scheme, purl->host); - if (purl->port != NULL && purl->port[0] != '\0') + if(purl->port != NULL && purl->port[0] != '\0') HDfprintf(stream, ":%s", purl->port); - if (purl->query != NULL && purl->query[0] != '\0') { + if(purl->query != NULL && purl->query[0] != '\0') { if (purl->path != NULL && purl->path[0] != '\0') HDfprintf(stream, "/%s", purl->path); else @@ -1005,23 +917,27 @@ ros3_fprint_stats(FILE *stream, * AGGREGATE STATS * *******************/ - for (i = 0; i <= ROS3_STATS_BIN_COUNT; i++) { + for(i = 0; i <= ROS3_STATS_BIN_COUNT; i++) { const ros3_statsbin *r = &file->raw[i]; const ros3_statsbin *m = &file->meta[i]; - if (m->min < min_meta) min_meta = m->min; - if (r->min < min_raw) min_raw = r->min; - if (m->max > max_meta) max_meta = m->max; - if (r->max > max_raw) max_raw = r->max; + if(m->min < min_meta) + min_meta = m->min; + if(r->min < min_raw) + min_raw = r->min; + if(m->max > max_meta) + max_meta = m->max; + if(r->max > max_raw) + max_raw = r->max; count_raw += r->count; count_meta += m->count; bytes_raw += r->bytes; bytes_meta += m->bytes; } - if (count_raw > 0) + if(count_raw > 0) average_raw = (double)bytes_raw / (double)count_raw; - if (count_meta > 0) + if(count_meta > 0) average_meta = (double)bytes_meta / (double)count_meta; /****************** @@ -1033,7 +949,7 @@ ros3_fprint_stats(FILE *stream, HDfprintf(stream, "TOTAL BYTES: %llu (%llu meta, %llu raw)\n", bytes_raw + bytes_meta, bytes_meta, bytes_raw); - if (count_raw + count_meta == 0) + if(count_raw + count_meta == 0) goto done; /************************* @@ -1042,21 +958,21 @@ ros3_fprint_stats(FILE *stream, HDfprintf(stream, "SIZES meta raw\n"); HDfprintf(stream, " min "); - if (count_meta == 0) { + if(count_meta == 0) HDfprintf(stream, " 0.000 "); - } else { + else { re_dub = (double)min_meta; - for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) + for(suffix_i = 0; re_dub >= 1024.0; suffix_i++) re_dub /= 1024.0; HDassert(suffix_i < sizeof(suffixes)); HDfprintf(stream, "%8.3lf%c ", re_dub, suffixes[suffix_i]); } - if (count_raw == 0) { + if(count_raw == 0) HDfprintf(stream, " 0.000 \n"); - } else { + else { re_dub = (double)min_raw; - for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) + for(suffix_i = 0; re_dub >= 1024.0; suffix_i++) re_dub /= 1024.0; HDassert(suffix_i < sizeof(suffixes)); HDfprintf(stream, "%8.3lf%c\n", re_dub, suffixes[suffix_i]); @@ -1064,26 +980,26 @@ ros3_fprint_stats(FILE *stream, HDfprintf(stream, " avg "); re_dub = (double)average_meta; - for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) + for(suffix_i = 0; re_dub >= 1024.0; suffix_i++) re_dub /= 1024.0; HDassert(suffix_i < sizeof(suffixes)); HDfprintf(stream, "%8.3lf%c ", re_dub, suffixes[suffix_i]); re_dub = (double)average_raw; - for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) + for(suffix_i = 0; re_dub >= 1024.0; suffix_i++) re_dub /= 1024.0; HDassert(suffix_i < sizeof(suffixes)); HDfprintf(stream, "%8.3lf%c\n", re_dub, suffixes[suffix_i]); HDfprintf(stream, " max "); re_dub = (double)max_meta; - for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) + for(suffix_i = 0; re_dub >= 1024.0; suffix_i++) re_dub /= 1024.0; HDassert(suffix_i < sizeof(suffixes)); HDfprintf(stream, "%8.3lf%c ", re_dub, suffixes[suffix_i]); re_dub = (double)max_raw; - for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) + for(suffix_i = 0; re_dub >= 1024.0; suffix_i++) re_dub /= 1024.0; HDassert(suffix_i < sizeof(suffixes)); HDfprintf(stream, "%8.3lf%c\n", re_dub, suffixes[suffix_i]); @@ -1097,7 +1013,7 @@ ros3_fprint_stats(FILE *stream, HDfprintf(stream, " up-to meta raw meta raw meta raw\n"); - for (i = 0; i <= ROS3_STATS_BIN_COUNT; i++) { + for(i = 0; i <= ROS3_STATS_BIN_COUNT; i++) { const ros3_statsbin *m; const ros3_statsbin *r; unsigned long long range_end = 0; @@ -1112,46 +1028,46 @@ ros3_fprint_stats(FILE *stream, m = &file->meta[i]; r = &file->raw[i]; - if (r->count == 0 && m->count == 0) + if(r->count == 0 && m->count == 0) continue; range_end = ros3_stats_boundaries[i]; - if (i == ROS3_STATS_BIN_COUNT) { + if(i == ROS3_STATS_BIN_COUNT) { range_end = ros3_stats_boundaries[i-1]; HDfprintf(stream, ">"); - } else { - HDfprintf(stream, " "); } + else + HDfprintf(stream, " "); bm_val = (double)m->bytes; - for (suffix_i = 0; bm_val >= 1024.0; suffix_i++) + for(suffix_i = 0; bm_val >= 1024.0; suffix_i++) bm_val /= 1024.0; HDassert(suffix_i < sizeof(suffixes)); bm_suffix = suffixes[suffix_i]; br_val = (double)r->bytes; - for (suffix_i = 0; br_val >= 1024.0; suffix_i++) + for(suffix_i = 0; br_val >= 1024.0; suffix_i++) br_val /= 1024.0; HDassert(suffix_i < sizeof(suffixes)); br_suffix = suffixes[suffix_i]; - if (m->count > 0) + if(m->count > 0) am_val = (double)(m->bytes) / (double)(m->count); - for (suffix_i = 0; am_val >= 1024.0; suffix_i++) + for(suffix_i = 0; am_val >= 1024.0; suffix_i++) am_val /= 1024.0; HDassert(suffix_i < sizeof(suffixes)); am_suffix = suffixes[suffix_i]; - if (r->count > 0) + if(r->count > 0) ar_val = (double)(r->bytes) / (double)(r->count); - for (suffix_i = 0; ar_val >= 1024.0; suffix_i++) + for(suffix_i = 0; ar_val >= 1024.0; suffix_i++) ar_val /= 1024.0; HDassert(suffix_i < sizeof(suffixes)); ar_suffix = suffixes[suffix_i]; re_dub = (double)range_end; - for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) + for(suffix_i = 0; re_dub >= 1024.0; suffix_i++) re_dub /= 1024.0; HDassert(suffix_i < sizeof(suffixes)); @@ -1165,7 +1081,7 @@ ros3_fprint_stats(FILE *stream, am_val, am_suffix, /* metadata average */ ar_val, ar_suffix); /* rawdata average */ - fflush(stream); + HDfflush(stream); } done: @@ -1177,7 +1093,7 @@ done: /*------------------------------------------------------------------------- * - * Function: H5FD_ros3_close() + * Function: H5FD__ros3_close() * * Purpose: * @@ -1193,52 +1109,45 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_ros3_close(H5FD_t H5_ATTR_UNUSED *_file) +H5FD__ros3_close(H5FD_t H5_ATTR_UNUSED *_file) { H5FD_ros3_t *file = (H5FD_ros3_t *)_file; herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC #if ROS3_DEBUG - HDfprintf(stdout, "H5FD_ros3_close() called.\n"); + HDfprintf(stdout, "H5FD__ros3_close() called.\n"); #endif - /* Sanity checks - */ + /* Sanity checks */ HDassert(file != NULL); HDassert(file->s3r_handle != NULL); /* Close the underlying request handle */ - if (FAIL == H5FD_s3comms_s3r_close(file->s3r_handle)) { - HGOTO_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, - "unable to close S3 request handle") - } + if(FAIL == H5FD_s3comms_s3r_close(file->s3r_handle)) + HGOTO_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "unable to close S3 request handle") #if ROS3_STATS /* TODO: mechanism to re-target stats printout */ - if (ros3_fprint_stats(stdout, file) == FAIL) { - HGOTO_ERROR(H5E_INTERNAL, H5E_ERROR, FAIL, - "problem while writing file statistics") - } + if(ros3_fprint_stats(stdout, file) == FAIL) + HGOTO_ERROR(H5E_INTERNAL, H5E_ERROR, FAIL, "problem while writing file statistics") #endif /* ROS3_STATS */ - /* Release the file info - */ + /* Release the file info */ file = H5FL_FREE(H5FD_ros3_t, file); done: curl_global_cleanup(); /* cleanup to answer init on open */ FUNC_LEAVE_NOAPI(ret_value) - -} /* end H5FD_ros3_close() */ +} /* end H5FD__ros3_close() */ /*------------------------------------------------------------------------- * - * Function: H5FD_ros3_cmp() + * Function: H5FD__ros3_cmp() * * Purpose: * @@ -1267,9 +1176,7 @@ done: *------------------------------------------------------------------------- */ static int -H5FD_ros3_cmp( - const H5FD_t *_f1, - const H5FD_t *_f2) +H5FD__ros3_cmp(const H5FD_t *_f1, const H5FD_t *_f2) { const H5FD_ros3_t *f1 = (const H5FD_ros3_t *)_f1; const H5FD_ros3_t *f2 = (const H5FD_ros3_t *)_f2; @@ -1277,10 +1184,10 @@ H5FD_ros3_cmp( const parsed_url_t *purl2 = NULL; int ret_value = 0; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR #if ROS3_DEBUG - HDfprintf(stdout, "H5FD_ros3_cmp() called.\n"); + HDfprintf(stdout, "H5FD__ros3_cmp() called.\n"); #endif HDassert(f1->s3r_handle != NULL); @@ -1296,113 +1203,80 @@ H5FD_ros3_cmp( HDassert(purl2->host != NULL); /* URL: SCHEME */ - if (HDstrcmp(purl1->scheme, purl2->scheme)) { - HGOTO_DONE(-1); - } + if(HDstrcmp(purl1->scheme, purl2->scheme)) + HGOTO_DONE(-1) /* URL: HOST */ - if (HDstrcmp(purl1->host, purl2->host)) { - HGOTO_DONE(-1); - } + if(HDstrcmp(purl1->host, purl2->host)) + HGOTO_DONE(-1) /* URL: PORT */ - if (purl1->port && purl2->port) { - if (HDstrcmp(purl1->port, purl2->port)) { - HGOTO_DONE(-1); - } - } - else - if (purl1->port) { - HGOTO_DONE(-1); - } - else - if (purl2->port) { - HGOTO_DONE(-1); + if(purl1->port && purl2->port) { + if(HDstrcmp(purl1->port, purl2->port)) + HGOTO_DONE(-1) } + else if(purl1->port) + HGOTO_DONE(-1) + else if(purl2->port) + HGOTO_DONE(-1) /* URL: PATH */ - if (purl1->path && purl2->path) { - if (HDstrcmp(purl1->path, purl2->path)) { - HGOTO_DONE(-1); - } - } - else - if (purl1->path && !purl2->path) { - HGOTO_DONE(-1); - } - else - if (purl2->path && !purl1->path) { - HGOTO_DONE(-1); + if(purl1->path && purl2->path) { + if(HDstrcmp(purl1->path, purl2->path)) + HGOTO_DONE(-1) } + else if(purl1->path && !purl2->path) + HGOTO_DONE(-1) + else if(purl2->path && !purl1->path) + HGOTO_DONE(-1) /* URL: QUERY */ - if (purl1->query && purl2->query) { - if (HDstrcmp(purl1->query, purl2->query)) { - HGOTO_DONE(-1); - } - } - else - if (purl1->query && !purl2->query) { - HGOTO_DONE(-1); - } - else - if (purl2->query && !purl1->query) { - HGOTO_DONE(-1); + if(purl1->query && purl2->query) { + if(HDstrcmp(purl1->query, purl2->query)) + HGOTO_DONE(-1) } + else if(purl1->query && !purl2->query) + HGOTO_DONE(-1) + else if(purl2->query && !purl1->query) + HGOTO_DONE(-1) /* FAPL: AWS_REGION */ - if (f1->fa.aws_region[0] != '\0' && f2->fa.aws_region[0] != '\0') { - if (HDstrcmp(f1->fa.aws_region, f2->fa.aws_region)) { - HGOTO_DONE(-1); - } - } - else - if (f1->fa.aws_region[0] != '\0') { - HGOTO_DONE(-1); - } - else - if (f2->fa.aws_region[0] != '\0') { - HGOTO_DONE(-1); + if(f1->fa.aws_region[0] != '\0' && f2->fa.aws_region[0] != '\0') { + if(HDstrcmp(f1->fa.aws_region, f2->fa.aws_region)) + HGOTO_DONE(-1) } + else if(f1->fa.aws_region[0] != '\0') + HGOTO_DONE(-1) + else if(f2->fa.aws_region[0] != '\0') + HGOTO_DONE(-1) /* FAPL: SECRET_ID */ - if (f1->fa.secret_id[0] != '\0' && f2->fa.secret_id[0] != '\0') { - if (HDstrcmp(f1->fa.secret_id, f2->fa.secret_id)) { - HGOTO_DONE(-1); - } - } - else - if (f1->fa.secret_id[0] != '\0') { - HGOTO_DONE(-1); - } - else - if (f2->fa.secret_id[0] != '\0') { - HGOTO_DONE(-1); + if(f1->fa.secret_id[0] != '\0' && f2->fa.secret_id[0] != '\0') { + if(HDstrcmp(f1->fa.secret_id, f2->fa.secret_id)) + HGOTO_DONE(-1) } + else if(f1->fa.secret_id[0] != '\0') + HGOTO_DONE(-1) + else if(f2->fa.secret_id[0] != '\0') + HGOTO_DONE(-1) /* FAPL: SECRET_KEY */ - if (f1->fa.secret_key[0] != '\0' && f2->fa.secret_key[0] != '\0') { - if (HDstrcmp(f1->fa.secret_key, f2->fa.secret_key)) { - HGOTO_DONE(-1); - } - } - else - if (f1->fa.secret_key[0] != '\0') { - HGOTO_DONE(-1); - } - else - if (f2->fa.secret_key[0] != '\0') { - HGOTO_DONE(-1); + if(f1->fa.secret_key[0] != '\0' && f2->fa.secret_key[0] != '\0') { + if(HDstrcmp(f1->fa.secret_key, f2->fa.secret_key)) + HGOTO_DONE(-1) } + else if(f1->fa.secret_key[0] != '\0') + HGOTO_DONE(-1) + else if(f2->fa.secret_key[0] != '\0') + HGOTO_DONE(-1) done: FUNC_LEAVE_NOAPI(ret_value) - -} /* H5FD_ros3_cmp() */ +} /* H5FD__ros3_cmp() */ /*------------------------------------------------------------------------- - * Function: H5FD_ros3_query + * Function: H5FD__ros3_query * * Purpose: Set the flags that this VFL driver is capable of supporting. * (listed in H5FDpublic.h) @@ -1421,30 +1295,28 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_ros3_query(const H5FD_t H5_ATTR_UNUSED *_file, - unsigned long *flags /* out */) +H5FD__ros3_query(const H5FD_t H5_ATTR_UNUSED *_file, unsigned long *flags) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR #if ROS3_DEBUG - HDfprintf(stdout, "H5FD_ros3_query() called.\n"); + HDfprintf(stdout, "H5FD__ros3_query() called.\n"); #endif /* Set the VFL feature flags that this driver supports */ - if (flags) { + if(flags) { *flags = 0; /* OK to perform data sieving for faster raw data reads & writes */ *flags |= H5FD_FEAT_DATA_SIEVE; } /* end if */ FUNC_LEAVE_NOAPI(SUCCEED) - -} /* H5FD_ros3_query() */ +} /* H5FD__ros3_query() */ /*------------------------------------------------------------------------- * - * Function: H5FD_ros3_get_eoa() + * Function: H5FD__ros3_get_eoa() * * Purpose: * @@ -1462,25 +1334,23 @@ H5FD_ros3_query(const H5FD_t H5_ATTR_UNUSED *_file, *------------------------------------------------------------------------- */ static haddr_t -H5FD_ros3_get_eoa(const H5FD_t *_file, - H5FD_mem_t H5_ATTR_UNUSED type) +H5FD__ros3_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) { const H5FD_ros3_t *file = (const H5FD_ros3_t *)_file; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR #if ROS3_DEBUG - HDfprintf(stdout, "H5FD_ros3_get_eoa() called.\n"); + HDfprintf(stdout, "H5FD__ros3_get_eoa() called.\n"); #endif FUNC_LEAVE_NOAPI(file->eoa) - -} /* end H5FD_ros3_get_eoa() */ +} /* end H5FD__ros3_get_eoa() */ /*------------------------------------------------------------------------- * - * Function: H5FD_ros3_set_eoa() + * Function: H5FD__ros3_set_eoa() * * Purpose: * @@ -1496,28 +1366,25 @@ H5FD_ros3_get_eoa(const H5FD_t *_file, *------------------------------------------------------------------------- */ static herr_t -H5FD_ros3_set_eoa(H5FD_t *_file, - H5FD_mem_t H5_ATTR_UNUSED type, - haddr_t addr) +H5FD__ros3_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr) { H5FD_ros3_t *file = (H5FD_ros3_t *)_file; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR #if ROS3_DEBUG - HDfprintf(stdout, "H5FD_ros3_set_eoa() called.\n"); + HDfprintf(stdout, "H5FD__ros3_set_eoa() called.\n"); #endif file->eoa = addr; FUNC_LEAVE_NOAPI(SUCCEED) - -} /* H5FD_ros3_set_eoa() */ +} /* H5FD__ros3_set_eoa() */ /*------------------------------------------------------------------------- * - * Function: H5FD_ros3_get_eof() + * Function: H5FD__ros3_get_eof() * * Purpose: * @@ -1534,25 +1401,23 @@ H5FD_ros3_set_eoa(H5FD_t *_file, *------------------------------------------------------------------------- */ static haddr_t -H5FD_ros3_get_eof(const H5FD_t *_file, - H5FD_mem_t H5_ATTR_UNUSED type) +H5FD__ros3_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) { const H5FD_ros3_t *file = (const H5FD_ros3_t *)_file; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR #if ROS3_DEBUG - HDfprintf(stdout, "H5FD_ros3_get_eof() called.\n"); + HDfprintf(stdout, "H5FD__ros3_get_eof() called.\n"); #endif FUNC_LEAVE_NOAPI(H5FD_s3comms_s3r_get_filesize(file->s3r_handle)) - -} /* end H5FD_ros3_get_eof() */ +} /* end H5FD__ros3_get_eof() */ /*------------------------------------------------------------------------- * - * Function: H5FD_ros3_get_handle() + * Function: H5FD__ros3_get_handle() * * Purpose: * @@ -1568,34 +1433,31 @@ H5FD_ros3_get_eof(const H5FD_t *_file, *------------------------------------------------------------------------- */ static herr_t -H5FD_ros3_get_handle(H5FD_t *_file, - hid_t H5_ATTR_UNUSED fapl, - void **file_handle) +H5FD__ros3_get_handle(H5FD_t *_file, hid_t H5_ATTR_UNUSED fapl, + void **file_handle) { H5FD_ros3_t *file = (H5FD_ros3_t *)_file; herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC #if ROS3_DEBUG - HDfprintf(stdout, "H5FD_ros3_get_handle() called.\n"); + HDfprintf(stdout, "H5FD__ros3_get_handle() called.\n"); #endif - if (!file_handle) { + if(!file_handle) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file handle not valid") - } *file_handle = file->s3r_handle; done: FUNC_LEAVE_NOAPI(ret_value) - -} /* end H5FD_ros3_get_handle() */ +} /* end H5FD__ros3_get_handle() */ /*------------------------------------------------------------------------- * - * Function: H5FD_ros3_read() + * Function: H5FD__ros3_read() * * Purpose * @@ -1616,12 +1478,9 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_ros3_read(H5FD_t *_file, - H5FD_mem_t H5_ATTR_UNUSED type, - hid_t H5_ATTR_UNUSED dxpl_id, - haddr_t addr, /* start offset */ - size_t size, /* length of read */ - void *buf) /* out */ +H5FD__ros3_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, + hid_t H5_ATTR_UNUSED dxpl_id, haddr_t addr, size_t size, + void *buf) { H5FD_ros3_t *file = (H5FD_ros3_t *)_file; size_t filesize = 0; @@ -1633,10 +1492,10 @@ H5FD_ros3_read(H5FD_t *_file, #endif /* ROS3_STATS */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC #if ROS3_DEBUG - HDfprintf(stdout, "H5FD_ros3_read() called.\n"); + HDfprintf(stdout, "H5FD__ros3_read() called.\n"); #endif HDassert(file != NULL); @@ -1645,40 +1504,32 @@ H5FD_ros3_read(H5FD_t *_file, filesize = H5FD_s3comms_s3r_get_filesize(file->s3r_handle); - if ((addr > filesize) || ((addr + size) > filesize)) { + if((addr > filesize) || ((addr + size) > filesize)) HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "range exceeds file address") - } - if (H5FD_s3comms_s3r_read(file->s3r_handle, addr, size, buf) == FAIL) { + if(H5FD_s3comms_s3r_read(file->s3r_handle, addr, size, buf) == FAIL) HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "unable to execute read") - } #if ROS3_STATS - /* Find which "bin" this read fits in. Can be "overflow" bin. - */ - for (bin_i = 0; bin_i < ROS3_STATS_BIN_COUNT; bin_i++) { - if ((unsigned long long)size < ros3_stats_boundaries[bin_i]) { + /* Find which "bin" this read fits in. Can be "overflow" bin. */ + for(bin_i = 0; bin_i < ROS3_STATS_BIN_COUNT; bin_i++) + if((unsigned long long)size < ros3_stats_boundaries[bin_i]) break; - } - } bin = (type == H5FD_MEM_DRAW) ? &file->raw[bin_i] : &file->meta[bin_i]; - /* Store collected stats in appropriate bin - */ - if (bin->count == 0) { + /* Store collected stats in appropriate bin */ + if(bin->count == 0) { bin->min = size; bin->max = size; } else { - if (size < bin->min) { + if(size < bin->min) bin->min = size; - } - if (size > bin->max) { + if(size > bin->max) bin->max = size; - } } bin->count++; bin->bytes += (unsigned long long)size; @@ -1687,13 +1538,12 @@ H5FD_ros3_read(H5FD_t *_file, done: FUNC_LEAVE_NOAPI(ret_value) - -} /* end H5FD_ros3_read() */ +} /* end H5FD__ros3_read() */ /*------------------------------------------------------------------------- * - * Function: H5FD_ros3_write() + * Function: H5FD__ros3_write() * * Purpose: * @@ -1710,33 +1560,28 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_ros3_write(H5FD_t H5_ATTR_UNUSED *_file, - H5FD_mem_t H5_ATTR_UNUSED type, - hid_t H5_ATTR_UNUSED dxpl_id, - haddr_t H5_ATTR_UNUSED addr, - size_t H5_ATTR_UNUSED size, - const void H5_ATTR_UNUSED *buf) +H5FD__ros3_write(H5FD_t H5_ATTR_UNUSED *_file, H5FD_mem_t H5_ATTR_UNUSED type, + hid_t H5_ATTR_UNUSED dxpl_id, haddr_t H5_ATTR_UNUSED addr, + size_t H5_ATTR_UNUSED size, const void H5_ATTR_UNUSED *buf) { herr_t ret_value = FAIL; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC #if ROS3_DEBUG - HDfprintf(stdout, "H5FD_ros3_write() called.\n"); + HDfprintf(stdout, "H5FD__ros3_write() called.\n"); #endif - HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, - "cannot write to read-only file.") + HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "cannot write to read-only file.") done: FUNC_LEAVE_NOAPI(ret_value) - -} /* H5FD_ros3_write() */ +} /* H5FD__ros3_write() */ /*------------------------------------------------------------------------- * - * Function: H5FD_ros3_truncate() + * Function: H5FD__ros3_truncate() * * Purpose: * @@ -1755,30 +1600,27 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_ros3_truncate(H5FD_t H5_ATTR_UNUSED *_file, - hid_t H5_ATTR_UNUSED dxpl_id, - hbool_t H5_ATTR_UNUSED closing) +H5FD__ros3_truncate(H5FD_t H5_ATTR_UNUSED *_file, hid_t H5_ATTR_UNUSED dxpl_id, + hbool_t H5_ATTR_UNUSED closing) { herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC #if ROS3_DEBUG - HDfprintf(stdout, "H5FD_ros3_truncate() called.\n"); + HDfprintf(stdout, "H5FD__ros3_truncate() called.\n"); #endif - HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, - "cannot truncate read-only file.") + HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "cannot truncate read-only file.") done: FUNC_LEAVE_NOAPI(ret_value) - -} /* end H5FD_ros3_truncate() */ +} /* end H5FD__ros3_truncate() */ /*------------------------------------------------------------------------- * - * Function: H5FD_ros3_lock() + * Function: H5FD__ros3_lock() * * Purpose: * @@ -1798,18 +1640,18 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_ros3_lock(H5FD_t H5_ATTR_UNUSED *_file, +H5FD__ros3_lock(H5FD_t H5_ATTR_UNUSED *_file, hbool_t H5_ATTR_UNUSED rw) { - FUNC_ENTER_NOAPI_NOINIT_NOERR - FUNC_LEAVE_NOAPI(SUCCEED) + FUNC_ENTER_STATIC_NOERR -} /* end H5FD_ros3_lock() */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5FD__ros3_lock() */ /*------------------------------------------------------------------------- * - * Function: H5FD_ros3_unlock() + * Function: H5FD__ros3_unlock() * * Purpose: * @@ -1826,12 +1668,12 @@ H5FD_ros3_lock(H5FD_t H5_ATTR_UNUSED *_file, *------------------------------------------------------------------------- */ static herr_t -H5FD_ros3_unlock(H5FD_t H5_ATTR_UNUSED *_file) +H5FD__ros3_unlock(H5FD_t H5_ATTR_UNUSED *_file) { - FUNC_ENTER_NOAPI_NOINIT_NOERR - FUNC_LEAVE_NOAPI(SUCCEED) + FUNC_ENTER_STATIC_NOERR -} /* end H5FD_ros3_unlock() */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5FD__ros3_unlock() */ #endif /* H5_HAVE_ROS3_VFD */ diff --git a/src/H5FDs3comms.c b/src/H5FDs3comms.c index d9d4c88..4c762d1 100644 --- a/src/H5FDs3comms.c +++ b/src/H5FDs3comms.c @@ -148,9 +148,8 @@ curlwritecallback(char *ptr, size_t product = (size * nmemb); size_t written = 0; - if (sds->magic != S3COMMS_CALLBACK_DATASTRUCT_MAGIC) { + if(sds->magic != S3COMMS_CALLBACK_DATASTRUCT_MAGIC) return written; - } if (size > 0) { HDmemcpy(&(sds->data[sds->size]), ptr, product); @@ -159,7 +158,6 @@ curlwritecallback(char *ptr, } return written; - } /* end curlwritecallback() */ @@ -236,22 +234,19 @@ H5FD_s3comms_hrb_node_set( FUNC_ENTER_NOAPI_NOINIT #if S3COMMS_DEBUG - HDfprintf(stdout, "called H5FD_s3comms_hrb_node_set.\n"); + HDfprintf(stdout, "called H5FD_s3comms_hrb_node_set."); HDprintf("NAME: %s\n", name); HDprintf("VALUE: %s\n", value); HDprintf("LIST:\n->"); - for (node_ptr = (*L); node_ptr != NULL; node_ptr = node_ptr->next) { + for(node_ptr = (*L); node_ptr != NULL; node_ptr = node_ptr->next) HDfprintf(stdout, "{%s}\n->", node_ptr->cat); - } HDprintf("(null)\n"); - fflush(stdout); + HDfflush(stdout); node_ptr = NULL; #endif - if (name == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "unable to operate on null name.\n"); - } + if(name == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to operate on null name"); namelen = HDstrlen(name); /*********************** @@ -261,20 +256,17 @@ H5FD_s3comms_hrb_node_set( /* copy and lowercase name */ lowername = (char *)H5MM_malloc(sizeof(char) * (namelen + 1)); - if (lowername == NULL) { - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, - "cannot make space for lowercase name copy.\n"); - } - for (i = 0; i < namelen; i++) { - lowername[i] = (char)tolower((int)name[i]); - } + if(lowername == NULL) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "cannot make space for lowercase name copy."); + for(i = 0; i < namelen; i++) + lowername[i] = (char)HDtolower((int)name[i]); lowername[namelen] = 0; /* If value supplied, copy name, value, and concatenated "name: value". * If NULL, we will be removing a node or doing nothing, so no need for * copies */ - if (value != NULL) { + if(value != NULL) { int ret = 0; size_t valuelen = HDstrlen(value); size_t catlen = namelen + valuelen + 2; /* +2 from ": " */ @@ -282,38 +274,28 @@ H5FD_s3comms_hrb_node_set( namecpy = (char *)H5MM_malloc(sizeof(char) * (namelen + 1)); - if (namecpy == NULL) { - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, - "cannot make space for name copy.\n"); - } + if(namecpy == NULL) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "cannot make space for name copy."); HDmemcpy(namecpy, name, (namelen + 1)); valuecpy = (char *)H5MM_malloc(sizeof(char) * (valuelen + 1)); - if (valuecpy == NULL) { - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, - "cannot make space for value copy.\n"); - } + if(valuecpy == NULL) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "cannot make space for value copy."); HDmemcpy(valuecpy, value, (valuelen + 1)); nvcat = (char *)H5MM_malloc(sizeof(char) * catwrite); - if (nvcat == NULL) { - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, - "cannot make space for concatenated string.\n"); - } + if(nvcat == NULL) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "cannot make space for concatenated string."); ret = HDsnprintf(nvcat, catwrite, "%s: %s", name, value); - if (ret < 0 || (size_t)ret > catlen) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "cannot concatenate `%s: %s", name, value); - } + if(ret < 0 || (size_t)ret > catlen) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cannot concatenate `%s: %s", name, value); HDassert( catlen == HDstrlen(nvcat) ); /* create new_node, should we need it */ new_node = (hrb_node_t *)H5MM_malloc(sizeof(hrb_node_t)); - if (new_node == NULL) { - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, - "cannot make space for new set.\n"); - } + if(new_node == NULL) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "cannot make space for new set."); new_node->magic = S3COMMS_HRB_NODE_MAGIC; new_node->name = NULL; @@ -327,14 +309,12 @@ H5FD_s3comms_hrb_node_set( * ACT ON LIST * ***************/ - if (*L == NULL) { - if (value == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "trying to remove node from empty list"); - } + if(*L == NULL) { + if(value == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "trying to remove node from empty list") else { #if S3COMMS_DEBUG -HDprintf("CREATE NEW\n"); fflush(stdout); +HDprintf("CREATE NEW\n"); HDfflush(stdout); #endif /******************* * CREATE NEW LIST * @@ -358,13 +338,13 @@ HDprintf("CREATE NEW\n"); fflush(stdout); /* Check whether to modify/remove first node in list */ - if (strcmp(lowername, node_ptr->lowername) == 0) { + if(HDstrcmp(lowername, node_ptr->lowername) == 0) { is_looking = FALSE; if (value == NULL) { #if S3COMMS_DEBUG -HDprintf("REMOVE HEAD\n"); fflush(stdout); +HDprintf("REMOVE HEAD\n"); HDfflush(stdout); #endif /*************** * REMOVE HEAD * @@ -373,41 +353,41 @@ HDprintf("REMOVE HEAD\n"); fflush(stdout); *L = node_ptr->next; #if S3COMMS_DEBUG -HDprintf("FREEING CAT (node)\n"); fflush(stdout); +HDprintf("FREEING CAT (node)\n"); HDfflush(stdout); #endif H5MM_xfree(node_ptr->cat); #if S3COMMS_DEBUG -HDprintf("FREEING LOWERNAME (node)\n"); fflush(stdout); +HDprintf("FREEING LOWERNAME (node)\n"); HDfflush(stdout); #endif H5MM_xfree(node_ptr->lowername); #if S3COMMS_DEBUG -HDprintf("FREEING NAME (node)\n"); fflush(stdout); +HDprintf("FREEING NAME (node)\n"); HDfflush(stdout); #endif H5MM_xfree(node_ptr->name); #if S3COMMS_DEBUG -HDprintf("FREEING VALUE (node)\n"); fflush(stdout); +HDprintf("FREEING VALUE (node)\n"); HDfflush(stdout); #endif H5MM_xfree(node_ptr->value); #if S3COMMS_DEBUG HDprintf("MAGIC OK? %s\n", (node_ptr->magic == S3COMMS_HRB_NODE_MAGIC) ? "YES" : "NO"); -fflush(stdout); +HDfflush(stdout); #endif HDassert( node_ptr->magic == S3COMMS_HRB_NODE_MAGIC ); node_ptr->magic += 1ul; #if S3COMMS_DEBUG -HDprintf("FREEING POINTER\n"); fflush(stdout); +HDprintf("FREEING POINTER\n"); HDfflush(stdout); #endif H5MM_xfree(node_ptr); #if S3COMMS_DEBUG -HDprintf("FREEING WORKING LOWERNAME\n"); fflush(stdout); +HDprintf("FREEING WORKING LOWERNAME\n"); HDfflush(stdout); #endif H5MM_xfree(lowername); lowername = NULL; } else { #if S3COMMS_DEBUG -HDprintf("MODIFY HEAD\n"); fflush(stdout); +HDprintf("MODIFY HEAD\n"); HDfflush(stdout); #endif /*************** * MODIFY HEAD * @@ -429,17 +409,15 @@ HDprintf("MODIFY HEAD\n"); fflush(stdout); } } else - if (strcmp(lowername, node_ptr->lowername) < 0) { + if (HDstrcmp(lowername, node_ptr->lowername) < 0) { is_looking = FALSE; - if (value == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "trying to remove a node 'before' head"); - } + if(value == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "trying to remove a node 'before' head") else { #if S3COMMS_DEBUG -HDprintf("PREPEND NEW HEAD\n"); fflush(stdout); +HDprintf("PREPEND NEW HEAD\n"); HDfflush(stdout); #endif /******************* * INSERT NEW HEAD * @@ -458,24 +436,22 @@ HDprintf("PREPEND NEW HEAD\n"); fflush(stdout); * SEARCH LIST * ***************/ - while (is_looking) { - if (node_ptr->next == NULL) { + while(is_looking) { + if(node_ptr->next == NULL) { is_looking = FALSE; - if (value == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "trying to remove absent node"); - } + if(value == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "trying to remove absent node") else { #if S3COMMS_DEBUG -HDprintf("APPEND A NODE\n"); fflush(stdout); +HDprintf("APPEND A NODE\n"); HDfflush(stdout); #endif /******************* * APPEND NEW NODE * *******************/ - HDassert( strcmp(lowername, node_ptr->lowername) > 0 ); + HDassert( HDstrcmp(lowername, node_ptr->lowername) > 0 ); new_node->name = namecpy; new_node->value = valuecpy; new_node->lowername = lowername; @@ -484,23 +460,21 @@ HDprintf("APPEND A NODE\n"); fflush(stdout); } } else - if (strcmp(lowername, node_ptr->next->lowername) < 0) { + if(HDstrcmp(lowername, node_ptr->next->lowername) < 0) { is_looking = FALSE; - if (value == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "trying to remove absent node"); - } + if(value == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "trying to remove absent node") else { #if S3COMMS_DEBUG -HDprintf("INSERT A NODE\n"); fflush(stdout); +HDprintf("INSERT A NODE\n"); HDfflush(stdout); #endif /******************* * INSERT NEW NODE * *******************/ - HDassert( strcmp(lowername, node_ptr->lowername) > 0 ); + HDassert( HDstrcmp(lowername, node_ptr->lowername) > 0 ); new_node->name = namecpy; new_node->value = valuecpy; new_node->lowername = lowername; @@ -510,11 +484,11 @@ HDprintf("INSERT A NODE\n"); fflush(stdout); } } else - if (strcmp(lowername, node_ptr->next->lowername) == 0) { + if(HDstrcmp(lowername, node_ptr->next->lowername) == 0) { is_looking = FALSE; - if (value == NULL) { + if(value == NULL) { /***************** * REMOVE A NODE * *****************/ @@ -523,7 +497,7 @@ HDprintf("INSERT A NODE\n"); fflush(stdout); node_ptr->next = tmp->next; #if S3COMMS_DEBUG -HDprintf("REMOVE A NODE\n"); fflush(stdout); +HDprintf("REMOVE A NODE\n"); HDfflush(stdout); #endif H5MM_xfree(tmp->cat); H5MM_xfree(tmp->lowername); @@ -539,7 +513,7 @@ HDprintf("REMOVE A NODE\n"); fflush(stdout); } else { #if S3COMMS_DEBUG -HDprintf("MODIFY A NODE\n"); fflush(stdout); +HDprintf("MODIFY A NODE\n"); HDfflush(stdout); #endif /***************** * MODIFY A NODE * @@ -572,14 +546,17 @@ HDprintf("MODIFY A NODE\n"); fflush(stdout); } /* end while is_looking */ done: - if (ret_value == FAIL) { - /* clean up - */ - if (nvcat != NULL) { H5MM_xfree(nvcat); } - if (namecpy != NULL) { H5MM_xfree(namecpy); } - if (lowername != NULL) { H5MM_xfree(lowername); } - if (valuecpy != NULL) { H5MM_xfree(valuecpy); } - if (new_node != NULL) { + if(ret_value == FAIL) { + /* clean up */ + if(nvcat != NULL) + H5MM_xfree(nvcat); + if(namecpy != NULL) + H5MM_xfree(namecpy); + if(lowername != NULL) + H5MM_xfree(lowername); + if(valuecpy != NULL) + H5MM_xfree(valuecpy); + if(new_node != NULL) { HDassert( new_node->magic == S3COMMS_HRB_NODE_MAGIC ); new_node->magic += 1ul; H5MM_xfree(new_node); @@ -638,12 +615,10 @@ H5FD_s3comms_hrb_destroy(hrb_t **_buf) HDfprintf(stdout, "called H5FD_s3comms_hrb_destroy.\n"); #endif - if (_buf != NULL && *_buf != NULL) { + if(_buf != NULL && *_buf != NULL) { buf = *_buf; - if (buf->magic != S3COMMS_HRB_MAGIC) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "pointer's magic does not match.\n"); - } + if(buf->magic != S3COMMS_HRB_MAGIC) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "pointer's magic does not match."); H5MM_xfree(buf->verb); H5MM_xfree(buf->version); @@ -707,53 +682,38 @@ H5FD_s3comms_hrb_init_request(const char *_verb, HDfprintf(stdout, "called H5FD_s3comms_hrb_init_request.\n"); #endif - if (_resource == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "resource string cannot be null.\n"); - } + if(_resource == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "resource string cannot be null."); - /* populate valid NULLs with defaults - */ - if (_verb == NULL) { + /* populate valid NULLs with defaults */ + if(_verb == NULL) _verb = "GET"; - } - - if (_http_version == NULL) { + if(_http_version == NULL) _http_version = "HTTP/1.1"; - } - /* malloc space for and prepare structure - */ + /* malloc space for and prepare structure */ request = (hrb_t *)H5MM_malloc(sizeof(hrb_t)); - if (request == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, NULL, - "no space for request structure"); - } + if(request == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, NULL, "no space for request structure"); request->magic = S3COMMS_HRB_MAGIC; request->body = NULL; request->body_len = 0; request->first_header = NULL; - - /* malloc and copy strings for the structure - */ + /* malloc and copy strings for the structure */ reslen = HDstrlen(_resource); if (_resource[0] == '/') { res = (char *)H5MM_malloc(sizeof(char) * (reslen+1)); - if (res == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, NULL, - "no space for resource string"); - } + if(res == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, NULL, "no space for resource string"); HDmemcpy(res, _resource, (reslen+1)); } else { res = (char *)H5MM_malloc(sizeof(char) * (reslen+2)); - if (res == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, NULL, - "no space for resource string"); - } + if(res == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, NULL, "no space for resource string"); *res = '/'; HDmemcpy((&res[1]), _resource, (reslen+1)); HDassert( (reslen+1) == HDstrlen(res) ); @@ -761,24 +721,18 @@ H5FD_s3comms_hrb_init_request(const char *_verb, verblen = HDstrlen(_verb) + 1; verb = (char *)H5MM_malloc(sizeof(char) * verblen); - if (verb == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "no space for verb string"); - } + if(verb == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "no space for verb string"); HDstrncpy(verb, _verb, verblen); vrsnlen = HDstrlen(_http_version) + 1; vrsn = (char *)H5MM_malloc(sizeof(char) * vrsnlen); - if (vrsn == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "no space for http-version string"); - } + if(vrsn == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "no space for http-version string"); HDstrncpy(vrsn, _http_version, vrsnlen); - - /* place new copies into structure - */ + /* place new copies into structure */ request->resource = res; request->verb = verb; request->version = vrsn; @@ -786,13 +740,16 @@ H5FD_s3comms_hrb_init_request(const char *_verb, ret_value = request; done: - /* if there is an error, clean up after ourselves - */ + /* if there is an error, clean up after ourselves */ if (ret_value == NULL) { - if (request != NULL) H5MM_xfree(request); - if (vrsn != NULL) H5MM_xfree(vrsn); - if (verb != NULL) H5MM_xfree(verb); - if (res != NULL) H5MM_xfree(res); + if(request != NULL) + H5MM_xfree(request); + if(vrsn != NULL) + H5MM_xfree(vrsn); + if(verb != NULL) + H5MM_xfree(verb); + if(res != NULL) + H5MM_xfree(res); } FUNC_LEAVE_NOAPI(ret_value) @@ -836,14 +793,10 @@ H5FD_s3comms_s3r_close(s3r_t *handle) HDfprintf(stdout, "called H5FD_s3comms_s3r_close.\n"); #endif - if (handle == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "handle cannot be null.\n"); - } - if (handle->magic != S3COMMS_S3R_MAGIC) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "handle has invalid magic.\n"); - } + if(handle == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle cannot be null."); + if(handle->magic != S3COMMS_S3R_MAGIC) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle has invalid magic."); curl_easy_cleanup(handle->curlhandle); @@ -854,10 +807,8 @@ H5FD_s3comms_s3r_close(s3r_t *handle) HDassert( handle->httpverb != NULL ); H5MM_xfree(handle->httpverb); - if (FAIL == H5FD_s3comms_free_purl(handle->purl)) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "unable to release parsed url structure") - } + if(FAIL == H5FD_s3comms_free_purl(handle->purl)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to release parsed url structure") H5MM_xfree(handle); @@ -893,9 +844,8 @@ H5FD_s3comms_s3r_get_filesize(s3r_t *handle) FUNC_ENTER_NOAPI_NOINIT_NOERR - if (handle != NULL) { + if(handle != NULL) ret_value = handle->filesize; - } FUNC_LEAVE_NOAPI(ret_value) } /* H5FD_s3comms_s3r_get_filesize */ @@ -953,58 +903,33 @@ H5FD_s3comms_s3r_getsize(s3r_t *handle) HDfprintf(stdout, "called H5FD_s3comms_s3r_getsize.\n"); #endif - if (handle == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "handle cannot be null.\n"); - } - if (handle->magic != S3COMMS_S3R_MAGIC) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "handle has invalid magic.\n"); - } - if (handle->curlhandle == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "handle has bad (null) curlhandle.\n") - } + if(handle == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle cannot be null."); + if(handle->magic != S3COMMS_S3R_MAGIC) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle has invalid magic."); + if(handle->curlhandle == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle has bad (null) curlhandle.") /******************** * PREPARE FOR HEAD * ********************/ curlh = handle->curlhandle; + if(CURLE_OK != curl_easy_setopt(curlh, CURLOPT_NOBODY, 1L)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "error while setting CURL option (CURLOPT_NOBODY)."); - if ( CURLE_OK != - curl_easy_setopt(curlh, - CURLOPT_NOBODY, - 1L) ) - { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "error while setting CURL option (CURLOPT_NOBODY). " - "(placeholder flags)"); - } - - if ( CURLE_OK != - curl_easy_setopt(curlh, - CURLOPT_HEADERDATA, - &sds) ) - { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "error while setting CURL option (CURLOPT_HEADERDATA). " - "(placeholder flags)"); - } + if(CURLE_OK != curl_easy_setopt(curlh, CURLOPT_HEADERDATA, &sds)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "error while setting CURL option (CURLOPT_HEADERDATA)."); HDassert( handle->httpverb == NULL ); handle->httpverb = (char *)H5MM_malloc(sizeof(char) * 16); - if (handle->httpverb == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, - "unable to allocate space for S3 request HTTP verb"); - } + if(handle->httpverb == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, "unable to allocate space for S3 request HTTP verb"); HDmemcpy(handle->httpverb, "HEAD", 5); headerresponse = (char *)H5MM_malloc(sizeof(char) * CURL_MAX_HTTP_HEADER); - if (headerresponse == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, - "unable to allocate space for curl header response"); - } + if(headerresponse == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, "unable to allocate space for curl header response"); sds.data = headerresponse; /******************* @@ -1015,65 +940,43 @@ H5FD_s3comms_s3r_getsize(s3r_t *handle) * but, with a NULL destination and NOBODY and HEADERDATA supplied above, * only http metadata will be sent by server and recorded by s3comms */ - if (FAIL == - H5FD_s3comms_s3r_read(handle, 0, 0, NULL) ) - { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "problem in reading during getsize.\n"); - } + if(FAIL == H5FD_s3comms_s3r_read(handle, 0, 0, NULL)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem in reading during getsize."); - if (sds.size > CURL_MAX_HTTP_HEADER) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "HTTP metadata buffer overrun\n"); - } else if (sds.size == 0) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "No HTTP metadata\n"); + if(sds.size > CURL_MAX_HTTP_HEADER) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "HTTP metadata buffer overrun") + else if (sds.size == 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "No HTTP metadata") #if S3COMMS_DEBUG - } else { + else HDfprintf(stderr, "GETSIZE: OK\n"); #endif - } /****************** * PARSE RESPONSE * ******************/ - start = strstr(headerresponse, - "\r\nContent-Length: "); - if (start == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "could not find \"Content-Length\" in response.\n"); - } + start = HDstrstr(headerresponse, "\r\nContent-Length: "); + if(start == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not find \"Content-Length\" in response."); - /* move "start" to beginning of value in line; find end of line - */ + /* move "start" to beginning of value in line; find end of line */ start = start + HDstrlen("\r\nContent-Length: "); - end = strstr(start, "\r\n"); - if (end == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "could not find end of content length line"); - } + end = HDstrstr(start, "\r\n"); + if(end == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not find end of content length line"); /* place null terminator at end of numbers */ *end = '\0'; - content_length = strtoumax((const char *)start, - NULL, - 0); - - if (UINTMAX_MAX > SIZE_MAX && content_length > SIZE_MAX) { - HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "content_length overflows size_t\n"); - } + content_length = HDstrtoumax((const char *)start, NULL, 0); + if(UINTMAX_MAX > SIZE_MAX && content_length > SIZE_MAX) + HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "content_length overflows size_t"); - if (content_length == 0 || - errno == ERANGE) /* errno set by strtoumax*/ - { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "could not convert found \"Content-Length\" response (\"%s\")", - start); /* range is null-terminated, remember */ - } + if(content_length == 0 || errno == ERANGE) /* errno set by HDstrtoumax*/ + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not convert found \"Content-Length\" response (\"%s\")", start); /* range is null-terminated, remember */ handle->filesize = (size_t)content_length; @@ -1081,32 +984,17 @@ H5FD_s3comms_s3r_getsize(s3r_t *handle) * UNDO HEAD SETTINGS * **********************/ - if ( CURLE_OK != - curl_easy_setopt(curlh, - CURLOPT_NOBODY, - NULL) ) - { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "error while setting CURL option (CURLOPT_NOBODY). " - "(placeholder flags)"); - } + if(CURLE_OK != curl_easy_setopt(curlh, CURLOPT_NOBODY, NULL)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "error while setting CURL option (CURLOPT_NOBODY)."); - if ( CURLE_OK != - curl_easy_setopt(curlh, - CURLOPT_HEADERDATA, - NULL) ) - { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "error while setting CURL option (CURLOPT_HEADERDATA). " - "(placeholder flags)"); - } + if(CURLE_OK != curl_easy_setopt(curlh, CURLOPT_HEADERDATA, NULL)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "error while setting CURL option (CURLOPT_HEADERDATA)."); done: H5MM_xfree(headerresponse); sds.magic += 1; /* set to bad magic */ FUNC_LEAVE_NOAPI(ret_value); - } /* H5FD_s3comms_s3r_getsize */ @@ -1167,26 +1055,19 @@ H5FD_s3comms_s3r_open(const char *url, HDfprintf(stdout, "called H5FD_s3comms_s3r_open.\n"); #endif + if(url == NULL || url[0] == '\0') + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "url cannot be null."); - - if (url == NULL || url[0] == '\0') { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "url cannot be null.\n"); - } - - if (FAIL == H5FD_s3comms_parse_url(url, &purl)) { + if(FAIL == H5FD_s3comms_parse_url(url, &purl)) /* probably a malformed url, but could be internal error */ - HGOTO_ERROR(H5E_ARGS, H5E_CANTCREATE, NULL, - "unable to create parsed url structure"); - } + HGOTO_ERROR(H5E_ARGS, H5E_CANTCREATE, NULL, "unable to create parsed url structure"); + HDassert( purl != NULL ); /* if above passes, this must be true */ HDassert( purl->magic == S3COMMS_PARSED_URL_MAGIC ); handle = (s3r_t *)H5MM_malloc(sizeof(s3r_t)); - if (handle == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, NULL, - "could not malloc space for handle.\n"); - } + if(handle == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, NULL, "could not malloc space for handle."); handle->magic = S3COMMS_S3R_MAGIC; handle->purl = purl; @@ -1200,50 +1081,35 @@ H5FD_s3comms_s3r_open(const char *url, * RECORD AUTHENTICATION INFORMATION * *************************************/ - if ((region != NULL && *region != '\0') || - (id != NULL && *id != '\0') || - (signing_key != NULL)) - { - /* if one exists, all three must exist - */ - if (region == NULL || region[0] == '\0') { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "region cannot be null.\n"); - } - if (id == NULL || id[0] == '\0') { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "secret id cannot be null.\n"); - } - if (signing_key == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "signing key cannot be null.\n"); - } + if((region != NULL && *region != '\0') || + (id != NULL && *id != '\0') || + (signing_key != NULL)) { - /* copy strings - */ + /* if one exists, all three must exist */ + if(region == NULL || region[0] == '\0') + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "region cannot be null."); + if(id == NULL || id[0] == '\0') + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "secret id cannot be null."); + if(signing_key == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "signing key cannot be null."); + + /* copy strings */ tmplen = HDstrlen(region) + 1; handle->region = (char *)H5MM_malloc(sizeof(char) * tmplen); - if (handle->region == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "could not malloc space for handle region copy.\n"); - } + if(handle->region == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "could not malloc space for handle region copy."); HDmemcpy(handle->region, region, tmplen); tmplen = HDstrlen(id) + 1; handle->secret_id = (char *)H5MM_malloc(sizeof(char) * tmplen); - if (handle->secret_id == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "could not malloc space for handle ID copy.\n"); - } + if(handle->secret_id == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "could not malloc space for handle ID copy."); HDmemcpy(handle->secret_id, id, tmplen); tmplen = SHA256_DIGEST_LENGTH; - handle->signing_key = - (unsigned char *)H5MM_malloc(sizeof(unsigned char) * tmplen); - if (handle->signing_key == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "could not malloc space for handle key copy.\n"); - } + handle->signing_key = (unsigned char *)H5MM_malloc(sizeof(unsigned char) * tmplen); + if(handle->signing_key == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "could not malloc space for handle key copy."); HDmemcpy(handle->signing_key, signing_key, tmplen); } /* if authentication information provided */ @@ -1252,61 +1118,23 @@ H5FD_s3comms_s3r_open(const char *url, ************************/ curlh = curl_easy_init(); + if(curlh == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "problem creating curl easy handle!"); - if (curlh == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "problem creating curl easy handle!\n"); - } + if(CURLE_OK != curl_easy_setopt(curlh, CURLOPT_HTTPGET, 1L)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "error while setting CURL option (CURLOPT_HTTPGET)."); - if ( CURLE_OK != - curl_easy_setopt(curlh, - CURLOPT_HTTPGET, - 1L) ) - { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "error while setting CURL option (CURLOPT_HTTPGET). " - "(placeholder flags)"); - } - - if ( CURLE_OK != - curl_easy_setopt(curlh, - CURLOPT_HTTP_VERSION, - CURL_HTTP_VERSION_1_1) ) - { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "error while setting CURL option (CURLOPT_HTTP_VERSION). " - "(placeholder flags)"); - } + if(CURLE_OK != curl_easy_setopt(curlh, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "error while setting CURL option (CURLOPT_HTTP_VERSION)."); - if ( CURLE_OK != - curl_easy_setopt(curlh, - CURLOPT_FAILONERROR, - 1L) ) - { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "error while setting CURL option (CURLOPT_FAILONERROR). " - "(placeholder flags)"); - } + if(CURLE_OK != curl_easy_setopt(curlh, CURLOPT_FAILONERROR, 1L)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "error while setting CURL option (CURLOPT_FAILONERROR)."); - if ( CURLE_OK != - curl_easy_setopt(curlh, - CURLOPT_WRITEFUNCTION, - curlwritecallback) ) - { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "error while setting CURL option (CURLOPT_WRITEFUNCTION). " - "(placeholder flags)"); - } + if(CURLE_OK != curl_easy_setopt(curlh, CURLOPT_WRITEFUNCTION, curlwritecallback)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "error while setting CURL option (CURLOPT_WRITEFUNCTION)."); - if ( CURLE_OK != - curl_easy_setopt(curlh, - CURLOPT_URL, - url) ) - { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "error while setting CURL option (CURLOPT_URL). " - "(placeholder flags)"); - } + if(CURLE_OK != curl_easy_setopt(curlh, CURLOPT_URL, url)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "error while setting CURL option (CURLOPT_URL)."); #if S3COMMS_CURL_VERBOSITY > 1 /* CURL will print (to stdout) information for each operation @@ -1322,12 +1150,8 @@ H5FD_s3comms_s3r_open(const char *url, * GET FILE SIZE * *******************/ - if (FAIL == - H5FD_s3comms_s3r_getsize(handle) ) - { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "problem in H5FD_s3comms_s3r_getsize.\n"); - } + if(FAIL == H5FD_s3comms_s3r_getsize(handle)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "problem in H5FD_s3comms_s3r_getsize."); /********************* * FINAL PREPARATION * @@ -1339,27 +1163,22 @@ H5FD_s3comms_s3r_open(const char *url, ret_value = handle; done: - if (ret_value == NULL) { - if (curlh != NULL) { + if(ret_value == NULL) { + if(curlh != NULL) curl_easy_cleanup(curlh); - } - if (FAIL == H5FD_s3comms_free_purl(purl)) { - HDONE_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "unable to free parsed url structure") - } - if (handle != NULL) { + if(FAIL == H5FD_s3comms_free_purl(purl)) + HDONE_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "unable to free parsed url structure") + if(handle != NULL) { H5MM_xfree(handle->region); H5MM_xfree(handle->secret_id); H5MM_xfree(handle->signing_key); - if (handle->httpverb != NULL) { + if(handle->httpverb != NULL) H5MM_xfree(handle->httpverb); - } H5MM_xfree(handle); } } FUNC_LEAVE_NOAPI(ret_value) - } /* H5FD_s3comms_s3r_open */ @@ -1433,27 +1252,17 @@ H5FD_s3comms_s3r_read(s3r_t *handle, * ABSOLUTELY NECESSARY SANITY-CHECKS * **************************************/ - if (handle == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "handle cannot be null.\n"); - } - if (handle->magic != S3COMMS_S3R_MAGIC) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "handle has invalid magic.\n"); - } - if (handle->curlhandle == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "handle has bad (null) curlhandle.\n") - } - if (handle->purl == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "handle has bad (null) url.\n") - } + if(handle == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle cannot be null."); + if(handle->magic != S3COMMS_S3R_MAGIC) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle has invalid magic."); + if(handle->curlhandle == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle has bad (null) curlhandle.") + if(handle->purl == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle has bad (null) url.") HDassert( handle->purl->magic == S3COMMS_PARSED_URL_MAGIC ); - if (offset > handle->filesize || (len + offset) > handle->filesize) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "unable to read past EoF") - } + if(offset > handle->filesize || (len + offset) > handle->filesize) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to read past EoF") curlh = handle->curlhandle; @@ -1461,26 +1270,16 @@ H5FD_s3comms_s3r_read(s3r_t *handle, * PREPARE WRITEDATA * *********************/ - if (dest != NULL) { - sds = (struct s3r_datastruct *)H5MM_malloc( - sizeof(struct s3r_datastruct)); - if (sds == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, - "could not malloc destination datastructure.\n"); - } + if(dest != NULL) { + sds = (struct s3r_datastruct *)H5MM_malloc(sizeof(struct s3r_datastruct)); + if(sds == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, "could not malloc destination datastructure."); sds->magic = S3COMMS_CALLBACK_DATASTRUCT_MAGIC; sds->data = (char *)dest; sds->size = 0; - if (CURLE_OK != - curl_easy_setopt(curlh, - CURLOPT_WRITEDATA, - sds) ) - { - HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, FAIL, - "error while setting CURL option (CURLOPT_WRITEDATA). " - "(placeholder flags)"); - } + if(CURLE_OK != curl_easy_setopt(curlh, CURLOPT_WRITEDATA, sds)) + HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, FAIL, "error while setting CURL option (CURLOPT_WRITEDATA)."); } /********************* @@ -1488,34 +1287,22 @@ H5FD_s3comms_s3r_read(s3r_t *handle, *********************/ if (len > 0) { - rangebytesstr = (char *)H5MM_malloc(sizeof(char) * \ - (S3COMMS_MAX_RANGE_STRING_SIZE+1) ); - if (rangebytesstr == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, - "could not malloc range format string.\n"); - } - ret = HDsnprintf(rangebytesstr, - (S3COMMS_MAX_RANGE_STRING_SIZE), + rangebytesstr = (char *)H5MM_malloc(sizeof(char) * (S3COMMS_MAX_RANGE_STRING_SIZE+1) ); + if(rangebytesstr == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, "could not malloc range format string."); + ret = HDsnprintf(rangebytesstr, (S3COMMS_MAX_RANGE_STRING_SIZE), "bytes="H5_PRINTF_HADDR_FMT"-"H5_PRINTF_HADDR_FMT, - offset, - offset + len - 1); - if (ret <= 0 || ret >= S3COMMS_MAX_RANGE_STRING_SIZE) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "unable to format HTTP Range value"); - } else if (offset > 0) { - rangebytesstr = (char *)H5MM_malloc(sizeof(char) * \ - (S3COMMS_MAX_RANGE_STRING_SIZE+1)); - if (rangebytesstr == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, - "could not malloc range format string.\n"); - } - ret = HDsnprintf(rangebytesstr, - (S3COMMS_MAX_RANGE_STRING_SIZE), - "bytes="H5_PRINTF_HADDR_FMT"-", - offset); - if (ret <= 0 || ret >= S3COMMS_MAX_RANGE_STRING_SIZE) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "unable to format HTTP Range value"); + offset, offset + len - 1); + if(ret <= 0 || ret >= S3COMMS_MAX_RANGE_STRING_SIZE) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to format HTTP Range value"); + } else if(offset > 0) { + rangebytesstr = (char *)H5MM_malloc(sizeof(char) * (S3COMMS_MAX_RANGE_STRING_SIZE+1)); + if(rangebytesstr == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, "could not malloc range format string."); + ret = HDsnprintf(rangebytesstr, (S3COMMS_MAX_RANGE_STRING_SIZE), + "bytes="H5_PRINTF_HADDR_FMT"-", offset); + if(ret <= 0 || ret >= S3COMMS_MAX_RANGE_STRING_SIZE) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to format HTTP Range value"); } /******************* @@ -1523,26 +1310,18 @@ H5FD_s3comms_s3r_read(s3r_t *handle, *******************/ if (handle->signing_key == NULL) { - /* Do not authenticate. - */ - if (rangebytesstr != NULL) { - /* Pass in range directly - */ + /* Do not authenticate. */ + if(rangebytesstr != NULL) { + /* Pass in range directly */ char *bytesrange_ptr = NULL; /* pointer past "bytes=" portion */ - bytesrange_ptr = strchr(rangebytesstr, '='); + bytesrange_ptr = HDstrchr(rangebytesstr, '='); HDassert( bytesrange_ptr != NULL ); bytesrange_ptr++; /* move to first char past '=' */ HDassert( *bytesrange_ptr != '\0' ); - if (CURLE_OK != - curl_easy_setopt(curlh, - CURLOPT_RANGE, - bytesrange_ptr) ) - { - HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, - "error while setting CURL option (CURLOPT_RANGE). "); - } + if(CURLE_OK != curl_easy_setopt(curlh, CURLOPT_RANGE, bytesrange_ptr)) + HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, "error while setting CURL option (CURLOPT_RANGE). "); } } else { /* authenticate request @@ -1575,30 +1354,18 @@ H5FD_s3comms_s3r_read(s3r_t *handle, /**** VERIFY INFORMATION EXISTS ****/ - if (handle->region == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "handle must have non-null region.\n"); - } - if (handle->secret_id == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "handle must have non-null secret_id.\n"); - } - if (handle->signing_key == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "handle must have non-null signing_key.\n"); - } - if (handle->httpverb == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "handle must have non-null httpverb.\n"); - } - if (handle->purl->host == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "handle must have non-null host.\n"); - } - if (handle->purl->path == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "handle must have non-null resource.\n"); - } + if(handle->region == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle must have non-null region."); + if(handle->secret_id == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle must have non-null secret_id."); + if(handle->signing_key == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle must have non-null signing_key."); + if(handle->httpverb == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle must have non-null httpverb."); + if(handle->purl->host == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle must have non-null host."); + if(handle->purl->path == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle must have non-null resource."); /**** CREATE HTTP REQUEST STRUCTURE (hrb_t) ****/ @@ -1606,198 +1373,93 @@ H5FD_s3comms_s3r_read(s3r_t *handle, (const char *)handle->httpverb, (const char *)handle->purl->path, "HTTP/1.1"); - if (request == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "could not allocate hrb_t request.\n"); - } + if(request == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not allocate hrb_t request."); HDassert( request->magic == S3COMMS_HRB_MAGIC ); now = gmnow(); - if (ISO8601NOW(iso8601now, now) != (ISO8601_SIZE - 1)) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "could not format ISO8601 time.\n"); - } + if(ISO8601NOW(iso8601now, now) != (ISO8601_SIZE - 1)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not format ISO8601 time."); - if (FAIL == - H5FD_s3comms_hrb_node_set( - &headers, - "x-amz-date", - (const char *)iso8601now) ) - { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "unable to set x-amz-date header") - } - if (headers == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "problem building headers list. " - "(placeholder flags)\n"); - } + if(FAIL == H5FD_s3comms_hrb_node_set( &headers, "x-amz-date", (const char *)iso8601now)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to set x-amz-date header") + if(headers == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem building headers list."); HDassert( headers->magic == S3COMMS_HRB_NODE_MAGIC ); - if (FAIL == - H5FD_s3comms_hrb_node_set( - &headers, - "x-amz-content-sha256", - (const char *)EMPTY_SHA256) ) - { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "unable to set x-amz-content-sha256 header") - } - if (headers == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "problem building headers list. " - "(placeholder flags)\n"); - } + if(FAIL == H5FD_s3comms_hrb_node_set(&headers, "x-amz-content-sha256", (const char *)EMPTY_SHA256)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to set x-amz-content-sha256 header") + if(headers == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem building headers list."); HDassert( headers->magic == S3COMMS_HRB_NODE_MAGIC ); - if (rangebytesstr != NULL) { - if (FAIL == - H5FD_s3comms_hrb_node_set( - &headers, - "Range", - (const char *)rangebytesstr) ) - { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "unable to set range header") - } - if (headers == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "problem building headers list. " - "(placeholder flags)\n"); - } + if(rangebytesstr != NULL) { + if(FAIL == H5FD_s3comms_hrb_node_set( &headers, "Range", rangebytesstr)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to set range header") + if(headers == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem building headers list."); HDassert( headers->magic == S3COMMS_HRB_NODE_MAGIC ); } - if (FAIL == - H5FD_s3comms_hrb_node_set( - &headers, - "Host", - (const char *)handle->purl->host) ) - { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "unable to set host header") - } - if (headers == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "problem building headers list. " - "(placeholder flags)\n"); - } + if(FAIL == H5FD_s3comms_hrb_node_set(&headers, "Host", handle->purl->host)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to set host header") + if(headers == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem building headers list."); HDassert( headers->magic == S3COMMS_HRB_NODE_MAGIC ); request->first_header = headers; /**** COMPUTE AUTHORIZATION ****/ - if (FAIL == /* buffer1 -> canonical request */ - H5FD_s3comms_aws_canonical_request( - buffer1, - 512, - signed_headers, - 48, - request) ) - { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "(placeholder flags)\n"); - } - if ( FAIL == /* buffer2->string-to-sign */ - H5FD_s3comms_tostringtosign(buffer2, - buffer1, - iso8601now, - handle->region) ) - { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "(placeholder flags)\n"); - } - if (FAIL == /* buffer1 -> signature */ - H5FD_s3comms_HMAC_SHA256(handle->signing_key, - SHA256_DIGEST_LENGTH, - buffer2, - HDstrlen(buffer2), - buffer1) ) - { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "(placeholder flags)\n"); - } + /* buffer1 -> canonical request */ + if(FAIL == H5FD_s3comms_aws_canonical_request(buffer1, 512, signed_headers, 48, request)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad canonical request"); + /* buffer2->string-to-sign */ + if(FAIL == H5FD_s3comms_tostringtosign(buffer2, buffer1, iso8601now, handle->region)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad string-to-sign"); + /* buffer1 -> signature */ + if(FAIL == H5FD_s3comms_HMAC_SHA256(handle->signing_key, SHA256_DIGEST_LENGTH, buffer2, HDstrlen(buffer2), buffer1)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad signature"); iso8601now[8] = 0; /* trim to yyyyMMDD */ - ret = S3COMMS_FORMAT_CREDENTIAL(buffer2, - handle->secret_id, - iso8601now, - handle->region, - "s3"); - if (ret == 0 || ret >= S3COMMS_MAX_CREDENTIAL_SIZE) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "unable to format aws4 credential string"); - - ret = HDsnprintf( - authorization, - 512, + ret = S3COMMS_FORMAT_CREDENTIAL(buffer2, handle->secret_id, iso8601now, handle->region, "s3"); + if(ret == 0 || ret >= S3COMMS_MAX_CREDENTIAL_SIZE) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to format aws4 credential string"); + + ret = HDsnprintf( authorization, 512, "AWS4-HMAC-SHA256 Credential=%s,SignedHeaders=%s,Signature=%s", - buffer2, - signed_headers, - buffer1); - if (ret <= 0 || ret >= 512) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "unable to format aws4 authorization string"); - } + buffer2, signed_headers, buffer1); + if(ret <= 0 || ret >= 512) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to format aws4 authorization string"); - /* append authorization header to http request buffer - */ - if (H5FD_s3comms_hrb_node_set( - &headers, - "Authorization", - (const char *)authorization) - == FAIL) - { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "unable to set Authorization header") - } - if (headers == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "problem building headers list. " - "(placeholder flags)\n"); - } + /* append authorization header to http request buffer */ + if(H5FD_s3comms_hrb_node_set(&headers, "Authorization", (const char *)authorization) == FAIL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to set Authorization header") + if(headers == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem building headers list."); - /* update hrb's "first header" pointer - */ + /* update hrb's "first header" pointer */ request->first_header = headers; /**** SET CURLHANDLE HTTP HEADERS FROM GENERATED DATA ****/ node = request->first_header; - while (node != NULL) { + while(node != NULL) { HDassert( node->magic == S3COMMS_HRB_NODE_MAGIC ); - curlheaders = curl_slist_append(curlheaders, - (const char *)node->cat); - if (curlheaders == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "could not append header to curl slist. " - "(placeholder flags)\n"); - } + curlheaders = curl_slist_append(curlheaders, (const char *)node->cat); + if(curlheaders == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not append header to curl slist."); node = node->next; } - /* sanity-check - */ - if (curlheaders == NULL) { + /* sanity-check */ + if(curlheaders == NULL) /* above loop was probably never run */ - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "curlheaders was never populated.\n"); - } - - /* finally, set http headers in curl handle - */ - if (curl_easy_setopt( - curlh, - CURLOPT_HTTPHEADER, - curlheaders) - != CURLE_OK) - { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "error while setting CURL option " - "(CURLOPT_HTTPHEADER). (placeholder flags)"); - } + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "curlheaders was never populated."); + /* finally, set http headers in curl handle */ + if(curl_easy_setopt(curlh, CURLOPT_HTTPHEADER, curlheaders) != CURLE_OK) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "error while setting CURL option (CURLOPT_HTTPHEADER)."); } /* end if should authenticate (info provided) */ /******************* @@ -1813,107 +1475,79 @@ H5FD_s3comms_s3r_read(s3r_t *handle, char curlerrbuf[CURL_ERROR_SIZE]; curlerrbuf[0] = '\0'; - if (CURLE_OK != - curl_easy_setopt(curlh, CURLOPT_ERRORBUFFER, curlerrbuf) ) - { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "problem setting error buffer") - } + if(CURLE_OK != curl_easy_setopt(curlh, CURLOPT_ERRORBUFFER, curlerrbuf)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem setting error buffer") p_status = curl_easy_perform(curlh); - if (p_status != CURLE_OK) { - if (CURLE_OK != - curl_easy_getinfo(curlh, CURLINFO_RESPONSE_CODE, &httpcode) ) - { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "problem getting response code") - } + if(p_status != CURLE_OK) { + if(CURLE_OK != curl_easy_getinfo(curlh, CURLINFO_RESPONSE_CODE, &httpcode)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem getting response code") HDfprintf(stderr, "CURL ERROR CODE: %d\nHTTP CODE: %d\n", p_status, httpcode); HDfprintf(stderr, "%s\n", curl_easy_strerror(p_status)); - HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, FAIL, - "problem while performing request.\n"); - } - if (CURLE_OK != - curl_easy_setopt(curlh, CURLOPT_ERRORBUFFER, NULL) ) - { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "problem unsetting error buffer") + HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, FAIL, "problem while performing request."); } + if(CURLE_OK != curl_easy_setopt(curlh, CURLOPT_ERRORBUFFER, NULL)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem unsetting error buffer") } /* verbose error reporting */ #else p_status = curl_easy_perform(curlh); - if (p_status != CURLE_OK) { - HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, FAIL, - "curl cannot perform request\n") - } + if(p_status != CURLE_OK) + HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, FAIL, "curl cannot perform request") #endif #if S3COMMS_DEBUG - if (dest != NULL) { + if(dest != NULL) { HDfprintf(stderr, "len: %d\n", (int)len); HDfprintf(stderr, "CHECKING FOR BUFFER OVERFLOW\n"); - if (sds == NULL) { + if(sds == NULL) HDfprintf(stderr, "sds is NULL!\n"); - } else { HDfprintf(stderr, "sds: 0x%lx\n", (long long)sds); HDfprintf(stderr, "sds->size: %d\n", (int)sds->size); - if (len > sds->size) { + if(len > sds->size) HDfprintf(stderr, "buffer overwrite\n"); - } } } - else { + else HDfprintf(stderr, "performed on entire file\n"); - } #endif done: /* clean any malloc'd resources */ - if (curlheaders != NULL) { + if(curlheaders != NULL) { curl_slist_free_all(curlheaders); curlheaders = NULL; } - if (rangebytesstr != NULL) { + if(rangebytesstr != NULL) { H5MM_xfree(rangebytesstr); rangebytesstr = NULL; } - if (sds != NULL) { + if(sds != NULL) { H5MM_xfree(sds); sds = NULL; } - if (request != NULL) { - while (headers != NULL) - if (FAIL == - H5FD_s3comms_hrb_node_set(&headers, headers->name, NULL)) - { - HDONE_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "cannot release header node") - } + if(request != NULL) { + while(headers != NULL) + if(FAIL == H5FD_s3comms_hrb_node_set(&headers, headers->name, NULL)) + HDONE_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cannot release header node") HDassert( NULL == headers ); - if (FAIL == H5FD_s3comms_hrb_destroy(&request)) { - HDONE_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "cannot release header request structure") - } + if(FAIL == H5FD_s3comms_hrb_destroy(&request)) + HDONE_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cannot release header request structure") HDassert( NULL == request ); } - if (curlh != NULL) { + if(curlh != NULL) { /* clear any Range */ - if (CURLE_OK != curl_easy_setopt(curlh, CURLOPT_RANGE, NULL) ) { - HDONE_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "cannot unset CURLOPT_RANGE") - } + if(CURLE_OK != curl_easy_setopt(curlh, CURLOPT_RANGE, NULL)) + HDONE_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cannot unset CURLOPT_RANGE") /* clear headers */ - if (CURLE_OK != curl_easy_setopt(curlh, CURLOPT_HTTPHEADER, NULL) ) { - HDONE_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "cannot unset CURLOPT_HTTPHEADER") - } + if(CURLE_OK != curl_easy_setopt(curlh, CURLOPT_HTTPHEADER, NULL)) + HDONE_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cannot unset CURLOPT_HTTPHEADER") } FUNC_LEAVE_NOAPI(ret_value); @@ -1951,9 +1585,8 @@ gmnow(void) struct tm *ret_value = NULL; /* Doctor assert, checks against error in time() */ - if ( (time_t)(-1) != time(now_ptr) ) { - ret_value = gmtime(now_ptr); - } + if((time_t)(-1) != HDtime(now_ptr)) + ret_value = HDgmtime(now_ptr); HDassert( ret_value != NULL ); @@ -2035,102 +1668,66 @@ H5FD_s3comms_aws_canonical_request( HDfprintf(stdout, "called H5FD_s3comms_aws_canonical_request.\n"); #endif - if (http_request == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "hrb object cannot be null.\n"); - } + if(http_request == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "hrb object cannot be null."); HDassert( http_request->magic == S3COMMS_HRB_MAGIC ); - if (canonical_request_dest == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "canonical request destination cannot be null.\n"); - } + if(canonical_request_dest == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "canonical request destination cannot be null."); - if (signed_headers_dest == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "signed headers destination cannot be null.\n"); - } + if(signed_headers_dest == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "signed headers destination cannot be null."); - /* HTTP verb, resource path, and query string lines - */ + /* HTTP verb, resource path, and query string lines */ cr_len = (HDstrlen(http_request->verb) + HDstrlen(http_request->resource) + HDstrlen(query_params) + (size_t)3); /* three newline chars */ - if (cr_len >= cr_size) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "not enough space in canonical request"); - } - ret = HDsnprintf( /* TODO: compiler warning */ - canonical_request_dest, - (cr_size-1), + if(cr_len >= cr_size) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not enough space in canonical request"); + /* TODO: compiler warning */ + ret = HDsnprintf(canonical_request_dest, (cr_size - 1), "%s\n%s\n%s\n", - http_request->verb, - http_request->resource, - query_params); - if (ret < 0 || (size_t)ret >= cr_size) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "unable to compose canonical request first line"); - } + http_request->verb, http_request->resource, query_params); + if(ret < 0 || (size_t)ret >= cr_size) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to compose canonical request first line"); - /* write in canonical headers, building signed headers concurrently - */ + /* write in canonical headers, building signed headers concurrently */ node = http_request->first_header; /* assumed sorted */ - while (node != NULL) { + while(node != NULL) { HDassert(node->magic == S3COMMS_HRB_NODE_MAGIC); - ret = HDsnprintf( - tmpstr, - 256, - "%s:%s\n", - node->lowername, - node->value); - if (ret < 0 || ret >= 256) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "unable to concatenate HTTP header %s:%s", - node->lowername, - node->value); - } + ret = HDsnprintf( tmpstr, 256, "%s:%s\n", node->lowername, node->value); + if(ret < 0 || ret >= 256) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to concatenate HTTP header %s:%s", node->lowername, node->value); cr_len += HDstrlen(tmpstr); - if (cr_len + 1 > cr_size) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "not enough space in canonical request"); - } - strcat(canonical_request_dest, tmpstr); - - ret = HDsnprintf( - tmpstr, - 256, - "%s;", - node->lowername); - if (ret < 0 || ret >= 256) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "unable to append semicolon to lowername %s", - node->lowername); - } + if(cr_len + 1 > cr_size) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not enough space in canonical request"); + HDstrcat(canonical_request_dest, tmpstr); + + ret = HDsnprintf( tmpstr, 256, "%s;", node->lowername); + if(ret < 0 || ret >= 256) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to append semicolon to lowername %s", node->lowername); sh_len += HDstrlen(tmpstr); - if (sh_len + 1 > sh_size) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "not enough space in signed headers"); - } - strcat(signed_headers_dest, tmpstr); + if(sh_len + 1 > sh_size) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not enough space in signed headers"); + HDstrcat(signed_headers_dest, tmpstr); node = node->next; } /* end while node is not NULL */ - /* remove tailing ';' from signed headers sequence - */ + /* remove trailing ';' from signed headers sequence */ signed_headers_dest[HDstrlen(signed_headers_dest) - 1] = '\0'; /* append signed headers and payload hash * NOTE: at present, no HTTP body is handled, per the nature of * requests/range-gets */ - strcat(canonical_request_dest, "\n"); - strcat(canonical_request_dest, signed_headers_dest); - strcat(canonical_request_dest, "\n"); - strcat(canonical_request_dest, EMPTY_SHA256); + HDstrcat(canonical_request_dest, "\n"); + HDstrcat(canonical_request_dest, signed_headers_dest); + HDstrcat(canonical_request_dest, "\n"); + HDstrcat(canonical_request_dest, EMPTY_SHA256); done: FUNC_LEAVE_NOAPI(ret_value); @@ -2184,30 +1781,20 @@ H5FD_s3comms_bytes_to_hex( HDfprintf(stdout, "called H5FD_s3comms_bytes_to_hex.\n"); #endif - if (dest == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "hex destination cannot be null.\n") - } - if (msg == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "bytes sequence cannot be null.\n") - } + if(dest == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "hex destination cannot be null.") + if(msg == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bytes sequence cannot be null.") for (i = 0; i < msg_len; i++) { - int chars_written = HDsnprintf(&(dest[i * 2]), - 3, /* 'X', 'X', '\n' */ - (lowercase == TRUE) ? "%02x" : "%02X", - msg[i]); - if (chars_written != 2) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "problem while writing hex chars for %c", - msg[i]); - } + int chars_written = HDsnprintf(&(dest[i * 2]), 3, /* 'X', 'X', '\n' */ + (lowercase == TRUE) ? "%02x" : "%02X", msg[i]); + if(chars_written != 2) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem while writing hex chars for %c", msg[i]); } done: FUNC_LEAVE_NOAPI(ret_value); - } /* end H5FD_s3comms_bytes_to_hex() */ @@ -2239,13 +1826,18 @@ H5FD_s3comms_free_purl(parsed_url_t *purl) HDprintf("called H5FD_s3comms_free_purl.\n"); #endif - if (purl != NULL) { + if(purl != NULL) { HDassert( purl->magic == S3COMMS_PARSED_URL_MAGIC ); - if (purl->scheme != NULL) { H5MM_xfree(purl->scheme); } - if (purl->host != NULL) { H5MM_xfree(purl->host); } - if (purl->port != NULL) { H5MM_xfree(purl->port); } - if (purl->path != NULL) { H5MM_xfree(purl->path); } - if (purl->query != NULL) { H5MM_xfree(purl->query); } + if(purl->scheme != NULL) + H5MM_xfree(purl->scheme); + if(purl->host != NULL) + H5MM_xfree(purl->host); + if(purl->port != NULL) + H5MM_xfree(purl->port); + if(purl->path != NULL) + H5MM_xfree(purl->path); + if(purl->query != NULL) + H5MM_xfree(purl->query); purl->magic += 1ul; H5MM_xfree(purl); } @@ -2302,29 +1894,14 @@ H5FD_s3comms_HMAC_SHA256( HDfprintf(stdout, "called H5FD_s3comms_HMAC_SHA256.\n"); #endif - if (dest == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "destination cannot be null."); - } + if(dest == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "destination cannot be null."); - HMAC(EVP_sha256(), - key, - (int)key_len, - (const unsigned char *)msg, - msg_len, - md, - &md_len); - - if (H5FD_s3comms_bytes_to_hex( - dest, - (const unsigned char *)md, - (size_t)md_len, - true) - == FAIL) - { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "could not convert to hex string."); - } + HMAC(EVP_sha256(), key, (int)key_len, (const unsigned char *)msg, + msg_len, md, &md_len); + + if(H5FD_s3comms_bytes_to_hex(dest, (const unsigned char *)md, (size_t)md_len, true) == FAIL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not convert to hex string."); done: FUNC_LEAVE_NOAPI(ret_value); @@ -2407,93 +1984,73 @@ H5FD__s3comms_load_aws_creds_from_file( int found_setting = 0; char *line_buffer = &(buffer[0]); - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC #if S3COMMS_DEBUG HDfprintf(stdout, "called load_aws_creds_from_file.\n"); #endif /* format target line for start of profile */ - if (32 < HDsnprintf(profile_line, 32, "[%s]", profile_name)) { - HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, - "unable to format profile label") - } + if(32 < HDsnprintf(profile_line, 32, "[%s]", profile_name)) + HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, "unable to format profile label") /* look for start of profile */ do { /* clear buffer */ - for (buffer_i=0; buffer_i < 128; buffer_i++) { + for(buffer_i=0; buffer_i < 128; buffer_i++) buffer[buffer_i] = 0; - } line_buffer = fgets(line_buffer, 128, file); - if (line_buffer == NULL) { /* reached end of file */ + if(line_buffer == NULL) /* reached end of file */ goto done; - } - } while (strncmp(line_buffer, profile_line, HDstrlen(profile_line))); + } while (HDstrncmp(line_buffer, profile_line, HDstrlen(profile_line))); /* extract credentials from lines */ do { /* clear buffer */ - for (buffer_i=0; buffer_i < 128; buffer_i++) { + for(buffer_i=0; buffer_i < 128; buffer_i++) buffer[buffer_i] = 0; - } /* collect a line from file */ line_buffer = fgets(line_buffer, 128, file); - if (line_buffer == NULL) { + if(line_buffer == NULL) goto done; /* end of file */ - } /* loop over names to see if line looks like assignment */ - for (setting_i = 0; setting_i < setting_count; setting_i++) { + for(setting_i = 0; setting_i < setting_count; setting_i++) { size_t setting_name_len = 0; const char *setting_name = NULL; char line_prefix[128]; setting_name = setting_names[setting_i]; setting_name_len = HDstrlen(setting_name); - if (HDsnprintf(line_prefix, 128, "%s=", setting_name) < 0) { - HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, - "unable to format line prefix") - } + if(HDsnprintf(line_prefix, 128, "%s=", setting_name) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, "unable to format line prefix") /* found a matching name? */ - if (!HDstrncmp(line_buffer, line_prefix, setting_name_len + 1)) { + if(!HDstrncmp(line_buffer, line_prefix, setting_name_len + 1)) { found_setting = 1; /* skip NULL destination buffer */ - if (setting_pointers[setting_i] == NULL) { + if(setting_pointers[setting_i] == NULL) break; - } /* advance to end of name in string */ do { line_buffer++; } while (*line_buffer != 0 && *line_buffer != '='); - if (*line_buffer == 0 || *(line_buffer+1) == 0) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "incomplete assignment in file") - } + if(*line_buffer == 0 || *(line_buffer+1) == 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "incomplete assignment in file") line_buffer++; /* was pointing at '='; advance */ /* copy line buffer into out pointer */ - if (HDstrncpy( - setting_pointers[setting_i], - (const char *)line_buffer, - HDstrlen(line_buffer)) - == NULL) - { - HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, - "unable to copy line into pointer") - } + HDstrncpy(setting_pointers[setting_i], (const char *)line_buffer, HDstrlen(line_buffer)); /* "trim" tailing whitespace by replacing with null terminator*/ buffer_i = 0; - while (!isspace(setting_pointers[setting_i][buffer_i])) { + while(!HDisspace(setting_pointers[setting_i][buffer_i])) buffer_i++; - } setting_pointers[setting_i][buffer_i] = '\0'; break; /* have read setting; don't compare with others */ @@ -2561,76 +2118,46 @@ H5FD_s3comms_load_aws_profile(const char *profile_name, #else ret = HDsnprintf(awspath, 117, "%s/.aws/", getenv("HOME")) ; #endif - if (ret < 0 || (size_t)ret >= 117) { - HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, - "unable to format home-aws path") - } + if(ret < 0 || (size_t)ret >= 117) + HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, "unable to format home-aws path") ret = HDsnprintf(filepath, 128, "%s%s", awspath, "credentials"); - if (ret < 0 || (size_t)ret >= 128) { - HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, - "unable to format credentials path") - } - - credfile = fopen(filepath, "r"); - if (credfile != NULL) { - if (H5FD__s3comms_load_aws_creds_from_file( - credfile, - profile_name, - key_id_out, - secret_access_key_out, - aws_region_out) - == FAIL) - { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "unable to load from aws credentials") - } - if (fclose(credfile) == EOF) { - HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, - "unable to close credentials file") - } + if(ret < 0 || (size_t)ret >= 128) + HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, "unable to format credentials path") + + credfile = HDfopen(filepath, "r"); + if(credfile != NULL) { + if(H5FD__s3comms_load_aws_creds_from_file(credfile, profile_name, key_id_out, + secret_access_key_out, aws_region_out) == FAIL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to load from aws credentials") + if(HDfclose(credfile) == EOF) + HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close credentials file") credfile = NULL; } /* end if credential file opened */ ret = HDsnprintf(filepath, 128, "%s%s", awspath, "config"); - if (ret < 0 || (size_t)ret >= 128) { - HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, - "unable to format config path") - } - credfile = fopen(filepath, "r"); - if (credfile != NULL) { - if (H5FD__s3comms_load_aws_creds_from_file( - credfile, - profile_name, + if(ret < 0 || (size_t)ret >= 128) + HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, "unable to format config path") + credfile = HDfopen(filepath, "r"); + if(credfile != NULL) { + if(H5FD__s3comms_load_aws_creds_from_file( credfile, profile_name, (*key_id_out == 0) ? key_id_out : NULL, (*secret_access_key_out == 0) ? secret_access_key_out : NULL, - (*aws_region_out == 0) ? aws_region_out : NULL) - == FAIL) - { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "unable to load from aws config") - } - if (fclose(credfile) == EOF) { - HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, - "unable to close config file") - } + (*aws_region_out == 0) ? aws_region_out : NULL) == FAIL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to load from aws config") + if(HDfclose(credfile) == EOF) + HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close config file") credfile = NULL; } /* end if credential file opened */ /* fail if not all three settings were loaded */ - if (*key_id_out == 0 || - *secret_access_key_out == 0 || - *aws_region_out == 0) - { + if(*key_id_out == 0 || *secret_access_key_out == 0 || *aws_region_out == 0) ret_value = FAIL; - } done: - if (credfile != NULL) { - if (fclose(credfile) == EOF) { - HDONE_ERROR(H5E_ARGS, H5E_ARGS, FAIL, - "problem error-closing aws configuration file") - } - } + if(credfile != NULL) + if(HDfclose(credfile) == EOF) + HDONE_ERROR(H5E_ARGS, H5E_ARGS, FAIL, "problem error-closing aws configuration file") + FUNC_LEAVE_NOAPI(ret_value); } /* end H5FD_s3comms_load_aws_profile() */ @@ -2675,16 +2202,14 @@ H5FD_s3comms_nlowercase( HDfprintf(stdout, "called H5FD_s3comms_nlowercase.\n"); #endif - if (dest == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "destination cannot be null.\n"); - } + if(dest == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "destination cannot be null."); - if (len > 0) { + if(len > 0) { HDmemcpy(dest, s, len); do { len--; - dest[len] = (char)tolower( (int)dest[len] ); + dest[len] = (char)HDtolower((int)dest[len]); } while (len > 0); } @@ -2743,18 +2268,14 @@ H5FD_s3comms_parse_url( HDprintf("called H5FD_s3comms_parse_url.\n"); #endif - if (str == NULL || *str == '\0') { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "invalid url string"); - } + if(str == NULL || *str == '\0') + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid url string"); urllen = (long int)HDstrlen(str); purl = (parsed_url_t *)H5MM_malloc(sizeof(parsed_url_t)); - if (purl == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, - "can't allocate space for parsed_url_t"); - } + if(purl == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, "can't allocate space for parsed_url_t"); purl->magic = S3COMMS_PARSED_URL_MAGIC; purl->scheme = NULL; purl->host = NULL; @@ -2767,38 +2288,27 @@ H5FD_s3comms_parse_url( ***************/ tmpstr = HDstrchr(curstr, ':'); - if (tmpstr == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "invalid SCHEME construction: probably not URL"); - } + if(tmpstr == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid SCHEME construction: probably not URL"); len = tmpstr - curstr; HDassert( (0 <= len) && (len < urllen) ); - /* check for restrictions - */ - for (i = 0; i < len; i++) { + /* check for restrictions */ + for(i = 0; i < len; i++) { /* scheme = [a-zA-Z+-.]+ (terminated by ":") */ - if (!isalpha(curstr[i]) && - '+' != curstr[i] && - '-' != curstr[i] && - '.' != curstr[i]) - { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "invalid SCHEME construction"); - } + if(!HDisalpha(curstr[i]) && '+' != curstr[i] && '-' != curstr[i] && + '.' != curstr[i]) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid SCHEME construction"); } - /* copy lowercased scheme to structure - */ + + /* copy lowercased scheme to structure */ purl->scheme = (char *)H5MM_malloc(sizeof(char) * (size_t)(len + 1)); - if (purl->scheme == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, - "can't allocate space for SCHEME"); - } - (void)HDstrncpy(purl->scheme, curstr, (size_t)len); + if(purl->scheme == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, "can't allocate space for SCHEME"); + HDstrncpy(purl->scheme, curstr, (size_t)len); purl->scheme[len] = '\0'; - for ( i = 0; i < len; i++ ) { - purl->scheme[i] = (char)tolower(purl->scheme[i]); - } + for(i = 0; i < len; i++ ) + purl->scheme[i] = (char)HDtolower(purl->scheme[i]); /* Skip "://" */ tmpstr += 3; @@ -2808,84 +2318,59 @@ H5FD_s3comms_parse_url( * READ HOST * *************/ - if (*curstr == '[') { + if(*curstr == '[') { /* IPv6 */ - while (']' != *tmpstr) { - if (tmpstr == 0) { /* end of string reached! */ - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "reached end of URL: incomplete IPv6 HOST"); - } + while(']' != *tmpstr) { + /* end of string reached! */ + if(tmpstr == 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "reached end of URL: incomplete IPv6 HOST"); tmpstr++; } tmpstr++; } /* end if (IPv6) */ else { - while (0 != *tmpstr) { - if (':' == *tmpstr || - '/' == *tmpstr || - '?' == *tmpstr) - { + while(0 != *tmpstr) { + if(':' == *tmpstr || '/' == *tmpstr || '?' == *tmpstr) break; - } tmpstr++; } } /* end else (IPv4) */ len = tmpstr - curstr; - if (len == 0) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "HOST substring cannot be empty"); - } - else - if (len > urllen) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "problem with length of HOST substring"); - } + if(len == 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "HOST substring cannot be empty") + else if(len > urllen) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem with length of HOST substring"); - /* copy host - */ + /* copy host */ purl->host = (char *)H5MM_malloc(sizeof(char) * (size_t)(len + 1)); - if (purl->host == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, - "can't allocate space for HOST"); - } - (void)HDstrncpy(purl->host, curstr, (size_t)len); + if(purl->host == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, "can't allocate space for HOST"); + HDstrncpy(purl->host, curstr, (size_t)len); purl->host[len] = 0; /************* * READ PORT * *************/ - if (':' == *tmpstr) { + if(':' == *tmpstr) { tmpstr += 1; /* advance past ':' */ curstr = tmpstr; - while ((0 != *tmpstr) && ('/' != *tmpstr) && ('?' != *tmpstr)) { + while((0 != *tmpstr) && ('/' != *tmpstr) && ('?' != *tmpstr)) tmpstr++; - } len = tmpstr - curstr; - if (len == 0) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "PORT element cannot be empty"); - } - else - if (len > urllen) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "problem with length of PORT substring"); - } - for (i = 0; i < len; i ++) { - if (!isdigit(curstr[i])) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "PORT is not a decimal string"); - } - } - - /* copy port - */ + if(len == 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "PORT element cannot be empty") + else if(len > urllen) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem with length of PORT substring"); + for(i = 0; i < len; i ++) + if(!HDisdigit(curstr[i])) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "PORT is not a decimal string"); + + /* copy port */ purl->port = (char *)H5MM_malloc(sizeof(char) * (size_t)(len + 1)); - if (purl->port == NULL) { /* cannot malloc */ - HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, - "can't allocate space for PORT"); - } - (void)HDstrncpy(purl->port, curstr, (size_t)len); + if(purl->port == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, "can't allocate space for PORT"); + HDstrncpy(purl->port, curstr, (size_t)len); purl->port[len] = 0; } /* end if PORT element */ @@ -2893,28 +2378,22 @@ H5FD_s3comms_parse_url( * READ PATH * *************/ - if ('/' == *tmpstr) { + if('/' == *tmpstr) { /* advance past '/' */ tmpstr += 1; curstr = tmpstr; - /* seek end of PATH - */ - while ((0 != *tmpstr) && ('?' != *tmpstr)) { + /* seek end of PATH */ + while((0 != *tmpstr) && ('?' != *tmpstr)) tmpstr++; - } len = tmpstr - curstr; - if (len > urllen) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "problem with length of PATH substring"); - } - if (len > 0) { + if(len > urllen) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem with length of PATH substring"); + if(len > 0) { purl->path = (char *)H5MM_malloc(sizeof(char) * (size_t)(len + 1)); - if (purl->path == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, - "can't allocate space for PATH"); - } /* cannot malloc path pointer */ - (void)HDstrncpy(purl->path, curstr, (size_t)len); + if(purl->path == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, "can't allocate space for PATH"); + HDstrncpy(purl->path, curstr, (size_t)len); purl->path[len] = 0; } } /* end if PATH element */ @@ -2923,26 +2402,20 @@ H5FD_s3comms_parse_url( * READ QUERY * **************/ - if ('?' == *tmpstr) { + if('?' == *tmpstr) { tmpstr += 1; curstr = tmpstr; - while (0 != *tmpstr) { + while(0 != *tmpstr) tmpstr++; - } len = tmpstr - curstr; - if (len == 0) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "QUERY cannot be empty"); - } else if (len > urllen) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "problem with length of QUERY substring"); - } + if(len == 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "QUERY cannot be empty") + else if(len > urllen) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem with length of QUERY substring"); purl->query = (char *)H5MM_malloc(sizeof(char) * (size_t)(len + 1)); - if (purl->query == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, - "can't allocate space for QUERY"); - } /* cannot malloc path pointer */ - (void)HDstrncpy(purl->query, curstr, (size_t)len); + if(purl->query == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, "can't allocate space for QUERY"); + HDstrncpy(purl->query, curstr, (size_t)len); purl->query[len] = 0; } /* end if QUERY exists */ @@ -2950,9 +2423,9 @@ H5FD_s3comms_parse_url( ret_value = SUCCEED; done: - if (ret_value == FAIL) { + if(ret_value == FAIL) H5FD_s3comms_free_purl(purl); - } + FUNC_LEAVE_NOAPI(ret_value); } /* end H5FD_s3comms_parse_url() */ @@ -3016,9 +2489,8 @@ H5FD_s3comms_percent_encode_char( HDfprintf(stdout, "called H5FD_s3comms_percent_encode_char.\n"); #endif - if (repr == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no destination `repr`.\n") - } + if(repr == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no destination `repr`.") #if S3COMMS_DEBUG H5FD_s3comms_bytes_to_hex((char *)hex, s, 1, FALSE); @@ -3026,7 +2498,7 @@ H5FD_s3comms_percent_encode_char( HDfprintf(stdout, " CHAR-HEX: \"%s\"\n", hex); #endif - if (c <= (unsigned char)0x7f) { + if(c <= (unsigned char)0x7f) { /* character represented in a single "byte" * and single percent-code */ @@ -3035,11 +2507,8 @@ H5FD_s3comms_percent_encode_char( #endif *repr_len = 3; chars_written = HDsnprintf(repr, 4, "%%%02X", c); - if (chars_written < 0) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "cannot write char %c", - c); - } + if(chars_written < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cannot write char %c", c); } /* end if single-byte unicode char */ else { /* multi-byte, multi-percent representation @@ -3092,16 +2561,9 @@ H5FD_s3comms_percent_encode_char( acc += (stack_size > 2) ? 0x20 : 0; /* 0x00100000 */ acc += (stack_size > 3) ? 0x10 : 0; /* 0x00010000 */ stack_size--; - chars_written = HDsnprintf( - repr, - 4, - "%%%02X", - (unsigned char)(acc + stack[stack_size])); - if (chars_written < 0) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "cannot write char %c", - c); - } + chars_written = HDsnprintf( repr, 4, "%%%02X", (unsigned char)(acc + stack[stack_size])); + if(chars_written < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cannot write char %c", c); *repr_len += 3; /************************ @@ -3109,17 +2571,11 @@ H5FD_s3comms_percent_encode_char( ************************/ /* 10xxxxxx */ - for (i = 0; i < stack_size; i++) { - chars_written = HDsnprintf( - &repr[i*3 + 3], - 4, - "%%%02X", - (unsigned char)(0x80 + stack[stack_size - 1 - i])); - if (chars_written < 0) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "cannot write char %c", - c); - } + for(i = 0; i < stack_size; i++) { + chars_written = HDsnprintf( &repr[i*3 + 3], 4, + "%%%02X", (unsigned char)(0x80 + stack[stack_size - 1 - i])); + if(chars_written < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cannot write char %c", c); *repr_len += 3; } /* end for each continuation byte */ } /* end else (multi-byte) */ @@ -3190,38 +2646,24 @@ H5FD_s3comms_signing_key( HDfprintf(stdout, "called H5FD_s3comms_signing_key.\n"); #endif - if (md == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "Destination `md` cannot be NULL.\n") - } - if (secret == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "`secret` cannot be NULL.\n") - } - if (region == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "`region` cannot be NULL.\n") - } - if (iso8601now == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "`iso8601now` cannot be NULL.\n") - } + if(md == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Destination `md` cannot be NULL.") + if(secret == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "`secret` cannot be NULL.") + if(region == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "`region` cannot be NULL.") + if(iso8601now == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "`iso8601now` cannot be NULL.") AWS4_secret_len = 4 + HDstrlen(secret) + 1; AWS4_secret = (char*)H5MM_malloc(sizeof(char *) * AWS4_secret_len); - if (AWS4_secret == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "Could not allocate space.\n") - } + if(AWS4_secret == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Could not allocate space.") - /* prepend "AWS4" to start of the secret key - */ + /* prepend "AWS4" to start of the secret key */ ret = HDsnprintf(AWS4_secret, AWS4_secret_len,"%s%s", "AWS4", secret); - if ((size_t)ret != (AWS4_secret_len - 1)) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "problem writing AWS4+secret `%s`", - secret); - } + if((size_t)ret != (AWS4_secret_len - 1)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem writing AWS4+secret `%s`", secret); /* hash_func, key, len(key), msg, len(msg), digest_dest, digest_len_dest * we know digest length, so ignore via NULL @@ -3320,37 +2762,26 @@ H5FD_s3comms_tostringtosign( HDfprintf(stdout, "called H5FD_s3comms_tostringtosign.\n"); #endif - if (dest == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "destination buffer cannot be null.\n") - } - if (req == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "canonical request cannot be null.\n") - } - if (now == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "Timestring cannot be NULL.\n") - } - if (region == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "Region cannot be NULL.\n") - } + if(dest == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "destination buffer cannot be null.") + if(req == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "canonical request cannot be null.") + if(now == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Timestring cannot be NULL.") + if(region == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Region cannot be NULL.") - for (i = 0; i < 128; i++) { + for(i = 0; i < 128; i++) tmp[i] = '\0'; - } - for (i = 0; i < SHA256_DIGEST_LENGTH * 2 + 1; i++) { + for(i = 0; i < SHA256_DIGEST_LENGTH * 2 + 1; i++) { checksum[i] = '\0'; hexsum[i] = '\0'; } HDstrncpy(day, now, 8); day[8] = '\0'; ret = HDsnprintf(tmp, 127, "%s/%s/s3/aws4_request", day, region); - if (ret <= 0 || ret >= 127) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "problem adding day and region to string") - } + if(ret <= 0 || ret >= 127) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem adding day and region to string") HDmemcpy((dest + d), "AWS4-HMAC-SHA256\n", 17); d = 17; @@ -3363,24 +2794,14 @@ H5FD_s3comms_tostringtosign( d += HDstrlen(tmp); dest[d++] = '\n'; - SHA256((const unsigned char *)req, - HDstrlen(req), - checksum); + SHA256((const unsigned char *)req, HDstrlen(req), checksum); - if (H5FD_s3comms_bytes_to_hex( - hexsum, - (const unsigned char *)checksum, - SHA256_DIGEST_LENGTH, - true) - == FAIL) - { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "could not create hex string"); - } + if(H5FD_s3comms_bytes_to_hex(hexsum, (const unsigned char *)checksum, + SHA256_DIGEST_LENGTH, true) == FAIL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not create hex string"); - for (i = 0; i < SHA256_DIGEST_LENGTH * 2; i++) { + for(i = 0; i < SHA256_DIGEST_LENGTH * 2; i++) dest[d++] = hexsum[i]; - } dest[d] = '\0'; @@ -3432,21 +2853,16 @@ H5FD_s3comms_trim(char *dest, HDfprintf(stdout, "called H5FD_s3comms_trim.\n"); #endif - if (dest == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "destination cannot be null.") - } - if (s == NULL) { + if(dest == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "destination cannot be null.") + if(s == NULL) s_len = 0; - } - if (s_len > 0) { + if(s_len > 0) { /* Find first non-whitespace character from start; * reduce total length per character. */ - while ((s_len > 0) && - isspace((unsigned char)s[0]) && s_len > 0) - { + while((s_len > 0) && HDisspace((unsigned char)s[0]) && s_len > 0) { s++; s_len--; } @@ -3455,14 +2871,13 @@ H5FD_s3comms_trim(char *dest, * reduce length per-character. * If length is 0 already, there is no non-whitespace character. */ - if (s_len > 0) { + if(s_len > 0) { do { s_len--; - } while( isspace((unsigned char)s[s_len]) ); + } while(HDisspace((unsigned char)s[s_len])); s_len++; - /* write output into dest - */ + /* write output into dest */ HDmemcpy(dest, s, s_len); } } @@ -3534,54 +2949,36 @@ H5FD_s3comms_uriencode( HDfprintf(stdout, "H5FD_s3comms_uriencode called.\n"); #endif - if (s == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "source string cannot be NULL"); - } - if (dest == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "destination cannot be NULL"); - } + if(s == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "source string cannot be NULL"); + if(dest == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "destination cannot be NULL"); /* Write characters to destination, converting to percent-encoded * "hex-utf-8" strings if necessary. * e.g., '$' -> "%24" */ - for (s_off = 0; s_off < s_len; s_off++) { + for(s_off = 0; s_off < s_len; s_off++) { c = s[s_off]; - if (isalnum(c) || - c == '.' || - c == '-' || - c == '_' || - c == '~' || - (c == '/' && encode_slash == FALSE)) - { + if(HDisalnum(c) || c == '.' || c == '-' || c == '_' || + c == '~' || (c == '/' && encode_slash == FALSE)) dest[dest_off++] = c; - } else { hex_off = 0; - if (H5FD_s3comms_percent_encode_char( - hex_buffer, - (const unsigned char)c, - &hex_len) - == FAIL) - { + if(H5FD_s3comms_percent_encode_char(hex_buffer, (const unsigned char)c, + &hex_len) == FAIL) { hex_buffer[0] = c; hex_buffer[1] = 0; - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "unable to percent-encode character \'%s\' " - "at %d in \"%s\"", hex_buffer, (int)s_off, s); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to percent-encode character \'%s\' " "at %d in \"%s\"", hex_buffer, (int)s_off, s); } - for (hex_off = 0; hex_off < hex_len; hex_off++) { + for(hex_off = 0; hex_off < hex_len; hex_off++) dest[dest_off++] = hex_buffer[hex_off]; - } } /* end else (not a regular character) */ } /* end for each character */ - if (dest_off < s_len) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "buffer overflow"); + if(dest_off < s_len) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "buffer overflow"); *n_written = dest_off; diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c index cdc3d83..8f519d9 100644 --- a/src/H5FDsec2.c +++ b/src/H5FDsec2.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, July 29, 1999 * * Purpose: The POSIX unbuffered file driver using only the HDF5 public @@ -39,6 +39,9 @@ /* The driver identification number, initialized at runtime */ static hid_t H5FD_SEC2_g = 0; +/* Whether to ignore file locks when disabled (env var value) */ +static htri_t ignore_disabled_file_locks_s = FAIL; + /* The description of a file belonging to this driver. The 'eoa' and 'eof' * determine the amount of hdf5 address space in use and the high-water mark * of the file (the current size of the underlying filesystem file). The @@ -57,6 +60,7 @@ typedef struct H5FD_sec2_t { haddr_t eof; /* end of file; current file size */ haddr_t pos; /* current file I/O position */ H5FD_file_op_t op; /* last operation */ + hbool_t ignore_disabled_file_locks; char filename[H5FD_MAX_FILENAME_LEN]; /* Copy of file name from open operation */ #ifndef H5_HAVE_WIN32_API /* On most systems the combination of device and i-node number uniquely @@ -95,7 +99,6 @@ typedef struct H5FD_sec2_t { * a single file. */ hbool_t fam_to_single; - } H5FD_sec2_t; /* @@ -113,37 +116,37 @@ typedef struct H5FD_sec2_t { * which can be addressed entirely by the second * argument of the file seek function. */ -#define MAXADDR (((haddr_t)1<<(8*sizeof(HDoff_t)-1))-1) -#define ADDR_OVERFLOW(A) (HADDR_UNDEF==(A) || ((A) & ~(haddr_t)MAXADDR)) +#define MAXADDR (((haddr_t)1 << (8 * sizeof(HDoff_t) - 1)) - 1) +#define ADDR_OVERFLOW(A) (HADDR_UNDEF == (A) || ((A) & ~(haddr_t)MAXADDR)) #define SIZE_OVERFLOW(Z) ((Z) & ~(hsize_t)MAXADDR) #define REGION_OVERFLOW(A,Z) (ADDR_OVERFLOW(A) || SIZE_OVERFLOW(Z) || \ - HADDR_UNDEF==(A)+(Z) || \ - (HDoff_t)((A)+(Z))<(HDoff_t)(A)) + HADDR_UNDEF == (A) + (Z) || \ + (HDoff_t)((A) + (Z)) < (HDoff_t)(A)) /* Prototypes */ -static herr_t H5FD_sec2_term(void); -static H5FD_t *H5FD_sec2_open(const char *name, unsigned flags, hid_t fapl_id, +static herr_t H5FD__sec2_term(void); +static H5FD_t *H5FD__sec2_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr); -static herr_t H5FD_sec2_close(H5FD_t *_file); -static int H5FD_sec2_cmp(const H5FD_t *_f1, const H5FD_t *_f2); -static herr_t H5FD_sec2_query(const H5FD_t *_f1, unsigned long *flags); -static haddr_t H5FD_sec2_get_eoa(const H5FD_t *_file, H5FD_mem_t type); -static herr_t H5FD_sec2_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr); -static haddr_t H5FD_sec2_get_eof(const H5FD_t *_file, H5FD_mem_t type); -static herr_t H5FD_sec2_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle); -static herr_t H5FD_sec2_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, +static herr_t H5FD__sec2_close(H5FD_t *_file); +static int H5FD__sec2_cmp(const H5FD_t *_f1, const H5FD_t *_f2); +static herr_t H5FD__sec2_query(const H5FD_t *_f1, unsigned long *flags); +static haddr_t H5FD__sec2_get_eoa(const H5FD_t *_file, H5FD_mem_t type); +static herr_t H5FD__sec2_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr); +static haddr_t H5FD__sec2_get_eof(const H5FD_t *_file, H5FD_mem_t type); +static herr_t H5FD__sec2_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle); +static herr_t H5FD__sec2_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, void *buf); -static herr_t H5FD_sec2_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, +static herr_t H5FD__sec2_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, const void *buf); -static herr_t H5FD_sec2_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); -static herr_t H5FD_sec2_lock(H5FD_t *_file, hbool_t rw); -static herr_t H5FD_sec2_unlock(H5FD_t *_file); +static herr_t H5FD__sec2_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); +static herr_t H5FD__sec2_lock(H5FD_t *_file, hbool_t rw); +static herr_t H5FD__sec2_unlock(H5FD_t *_file); static const H5FD_class_t H5FD_sec2_g = { "sec2", /* name */ MAXADDR, /* maxaddr */ H5F_CLOSE_WEAK, /* fc_degree */ - H5FD_sec2_term, /* terminate */ + H5FD__sec2_term, /* terminate */ NULL, /* sb_size */ NULL, /* sb_encode */ NULL, /* sb_decode */ @@ -154,25 +157,25 @@ static const H5FD_class_t H5FD_sec2_g = { 0, /* dxpl_size */ NULL, /* dxpl_copy */ NULL, /* dxpl_free */ - H5FD_sec2_open, /* open */ - H5FD_sec2_close, /* close */ - H5FD_sec2_cmp, /* cmp */ - H5FD_sec2_query, /* query */ + H5FD__sec2_open, /* open */ + H5FD__sec2_close, /* close */ + H5FD__sec2_cmp, /* cmp */ + H5FD__sec2_query, /* query */ NULL, /* get_type_map */ NULL, /* alloc */ NULL, /* free */ - H5FD_sec2_get_eoa, /* get_eoa */ - H5FD_sec2_set_eoa, /* set_eoa */ - H5FD_sec2_get_eof, /* get_eof */ - H5FD_sec2_get_handle, /* get_handle */ - H5FD_sec2_read, /* read */ - H5FD_sec2_write, /* write */ + H5FD__sec2_get_eoa, /* get_eoa */ + H5FD__sec2_set_eoa, /* set_eoa */ + H5FD__sec2_get_eof, /* get_eof */ + H5FD__sec2_get_handle, /* get_handle */ + H5FD__sec2_read, /* read */ + H5FD__sec2_write, /* write */ NULL, /* read_vector */ NULL, /* write_vector */ NULL, /* flush */ - H5FD_sec2_truncate, /* truncate */ - H5FD_sec2_lock, /* lock */ - H5FD_sec2_unlock, /* unlock */ + H5FD__sec2_truncate, /* truncate */ + H5FD__sec2_lock, /* lock */ + H5FD__sec2_unlock, /* unlock */ H5FD_FLMAP_DICHOTOMY /* fl_map */ }; @@ -192,10 +195,20 @@ H5FL_DEFINE_STATIC(H5FD_sec2_t); static herr_t H5FD__init_package(void) { + char *lock_env_var = NULL; /* Environment variable pointer */ herr_t ret_value = SUCCEED; FUNC_ENTER_STATIC + /* Check the use disabled file locks environment variable */ + lock_env_var = HDgetenv("HDF5_USE_FILE_LOCKING"); + if(lock_env_var && !HDstrcmp(lock_env_var, "BEST_EFFORT")) + ignore_disabled_file_locks_s = TRUE; /* Override: Ignore disabled locks */ + else if(lock_env_var && (!HDstrcmp(lock_env_var, "TRUE") || !HDstrcmp(lock_env_var, "1"))) + ignore_disabled_file_locks_s = FALSE; /* Override: Don't ignore disabled locks */ + else + ignore_disabled_file_locks_s = FAIL; /* Environment variable not set, or not set correctly */ + if(H5FD_sec2_init() < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to initialize sec2 VFD") @@ -221,7 +234,7 @@ done: hid_t H5FD_sec2_init(void) { - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_NOAPI(H5I_INVALID_HID) @@ -237,7 +250,7 @@ done: /*--------------------------------------------------------------------------- - * Function: H5FD_sec2_term + * Function: H5FD__sec2_term * * Purpose: Shut down the VFD * @@ -249,15 +262,15 @@ done: *--------------------------------------------------------------------------- */ static herr_t -H5FD_sec2_term(void) +H5FD__sec2_term(void) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Reset VFL ID */ H5FD_SEC2_g = 0; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5FD_sec2_term() */ +} /* end H5FD__sec2_term() */ /*------------------------------------------------------------------------- @@ -294,7 +307,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_sec2_open + * Function: H5FD__sec2_open * * Purpose: Create and/or opens a file as an HDF5 file. * @@ -309,7 +322,7 @@ done: *------------------------------------------------------------------------- */ static H5FD_t * -H5FD_sec2_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) +H5FD__sec2_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) { H5FD_sec2_t *file = NULL; /* sec2 VFD info */ int fd = -1; /* File descriptor */ @@ -318,9 +331,10 @@ H5FD_sec2_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) struct _BY_HANDLE_FILE_INFORMATION fileinfo; #endif h5_stat_t sb; + H5P_genplist_t *plist; /* Property list pointer */ H5FD_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity check on file offsets */ HDcompile_assert(sizeof(HDoff_t) >= sizeof(size_t)); @@ -375,17 +389,26 @@ H5FD_sec2_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) file->inode = sb.st_ino; #endif /* H5_HAVE_WIN32_API */ + /* Get the FAPL */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) + HGOTO_ERROR(H5E_VFL, H5E_BADTYPE, NULL, "not a file access property list") + + /* Check the file locking flags in the fapl */ + if(ignore_disabled_file_locks_s != FAIL) + /* The environment variable was set, so use that preferentially */ + file->ignore_disabled_file_locks = ignore_disabled_file_locks_s; + else { + /* Use the value in the property list */ + if(H5P_get(plist, H5F_ACS_IGNORE_DISABLED_FILE_LOCKS_NAME, &file->ignore_disabled_file_locks) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get ignore disabled file locks property") + } + /* Retain a copy of the name used to open the file, for possible error reporting */ HDstrncpy(file->filename, name, sizeof(file->filename)); file->filename[sizeof(file->filename) - 1] = '\0'; /* Check for non-default FAPL */ if(H5P_FILE_ACCESS_DEFAULT != fapl_id) { - H5P_genplist_t *plist; /* Property list pointer */ - - /* Get the FAPL */ - if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) - HGOTO_ERROR(H5E_VFL, H5E_BADTYPE, NULL, "not a file access property list") /* This step is for h5repart tool only. If user wants to change file driver from * family to one that uses single files (sec2, etc.) while using h5repart, this @@ -409,11 +432,11 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_sec2_open() */ +} /* end H5FD__sec2_open() */ /*------------------------------------------------------------------------- - * Function: H5FD_sec2_close + * Function: H5FD__sec2_close * * Purpose: Closes an HDF5 file. * @@ -426,12 +449,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_sec2_close(H5FD_t *_file) +H5FD__sec2_close(H5FD_t *_file) { H5FD_sec2_t *file = (H5FD_sec2_t *)_file; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity check */ HDassert(file); @@ -445,11 +468,11 @@ H5FD_sec2_close(H5FD_t *_file) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_sec2_close() */ +} /* end H5FD__sec2_close() */ /*------------------------------------------------------------------------- - * Function: H5FD_sec2_cmp + * Function: H5FD__sec2_cmp * * Purpose: Compares two files belonging to this driver using an * arbitrary (but consistent) ordering. @@ -464,13 +487,13 @@ done: *------------------------------------------------------------------------- */ static int -H5FD_sec2_cmp(const H5FD_t *_f1, const H5FD_t *_f2) +H5FD__sec2_cmp(const H5FD_t *_f1, const H5FD_t *_f2) { const H5FD_sec2_t *f1 = (const H5FD_sec2_t *)_f1; const H5FD_sec2_t *f2 = (const H5FD_sec2_t *)_f2; int ret_value = 0; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR #ifdef H5_HAVE_WIN32_API if(f1->dwVolumeSerialNumber < f2->dwVolumeSerialNumber) HGOTO_DONE(-1) @@ -499,11 +522,11 @@ H5FD_sec2_cmp(const H5FD_t *_f1, const H5FD_t *_f2) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_sec2_cmp() */ +} /* end H5FD__sec2_cmp() */ /*------------------------------------------------------------------------- - * Function: H5FD_sec2_query + * Function: H5FD__sec2_query * * Purpose: Set the flags that this VFL driver is capable of supporting. * (listed in H5FDpublic.h) @@ -516,11 +539,11 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_sec2_query(const H5FD_t *_file, unsigned long *flags /* out */) +H5FD__sec2_query(const H5FD_t *_file, unsigned long *flags /* out */) { const H5FD_sec2_t *file = (const H5FD_sec2_t *)_file; /* sec2 VFD info */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Set the VFL feature flags that this driver supports */ /* Notice: the Mirror VFD Writer currently uses only the Sec2 driver as @@ -545,11 +568,11 @@ H5FD_sec2_query(const H5FD_t *_file, unsigned long *flags /* out */) } /* end if */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5FD_sec2_query() */ +} /* end H5FD__sec2_query() */ /*------------------------------------------------------------------------- - * Function: H5FD_sec2_get_eoa + * Function: H5FD__sec2_get_eoa * * Purpose: Gets the end-of-address marker for the file. The EOA marker * is the first address past the last byte allocated in the @@ -563,18 +586,18 @@ H5FD_sec2_query(const H5FD_t *_file, unsigned long *flags /* out */) *------------------------------------------------------------------------- */ static haddr_t -H5FD_sec2_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) +H5FD__sec2_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) { const H5FD_sec2_t *file = (const H5FD_sec2_t *)_file; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR FUNC_LEAVE_NOAPI(file->eoa) -} /* end H5FD_sec2_get_eoa() */ +} /* end H5FD__sec2_get_eoa() */ /*------------------------------------------------------------------------- - * Function: H5FD_sec2_set_eoa + * Function: H5FD__sec2_set_eoa * * Purpose: Set the end-of-address marker for the file. This function is * called shortly after an existing HDF5 file is opened in order @@ -588,20 +611,20 @@ H5FD_sec2_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) *------------------------------------------------------------------------- */ static herr_t -H5FD_sec2_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr) +H5FD__sec2_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr) { H5FD_sec2_t *file = (H5FD_sec2_t *)_file; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR file->eoa = addr; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5FD_sec2_set_eoa() */ +} /* end H5FD__sec2_set_eoa() */ /*------------------------------------------------------------------------- - * Function: H5FD_sec2_get_eof + * Function: H5FD__sec2_get_eof * * Purpose: Returns the end-of-file marker, which is the greater of * either the filesystem end-of-file or the HDF5 end-of-address @@ -616,18 +639,18 @@ H5FD_sec2_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr) *------------------------------------------------------------------------- */ static haddr_t -H5FD_sec2_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) +H5FD__sec2_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) { const H5FD_sec2_t *file = (const H5FD_sec2_t *)_file; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR FUNC_LEAVE_NOAPI(file->eof) -} /* end H5FD_sec2_get_eof() */ +} /* end H5FD__sec2_get_eof() */ /*------------------------------------------------------------------------- - * Function: H5FD_sec2_get_handle + * Function: H5FD__sec2_get_handle * * Purpose: Returns the file handle of sec2 file driver. * @@ -639,12 +662,12 @@ H5FD_sec2_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) *------------------------------------------------------------------------- */ static herr_t -H5FD_sec2_get_handle(H5FD_t *_file, hid_t H5_ATTR_UNUSED fapl, void **file_handle) +H5FD__sec2_get_handle(H5FD_t *_file, hid_t H5_ATTR_UNUSED fapl, void **file_handle) { H5FD_sec2_t *file = (H5FD_sec2_t *)_file; herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(!file_handle) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file handle not valid") @@ -653,11 +676,11 @@ H5FD_sec2_get_handle(H5FD_t *_file, hid_t H5_ATTR_UNUSED fapl, void **file_handl done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_sec2_get_handle() */ +} /* end H5FD__sec2_get_handle() */ /*------------------------------------------------------------------------- - * Function: H5FD_sec2_read + * Function: H5FD__sec2_read * * Purpose: Reads SIZE bytes of data from FILE beginning at address ADDR * into buffer BUF according to data transfer properties in @@ -673,14 +696,14 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_sec2_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUSED dxpl_id, +H5FD__sec2_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t addr, size_t size, void *buf /*out*/) { H5FD_sec2_t *file = (H5FD_sec2_t *)_file; HDoff_t offset = (HDoff_t)addr; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(file && file->pub.cls); HDassert(buf); @@ -693,17 +716,15 @@ H5FD_sec2_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUS #ifndef H5_HAVE_PREADWRITE /* Seek to the correct location (if we don't have pread) */ - if(addr != file->pos || OP_READ != file->op) { + if(addr != file->pos || OP_READ != file->op) if(HDlseek(file->fd, (HDoff_t)addr, SEEK_SET) < 0) HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position") - } #endif /* H5_HAVE_PREADWRITE */ /* Read data, being careful of interrupted system calls, partial results, * and the end of the file. */ while(size > 0) { - h5_posix_io_t bytes_in = 0; /* # of bytes to read */ h5_posix_io_ret_t bytes_read = -1; /* # of bytes actually read */ @@ -760,11 +781,11 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_sec2_read() */ +} /* end H5FD__sec2_read() */ /*------------------------------------------------------------------------- - * Function: H5FD_sec2_write + * Function: H5FD__sec2_write * * Purpose: Writes SIZE bytes of data to FILE beginning at address ADDR * from buffer BUF according to data transfer properties in @@ -778,14 +799,14 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_sec2_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUSED dxpl_id, +H5FD__sec2_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t addr, size_t size, const void *buf) { H5FD_sec2_t *file = (H5FD_sec2_t *)_file; HDoff_t offset = (HDoff_t)addr; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(file && file->pub.cls); HDassert(buf); @@ -798,17 +819,15 @@ H5FD_sec2_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU #ifndef H5_HAVE_PREADWRITE /* Seek to the correct location (if we don't have pwrite) */ - if(addr != file->pos || OP_WRITE != file->op) { + if(addr != file->pos || OP_WRITE != file->op) if(HDlseek(file->fd, (HDoff_t)addr, SEEK_SET) < 0) HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position") - } #endif /* H5_HAVE_PREADWRITE */ /* Write the data, being careful of interrupted system calls and partial * results */ while(size > 0) { - h5_posix_io_t bytes_in = 0; /* # of bytes to write */ h5_posix_io_ret_t bytes_wrote = -1; /* # of bytes written */ @@ -861,11 +880,11 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_sec2_write() */ +} /* end H5FD__sec2_write() */ /*------------------------------------------------------------------------- - * Function: H5FD_sec2_truncate + * Function: H5FD__sec2_truncate * * Purpose: Makes sure that the true file size is the same (or larger) * than the end-of-address. @@ -878,12 +897,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_sec2_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_UNUSED closing) +H5FD__sec2_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_UNUSED closing) { H5FD_sec2_t *file = (H5FD_sec2_t *)_file; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(file); @@ -930,11 +949,11 @@ H5FD_sec2_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_sec2_truncate() */ +} /* end H5FD__sec2_truncate() */ /*------------------------------------------------------------------------- - * Function: H5FD_sec2_lock + * Function: H5FD__sec2_lock * * Purpose: To place an advisory lock on a file. * The lock type to apply depends on the parameter "rw": @@ -948,13 +967,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_sec2_lock(H5FD_t *_file, hbool_t rw) +H5FD__sec2_lock(H5FD_t *_file, hbool_t rw) { H5FD_sec2_t *file = (H5FD_sec2_t *)_file; /* VFD file struct */ int lock_flags; /* file locking flags */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(file); @@ -963,19 +982,23 @@ H5FD_sec2_lock(H5FD_t *_file, hbool_t rw) /* Place a non-blocking lock on the file */ if(HDflock(file->fd, lock_flags | LOCK_NB) < 0) { - if(ENOSYS == errno) - HSYS_GOTO_ERROR(H5E_FILE, H5E_BADFILE, FAIL, "file locking disabled on this file system (use HDF5_USE_FILE_LOCKING environment variable to override)") + if(file->ignore_disabled_file_locks && ENOSYS == errno) { + /* When errno is set to ENOSYS, the file system does not support + * locking, so ignore it. + */ + errno = 0; + } else - HSYS_GOTO_ERROR(H5E_FILE, H5E_BADFILE, FAIL, "unable to lock file") - } /* end if */ + HSYS_GOTO_ERROR(H5E_VFL, H5E_CANTLOCKFILE, FAIL, "unable to lock file") + } done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_sec2_lock() */ +} /* end H5FD__sec2_lock() */ /*------------------------------------------------------------------------- - * Function: H5FD_sec2_unlock + * Function: H5FD__sec2_unlock * * Purpose: To remove the existing lock on the file * @@ -986,23 +1009,27 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_sec2_unlock(H5FD_t *_file) +H5FD__sec2_unlock(H5FD_t *_file) { H5FD_sec2_t *file = (H5FD_sec2_t *)_file; /* VFD file struct */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(file); if(HDflock(file->fd, LOCK_UN) < 0) { - if(ENOSYS == errno) - HSYS_GOTO_ERROR(H5E_FILE, H5E_BADFILE, FAIL, "file locking disabled on this file system (use HDF5_USE_FILE_LOCKING environment variable to override)") + if(file->ignore_disabled_file_locks && ENOSYS == errno) { + /* When errno is set to ENOSYS, the file system does not support + * locking, so ignore it. + */ + errno = 0; + } else - HSYS_GOTO_ERROR(H5E_FILE, H5E_BADFILE, FAIL, "unable to unlock file") - } /* end if */ + HSYS_GOTO_ERROR(H5E_VFL, H5E_CANTUNLOCKFILE, FAIL, "unable to unlock file") + } done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_sec2_unlock() */ +} /* end H5FD__sec2_unlock() */ diff --git a/src/H5FDsec2.h b/src/H5FDsec2.h index a4ade0b..d669582 100644 --- a/src/H5FDsec2.h +++ b/src/H5FDsec2.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, August 2, 1999 * * Purpose: The public header file for the sec2 driver. diff --git a/src/H5FDspace.c b/src/H5FDspace.c index e1f0cb2..22d7e22 100644 --- a/src/H5FDspace.c +++ b/src/H5FDspace.c @@ -15,7 +15,7 @@ * * Created: H5FDspace.c * Jan 3 2008 - * Quincey Koziol + * Quincey Koziol * * Purpose: Space allocation routines for the file driver code. * @@ -84,7 +84,7 @@ H5FL_DEFINE(H5FD_free_t); /*------------------------------------------------------------------------- - * Function: H5FD_extend + * Function: H5FD__extend * * Purpose: Extend the EOA space of a file. * @@ -99,12 +99,12 @@ H5FL_DEFINE(H5FD_free_t); *------------------------------------------------------------------------- */ static haddr_t -H5FD_extend(H5FD_t *file, H5FD_mem_t type, hsize_t size) +H5FD__extend(H5FD_t *file, H5FD_mem_t type, hsize_t size) { haddr_t eoa; /* Address of end-of-allocated space */ haddr_t ret_value = HADDR_UNDEF; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(file); @@ -129,7 +129,7 @@ H5FD_extend(H5FD_t *file, H5FD_mem_t type, hsize_t size) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_extend() */ +} /* end H5FD__extend() */ /*------------------------------------------------------------------------- @@ -203,7 +203,7 @@ HDfprintf(stderr, "%s: type = %u, size = %Hu\n", FUNC, (unsigned)type, size); HGOTO_ERROR(H5E_VFL, H5E_NOSPACE, HADDR_UNDEF, "driver allocation request failed") } /* end if */ else { - ret_value = H5FD_extend(file, type, size + extra); + ret_value = H5FD__extend(file, type, size + extra); if(!H5F_addr_defined(ret_value)) HGOTO_ERROR(H5E_VFL, H5E_NOSPACE, HADDR_UNDEF, "driver eoa update request failed") } /* end else */ @@ -439,7 +439,7 @@ H5FD_try_extend(H5FD_t *file, H5FD_mem_t type, H5F_t *f, haddr_t blk_end, hsize_ /* Check if the block is exactly at the end of the file */ if(H5F_addr_eq(blk_end, eoa)) { /* Extend the object by extending the underlying file */ - if(HADDR_UNDEF == H5FD_extend(file, type, extra_requested)) + if(HADDR_UNDEF == H5FD__extend(file, type, extra_requested)) HGOTO_ERROR(H5E_VFL, H5E_CANTEXTEND, FAIL, "driver extend request failed") /* Mark EOA info dirty in cache, so change will get encoded */ diff --git a/src/H5FDsplitter.c b/src/H5FDsplitter.c index fc056f1..7bf0de8 100644 --- a/src/H5FDsplitter.c +++ b/src/H5FDsplitter.c @@ -27,8 +27,6 @@ #include "H5FLprivate.h" /* Free Lists */ #include "H5Iprivate.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ -#include "H5FDsec2.h" /* Generic Functions */ -#include "H5FDstdio.h" /* Generic Functions */ #include "H5Pprivate.h" /* Property lists */ /* The driver identification number, initialized at runtime */ @@ -83,9 +81,8 @@ typedef struct H5FD_splitter_t { #define H5FD_SPLITTER_WO_ERROR(file, funcname, errmajor, errminor, ret, mesg) \ { \ H5FD__splitter_log_error((file), (funcname), (mesg)); \ - if (FALSE == (file)->fa.ignore_wo_errs) { \ + if(FALSE == (file)->fa.ignore_wo_errs) \ HGOTO_ERROR((errmajor), (errminor), (ret), (mesg)) \ - } \ } #define H5FD_SPLITTER_DEBUG_OP_CALLS 0 /* debugging print toggle; 0 disables */ @@ -93,7 +90,7 @@ typedef struct H5FD_splitter_t { #if H5FD_SPLITTER_DEBUG_OP_CALLS #define H5FD_SPLITTER_LOG_CALL(name) do { \ HDprintf("called %s()\n", (name)); \ - fflush(stdout); \ + HDfflush(stdout); \ } while (0) #else #define H5FD_SPLITTER_LOG_CALL(name) /* no-op */ @@ -103,75 +100,77 @@ typedef struct H5FD_splitter_t { /* Print error messages from W/O channel to log file */ static herr_t H5FD__splitter_log_error(const H5FD_splitter_t *file, const char *atfunc, const char *msg); - static int H5FD__copy_plist(hid_t fapl_id, hid_t *id_out_ptr); /* Prototypes */ -static herr_t H5FD_splitter_term(void); -static hsize_t H5FD_splitter_sb_size(H5FD_t *_file); -static herr_t H5FD_splitter_sb_encode(H5FD_t *_file, char *name/*out*/, unsigned char *buf/*out*/); -static herr_t H5FD_splitter_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf); -static void *H5FD_splitter_fapl_get(H5FD_t *_file); -static void *H5FD_splitter_fapl_copy(const void *_old_fa); -static herr_t H5FD_splitter_fapl_free(void *_fapl); -static H5FD_t *H5FD_splitter_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr); -static herr_t H5FD_splitter_close(H5FD_t *_file); -static int H5FD_splitter_cmp(const H5FD_t *_f1, const H5FD_t *_f2); -static herr_t H5FD_splitter_query(const H5FD_t *_file, unsigned long *flags /* out */); -static herr_t H5FD_splitter_get_type_map(const H5FD_t *_file, H5FD_mem_t *type_map); -static haddr_t H5FD_splitter_alloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size); -static herr_t H5FD_splitter_free(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t size); -static haddr_t H5FD_splitter_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type); -static herr_t H5FD_splitter_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr); -static haddr_t H5FD_splitter_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type); -static herr_t H5FD_splitter_get_handle(H5FD_t *_file, hid_t H5_ATTR_UNUSED fapl, void** file_handle); -static herr_t H5FD_splitter_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, void *buf); -static herr_t H5FD_splitter_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, const void *buf); -static herr_t H5FD_splitter_flush(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); -static herr_t H5FD_splitter_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); -static herr_t H5FD_splitter_lock(H5FD_t *_file, hbool_t rw); -static herr_t H5FD_splitter_unlock(H5FD_t *_file); +static herr_t H5FD__splitter_term(void); +static hsize_t H5FD__splitter_sb_size(H5FD_t *_file); +static herr_t H5FD__splitter_sb_encode(H5FD_t *_file, char *name/*out*/, unsigned char *buf/*out*/); +static herr_t H5FD__splitter_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf); +static void *H5FD__splitter_fapl_get(H5FD_t *_file); +static void *H5FD__splitter_fapl_copy(const void *_old_fa); +static herr_t H5FD__splitter_fapl_free(void *_fapl); +static H5FD_t *H5FD__splitter_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr); +static herr_t H5FD__splitter_close(H5FD_t *_file); +static int H5FD__splitter_cmp(const H5FD_t *_f1, const H5FD_t *_f2); +static herr_t H5FD__splitter_query(const H5FD_t *_file, unsigned long *flags /* out */); +static herr_t H5FD__splitter_get_type_map(const H5FD_t *_file, H5FD_mem_t *type_map); +static haddr_t H5FD__splitter_alloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size); +static herr_t H5FD__splitter_free(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t size); +static haddr_t H5FD__splitter_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type); +static herr_t H5FD__splitter_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr); +static haddr_t H5FD__splitter_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type); +static herr_t H5FD__splitter_get_handle(H5FD_t *_file, hid_t H5_ATTR_UNUSED fapl, void** file_handle); +static herr_t H5FD__splitter_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, void *buf); +static herr_t H5FD__splitter_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, const void *buf); +static herr_t H5FD__splitter_flush(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); +static herr_t H5FD__splitter_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); +static herr_t H5FD__splitter_lock(H5FD_t *_file, hbool_t rw); +static herr_t H5FD__splitter_unlock(H5FD_t *_file); static const H5FD_class_t H5FD_splitter_g = { "splitter", /* name */ MAXADDR, /* maxaddr */ H5F_CLOSE_WEAK, /* fc_degree */ - H5FD_splitter_term, /* terminate */ - H5FD_splitter_sb_size, /* sb_size */ - H5FD_splitter_sb_encode, /* sb_encode */ - H5FD_splitter_sb_decode, /* sb_decode */ + H5FD__splitter_term, /* terminate */ + H5FD__splitter_sb_size, /* sb_size */ + H5FD__splitter_sb_encode, /* sb_encode */ + H5FD__splitter_sb_decode, /* sb_decode */ sizeof(H5FD_splitter_fapl_t), /* fapl_size */ - H5FD_splitter_fapl_get, /* fapl_get */ - H5FD_splitter_fapl_copy, /* fapl_copy */ - H5FD_splitter_fapl_free, /* fapl_free */ + H5FD__splitter_fapl_get, /* fapl_get */ + H5FD__splitter_fapl_copy, /* fapl_copy */ + H5FD__splitter_fapl_free, /* fapl_free */ 0, /* dxpl_size */ NULL, /* dxpl_copy */ NULL, /* dxpl_free */ - H5FD_splitter_open, /* open */ - H5FD_splitter_close, /* close */ - H5FD_splitter_cmp, /* cmp */ - H5FD_splitter_query, /* query */ - H5FD_splitter_get_type_map, /* get_type_map */ - H5FD_splitter_alloc, /* alloc */ - H5FD_splitter_free, /* free */ - H5FD_splitter_get_eoa, /* get_eoa */ - H5FD_splitter_set_eoa, /* set_eoa */ - H5FD_splitter_get_eof, /* get_eof */ - H5FD_splitter_get_handle, /* get_handle */ - H5FD_splitter_read, /* read */ - H5FD_splitter_write, /* write */ + H5FD__splitter_open, /* open */ + H5FD__splitter_close, /* close */ + H5FD__splitter_cmp, /* cmp */ + H5FD__splitter_query, /* query */ + H5FD__splitter_get_type_map, /* get_type_map */ + H5FD__splitter_alloc, /* alloc */ + H5FD__splitter_free, /* free */ + H5FD__splitter_get_eoa, /* get_eoa */ + H5FD__splitter_set_eoa, /* set_eoa */ + H5FD__splitter_get_eof, /* get_eof */ + H5FD__splitter_get_handle, /* get_handle */ + H5FD__splitter_read, /* read */ + H5FD__splitter_write, /* write */ NULL, /* read_vector */ NULL, /* write_vector */ - H5FD_splitter_flush, /* flush */ - H5FD_splitter_truncate, /* truncate */ - H5FD_splitter_lock, /* lock */ - H5FD_splitter_unlock, /* unlock */ + H5FD__splitter_flush, /* flush */ + H5FD__splitter_truncate, /* truncate */ + H5FD__splitter_lock, /* lock */ + H5FD__splitter_unlock, /* unlock */ H5FD_FLMAP_DICHOTOMY /* fl_map */ }; /* Declare a free list to manage the H5FD_splitter_t struct */ H5FL_DEFINE_STATIC(H5FD_splitter_t); +/* Declare a free list to manage the H5FD_splitter_fapl_t struct */ +H5FL_DEFINE_STATIC(H5FD_splitter_fapl_t); + /*------------------------------------------------------------------------- * Function: H5FD__init_package @@ -188,11 +187,10 @@ H5FD__init_package(void) FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL("H5FD__init_package"); + H5FD_SPLITTER_LOG_CALL(FUNC); - if (H5FD_splitter_init() < 0) { + if(H5FD_splitter_init() < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to initialize splitter VFD") - } done: FUNC_LEAVE_NOAPI(ret_value) @@ -216,11 +214,10 @@ H5FD_splitter_init(void) FUNC_ENTER_NOAPI(FAIL) - H5FD_SPLITTER_LOG_CALL("H5FD_splitter_init"); + H5FD_SPLITTER_LOG_CALL(FUNC); - if (H5I_VFL != H5I_get_type(H5FD_SPLITTER_g)) { + if(H5I_VFL != H5I_get_type(H5FD_SPLITTER_g)) H5FD_SPLITTER_g = H5FDregister(&H5FD_splitter_g); - } ret_value = H5FD_SPLITTER_g; @@ -230,7 +227,7 @@ done: /*--------------------------------------------------------------------------- - * Function: H5FD_splitter_term + * Function: H5FD__splitter_term * * Purpose: Shut down the splitter VFD. * @@ -238,17 +235,17 @@ done: *--------------------------------------------------------------------------- */ static herr_t -H5FD_splitter_term(void) +H5FD__splitter_term(void) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR - H5FD_SPLITTER_LOG_CALL("H5FD_splitter_term"); + H5FD_SPLITTER_LOG_CALL(FUNC); /* Reset VFL ID */ H5FD_SPLITTER_g = 0; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5FD_splitter_term() */ +} /* end H5FD__splitter_term() */ /*------------------------------------------------------------------------- @@ -267,25 +264,22 @@ H5FD__copy_plist(hid_t fapl_id, int ret_value = 0; H5P_genplist_t *plist_ptr = NULL; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL("H5FD__copy_plist"); + H5FD_SPLITTER_LOG_CALL(FUNC); HDassert(id_out_ptr != NULL); - if (FALSE == H5P_isa_class(fapl_id, H5P_FILE_ACCESS)) { + if(FALSE == H5P_isa_class(fapl_id, H5P_FILE_ACCESS)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, -1, "not a file access property list"); - } plist_ptr = (H5P_genplist_t *)H5I_object(fapl_id); - if (NULL == plist_ptr) { + if(NULL == plist_ptr) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, -1, "unable to get property list"); - } *id_out_ptr = H5P_copy_plist(plist_ptr, FALSE); - if (H5I_INVALID_HID == *id_out_ptr) { + if(H5I_INVALID_HID == *id_out_ptr) HGOTO_ERROR(H5E_VFL, H5E_BADTYPE, -1, "unable to copy file access property list"); - } done: FUNC_LEAVE_NOAPI(ret_value); @@ -304,28 +298,21 @@ done: herr_t H5Pset_fapl_splitter(hid_t fapl_id, H5FD_splitter_vfd_config_t *vfd_config) { - H5FD_splitter_fapl_t info; + H5FD_splitter_fapl_t *info = NULL; H5P_genplist_t *plist_ptr = NULL; herr_t ret_value = SUCCEED; - H5Eclear2(H5E_DEFAULT); - FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*Dr", fapl_id, vfd_config); - H5FD_SPLITTER_LOG_CALL("H5Pset_fapl_splitter"); + H5FD_SPLITTER_LOG_CALL(FUNC); - if (H5FD_SPLITTER_MAGIC != vfd_config->magic) { + if(H5FD_SPLITTER_MAGIC != vfd_config->magic) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid configuration (magic number mismatch)") - } - if (H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION != vfd_config->version) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invlaid config (version number mismatch)") - } - - if (NULL == (plist_ptr = (H5P_genplist_t *)H5I_object(fapl_id))) { + if(H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION != vfd_config->version) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid config (version number mismatch)") + if(NULL == (plist_ptr = (H5P_genplist_t *)H5I_object(fapl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a valid property list") - } - /* Make sure that the W/O channel supports write-only capability. * Some drivers (e.g. family or multi) do revision of the superblock @@ -333,55 +320,54 @@ H5Pset_fapl_splitter(hid_t fapl_id, H5FD_splitter_vfd_config_t *vfd_config) * Uses the feature flag H5FD_FEAT_DEFAULT_VFD_COMPATIBLE as the * determining attribute. */ - if (H5P_DEFAULT != vfd_config->wo_fapl_id) { + if(H5P_DEFAULT != vfd_config->wo_fapl_id) { H5FD_class_t *wo_driver = NULL; H5FD_driver_prop_t wo_driver_prop; H5P_genplist_t *wo_plist_ptr = NULL; unsigned long wo_driver_flags = 0; wo_plist_ptr = (H5P_genplist_t *)H5I_object(vfd_config->wo_fapl_id); - if (NULL == wo_plist_ptr) { + if(NULL == wo_plist_ptr) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") - } - if (H5P_peek(wo_plist_ptr, H5F_ACS_FILE_DRV_NAME, &wo_driver_prop) < 0) { + if(H5P_peek(wo_plist_ptr, H5F_ACS_FILE_DRV_NAME, &wo_driver_prop) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get driver ID & info") - } wo_driver = (H5FD_class_t *)H5I_object(wo_driver_prop.driver_id); - if (NULL == wo_driver) { + if(NULL == wo_driver) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "invalid driver ID in file access property list") - } - if (H5FD_driver_query(wo_driver, &wo_driver_flags) < 0) { + if(H5FD_driver_query(wo_driver, &wo_driver_flags) < 0) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "can't query VFD flags") - } - if (0 == (H5FD_FEAT_DEFAULT_VFD_COMPATIBLE & wo_driver_flags)) { + if(0 == (H5FD_FEAT_DEFAULT_VFD_COMPATIBLE & wo_driver_flags)) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "unsuitable W/O driver") - } } /* end if W/O VFD is non-default */ + info = H5FL_CALLOC(H5FD_splitter_fapl_t); + if(NULL == info) + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "unable to allocate file access property list struct") - info.ignore_wo_errs = vfd_config->ignore_wo_errs; - HDstrncpy(info.wo_path, vfd_config->wo_path, H5FD_SPLITTER_PATH_MAX); - HDstrncpy(info.log_file_path, vfd_config->log_file_path, H5FD_SPLITTER_PATH_MAX); - info.rw_fapl_id = H5P_FILE_ACCESS_DEFAULT; /* pre-set value */ - info.wo_fapl_id = H5P_FILE_ACCESS_DEFAULT; /* pre-set value */ + info->ignore_wo_errs = vfd_config->ignore_wo_errs; + HDstrncpy(info->wo_path, vfd_config->wo_path, H5FD_SPLITTER_PATH_MAX); + HDstrncpy(info->log_file_path, vfd_config->log_file_path, H5FD_SPLITTER_PATH_MAX); + info->rw_fapl_id = H5P_FILE_ACCESS_DEFAULT; /* pre-set value */ + info->wo_fapl_id = H5P_FILE_ACCESS_DEFAULT; /* pre-set value */ /* Set non-default channel FAPL IDs in splitter configuration info */ - if (H5P_DEFAULT != vfd_config->rw_fapl_id) { - if (FALSE == H5P_isa_class(vfd_config->rw_fapl_id, H5P_FILE_ACCESS)) { + if(H5P_DEFAULT != vfd_config->rw_fapl_id) { + if(FALSE == H5P_isa_class(vfd_config->rw_fapl_id, H5P_FILE_ACCESS)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access list") - } - info.rw_fapl_id = vfd_config->rw_fapl_id; + info->rw_fapl_id = vfd_config->rw_fapl_id; } - if (H5P_DEFAULT != vfd_config->wo_fapl_id) { - if (FALSE == H5P_isa_class(vfd_config->wo_fapl_id, H5P_FILE_ACCESS)) { + if(H5P_DEFAULT != vfd_config->wo_fapl_id) { + if(FALSE == H5P_isa_class(vfd_config->wo_fapl_id, H5P_FILE_ACCESS)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access list") - } - info.wo_fapl_id = vfd_config->wo_fapl_id; + info->wo_fapl_id = vfd_config->wo_fapl_id; } - ret_value = H5P_set_driver(plist_ptr, H5FD_SPLITTER, &info); + ret_value = H5P_set_driver(plist_ptr, H5FD_SPLITTER, info); done: + if(info) + info = H5FL_FREE(H5FD_splitter_fapl_t, info); + FUNC_LEAVE_API(ret_value) } /* end H5Pset_fapl_splitter() */ @@ -408,48 +394,39 @@ H5Pget_fapl_splitter(hid_t fapl_id, H5FD_splitter_vfd_config_t *config_out) FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*Dr", fapl_id, config_out); - H5FD_SPLITTER_LOG_CALL("H5Pget_fapl_splitter"); + H5FD_SPLITTER_LOG_CALL(FUNC); /* Check arguments */ - if (TRUE != H5P_isa_class(fapl_id, H5P_FILE_ACCESS)) { + if(TRUE != H5P_isa_class(fapl_id, H5P_FILE_ACCESS)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") - } - if (config_out == NULL) { + if(config_out == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "config_out pointer is null") - } - if (H5FD_SPLITTER_MAGIC != config_out->magic) { + if(H5FD_SPLITTER_MAGIC != config_out->magic) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "info-out pointer invalid (magic number mismatch)") - } - if (H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION != config_out->version) { + if(H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION != config_out->version) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "info-out pointer invalid (version unsafe)") - } /* Pre-set out FAPL IDs with intent to replace these values */ config_out->rw_fapl_id = H5I_INVALID_HID; config_out->wo_fapl_id = H5I_INVALID_HID; /* Check and get the splitter fapl */ - if (NULL == (plist_ptr = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) { + if(NULL == (plist_ptr = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") - } - if (H5FD_SPLITTER != H5P_peek_driver(plist_ptr)) { + if(H5FD_SPLITTER != H5P_peek_driver(plist_ptr)) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver") - } - if (NULL == (fapl_ptr = (const H5FD_splitter_fapl_t *)H5P_peek_driver_info(plist_ptr))) { + if(NULL == (fapl_ptr = (const H5FD_splitter_fapl_t *)H5P_peek_driver_info(plist_ptr))) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "unable to get specific-driver info") - } HDstrncpy(config_out->wo_path, fapl_ptr->wo_path, H5FD_SPLITTER_PATH_MAX); HDstrncpy(config_out->log_file_path, fapl_ptr->log_file_path, H5FD_SPLITTER_PATH_MAX); config_out->ignore_wo_errs = fapl_ptr->ignore_wo_errs; /* Copy R/W and W/O FAPLs */ - if (H5FD__copy_plist(fapl_ptr->rw_fapl_id, &(config_out->rw_fapl_id)) < 0) { + if(H5FD__copy_plist(fapl_ptr->rw_fapl_id, &(config_out->rw_fapl_id)) < 0) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "can't copy R/W FAPL"); - } - if (H5FD__copy_plist(fapl_ptr->wo_fapl_id, &(config_out->wo_fapl_id)) < 0) { + if(H5FD__copy_plist(fapl_ptr->wo_fapl_id, &(config_out->wo_fapl_id)) < 0) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "can't copy W/O FAPL"); - } done: FUNC_LEAVE_API(ret_value) @@ -457,7 +434,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_splitter_flush + * Function: H5FD__splitter_flush * * Purpose: Flushes all data to disk for both channels. * @@ -465,32 +442,28 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_splitter_flush(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closing) +H5FD__splitter_flush(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closing) { H5FD_splitter_t *file = (H5FD_splitter_t *)_file; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL("H5FD_splitter_flush"); + H5FD_SPLITTER_LOG_CALL(FUNC); /* Public API for dxpl "context" */ - if (H5FDflush(file->rw_file, dxpl_id, closing) < 0) { + if(H5FDflush(file->rw_file, dxpl_id, closing) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTFLUSH, FAIL, "unable to flush R/W file") - } - if (H5FDflush(file->wo_file, dxpl_id, closing) < 0) { - H5FD_SPLITTER_WO_ERROR(file, "H5FD_splitter_flush", - H5E_VFL, H5E_CANTFLUSH, FAIL, - "unable to flush W/O file") - } + if(H5FDflush(file->wo_file, dxpl_id, closing) < 0) + H5FD_SPLITTER_WO_ERROR(file, FUNC, H5E_VFL, H5E_CANTFLUSH, FAIL, "unable to flush W/O file") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_splitter_flush() */ +} /* end H5FD__splitter_flush() */ /*------------------------------------------------------------------------- - * Function: H5FD_splitter_read + * Function: H5FD__splitter_read * * Purpose: Reads SIZE bytes of data from the R/W channel, beginning at * address ADDR into buffer BUF according to data transfer @@ -504,45 +477,37 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_splitter_read( - H5FD_t *_file, - H5FD_mem_t H5_ATTR_UNUSED type, - hid_t H5_ATTR_UNUSED dxpl_id, - haddr_t addr, - size_t size, - void *buf /*out*/) +H5FD__splitter_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, + hid_t H5_ATTR_UNUSED dxpl_id, haddr_t addr, size_t size, void *buf) { H5FD_splitter_t *file = (H5FD_splitter_t *)_file; herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL("H5FD_splitter_read"); + H5FD_SPLITTER_LOG_CALL(FUNC); HDassert(file && file->pub.cls); HDassert(buf); /* Check for overflow conditions */ - if (!H5F_addr_defined(addr)) { + if(!H5F_addr_defined(addr)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "addr undefined, addr = %llu", (unsigned long long)addr) - } - if (REGION_OVERFLOW(addr, size)) { + if(REGION_OVERFLOW(addr, size)) HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow, addr = %llu", (unsigned long long)addr) - } /* Only read from R/W channel */ /* Public API for dxpl "context" */ - if (H5FDread(file->rw_file, type, dxpl_id, addr, size, buf) < 0) { + if(H5FDread(file->rw_file, type, dxpl_id, addr, size, buf) < 0) HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "Reading from R/W channel failed") - } done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_splitter_read() */ +} /* end H5FD__splitter_read() */ /*------------------------------------------------------------------------- - * Function: H5FD_splitter_write + * Function: H5FD__splitter_write * * Purpose: Writes SIZE bytes of data to R/W and W/O channels, beginning * at address ADDR from buffer BUF according to data transfer @@ -552,38 +517,34 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_splitter_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, const void *buf) +H5FD__splitter_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, + haddr_t addr, size_t size, const void *buf) { H5FD_splitter_t *file = (H5FD_splitter_t *)_file; H5P_genplist_t *plist_ptr = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL("H5FD_splitter_write"); + H5FD_SPLITTER_LOG_CALL(FUNC); - if (NULL == (plist_ptr = (H5P_genplist_t *)H5I_object(dxpl_id))) { + if(NULL == (plist_ptr = (H5P_genplist_t *)H5I_object(dxpl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") - } /* Write to each file */ /* Public API for dxpl "context" */ - if (H5FDwrite(file->rw_file, type, dxpl_id, addr, size, buf) < 0) { + if(H5FDwrite(file->rw_file, type, dxpl_id, addr, size, buf) < 0) HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "R/W file write failed") - } - if (H5FDwrite(file->wo_file, type, dxpl_id, addr, size, buf) < 0) { - H5FD_SPLITTER_WO_ERROR(file, "H5FD_splitter_write", - H5E_VFL, H5E_WRITEERROR, FAIL, - "unable to write W/O file") - } + if(H5FDwrite(file->wo_file, type, dxpl_id, addr, size, buf) < 0) + H5FD_SPLITTER_WO_ERROR(file, FUNC, H5E_VFL, H5E_WRITEERROR, FAIL, "unable to write W/O file") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_splitter_write() */ +} /* end H5FD__splitter_write() */ /*------------------------------------------------------------------------- - * Function: H5FD_splitter_fapl_get + * Function: H5FD__splitter_fapl_get * * Purpose: Returns a file access property list which indicates how the * specified file is being accessed. The return list could be @@ -595,23 +556,23 @@ done: *------------------------------------------------------------------------- */ static void * -H5FD_splitter_fapl_get(H5FD_t *_file) +H5FD__splitter_fapl_get(H5FD_t *_file) { H5FD_splitter_t *file = (H5FD_splitter_t *)_file; void *ret_value = NULL; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR - H5FD_SPLITTER_LOG_CALL("H5FD_splitter_fapl_get"); + H5FD_SPLITTER_LOG_CALL(FUNC); - ret_value = H5FD_splitter_fapl_copy(&(file->fa)); + ret_value = H5FD__splitter_fapl_copy(&(file->fa)); FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5FD__splitter_fapl_get() */ /*------------------------------------------------------------------------- - * Function: H5FD_splitter_fapl_copy + * Function: H5FD__splitter_fapl_copy * * Purpose: Copies the file access properties. * @@ -620,56 +581,45 @@ H5FD_splitter_fapl_get(H5FD_t *_file) *------------------------------------------------------------------------- */ static void * -H5FD_splitter_fapl_copy(const void *_old_fa) +H5FD__splitter_fapl_copy(const void *_old_fa) { const H5FD_splitter_fapl_t *old_fa_ptr = (const H5FD_splitter_fapl_t *)_old_fa; H5FD_splitter_fapl_t *new_fa_ptr = NULL; void *ret_value = NULL; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL("H5FD_splitter_fapl_copy"); + H5FD_SPLITTER_LOG_CALL(FUNC); HDassert(old_fa_ptr); - new_fa_ptr = (H5FD_splitter_fapl_t *)H5MM_calloc(sizeof(H5FD_splitter_fapl_t)); - if (NULL == new_fa_ptr) { + new_fa_ptr = H5FL_CALLOC(H5FD_splitter_fapl_t); + if(NULL == new_fa_ptr) HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "unable to allocate log file FAPL") - } - if (HDmemcpy(new_fa_ptr, old_fa_ptr, sizeof(H5FD_splitter_fapl_t)) == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, NULL, "unable to shallow-copy info") - } - if (HDstrncpy(new_fa_ptr->wo_path, old_fa_ptr->wo_path, H5FD_SPLITTER_PATH_MAX) == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, NULL, "unable to copy write-only channel file path") - } - if (HDstrncpy(new_fa_ptr->log_file_path, old_fa_ptr->log_file_path, H5FD_SPLITTER_PATH_MAX) == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, NULL, "unable to copy log file path") - } + HDmemcpy(new_fa_ptr, old_fa_ptr, sizeof(H5FD_splitter_fapl_t)); + HDstrncpy(new_fa_ptr->wo_path, old_fa_ptr->wo_path, H5FD_SPLITTER_PATH_MAX); + HDstrncpy(new_fa_ptr->log_file_path, old_fa_ptr->log_file_path, H5FD_SPLITTER_PATH_MAX); /* Copy R/W and W/O FAPLs */ - if (H5FD__copy_plist(old_fa_ptr->rw_fapl_id, &(new_fa_ptr->rw_fapl_id)) < 0) { + if(H5FD__copy_plist(old_fa_ptr->rw_fapl_id, &(new_fa_ptr->rw_fapl_id)) < 0) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "can't copy R/W FAPL"); - } - if (H5FD__copy_plist(old_fa_ptr->wo_fapl_id, &(new_fa_ptr->wo_fapl_id)) < 0) { + if(H5FD__copy_plist(old_fa_ptr->wo_fapl_id, &(new_fa_ptr->wo_fapl_id)) < 0) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "can't copy W/O FAPL"); - } ret_value = (void *)new_fa_ptr; done: - if (NULL == ret_value) { - if (new_fa_ptr) { - H5MM_free(new_fa_ptr); - } - } + if(NULL == ret_value) + if(new_fa_ptr) + new_fa_ptr = H5FL_FREE(H5FD_splitter_fapl_t, new_fa_ptr); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_splitter_fapl_copy() */ +} /* end H5FD__splitter_fapl_copy() */ /*-------------------------------------------------------------------------- - * Function: H5FD_splitter_fapl_free + * Function: H5FD__splitter_fapl_free * * Purpose: Releases the file access lists * @@ -677,35 +627,33 @@ done: *-------------------------------------------------------------------------- */ static herr_t -H5FD_splitter_fapl_free(void *_fapl) +H5FD__splitter_fapl_free(void *_fapl) { H5FD_splitter_fapl_t *fapl = (H5FD_splitter_fapl_t*)_fapl; herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL("H5FD_splitter_fapl_free"); + H5FD_SPLITTER_LOG_CALL(FUNC); /* Check arguments */ HDassert(fapl); - if (H5I_dec_ref(fapl->rw_fapl_id) < 0) { + if(H5I_dec_ref(fapl->rw_fapl_id) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTDEC, FAIL, "can't close R/W FAPL ID") - } - if (H5I_dec_ref(fapl->wo_fapl_id) < 0) { + if(H5I_dec_ref(fapl->wo_fapl_id) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTDEC, FAIL, "can't close W/O FAPL ID") - } /* Free the property list */ - H5MM_free(fapl); + fapl = H5FL_FREE(H5FD_splitter_fapl_t, fapl); done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_splitter_fapl_free() */ +} /* end H5FD__splitter_fapl_free() */ /*------------------------------------------------------------------------- - * Function: H5FD_splitter_open + * Function: H5FD__splitter_open * * Purpose: Create and/or opens a file as an HDF5 file. * @@ -716,123 +664,99 @@ done: *------------------------------------------------------------------------- */ static H5FD_t * -H5FD_splitter_open(const char *name, unsigned flags, hid_t splitter_fapl_id, haddr_t maxaddr) +H5FD__splitter_open(const char *name, unsigned flags, hid_t splitter_fapl_id, haddr_t maxaddr) { H5FD_splitter_t *file_ptr = NULL; /* Splitter VFD info */ const H5FD_splitter_fapl_t *fapl_ptr = NULL; /* Driver-specific property list */ H5P_genplist_t *plist_ptr = NULL; H5FD_t *ret_value = NULL; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL("H5FD_splitter_open"); + H5FD_SPLITTER_LOG_CALL(FUNC); /* Check arguments */ - if (!name || !*name) { + if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid file name") - } - if (0 == maxaddr || HADDR_UNDEF == maxaddr) { + if(0 == maxaddr || HADDR_UNDEF == maxaddr) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "bogus maxaddr") - } - if (ADDR_OVERFLOW(maxaddr)) { + if(ADDR_OVERFLOW(maxaddr)) HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, NULL, "bogus maxaddr") - } - if ( (H5P_FILE_ACCESS_DEFAULT == splitter_fapl_id) || - (H5FD_SPLITTER != H5Pget_driver(splitter_fapl_id)) ) - { + if((H5P_FILE_ACCESS_DEFAULT == splitter_fapl_id) || + (H5FD_SPLITTER != H5Pget_driver(splitter_fapl_id)) ) /* presupposes that H5P_FILE_ACCESS_DEFAULT is not a splitter */ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "driver is not splitter") - } file_ptr = (H5FD_splitter_t *)H5FL_CALLOC(H5FD_splitter_t); - if (NULL == file_ptr) { - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate file struct") - } + if(NULL == file_ptr) + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "unable to allocate file struct") file_ptr->fa.rw_fapl_id = H5I_INVALID_HID; file_ptr->fa.wo_fapl_id = H5I_INVALID_HID; /* Get the driver-specific file access properties */ plist_ptr = (H5P_genplist_t *)H5I_object(splitter_fapl_id); - if (NULL == plist_ptr) { + if(NULL == plist_ptr) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") - } fapl_ptr = (const H5FD_splitter_fapl_t *)H5P_peek_driver_info(plist_ptr); - if (NULL == fapl_ptr) { + if(NULL == fapl_ptr) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "unable to get VFL driver info") - } /* Copy simpler info */ - if (HDstrncpy(file_ptr->fa.wo_path, fapl_ptr->wo_path, H5FD_SPLITTER_PATH_MAX) == NULL) { - HGOTO_ERROR(H5E_VFL, H5E_CANTCOPY, NULL, "unable to copy write-only path") - } - if (HDstrncpy(file_ptr->fa.log_file_path, fapl_ptr->log_file_path, H5FD_SPLITTER_PATH_MAX) == NULL) { - HGOTO_ERROR(H5E_VFL, H5E_CANTCOPY, NULL, "unable to copy logfile path") - } + HDstrncpy(file_ptr->fa.wo_path, fapl_ptr->wo_path, H5FD_SPLITTER_PATH_MAX); + HDstrncpy(file_ptr->fa.log_file_path, fapl_ptr->log_file_path, H5FD_SPLITTER_PATH_MAX); file_ptr->fa.ignore_wo_errs = fapl_ptr->ignore_wo_errs; /* Copy R/W and W/O channel FAPLs. */ - if (H5FD__copy_plist(fapl_ptr->rw_fapl_id, &(file_ptr->fa.rw_fapl_id)) < 0) { + if(H5FD__copy_plist(fapl_ptr->rw_fapl_id, &(file_ptr->fa.rw_fapl_id)) < 0) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "can't copy R/W FAPL"); - } - if (H5FD__copy_plist(fapl_ptr->wo_fapl_id, &(file_ptr->fa.wo_fapl_id)) < 0) { + if(H5FD__copy_plist(fapl_ptr->wo_fapl_id, &(file_ptr->fa.wo_fapl_id)) < 0) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "can't copy W/O FAPL"); - } /* Prepare log file if necessary. * If application wants to ignore the errors from W/O channel and * provided a name for the log file, then open it */ - if (!file_ptr->logfp) { - if (file_ptr->fa.log_file_path[0] != '\0') { + if(!file_ptr->logfp) { + if(file_ptr->fa.log_file_path[0] != '\0') { file_ptr->logfp = HDfopen(file_ptr->fa.log_file_path, "w"); - if (file_ptr->logfp == NULL) { + if(file_ptr->logfp == NULL) HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, "unable to open log file") - } } /* end if logfile path given */ } /* end if logfile pointer/handle does not exist */ file_ptr->rw_file = H5FD_open(name, flags, fapl_ptr->rw_fapl_id, HADDR_UNDEF); - if (!file_ptr->rw_file) { + if(!file_ptr->rw_file) HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, "unable to open R/W file") - } file_ptr->wo_file = H5FD_open(fapl_ptr->wo_path, flags, fapl_ptr->wo_fapl_id, HADDR_UNDEF); - if (!file_ptr->wo_file) { - H5FD_SPLITTER_WO_ERROR(file_ptr, "H5FD_splitter_open", - H5E_VFL, H5E_CANTOPENFILE, NULL, - "unable to open W/O file") - } + if(!file_ptr->wo_file) + H5FD_SPLITTER_WO_ERROR(file_ptr, FUNC, H5E_VFL, H5E_CANTOPENFILE, NULL, "unable to open W/O file") ret_value = (H5FD_t*)file_ptr; done: - if (NULL == ret_value) { - if (file_ptr) { - if (H5I_INVALID_HID != file_ptr->fa.rw_fapl_id) { + if(NULL == ret_value) { + if(file_ptr) { + if(H5I_INVALID_HID != file_ptr->fa.rw_fapl_id) H5I_dec_ref(file_ptr->fa.rw_fapl_id); - } - if (H5I_INVALID_HID != file_ptr->fa.wo_fapl_id) { + if(H5I_INVALID_HID != file_ptr->fa.wo_fapl_id) H5I_dec_ref(file_ptr->fa.wo_fapl_id); - } - if (file_ptr->rw_file) { + if(file_ptr->rw_file) H5FD_close(file_ptr->rw_file); - } - if (file_ptr->wo_file) { + if(file_ptr->wo_file) H5FD_close(file_ptr->wo_file); - } - if (file_ptr->logfp) { + if(file_ptr->logfp) HDfclose(file_ptr->logfp); - } H5FL_FREE(H5FD_splitter_t, file_ptr); } } /* end if error */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_splitter_open() */ +} /* end H5FD__splitter_open() */ /*------------------------------------------------------------------------- - * Function: H5FD_splitter_close + * Function: H5FD__splitter_close * * Purpose: Closes files on both read-write and write-only channels. * @@ -841,39 +765,31 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_splitter_close(H5FD_t *_file) +H5FD__splitter_close(H5FD_t *_file) { H5FD_splitter_t *file = (H5FD_splitter_t *)_file; herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL("H5FD_splitter_close"); + H5FD_SPLITTER_LOG_CALL(FUNC); /* Sanity check */ HDassert(file); - if (H5I_dec_ref(file->fa.rw_fapl_id) < 0) { + if(H5I_dec_ref(file->fa.rw_fapl_id) < 0) HGOTO_ERROR(H5E_VFL, H5E_ARGS, FAIL, "can't close R/W FAPL") - } - if (H5I_dec_ref(file->fa.wo_fapl_id) < 0) { + if(H5I_dec_ref(file->fa.wo_fapl_id) < 0) HGOTO_ERROR(H5E_VFL, H5E_ARGS, FAIL, "can't close W/O FAPL") - } - if (file->rw_file) { - if (H5FD_close(file->rw_file) == FAIL) { + if(file->rw_file) + if(H5FD_close(file->rw_file) == FAIL) HGOTO_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "unable to close R/W file") - } - } - if (file->wo_file) { - if (H5FD_close(file->wo_file) == FAIL) { - H5FD_SPLITTER_WO_ERROR(file, "H5FD_splitter_close", - H5E_VFL, H5E_CANTCLOSEFILE, FAIL, - "unable to close W/O file") - } - } + if(file->wo_file) + if(H5FD_close(file->wo_file) == FAIL) + H5FD_SPLITTER_WO_ERROR(file, FUNC, H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "unable to close W/O file") - if (file->logfp) { + if(file->logfp) { HDfclose(file->logfp); file->logfp = NULL; } @@ -884,11 +800,11 @@ H5FD_splitter_close(H5FD_t *_file) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_splitter_close() */ +} /* end H5FD__splitter_close() */ /*------------------------------------------------------------------------- - * Function: H5FD_splitter_get_eoa + * Function: H5FD__splitter_get_eoa * * Purpose: Returns the end-of-address marker for the file. The EOA * marker is the first address past the last byte allocated in @@ -900,30 +816,29 @@ done: *------------------------------------------------------------------------- */ static haddr_t -H5FD_splitter_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) +H5FD__splitter_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) { const H5FD_splitter_t *file = (const H5FD_splitter_t *)_file; haddr_t ret_value = HADDR_UNDEF; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL("H5FD_splitter_get_eoa"); + H5FD_SPLITTER_LOG_CALL(FUNC); /* Sanity check */ HDassert(file); HDassert(file->rw_file); - if ((ret_value = H5FD_get_eoa(file->rw_file, type)) == HADDR_UNDEF) { + if((ret_value = H5FD_get_eoa(file->rw_file, type)) == HADDR_UNDEF) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, HADDR_UNDEF, "unable to get eoa") - } done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_splitter_get_eoa */ +} /* end H5FD__splitter_get_eoa */ /*------------------------------------------------------------------------- - * Function: H5FD_splitter_set_eoa + * Function: H5FD__splitter_set_eoa * * Purpose: Set the end-of-address marker for the file. This function is * called shortly after an existing HDF5 file is opened in order @@ -933,37 +848,33 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_splitter_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr) +H5FD__splitter_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr) { H5FD_splitter_t *file = (H5FD_splitter_t *)_file; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL("H5FD_splitter_set_eoa";) + H5FD_SPLITTER_LOG_CALL(FUNC) /* Sanity check */ HDassert(file); HDassert(file->rw_file); HDassert(file->wo_file); - if (H5FD_set_eoa(file->rw_file, type, addr) < 0) { + if(H5FD_set_eoa(file->rw_file, type, addr) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "H5FDset_eoa failed for R/W file") - } - if (H5FD_set_eoa(file->wo_file, type, addr) < 0) { - H5FD_SPLITTER_WO_ERROR(file, "H5FD_splitter_set_eoa", - H5E_VFL, H5E_CANTSET, FAIL, - "unable to set EOA for W/O file") - } + if(H5FD_set_eoa(file->wo_file, type, addr) < 0) + H5FD_SPLITTER_WO_ERROR(file, FUNC, H5E_VFL, H5E_CANTSET, FAIL, "unable to set EOA for W/O file") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_splitter_set_eoa() */ +} /* end H5FD__splitter_set_eoa() */ /*------------------------------------------------------------------------- - * Function: H5FD_splitter_get_eof + * Function: H5FD__splitter_get_eof * * Purpose: Returns the end-of-address marker for the file. The EOA * marker is the first address past the last byte allocated in @@ -975,30 +886,29 @@ done: *------------------------------------------------------------------------- */ static haddr_t -H5FD_splitter_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) +H5FD__splitter_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) { const H5FD_splitter_t *file = (const H5FD_splitter_t *)_file; haddr_t ret_value = HADDR_UNDEF; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL("H5FD_splitter_get_eof"); + H5FD_SPLITTER_LOG_CALL(FUNC); /* Sanity check */ HDassert(file); HDassert(file->rw_file); - if (HADDR_UNDEF == (ret_value = H5FD_get_eof(file->rw_file, type))) { + if(HADDR_UNDEF == (ret_value = H5FD_get_eof(file->rw_file, type))) HGOTO_ERROR(H5E_VFL, H5E_CANTGET, HADDR_UNDEF, "unable to get eof") - } done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_splitter_get_eof */ +} /* end H5FD__splitter_get_eof */ /*------------------------------------------------------------------------- - * Function: H5FD_splitter_truncate + * Function: H5FD__splitter_truncate * * Purpose: Notify driver to truncate the file back to the allocated size. * @@ -1006,36 +916,32 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_splitter_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing) +H5FD__splitter_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing) { H5FD_splitter_t *file = (H5FD_splitter_t *)_file; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL("H5FD_splitter_truncate"); + H5FD_SPLITTER_LOG_CALL(FUNC); HDassert(file); HDassert(file->rw_file); HDassert(file->wo_file); - if (H5FDtruncate(file->rw_file, dxpl_id, closing) < 0) { + if(H5FDtruncate(file->rw_file, dxpl_id, closing) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTUPDATE, FAIL, "unable to truncate R/W file") - } - if (H5FDtruncate(file->wo_file, dxpl_id, closing) < 0) { - H5FD_SPLITTER_WO_ERROR(file, "H5FD_splitter_truncate", - H5E_VFL, H5E_CANTUPDATE, FAIL, - "unable to truncate W/O file") - } + if(H5FDtruncate(file->wo_file, dxpl_id, closing) < 0) + H5FD_SPLITTER_WO_ERROR(file, FUNC, H5E_VFL, H5E_CANTUPDATE, FAIL, "unable to truncate W/O file") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_splitter_truncate */ +} /* end H5FD__splitter_truncate */ /*------------------------------------------------------------------------- - * Function: H5FD_splitter_sb_size + * Function: H5FD__splitter_sb_size * * Purpose: Obtains the number of bytes required to store the driver file * access data in the HDF5 superblock. @@ -1049,29 +955,28 @@ done: *------------------------------------------------------------------------- */ static hsize_t -H5FD_splitter_sb_size(H5FD_t *_file) +H5FD__splitter_sb_size(H5FD_t *_file) { H5FD_splitter_t *file = (H5FD_splitter_t *)_file; hsize_t ret_value = 0; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR - H5FD_SPLITTER_LOG_CALL("H5FD_splitter_sb_size"); + H5FD_SPLITTER_LOG_CALL(FUNC); /* Sanity check */ HDassert(file); HDassert(file->rw_file); - if (file->rw_file) { + if(file->rw_file) ret_value = H5FD_sb_size(file->rw_file); - } FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_splitter_sb_size */ +} /* end H5FD__splitter_sb_size */ /*------------------------------------------------------------------------- - * Function: H5FD_splitter_sb_encode + * Function: H5FD__splitter_sb_encode * * Purpose: Encode driver-specific data into the output arguments. * @@ -1079,30 +984,29 @@ H5FD_splitter_sb_size(H5FD_t *_file) *------------------------------------------------------------------------- */ static herr_t -H5FD_splitter_sb_encode(H5FD_t *_file, char *name/*out*/, unsigned char *buf/*out*/) +H5FD__splitter_sb_encode(H5FD_t *_file, char *name/*out*/, unsigned char *buf/*out*/) { H5FD_splitter_t *file = (H5FD_splitter_t *)_file; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL("H5FD_splitter_sb_encode"); + H5FD_SPLITTER_LOG_CALL(FUNC); /* Sanity check */ HDassert(file); HDassert(file->rw_file); - if (file->rw_file && H5FD_sb_encode(file->rw_file, name, buf) < 0) { + if(file->rw_file && H5FD_sb_encode(file->rw_file, name, buf) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTENCODE, FAIL, "unable to encode the superblock in R/W file") - } done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_splitter_sb_encode */ +} /* end H5FD__splitter_sb_encode */ /*------------------------------------------------------------------------- - * Function: H5FD_splitter_sb_decode + * Function: H5FD__splitter_sb_decode * * Purpose: Decodes the driver information block. * @@ -1112,30 +1016,29 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_splitter_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf) +H5FD__splitter_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf) { H5FD_splitter_t *file = (H5FD_splitter_t *)_file; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL("H5FD_splitter_sb_decode"); + H5FD_SPLITTER_LOG_CALL(FUNC); /* Sanity check */ HDassert(file); HDassert(file->rw_file); - if (H5FD_sb_load(file->rw_file, name, buf) < 0) { + if(H5FD_sb_load(file->rw_file, name, buf) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTDECODE, FAIL, "unable to decode the superblock in R/W file") - } done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_splitter_sb_decode */ +} /* end H5FD__splitter_sb_decode */ /*------------------------------------------------------------------------- - * Function: H5FD_splitter_cmp + * Function: H5FD__splitter_cmp * * Purpose: Compare the keys of two files. * @@ -1144,15 +1047,15 @@ done: *------------------------------------------------------------------------- */ static int -H5FD_splitter_cmp(const H5FD_t *_f1, const H5FD_t *_f2) +H5FD__splitter_cmp(const H5FD_t *_f1, const H5FD_t *_f2) { const H5FD_splitter_t *f1 = (const H5FD_splitter_t *)_f1; const H5FD_splitter_t *f2 = (const H5FD_splitter_t *)_f2; herr_t ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR - H5FD_SPLITTER_LOG_CALL("H5FD_splitter_cmp"); + H5FD_SPLITTER_LOG_CALL(FUNC); HDassert(f1); HDassert(f2); @@ -1160,11 +1063,11 @@ H5FD_splitter_cmp(const H5FD_t *_f1, const H5FD_t *_f2) ret_value = H5FD_cmp(f1->rw_file, f2->rw_file); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_splitter_cmp */ +} /* end H5FD__splitter_cmp */ /*-------------------------------------------------------------------------- - * Function: H5FD_splitter_get_handle + * Function: H5FD__splitter_get_handle * * Purpose: Returns a pointer to the file handle of low-level virtual * file driver. @@ -1173,17 +1076,15 @@ H5FD_splitter_cmp(const H5FD_t *_f1, const H5FD_t *_f2) *-------------------------------------------------------------------------- */ static herr_t -H5FD_splitter_get_handle( - H5FD_t *_file, - hid_t H5_ATTR_UNUSED fapl, - void **file_handle) +H5FD__splitter_get_handle(H5FD_t *_file, hid_t H5_ATTR_UNUSED fapl, + void **file_handle) { H5FD_splitter_t *file = (H5FD_splitter_t*)_file; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL("H5FD_splitter_get_handle"); + H5FD_SPLITTER_LOG_CALL(FUNC); /* Check arguments */ HDassert(file); @@ -1191,18 +1092,16 @@ H5FD_splitter_get_handle( HDassert(file_handle); /* Only do for R/W channel */ - if (H5FD_get_vfd_handle(file->rw_file, file->fa.rw_fapl_id, file_handle) < 0) - { + if(H5FD_get_vfd_handle(file->rw_file, file->fa.rw_fapl_id, file_handle) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "unable to get handle of R/W file") - } done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_splitter_get_handle */ +} /* end H5FD__splitter_get_handle */ /*-------------------------------------------------------------------------- - * Function: H5FD_splitter_lock + * Function: H5FD__splitter_lock * * Purpose: Sets a file lock. * @@ -1210,37 +1109,33 @@ done: *-------------------------------------------------------------------------- */ static herr_t -H5FD_splitter_lock(H5FD_t *_file, hbool_t rw) +H5FD__splitter_lock(H5FD_t *_file, hbool_t rw) { H5FD_splitter_t *file = (H5FD_splitter_t *)_file; /* VFD file struct */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL("H5FD_splitter_lock"); + H5FD_SPLITTER_LOG_CALL(FUNC); HDassert(file); HDassert(file->rw_file); /* Place the lock on each file */ - if (H5FD_lock(file->rw_file, rw) < 0) { - HGOTO_ERROR(H5E_VFL, H5E_CANTLOCK, FAIL, "unable to lock R/W file") - } - if (file->wo_file != NULL) { - if (H5FD_lock(file->wo_file, rw) < 0) { - H5FD_SPLITTER_WO_ERROR(file, "H5FD_splitter_lock", - H5E_VFL, H5E_CANTLOCK, FAIL, - "unable to lock W/O file") - } - } + if(H5FD_lock(file->rw_file, rw) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTLOCKFILE, FAIL, "unable to lock R/W file") + + if(file->wo_file != NULL) + if(H5FD_lock(file->wo_file, rw) < 0) + H5FD_SPLITTER_WO_ERROR(file, FUNC, H5E_VFL, H5E_CANTLOCKFILE, FAIL, "unable to lock W/O file") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_splitter_lock */ +} /* end H5FD__splitter_lock */ /*-------------------------------------------------------------------------- - * Function: H5FD_splitter_unlock + * Function: H5FD__splitter_unlock * * Purpose: Removes a file lock. * @@ -1248,37 +1143,34 @@ done: *-------------------------------------------------------------------------- */ static herr_t -H5FD_splitter_unlock(H5FD_t *_file) +H5FD__splitter_unlock(H5FD_t *_file) { H5FD_splitter_t *file = (H5FD_splitter_t *)_file; /* VFD file struct */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL("H5FD_splitter_unlock"); + H5FD_SPLITTER_LOG_CALL(FUNC); /* Check arguments */ HDassert(file); HDassert(file->rw_file); /* Remove the lock on each file */ - if (H5FD_unlock(file->rw_file) < 0) { - HGOTO_ERROR(H5E_VFL, H5E_CANTUNLOCK, FAIL, "unable to unlock R/W file") - } - if (file->wo_file != NULL) { - if (H5FD_unlock(file->wo_file) < 0) { - HGOTO_ERROR(H5E_VFL, H5E_CANTUNLOCK, FAIL, - "unable to unlock W/O file") - } - } + if(H5FD_unlock(file->rw_file) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTUNLOCKFILE, FAIL, "unable to unlock R/W file") + + if(file->wo_file != NULL) + if(H5FD_unlock(file->wo_file) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTUNLOCKFILE, FAIL, "unable to unlock W/O file") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_splitter_unlock */ +} /* end H5FD__splitter_unlock */ /*------------------------------------------------------------------------- - * Function: H5FD_splitter_query + * Function: H5FD__splitter_query * * Purpose: Set the flags that this VFL driver is capable of supporting. * (listed in H5FDpublic.h) @@ -1287,40 +1179,37 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_splitter_query(const H5FD_t *_file, unsigned long *flags /* out */) +H5FD__splitter_query(const H5FD_t *_file, unsigned long *flags /* out */) { const H5FD_splitter_t *file = (const H5FD_splitter_t *)_file; herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL("H5FD_splitter_query"); + H5FD_SPLITTER_LOG_CALL(FUNC); - if (file) { + if(file) { HDassert(file); HDassert(file->rw_file); - if (H5FDquery(file->rw_file, flags) < 0) { - HGOTO_ERROR(H5E_VFL, H5E_CANTLOCK, FAIL, - "unable to query R/W file"); - } + if(H5FDquery(file->rw_file, flags) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTLOCK, FAIL, "unable to query R/W file"); } else { /* There is no file. Because this is a pure passthrough VFD, * it has no features of its own. */ - if (flags) { + if(flags) *flags = 0; - } } done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_splitter_query() */ +} /* end H5FD__splitter_query() */ /*------------------------------------------------------------------------- - * Function: H5FD_splitter_alloc + * Function: H5FD__splitter_alloc * * Purpose: Allocate file memory. * @@ -1328,37 +1217,33 @@ done: *------------------------------------------------------------------------- */ static haddr_t -H5FD_splitter_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size) +H5FD__splitter_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size) { H5FD_splitter_t *file = (H5FD_splitter_t *)_file; /* VFD file struct */ haddr_t ret_value = HADDR_UNDEF; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL("H5FD_splitter_alloc"); + H5FD_SPLITTER_LOG_CALL(FUNC); /* Check arguments */ HDassert(file); HDassert(file->rw_file); /* Allocate memory for each file, only return the return value for R/W file. */ - if ((ret_value = H5FDalloc(file->rw_file, type, dxpl_id, size)) == HADDR_UNDEF) { + if((ret_value = H5FDalloc(file->rw_file, type, dxpl_id, size)) == HADDR_UNDEF) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "unable to allocate for R/W file") - } - if (H5FDalloc(file->wo_file, type, dxpl_id, size) == HADDR_UNDEF) { - H5FD_SPLITTER_WO_ERROR(file, "H5FD_splitter_alloc", - H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, - "unable to alloc for W/O file") - } + if(H5FDalloc(file->wo_file, type, dxpl_id, size) == HADDR_UNDEF) + H5FD_SPLITTER_WO_ERROR(file, FUNC, H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "unable to alloc for W/O file") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_splitter_alloc() */ +} /* end H5FD__splitter_alloc() */ /*------------------------------------------------------------------------- - * Function: H5FD_splitter_get_type_map + * Function: H5FD__splitter_get_type_map * * Purpose: Retrieve the memory type mapping for this file * @@ -1366,31 +1251,30 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_splitter_get_type_map(const H5FD_t *_file, H5FD_mem_t *type_map) +H5FD__splitter_get_type_map(const H5FD_t *_file, H5FD_mem_t *type_map) { const H5FD_splitter_t *file = (const H5FD_splitter_t *)_file; herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL("H5FD_splitter_get_type_map"); + H5FD_SPLITTER_LOG_CALL(FUNC); /* Check arguments */ HDassert(file); HDassert(file->rw_file); /* Retrieve memory type mapping for R/W channel only */ - if (H5FD_get_fs_type_map(file->rw_file, type_map) < 0) { + if(H5FD_get_fs_type_map(file->rw_file, type_map) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "unable to allocate for R/W file") - } done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_splitter_get_type_map() */ +} /* end H5FD__splitter_get_type_map() */ /*------------------------------------------------------------------------- - * Function: H5FD_splitter_free + * Function: H5FD__splitter_free * * Purpose: Free the resources for the splitter VFD. * @@ -1398,32 +1282,28 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_splitter_free(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t size) +H5FD__splitter_free(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t size) { H5FD_splitter_t *file = (H5FD_splitter_t *)_file; /* VFD file struct */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL("H5FD_splitter_free"); + H5FD_SPLITTER_LOG_CALL(FUNC); /* Check arguments */ HDassert(file); HDassert(file->rw_file); - if (H5FDfree(file->rw_file, type, dxpl_id, addr, size) < 0) { + if(H5FDfree(file->rw_file, type, dxpl_id, addr, size) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "unable to free for R/W file") - } - if (H5FDfree(file->wo_file, type, dxpl_id, addr, size) < 0) { - H5FD_SPLITTER_WO_ERROR(file, "H5FD_splitter_free", - H5E_VFL, H5E_CANTINIT, FAIL, - "unable to free for W/O file") - } + if(H5FDfree(file->wo_file, type, dxpl_id, addr, size) < 0) + H5FD_SPLITTER_WO_ERROR(file, FUNC, H5E_VFL, H5E_CANTINIT, FAIL, "unable to free for W/O file") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_splitter_free() */ +} /* end H5FD__splitter_free() */ /*------------------------------------------------------------------------- @@ -1437,33 +1317,29 @@ done: static herr_t H5FD__splitter_log_error(const H5FD_splitter_t *file, const char *atfunc, const char *msg) { - size_t size = 0; - char *s = NULL; herr_t ret_value = SUCCEED; FUNC_ENTER_STATIC_NOERR - H5FD_SPLITTER_LOG_CALL("H5FD__splitter_log_error"); + H5FD_SPLITTER_LOG_CALL(FUNC); /* Check arguments */ HDassert(file); HDassert(atfunc && *atfunc); HDassert(msg && *msg); - if (file->logfp != NULL) { - size = strlen(atfunc) + strlen(msg) + 3; /* ':', ' ', '\n' */ - s = (char *)malloc(sizeof(char) * (size+1)); - if (NULL == s) { + if(file->logfp != NULL) { + size_t size; + char *s; + + size = HDstrlen(atfunc) + HDstrlen(msg) + 3; /* ':', ' ', '\n' */ + s = (char *)HDmalloc(sizeof(char) * (size + 1)); + if(NULL == s) ret_value = FAIL; - } - else - if (size < (size_t)HDsnprintf(s, size+1, "%s: %s\n", atfunc, msg)) { + else if(size < (size_t)HDsnprintf(s, size+1, "%s: %s\n", atfunc, msg)) ret_value = FAIL; - } - else - if (size != HDfwrite(s, 1, size, file->logfp)) { + else if(size != HDfwrite(s, 1, size, file->logfp)) ret_value = FAIL; - } HDfree(s); } diff --git a/src/H5FDstdio.c b/src/H5FDstdio.c index 0d4188a..5547a30 100644 --- a/src/H5FDstdio.c +++ b/src/H5FDstdio.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Robb Matzke +/* Programmer: Robb Matzke * Wednesday, October 22, 1997 * * Purpose: The C STDIO virtual file driver which only uses calls from stdio.h. @@ -52,6 +52,9 @@ /* The driver identification number, initialized at runtime */ static hid_t H5FD_STDIO_g = 0; +/* Whether to ignore file locks when disabled (env var value) */ +static htri_t ignore_disabled_file_locks_s = -1; + /* The maximum number of bytes which can be written in a single I/O operation */ static size_t H5_STDIO_MAX_IO_BYTES_g = (size_t)-1; @@ -82,6 +85,7 @@ typedef struct H5FD_stdio_t { haddr_t eof; /* end of file; current file size */ haddr_t pos; /* current file I/O position */ unsigned write_access; /* Flag to indicate the file was opened with write access */ + hbool_t ignore_disabled_file_locks; H5FD_stdio_file_op op; /* last operation */ #ifndef H5_HAVE_WIN32_API /* On most systems the combination of device and i-node number uniquely @@ -233,11 +237,23 @@ static const H5FD_class_t H5FD_stdio_g = { hid_t H5FD_stdio_init(void) { + char *lock_env_var = NULL; /* Environment variable pointer */ + /* Clear the error stack */ H5Eclear2(H5E_DEFAULT); - if (H5I_VFL!=H5Iget_type(H5FD_STDIO_g)) + /* Check the use disabled file locks environment variable */ + lock_env_var = getenv("HDF5_USE_FILE_LOCKING"); + if(lock_env_var && !strcmp(lock_env_var, "BEST_EFFORT")) + ignore_disabled_file_locks_s = 1; /* Override: Ignore disabled locks */ + else if(lock_env_var && (!strcmp(lock_env_var, "TRUE") || !strcmp(lock_env_var, "1"))) + ignore_disabled_file_locks_s = 0; /* Override: Don't ignore disabled locks */ + else + ignore_disabled_file_locks_s = -1; /* Environment variable not set, or not set correctly */ + + if (H5I_VFL != H5Iget_type(H5FD_STDIO_g)) H5FD_STDIO_g = H5FDregister(&H5FD_stdio_g); + return H5FD_STDIO_g; } /* end H5FD_stdio_init() */ @@ -320,7 +336,7 @@ H5Pset_fapl_stdio(hid_t fapl_id) *------------------------------------------------------------------------- */ static H5FD_t * -H5FD_stdio_open( const char *name, unsigned flags, hid_t /*UNUSED*/ fapl_id, +H5FD_stdio_open( const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) { FILE *f = NULL; @@ -398,6 +414,21 @@ H5FD_stdio_open( const char *name, unsigned flags, hid_t /*UNUSED*/ fapl_id, file->eof = (haddr_t)x; } + /* Check the file locking flags in the fapl */ + if(ignore_disabled_file_locks_s != -1) + /* The environment variable was set, so use that preferentially */ + file->ignore_disabled_file_locks = ignore_disabled_file_locks_s; + else { + hbool_t unused; + + /* Use the value in the property list */ + if(H5Pget_file_locking(fapl_id, &unused, &file->ignore_disabled_file_locks) < 0) { + free(file); + fclose(f); + H5Epush_ret(func, H5E_ERR_CLS, H5E_FILE, H5E_CANTGET, "unable to get use disabled file locks property", NULL); + } + } + /* Get the file descriptor (needed for truncate and some Windows information) */ #ifdef H5_HAVE_WIN32_API file->fd = _fileno(file->fp); @@ -1106,10 +1137,13 @@ H5FD_stdio_lock(H5FD_t *_file, hbool_t rw) /* Place a non-blocking lock on the file */ if(flock(file->fd, lock_flags | LOCK_NB) < 0) { - if(ENOSYS == errno) - H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_FCNTL, "file locking disabled on this file system (use HDF5_USE_FILE_LOCKING environment variable to override)", -1) + if(file->ignore_disabled_file_locks && ENOSYS == errno) + /* When errno is set to ENOSYS, the file system does not support + * locking, so ignore it. + */ + errno = 0; else - H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_FCNTL, "file lock failed", -1) + H5Epush_ret(func, H5E_ERR_CLS, H5E_VFL, H5E_CANTLOCKFILE, "file lock failed", -1) } /* end if */ /* Flush the stream */ @@ -1154,10 +1188,13 @@ H5FD_stdio_unlock(H5FD_t *_file) /* Place a non-blocking lock on the file */ if(flock(file->fd, LOCK_UN) < 0) { - if(ENOSYS == errno) - H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_FCNTL, "file locking disabled on this file system (use HDF5_USE_FILE_LOCKING environment variable to override)", -1) + if(file->ignore_disabled_file_locks && ENOSYS == errno) + /* When errno is set to ENOSYS, the file system does not support + * locking, so ignore it. + */ + errno = 0; else - H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_FCNTL, "file unlock failed", -1) + H5Epush_ret(func, H5E_ERR_CLS, H5E_VFL, H5E_CANTUNLOCKFILE, "file unlock failed", -1) } /* end if */ #endif /* H5_HAVE_FLOCK */ diff --git a/src/H5FDstdio.h b/src/H5FDstdio.h index f99aacf..9a5bc78 100644 --- a/src/H5FDstdio.h +++ b/src/H5FDstdio.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, August 2, 1999 * * Purpose: The public header file for the sec2 driver. diff --git a/src/H5FDtest.c b/src/H5FDtest.c index 2eb176d..7afc1bf 100644 --- a/src/H5FDtest.c +++ b/src/H5FDtest.c @@ -110,6 +110,5 @@ H5FD__supports_swmr_test(const char *vfd_name) ret_value = !HDstrcmp(vfd_name, "log") || !HDstrcmp(vfd_name, "sec2"); FUNC_LEAVE_NOAPI(ret_value) - } /* end H5FD__supports_swmr_test() */ diff --git a/src/H5FDwindows.h b/src/H5FDwindows.h index 5cf68a1..5e23712 100644 --- a/src/H5FDwindows.h +++ b/src/H5FDwindows.h @@ -12,8 +12,8 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Scott Wegner - * Based on code by Robb Matzke + * Programmer: Scott Wegner + * Based on code by Robb Matzke * Thursday, May 24 2007 * * Purpose: The public header file for the windows driver. diff --git a/src/H5FL.c b/src/H5FL.c index 66d27fb..e50616a 100644 --- a/src/H5FL.c +++ b/src/H5FL.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, March 23, 2000 * * Purpose: Manage priority queues of free-lists (of blocks of bytes). diff --git a/src/H5FLmodule.h b/src/H5FLmodule.h index 48b8d2b..dbce75c 100644 --- a/src/H5FLmodule.h +++ b/src/H5FLmodule.h @@ -11,7 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, September 12, 2015 * * Purpose: This file contains declarations which define macros for the diff --git a/src/H5FLprivate.h b/src/H5FLprivate.h index 94a51e5..a2c019a 100644 --- a/src/H5FLprivate.h +++ b/src/H5FLprivate.h @@ -15,12 +15,10 @@ * * Created: H5FLprivate.h * Mar 23 2000 - * Quincey Koziol + * Quincey Koziol * * Purpose: Private non-prototype header. * - * Modifications: - * *------------------------------------------------------------------------- */ #ifndef _H5FLprivate_H diff --git a/src/H5FS.c b/src/H5FS.c index 6d574c0..cb60c0e 100644 --- a/src/H5FS.c +++ b/src/H5FS.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, May 2, 2006 * * Purpose: Free space tracking functions. @@ -787,9 +787,6 @@ H5FS__dirty(H5FS_t *fspace) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE -#ifdef QAK -HDfprintf(stderr, "%s: Marking free space header as dirty\n", FUNC); -#endif /* QAK */ /* Sanity check */ HDassert(fspace); @@ -1206,9 +1203,6 @@ void H5FS__assert(const H5FS_t *fspace) { FUNC_ENTER_PACKAGE_NOERR -#ifdef QAK -HDfprintf(stderr, "%s: fspace->tot_sect_count = %Hu\n", "H5FS__assert", fspace->tot_sect_count); -#endif /* QAK */ /* Checks for section info, if it's available */ if(fspace->sinfo) { @@ -1224,9 +1218,6 @@ HDfprintf(stderr, "%s: fspace->tot_sect_count = %Hu\n", "H5FS__assert", fspace-> HDassert(fspace->tot_sect_count >= fspace->serial_sect_count); HDassert(fspace->tot_sect_count >= fspace->ghost_sect_count); HDassert(fspace->tot_sect_count == (fspace->serial_sect_count + fspace->ghost_sect_count)); -#ifdef QAK - HDassert(fspace->serial_sect_count > 0 || fspace->ghost_sect_count == 0); -#endif /* QAK */ FUNC_LEAVE_NOAPI_VOID } /* end H5FS__assert() */ diff --git a/src/H5FScache.c b/src/H5FScache.c index c3e3998..4c75fb1 100644 --- a/src/H5FScache.c +++ b/src/H5FScache.c @@ -15,7 +15,7 @@ * * Created: H5FScache.c * May 2 2006 - * Quincey Koziol + * Quincey Koziol * * Purpose: Implement file free space metadata cache methods. * @@ -163,7 +163,6 @@ const H5AC_class_t H5AC_FSPACE_SINFO[1] = {{ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * August 14, 2013 * *------------------------------------------------------------------------- @@ -235,7 +234,6 @@ H5FS__cache_hdr_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSE * Failure: NULL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * August 18 2013 * *------------------------------------------------------------------------- @@ -350,7 +348,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * August 14, 2013 * *------------------------------------------------------------------------- @@ -796,7 +793,6 @@ H5FS__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_NDEBUG_UN * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@lbl.gov * January 3, 2017 * *------------------------------------------------------------------------- @@ -860,7 +856,6 @@ done: * Failure: FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 2 2006 * *------------------------------------------------------------------------- @@ -1132,7 +1127,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * August 14, 2013 * *------------------------------------------------------------------------- diff --git a/src/H5FSdbg.c b/src/H5FSdbg.c index c615b68..9708e9e 100644 --- a/src/H5FSdbg.c +++ b/src/H5FSdbg.c @@ -15,7 +15,7 @@ * * Created: H5FSdbg.c * May 9 2006 - * Quincey Koziol + * Quincey Koziol * * Purpose: Dump debugging information about a free space manager * diff --git a/src/H5FSint.c b/src/H5FSint.c index 6ba5748..926b818 100644 --- a/src/H5FSint.c +++ b/src/H5FSint.c @@ -15,7 +15,7 @@ * * Created: H5FSint.c * Fall 2012 - * Dana Robinson + * Dana Robinson * * Purpose: Internal routines for free space managers. * diff --git a/src/H5FSmodule.h b/src/H5FSmodule.h index b2869dd..88c663b 100644 --- a/src/H5FSmodule.h +++ b/src/H5FSmodule.h @@ -11,7 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, September 12, 2015 * * Purpose: This file contains declarations which define macros for the diff --git a/src/H5FSpkg.h b/src/H5FSpkg.h index 2c56ab6..0cc328e 100644 --- a/src/H5FSpkg.h +++ b/src/H5FSpkg.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, May 2, 2006 * * Purpose: This file contains declarations which are visible only within diff --git a/src/H5FSprivate.h b/src/H5FSprivate.h index d2e1f90..e02a8e2 100644 --- a/src/H5FSprivate.h +++ b/src/H5FSprivate.h @@ -15,7 +15,7 @@ * * Created: H5FSprivate.h * May 2 2006 - * Quincey Koziol + * Quincey Koziol * * Purpose: Private header for library accessible file free space routines. * diff --git a/src/H5FSsection.c b/src/H5FSsection.c index d783901..62263f2 100644 --- a/src/H5FSsection.c +++ b/src/H5FSsection.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, July 31, 2006 * * Purpose: Free space tracking functions. @@ -518,12 +518,6 @@ H5FS__sect_serialize_size(H5FS_t *fspace) /* Check arguments. */ HDassert(fspace); -#ifdef QAK -HDfprintf(stderr, "%s: Check 1.0 - fspace->sect_size = %Hu\n", "H5FS__sect_serialize_size", fspace->sect_size); -HDfprintf(stderr, "%s: fspace->serial_sect_count = %Zu\n", "H5FS__sect_serialize_size", fspace->serial_sect_count); -HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu\n", "H5FS__sect_serialize_size", fspace->alloc_sect_size); -HDfprintf(stderr, "%s: fspace->sinfo->serial_size_count = %Zu\n", "H5FS__sect_serialize_size", fspace->sinfo->serial_size_count); -#endif /* QAK */ /* Compute the size of the buffer required to serialize all the sections */ if(fspace->serial_sect_count > 0) { @@ -533,10 +527,6 @@ HDfprintf(stderr, "%s: fspace->sinfo->serial_size_count = %Zu\n", "H5FS__sect_se sect_buf_size = fspace->sinfo->sect_prefix_size; /* Count for each differently sized serializable section */ -#ifdef QAK -HDfprintf(stderr, "%s: fspace->sinfo->serial_size_count = %Zu\n", "H5FS__sect_serialize_size", fspace->sinfo->serial_size_count); -HDfprintf(stderr, "%s: fspace->serial_sect_count = %Hu\n", "H5FS__sect_serialize_size", fspace->serial_sect_count); -#endif /* QAK */ sect_buf_size += fspace->sinfo->serial_size_count * H5VM_limit_enc_size((uint64_t)fspace->serial_sect_count); /* Size for each differently sized serializable section */ @@ -604,10 +594,6 @@ H5FS__sect_increase(H5FS_t *fspace, const H5FS_section_class_t *cls, fspace->serial_sect_count++; /* Increment amount of space required to serialize all sections */ -#ifdef QAK -HDfprintf(stderr, "%s: sinfo->serial_size = %Zu\n", FUNC, fspace->sinfo->serial_size); -HDfprintf(stderr, "%s: cls->serial_size = %Zu\n", FUNC, cls->serial_size); -#endif /* QAK */ fspace->sinfo->serial_size += cls->serial_size; /* Update the free space sections' serialized size */ @@ -664,10 +650,6 @@ H5FS__sect_decrease(H5FS_t *fspace, const H5FS_section_class_t *cls) fspace->serial_sect_count--; /* Decrement amount of space required to serialize all sections */ -#ifdef QAK -HDfprintf(stderr, "%s: fspace->serial_size = %Zu\n", FUNC, fspace->sinfo->serial_size); -HDfprintf(stderr, "%s: cls->serial_size = %Zu\n", FUNC, cls->serial_size); -#endif /* QAK */ fspace->sinfo->serial_size -= cls->serial_size; /* Update the free space sections' serialized size */ @@ -710,9 +692,6 @@ H5FS__size_node_decr(H5FS_sinfo_t *sinfo, unsigned bin, H5FS_node_t *fspace_node * the bin's skiplist is also a skiplist...) */ sinfo->bins[bin].tot_sect_count--; -#ifdef QAK -HDfprintf(stderr, "%s: sinfo->bins[%u].sect_count = %Zu\n", FUNC, bin, sinfo->bins[bin].sect_count); -#endif /* QAK */ /* Check for 'ghost' or 'serializable' section */ if(cls->flags & H5FS_CLS_GHOST_OBJ) { @@ -853,9 +832,6 @@ H5FS__sect_unlink_rest(H5FS_t *fspace, const H5FS_section_class_t *cls, if(!(cls->flags & H5FS_CLS_SEPAR_OBJ)) { H5FS_section_info_t *tmp_sect_node; /* Temporary section node */ -#ifdef QAK -HDfprintf(stderr, "%s: removing object from merge list, sect->type = %u\n", FUNC, (unsigned)sect->type); -#endif /* QAK */ tmp_sect_node = (H5FS_section_info_t *)H5SL_remove(fspace->sinfo->merge_list, §->addr); if(tmp_sect_node == NULL || tmp_sect_node != sect) HGOTO_ERROR(H5E_FSPACE, H5E_NOTFOUND, FAIL, "can't find section node on size list") @@ -866,9 +842,6 @@ HDfprintf(stderr, "%s: removing object from merge list, sect->type = %u\n", FUNC HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't increase free space section size on disk") /* Decrement amount of free space managed */ -#ifdef QAK -HDfprintf(stderr, "%s: fspace->tot_space = %Hu\n", FUNC, fspace->tot_space); -#endif /* QAK */ fspace->tot_space -= sect->size; done: @@ -982,9 +955,6 @@ H5FS__sect_link_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls, herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC -#ifdef QAK -HDfprintf(stderr, "%s: sect->size = %Hu, sect->addr = %a\n", FUNC, sect->size, sect->addr); -#endif /* QAK */ /* Check arguments. */ HDassert(sinfo); @@ -999,10 +969,9 @@ HDfprintf(stderr, "%s: sect->size = %Hu, sect->addr = %a\n", FUNC, sect->size, s if(NULL == (sinfo->bins[bin].bin_list = H5SL_create(H5SL_TYPE_HSIZE, NULL))) HGOTO_ERROR(H5E_FSPACE, H5E_CANTCREATE, FAIL, "can't create skip list for free space nodes") } /* end if */ - else { + else /* Check for node list of the correct size already */ fspace_node = (H5FS_node_t *)H5SL_search(sinfo->bins[bin].bin_list, §->size); - } /* end else */ /* Check if we need to create a new skip list for nodes of this size */ if(fspace_node == NULL) { @@ -1030,9 +999,6 @@ HDfprintf(stderr, "%s: sect->size = %Hu, sect->addr = %a\n", FUNC, sect->size, s /* (Different from the # of items in the bin's skiplist, since each node on * the bin's skiplist is also a skiplist...) */ -#ifdef QAK -HDfprintf(stderr, "%s: sinfo->bins[%u].sect_count = %Zu\n", FUNC, bin, sinfo->bins[bin].sect_count); -#endif /* QAK */ sinfo->bins[bin].tot_sect_count++; if(cls->flags & H5FS_CLS_GHOST_OBJ) { sinfo->bins[bin].ghost_sect_count++; @@ -1095,9 +1061,6 @@ H5FS__sect_link_rest(H5FS_t *fspace, const H5FS_section_class_t *cls, /* Add section to the address-ordered list of sections, if allowed */ if(!(cls->flags & H5FS_CLS_SEPAR_OBJ)) { -#ifdef QAK -HDfprintf(stderr, "%s: inserting object into merge list, sect->type = %u\n", FUNC, (unsigned)sect->type); -#endif /* QAK */ if(fspace->sinfo->merge_list == NULL) if(NULL == (fspace->sinfo->merge_list = H5SL_create(H5SL_TYPE_HADDR, NULL))) HGOTO_ERROR(H5E_FSPACE, H5E_CANTCREATE, FAIL, "can't create skip list for merging free space sections") @@ -1146,21 +1109,12 @@ H5FS__sect_link(H5FS_t *fspace, H5FS_section_info_t *sect, unsigned flags) cls = &fspace->sect_cls[sect->type]; /* Add section to size tracked data structures */ -#ifdef QAK -HDfprintf(stderr, "%s: Check 1.0 - fspace->tot_space = %Hu\n", FUNC, fspace->tot_space); -#endif /* QAK */ if(H5FS__sect_link_size(fspace->sinfo, cls, sect) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't add section to size tracking data structures") -#ifdef QAK -HDfprintf(stderr, "%s: Check 2.0 - fspace->tot_space = %Hu\n", FUNC, fspace->tot_space); -#endif /* QAK */ /* Update rest of free space manager data structures for section addition */ if(H5FS__sect_link_rest(fspace, cls, sect, flags) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't add section to non-size tracking data structures") -#ifdef QAK -HDfprintf(stderr, "%s: Check 3.0 - fspace->tot_space = %Hu\n", FUNC, fspace->tot_space); -#endif /* QAK */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -1304,9 +1258,6 @@ H5FS__sect_merge(H5FS_t *fspace, H5FS_section_info_t **sect, void *op_data) } while(modified); } /* end if */ HDassert(*sect); -#ifdef QAK -HDfprintf(stderr, "%s: Done merging, (*sect) = {%a, %Hu, %u, %s}\n", FUNC, (*sect)->addr, (*sect)->size, (*sect)->type, ((*sect)->state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -#endif /* QAK */ /* Loop until no more shrinking */ do { @@ -1319,10 +1270,6 @@ HDfprintf(stderr, "%s: Done merging, (*sect) = {%a, %Hu, %u, %s}\n", FUNC, (*sec if((status = (*sect_cls->can_shrink)(*sect, op_data)) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTSHRINK, FAIL, "can't check for shrinking container") if(status > 0) { -#ifdef QAK -HDfprintf(stderr, "%s: Can shrink!\n", FUNC); -#endif /* QAK */ - /* Remove SECT from free-space manager */ /* (only possible to happen on second+ pass through loop) */ if(remove_sect) { @@ -1365,18 +1312,7 @@ HDfprintf(stderr, "%s: Can shrink!\n", FUNC); if(remove_sect && (*sect != NULL)) *sect = NULL; -#ifdef QAK -HDfprintf(stderr, "%s: Done shrinking\n", FUNC); -if(*sect) - HDfprintf(stderr, "%s: (*sect) = {%a, %Hu, %u, %s}\n", FUNC, (*sect)->addr, (*sect)->size, (*sect)->type, ((*sect)->state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -else - HDfprintf(stderr, "%s: *sect = %p\n", FUNC, *sect); -#endif /* QAK */ - done: -#ifdef QAK -HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", FUNC, ret_value); -#endif /* QAK */ FUNC_LEAVE_NOAPI(ret_value) } /* H5FS__sect_merge() */ @@ -1706,10 +1642,6 @@ H5FS__sect_find_node(H5FS_t *fspace, hsize_t request, H5FS_section_info_t **node /* Determine correct bin which holds items of at least the section's size */ bin = H5VM_log2_gen(request); HDassert(bin < fspace->sinfo->nbins); -#ifdef QAK -HDfprintf(stderr, "%s: fspace->sinfo->nbins = %u\n", FUNC, fspace->sinfo->nbins); -HDfprintf(stderr, "%s: bin = %u\n", FUNC, bin); -#endif /* QAK */ alignment = fspace->alignment; if(!((alignment > 1) && (request >= fspace->align_thres))) alignment = 0; /* no alignment */ @@ -1841,10 +1773,6 @@ H5FS_sect_find(H5F_t *f, H5FS_t *fspace, hsize_t request, H5FS_section_info_t ** FUNC_ENTER_NOAPI(FAIL) -#ifdef QAK -HDfprintf(stderr, "%s: request = %Hu\n", FUNC, request); -#endif /* QAK */ - /* Check arguments. */ HDassert(fspace); HDassert(fspace->nclasses); @@ -1852,11 +1780,6 @@ HDfprintf(stderr, "%s: request = %Hu\n", FUNC, request); HDassert(node); /* Check for any sections on free space list */ -#ifdef QAK -HDfprintf(stderr, "%s: fspace->tot_sect_count = %Hu\n", FUNC, fspace->tot_sect_count); -HDfprintf(stderr, "%s: fspace->serial_sect_count = %Hu\n", FUNC, fspace->serial_sect_count); -HDfprintf(stderr, "%s: fspace->ghost_sect_count = %Hu\n", FUNC, fspace->ghost_sect_count); -#endif /* QAK */ if(fspace->tot_sect_count > 0) { /* Get a pointer to the section info */ if(H5FS__sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0) @@ -1871,9 +1794,6 @@ HDfprintf(stderr, "%s: fspace->ghost_sect_count = %Hu\n", FUNC, fspace->ghost_se if(ret_value > 0) { /* Note that we've modified the section info */ sinfo_modified = TRUE; -#ifdef QAK -HDfprintf(stderr, "%s: (*node)->size = %Hu, (*node)->addr = %a, (*node)->type = %u\n", FUNC, (*node)->size, (*node)->addr, (*node)->type); -#endif /* QAK */ } /* end if */ } /* end if */ @@ -1890,7 +1810,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_iterate_sect_cb + * Function: H5FS__iterate_sect_cb * * Purpose: Skip list iterator callback to iterate over free space sections * of a particular size @@ -1903,13 +1823,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FS_iterate_sect_cb(void *_item, void H5_ATTR_UNUSED *key, void *_udata) +H5FS__iterate_sect_cb(void *_item, void H5_ATTR_UNUSED *key, void *_udata) { H5FS_section_info_t *sect_info = (H5FS_section_info_t *)_item; /* Free space section to work on */ H5FS_iter_ud_t *udata = (H5FS_iter_ud_t *)_udata; /* Callback info */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(sect_info); @@ -1922,11 +1842,11 @@ H5FS_iterate_sect_cb(void *_item, void H5_ATTR_UNUSED *key, void *_udata) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5FS_iterate_sect_cb() */ +} /* H5FS__iterate_sect_cb() */ /*------------------------------------------------------------------------- - * Function: H5FS_iterate_node_cb + * Function: H5FS__iterate_node_cb * * Purpose: Skip list iterator callback to iterate over free space sections * in a bin @@ -1939,13 +1859,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FS_iterate_node_cb(void *_item, void H5_ATTR_UNUSED *key, void *_udata) +H5FS__iterate_node_cb(void *_item, void H5_ATTR_UNUSED *key, void *_udata) { H5FS_node_t *fspace_node = (H5FS_node_t *)_item; /* Free space size node to work on */ H5FS_iter_ud_t *udata = (H5FS_iter_ud_t *)_udata; /* Callback info */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(fspace_node); @@ -1954,12 +1874,12 @@ H5FS_iterate_node_cb(void *_item, void H5_ATTR_UNUSED *key, void *_udata) /* Iterate through all the sections of this size */ HDassert(fspace_node->sect_list); - if(H5SL_iterate(fspace_node->sect_list, H5FS_iterate_sect_cb, udata) < 0) + if(H5SL_iterate(fspace_node->sect_list, H5FS__iterate_sect_cb, udata) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_BADITER, FAIL, "can't iterate over section nodes") done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5FS_iterate_node_cb() */ +} /* H5FS__iterate_node_cb() */ /*------------------------------------------------------------------------- @@ -1987,10 +1907,6 @@ H5FS_sect_iterate(H5F_t *f, H5FS_t *fspace, H5FS_operator_t op, void *op_data) HDassert(fspace); HDassert(op); -#ifdef QAK -HDfprintf(stderr, "%s: fspace->tot_sect_count = %Hu\n", FUNC, fspace->tot_sect_count); -#endif /* QAK */ - /* Set up user data for iterator */ udata.fspace = fspace; udata.op = op; @@ -2006,14 +1922,11 @@ HDfprintf(stderr, "%s: fspace->tot_sect_count = %Hu\n", FUNC, fspace->tot_sect_c sinfo_valid = TRUE; /* Iterate over all the bins */ -#ifdef QAK -HDfprintf(stderr, "%s: Iterate over section bins\n", FUNC); -#endif /* QAK */ for(bin = 0; bin < fspace->sinfo->nbins; bin++) { /* Check if there are any sections in this bin */ if(fspace->sinfo->bins[bin].bin_list) { /* Iterate over list of section size nodes for bin */ - if(H5SL_iterate(fspace->sinfo->bins[bin].bin_list, H5FS_iterate_node_cb, &udata) < 0) + if(H5SL_iterate(fspace->sinfo->bins[bin].bin_list, H5FS__iterate_node_cb, &udata) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_BADITER, FAIL, "can't iterate over section size nodes") } /* end if */ } /* end for */ @@ -2098,10 +2011,6 @@ H5FS_sect_change_class(H5F_t *f, H5FS_t *fspace, H5FS_section_info_t *sect, old_class = sect->type; old_cls = &fspace->sect_cls[sect->type]; new_cls = &fspace->sect_cls[new_class]; -#ifdef QAK -HDfprintf(stderr, "%s: old_cls->flags = %x\n", FUNC, old_cls->flags); -HDfprintf(stderr, "%s: new_cls->flags = %x\n", FUNC, new_cls->flags); -#endif /* QAK */ /* Check if the section's class change will affect the # of serializable or ghost sections */ if((old_cls->flags & H5FS_CLS_GHOST_OBJ) != (new_cls->flags & H5FS_CLS_GHOST_OBJ)) { @@ -2114,9 +2023,6 @@ HDfprintf(stderr, "%s: new_cls->flags = %x\n", FUNC, new_cls->flags); to_ghost = FALSE; else to_ghost = TRUE; -#ifdef QAK -HDfprintf(stderr, "%s: to_ghost = %u\n", FUNC, to_ghost); -#endif /* QAK */ /* Sanity check */ HDassert(fspace->sinfo->bins); @@ -2180,15 +2086,9 @@ HDfprintf(stderr, "%s: to_ghost = %u\n", FUNC, to_ghost); to_mergable = TRUE; else to_mergable = FALSE; -#ifdef QAK -HDfprintf(stderr, "%s: to_mergable = %u\n", FUNC, to_mergable); -#endif /* QAK */ /* Add or remove section from merge list, as appropriate */ if(to_mergable) { -#ifdef QAK -HDfprintf(stderr, "%s: inserting object into merge list, sect->type = %u\n", FUNC, (unsigned)sect->type); -#endif /* QAK */ if(fspace->sinfo->merge_list == NULL) if(NULL == (fspace->sinfo->merge_list = H5SL_create(H5SL_TYPE_HADDR, NULL))) HGOTO_ERROR(H5E_FSPACE, H5E_CANTCREATE, FAIL, "can't create skip list for merging free space sections") @@ -2198,9 +2098,6 @@ HDfprintf(stderr, "%s: inserting object into merge list, sect->type = %u\n", FUN else { H5FS_section_info_t *tmp_sect_node; /* Temporary section node */ -#ifdef QAK -HDfprintf(stderr, "%s: removing object from merge list, sect->type = %u\n", FUNC, (unsigned)sect->type); -#endif /* QAK */ tmp_sect_node = (H5FS_section_info_t *)H5SL_remove(fspace->sinfo->merge_list, §->addr); if(tmp_sect_node == NULL || tmp_sect_node != sect) HGOTO_ERROR(H5E_FSPACE, H5E_NOTFOUND, FAIL, "can't find section node on size list") @@ -2246,9 +2143,6 @@ H5FS__sect_assert(const H5FS_t *fspace) hsize_t separate_obj; /* The number of separate objects managed */ FUNC_ENTER_PACKAGE_NOERR -#ifdef QAK -HDfprintf(stderr, "%s: fspace->tot_sect_count = %Hu\n", "H5FS__sect_assert", fspace->tot_sect_count); -#endif /* QAK */ /* Initialize state */ separate_obj = 0; @@ -2305,9 +2199,6 @@ HDfprintf(stderr, "%s: fspace->tot_sect_count = %Hu\n", "H5FS__sect_assert", fsp /* Get section node & it's class */ sect = (H5FS_section_info_t *)H5SL_item(curr_sect_node); cls = &fspace->sect_cls[sect->type]; -#ifdef QAK -HDfprintf(stderr, "%s: sect->size = %Hu, sect->addr = %a, sect->type = %u\n", "H5FS__sect_assert", sect->size, sect->addr, sect->type); -#endif /* QAK */ /* Sanity check section */ HDassert(H5F_addr_defined(sect->addr)); @@ -2386,7 +2277,7 @@ HDfprintf(stderr, "%s: sect->size = %Hu, sect->addr = %a, sect->type = %u\n", "H * * Return: TRUE/FALSE/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * *------------------------------------------------------------------------- */ diff --git a/src/H5Faccum.c b/src/H5Faccum.c index 74a170b..02f475d 100644 --- a/src/H5Faccum.c +++ b/src/H5Faccum.c @@ -15,7 +15,7 @@ * * Created: H5Faccum.c * Jan 10 2008 - * Quincey Koziol + * Quincey Koziol * * Purpose: File metadata "accumulator" routines. (Used to * cache small metadata I/Os and group them into a @@ -105,7 +105,6 @@ H5FL_BLK_DEFINE_STATIC(meta_accum); * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jan 10 2008 * *------------------------------------------------------------------------- @@ -274,7 +273,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jun 11 2009 * *------------------------------------------------------------------------- @@ -413,7 +411,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jan 10 2008 * *------------------------------------------------------------------------- @@ -841,7 +838,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jan 10 2008 * *------------------------------------------------------------------------- @@ -1007,7 +1003,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jan 10 2008 * *------------------------------------------------------------------------- @@ -1050,7 +1045,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jan 10 2008 * *------------------------------------------------------------------------- diff --git a/src/H5Fcwfs.c b/src/H5Fcwfs.c index 26452b6..2b368d5 100644 --- a/src/H5Fcwfs.c +++ b/src/H5Fcwfs.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, July 19, 2011 * * Purpose: Each file has a small cache of global heap collections called diff --git a/src/H5Fdbg.c b/src/H5Fdbg.c index 535b43d..09f6829 100644 --- a/src/H5Fdbg.c +++ b/src/H5Fdbg.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol +/* Programmer: Quincey Koziol * Wednesday, July 9, 2003 * * Purpose: File object debugging functions. @@ -39,7 +39,6 @@ * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 1 1997 * *------------------------------------------------------------------------- diff --git a/src/H5Fdeprec.c b/src/H5Fdeprec.c index a047161..76a0991 100644 --- a/src/H5Fdeprec.c +++ b/src/H5Fdeprec.c @@ -15,7 +15,7 @@ * * Created: H5Fdeprec.c * October 1 2009 - * Quincey Koziol + * Quincey Koziol * * Purpose: Deprecated functions from the H5F interface. These * functions are here for compatibility purposes and may be diff --git a/src/H5Fefc.c b/src/H5Fefc.c index 77d29f5..c9a3a00 100644 --- a/src/H5Fefc.c +++ b/src/H5Fefc.c @@ -15,7 +15,7 @@ * * Created: H5Defc.c * December 13, 2010 - * Neil Fortner + * Neil Fortner * * Purpose: External file caching routines - implements a * cache of external files to minimize the number of diff --git a/src/H5Ffake.c b/src/H5Ffake.c index 67bd180..36fea5b 100644 --- a/src/H5Ffake.c +++ b/src/H5Ffake.c @@ -34,7 +34,6 @@ * Failure: NULL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Oct 2, 2006 * *------------------------------------------------------------------------- @@ -79,7 +78,6 @@ done: * Failure: negative * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Oct 2, 2006 * *------------------------------------------------------------------------- diff --git a/src/H5Fint.c b/src/H5Fint.c index 0bda894..7e3876f 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -76,12 +76,14 @@ typedef struct H5F_olist_t { /* Local Prototypes */ /********************/ +static herr_t H5F__close_cb(H5VL_object_t *file_vol_obj); static herr_t H5F__set_vol_conn(H5F_t *file); static herr_t H5F__get_objects(const H5F_t *f, unsigned types, size_t max_index, hid_t *obj_id_list, hbool_t app_ref, size_t *obj_id_count_ptr); static int H5F__get_objects_cb(void *obj_ptr, hid_t obj_id, void *key); static herr_t H5F__build_name(const char *prefix, const char *file_name, char **full_name/*out*/); static char *H5F__getenv_prefix_name(char **env_prefix/*in,out*/); static H5F_t *H5F__new(H5F_shared_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf); +static herr_t H5F__check_if_using_file_locks(H5P_genplist_t *fapl, hbool_t *use_file_locking); static herr_t H5F__build_actual_name(const H5F_t *f, const H5P_genplist_t *fapl, const char *name, char ** /*out*/ actual_name); static herr_t H5F__flush_phase1(H5F_t *f); static herr_t H5F__flush_phase2(H5F_t *f, hbool_t closing); @@ -91,6 +93,15 @@ static herr_t H5F__flush_phase2(H5F_t *f, hbool_t closing); /* Package Variables */ /*********************/ +/* Package initialization variable */ +hbool_t H5_PKG_INIT_VAR = FALSE; + +/* Based on the value of the HDF5_USE_FILE_LOCKING environment variable. + * TRUE/FALSE have obvious meanings. FAIL means the environment variable was + * not set, so the code should ignore it and use the fapl value instead. + */ +htri_t use_locks_env_g = FAIL; + /*****************************/ /* Library Private Variables */ @@ -107,6 +118,186 @@ H5FL_DEFINE(H5F_t); /* Declare a free list to manage the H5F_shared_t struct */ H5FL_DEFINE(H5F_shared_t); +/* File ID class */ +static const H5I_class_t H5I_FILE_CLS[1] = {{ + H5I_FILE, /* ID class value */ + 0, /* Class flags */ + 0, /* # of reserved IDs for class */ + (H5I_free_t)H5F__close_cb /* Callback routine for closing objects of this class */ +}}; + + + +/*------------------------------------------------------------------------- + * Function: H5F_init + * + * Purpose: Initialize the interface from some other layer. + * + * Return: Success: non-negative + * + * Failure: negative + *------------------------------------------------------------------------- + */ +herr_t +H5F_init(void) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + /* FUNC_ENTER() does all the work */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5F_init() */ + + +/*-------------------------------------------------------------------------- +NAME + H5F__init_package -- Initialize interface-specific information +USAGE + herr_t H5F__init_package() +RETURNS + Non-negative on success/Negative on failure +DESCRIPTION + Initializes any interface-specific data or routines. + +--------------------------------------------------------------------------*/ +herr_t +H5F__init_package(void) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* + * Initialize the atom group for the file IDs. + */ + if(H5I_register_type(H5I_FILE_CLS) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to initialize interface") + + /* Check the file locking environment variable */ + if(H5F__parse_file_lock_env_var(&use_locks_env_g) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to parse file locking environment variable") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5F__init_package() */ + + +/*------------------------------------------------------------------------- + * Function: H5F_term_package + * + * Purpose: Terminate this interface: free all memory and reset global + * variables to their initial values. Release all ID groups + * associated with this interface. + * + * Return: Success: Positive if anything was done that might + * have affected other interfaces; + * zero otherwise. + * + * Failure: Never fails + * + *------------------------------------------------------------------------- + */ +int +H5F_term_package(void) +{ + int n = 0; + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + if(H5_PKG_INIT_VAR) { + if(H5I_nmembers(H5I_FILE) > 0) { + (void)H5I_clear_type(H5I_FILE, FALSE, FALSE); + n++; /*H5I*/ + } /* end if */ + else { + /* Make certain we've cleaned up all the shared file objects */ + H5F_sfile_assert_num(0); + + /* Destroy the file object id group */ + n += (H5I_dec_type_ref(H5I_FILE) > 0); + + /* Mark closed */ + if(0 == n) + H5_PKG_INIT_VAR = FALSE; + } /* end else */ + } /* end if */ + + FUNC_LEAVE_NOAPI(n) +} /* end H5F_term_package() */ + + +/*------------------------------------------------------------------------- + * Function: H5F__close_cb + * + * Purpose: Closes a file or causes the close operation to be pended. + * This function is called from the API and gets called + * by H5Fclose->H5I_dec_ref->H5F__close_cb when H5I_dec_ref() + * decrements the file ID reference count to zero. The file ID + * is removed from the H5I_FILE group by H5I_dec_ref() just + * before H5F__close_cb() is called. If there are open object + * headers then the close is pended by moving the file to the + * H5I_FILE_CLOSING ID group (the f->closing contains the ID + * assigned to file). + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5F__close_cb(H5VL_object_t *file_vol_obj) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(file_vol_obj); + + /* Close the file */ + if(H5VL_file_close(file_vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close file") + + /* Free the VOL object */ + if(H5VL_free_object(file_vol_obj) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "unable to free VOL object") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5F__close_cb() */ + + +/*------------------------------------------------------------------------- + * Function: H5F__parse_file_lock_env_var + * + * Purpose: Parses the HDF5_USE_FILE_LOCKING environment variable. + * + * NOTE: This is done in a separate function so we can call it from + * the test code. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5F__parse_file_lock_env_var(htri_t *use_locks) +{ + char *lock_env_var = NULL; /* Environment variable pointer */ + + FUNC_ENTER_PACKAGE_NOERR + + /* Check the file locking environment variable */ + lock_env_var = HDgetenv("HDF5_USE_FILE_LOCKING"); + if(lock_env_var && (!HDstrcmp(lock_env_var, "FALSE") || !HDstrcmp(lock_env_var, "0"))) + *use_locks = FALSE; /* Override: Never use locks */ + else if(lock_env_var && (!HDstrcmp(lock_env_var, "TRUE") || !HDstrcmp(lock_env_var, "BEST_EFFORT") || !HDstrcmp(lock_env_var, "1"))) + *use_locks = TRUE; /* Override: Always use locks */ + else + *use_locks = FAIL; /* Environment variable not set, or not set correctly */ + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5F__parse_file_lock_env_var() */ /*------------------------------------------------------------------------- @@ -1426,6 +1617,52 @@ H5F__dest(H5F_t *f, hbool_t flush) /*------------------------------------------------------------------------- + * Function: H5F__check_if_using_file_locks + * + * Purpose: Determines if this file will use file locks. + * + * There are three ways that file locking can be controlled: + * + * 1) The configure/cmake option that sets the H5_USE_FILE_LOCKING + * symbol (which is used as the default fapl value). + * + * 2) The H5Pset_file_locking() API call, which will override + * the configuration default. + * + * 3) The HDF5_USE_FILE_LOCKING environment variable, which overrides + * everything above. + * + * The main reason to disable file locking is to prevent errors on file + * systems where locking is not supported or has been disabled (as is + * often the case in parallel file systems). + * + * Return: SUCCEED/FAIL + *------------------------------------------------------------------------- + */ +static herr_t +H5F__check_if_using_file_locks(H5P_genplist_t *fapl, hbool_t *use_file_locking) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Make sure the out parameter has a value */ + *use_file_locking = TRUE; + + /* Check the fapl property */ + if(H5P_get(fapl, H5F_ACS_USE_FILE_LOCKING_NAME, use_file_locking) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get use file locking flag") + + /* Check the environment variable */ + if(use_locks_env_g != FAIL) + *use_file_locking = (use_locks_env_g == TRUE) ? TRUE : FALSE; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5F__check_if_using_file_locks() */ + + +/*------------------------------------------------------------------------- * Function: H5F_open * * Purpose: Opens (or creates) a file. This function understands the @@ -1514,8 +1751,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) hbool_t set_flag = FALSE; /*set the status_flags in the superblock */ hbool_t clear = FALSE; /*clear the status_flags */ hbool_t evict_on_close; /* evict on close value from plist */ - char *lock_env_var = NULL;/*env var pointer */ - hbool_t use_file_locking; /*read from env var */ + hbool_t use_file_locking = TRUE; /* Using file locks? */ hbool_t ci_load = FALSE; /* whether MDC ci load requested */ hbool_t ci_write = FALSE; /* whether MDC CI write requested */ H5F_t *ret_value = NULL; /*actual return value */ @@ -1533,15 +1769,13 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) if(NULL == (drvr = H5FD_get_class(fapl_id))) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "unable to retrieve VFL class") - /* Check the environment variable that determines if we care - * about file locking. File locking should be used unless explicitly - * disabled. - */ - lock_env_var = HDgetenv("HDF5_USE_FILE_LOCKING"); - if(lock_env_var && !HDstrcmp(lock_env_var, "FALSE")) - use_file_locking = FALSE; - else - use_file_locking = TRUE; + /* Get the file access property list, for future queries */ + if(NULL == (a_plist = (H5P_genplist_t *)H5I_object(fapl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not file access property list") + + /* Check if we are using file locking */ + if (H5F__check_if_using_file_locks(a_plist, &use_file_locking) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "unable to get file locking flag") /* * Opening a file is a two step process. First we try to open the @@ -1618,8 +1852,8 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) if(H5FD_lock(lf, (hbool_t)((flags & H5F_ACC_RDWR) ? TRUE : FALSE)) < 0) { /* Locking failed - Closing will remove the lock */ if(H5FD_close(lf) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to close low-level file info") - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to lock the file") + HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, NULL, "unable to close low-level file info") + HGOTO_ERROR(H5E_FILE, H5E_CANTLOCKFILE, NULL, "unable to lock the file") } /* end if */ /* Create the 'top' file structure */ @@ -1651,9 +1885,14 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) shared = file->shared; lf = shared->lf; - /* Get the file access property list, for future queries */ - if(NULL == (a_plist = (H5P_genplist_t *)H5I_object(fapl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not file access property list") + /* Set the file locking flag. If the file is already open, the file + * requested file locking flag must match that of the open file. + */ + if(shared->nrefs == 1) + file->shared->use_file_locking = use_file_locking; + else if(shared->nrefs > 1) + if(file->shared->use_file_locking != use_file_locking) + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "file locking flag values don't match") /* Check if page buffering is enabled */ if(H5P_get(a_plist, H5F_ACS_PAGE_BUFFER_SIZE_NAME, &page_buf_size) < 0) @@ -1795,7 +2034,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) /* Remove the file lock for SWMR_WRITE */ if(use_file_locking && (H5F_INTENT(file) & H5F_ACC_SWMR_WRITE)) { if(H5FD_unlock(file->shared->lf) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to unlock the file") + HGOTO_ERROR(H5E_FILE, H5E_CANTUNLOCKFILE, NULL, "unable to unlock the file") } /* end if */ } /* end if */ else { /* H5F_ACC_RDONLY: check consistency of status_flags */ @@ -1854,7 +2093,7 @@ H5F__post_open(H5F_t *f) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5F__flush() */ +} /* end H5F__post_open() */ /*------------------------------------------------------------------------- @@ -1914,6 +2153,11 @@ H5F__flush_phase2(H5F_t *f, hbool_t closing) /* Sanity check arguments */ HDassert(f); + /* Inform the metadata cache that we are about to flush */ + if(H5AC_prep_for_file_flush(f) < 0) + /* Push error, but keep going*/ + HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "prep for MDC flush failed") + /* Flush the entire metadata cache */ if(H5AC_flush(f) < 0) /* Push error, but keep going*/ @@ -1946,6 +2190,11 @@ H5F__flush_phase2(H5F_t *f, hbool_t closing) H5CX_set_mpi_file_flushing(FALSE); #endif /* H5_HAVE_PARALLEL */ + /* Inform the metadata cache that we are done with the flush */ + if(H5AC_secure_from_file_flush(f) < 0) + /* Push error, but keep going*/ + HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "secure from MDC flush failed") + /* Flush out the metadata accumulator */ if(H5F__accum_flush(f->shared) < 0) /* Push error, but keep going*/ @@ -3455,6 +3704,12 @@ H5F__start_swmr_write(H5F_t *f) setup = TRUE; + /* Place an advisory lock on the file */ + if(H5F_USE_FILE_LOCKING(f)) + if(H5FD_lock(f->shared->lf, TRUE) < 0) { + HGOTO_ERROR(H5E_FILE, H5E_CANTLOCKFILE, FAIL, "unable to lock the file") + } + /* Mark superblock as dirty */ if(H5F_super_dirty(f) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark superblock as dirty") @@ -3472,10 +3727,6 @@ H5F__start_swmr_write(H5F_t *f) if(H5O_refresh_metadata_reopen(obj_ids[u], &obj_glocs[u], vol_connector, TRUE) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CLOSEERROR, FAIL, "can't refresh-close object") - /* Unlock the file */ - if(H5FD_unlock(f->shared->lf) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to unlock the file") - done: if(ret_value < 0 && setup) { @@ -3504,6 +3755,11 @@ done: HDONE_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush superblock") } /* end if */ + /* Unlock the file */ + if(H5F_USE_FILE_LOCKING(f)) + if(H5FD_unlock(f->shared->lf) < 0) + HDONE_ERROR(H5E_FILE, H5E_CANTUNLOCKFILE, FAIL, "unable to unlock the file") + /* Free memory */ if(obj_ids) H5MM_xfree(obj_ids); diff --git a/src/H5Fio.c b/src/H5Fio.c index 34dd0d6..7a901aa 100644 --- a/src/H5Fio.c +++ b/src/H5Fio.c @@ -15,7 +15,7 @@ * * Created: H5Fio.c * Jan 10 2008 - * Quincey Koziol + * Quincey Koziol * * Purpose: File I/O routines. * @@ -86,7 +86,6 @@ * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Jul 10 1997 * *------------------------------------------------------------------------- @@ -130,7 +129,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Jul 10 1997 * *------------------------------------------------------------------------- @@ -175,7 +173,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Jul 10 1997 * *------------------------------------------------------------------------- @@ -220,7 +217,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Jul 10 1997 * *------------------------------------------------------------------------- diff --git a/src/H5Fmodule.h b/src/H5Fmodule.h index 0481512..fb362fc 100644 --- a/src/H5Fmodule.h +++ b/src/H5Fmodule.h @@ -11,7 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, September 12, 2015 * * Purpose: This file contains declarations which define macros for the diff --git a/src/H5Fmount.c b/src/H5Fmount.c index 5e6b899..9d32fa5 100644 --- a/src/H5Fmount.c +++ b/src/H5Fmount.c @@ -627,7 +627,7 @@ H5F__mount_count_ids(H5F_t *f, unsigned *nopen_files, unsigned *nopen_objs) /*------------------------------------------------------------------------- - * Function: H5F_flush_mounts_recurse + * Function: H5F__flush_mounts_recurse * * Purpose: Flush a mount hierarchy, recursively * @@ -639,20 +639,20 @@ H5F__mount_count_ids(H5F_t *f, unsigned *nopen_files, unsigned *nopen_objs) *------------------------------------------------------------------------- */ static herr_t -H5F_flush_mounts_recurse(H5F_t *f) +H5F__flush_mounts_recurse(H5F_t *f) { unsigned nerrors = 0; /* Errors from recursive flushes */ unsigned u; /* Index variable */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity check */ HDassert(f); /* Flush all child files, not stopping for errors */ for(u = 0; u < f->shared->mtab.nmounts; u++) - if(H5F_flush_mounts_recurse(f->shared->mtab.child[u].file) < 0) + if(H5F__flush_mounts_recurse(f->shared->mtab.child[u].file) < 0) nerrors++; /* Call the "real" flush routine, for this file */ @@ -665,7 +665,7 @@ H5F_flush_mounts_recurse(H5F_t *f) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5F_flush_mounts_recurse() */ +} /* end H5F__flush_mounts_recurse() */ /*------------------------------------------------------------------------- @@ -695,7 +695,7 @@ H5F_flush_mounts(H5F_t *f) f = f->parent; /* Flush the mounted file hierarchy */ - if(H5F_flush_mounts_recurse(f) < 0) + if(H5F__flush_mounts_recurse(f) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush mounted file hierarchy") done: diff --git a/src/H5Fmpi.c b/src/H5Fmpi.c index 0c46f59..8189821 100644 --- a/src/H5Fmpi.c +++ b/src/H5Fmpi.c @@ -15,7 +15,7 @@ * * Created: H5Fmpi.c * Jan 10 2008 - * Quincey Koziol + * Quincey Koziol * * Purpose: MPI-related routines. * diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index 46185ff..30306d8 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, September 28, 2000 * * Purpose: This file contains declarations which are visible only within @@ -306,6 +306,7 @@ struct H5F_shared_t { struct H5G_t *root_grp; /* Open root group */ H5FO_t *open_objs; /* Open objects in file */ H5UC_t *grp_btree_shared; /* Ref-counted group B-tree node info */ + hbool_t use_file_locking; /* Whether or not to use file locking */ hbool_t closing; /* File is in the process of being closed */ /* Cached VOL connector ID & info */ @@ -384,6 +385,7 @@ struct H5F_t { unsigned nmounts; /* Number of children mounted to this file */ }; + /*****************************/ /* Package Private Variables */ /*****************************/ @@ -394,6 +396,10 @@ H5FL_EXTERN(H5F_t); /* Declare a free list to manage the H5F_shared_t struct */ H5FL_EXTERN(H5F_shared_t); +/* Whether or not to use file locking (based on the environment variable) + * FAIL means ignore the environment variable. + */ +H5_DLLVAR htri_t use_locks_env_g; /******************************/ /* Package Private Prototypes */ @@ -412,6 +418,7 @@ H5_DLL herr_t H5F__start_swmr_write(H5F_t *f); H5_DLL herr_t H5F__close(H5F_t *f); H5_DLL herr_t H5F__set_libver_bounds(H5F_t *f, H5F_libver_t low, H5F_libver_t high); H5_DLL herr_t H5F__get_cont_info(const H5F_t *f, H5VL_file_cont_info_t *info); +H5_DLL herr_t H5F__parse_file_lock_env_var(htri_t *use_locks); /* File mount related routines */ H5_DLL herr_t H5F__mount(H5G_loc_t *loc, const char *name, H5F_t *child, hid_t plist_id); @@ -472,6 +479,7 @@ H5_DLL herr_t H5F__check_cached_stab_test(hid_t file_id); H5_DLL herr_t H5F__get_maxaddr_test(hid_t file_id, haddr_t *maxaddr); H5_DLL herr_t H5F__get_sbe_addr_test(hid_t file_id, haddr_t *sbe_addr); H5_DLL htri_t H5F__same_file_test(hid_t file_id1, hid_t file_id2); +H5_DLL herr_t H5F__reparse_file_lock_variable_test(void); #endif /* H5F_TESTING */ #endif /* _H5Fpkg_H */ diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index c5d4c89..552855b 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -116,16 +116,16 @@ typedef struct H5F_t H5F_t; /* Encode a 64-bit unsigned integer and its length into a variable-sized buffer */ /* (Assumes that the high bits of the integer are zero) */ # define UINT64ENCODE_VARLEN(p, n) { \ - uint64_t __n = (uint64_t)(n); \ - unsigned _s = H5VM_limit_enc_size(__n); \ - \ - *(p)++ = (uint8_t)_s; \ - UINT64ENCODE_VAR(p, __n, _s); \ + uint64_t __n = (uint64_t)(n); \ + unsigned _s = H5VM_limit_enc_size(__n); \ + \ + *(p)++ = (uint8_t)_s; \ + UINT64ENCODE_VAR(p, __n, _s); \ } # define H5_ENCODE_UNSIGNED(p, n) { \ - HDcompile_assert(sizeof(unsigned) == sizeof(uint32_t)); \ - UINT32ENCODE(p, n) \ + HDcompile_assert(sizeof(unsigned) == sizeof(uint32_t)); \ + UINT32ENCODE(p, n) \ } /* Assumes the endianness of uint64_t is the same as double */ @@ -338,6 +338,7 @@ typedef struct H5F_t H5F_t; #define H5F_SET_MIN_DSET_OHDR(F, V) ((F)->shared->crt_dset_min_ohdr_flag = (V)) #define H5F_VOL_CLS(F) ((F)->shared->vol_cls) #define H5F_VOL_OBJ(F) ((F)->vol_obj) +#define H5F_USE_FILE_LOCKING(F) ((F)->shared->use_file_locking) #else /* H5F_MODULE */ #define H5F_LOW_BOUND(F) (H5F_get_low_bound(F)) #define H5F_HIGH_BOUND(F) (H5F_get_high_bound(F)) @@ -400,6 +401,7 @@ typedef struct H5F_t H5F_t; #define H5F_SET_MIN_DSET_OHDR(F, V) (H5F_set_min_dset_ohdr((F), (V))) #define H5F_VOL_CLS(F) (H5F_get_vol_cls(F)) #define H5F_VOL_OBJ(F) (H5F_get_vol_obj(F)) +#define H5F_USE_FILE_LOCKING(F) (H5F_get_use_file_locking(F)) #endif /* H5F_MODULE */ @@ -518,6 +520,8 @@ typedef struct H5F_t H5F_t; #define H5F_ACS_PAGE_BUFFER_SIZE_NAME "page_buffer_size" /* the maximum size for the page buffer cache */ #define H5F_ACS_PAGE_BUFFER_MIN_META_PERC_NAME "page_buffer_min_meta_perc" /* the min metadata percentage for the page buffer cache */ #define H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_NAME "page_buffer_min_raw_perc" /* the min raw data percentage for the page buffer cache */ +#define H5F_ACS_USE_FILE_LOCKING_NAME "use_file_locking" /* whether or not we use file locks for SWMR control and to prevent multiple writers */ +#define H5F_ACS_IGNORE_DISABLED_FILE_LOCKS_NAME "ignore_disabled_file_locks" /* whether or not we ignore "locks disabled" errors */ #ifdef H5_HAVE_PARALLEL #define H5F_ACS_MPI_PARAMS_COMM_NAME "mpi_params_comm" /* the MPI communicator */ #define H5F_ACS_MPI_PARAMS_INFO_NAME "mpi_params_info" /* the MPI info struct */ @@ -763,6 +767,7 @@ H5_DLL hbool_t H5F_get_min_dset_ohdr(const H5F_t *f); H5_DLL herr_t H5F_set_min_dset_ohdr(H5F_t *f, hbool_t minimize); H5_DLL const H5VL_class_t *H5F_get_vol_cls(const H5F_t *f); H5_DLL H5VL_object_t *H5F_get_vol_obj(const H5F_t *f); +H5_DLL hbool_t H5F_get_file_locking(const H5F_t *f); /* Functions than retrieve values set/cached from the superblock/FCPL */ H5_DLL haddr_t H5F_get_base_addr(const H5F_t *f); diff --git a/src/H5Fquery.c b/src/H5Fquery.c index e1b11c8..51f2194 100644 --- a/src/H5Fquery.c +++ b/src/H5Fquery.c @@ -15,7 +15,7 @@ * * Created: H5Fquery.c * Jan 10 2008 - * Quincey Koziol + * Quincey Koziol * * Purpose: File structure query routines. * @@ -763,7 +763,6 @@ H5F_sieve_buf_size(const H5F_t *f) * Failure: (should not happen) * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Jul 8 2005 * *------------------------------------------------------------------------- @@ -1364,3 +1363,24 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_get_cont_info */ + +/*------------------------------------------------------------------------- + * Function: H5F_get_file_locking + * + * Purpose: Get the file locking flag for the file + * + * Return: TRUE/FALSE + * + *------------------------------------------------------------------------- + */ +hbool_t +H5F_get_file_locking(const H5F_t *f) +{ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + HDassert(f); + HDassert(f->shared); + + FUNC_LEAVE_NOAPI(f->shared->use_file_locking) +} /* end H5F_get_file_locking */ + diff --git a/src/H5Fspace.c b/src/H5Fspace.c index 6baf163..3d969f9 100644 --- a/src/H5Fspace.c +++ b/src/H5Fspace.c @@ -15,7 +15,7 @@ * * Created: H5Fspace.c * Dec 30 2013 - * Quincey Koziol + * Quincey Koziol * * Purpose: Space allocation routines for the file. * diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index e5d4cde..cf3f72a 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -318,7 +318,6 @@ done: * Failure: FAIL * * Programmer: Bill Wendling - * wendling@ncsa.uiuc.edu * Sept 12, 2003 * *------------------------------------------------------------------------- @@ -896,8 +895,13 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "error in writing fsinfo message to superblock extension") } else { - if(H5F__super_ext_remove_msg(f, H5O_FSINFO_ID) < 0) + if(H5F__super_ext_remove_msg(f, H5O_FSINFO_ID) < 0) { +#if 1 /* bug fix test code -- tidy this up if all goes well */ /* JRM */ + f->shared->sblock = NULL; +#endif /* JRM */ + HGOTO_ERROR(H5E_FILE, H5E_CANTDELETE, FAIL, "error in removing message from superblock extension") + } if(H5F__super_ext_write_msg(f, H5O_FSINFO_ID, &fsinfo, TRUE, H5O_MSG_FLAG_MARK_IF_UNKNOWN) < 0) HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "error in writing fsinfo message to superblock extension") @@ -1061,7 +1065,6 @@ done: * Failure: FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Sept 15, 2003 * *------------------------------------------------------------------------- diff --git a/src/H5Fsuper_cache.c b/src/H5Fsuper_cache.c index 119548c..329bf21 100644 --- a/src/H5Fsuper_cache.c +++ b/src/H5Fsuper_cache.c @@ -15,7 +15,7 @@ * * Created: H5Fsuper_cache.c * Aug 15 2009 - * Quincey Koziol + * Quincey Koziol * * Purpose: Implement file superblock & driver info metadata cache methods. * @@ -309,7 +309,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 17, 2013 * *------------------------------------------------------------------------- @@ -338,7 +337,6 @@ H5F__cache_superblock_get_initial_load_size(void H5_ATTR_UNUSED *_udata, size_t * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@lbl.gov * November 17, 2016 * *------------------------------------------------------------------------- @@ -428,7 +426,6 @@ H5F__cache_superblock_verify_chksum(const void *_image, size_t len, void *_udata * Failure: NULL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 18 2013 * *------------------------------------------------------------------------- @@ -621,7 +618,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 19, 2013 * *------------------------------------------------------------------------- @@ -654,7 +650,6 @@ H5F__cache_superblock_image_len(const void *_thing, size_t *image_len) * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 19 2013 * *------------------------------------------------------------------------- @@ -798,7 +793,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 20, 2013 * *------------------------------------------------------------------------- @@ -833,7 +827,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 20, 2013 * *------------------------------------------------------------------------- @@ -861,7 +854,6 @@ H5F__cache_drvrinfo_get_initial_load_size(void H5_ATTR_UNUSED *_udata, size_t *i * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@lbl.gov * November 17, 2016 * *------------------------------------------------------------------------- @@ -905,7 +897,6 @@ done: * Failure: NULL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 20 2013 * *------------------------------------------------------------------------- @@ -966,7 +957,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 20, 2013 * *------------------------------------------------------------------------- @@ -1000,7 +990,6 @@ H5F__cache_drvrinfo_image_len(const void *_thing, size_t *image_len) * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 20 2013 * *------------------------------------------------------------------------- @@ -1064,7 +1053,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 20, 2013 * *------------------------------------------------------------------------- diff --git a/src/H5Ftest.c b/src/H5Ftest.c index 49a2a22..50a31cf 100644 --- a/src/H5Ftest.c +++ b/src/H5Ftest.c @@ -15,7 +15,7 @@ * * Created: H5Ftest.c * Jan 3 2007 - * Quincey Koziol + * Quincey Koziol * * Purpose: File testing routines. * @@ -267,3 +267,36 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5F__same_file_test() */ + +/*------------------------------------------------------------------------- + * Function: H5F__reparse_file_lock_variable_test + * + * Purpose: Re-parse the file locking environment variable. + * + * Since getenv(3) is fairly expensive, we only parse it once, + * when the library opens. This test function is used to + * re-parse the environment variable after we've changed it + * with setnev(3). + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Summer 2020 + * + *------------------------------------------------------------------------- + */ +herr_t +H5F__reparse_file_lock_variable_test(void) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_PACKAGE + + /* Check the file locking environment variable */ + if(H5F__parse_file_lock_env_var(&use_locks_env_g) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to parse file locking environment variable") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5F__reparse_file_lock_variable_test() */ + diff --git a/src/H5Gbtree2.c b/src/H5Gbtree2.c index 71e0b2d..918e18c 100644 --- a/src/H5Gbtree2.c +++ b/src/H5Gbtree2.c @@ -15,7 +15,7 @@ * * Created: H5Gbtree2.c * Sep 9 2006 - * Quincey Koziol + * Quincey Koziol * * Purpose: v2 B-tree callbacks for indexing fields on links * @@ -75,27 +75,27 @@ typedef struct H5G_fh_ud_cmp_t { /* v2 B-tree function callbacks */ /* v2 B-tree driver callbacks for 'creation order' index */ -static herr_t H5G_dense_btree2_corder_store(void *native, const void *udata); -static herr_t H5G_dense_btree2_corder_compare(const void *rec1, const void *rec2, int *result); -static herr_t H5G_dense_btree2_corder_encode(uint8_t *raw, const void *native, +static herr_t H5G__dense_btree2_corder_store(void *native, const void *udata); +static herr_t H5G__dense_btree2_corder_compare(const void *rec1, const void *rec2, int *result); +static herr_t H5G__dense_btree2_corder_encode(uint8_t *raw, const void *native, void *ctx); -static herr_t H5G_dense_btree2_corder_decode(const uint8_t *raw, void *native, +static herr_t H5G__dense_btree2_corder_decode(const uint8_t *raw, void *native, void *ctx); -static herr_t H5G_dense_btree2_corder_debug(FILE *stream, int indent, int fwidth, +static herr_t H5G__dense_btree2_corder_debug(FILE *stream, int indent, int fwidth, const void *record, const void *_udata); /* v2 B-tree driver callbacks for 'name' index */ -static herr_t H5G_dense_btree2_name_store(void *native, const void *udata); +static herr_t H5G__dense_btree2_name_store(void *native, const void *udata); static herr_t H5G__dense_btree2_name_compare(const void *rec1, const void *rec2, int *result); -static herr_t H5G_dense_btree2_name_encode(uint8_t *raw, const void *native, +static herr_t H5G__dense_btree2_name_encode(uint8_t *raw, const void *native, void *ctx); -static herr_t H5G_dense_btree2_name_decode(const uint8_t *raw, void *native, +static herr_t H5G__dense_btree2_name_decode(const uint8_t *raw, void *native, void *ctx); -static herr_t H5G_dense_btree2_name_debug(FILE *stream, int indent, int fwidth, +static herr_t H5G__dense_btree2_name_debug(FILE *stream, int indent, int fwidth, const void *record, const void *_udata); /* Fractal heap function callbacks */ -static herr_t H5G_dense_fh_name_cmp(const void *obj, size_t obj_len, void *op_data); +static herr_t H5G__dense_fh_name_cmp(const void *obj, size_t obj_len, void *op_data); /*********************/ @@ -108,11 +108,11 @@ const H5B2_class_t H5G_BT2_NAME[1]={{ /* B-tree class information */ sizeof(H5G_dense_bt2_name_rec_t), /* Size of native record */ NULL, /* Create client callback context */ NULL, /* Destroy client callback context */ - H5G_dense_btree2_name_store, /* Record storage callback */ - H5G__dense_btree2_name_compare, /* Record comparison callback */ - H5G_dense_btree2_name_encode, /* Record encoding callback */ - H5G_dense_btree2_name_decode, /* Record decoding callback */ - H5G_dense_btree2_name_debug /* Record debugging callback */ + H5G__dense_btree2_name_store, /* Record storage callback */ + H5G__dense_btree2_name_compare, /* Record comparison callback */ + H5G__dense_btree2_name_encode, /* Record encoding callback */ + H5G__dense_btree2_name_decode, /* Record decoding callback */ + H5G__dense_btree2_name_debug /* Record debugging callback */ }}; /* v2 B-tree class for indexing 'creation order' field of links */ @@ -122,11 +122,11 @@ const H5B2_class_t H5G_BT2_CORDER[1]={{ /* B-tree class information */ sizeof(H5G_dense_bt2_corder_rec_t), /* Size of native record */ NULL, /* Create client callback context */ NULL, /* Destroy client callback context */ - H5G_dense_btree2_corder_store, /* Record storage callback */ - H5G_dense_btree2_corder_compare, /* Record comparison callback */ - H5G_dense_btree2_corder_encode, /* Record encoding callback */ - H5G_dense_btree2_corder_decode, /* Record decoding callback */ - H5G_dense_btree2_corder_debug /* Record debugging callback */ + H5G__dense_btree2_corder_store, /* Record storage callback */ + H5G__dense_btree2_corder_compare, /* Record comparison callback */ + H5G__dense_btree2_corder_encode, /* Record encoding callback */ + H5G__dense_btree2_corder_decode, /* Record decoding callback */ + H5G__dense_btree2_corder_debug /* Record debugging callback */ }}; /*****************************/ @@ -141,7 +141,7 @@ const H5B2_class_t H5G_BT2_CORDER[1]={{ /* B-tree class information */ /*------------------------------------------------------------------------- - * Function: H5G_dense_fh_name_cmp + * Function: H5G__dense_fh_name_cmp * * Purpose: Compares the name of a link in a fractal heap to another * name @@ -149,19 +149,18 @@ const H5B2_class_t H5G_BT2_CORDER[1]={{ /* B-tree class information */ * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 11 2006 * *------------------------------------------------------------------------- */ static herr_t -H5G_dense_fh_name_cmp(const void *obj, size_t obj_len, void *_udata) +H5G__dense_fh_name_cmp(const void *obj, size_t obj_len, void *_udata) { H5G_fh_ud_cmp_t *udata = (H5G_fh_ud_cmp_t *)_udata; /* User data for 'op' callback */ H5O_link_t *lnk; /* Pointer to link created from heap object */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Decode link information */ if(NULL == (lnk = (H5O_link_t *)H5O_msg_decode(udata->f, NULL, H5O_LINK_ID, obj_len, (const unsigned char *)obj))) @@ -181,11 +180,11 @@ H5G_dense_fh_name_cmp(const void *obj, size_t obj_len, void *_udata) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_dense_fh_name_cmp() */ +} /* end H5G__dense_fh_name_cmp() */ /*------------------------------------------------------------------------- - * Function: H5G_dense_btree2_name_store + * Function: H5G__dense_btree2_name_store * * Purpose: Store user information into native record for v2 B-tree * @@ -198,19 +197,19 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5G_dense_btree2_name_store(void *_nrecord, const void *_udata) +H5G__dense_btree2_name_store(void *_nrecord, const void *_udata) { const H5G_bt2_ud_ins_t *udata = (const H5G_bt2_ud_ins_t *)_udata; H5G_dense_bt2_name_rec_t *nrecord = (H5G_dense_bt2_name_rec_t *)_nrecord; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Copy user information info native record */ nrecord->hash = udata->common.name_hash; H5MM_memcpy(nrecord->id, udata->id, (size_t)H5G_DENSE_FHEAP_ID_LEN); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5G_dense_btree2_name_store() */ +} /* H5G__dense_btree2_name_store() */ /*------------------------------------------------------------------------- @@ -240,16 +239,6 @@ H5G__dense_btree2_name_compare(const void *_bt2_udata, const void *_bt2_rec, int HDassert(bt2_udata); HDassert(bt2_rec); -#ifdef QAK -{ -unsigned u; - -HDfprintf(stderr, "%s: bt2_udata = {'%s', %x}\n", "H5G__dense_btree2_name_compare", bt2_udata->name, (unsigned)bt2_udata->name_hash); -HDfprintf(stderr, "%s: bt2_rec = {%x, ", "H5G__dense_btree2_name_compare", (unsigned)bt2_rec->hash); -for(u = 0; u < H5G_DENSE_FHEAP_ID_LEN; u++) - HDfprintf(stderr, "%02x%s", bt2_rec->id[u], (u < (H5G_DENSE_FHEAP_ID_LEN - 1) ? " " : "}\n")); -} -#endif /* QAK */ /* Check hash value */ if(bt2_udata->name_hash < bt2_rec->hash) *result = (-1); @@ -272,7 +261,7 @@ for(u = 0; u < H5G_DENSE_FHEAP_ID_LEN; u++) fh_udata.cmp = 0; /* Check if the user's link and the B-tree's link have the same name */ - if(H5HF_op(bt2_udata->fheap, bt2_rec->id, H5G_dense_fh_name_cmp, &fh_udata) < 0) + if(H5HF_op(bt2_udata->fheap, bt2_rec->id, H5G__dense_fh_name_cmp, &fh_udata) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records") /* Callback will set comparison value */ @@ -285,7 +274,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_dense_btree2_name_encode + * Function: H5G__dense_btree2_name_encode * * Purpose: Encode native information into raw form for storing on disk * @@ -298,22 +287,22 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5G_dense_btree2_name_encode(uint8_t *raw, const void *_nrecord, void H5_ATTR_UNUSED *ctx) +H5G__dense_btree2_name_encode(uint8_t *raw, const void *_nrecord, void H5_ATTR_UNUSED *ctx) { const H5G_dense_bt2_name_rec_t *nrecord = (const H5G_dense_bt2_name_rec_t *)_nrecord; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Encode the record's fields */ UINT32ENCODE(raw, nrecord->hash) H5MM_memcpy(raw, nrecord->id, (size_t)H5G_DENSE_FHEAP_ID_LEN); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5G_dense_btree2_name_encode() */ +} /* H5G__dense_btree2_name_encode() */ /*------------------------------------------------------------------------- - * Function: H5G_dense_btree2_name_decode + * Function: H5G__dense_btree2_name_decode * * Purpose: Decode raw disk form of record into native form * @@ -326,22 +315,22 @@ H5G_dense_btree2_name_encode(uint8_t *raw, const void *_nrecord, void H5_ATTR_UN *------------------------------------------------------------------------- */ static herr_t -H5G_dense_btree2_name_decode(const uint8_t *raw, void *_nrecord, void H5_ATTR_UNUSED *ctx) +H5G__dense_btree2_name_decode(const uint8_t *raw, void *_nrecord, void H5_ATTR_UNUSED *ctx) { H5G_dense_bt2_name_rec_t *nrecord = (H5G_dense_bt2_name_rec_t *)_nrecord; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Decode the record's fields */ UINT32DECODE(raw, nrecord->hash) H5MM_memcpy(nrecord->id, raw, (size_t)H5G_DENSE_FHEAP_ID_LEN); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5G_dense_btree2_name_decode() */ +} /* H5G__dense_btree2_name_decode() */ /*------------------------------------------------------------------------- - * Function: H5G_dense_btree2_name_debug + * Function: H5G__dense_btree2_name_debug * * Purpose: Debug native form of record * @@ -354,13 +343,13 @@ H5G_dense_btree2_name_decode(const uint8_t *raw, void *_nrecord, void H5_ATTR_UN *------------------------------------------------------------------------- */ static herr_t -H5G_dense_btree2_name_debug(FILE *stream, int indent, int fwidth, +H5G__dense_btree2_name_debug(FILE *stream, int indent, int fwidth, const void *_nrecord, const void H5_ATTR_UNUSED *_udata) { const H5G_dense_bt2_name_rec_t *nrecord = (const H5G_dense_bt2_name_rec_t *)_nrecord; unsigned u; /* Local index variable */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDfprintf(stream, "%*s%-*s {%x, ", indent, "", fwidth, "Record:", (unsigned)nrecord->hash); @@ -368,11 +357,11 @@ H5G_dense_btree2_name_debug(FILE *stream, int indent, int fwidth, HDfprintf(stderr, "%02x%s", nrecord->id[u], (u < (H5G_DENSE_FHEAP_ID_LEN - 1) ? " " : "}\n")); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5G_dense_btree2_name_debug() */ +} /* H5G__dense_btree2_name_debug() */ /*------------------------------------------------------------------------- - * Function: H5G_dense_btree2_corder_store + * Function: H5G__dense_btree2_corder_store * * Purpose: Store user information into native record for v2 B-tree * @@ -385,23 +374,23 @@ H5G_dense_btree2_name_debug(FILE *stream, int indent, int fwidth, *------------------------------------------------------------------------- */ static herr_t -H5G_dense_btree2_corder_store(void *_nrecord, const void *_udata) +H5G__dense_btree2_corder_store(void *_nrecord, const void *_udata) { const H5G_bt2_ud_ins_t *udata = (const H5G_bt2_ud_ins_t *)_udata; H5G_dense_bt2_corder_rec_t *nrecord = (H5G_dense_bt2_corder_rec_t *)_nrecord; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Copy user information info native record */ nrecord->corder = udata->common.corder; H5MM_memcpy(nrecord->id, udata->id, (size_t)H5G_DENSE_FHEAP_ID_LEN); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5G_dense_btree2_corder_store() */ +} /* H5G__dense_btree2_corder_store() */ /*------------------------------------------------------------------------- - * Function: H5G_dense_btree2_corder_compare + * Function: H5G__dense_btree2_corder_compare * * Purpose: Compare two native information records, according to some key * @@ -415,27 +404,17 @@ H5G_dense_btree2_corder_store(void *_nrecord, const void *_udata) *------------------------------------------------------------------------- */ static herr_t -H5G_dense_btree2_corder_compare(const void *_bt2_udata, const void *_bt2_rec, int *result) +H5G__dense_btree2_corder_compare(const void *_bt2_udata, const void *_bt2_rec, int *result) { const H5G_bt2_ud_common_t *bt2_udata = (const H5G_bt2_ud_common_t *)_bt2_udata; const H5G_dense_bt2_corder_rec_t *bt2_rec = (const H5G_dense_bt2_corder_rec_t *)_bt2_rec; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity check */ HDassert(bt2_udata); HDassert(bt2_rec); -#ifdef QAK -{ -unsigned u; - -HDfprintf(stderr, "%s: bt2_udata->corder = %Hd\n", "H5G_dense_btree2_corder_compare", (hsize_t)bt2_udata->corder); -HDfprintf(stderr, "%s: bt2_rec = {%Hu, ", "H5G_dense_btree2_corder_compare", (hsize_t)bt2_rec->corder); -for(u = 0; u < H5G_DENSE_FHEAP_ID_LEN; u++) - HDfprintf(stderr, "%02x%s", bt2_rec->id[u], (u < (H5G_DENSE_FHEAP_ID_LEN - 1) ? " " : "}\n")); -} -#endif /* QAK */ /* Check creation order value */ if(bt2_udata->corder < bt2_rec->corder) *result = -1; @@ -445,11 +424,11 @@ for(u = 0; u < H5G_DENSE_FHEAP_ID_LEN; u++) *result = 0; FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5G_dense_btree2_corder_compare() */ +} /* H5G__dense_btree2_corder_compare() */ /*------------------------------------------------------------------------- - * Function: H5G_dense_btree2_corder_encode + * Function: H5G__dense_btree2_corder_encode * * Purpose: Encode native information into raw form for storing on disk * @@ -462,22 +441,22 @@ for(u = 0; u < H5G_DENSE_FHEAP_ID_LEN; u++) *------------------------------------------------------------------------- */ static herr_t -H5G_dense_btree2_corder_encode(uint8_t *raw, const void *_nrecord, void H5_ATTR_UNUSED *ctx) +H5G__dense_btree2_corder_encode(uint8_t *raw, const void *_nrecord, void H5_ATTR_UNUSED *ctx) { const H5G_dense_bt2_corder_rec_t *nrecord = (const H5G_dense_bt2_corder_rec_t *)_nrecord; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Encode the record's fields */ INT64ENCODE(raw, nrecord->corder) H5MM_memcpy(raw, nrecord->id, (size_t)H5G_DENSE_FHEAP_ID_LEN); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5G_dense_btree2_corder_encode() */ +} /* H5G__dense_btree2_corder_encode() */ /*------------------------------------------------------------------------- - * Function: H5G_dense_btree2_corder_decode + * Function: H5G__dense_btree2_corder_decode * * Purpose: Decode raw disk form of record into native form * @@ -490,22 +469,22 @@ H5G_dense_btree2_corder_encode(uint8_t *raw, const void *_nrecord, void H5_ATTR_ *------------------------------------------------------------------------- */ static herr_t -H5G_dense_btree2_corder_decode(const uint8_t *raw, void *_nrecord, void H5_ATTR_UNUSED *ctx) +H5G__dense_btree2_corder_decode(const uint8_t *raw, void *_nrecord, void H5_ATTR_UNUSED *ctx) { H5G_dense_bt2_corder_rec_t *nrecord = (H5G_dense_bt2_corder_rec_t *)_nrecord; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Decode the record's fields */ INT64DECODE(raw, nrecord->corder) H5MM_memcpy(nrecord->id, raw, (size_t)H5G_DENSE_FHEAP_ID_LEN); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5G_dense_btree2_corder_decode() */ +} /* H5G__dense_btree2_corder_decode() */ /*------------------------------------------------------------------------- - * Function: H5G_dense_btree2_corder_debug + * Function: H5G__dense_btree2_corder_debug * * Purpose: Debug native form of record * @@ -518,13 +497,13 @@ H5G_dense_btree2_corder_decode(const uint8_t *raw, void *_nrecord, void H5_ATTR_ *------------------------------------------------------------------------- */ static herr_t -H5G_dense_btree2_corder_debug(FILE *stream, int indent, int fwidth, +H5G__dense_btree2_corder_debug(FILE *stream, int indent, int fwidth, const void *_nrecord, const void H5_ATTR_UNUSED *_udata) { const H5G_dense_bt2_corder_rec_t *nrecord = (const H5G_dense_bt2_corder_rec_t *)_nrecord; unsigned u; /* Local index variable */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDfprintf(stream, "%*s%-*s {%llu, ", indent, "", fwidth, "Record:", (unsigned long long)nrecord->corder); @@ -532,5 +511,5 @@ H5G_dense_btree2_corder_debug(FILE *stream, int indent, int fwidth, HDfprintf(stderr, "%02x%s", nrecord->id[u], (u < (H5G_DENSE_FHEAP_ID_LEN - 1) ? " " : "}\n")); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5G_dense_btree2_corder_debug() */ +} /* H5G__dense_btree2_corder_debug() */ diff --git a/src/H5Gcache.c b/src/H5Gcache.c index 13a33a3..22b0488 100644 --- a/src/H5Gcache.c +++ b/src/H5Gcache.c @@ -15,7 +15,7 @@ * * Created: H5Gcache.c * Feb 5 2008 - * Quincey Koziol + * Quincey Koziol * * Purpose: Implement group metadata cache methods. * diff --git a/src/H5Gcompact.c b/src/H5Gcompact.c index 1a76012..d14ec20 100644 --- a/src/H5Gcompact.c +++ b/src/H5Gcompact.c @@ -15,7 +15,7 @@ * * Created: H5Gcompact.c * Sep 5 2005 - * Quincey Koziol + * Quincey Koziol * * Purpose: Functions for handling compact storage. * @@ -75,7 +75,6 @@ static herr_t H5G__compact_lookup_cb(const void *_mesg, unsigned H5_ATTR_UNUSED * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Sep 5 2005 * *------------------------------------------------------------------------- @@ -178,7 +177,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Sep 6 2005 * *------------------------------------------------------------------------- @@ -257,7 +255,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_compact_remove_common_cb + * Function: H5G__compact_remove_common_cb * * Purpose: Common callback routine for deleting 'link' message for a * particular name. @@ -265,19 +263,18 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Sep 5 2005 * *------------------------------------------------------------------------- */ static herr_t -H5G_compact_remove_common_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, void *_udata) +H5G__compact_remove_common_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, void *_udata) { const H5O_link_t *lnk = (const H5O_link_t *)_mesg; /* Pointer to link */ H5G_iter_rm_t *udata = (H5G_iter_rm_t *)_udata; /* 'User data' passed in */ herr_t ret_value = H5_ITER_CONT; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check arguments */ HDassert(lnk); @@ -295,7 +292,7 @@ H5G_compact_remove_common_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, voi done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_compact_remove_common_cb() */ +} /* end H5G__compact_remove_common_cb() */ /*------------------------------------------------------------------------- @@ -328,7 +325,7 @@ H5G__compact_remove(const H5O_loc_t *oloc, H5RS_str_t *grp_full_path_r, udata.name = name; /* Iterate over the link messages to delete the right one */ - if(H5O_msg_remove_op(oloc, H5O_LINK_ID, H5O_FIRST, H5G_compact_remove_common_cb, &udata, TRUE) < 0) + if(H5O_msg_remove_op(oloc, H5O_LINK_ID, H5O_FIRST, H5G__compact_remove_common_cb, &udata, TRUE) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete link message") done: @@ -376,7 +373,7 @@ H5G__compact_remove_by_idx(const H5O_loc_t *oloc, const H5O_linfo_t *linfo, udata.name = ltable.lnks[n].name; /* Iterate over the link messages to delete the right one */ - if(H5O_msg_remove_op(oloc, H5O_LINK_ID, H5O_FIRST, H5G_compact_remove_common_cb, &udata, TRUE) < 0) + if(H5O_msg_remove_op(oloc, H5O_LINK_ID, H5O_FIRST, H5G__compact_remove_common_cb, &udata, TRUE) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete link message") done: @@ -441,7 +438,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Sep 20 2005 * *------------------------------------------------------------------------- @@ -487,7 +483,6 @@ done: * Return: Non-negative (TRUE/FALSE) on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Sep 20 2005 * *------------------------------------------------------------------------- @@ -533,7 +528,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Nov 6 2006 * *------------------------------------------------------------------------- diff --git a/src/H5Gdense.c b/src/H5Gdense.c index a2ef55c..8545d73 100644 --- a/src/H5Gdense.c +++ b/src/H5Gdense.c @@ -15,7 +15,7 @@ * * Created: H5Gdense.c * Sep 9 2006 - * Quincey Koziol + * Quincey Koziol * * Purpose: Routines for operating on "dense" link storage for a * group in a file. @@ -250,7 +250,6 @@ typedef struct { * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 9 2006 * *------------------------------------------------------------------------- @@ -294,17 +293,11 @@ H5G__dense_create(H5F_t *f, H5O_linfo_t *linfo, const H5O_pline_t *pline) /* Retrieve the heap's address in the file */ if(H5HF_get_heap_addr(fheap, &(linfo->fheap_addr)) < 0) 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 */ /* Retrieve the heap's ID length in the file */ if(H5HF_get_id_len(fheap, &fheap_id_len) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGETSIZE, FAIL, "can't get fractal heap ID length") HDassert(fheap_id_len == H5G_DENSE_FHEAP_ID_LEN); -#ifdef QAK -HDfprintf(stderr, "%s: fheap_id_len = %Zu\n", FUNC, fheap_id_len); -#endif /* QAK */ /* Create the name index v2 B-tree */ HDmemset(&bt2_cparam, 0, sizeof(bt2_cparam)); @@ -321,9 +314,6 @@ HDfprintf(stderr, "%s: fheap_id_len = %Zu\n", FUNC, fheap_id_len); /* 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 */ /* Check if we should create a creation order index v2 B-tree */ if(linfo->index_corder) { @@ -342,9 +332,6 @@ HDfprintf(stderr, "%s: linfo->name_bt2_addr = %a\n", FUNC, linfo->name_bt2_addr) /* 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: @@ -368,7 +355,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 11 2006 * *------------------------------------------------------------------------- @@ -394,17 +380,10 @@ H5G__dense_insert(H5F_t *f, const H5O_linfo_t *linfo, const H5O_link_t *lnk) HDassert(f); HDassert(linfo); HDassert(lnk); -#ifdef QAK -HDfprintf(stderr, "%s: linfo->fheap_addr = %a\n", FUNC, linfo->fheap_addr); -HDfprintf(stderr, "%s: linfo->name_bt2_addr = %a\n", FUNC, linfo->name_bt2_addr); -#endif /* QAK */ /* Find out the size of buffer needed for serialized link */ if((link_size = H5O_msg_raw_size(f, H5O_LINK_ID, FALSE, lnk)) == 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGETSIZE, FAIL, "can't get link size") -#ifdef QAK -HDfprintf(stderr, "%s: HDstrlen(lnk->name) = %Zu, link_size = %Zu\n", FUNC, HDstrlen(lnk->name), link_size); -#endif /* QAK */ /* Wrap the local buffer for serialized link */ if(NULL == (wb = H5WB_wrap(link_buf, sizeof(link_buf)))) @@ -472,26 +451,25 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_dense_lookup_cb + * Function: H5G__dense_lookup_cb * * Purpose: Callback when a link is located in an index * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 11 2006 * *------------------------------------------------------------------------- */ static herr_t -H5G_dense_lookup_cb(const void *_lnk, void *_user_lnk) +H5G__dense_lookup_cb(const void *_lnk, void *_user_lnk) { const H5O_link_t *lnk = (const H5O_link_t *)_lnk; /* Record from B-tree */ H5O_link_t *user_lnk = (H5O_link_t *)_user_lnk; /* User data from v2 B-tree link lookup */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* * Check arguments. @@ -505,7 +483,7 @@ H5G_dense_lookup_cb(const void *_lnk, void *_user_lnk) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_dense_lookup_cb() */ +} /* end H5G__dense_lookup_cb() */ /*------------------------------------------------------------------------- @@ -516,7 +494,6 @@ done: * Return: Non-negative (TRUE/FALSE) on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 11 2006 * *------------------------------------------------------------------------- @@ -553,7 +530,7 @@ H5G__dense_lookup(H5F_t *f, const H5O_linfo_t *linfo, const char *name, udata.fheap = fheap; udata.name = name; udata.name_hash = H5_checksum_lookup3(name, HDstrlen(name), 0); - udata.found_op = H5G_dense_lookup_cb; /* v2 B-tree comparison callback */ + udata.found_op = H5G__dense_lookup_cb; /* v2 B-tree comparison callback */ udata.found_op_data = lnk; /* Find & copy the named link in the 'name' index */ @@ -572,7 +549,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_dense_lookup_by_idx_fh_cb + * Function: H5G__dense_lookup_by_idx_fh_cb * * Purpose: Callback for fractal heap operator, to make copy of link when * when lookup up a link by index @@ -580,19 +557,18 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Nov 7 2006 * *------------------------------------------------------------------------- */ static herr_t -H5G_dense_lookup_by_idx_fh_cb(const void *obj, size_t obj_len, void *_udata) +H5G__dense_lookup_by_idx_fh_cb(const void *obj, size_t obj_len, void *_udata) { H5G_fh_ud_lbi_t *udata = (H5G_fh_ud_lbi_t *)_udata; /* User data for fractal heap 'op' callback */ H5O_link_t *tmp_lnk = NULL; /* Temporary pointer to link */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Decode link information & keep a copy */ if(NULL == (tmp_lnk = (H5O_link_t *)H5O_msg_decode(udata->f, NULL, H5O_LINK_ID, obj_len, (const unsigned char *)obj))) @@ -608,31 +584,30 @@ done: H5O_msg_free(H5O_LINK_ID, tmp_lnk); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_dense_lookup_by_idx_fh_cb() */ +} /* end H5G__dense_lookup_by_idx_fh_cb() */ /*------------------------------------------------------------------------- - * Function: H5G_dense_lookup_by_idx_bt2_cb + * Function: H5G__dense_lookup_by_idx_bt2_cb * * Purpose: v2 B-tree callback for dense link storage lookup by index * * Return: H5_ITER_ERROR/H5_ITER_CONT/H5_ITER_STOP * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Nov 7 2006 * *------------------------------------------------------------------------- */ static herr_t -H5G_dense_lookup_by_idx_bt2_cb(const void *_record, void *_bt2_udata) +H5G__dense_lookup_by_idx_bt2_cb(const void *_record, void *_bt2_udata) { const H5G_dense_bt2_name_rec_t *record = (const H5G_dense_bt2_name_rec_t *)_record; H5G_bt2_ud_lbi_t *bt2_udata = (H5G_bt2_ud_lbi_t *)_bt2_udata; /* User data for callback */ H5G_fh_ud_lbi_t fh_udata; /* User data for fractal heap 'op' callback */ int ret_value = H5_ITER_CONT; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Prepare user data for callback */ /* down */ @@ -640,12 +615,12 @@ H5G_dense_lookup_by_idx_bt2_cb(const void *_record, void *_bt2_udata) fh_udata.lnk = bt2_udata->lnk; /* Call fractal heap 'op' routine, to copy the link information */ - if(H5HF_op(bt2_udata->fheap, record->id, H5G_dense_lookup_by_idx_fh_cb, &fh_udata) < 0) + if(H5HF_op(bt2_udata->fheap, record->id, H5G__dense_lookup_by_idx_fh_cb, &fh_udata) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTOPERATE, H5_ITER_ERROR, "link found callback failed") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_dense_lookup_by_idx_bt2_cb() */ +} /* end H5G__dense_lookup_by_idx_bt2_cb() */ /*------------------------------------------------------------------------- @@ -657,7 +632,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Nov 7 2006 * *------------------------------------------------------------------------- @@ -727,7 +701,7 @@ H5G__dense_lookup_by_idx(H5F_t *f, const H5O_linfo_t *linfo, udata.lnk = lnk; /* Find & copy the link in the appropriate index */ - if(H5B2_index(bt2, order, n, H5G_dense_lookup_by_idx_bt2_cb, &udata) < 0) + if(H5B2_index(bt2, 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 */ @@ -758,7 +732,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_dense_build_table_cb + * Function: H5G__dense_build_table_cb * * Purpose: Callback routine for building table of links from dense * link storage. @@ -767,18 +741,17 @@ done: * Failure: Negative * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sept 25 2006 * *------------------------------------------------------------------------- */ static herr_t -H5G_dense_build_table_cb(const H5O_link_t *lnk, void *_udata) +H5G__dense_build_table_cb(const H5O_link_t *lnk, void *_udata) { H5G_dense_bt_ud_t *udata = (H5G_dense_bt_ud_t *)_udata; /* 'User data' passed in */ herr_t ret_value = H5_ITER_CONT; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check arguments */ HDassert(lnk); @@ -794,7 +767,7 @@ H5G_dense_build_table_cb(const H5O_link_t *lnk, void *_udata) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_dense_build_table_cb() */ +} /* end H5G__dense_build_table_cb() */ /*------------------------------------------------------------------------- @@ -843,7 +816,7 @@ H5G__dense_build_table(H5F_t *f, const H5O_linfo_t *linfo, H5_index_t idx_type, udata.curr_lnk = 0; /* Iterate over the links in the group, building a table of the link messages */ - if(H5G__dense_iterate(f, linfo, H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)0, NULL, H5G_dense_build_table_cb, &udata) < 0) + if(H5G__dense_iterate(f, linfo, H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)0, NULL, H5G__dense_build_table_cb, &udata) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTNEXT, FAIL, "error iterating over links") /* Sort link table in correct iteration order */ @@ -859,7 +832,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_dense_iterate_fh_cb + * Function: H5G__dense_iterate_fh_cb * * Purpose: Callback for fractal heap operator, to make user's callback * when iterating over links @@ -867,18 +840,17 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 11 2006 * *------------------------------------------------------------------------- */ static herr_t -H5G_dense_iterate_fh_cb(const void *obj, size_t obj_len, void *_udata) +H5G__dense_iterate_fh_cb(const void *obj, size_t obj_len, void *_udata) { H5G_fh_ud_it_t *udata = (H5G_fh_ud_it_t *)_udata; /* User data for fractal heap 'op' callback */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Decode link information & keep a copy */ /* (we make a copy instead of calling the user/library callback directly in @@ -892,30 +864,29 @@ H5G_dense_iterate_fh_cb(const void *obj, size_t obj_len, void *_udata) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_dense_iterate_fh_cb() */ +} /* end H5G__dense_iterate_fh_cb() */ /*------------------------------------------------------------------------- - * Function: H5G_dense_iterate_bt2_cb + * Function: H5G__dense_iterate_bt2_cb * * Purpose: v2 B-tree callback for dense link storage iterator * * Return: H5_ITER_ERROR/H5_ITER_CONT/H5_ITER_STOP * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 11 2006 * *------------------------------------------------------------------------- */ static herr_t -H5G_dense_iterate_bt2_cb(const void *_record, void *_bt2_udata) +H5G__dense_iterate_bt2_cb(const void *_record, void *_bt2_udata) { const H5G_dense_bt2_name_rec_t *record = (const H5G_dense_bt2_name_rec_t *)_record; H5G_bt2_ud_it_t *bt2_udata = (H5G_bt2_ud_it_t *)_bt2_udata; /* User data for callback */ herr_t ret_value = H5_ITER_CONT; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check for skipping links */ if(bt2_udata->skip > 0) @@ -928,7 +899,7 @@ H5G_dense_iterate_bt2_cb(const void *_record, void *_bt2_udata) fh_udata.f = bt2_udata->f; /* Call fractal heap 'op' routine, to copy the link information */ - if(H5HF_op(bt2_udata->fheap, record->id, H5G_dense_iterate_fh_cb, &fh_udata) < 0) + if(H5HF_op(bt2_udata->fheap, record->id, H5G__dense_iterate_fh_cb, &fh_udata) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTOPERATE, H5_ITER_ERROR, "heap op callback failed") /* Make the callback */ @@ -948,7 +919,7 @@ H5G_dense_iterate_bt2_cb(const void *_record, void *_bt2_udata) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_dense_iterate_bt2_cb() */ +} /* end H5G__dense_iterate_bt2_cb() */ /*------------------------------------------------------------------------- @@ -959,14 +930,14 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 11 2006 * *------------------------------------------------------------------------- */ herr_t H5G__dense_iterate(H5F_t *f, const H5O_linfo_t *linfo, H5_index_t idx_type, - H5_iter_order_t order, hsize_t skip, hsize_t *last_lnk, H5G_lib_iterate_t op, void *op_data) + H5_iter_order_t order, hsize_t skip, hsize_t *last_lnk, H5G_lib_iterate_t op, + void *op_data) { H5HF_t *fheap = NULL; /* Fractal heap handle */ H5G_link_table_t ltable = {0, NULL}; /* Table of links */ @@ -1036,7 +1007,7 @@ H5G__dense_iterate(H5F_t *f, const H5O_linfo_t *linfo, H5_index_t idx_type, /* Iterate over the records in the v2 B-tree's "native" order */ /* (by hash of name) */ - if((ret_value = H5B2_iterate(bt2, H5G_dense_iterate_bt2_cb, &udata)) < 0) + if((ret_value = H5B2_iterate(bt2, H5G__dense_iterate_bt2_cb, &udata)) < 0) HERROR(H5E_SYM, H5E_BADITER, "link iteration failed"); /* Update the last link examined, if requested */ @@ -1067,7 +1038,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_dense_get_name_by_idx_fh_cb + * Function: H5G__dense_get_name_by_idx_fh_cb * * Purpose: Callback for fractal heap operator, to retrieve name according * to an index @@ -1075,19 +1046,18 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 19 2006 * *------------------------------------------------------------------------- */ static herr_t -H5G_dense_get_name_by_idx_fh_cb(const void *obj, size_t obj_len, void *_udata) +H5G__dense_get_name_by_idx_fh_cb(const void *obj, size_t obj_len, void *_udata) { H5G_fh_ud_gnbi_t *udata = (H5G_fh_ud_gnbi_t *)_udata; /* User data for fractal heap 'op' callback */ H5O_link_t *lnk; /* Pointer to link created from heap object */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Decode link information */ if(NULL == (lnk = (H5O_link_t *)H5O_msg_decode(udata->f, NULL, H5O_LINK_ID, obj_len, (const unsigned char *)obj))) @@ -1108,31 +1078,30 @@ H5G_dense_get_name_by_idx_fh_cb(const void *obj, size_t obj_len, void *_udata) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_dense_get_name_by_idx_fh_cb() */ +} /* end H5G__dense_get_name_by_idx_fh_cb() */ /*------------------------------------------------------------------------- - * Function: H5G_dense_get_name_by_idx_bt2_cb + * Function: H5G__dense_get_name_by_idx_bt2_cb * * Purpose: v2 B-tree callback for dense link storage 'get name by idx' call * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 19 2006 * *------------------------------------------------------------------------- */ static herr_t -H5G_dense_get_name_by_idx_bt2_cb(const void *_record, void *_bt2_udata) +H5G__dense_get_name_by_idx_bt2_cb(const void *_record, void *_bt2_udata) { const H5G_dense_bt2_name_rec_t *record = (const H5G_dense_bt2_name_rec_t *)_record; H5G_bt2_ud_gnbi_t *bt2_udata = (H5G_bt2_ud_gnbi_t *)_bt2_udata; /* User data for callback */ H5G_fh_ud_gnbi_t fh_udata; /* User data for fractal heap 'op' callback */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Prepare user data for callback */ /* down */ @@ -1141,7 +1110,7 @@ H5G_dense_get_name_by_idx_bt2_cb(const void *_record, void *_bt2_udata) fh_udata.name_size = bt2_udata->name_size; /* Call fractal heap 'op' routine, to perform user callback */ - if(H5HF_op(bt2_udata->fheap, record->id, H5G_dense_get_name_by_idx_fh_cb, &fh_udata) < 0) + if(H5HF_op(bt2_udata->fheap, record->id, H5G__dense_get_name_by_idx_fh_cb, &fh_udata) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTOPERATE, FAIL, "link found callback failed") /* Set the name's full length to return */ @@ -1149,7 +1118,7 @@ H5G_dense_get_name_by_idx_bt2_cb(const void *_record, void *_bt2_udata) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_dense_get_name_by_idx_bt2_cb() */ +} /* end H5G__dense_get_name_by_idx_bt2_cb() */ /*------------------------------------------------------------------------- @@ -1161,7 +1130,6 @@ done: * Failure: Negative * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 19 2006 * *------------------------------------------------------------------------- @@ -1231,7 +1199,7 @@ H5G__dense_get_name_by_idx(H5F_t *f, H5O_linfo_t *linfo, H5_index_t idx_type, udata.name_size = size; /* Retrieve the name according to the v2 B-tree's index order */ - if(H5B2_index(bt2, order, n, H5G_dense_get_name_by_idx_bt2_cb, &udata) < 0) + if(H5B2_index(bt2, 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 */ @@ -1271,27 +1239,26 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_dense_remove_fh_cb + * Function: H5G__dense_remove_fh_cb * * Purpose: Callback for fractal heap operator when removing links * * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 12 2006 * *------------------------------------------------------------------------- */ static herr_t -H5G_dense_remove_fh_cb(const void *obj, size_t obj_len, void *_udata) +H5G__dense_remove_fh_cb(const void *obj, size_t 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 + FUNC_ENTER_STATIC /* Decode link information */ if(NULL == (lnk = (H5O_link_t *)H5O_msg_decode(udata->f, NULL, H5O_LINK_ID, obj_len, (const unsigned char *)obj))) @@ -1332,31 +1299,30 @@ done: H5O_msg_free(H5O_LINK_ID, lnk); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_dense_remove_fh_cb() */ +} /* end H5G__dense_remove_fh_cb() */ /*------------------------------------------------------------------------- - * Function: H5G_dense_remove_bt2_cb + * Function: H5G__dense_remove_bt2_cb * * Purpose: v2 B-tree callback for dense link storage record removal * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 12 2006 * *------------------------------------------------------------------------- */ static herr_t -H5G_dense_remove_bt2_cb(const void *_record, void *_bt2_udata) +H5G__dense_remove_bt2_cb(const void *_record, void *_bt2_udata) { const H5G_dense_bt2_name_rec_t *record = (const H5G_dense_bt2_name_rec_t *)_record; H5G_bt2_ud_rm_t *bt2_udata = (H5G_bt2_ud_rm_t *)_bt2_udata; /* User data for callback */ H5G_fh_ud_rm_t fh_udata; /* User data for fractal heap 'op' callback */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Set up the user data for fractal heap 'op' callback */ fh_udata.f = bt2_udata->common.f; @@ -1365,7 +1331,7 @@ H5G_dense_remove_bt2_cb(const void *_record, void *_bt2_udata) fh_udata.replace_names = bt2_udata->replace_names; /* Call fractal heap 'op' routine, to perform user callback */ - if(H5HF_op(bt2_udata->common.fheap, record->id, H5G_dense_remove_fh_cb, &fh_udata) < 0) + if(H5HF_op(bt2_udata->common.fheap, record->id, H5G__dense_remove_fh_cb, &fh_udata) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTOPERATE, FAIL, "link removal callback failed") /* Remove record from fractal heap, if requested */ @@ -1375,7 +1341,7 @@ H5G_dense_remove_bt2_cb(const void *_record, void *_bt2_udata) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_dense_remove_bt2_cb() */ +} /* end H5G__dense_remove_bt2_cb() */ /*------------------------------------------------------------------------- @@ -1386,7 +1352,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 12 2006 * *------------------------------------------------------------------------- @@ -1430,7 +1395,7 @@ H5G__dense_remove(H5F_t *f, const H5O_linfo_t *linfo, H5RS_str_t *grp_full_path_ udata.replace_names = TRUE; /* Remove the record from the name index v2 B-tree */ - if(H5B2_remove(bt2, &udata, H5G_dense_remove_bt2_cb, &udata) < 0) + if(H5B2_remove(bt2, &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: @@ -1445,25 +1410,24 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_dense_remove_by_idx_fh_cb + * Function: H5G__dense_remove_by_idx_fh_cb * * Purpose: Callback for fractal heap operator when removing links by index * * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Nov 15 2006 * *------------------------------------------------------------------------- */ static herr_t -H5G_dense_remove_by_idx_fh_cb(const void *obj, size_t obj_len, void *_udata) +H5G__dense_remove_by_idx_fh_cb(const void *obj, size_t obj_len, void *_udata) { H5G_fh_ud_rmbi_t *udata = (H5G_fh_ud_rmbi_t *)_udata; /* User data for fractal heap 'op' callback */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Decode link information */ if(NULL == (udata->lnk = (H5O_link_t *)H5O_msg_decode(udata->f, NULL, H5O_LINK_ID, obj_len, (const unsigned char *)obj))) @@ -1473,24 +1437,23 @@ H5G_dense_remove_by_idx_fh_cb(const void *obj, size_t obj_len, void *_udata) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_dense_remove_by_idx_fh_cb() */ +} /* end H5G__dense_remove_by_idx_fh_cb() */ /*------------------------------------------------------------------------- - * Function: H5G_dense_remove_by_idx_bt2_cb + * Function: H5G__dense_remove_by_idx_bt2_cb * * Purpose: v2 B-tree callback for dense link storage record removal by index * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Nov 15 2006 * *------------------------------------------------------------------------- */ static herr_t -H5G_dense_remove_by_idx_bt2_cb(const void *_record, void *_bt2_udata) +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 */ @@ -1498,7 +1461,7 @@ H5G_dense_remove_by_idx_bt2_cb(const void *_record, void *_bt2_udata) const uint8_t *heap_id; /* Heap ID for link */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Determine the index being used */ if(bt2_udata->idx_type == H5_INDEX_NAME) { @@ -1521,7 +1484,7 @@ H5G_dense_remove_by_idx_bt2_cb(const void *_record, void *_bt2_udata) fh_udata.lnk = NULL; /* Call fractal heap 'op' routine, to perform user callback */ - if(H5HF_op(bt2_udata->fheap, heap_id, H5G_dense_remove_by_idx_fh_cb, &fh_udata) < 0) + if(H5HF_op(bt2_udata->fheap, heap_id, H5G__dense_remove_by_idx_fh_cb, &fh_udata) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTOPERATE, FAIL, "link removal callback failed") HDassert(fh_udata.lnk); @@ -1579,7 +1542,7 @@ done: 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() */ +} /* end H5G__dense_remove_by_idx_bt2_cb() */ /*------------------------------------------------------------------------- @@ -1591,7 +1554,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Nov 14 2006 * *------------------------------------------------------------------------- @@ -1662,7 +1624,7 @@ H5G__dense_remove_by_idx(H5F_t *f, const H5O_linfo_t *linfo, H5RS_str_t *grp_ful udata.grp_full_path_r = grp_full_path_r; /* Remove the record from the name index v2 B-tree */ - if(H5B2_remove_by_idx(bt2, order, n, H5G_dense_remove_by_idx_bt2_cb, &udata) < 0) + if(H5B2_remove_by_idx(bt2, 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 */ @@ -1700,7 +1662,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 12 2006 * *------------------------------------------------------------------------- @@ -1743,7 +1704,7 @@ H5G__dense_delete(H5F_t *f, 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, linfo->name_bt2_addr, NULL, H5G_dense_remove_bt2_cb, &udata) < 0) + if(H5B2_delete(f, linfo->name_bt2_addr, NULL, 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 */ diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c index 126456b..1d85eb7 100644 --- a/src/H5Gdeprec.c +++ b/src/H5Gdeprec.c @@ -15,7 +15,7 @@ * * Created: H5Gdeprec.c * June 21 2006 - * James Laird + * James Laird * * Purpose: Deprecated functions from the H5G interface. These * functions are here for compatibility purposes and may be @@ -986,7 +986,7 @@ H5G__get_objinfo_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char *name, c H5G_trav_goi_t *udata = (H5G_trav_goi_t *)_udata; /* User data passed in */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC; + FUNC_ENTER_STATIC /* Check if the name in this group resolved to a valid link */ if(lnk == NULL && obj_loc == NULL) @@ -1082,7 +1082,7 @@ H5G__get_objinfo(const H5G_loc_t *loc, const char *name, hbool_t follow_link, HDassert(name && *name); /* Reset stat buffer */ - if (statbuf) + if(statbuf) HDmemset(statbuf, 0, sizeof(H5G_stat_t)); /* Set up user data for retrieving information */ @@ -1091,11 +1091,11 @@ H5G__get_objinfo(const H5G_loc_t *loc, const char *name, hbool_t follow_link, udata.loc_file = loc->oloc->file; /* Traverse the group hierarchy to locate the object to get info about */ - if (H5G_traverse(loc, name, (unsigned)(follow_link ? H5G_TARGET_NORMAL : (H5G_TARGET_SLINK | H5G_TARGET_UDLINK)), H5G__get_objinfo_cb, &udata) < 0) + if(H5G_traverse(loc, name, (unsigned)(follow_link ? H5G_TARGET_NORMAL : (H5G_TARGET_SLINK | H5G_TARGET_UDLINK)), H5G__get_objinfo_cb, &udata) < 0) HGOTO_ERROR(H5E_SYM, H5E_EXISTS, FAIL, "name doesn't exist"); /* If we're pointing at a soft or UD link, get the real link length and type */ - if (statbuf && follow_link == 0) { + if(statbuf && follow_link == 0) { H5L_info2_t linfo; /* Link information buffer */ herr_t ret; diff --git a/src/H5Gent.c b/src/H5Gent.c index 19aef10..632ffa0 100644 --- a/src/H5Gent.c +++ b/src/H5Gent.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, September 19, 1997 */ @@ -86,7 +86,6 @@ H5FL_BLK_EXTERN(str_buf); * Failure: Negative * * Programmer: Robb Matzke - * matzke@llnl.gov * Jul 18 1997 * *------------------------------------------------------------------------- @@ -128,7 +127,6 @@ done: * Failure: Negative * * Programmer: Robb Matzke - * matzke@llnl.gov * Jul 18 1997 * *------------------------------------------------------------------------- @@ -194,7 +192,6 @@ done: * Failure: Negative * * Programmer: Robb Matzke - * matzke@llnl.gov * Jul 18 1997 * *------------------------------------------------------------------------- @@ -234,7 +231,6 @@ done: * Failure: Negative * * Programmer: Robb Matzke - * matzke@llnl.gov * Jul 18 1997 * *------------------------------------------------------------------------- @@ -306,7 +302,6 @@ done: * Failure: Negative * * Programmer: Pedro Vicente - * pvn@ncsa.uiuc.edu * ???day, August ??, 2002 * * Notes: 'depth' parameter determines how much of the group entry @@ -385,7 +380,6 @@ H5G__ent_reset(H5G_entry_t *ent) * Failure: Negative * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Sep 20 2005 * *------------------------------------------------------------------------- @@ -530,7 +524,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 29 1997 * *------------------------------------------------------------------------- diff --git a/src/H5Gint.c b/src/H5Gint.c index 0f9f9cb..c3c8719 100644 --- a/src/H5Gint.c +++ b/src/H5Gint.c @@ -15,7 +15,7 @@ * * Created: H5Gint.c * April 5 2007 - * Quincey Koziol + * Quincey Koziol * * Purpose: General use, "internal" routines for groups. * @@ -88,6 +88,7 @@ typedef struct { /********************/ static herr_t H5G__open_oid(H5G_t *grp); +static herr_t H5G__visit_cb(const H5O_link_t *lnk, void *_udata); /*********************/ @@ -179,7 +180,6 @@ done: * Failure: NULL * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 11 1997 * *------------------------------------------------------------------------- @@ -719,7 +719,7 @@ H5G_unmount(H5G_t *grp) /*------------------------------------------------------------------------- - * Function: H5G_iterate_cb + * Function: H5G__iterate_cb * * Purpose: Callback function for iterating over links in a group * @@ -732,12 +732,12 @@ H5G_unmount(H5G_t *grp) *------------------------------------------------------------------------- */ static herr_t -H5G_iterate_cb(const H5O_link_t *lnk, void *_udata) +H5G__iterate_cb(const H5O_link_t *lnk, void *_udata) { H5G_iter_appcall_ud_t *udata = (H5G_iter_appcall_ud_t *)_udata; /* User data for callback */ herr_t ret_value = H5_ITER_ERROR; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity check */ HDassert(lnk); @@ -770,7 +770,7 @@ H5G_iterate_cb(const H5O_link_t *lnk, void *_udata) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_iterate_cb() */ +} /* end H5G__iterate_cb() */ /*------------------------------------------------------------------------- @@ -818,7 +818,7 @@ H5G_iterate(H5G_loc_t *loc, const char *group_name, udata.op_data = op_data; /* Call the real group iteration routine */ - if((ret_value = H5G__obj_iterate(&(grp->oloc), idx_type, order, skip, last_lnk, H5G_iterate_cb, &udata)) < 0) + if((ret_value = H5G__obj_iterate(&(grp->oloc), idx_type, order, skip, last_lnk, H5G__iterate_cb, &udata)) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "error iterating over links") done: @@ -835,7 +835,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_free_visit_visited + * Function: H5G__free_visit_visited * * Purpose: Free the key for an object visited during a group traversal * @@ -847,18 +847,18 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5G_free_visit_visited(void *item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSED *operator_data/*in,out*/) +H5G__free_visit_visited(void *item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSED *operator_data/*in,out*/) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR item = H5FL_FREE(H5_obj_t, item); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5G_free_visit_visited() */ +} /* end H5G__free_visit_visited() */ /*------------------------------------------------------------------------- - * Function: H5G_visit_cb + * Function: H5G__visit_cb * * Purpose: Callback function for recursively visiting links from a group * @@ -871,7 +871,7 @@ H5G_free_visit_visited(void *item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSED *------------------------------------------------------------------------- */ static herr_t -H5G_visit_cb(const H5O_link_t *lnk, void *_udata) +H5G__visit_cb(const H5O_link_t *lnk, void *_udata) { H5G_iter_visit_ud_t *udata = (H5G_iter_visit_ud_t *)_udata; /* User data for callback */ H5L_info2_t info; /* Link info */ @@ -884,7 +884,7 @@ H5G_visit_cb(const H5O_link_t *lnk, void *_udata) size_t len_needed; /* Length of path string needed */ herr_t ret_value = H5_ITER_CONT; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity check */ HDassert(lnk); @@ -998,7 +998,7 @@ H5G_visit_cb(const H5O_link_t *lnk, void *_udata) udata->curr_loc = &obj_loc; /* Iterate over links in group */ - ret_value = H5G__obj_iterate(&obj_oloc, idx_type, udata->order, (hsize_t)0, NULL, H5G_visit_cb, udata); + ret_value = H5G__obj_iterate(&obj_oloc, idx_type, udata->order, (hsize_t)0, NULL, H5G__visit_cb, udata); /* Restore location */ udata->curr_loc = old_loc; @@ -1016,7 +1016,7 @@ done: HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, H5_ITER_ERROR, "can't free location") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_visit_cb() */ +} /* end H5G__visit_cb() */ /*------------------------------------------------------------------------- @@ -1140,14 +1140,14 @@ H5G_visit(H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, } /* end if */ /* Call the link iteration routine */ - if((ret_value = H5G__obj_iterate(&(grp->oloc), idx_type, order, (hsize_t)0, NULL, H5G_visit_cb, &udata)) < 0) + if((ret_value = H5G__obj_iterate(&(grp->oloc), idx_type, order, (hsize_t)0, NULL, H5G__visit_cb, &udata)) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "can't visit links") done: /* Release user data resources */ H5MM_xfree(udata.path); if(udata.visited) - H5SL_destroy(udata.visited, H5G_free_visit_visited, NULL); + H5SL_destroy(udata.visited, H5G__free_visit_visited, NULL); /* Release the group opened */ if(gid != H5I_INVALID_HID) { diff --git a/src/H5Glink.c b/src/H5Glink.c index 6c42f1d..8b8377a 100644 --- a/src/H5Glink.c +++ b/src/H5Glink.c @@ -15,7 +15,7 @@ * * Created: H5Glink.c * Nov 13 2006 - * Quincey Koziol + * Quincey Koziol * * Purpose: Functions for handling links in groups. * @@ -63,10 +63,10 @@ /* Local Prototypes */ /********************/ -static int H5G_link_cmp_name_inc(const void *lnk1, const void *lnk2); -static int H5G_link_cmp_name_dec(const void *lnk1, const void *lnk2); -static int H5G_link_cmp_corder_inc(const void *lnk1, const void *lnk2); -static int H5G_link_cmp_corder_dec(const void *lnk1, const void *lnk2); +static int H5G__link_cmp_name_inc(const void *lnk1, const void *lnk2); +static int H5G__link_cmp_name_dec(const void *lnk1, const void *lnk2); +static int H5G__link_cmp_corder_inc(const void *lnk1, const void *lnk2); +static int H5G__link_cmp_corder_dec(const void *lnk1, const void *lnk2); /*********************/ @@ -86,7 +86,7 @@ static int H5G_link_cmp_corder_dec(const void *lnk1, const void *lnk2); /*------------------------------------------------------------------------- - * Function: H5G_link_cmp_name_inc + * Function: H5G__link_cmp_name_inc * * Purpose: Callback routine for comparing two link names, in * increasing alphabetic order @@ -98,22 +98,21 @@ static int H5G_link_cmp_corder_dec(const void *lnk1, const void *lnk2); * (i.e. same as strcmp()) * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Sep 5 2005 * *------------------------------------------------------------------------- */ static int -H5G_link_cmp_name_inc(const void *lnk1, const void *lnk2) +H5G__link_cmp_name_inc(const void *lnk1, const void *lnk2) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR FUNC_LEAVE_NOAPI(HDstrcmp(((const H5O_link_t *)lnk1)->name, ((const H5O_link_t *)lnk2)->name)) -} /* end H5G_link_cmp_name_inc() */ +} /* end H5G__link_cmp_name_inc() */ /*------------------------------------------------------------------------- - * Function: H5G_link_cmp_name_dec + * Function: H5G__link_cmp_name_dec * * Purpose: Callback routine for comparing two link names, in * decreasing alphabetic order @@ -125,22 +124,21 @@ H5G_link_cmp_name_inc(const void *lnk1, const void *lnk2) * (i.e. opposite strcmp()) * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Sep 25 2006 * *------------------------------------------------------------------------- */ static int -H5G_link_cmp_name_dec(const void *lnk1, const void *lnk2) +H5G__link_cmp_name_dec(const void *lnk1, const void *lnk2) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR FUNC_LEAVE_NOAPI(HDstrcmp(((const H5O_link_t *)lnk2)->name, ((const H5O_link_t *)lnk1)->name)) -} /* end H5G_link_cmp_name_dec() */ +} /* end H5G__link_cmp_name_dec() */ /*------------------------------------------------------------------------- - * Function: H5G_link_cmp_corder_inc + * Function: H5G__link_cmp_corder_inc * * Purpose: Callback routine for comparing two link creation orders, in * increasing order @@ -151,17 +149,16 @@ H5G_link_cmp_name_dec(const void *lnk1, const void *lnk2) * as equal, their order in the sorted array is undefined. * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Nov 6 2006 * *------------------------------------------------------------------------- */ static int -H5G_link_cmp_corder_inc(const void *lnk1, const void *lnk2) +H5G__link_cmp_corder_inc(const void *lnk1, const void *lnk2) { int ret_value = -1; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR if(((const H5O_link_t *)lnk1)->corder < ((const H5O_link_t *)lnk2)->corder) ret_value = -1; @@ -171,11 +168,11 @@ H5G_link_cmp_corder_inc(const void *lnk1, const void *lnk2) ret_value = 0; FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_link_cmp_corder_inc() */ +} /* end H5G__link_cmp_corder_inc() */ /*------------------------------------------------------------------------- - * Function: H5G_link_cmp_corder_dec + * Function: H5G__link_cmp_corder_dec * * Purpose: Callback routine for comparing two link creation orders, in * decreasing order @@ -186,17 +183,16 @@ H5G_link_cmp_corder_inc(const void *lnk1, const void *lnk2) * as equal, their order in the sorted array is undefined. * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Nov 6 2006 * *------------------------------------------------------------------------- */ static int -H5G_link_cmp_corder_dec(const void *lnk1, const void *lnk2) +H5G__link_cmp_corder_dec(const void *lnk1, const void *lnk2) { int ret_value = -1; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR if(((const H5O_link_t *)lnk1)->corder < ((const H5O_link_t *)lnk2)->corder) ret_value = 1; @@ -206,7 +202,7 @@ H5G_link_cmp_corder_dec(const void *lnk1, const void *lnk2) ret_value = 0; FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_link_cmp_corder_dec() */ +} /* end H5G__link_cmp_corder_dec() */ /*------------------------------------------------------------------------- @@ -217,7 +213,6 @@ H5G_link_cmp_corder_dec(const void *lnk1, const void *lnk2) * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 16 2006 * *------------------------------------------------------------------------- @@ -439,18 +434,18 @@ H5G__link_sort_table(H5G_link_table_t *ltable, H5_index_t idx_type, /* Pick appropriate sorting routine */ if(idx_type == H5_INDEX_NAME) { if(order == H5_ITER_INC) - HDqsort(ltable->lnks, ltable->nlinks, sizeof(H5O_link_t), H5G_link_cmp_name_inc); + HDqsort(ltable->lnks, ltable->nlinks, sizeof(H5O_link_t), H5G__link_cmp_name_inc); else if(order == H5_ITER_DEC) - HDqsort(ltable->lnks, ltable->nlinks, sizeof(H5O_link_t), H5G_link_cmp_name_dec); + HDqsort(ltable->lnks, ltable->nlinks, sizeof(H5O_link_t), H5G__link_cmp_name_dec); else HDassert(order == H5_ITER_NATIVE); } /* end if */ else { HDassert(idx_type == H5_INDEX_CRT_ORDER); if(order == H5_ITER_INC) - HDqsort(ltable->lnks, ltable->nlinks, sizeof(H5O_link_t), H5G_link_cmp_corder_inc); + HDqsort(ltable->lnks, ltable->nlinks, sizeof(H5O_link_t), H5G__link_cmp_corder_inc); else if(order == H5_ITER_DEC) - HDqsort(ltable->lnks, ltable->nlinks, sizeof(H5O_link_t), H5G_link_cmp_corder_dec); + HDqsort(ltable->lnks, ltable->nlinks, sizeof(H5O_link_t), H5G__link_cmp_corder_dec); else HDassert(order == H5_ITER_NATIVE); } /* end else */ @@ -561,7 +556,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Nov 13 2006 * *------------------------------------------------------------------------- diff --git a/src/H5Gloc.c b/src/H5Gloc.c index 4d89abb..3109b49 100644 --- a/src/H5Gloc.c +++ b/src/H5Gloc.c @@ -15,7 +15,7 @@ * * Created: H5Gloc.c * Sep 13 2005 - * Quincey Koziol + * Quincey Koziol * * Purpose: Functions for working with group "locations" * @@ -621,7 +621,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_loc_exists_cb + * Function: H5G__loc_exists_cb * * Purpose: Callback for checking if an object exists * @@ -633,13 +633,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5G_loc_exists_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char H5_ATTR_UNUSED *name, +H5G__loc_exists_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char H5_ATTR_UNUSED *name, const H5O_link_t H5_ATTR_UNUSED *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/) { H5G_loc_exists_t *udata = (H5G_loc_exists_t *)_udata; /* User data passed in */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check if the name in this group resolved to a valid object */ if(obj_loc == NULL) @@ -655,7 +655,7 @@ H5G_loc_exists_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char H5_ATTR_UN *own_loc = H5G_OWN_NONE; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5G_loc_exists_cb() */ +} /* end H5G__loc_exists_cb() */ /*------------------------------------------------------------------------- @@ -687,7 +687,7 @@ H5G_loc_exists(const H5G_loc_t *loc, const char *name) udata.exists = FALSE; /* Traverse group hierarchy to locate object */ - if(H5G_traverse(loc, name, H5G_TARGET_EXISTS, H5G_loc_exists_cb, &udata) < 0) + if(H5G_traverse(loc, name, H5G_TARGET_EXISTS, H5G__loc_exists_cb, &udata) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't check if object exists") /* Set return value */ @@ -809,9 +809,9 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_loc_info + * Function: H5G_loc_info * - * Purpose: Retrieve the data model information for an object from a group location + * Purpose: Retrieve the data model information for an object from a group location * and path to that object * * Return: Non-negative on success/Negative on failure diff --git a/src/H5Gmodule.h b/src/H5Gmodule.h index 19ea982..883aa6d 100644 --- a/src/H5Gmodule.h +++ b/src/H5Gmodule.h @@ -11,7 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, September 12, 2015 * * Purpose: This file contains declarations which define macros for the diff --git a/src/H5Gname.c b/src/H5Gname.c index 4b0f04c..95b85b4 100644 --- a/src/H5Gname.c +++ b/src/H5Gname.c @@ -15,7 +15,7 @@ * * Created: H5Gname.c * Sep 12 2005 - * Quincey Koziol + * Quincey Koziol * * Purpose: Functions for handling group hierarchy paths. * @@ -81,14 +81,14 @@ typedef struct H5G_gnba_iter_t { /* Local Prototypes */ /********************/ -static htri_t H5G_common_path(const H5RS_str_t *fullpath_r, const H5RS_str_t *prefix_r); -static H5RS_str_t *H5G_build_fullpath(const char *prefix, const char *name); +static htri_t H5G__common_path(const H5RS_str_t *fullpath_r, const H5RS_str_t *prefix_r); +static H5RS_str_t *H5G__build_fullpath(const char *prefix, const char *name); #ifdef NOT_YET -static H5RS_str_t *H5G_build_fullpath_refstr_refstr(const H5RS_str_t *prefix_r, const H5RS_str_t *name_r); +static H5RS_str_t *H5G__build_fullpath_refstr_refstr(const H5RS_str_t *prefix_r, const H5RS_str_t *name_r); #endif /* NOT_YET */ -static herr_t H5G_name_move_path(H5RS_str_t **path_r_ptr, +static herr_t H5G__name_move_path(H5RS_str_t **path_r_ptr, const char *full_suffix, const char *src_path, const char *dst_path); -static int H5G_name_replace_cb(void *obj_ptr, hid_t obj_id, void *key); +static int H5G__name_replace_cb(void *obj_ptr, hid_t obj_id, void *key); /*********************/ @@ -123,7 +123,6 @@ H5FL_BLK_EXTERN(str_buf); * Failure: Ptr to the null terminator of NAME. * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 11 1997 * *------------------------------------------------------------------------- @@ -209,28 +208,28 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_common_path + * Function: H5G__common_path * * Purpose: Determine if one path is a valid prefix of another path * * Return: TRUE for valid prefix, FALSE for not a valid prefix, FAIL * on error * - * Programmer: Quincey Koziol, koziol@ncsa.uiuc.edu + * Programmer: Quincey Koziol * * Date: September 24, 2002 * *------------------------------------------------------------------------- */ static htri_t -H5G_common_path(const H5RS_str_t *fullpath_r, const H5RS_str_t *prefix_r) +H5G__common_path(const H5RS_str_t *fullpath_r, const H5RS_str_t *prefix_r) { const char *fullpath; /* Pointer to actual fullpath string */ const char *prefix; /* Pointer to actual prefix string */ size_t nchars1,nchars2; /* Number of characters in components */ htri_t ret_value=FALSE; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Get component of each name */ fullpath=H5RS_get_str(fullpath_r); @@ -271,24 +270,24 @@ H5G_common_path(const H5RS_str_t *fullpath_r, const H5RS_str_t *prefix_r) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_common_path() */ +} /* end H5G__common_path() */ /*------------------------------------------------------------------------- - * Function: H5G_build_fullpath + * Function: H5G__build_fullpath * * Purpose: Build a full path from a prefix & base pair of strings * * Return: Pointer to reference counted string on success, NULL on error * - * Programmer: Quincey Koziol, koziol@ncsa.uiuc.edu + * Programmer: Quincey Koziol * * Date: August 19, 2005 * *------------------------------------------------------------------------- */ static H5RS_str_t * -H5G_build_fullpath(const char *prefix, const char *name) +H5G__build_fullpath(const char *prefix, const char *name) { char *full_path; /* Full user path built */ size_t orig_path_len; /* Original length of the path */ @@ -297,7 +296,7 @@ H5G_build_fullpath(const char *prefix, const char *name) unsigned need_sep; /* Flag to indicate if separator is needed */ H5RS_str_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity check */ HDassert(prefix); @@ -332,7 +331,7 @@ H5G_build_fullpath(const char *prefix, const char *name) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_build_fullpath() */ +} /* end H5G__build_fullpath() */ /*------------------------------------------------------------------------- @@ -343,7 +342,7 @@ done: * Return: Success: Non-NULL, combined path * Failure: NULL * - * Programmer: Quincey Koziol, koziol@ncsa.uiuc.edu + * Programmer: Quincey Koziol * Tuesday, October 11, 2005 * *------------------------------------------------------------------------- @@ -364,7 +363,7 @@ H5G_build_fullpath_refstr_str(H5RS_str_t *prefix_r, const char *name) HDassert(prefix); /* Create reference counted string for path */ - ret_value = H5G_build_fullpath(prefix, name); + ret_value = H5G__build_fullpath(prefix, name); FUNC_LEAVE_NOAPI(ret_value) } /* end H5G_build_fullpath_refstr_str() */ @@ -379,20 +378,20 @@ H5G_build_fullpath_refstr_str(H5RS_str_t *prefix_r, const char *name) * * Return: Pointer to reference counted string on success, NULL on error * - * Programmer: Quincey Koziol, koziol@ncsa.uiuc.edu + * Programmer: Quincey Koziol * * Date: August 19, 2005 * *------------------------------------------------------------------------- */ static H5RS_str_t * -H5G_build_fullpath_refstr_refstr(const H5RS_str_t *prefix_r, const H5RS_str_t *name_r) +H5G__build_fullpath_refstr_refstr(const H5RS_str_t *prefix_r, const H5RS_str_t *name_r) { const char *prefix; /* Pointer to raw string of prefix */ const char *name; /* Pointer to raw string of name */ H5RS_str_t *ret_value; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Get the pointer to the prefix */ prefix = H5RS_get_str(prefix_r); @@ -401,10 +400,10 @@ H5G_build_fullpath_refstr_refstr(const H5RS_str_t *prefix_r, const H5RS_str_t *n name = H5RS_get_str(name_r); /* Create reference counted string for path */ - ret_value = H5G_build_fullpath(prefix, name); + ret_value = H5G__build_fullpath(prefix, name); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_build_fullpath_refstr_refstr() */ +} /* end H5G__build_fullpath_refstr_refstr() */ #endif /* NOT_YET */ @@ -448,7 +447,7 @@ H5G__name_init(H5G_name_t *name, const char *path) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * Thursday, August 22, 2002 * *------------------------------------------------------------------------- @@ -552,10 +551,6 @@ H5G_name_copy(H5G_name_t *dst, const H5G_name_t *src, H5_copy_depth_t depth) * Programmer: Quincey Koziol * Tuesday, December 13, 2005 * - * Modifications: Leon Arber - * Oct. 18, 2006 - * Added functionality to get the name for a reference. - * *------------------------------------------------------------------------- */ ssize_t @@ -639,7 +634,7 @@ H5G_name_reset(H5G_name_t *name) * * Return: Success * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: August 22, 2002 * @@ -668,7 +663,7 @@ H5G_name_free(H5G_name_t *name) /*------------------------------------------------------------------------- - * Function: H5G_name_move_path + * Function: H5G__name_move_path * * Purpose: Update a user or canonical path after an object moves * @@ -681,7 +676,7 @@ H5G_name_free(H5G_name_t *name) *------------------------------------------------------------------------- */ static herr_t -H5G_name_move_path(H5RS_str_t **path_r_ptr, const char *full_suffix, const char *src_path, +H5G__name_move_path(H5RS_str_t **path_r_ptr, const char *full_suffix, const char *src_path, const char *dst_path) { const char *path; /* Path to update */ @@ -689,7 +684,7 @@ H5G_name_move_path(H5RS_str_t **path_r_ptr, const char *full_suffix, const char size_t full_suffix_len; /* Length of full suffix */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments */ HDassert(path_r_ptr && *path_r_ptr); @@ -767,24 +762,24 @@ H5G_name_move_path(H5RS_str_t **path_r_ptr, const char *full_suffix, const char done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_name_move_path() */ +} /* end H5G__name_move_path() */ /*------------------------------------------------------------------------- - * Function: H5G_name_replace_cb + * Function: H5G__name_replace_cb * * Purpose: H5I_iterate callback function to replace group entry names * * Return: Success: 0, Failure: -1 * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: June 5, 2002 * *------------------------------------------------------------------------- */ static int -H5G_name_replace_cb(void *obj_ptr, hid_t obj_id, void *key) +H5G__name_replace_cb(void *obj_ptr, hid_t obj_id, void *key) { const H5G_names_t *names = (const H5G_names_t *)key; /* Get operation's information */ H5O_loc_t *oloc; /* Object location for object that the ID refers to */ @@ -793,7 +788,7 @@ H5G_name_replace_cb(void *obj_ptr, hid_t obj_id, void *key) hbool_t obj_in_child = FALSE; /* Flag to indicate that the object is in the child mount hier. */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(obj_ptr); @@ -912,7 +907,7 @@ H5G_name_replace_cb(void *obj_ptr, hid_t obj_id, void *key) else { /* Check if the source is along the entry's path */ /* (But not actually the entry itself) */ - if(H5G_common_path(obj_path->full_path_r, names->src_full_path_r) && + if(H5G__common_path(obj_path->full_path_r, names->src_full_path_r) && H5RS_cmp(obj_path->full_path_r, names->src_full_path_r)) { /* Hide the user path */ (obj_path->obj_hidden)++; @@ -962,7 +957,7 @@ H5G_name_replace_cb(void *obj_ptr, hid_t obj_id, void *key) } /* end if */ else { /* Check if file being unmounted was hiding the object */ - if(H5G_common_path(obj_path->full_path_r, names->src_full_path_r) && + if(H5G__common_path(obj_path->full_path_r, names->src_full_path_r) && H5RS_cmp(obj_path->full_path_r, names->src_full_path_r)) { /* Un-hide the user path */ (obj_path->obj_hidden)--; @@ -976,7 +971,7 @@ H5G_name_replace_cb(void *obj_ptr, hid_t obj_id, void *key) */ case H5G_NAME_DELETE: /* Check if the location being unlinked is in the path for the current object */ - if(H5G_common_path(obj_path->full_path_r, names->src_full_path_r)) { + if(H5G__common_path(obj_path->full_path_r, names->src_full_path_r)) { /* Free paths for object */ H5G_name_free(obj_path); } /* end if */ @@ -988,7 +983,7 @@ H5G_name_replace_cb(void *obj_ptr, hid_t obj_id, void *key) */ case H5G_NAME_MOVE: /* Link move case, check for relative names case */ /* Check if the src object moved is in the current object's path */ - if(H5G_common_path(obj_path->full_path_r, names->src_full_path_r)) { + if(H5G__common_path(obj_path->full_path_r, names->src_full_path_r)) { const char *full_path; /* Full path of current object */ const char *full_suffix; /* Suffix of full path, after src_path */ size_t full_suffix_len; /* Length of suffix of full path after src_path*/ @@ -1017,7 +1012,7 @@ H5G_name_replace_cb(void *obj_ptr, hid_t obj_id, void *key) /* Update the user path, if one exists */ if(obj_path->user_path_r) - if(H5G_name_move_path(&(obj_path->user_path_r), full_suffix, src_path, dst_path) < 0) + if(H5G__name_move_path(&(obj_path->user_path_r), full_suffix, src_path, dst_path) < 0) HGOTO_ERROR(H5E_SYM, H5E_PATH, FAIL, "can't build user path name") /* Build new full path */ @@ -1045,7 +1040,7 @@ H5G_name_replace_cb(void *obj_ptr, hid_t obj_id, void *key) done: FUNC_LEAVE_NOAPI(ret_value); -} /* end H5G_name_replace_cb() */ +} /* end H5G__name_replace_cb() */ /*------------------------------------------------------------------------- @@ -1060,7 +1055,7 @@ done: * * Return: Success: 0, Failure: -1 * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: June 11, 2002 * @@ -1171,17 +1166,17 @@ H5G_name_replace(const H5O_link_t *lnk, H5G_names_op_t op, H5F_t *src_file, /* Search through group IDs */ if(search_group) - if(H5I_iterate(H5I_GROUP, H5G_name_replace_cb, &names, FALSE) < 0) + if(H5I_iterate(H5I_GROUP, H5G__name_replace_cb, &names, FALSE) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "can't iterate over groups") /* Search through dataset IDs */ if(search_dataset) - if(H5I_iterate(H5I_DATASET, H5G_name_replace_cb, &names, FALSE) < 0) + if(H5I_iterate(H5I_DATASET, H5G__name_replace_cb, &names, FALSE) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "can't iterate over datasets") /* Search through datatype IDs */ if(search_datatype) - if(H5I_iterate(H5I_DATATYPE, H5G_name_replace_cb, &names, FALSE) < 0) + if(H5I_iterate(H5I_DATATYPE, H5G__name_replace_cb, &names, FALSE) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "can't iterate over datatypes") } /* end if */ } /* end if */ @@ -1192,7 +1187,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_get_name_by_addr_cb + * Function: H5G__get_name_by_addr_cb * * Purpose: Callback for retrieving object's name by address * @@ -1206,7 +1201,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5G_get_name_by_addr_cb(hid_t gid, const char *path, const H5L_info2_t *linfo, +H5G__get_name_by_addr_cb(hid_t gid, const char *path, const H5L_info2_t *linfo, void *_udata) { H5G_gnba_iter_t *udata = (H5G_gnba_iter_t *)_udata; /* User data for iteration */ @@ -1216,7 +1211,7 @@ H5G_get_name_by_addr_cb(hid_t gid, const char *path, const H5L_info2_t *linfo, hbool_t obj_found = FALSE; /* Object at 'path' found */ herr_t ret_value = H5_ITER_CONT; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity check */ HDassert(path); @@ -1266,7 +1261,7 @@ done: HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, H5_ITER_ERROR, "can't free location") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_get_name_by_addr_cb() */ +} /* end H5G__get_name_by_addr_cb() */ /*------------------------------------------------------------------------- @@ -1315,7 +1310,7 @@ H5G_get_name_by_addr(H5F_t *f, const H5O_loc_t *loc, char *name, size_t size) udata.path = NULL; /* Visit all the links in the file */ - if((status = H5G_visit(&root_loc, "/", H5_INDEX_NAME, H5_ITER_NATIVE, H5G_get_name_by_addr_cb, &udata)) < 0) + if((status = H5G_visit(&root_loc, "/", H5_INDEX_NAME, H5_ITER_NATIVE, H5G__get_name_by_addr_cb, &udata)) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADITER, (-1), "group traversal failed while looking for object name") else if(status > 0) found_obj = TRUE; diff --git a/src/H5Gnode.c b/src/H5Gnode.c index 9faa0b5..5578f83 100644 --- a/src/H5Gnode.c +++ b/src/H5Gnode.c @@ -15,7 +15,7 @@ * * Created: H5Gnode.c * Jun 26 1997 - * Robb Matzke + * Robb Matzke * * Purpose: Functions for handling symbol table nodes. A * symbol table node is a small collection of symbol @@ -75,21 +75,21 @@ typedef struct H5G_node_key_t { /********************/ /* B-tree callbacks */ -static H5UC_t *H5G_node_get_shared(const H5F_t *f, const void *_udata); +static H5UC_t *H5G__node_get_shared(const H5F_t *f, const void *_udata); static herr_t H5G__node_create(H5F_t *f, H5B_ins_t op, void *_lt_key, void *_udata, void *_rt_key, haddr_t *addr_p/*out*/); -static int H5G_node_cmp2(void *_lt_key, void *_udata, void *_rt_key); -static int H5G_node_cmp3(void *_lt_key, void *_udata, void *_rt_key); -static htri_t H5G_node_found(H5F_t *f, haddr_t addr, const void *_lt_key, +static int H5G__node_cmp2(void *_lt_key, void *_udata, void *_rt_key); +static int H5G__node_cmp3(void *_lt_key, void *_udata, void *_rt_key); +static htri_t H5G__node_found(H5F_t *f, haddr_t addr, const void *_lt_key, void *_udata); static H5B_ins_t H5G__node_insert(H5F_t *f, haddr_t addr, void *_lt_key, hbool_t *lt_key_changed, void *_md_key, void *_udata, void *_rt_key, hbool_t *rt_key_changed, haddr_t *new_node_p/*out*/); -static H5B_ins_t H5G_node_remove(H5F_t *f, haddr_t addr, void *lt_key, +static H5B_ins_t H5G__node_remove(H5F_t *f, haddr_t addr, void *lt_key, hbool_t *lt_key_changed, void *udata, void *rt_key, hbool_t *rt_key_changed); -static herr_t H5G_node_decode_key(const H5B_shared_t *shared, const uint8_t *raw, void *_key); -static herr_t H5G_node_encode_key(const H5B_shared_t *shared, uint8_t *raw, const void *_key); -static herr_t H5G_node_debug_key(FILE *stream, int indent, int fwidth, +static herr_t H5G__node_decode_key(const H5B_shared_t *shared, const uint8_t *raw, void *_key); +static herr_t H5G__node_encode_key(const H5B_shared_t *shared, uint8_t *raw, const void *_key); +static herr_t H5G__node_debug_key(FILE *stream, int indent, int fwidth, const void *key, const void *udata); @@ -101,19 +101,19 @@ static herr_t H5G_node_debug_key(FILE *stream, int indent, int fwidth, H5B_class_t H5B_SNODE[1] = {{ H5B_SNODE_ID, /*id */ sizeof(H5G_node_key_t), /*sizeof_nkey */ - H5G_node_get_shared, /*get_shared */ + H5G__node_get_shared, /*get_shared */ H5G__node_create, /*new */ - H5G_node_cmp2, /*cmp2 */ - H5G_node_cmp3, /*cmp3 */ - H5G_node_found, /*found */ + H5G__node_cmp2, /*cmp2 */ + H5G__node_cmp3, /*cmp3 */ + H5G__node_found, /*found */ H5G__node_insert, /*insert */ TRUE, /*follow min branch? */ TRUE, /*follow max branch? */ H5B_RIGHT, /*critical key */ - H5G_node_remove, /*remove */ - H5G_node_decode_key, /*decode */ - H5G_node_encode_key, /*encode */ - H5G_node_debug_key /*debug */ + H5G__node_remove, /*remove */ + H5G__node_decode_key, /*decode */ + H5G__node_encode_key, /*encode */ + H5G__node_debug_key /*debug */ }}; /* Declare a free list to manage the H5G_node_t struct */ @@ -134,7 +134,7 @@ H5FL_SEQ_DEFINE(H5G_entry_t); /*------------------------------------------------------------------------- - * Function: H5G_node_get_shared + * Function: H5G__node_get_shared * * Purpose: Returns the shared B-tree info for the specified UDATA. * @@ -145,41 +145,38 @@ H5FL_SEQ_DEFINE(H5G_entry_t); * Programmer: Robb Matzke * Wednesday, October 8, 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ static H5UC_t * -H5G_node_get_shared(const H5F_t *f, const void H5_ATTR_UNUSED *_udata) +H5G__node_get_shared(const H5F_t *f, const void H5_ATTR_UNUSED *_udata) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(f); /* Return the pointer to the ref-count object */ FUNC_LEAVE_NOAPI(H5F_GRP_BTREE_SHARED(f)) -} /* end H5G_node_get_shared() */ +} /* end H5G__node_get_shared() */ /*------------------------------------------------------------------------- - * Function: H5G_node_decode_key + * Function: H5G__node_decode_key * * Purpose: Decodes a raw key into a native key. * * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Jul 8 1997 * *------------------------------------------------------------------------- */ static herr_t -H5G_node_decode_key(const H5B_shared_t *shared, const uint8_t *raw, void *_key) +H5G__node_decode_key(const H5B_shared_t *shared, const uint8_t *raw, void *_key) { H5G_node_key_t *key = (H5G_node_key_t *) _key; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(shared); HDassert(raw); @@ -188,28 +185,27 @@ H5G_node_decode_key(const H5B_shared_t *shared, const uint8_t *raw, void *_key) H5F_DECODE_LENGTH_LEN(raw, key->offset, shared->sizeof_len); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5G_node_decode_key() */ +} /* end H5G__node_decode_key() */ /*------------------------------------------------------------------------- - * Function: H5G_node_encode_key + * Function: H5G__node_encode_key * * Purpose: Encodes a native key into a raw key. * * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Jul 8 1997 * *------------------------------------------------------------------------- */ static herr_t -H5G_node_encode_key(const H5B_shared_t *shared, uint8_t *raw, const void *_key) +H5G__node_encode_key(const H5B_shared_t *shared, uint8_t *raw, const void *_key) { const H5G_node_key_t *key = (const H5G_node_key_t *) _key; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(shared); HDassert(raw); @@ -218,11 +214,11 @@ H5G_node_encode_key(const H5B_shared_t *shared, uint8_t *raw, const void *_key) H5F_ENCODE_LENGTH_LEN(raw, key->offset, shared->sizeof_len); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5G_node_encode_key() */ +} /* end H5G__node_encode_key() */ /*------------------------------------------------------------------------- - * Function: H5G_node_debug_key + * Function: H5G__node_debug_key * * Purpose: Prints a key. * @@ -234,13 +230,13 @@ H5G_node_encode_key(const H5B_shared_t *shared, uint8_t *raw, const void *_key) *------------------------------------------------------------------------- */ static herr_t -H5G_node_debug_key(FILE *stream, int indent, int fwidth, const void *_key, +H5G__node_debug_key(FILE *stream, int indent, int fwidth, const void *_key, const void *_udata) { const H5G_node_key_t *key = (const H5G_node_key_t *) _key; const H5G_bt_common_t *udata = (const H5G_bt_common_t *) _udata; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(key); @@ -259,7 +255,7 @@ H5G_node_debug_key(FILE *stream, int indent, int fwidth, const void *_key, HDfprintf(stream, "%*s%-*s ", indent, "", fwidth, "Cannot get name; heap address not specified\n"); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5G_node_debug_key() */ +} /* end H5G__node_debug_key() */ /*------------------------------------------------------------------------- @@ -270,7 +266,6 @@ H5G_node_debug_key(FILE *stream, int indent, int fwidth, const void *_key, * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Jan 15 2003 * *------------------------------------------------------------------------- @@ -310,7 +305,6 @@ H5G__node_free(H5G_node_t *sym) * Failure: Negative * * Programmer: Robb Matzke - * matzke@llnl.gov * Jun 23 1997 * *------------------------------------------------------------------------- @@ -367,7 +361,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_node_cmp2 + * Function: H5G__node_cmp2 * * Purpose: Compares two keys from a B-tree node (LT_KEY and RT_KEY). * The UDATA pointer supplies extra data not contained in the @@ -382,15 +376,12 @@ done: * Failure: FAIL (same as LT_KEYheap); @@ -416,11 +407,11 @@ H5G_node_cmp2(void *_lt_key, void *_udata, void *_rt_key) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5G_node_cmp2() */ +} /* H5G__node_cmp2() */ /*------------------------------------------------------------------------- - * Function: H5G_node_cmp3 + * Function: H5G__node_cmp3 * * Purpose: Compares two keys from a B-tree node (LT_KEY and RT_KEY) * against another key (not necessarily the same type) @@ -439,15 +430,12 @@ done: * Failure: FAIL (same as UDATA < LT_KEY) * * Programmer: Robb Matzke - * matzke@llnl.gov * Jun 23 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5G_node_cmp3(void *_lt_key, void *_udata, void *_rt_key) +H5G__node_cmp3(void *_lt_key, void *_udata, void *_rt_key) { H5G_bt_common_t *udata = (H5G_bt_common_t *) _udata; H5G_node_key_t *lt_key = (H5G_node_key_t *) _lt_key; @@ -455,7 +443,7 @@ H5G_node_cmp3(void *_lt_key, void *_udata, void *_rt_key) const char *s; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity checks */ HDassert(udata && udata->heap); @@ -477,11 +465,11 @@ H5G_node_cmp3(void *_lt_key, void *_udata, void *_rt_key) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_node_cmp3() */ +} /* end H5G__node_cmp3() */ /*------------------------------------------------------------------------- - * Function: H5G_node_found + * Function: H5G__node_found * * Purpose: The B-tree search engine has found the symbol table node * which contains the requested symbol if the symbol exists. @@ -501,13 +489,12 @@ done: * Failure: Negative if not found. * * Programmer: Robb Matzke - * matzke@llnl.gov * Jun 23 1997 * *------------------------------------------------------------------------- */ static htri_t -H5G_node_found(H5F_t *f, haddr_t addr, const void H5_ATTR_UNUSED *_lt_key, +H5G__node_found(H5F_t *f, haddr_t addr, const void H5_ATTR_UNUSED *_lt_key, void *_udata) { H5G_bt_lkp_t *udata = (H5G_bt_lkp_t *)_udata; @@ -517,7 +504,7 @@ H5G_node_found(H5F_t *f, haddr_t addr, const void H5_ATTR_UNUSED *_lt_key, const char *s; htri_t ret_value = TRUE; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* * Check arguments. @@ -561,7 +548,7 @@ done: HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to release symbol table node") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_node_found() */ +} /* end H5G__node_found() */ /*------------------------------------------------------------------------- @@ -591,7 +578,6 @@ done: * Failure: H5B_INS_ERROR, NEW_NODE_P might not be initialized. * * Programmer: Robb Matzke - * matzke@llnl.gov * Jun 24 1997 * *------------------------------------------------------------------------- @@ -734,7 +720,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_node_remove + * Function: H5G__node_remove * * Purpose: The B-tree removal engine has found the symbol table node * which should contain the name which is being removed. This @@ -762,7 +748,7 @@ done: *------------------------------------------------------------------------- */ static H5B_ins_t -H5G_node_remove(H5F_t *f, haddr_t addr, void H5_ATTR_NDEBUG_UNUSED *_lt_key/*in,out*/, +H5G__node_remove(H5F_t *f, haddr_t addr, void H5_ATTR_NDEBUG_UNUSED *_lt_key/*in,out*/, hbool_t H5_ATTR_UNUSED *lt_key_changed/*out*/, void *_udata/*in,out*/, void *_rt_key/*in,out*/, hbool_t *rt_key_changed/*out*/) @@ -775,7 +761,7 @@ H5G_node_remove(H5F_t *f, haddr_t addr, void H5_ATTR_NDEBUG_UNUSED *_lt_key/*in, int cmp = 1; H5B_ins_t ret_value = H5B_INS_ERROR; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments */ HDassert(f); @@ -940,7 +926,7 @@ done: HDONE_ERROR(H5E_SYM, H5E_CANTUNPROTECT, H5B_INS_ERROR, "unable to release symbol table node") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_node_remove() */ +} /* end H5G__node_remove() */ /*------------------------------------------------------------------------- @@ -951,7 +937,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Jun 24 1997 * *------------------------------------------------------------------------- @@ -1368,7 +1353,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Nov 19 2006 * *------------------------------------------------------------------------- @@ -1475,7 +1459,6 @@ H5G__node_iterate_size(H5F_t *f, const void H5_ATTR_UNUSED *_lt_key, * Return: 0(zero) on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 4 1997 * *------------------------------------------------------------------------- diff --git a/src/H5Gobj.c b/src/H5Gobj.c index 1892182..7366038 100644 --- a/src/H5Gobj.c +++ b/src/H5Gobj.c @@ -15,7 +15,7 @@ * * Created: H5Gobj.c * Sep 5 2005 - * Quincey Koziol + * Quincey Koziol * * Purpose: Functions for abstract handling of objects in groups. * @@ -85,7 +85,7 @@ typedef struct { /********************/ /* Local Prototypes */ /********************/ -static herr_t H5G_obj_compact_to_dense_cb(const void *_mesg, unsigned idx, +static herr_t H5G__obj_compact_to_dense_cb(const void *_mesg, unsigned idx, void *_udata); static herr_t H5G__obj_remove_update_linfo(const H5O_loc_t *oloc, H5O_linfo_t *linfo); @@ -114,7 +114,6 @@ static herr_t H5G__obj_remove_update_linfo(const H5O_loc_t *oloc, H5O_linfo_t *l * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Sep 29 2005 * *------------------------------------------------------------------------- @@ -169,7 +168,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Sep 29 2005 * *------------------------------------------------------------------------- @@ -304,7 +302,6 @@ done: * Failure: FAIL if error occurred * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Mar 11 2007 * *------------------------------------------------------------------------- @@ -360,7 +357,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_obj_compact_to_dense_cb + * Function: H5G__obj_compact_to_dense_cb * * Purpose: Callback routine for converting "compact" to "dense" * link storage form. @@ -368,19 +365,18 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Aug 30 2005 * *------------------------------------------------------------------------- */ static herr_t -H5G_obj_compact_to_dense_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, void *_udata) +H5G__obj_compact_to_dense_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, void *_udata) { const H5O_link_t *lnk = (const H5O_link_t *)_mesg; /* Pointer to link */ H5G_obj_oh_it_ud1_t *udata = (H5G_obj_oh_it_ud1_t *)_udata; /* 'User data' passed in */ herr_t ret_value = H5_ITER_CONT; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_TAG(udata->oh_addr) + FUNC_ENTER_STATIC /* check arguments */ HDassert(lnk); @@ -391,12 +387,12 @@ H5G_obj_compact_to_dense_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, void HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert link into dense storage") done: - FUNC_LEAVE_NOAPI_TAG(ret_value) -} /* end H5G_obj_compact_to_dense_cb() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5G__obj_compact_to_dense_cb() */ /*------------------------------------------------------------------------- - * Function: H5G_obj_stab_to_new_cb + * Function: H5G__obj_stab_to_new_cb * * Purpose: Callback routine for converting "symbol table" link storage to * "new format" storage (either "compact" or "dense" storage). @@ -404,18 +400,17 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sept 16 2006 * *------------------------------------------------------------------------- */ static herr_t -H5G_obj_stab_to_new_cb(const H5O_link_t *lnk, void *_udata) +H5G__obj_stab_to_new_cb(const H5O_link_t *lnk, void *_udata) { H5G_obj_stab_it_ud1_t *udata = (H5G_obj_stab_it_ud1_t *)_udata; /* 'User data' passed in */ herr_t ret_value = H5_ITER_CONT; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check arguments */ HDassert(lnk); @@ -428,7 +423,7 @@ H5G_obj_stab_to_new_cb(const H5O_link_t *lnk, void *_udata) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_obj_stab_to_new_cb() */ +} /* end H5G__obj_stab_to_new_cb() */ /*------------------------------------------------------------------------- @@ -443,7 +438,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Sep 6 2005 * *------------------------------------------------------------------------- @@ -529,7 +523,7 @@ H5G_obj_insert(const H5O_loc_t *grp_oloc, const char *name, H5O_link_t *obj_lnk, /* Iterate over the 'link' messages, inserting them into the dense link storage */ op.op_type = H5O_MESG_OP_APP; - op.u.app_op = H5G_obj_compact_to_dense_cb; + op.u.app_op = H5G__obj_compact_to_dense_cb; if(H5O_msg_iterate(grp_oloc, H5O_LINK_ID, &op, &udata) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "error iterating over links") @@ -561,7 +555,7 @@ H5G_obj_insert(const H5O_loc_t *grp_oloc, const char *name, H5O_link_t *obj_lnk, udata.grp_oloc = grp_oloc; /* Iterate through all links in "old format" group and insert them into new format */ - if(H5G__stab_iterate(grp_oloc, H5_ITER_NATIVE, (hsize_t)0, NULL, H5G_obj_stab_to_new_cb, &udata) < 0) + if(H5G__stab_iterate(grp_oloc, H5_ITER_NATIVE, (hsize_t)0, NULL, H5G__obj_stab_to_new_cb, &udata) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTNEXT, FAIL, "error iterating over old format links") /* Remove the symbol table message from the group */ @@ -710,7 +704,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Nov 27 2006 * *------------------------------------------------------------------------- @@ -1040,7 +1033,7 @@ H5G_obj_remove_by_idx(const H5O_loc_t *grp_oloc, H5RS_str_t *grp_full_path_r, hbool_t use_old_format; /* Whether to use 'old format' (symbol table) for deletion or not */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_TAG(grp_oloc->addr, FAIL) + FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ HDassert(grp_oloc && grp_oloc->file); @@ -1090,7 +1083,7 @@ H5G_obj_remove_by_idx(const H5O_loc_t *grp_oloc, H5RS_str_t *grp_full_path_r, HGOTO_ERROR(H5E_SYM, H5E_CANTUPDATE, FAIL, "unable to update link info") done: - FUNC_LEAVE_NOAPI_TAG(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5G_obj_remove() */ @@ -1102,7 +1095,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Sep 26 2005 * *------------------------------------------------------------------------- @@ -1155,7 +1147,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Nov 6 2006 * *------------------------------------------------------------------------- diff --git a/src/H5Goh.c b/src/H5Goh.c index f29529b..cba6e80 100644 --- a/src/H5Goh.c +++ b/src/H5Goh.c @@ -338,7 +338,7 @@ H5O__group_bh_info(const H5O_loc_t *loc, H5O_t *oh, H5_ih_info_t *bh_info) H5B2_t *bt2_corder = NULL; /* v2 B-tree handle for creation order index */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC_TAG(oh->cache_info.addr) + FUNC_ENTER_STATIC /* Sanity check */ HDassert(loc); @@ -411,6 +411,6 @@ done: if(bt2_corder && H5B2_close(bt2_corder) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for creation order index") - FUNC_LEAVE_NOAPI_TAG(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__group_bh_info() */ diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h index 8ad03d0..9289ab5 100644 --- a/src/H5Gpkg.h +++ b/src/H5Gpkg.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, September 18, 1997 * * Purpose: This file contains declarations which are visible diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h index 501c883..96e695d 100644 --- a/src/H5Gprivate.h +++ b/src/H5Gprivate.h @@ -15,7 +15,7 @@ * * Created: H5Gprivate.h * Jul 11 1997 - * Robb Matzke + * Robb Matzke * * Purpose: Library-visible declarations. * diff --git a/src/H5Gpublic.h b/src/H5Gpublic.h index 170b74d..3f74d45 100644 --- a/src/H5Gpublic.h +++ b/src/H5Gpublic.h @@ -15,7 +15,7 @@ * * Created: H5Gpublic.h * Jul 11 1997 - * Robb Matzke + * Robb Matzke * * Purpose: Public declarations for the H5G package * diff --git a/src/H5Groot.c b/src/H5Groot.c index 36aa8f6..79b7075 100644 --- a/src/H5Groot.c +++ b/src/H5Groot.c @@ -15,7 +15,7 @@ * * Created: H5Groot.c * Apr 8 2009 - * Neil Fortner + * Neil Fortner * * Purpose: Functions for operating on the root group. * @@ -137,7 +137,6 @@ H5G_rootof(H5F_t *f) * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 11 1997 * *------------------------------------------------------------------------- @@ -370,7 +369,6 @@ H5G_root_free(H5G_t *grp) * Failure: Negative * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Mar 5 2007 * *------------------------------------------------------------------------- diff --git a/src/H5Gstab.c b/src/H5Gstab.c index e8d38b9..fafd0bb 100644 --- a/src/H5Gstab.c +++ b/src/H5Gstab.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Robb Matzke +/* Programmer: Robb Matzke * Friday, September 19, 1997 * */ @@ -127,7 +127,6 @@ typedef struct H5G_bt_it_lbi_t { * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Nov 7 2005 * *------------------------------------------------------------------------- @@ -194,7 +193,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 1 1997 * *------------------------------------------------------------------------- @@ -249,7 +247,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@uiuc.edu * Nov 7 2005 * *------------------------------------------------------------------------- @@ -304,7 +301,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 1 1997 * *------------------------------------------------------------------------- @@ -316,7 +312,7 @@ H5G__stab_insert(const H5O_loc_t *grp_oloc, const char *name, H5O_stab_t stab; /* Symbol table message */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_TAG(grp_oloc->addr) + FUNC_ENTER_PACKAGE /* check arguments */ HDassert(grp_oloc && grp_oloc->file); @@ -331,7 +327,7 @@ H5G__stab_insert(const H5O_loc_t *grp_oloc, const char *name, HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5_ITER_ERROR, "unable to insert the name") done: - FUNC_LEAVE_NOAPI_TAG(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__stab_insert() */ @@ -526,7 +522,7 @@ H5G__stab_iterate(const H5O_loc_t *oloc, H5_iter_order_t order, H5G_link_table_t ltable = {0, NULL}; /* Link table */ herr_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_PACKAGE_TAG(oloc->addr) + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(oloc); @@ -593,7 +589,7 @@ done: if(ltable.lnks && H5G__link_release_table(<able) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to release link table") - FUNC_LEAVE_NOAPI_TAG(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__stab_iterate() */ @@ -683,7 +679,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_stab_get_name_by_idx_cb + * Function: H5G__stab_get_name_by_idx_cb * * Purpose: Callback for B-tree iteration 'by index' info query to * retrieve the name of a link @@ -697,14 +693,14 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5G_stab_get_name_by_idx_cb(const H5G_entry_t *ent, void *_udata) +H5G__stab_get_name_by_idx_cb(const H5G_entry_t *ent, void *_udata) { H5G_bt_it_gnbi_t *udata = (H5G_bt_it_gnbi_t *)_udata; size_t name_off; /* Offset of name in heap */ const char *name; /* Pointer to name string in heap */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity check */ HDassert(ent); @@ -721,7 +717,7 @@ H5G_stab_get_name_by_idx_cb(const H5G_entry_t *ent, void *_udata) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_stab_get_name_by_idx_cb */ +} /* end H5G__stab_get_name_by_idx_cb */ /*------------------------------------------------------------------------- @@ -778,7 +774,7 @@ H5G__stab_get_name_by_idx(const H5O_loc_t *oloc, H5_iter_order_t order, hsize_t /* Set iteration information */ udata.common.idx = n; udata.common.num_objs = 0; - udata.common.op = H5G_stab_get_name_by_idx_cb; + udata.common.op = H5G__stab_get_name_by_idx_cb; udata.heap = heap; udata.name = NULL; udata_valid = TRUE; @@ -815,7 +811,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_stab_lookup_cb + * Function: H5G__stab_lookup_cb * * Purpose: B-tree 'find' callback to retrieve location for an object * @@ -829,12 +825,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5G_stab_lookup_cb(const H5G_entry_t *ent, void *_udata) +H5G__stab_lookup_cb(const H5G_entry_t *ent, void *_udata) { H5G_stab_fnd_ud_t *udata = (H5G_stab_fnd_ud_t *)_udata; /* 'User data' passed in */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check for setting link info */ if(udata->lnk) @@ -844,7 +840,7 @@ H5G_stab_lookup_cb(const H5G_entry_t *ent, void *_udata) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_stab_lookup_cb() */ +} /* end H5G__stab_lookup_cb() */ /*------------------------------------------------------------------------- @@ -855,7 +851,6 @@ done: * Return: Non-negative (TRUE/FALSE) on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Sep 20 2005 * *------------------------------------------------------------------------- @@ -892,7 +887,7 @@ H5G__stab_lookup(const H5O_loc_t *grp_oloc, const char *name, H5O_link_t *lnk) /* Set up the user data for actual B-tree find operation */ bt_udata.common.name = name; bt_udata.common.heap = heap; - bt_udata.op = H5G_stab_lookup_cb; + bt_udata.op = H5G__stab_lookup_cb; bt_udata.op_data = &udata; /* Search the B-tree */ @@ -909,7 +904,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_stab_lookup_by_idx_cb + * Function: H5G__stab_lookup_by_idx_cb * * Purpose: Callback for B-tree iteration 'by index' info query to * retrieve the link @@ -923,13 +918,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5G_stab_lookup_by_idx_cb(const H5G_entry_t *ent, void *_udata) +H5G__stab_lookup_by_idx_cb(const H5G_entry_t *ent, void *_udata) { H5G_bt_it_lbi_t *udata = (H5G_bt_it_lbi_t *)_udata; const char *name; /* Pointer to name string in heap */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity check */ HDassert(ent); @@ -946,7 +941,7 @@ H5G_stab_lookup_by_idx_cb(const H5G_entry_t *ent, void *_udata) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_stab_lookup_by_idx_cb */ +} /* end H5G__stab_lookup_by_idx_cb */ /*------------------------------------------------------------------------- @@ -957,7 +952,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Nov 7 2006 * *------------------------------------------------------------------------- @@ -1000,7 +994,7 @@ H5G__stab_lookup_by_idx(const H5O_loc_t *grp_oloc, H5_iter_order_t order, hsize_ /* Set iteration information */ udata.common.idx = n; udata.common.num_objs = 0; - udata.common.op = H5G_stab_lookup_by_idx_cb; + udata.common.op = H5G__stab_lookup_by_idx_cb; udata.heap = heap; udata.lnk = lnk; udata.found = FALSE; @@ -1040,7 +1034,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Neil Fortner - * nfortne2@hdfgroup.org * Mar 17, 2009 * *------------------------------------------------------------------------- diff --git a/src/H5Gtest.c b/src/H5Gtest.c index f9ab6f2..03efc7e 100644 --- a/src/H5Gtest.c +++ b/src/H5Gtest.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol +/* Programmer: Quincey Koziol * Monday, October 17, 2005 * * Purpose: Group testing functions. @@ -814,7 +814,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Neil Fortner - * nfortne2@hdfgroup.org * April 6 2011 * *------------------------------------------------------------------------- diff --git a/src/H5Gtraverse.c b/src/H5Gtraverse.c index 5a4380d..15088d9 100644 --- a/src/H5Gtraverse.c +++ b/src/H5Gtraverse.c @@ -15,7 +15,7 @@ * * Created: H5Gtraverse.c * Sep 13 2005 - * Quincey Koziol + * Quincey Koziol * * Purpose: Functions for traversing group hierarchy * @@ -355,7 +355,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Nov 20 2006 * *------------------------------------------------------------------------- @@ -464,7 +463,6 @@ done: * resolved. * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 11 1997 * *------------------------------------------------------------------------- @@ -811,7 +809,6 @@ done: * traversed. * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Sep 13 2005 * *------------------------------------------------------------------------- @@ -835,7 +832,7 @@ H5G_traverse(const H5G_loc_t *loc, const char *name, unsigned target, H5G_traver /* Retrieve the original # of soft / UD links that are able to be traversed * (So that multiple calls to H5G_traverse don't incorrectly look - * like they've traversed too many. Nested calls, like in H5L_move(), + * like they've traversed too many. Nested calls, like in H5L__move(), * may need their own mechanism to set & reset the # of links to traverse) */ if(H5CX_get_nlinks(&orig_nlinks) < 0) diff --git a/src/H5HF.c b/src/H5HF.c index 5d52ca4..2e437ad 100644 --- a/src/H5HF.c +++ b/src/H5HF.c @@ -15,7 +15,7 @@ * * Created: H5HF.c * Feb 24 2006 - * Quincey Koziol + * Quincey Koziol * * Purpose: Implements a "fractal heap" for storing variable- * length objects in a file. @@ -88,53 +88,51 @@ H5FL_DEFINE_STATIC(H5HF_t); /*------------------------------------------------------------------------- - * Function: H5HF_op_read + * Function: H5HF__op_read * * Purpose: Performs a 'read' operation for a heap 'op' callback * * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 11 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_op_read(const void *obj, size_t obj_len, void *op_data) +H5HF__op_read(const void *obj, size_t obj_len, void *op_data) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* Perform "read", using memcpy() */ H5MM_memcpy(op_data, obj, obj_len); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5HF_op_read() */ +} /* end H5HF__op_read() */ /*------------------------------------------------------------------------- - * Function: H5HF_op_write + * Function: H5HF__op_write * * Purpose: Performs a 'write' operation for a heap 'op' callback * * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Dec 18 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_op_write(const void *obj, size_t obj_len, void *op_data) +H5HF__op_write(const void *obj, size_t obj_len, void *op_data) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* Perform "write", using memcpy() */ H5MM_memcpy((void *)obj, op_data, obj_len); /* Casting away const OK -QAK */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5HF_op_write() */ +} /* end H5HF__op_write() */ /*------------------------------------------------------------------------- @@ -146,7 +144,6 @@ H5HF_op_write(const void *obj, size_t obj_len, void *op_data) * NULL on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 24 2006 * *------------------------------------------------------------------------- @@ -168,7 +165,7 @@ H5HF_create(H5F_t *f, const H5HF_create_t *cparam) HDassert(cparam); /* Create shared fractal heap header */ - if(HADDR_UNDEF == (fh_addr = H5HF_hdr_create(f, cparam))) + if(HADDR_UNDEF == (fh_addr = H5HF__hdr_create(f, cparam))) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, NULL, "can't create fractal heap header") /* Allocate fractal heap wrapper */ @@ -181,11 +178,11 @@ H5HF_create(H5F_t *f, const H5HF_create_t *cparam) /* Point fractal heap wrapper at header and bump it's ref count */ fh->hdr = hdr; - if(H5HF_hdr_incr(fh->hdr) < 0) + if(H5HF__hdr_incr(fh->hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't increment reference count on shared heap header") /* Increment # of files using this heap header */ - if(H5HF_hdr_fuse_incr(fh->hdr) < 0) + if(H5HF__hdr_fuse_incr(fh->hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't increment file reference count on shared heap header") /* Set file pointer for this heap open context */ @@ -214,7 +211,6 @@ done: * NULL on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Apr 18 2006 * *------------------------------------------------------------------------- @@ -248,11 +244,11 @@ H5HF_open(H5F_t *f, haddr_t fh_addr) /* Point fractal heap wrapper at header */ fh->hdr = hdr; - if(H5HF_hdr_incr(fh->hdr) < 0) + if(H5HF__hdr_incr(fh->hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't increment reference count on shared heap header") /* Increment # of files using this heap header */ - if(H5HF_hdr_fuse_incr(fh->hdr) < 0) + if(H5HF__hdr_fuse_incr(fh->hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't increment file reference count on shared heap header") /* Set file pointer for this heap open context */ @@ -280,7 +276,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Apr 17 2006 * *------------------------------------------------------------------------- @@ -311,7 +306,6 @@ H5HF_get_id_len(H5HF_t *fh, size_t *id_len_p) * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Apr 18 2006 * *------------------------------------------------------------------------- @@ -343,7 +337,6 @@ H5HF_get_heap_addr(const H5HF_t *fh, haddr_t *heap_addr_p) * filled in), negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 24 2006 * *------------------------------------------------------------------------- @@ -381,7 +374,7 @@ H5HF_insert(H5HF_t *fh, size_t size, const void *obj, void *id/*out*/) /* Check for 'tiny' object */ else if(size <= hdr->tiny_max_len) { /* Store 'tiny' object in heap */ - if(H5HF_tiny_insert(hdr, size, obj, id) < 0) + if(H5HF__tiny_insert(hdr, size, obj, id) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINSERT, FAIL, "can't store 'tiny' object in fractal heap") } /* end if */ else { @@ -409,7 +402,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 9 2006 * *------------------------------------------------------------------------- @@ -442,7 +434,7 @@ H5HF_get_obj_len(H5HF_t *fh, const void *_id, size_t *obj_len_p) /* Check type of object in heap */ if((id_flags & H5HF_ID_TYPE_MASK) == H5HF_ID_TYPE_MAN) { - if(H5HF_man_get_obj_len(fh->hdr, id, obj_len_p) < 0) + if(H5HF__man_get_obj_len(fh->hdr, id, obj_len_p) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't get 'managed' object's length") } /* end if */ else if((id_flags & H5HF_ID_TYPE_MASK) == H5HF_ID_TYPE_HUGE) { @@ -450,7 +442,7 @@ H5HF_get_obj_len(H5HF_t *fh, const void *_id, size_t *obj_len_p) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't get 'huge' object's length") } /* end if */ else if((id_flags & H5HF_ID_TYPE_MASK) == H5HF_ID_TYPE_TINY) { - if(H5HF_tiny_get_obj_len(fh->hdr, id, obj_len_p) < 0) + if(H5HF__tiny_get_obj_len(fh->hdr, id, obj_len_p) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't get 'tiny' object's length") } /* end if */ else { @@ -471,7 +463,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 20 2015 * *------------------------------------------------------------------------- @@ -533,7 +524,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 18 2006 * *------------------------------------------------------------------------- @@ -577,7 +567,7 @@ H5HF_read(H5HF_t *fh, const void *_id, void *obj/*out*/) } /* end if */ else if((id_flags & H5HF_ID_TYPE_MASK) == H5HF_ID_TYPE_TINY) { /* Read 'tiny' object from file */ - if(H5HF_tiny_read(fh->hdr, id, obj) < 0) + if(H5HF__tiny_read(fh->hdr, id, obj) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't read 'tiny' object from fractal heap") } /* end if */ else { @@ -610,7 +600,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Dec 18 2006 * *------------------------------------------------------------------------- @@ -681,7 +670,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sept 11 2006 * *------------------------------------------------------------------------- @@ -725,7 +713,7 @@ H5HF_op(H5HF_t *fh, const void *_id, H5HF_operator_t op, void *op_data) } /* end if */ else if((id_flags & H5HF_ID_TYPE_MASK) == H5HF_ID_TYPE_TINY) { /* Operate on 'tiny' object from file */ - if(H5HF_tiny_op(fh->hdr, id, op, op_data) < 0) + if(H5HF__tiny_op(fh->hdr, id, op, op_data) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTOPERATE, FAIL, "can't operate on 'tiny' object from fractal heap") } /* end if */ else { @@ -746,7 +734,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 15 2006 * *------------------------------------------------------------------------- @@ -790,7 +777,7 @@ H5HF_remove(H5HF_t *fh, const void *_id) } /* end if */ else if((id_flags & H5HF_ID_TYPE_MASK) == H5HF_ID_TYPE_TINY) { /* Remove 'tiny' object from heap statistics */ - if(H5HF_tiny_remove(fh->hdr, id) < 0) + if(H5HF__tiny_remove(fh->hdr, id) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTREMOVE, FAIL, "can't remove 'tiny' object from fractal heap") } /* end if */ else { @@ -811,7 +798,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Apr 17 2006 * *------------------------------------------------------------------------- @@ -831,7 +817,7 @@ H5HF_close(H5HF_t *fh) HDassert(fh); /* Decrement file reference & check if this is the last open fractal heap using the shared heap header */ - if(0 == H5HF_hdr_fuse_decr(fh->hdr)) { + if(0 == H5HF__hdr_fuse_decr(fh->hdr)) { /* Set the shared heap header's file context for this operation */ fh->hdr->f = fh->f; @@ -850,8 +836,8 @@ H5HF_close(H5HF_t *fh) * a reference loop and the objects couldn't be removed from * the metadata cache - QAK) */ - if(H5HF_man_iter_ready(&fh->hdr->next_block)) - if(H5HF_man_iter_reset(&fh->hdr->next_block) < 0) + if(H5HF__man_iter_ready(&fh->hdr->next_block)) + if(H5HF__man_iter_reset(&fh->hdr->next_block) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't reset block iterator") /* Shut down the huge object information */ @@ -873,10 +859,10 @@ H5HF_close(H5HF_t *fh) } /* end if */ /* Decrement the reference count on the heap header */ - /* (don't put in H5HF_hdr_fuse_decr() as the heap header may be evicted + /* (don't put in H5HF__hdr_fuse_decr() as the heap header may be evicted * immediately -QAK) */ - if(H5HF_hdr_decr(fh->hdr) < 0) + if(H5HF__hdr_decr(fh->hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement reference count on shared heap header") /* Check for pending heap deletion */ @@ -908,7 +894,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Aug 4 2006 * *------------------------------------------------------------------------- diff --git a/src/H5HFbtree2.c b/src/H5HFbtree2.c index 479c2bd..756ddb5 100644 --- a/src/H5HFbtree2.c +++ b/src/H5HFbtree2.c @@ -15,7 +15,7 @@ * * Created: H5HFbtree2.c * Aug 7 2006 - * Quincey Koziol + * Quincey Koziol * * Purpose: v2 B-tree callbacks for "huge" object tracker * diff --git a/src/H5HFcache.c b/src/H5HFcache.c index 8dbdf25..31430f9 100644 --- a/src/H5HFcache.c +++ b/src/H5HFcache.c @@ -15,7 +15,7 @@ * * Created: H5HFcache.c * Feb 24 2006 - * Quincey Koziol + * Quincey Koziol * * Purpose: Implement fractal heap metadata cache methods. * @@ -255,7 +255,6 @@ done: * Failure: NULL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 27 2006 * *------------------------------------------------------------------------- @@ -305,7 +304,6 @@ H5HF__dtable_decode(H5F_t *f, const uint8_t **pp, H5HF_dtable_t *dtable) * Failure: NULL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 27 2006 * *------------------------------------------------------------------------- @@ -353,7 +351,7 @@ H5HF__dtable_encode(H5F_t *f, uint8_t **pp, const H5HF_dtable_t *dtable) * * Note also that the value returned by this function presumes that * there is no I/O filtering data in the header. If there is, the - * size reported will be too small, and H5C_load_entry() + * size reported will be too small, and H5C__load_entry() * will have to make two tries to load the fractal heap header. * * Return: Success: SUCCEED @@ -507,7 +505,7 @@ H5HF__cache_hdr_deserialize(const void *_image, size_t len, void *_udata, HDassert(dirty); /* Allocate space for the fractal heap data structure */ - if(NULL == (hdr = H5HF_hdr_alloc(udata->f))) + if(NULL == (hdr = H5HF__hdr_alloc(udata->f))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Deserialize the fractal heap header's prefix */ @@ -591,7 +589,7 @@ H5HF__cache_hdr_deserialize(const void *_image, size_t len, void *_udata, HDassert((size_t)(image - (const uint8_t *)_image) == hdr->heap_size); /* Finish initialization of heap header */ - if(H5HF_hdr_finish_init(hdr) < 0) + if(H5HF__hdr_finish_init(hdr) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, NULL, "can't finish initializing shared fractal heap header") /* Set return value */ @@ -599,7 +597,7 @@ H5HF__cache_hdr_deserialize(const void *_image, size_t len, void *_udata, done: if(!ret_value && hdr) - if(H5HF_hdr_free(hdr) < 0) + if(H5HF__hdr_free(hdr) < 0) HDONE_ERROR(H5E_HEAP, H5E_CANTRELEASE, NULL, "unable to release fractal heap header") FUNC_LEAVE_NOAPI(ret_value) @@ -879,7 +877,7 @@ H5HF__cache_hdr_free_icr(void *_thing) HDassert(hdr->cache_info.type == H5AC_FHEAP_HDR); HDassert(hdr->rc == 0); - if(H5HF_hdr_free(hdr) < 0) + if(H5HF__hdr_free(hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "unable to release fractal heap header") done: @@ -1009,7 +1007,7 @@ H5HF__cache_iblock_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED /* Share common heap information */ iblock->hdr = hdr; - if(H5HF_hdr_incr(hdr) < 0) + if(H5HF__hdr_incr(hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't increment reference count on shared heap header") /* Set block's internal information */ @@ -1049,7 +1047,7 @@ H5HF__cache_iblock_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED iblock->par_entry = udata->par_info->entry; if(iblock->parent) { /* Share parent block */ - if(H5HF_iblock_incr(iblock->parent) < 0) + if(H5HF__iblock_incr(iblock->parent) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't increment reference count on shared indirect block") /* Set max. # of rows in this block */ @@ -1144,7 +1142,7 @@ H5HF__cache_iblock_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED done: if(!ret_value && iblock) - if(H5HF_man_iblock_dest(iblock) < 0) + if(H5HF__man_iblock_dest(iblock) < 0) HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, NULL, "unable to destroy fractal heap indirect block") FUNC_LEAVE_NOAPI(ret_value) @@ -1280,7 +1278,7 @@ H5HF__cache_iblock_pre_serialize(H5F_t *f, void *_thing, haddr_t addr, hdr->man_dtable.table_addr = iblock_addr; /* Mark that heap header was modified */ - if(H5HF_hdr_dirty(hdr) < 0) + if(H5HF__hdr_dirty(hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark heap header as dirty") } /* end if */ else { @@ -1295,7 +1293,7 @@ H5HF__cache_iblock_pre_serialize(H5F_t *f, void *_thing, haddr_t addr, par_iblock->ents[par_entry].addr = iblock_addr; /* Mark that parent was modified */ - if(H5HF_iblock_dirty(par_iblock) < 0) + if(H5HF__iblock_dirty(par_iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark heap header as dirty") } /* end if */ @@ -1559,7 +1557,7 @@ H5HF__cache_iblock_free_icr(void *thing) HDassert(iblock->hdr); /* Destroy fractal heap indirect block */ - if(H5HF_man_iblock_dest(iblock) < 0) + if(H5HF__man_iblock_dest(iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy fractal heap indirect block") done: @@ -1792,7 +1790,7 @@ H5HF__cache_dblock_deserialize(const void *_image, size_t len, void *_udata, /* Share common heap information */ dblock->hdr = hdr; - if(H5HF_hdr_incr(hdr) < 0) + if(H5HF__hdr_incr(hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't increment reference count on shared heap header") /* Set block's internal information */ @@ -1885,7 +1883,7 @@ H5HF__cache_dblock_deserialize(const void *_image, size_t len, void *_udata, dblock->par_entry = par_info->entry; if(dblock->parent) { /* Share parent block */ - if(H5HF_iblock_incr(dblock->parent) < 0) + if(H5HF__iblock_incr(dblock->parent) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't increment reference count on shared indirect block") } /* end if */ @@ -1915,7 +1913,7 @@ done: /* Cleanup on error */ if(!ret_value && dblock) - if(H5HF_man_dblock_dest(dblock) < 0) + if(H5HF__man_dblock_dest(dblock) < 0) HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, NULL, "unable to destroy fractal heap direct block") FUNC_LEAVE_NOAPI(ret_value) @@ -2269,7 +2267,7 @@ H5HF__cache_dblock_pre_serialize(H5F_t *f, void *_thing, /* Check if heap header was modified */ if(hdr_changed) - if(H5HF_hdr_dirty(hdr) < 0) + if(H5HF__hdr_dirty(hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark heap header as dirty") } /* end if */ else { /* the direct block's parent is an indirect block */ @@ -2321,7 +2319,7 @@ H5HF__cache_dblock_pre_serialize(H5F_t *f, void *_thing, /* Check if parent was modified */ if(par_changed) - if(H5HF_iblock_dirty(par_iblock) < 0) + if(H5HF__iblock_dirty(par_iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark heap header as dirty") } /* end else */ } /* end if */ @@ -2357,7 +2355,7 @@ H5HF__cache_dblock_pre_serialize(H5F_t *f, void *_thing, hdr->man_dtable.table_addr = dblock_addr; /* Mark that heap header was modified */ - if(H5HF_hdr_dirty(hdr) < 0) + if(H5HF__hdr_dirty(hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark heap header as dirty") } /* end if */ else { /* the direct block's parent is an indirect block */ @@ -2371,7 +2369,7 @@ H5HF__cache_dblock_pre_serialize(H5F_t *f, void *_thing, par_iblock->ents[par_entry].addr = dblock_addr; /* Mark that parent was modified */ - if(H5HF_iblock_dirty(par_iblock) < 0) + if(H5HF__iblock_dirty(par_iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark heap header as dirty") } /* end else */ } /* end if */ @@ -2574,7 +2572,7 @@ H5HF__cache_dblock_free_icr(void *_thing) HDassert(dblock->cache_info.type == H5AC_FHEAP_DBLOCK); /* Destroy fractal heap direct block */ - if(H5HF_man_dblock_dest(dblock) < 0) + if(H5HF__man_dblock_dest(dblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy fractal heap direct block") done: diff --git a/src/H5HFdbg.c b/src/H5HFdbg.c index 22de0c4..e841d78 100644 --- a/src/H5HFdbg.c +++ b/src/H5HFdbg.c @@ -15,7 +15,7 @@ * * Created: H5HFdbg.c * Feb 24 2006 - * Quincey Koziol + * Quincey Koziol * * Purpose: Dump debugging information about a fractal heap * @@ -78,7 +78,7 @@ typedef struct { /* Local Prototypes */ /********************/ -static herr_t H5HF_dtable_debug(const H5HF_dtable_t *dtable, FILE *stream, +static herr_t H5HF__dtable_debug(const H5HF_dtable_t *dtable, FILE *stream, int indent, int fwidth); @@ -105,7 +105,6 @@ static herr_t H5HF_dtable_debug(const H5HF_dtable_t *dtable, FILE *stream, * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 20 2015 * *------------------------------------------------------------------------- @@ -172,22 +171,21 @@ done: /*------------------------------------------------------------------------- - * Function: H5HF_dtable_debug + * Function: H5HF__dtable_debug * * Purpose: Prints debugging info about a doubling table * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 28 2006 * *------------------------------------------------------------------------- */ static herr_t -H5HF_dtable_debug(const H5HF_dtable_t *dtable, FILE *stream, int indent, int fwidth) +H5HF__dtable_debug(const H5HF_dtable_t *dtable, FILE *stream, int indent, int fwidth) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* * Check arguments. @@ -240,7 +238,7 @@ H5HF_dtable_debug(const H5HF_dtable_t *dtable, FILE *stream, int indent, int fwi dtable->num_id_first_row); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5HF_dtable_debug() */ +} /* end H5HF__dtable_debug() */ /*------------------------------------------------------------------------- @@ -251,7 +249,6 @@ H5HF_dtable_debug(const H5HF_dtable_t *dtable, FILE *stream, int indent, int fwi * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Feb 23 2012 * *------------------------------------------------------------------------- @@ -328,7 +325,7 @@ H5HF_hdr_print(const H5HF_hdr_t *hdr, hbool_t dump_internal, FILE *stream, int i hdr->tiny_nobjs); HDfprintf(stream, "%*sManaged Objects Doubling-Table Info...\n", indent, ""); - H5HF_dtable_debug(&hdr->man_dtable, stream, indent + 3, MAX(0, fwidth - 3)); + H5HF__dtable_debug(&hdr->man_dtable, stream, indent + 3, MAX(0, fwidth - 3)); /* Print information about I/O filters */ if(hdr->filter_len > 0) { @@ -371,7 +368,6 @@ H5HF_hdr_print(const H5HF_hdr_t *hdr, hbool_t dump_internal, FILE *stream, int i * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 24 2006 * *------------------------------------------------------------------------- @@ -416,7 +412,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 13 2006 * *------------------------------------------------------------------------- @@ -500,7 +495,6 @@ H5HF_dblock_debug_cb(H5FS_section_info_t *_sect, void *_udata) * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 28 2006 * *------------------------------------------------------------------------- @@ -627,7 +621,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Feb 23 2012 * *------------------------------------------------------------------------- @@ -759,7 +752,6 @@ H5HF_iblock_print(const H5HF_indirect_t *iblock, * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 7 2006 * *------------------------------------------------------------------------- @@ -817,7 +809,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 13 2006 * *------------------------------------------------------------------------- @@ -849,11 +840,6 @@ H5HF_sects_debug_cb(H5FS_section_info_t *_sect, void *_udata) HDfprintf(udata->stream, "%*s%-*s %Hu\n", udata->indent, "", udata->fwidth, "Section size:", sect->sect_info.size); -#ifdef QAK - HDfprintf(udata->stream, "%*s%-*s %s\n", udata->indent, "", udata->fwidth, - "Section state:", - (sect->sect_info.state == H5FS_SECT_LIVE ? "live" : "serialized")); -#endif /* QAK */ /* Dump section-specific debugging information */ if(H5FS_sect_debug(udata->fspace, _sect, udata->stream, udata->indent + 3, MAX(0, udata->fwidth - 3)) < 0) @@ -872,7 +858,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 9 2006 * *------------------------------------------------------------------------- diff --git a/src/H5HFdblock.c b/src/H5HFdblock.c index a6560e2..1e0813c 100644 --- a/src/H5HFdblock.c +++ b/src/H5HFdblock.c @@ -15,7 +15,7 @@ * * Created: H5HFdblock.c * Apr 10 2006 - * Quincey Koziol + * Quincey Koziol * * Purpose: Direct block routines for fractal heaps. * @@ -86,7 +86,6 @@ H5FL_DEFINE(H5HF_direct_t); * Return: Pointer to new direct block on success, NULL on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 27 2006 * *------------------------------------------------------------------------- @@ -119,7 +118,7 @@ H5HF__man_dblock_create(H5HF_hdr_t *hdr, H5HF_indirect_t *par_iblock, /* Share common heap information */ dblock->hdr = hdr; - if(H5HF_hdr_incr(hdr) < 0) + if(H5HF__hdr_incr(hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, FAIL, "can't increment reference count on shared heap header") /* Set info for direct block */ @@ -162,7 +161,7 @@ H5HF__man_dblock_create(H5HF_hdr_t *hdr, H5HF_indirect_t *par_iblock, /* Attach to parent indirect block, if there is one */ dblock->parent = par_iblock; if(dblock->parent) { - if(H5HF_man_iblock_attach(dblock->parent, par_entry, dblock_addr) < 0) + if(H5HF__man_iblock_attach(dblock->parent, par_entry, dblock_addr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTATTACH, FAIL, "can't attach direct block to parent indirect block") dblock->fd_parent = par_iblock; } /* end if */ @@ -171,7 +170,7 @@ H5HF__man_dblock_create(H5HF_hdr_t *hdr, H5HF_indirect_t *par_iblock, dblock->par_entry = par_entry; /* Create a new 'single' section for the free space in the block */ - if(NULL == (sec_node = H5HF_sect_single_new((dblock->block_off + H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr)), + if(NULL == (sec_node = H5HF__sect_single_new((dblock->block_off + H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr)), free_space, dblock->parent, dblock->par_entry))) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't create section for new direct block's free space") @@ -190,7 +189,7 @@ H5HF__man_dblock_create(H5HF_hdr_t *hdr, H5HF_indirect_t *par_iblock, HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't add fractal heap direct block to cache") /* Increase the allocated heap size */ - if(H5HF_hdr_inc_alloc(hdr, dblock->size) < 0) + if(H5HF__hdr_inc_alloc(hdr, dblock->size) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't increase allocated heap size") /* Set the address of of direct block, if requested */ @@ -200,7 +199,7 @@ H5HF__man_dblock_create(H5HF_hdr_t *hdr, H5HF_indirect_t *par_iblock, done: if(ret_value < 0) if(dblock) - if(H5HF_man_dblock_dest(dblock) < 0) + if(H5HF__man_dblock_dest(dblock) < 0) HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy fractal heap direct block") FUNC_LEAVE_NOAPI(ret_value) @@ -219,7 +218,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 17 2006 * *------------------------------------------------------------------------- @@ -272,7 +270,7 @@ H5HF__man_dblock_destroy(H5HF_hdr_t *hdr, H5HF_direct_t *dblock, HDassert(hdr->man_dtable.cparam.start_block_size == dblock->size); /* Sanity check block iterator */ - HDassert(!H5HF_man_iter_ready(&hdr->next_block)); + HDassert(!H5HF__man_iter_ready(&hdr->next_block)); /* Reset header information back to "empty heap" state */ if(H5HF__hdr_empty(hdr) < 0) @@ -334,7 +332,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 13 2006 * *------------------------------------------------------------------------- @@ -383,7 +380,7 @@ H5HF__man_dblock_new(H5HF_hdr_t *hdr, size_t request, } /* end if */ /* Extend heap to cover new direct block */ - if(H5HF_hdr_adjust_heap(hdr, (hsize_t)hdr->man_dtable.cparam.start_block_size, (hssize_t)hdr->man_dtable.row_tot_dblock_free[0]) < 0) + if(H5HF__hdr_adjust_heap(hdr, (hsize_t)hdr->man_dtable.cparam.start_block_size, (hssize_t)hdr->man_dtable.row_tot_dblock_free[0]) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTEXTEND, FAIL, "can't increase space to cover root direct block") } /* end if */ /* Root entry already exists, allocate direct block from root indirect block */ @@ -398,7 +395,7 @@ H5HF__man_dblock_new(H5HF_hdr_t *hdr, size_t request, HGOTO_ERROR(H5E_HEAP, H5E_CANTUPDATE, FAIL, "unable to update block iterator") /* Retrieve information about current iterator position */ - if(H5HF_man_iter_curr(&hdr->next_block, &next_row, NULL, &next_entry, &iblock) < 0) + if(H5HF__man_iter_curr(&hdr->next_block, &next_row, NULL, &next_entry, &iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "unable to retrieve current block iterator location") HDassert(next_row < iblock->nrows); H5_CHECKED_ASSIGN(next_size, size_t, hdr->man_dtable.row_block_size[next_row], hsize_t); @@ -410,7 +407,7 @@ HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "skipping direct block sizes not su } /* end if */ /* Advance "next block" iterator to next direct block entry */ - if(H5HF_hdr_inc_iter(hdr, (hsize_t)next_size, 1) < 0) + if(H5HF__hdr_inc_iter(hdr, (hsize_t)next_size, 1) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, FAIL, "can't increment 'next block' iterator") /* Create new direct block at current location*/ @@ -432,7 +429,6 @@ done: * Return: Pointer to direct block on success, NULL on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Apr 17 2006 * *------------------------------------------------------------------------- @@ -515,7 +511,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 8 2006 * *------------------------------------------------------------------------- @@ -546,7 +541,7 @@ H5HF__man_dblock_locate(H5HF_hdr_t *hdr, hsize_t obj_off, HDassert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0); /* Look up row & column for object */ - if(H5HF_dtable_lookup(&hdr->man_dtable, obj_off, &row, &col) < 0) + if(H5HF__dtable_lookup(&hdr->man_dtable, obj_off, &row, &col) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPUTE, FAIL, "can't compute row & column of object") /* Set initial indirect block info */ @@ -595,7 +590,7 @@ H5HF__man_dblock_locate(H5HF_hdr_t *hdr, hsize_t obj_off, did_protect = new_did_protect; /* Look up row & column in new indirect block for object */ - if(H5HF_dtable_lookup(&hdr->man_dtable, (obj_off - iblock->block_off), &row, &col) < 0) + if(H5HF__dtable_lookup(&hdr->man_dtable, (obj_off - iblock->block_off), &row, &col) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPUTE, FAIL, "can't compute row & column of object") HDassert(row < iblock->nrows); /* child must be smaller than parent */ } /* end while */ @@ -624,7 +619,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 7 2006 * *------------------------------------------------------------------------- @@ -682,24 +676,23 @@ done: /*------------------------------------------------------------------------- - * Function: H5HF_man_dblock_dest + * Function: H5HF__man_dblock_dest * * Purpose: Destroys a fractal heap direct block in memory. * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 27 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_man_dblock_dest(H5HF_direct_t *dblock) +H5HF__man_dblock_dest(H5HF_direct_t *dblock) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -708,7 +701,7 @@ H5HF_man_dblock_dest(H5HF_direct_t *dblock) /* Decrement reference count on shared fractal heap info */ HDassert(dblock->hdr != NULL); - if(H5HF_hdr_decr(dblock->hdr) < 0) + if(H5HF__hdr_decr(dblock->hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement reference count on shared heap header") if(dblock->parent) if(H5HF__iblock_decr(dblock->parent) < 0) @@ -722,5 +715,5 @@ H5HF_man_dblock_dest(H5HF_direct_t *dblock) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_man_dblock_dest() */ +} /* end H5HF__man_dblock_dest() */ diff --git a/src/H5HFdtable.c b/src/H5HFdtable.c index 6e9429a..4fff348 100644 --- a/src/H5HFdtable.c +++ b/src/H5HFdtable.c @@ -15,7 +15,7 @@ * * Created: H5HFdtable.c * Apr 10 2006 - * Quincey Koziol + * Quincey Koziol * * Purpose: "Doubling table" routines for fractal heaps. * @@ -75,27 +75,26 @@ /*------------------------------------------------------------------------- - * Function: H5HF_dtable_init + * Function: H5HF__dtable_init * * Purpose: Initialize values for doubling table * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 6 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_dtable_init(H5HF_dtable_t *dtable) +H5HF__dtable_init(H5HF_dtable_t *dtable) { hsize_t tmp_block_size; /* Temporary block size */ hsize_t acc_block_off; /* Accumulated block offset */ size_t u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -133,26 +132,25 @@ H5HF_dtable_init(H5HF_dtable_t *dtable) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_dtable_init() */ +} /* end H5HF__dtable_init() */ /*------------------------------------------------------------------------- - * Function: H5HF_dtable_lookup + * Function: H5HF__dtable_lookup * * Purpose: Compute the row & col of an offset in a doubling-table * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 6 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_dtable_lookup(const H5HF_dtable_t *dtable, hsize_t off, unsigned *row, unsigned *col) +H5HF__dtable_lookup(const H5HF_dtable_t *dtable, hsize_t off, unsigned *row, unsigned *col) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* * Check arguments. @@ -160,9 +158,6 @@ H5HF_dtable_lookup(const H5HF_dtable_t *dtable, hsize_t off, unsigned *row, unsi HDassert(dtable); HDassert(row); HDassert(col); -#ifdef QAK -HDfprintf(stderr, "%s: off = %Hu\n", "H5HF_dtable_lookup", off); -#endif /* QAK */ /* Check for offset in first row */ if(off < dtable->num_id_first_row) { @@ -173,34 +168,30 @@ HDfprintf(stderr, "%s: off = %Hu\n", "H5HF_dtable_lookup", off); unsigned high_bit = H5VM_log2_gen(off); /* Determine the high bit in the offset */ hsize_t off_mask = ((hsize_t)1) << high_bit; /* Compute mask for determining column */ -#ifdef QAK -HDfprintf(stderr, "%s: high_bit = %u, off_mask = %Hu\n", "H5HF_dtable_lookup", high_bit, off_mask); -#endif /* QAK */ *row = (high_bit - dtable->first_row_bits) + 1; H5_CHECKED_ASSIGN(*col, unsigned, ((off - off_mask) / dtable->row_block_size[*row]), hsize_t); } /* end else */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5HF_dtable_lookup() */ +} /* end H5HF__dtable_lookup() */ /*------------------------------------------------------------------------- - * Function: H5HF_dtable_dest + * Function: H5HF__dtable_dest * * Purpose: Release information for doubling table * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 27 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_dtable_dest(H5HF_dtable_t *dtable) +H5HF__dtable_dest(H5HF_dtable_t *dtable) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* * Check arguments. @@ -220,28 +211,27 @@ H5HF_dtable_dest(H5HF_dtable_t *dtable) H5MM_xfree(dtable->row_max_dblock_free); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5HF_dtable_dest() */ +} /* end H5HF__dtable_dest() */ /*------------------------------------------------------------------------- - * Function: H5HF_dtable_size_to_row + * Function: H5HF__dtable_size_to_row * * Purpose: Compute row that can hold block of a certain size * * Return: Non-negative on success (can't fail) * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Apr 25 2006 * *------------------------------------------------------------------------- */ unsigned -H5HF_dtable_size_to_row(const H5HF_dtable_t *dtable, size_t block_size) +H5HF__dtable_size_to_row(const H5HF_dtable_t *dtable, size_t block_size) { unsigned row = 0; /* Row where block will fit */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* * Check arguments. @@ -254,28 +244,27 @@ H5HF_dtable_size_to_row(const H5HF_dtable_t *dtable, size_t block_size) row = (H5VM_log2_of2((uint32_t)block_size) - H5VM_log2_of2((uint32_t)dtable->cparam.start_block_size)) + 1; FUNC_LEAVE_NOAPI(row) -} /* end H5HF_dtable_size_to_row() */ +} /* end H5HF__dtable_size_to_row() */ /*------------------------------------------------------------------------- - * Function: H5HF_dtable_size_to_rows + * Function: H5HF__dtable_size_to_rows * * Purpose: Compute # of rows of indirect block of a given size * * Return: Non-negative on success (can't fail) * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 31 2006 * *------------------------------------------------------------------------- */ unsigned -H5HF_dtable_size_to_rows(const H5HF_dtable_t *dtable, hsize_t size) +H5HF__dtable_size_to_rows(const H5HF_dtable_t *dtable, hsize_t size) { unsigned rows = 0; /* # of rows required for indirect block */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* * Check arguments. @@ -285,24 +274,23 @@ H5HF_dtable_size_to_rows(const H5HF_dtable_t *dtable, hsize_t size) rows = (H5VM_log2_gen(size) - dtable->first_row_bits) + 1; FUNC_LEAVE_NOAPI(rows) -} /* end H5HF_dtable_size_to_rows() */ +} /* end H5HF__dtable_size_to_rows() */ /*------------------------------------------------------------------------- - * Function: H5HF_dtable_span_size + * Function: H5HF__dtable_span_size * * Purpose: Compute the size covered by a span of entries * * Return: Non-zero span size on success/zero on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 25 2006 * *------------------------------------------------------------------------- */ hsize_t -H5HF_dtable_span_size(const H5HF_dtable_t *dtable, unsigned start_row, +H5HF__dtable_span_size(const H5HF_dtable_t *dtable, unsigned start_row, unsigned start_col, unsigned num_entries) { unsigned start_entry; /* Entry for first block covered */ @@ -311,7 +299,7 @@ H5HF_dtable_span_size(const H5HF_dtable_t *dtable, unsigned start_row, unsigned end_entry; /* Entry for last block covered */ hsize_t acc_span_size = 0; /* Accumulated span size */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* * Check arguments. @@ -326,10 +314,6 @@ H5HF_dtable_span_size(const H5HF_dtable_t *dtable, unsigned start_row, end_entry = (start_entry + num_entries) - 1; end_row = end_entry / dtable->cparam.width; end_col = end_entry % dtable->cparam.width; -#ifdef QAK -HDfprintf(stderr, "%s: start_row = %u, start_col = %u, start_entry = %u\n", "H5HF_sect_indirect_span_size", start_row, start_col, start_entry); -HDfprintf(stderr, "%s: end_row = %u, end_col = %u, end_entry = %u\n", "H5HF_sect_indirect_span_size", end_row, end_col, end_entry); -#endif /* QAK */ /* Initialize accumulated span size */ acc_span_size = 0; @@ -362,9 +346,6 @@ HDfprintf(stderr, "%s: end_row = %u, end_col = %u, end_entry = %u\n", "H5HF_sect ((end_col - start_col) + 1); } /* end else */ -#ifdef QAK -HDfprintf(stderr, "%s: acc_span_size = %Hu\n", "H5HF_dtable_span_size", acc_span_size); -#endif /* QAK */ FUNC_LEAVE_NOAPI(acc_span_size) -} /* end H5HF_sect_indirect_span_size() */ +} /* end H5HF__dtable_span_size() */ diff --git a/src/H5HFhdr.c b/src/H5HFhdr.c index 5750a03..043ab87 100644 --- a/src/H5HFhdr.c +++ b/src/H5HFhdr.c @@ -15,7 +15,7 @@ * * Created: H5HFhdr.c * Apr 10 2006 - * Quincey Koziol + * Quincey Koziol * * Purpose: Heap header routines for fractal heaps. * @@ -94,25 +94,24 @@ H5FL_DEFINE_STATIC(H5HF_hdr_t); /*------------------------------------------------------------------------- - * Function: H5HF_hdr_alloc + * Function: H5HF__hdr_alloc * * Purpose: Allocate shared fractal heap header * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 21 2006 * *------------------------------------------------------------------------- */ H5HF_hdr_t * -H5HF_hdr_alloc(H5F_t *f) +H5HF__hdr_alloc(H5F_t *f) { H5HF_hdr_t *hdr = NULL; /* Shared fractal heap header */ H5HF_hdr_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -133,7 +132,7 @@ H5HF_hdr_alloc(H5F_t *f) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_hdr_alloc() */ +} /* end H5HF__hdr_alloc() */ /*------------------------------------------------------------------------- @@ -145,13 +144,12 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 21 2006 * *------------------------------------------------------------------------- */ static herr_t -H5HF_hdr_compute_free_space(H5HF_hdr_t *hdr, unsigned iblock_row) +H5HF__hdr_compute_free_space(H5HF_hdr_t *hdr, unsigned iblock_row) { hsize_t acc_heap_size; /* Accumumated heap space */ hsize_t iblock_size; /* Size of indirect block to calculate for */ @@ -160,7 +158,7 @@ H5HF_hdr_compute_free_space(H5HF_hdr_t *hdr, unsigned iblock_row) unsigned curr_row; /* Current row in block */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* * Check arguments. @@ -189,28 +187,27 @@ H5HF_hdr_compute_free_space(H5HF_hdr_t *hdr, unsigned iblock_row) hdr->man_dtable.row_max_dblock_free[iblock_row] = max_dblock_free; FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_hdr_compute_free_space() */ +} /* end H5HF__hdr_compute_free_space() */ /*------------------------------------------------------------------------- - * Function: H5HF_hdr_finish_init_phase1 + * Function: H5HF__hdr_finish_init_phase1 * * Purpose: First phase to finish initializing info in shared heap header * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 12 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_hdr_finish_init_phase1(H5HF_hdr_t *hdr) +H5HF__hdr_finish_init_phase1(H5HF_hdr_t *hdr) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -219,7 +216,7 @@ H5HF_hdr_finish_init_phase1(H5HF_hdr_t *hdr) /* Compute/cache some values */ hdr->heap_off_size = (uint8_t)H5HF_SIZEOF_OFFSET_BITS(hdr->man_dtable.cparam.max_index); - if(H5HF_dtable_init(&hdr->man_dtable) < 0) + if(H5HF__dtable_init(&hdr->man_dtable) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize doubling table info") /* Set the size of heap IDs */ @@ -228,29 +225,28 @@ H5HF_hdr_finish_init_phase1(H5HF_hdr_t *hdr) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_hdr_finish_init_phase1() */ +} /* end H5HF__hdr_finish_init_phase1() */ /*------------------------------------------------------------------------- - * Function: H5HF_hdr_finish_init_phase2 + * Function: H5HF__hdr_finish_init_phase2 * * Purpose: Second phase to finish initializing info in shared heap header * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 12 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_hdr_finish_init_phase2(H5HF_hdr_t *hdr) +H5HF__hdr_finish_init_phase2(H5HF_hdr_t *hdr) { unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -265,46 +261,45 @@ H5HF_hdr_finish_init_phase2(H5HF_hdr_t *hdr) H5_CHECKED_ASSIGN(hdr->man_dtable.row_max_dblock_free[u], size_t, hdr->man_dtable.row_tot_dblock_free[u], hsize_t); } /* end if */ else - if(H5HF_hdr_compute_free_space(hdr, u) < 0) + if(H5HF__hdr_compute_free_space(hdr, u) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize direct block free space for indirect block") } /* end for */ /* Initialize the block iterator for searching for free space */ - if(H5HF_man_iter_init(&hdr->next_block) < 0) + if(H5HF__man_iter_init(&hdr->next_block) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize space search block iterator") /* Initialize the information for tracking 'huge' objects */ - if(H5HF_huge_init(hdr) < 0) + if(H5HF__huge_init(hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize info for tracking huge objects") /* Initialize the information for tracking 'tiny' objects */ - if(H5HF_tiny_init(hdr) < 0) + if(H5HF__tiny_init(hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize info for tracking tiny objects") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_hdr_finish_init_phase2() */ +} /* end H5HF__hdr_finish_init_phase2() */ /*------------------------------------------------------------------------- - * Function: H5HF_hdr_finish_init + * Function: H5HF__hdr_finish_init * * Purpose: Finish initializing info in shared heap header * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 21 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_hdr_finish_init(H5HF_hdr_t *hdr) +H5HF__hdr_finish_init(H5HF_hdr_t *hdr) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -312,39 +307,38 @@ H5HF_hdr_finish_init(H5HF_hdr_t *hdr) HDassert(hdr); /* First phase of header final initialization */ - if(H5HF_hdr_finish_init_phase1(hdr) < 0) + if(H5HF__hdr_finish_init_phase1(hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't finish phase #1 of header final initialization") /* Second phase of header final initialization */ - if(H5HF_hdr_finish_init_phase2(hdr) < 0) + if(H5HF__hdr_finish_init_phase2(hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't finish phase #2 of header final initialization") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_hdr_finish_init() */ +} /* end H5HF__hdr_finish_init() */ /*------------------------------------------------------------------------- - * Function: H5HF_hdr_create + * 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 -H5HF_hdr_create(H5F_t *f, const H5HF_create_t *cparam) +H5HF__hdr_create(H5F_t *f, const H5HF_create_t *cparam) { H5HF_hdr_t *hdr = NULL; /* The new fractal heap header information */ size_t dblock_overhead; /* Direct block's overhead */ haddr_t ret_value = HADDR_UNDEF; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -377,7 +371,7 @@ H5HF_hdr_create(H5F_t *f, const H5HF_create_t *cparam) #endif /* NDEBUG */ /* Allocate & basic initialization for the shared header */ - if(NULL == (hdr = H5HF_hdr_alloc(f))) + if(NULL == (hdr = H5HF__hdr_alloc(f))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "can't allocate space for shared heap info") #ifndef NDEBUG @@ -401,7 +395,7 @@ H5HF_hdr_create(H5F_t *f, const H5HF_create_t *cparam) /* First phase of header final initialization */ /* (doesn't need ID length set up) */ - if(H5HF_hdr_finish_init_phase1(hdr) < 0) + if(H5HF__hdr_finish_init_phase1(hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, HADDR_UNDEF, "can't finish phase #1 of header final initialization") /* Copy any I/O filter pipeline */ @@ -484,7 +478,7 @@ H5HF_hdr_create(H5F_t *f, const H5HF_create_t *cparam) /* Second phase of header final initialization */ /* (needs ID and filter lengths set up) */ - if(H5HF_hdr_finish_init_phase2(hdr) < 0) + if(H5HF__hdr_finish_init_phase2(hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, HADDR_UNDEF, "can't finish phase #2 of header final initialization") /* Extra checking for possible gap between max. direct block size minus @@ -506,11 +500,11 @@ H5HF_hdr_create(H5F_t *f, const H5HF_create_t *cparam) done: if(!H5F_addr_defined(ret_value) && hdr) - if(H5HF_hdr_free(hdr) < 0) + 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() */ +} /* end H5HF__hdr_create() */ /*------------------------------------------------------------------------- @@ -521,7 +515,6 @@ done: * Return: Pointer to indirect block on success, NULL on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * May 5 2010 * *------------------------------------------------------------------------- @@ -564,24 +557,23 @@ done: /*------------------------------------------------------------------------- - * Function: H5HF_hdr_incr + * Function: H5HF__hdr_incr * * Purpose: Increment component reference count on shared heap header * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 27 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_hdr_incr(H5HF_hdr_t *hdr) +H5HF__hdr_incr(H5HF_hdr_t *hdr) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(hdr); @@ -596,28 +588,27 @@ H5HF_hdr_incr(H5HF_hdr_t *hdr) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_hdr_incr() */ +} /* end H5HF__hdr_incr() */ /*------------------------------------------------------------------------- - * Function: H5HF_hdr_decr + * Function: H5HF__hdr_decr * * Purpose: Decrement component reference count on shared heap header * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 27 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_hdr_decr(H5HF_hdr_t *hdr) +H5HF__hdr_decr(H5HF_hdr_t *hdr) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(hdr); @@ -635,26 +626,25 @@ H5HF_hdr_decr(H5HF_hdr_t *hdr) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_hdr_decr() */ +} /* end H5HF__hdr_decr() */ /*------------------------------------------------------------------------- - * Function: H5HF_hdr_fuse_incr + * Function: H5HF__hdr_fuse_incr * * Purpose: Increment file reference count on shared heap header * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Oct 1 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_hdr_fuse_incr(H5HF_hdr_t *hdr) +H5HF__hdr_fuse_incr(H5HF_hdr_t *hdr) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ HDassert(hdr); @@ -663,26 +653,25 @@ H5HF_hdr_fuse_incr(H5HF_hdr_t *hdr) hdr->file_rc++; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5HF_hdr_fuse_incr() */ +} /* end H5HF__hdr_fuse_incr() */ /*------------------------------------------------------------------------- - * Function: H5HF_hdr_fuse_decr + * Function: H5HF__hdr_fuse_decr * * Purpose: Decrement file reference count on shared heap header * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Oct 1 2006 * *------------------------------------------------------------------------- */ size_t -H5HF_hdr_fuse_decr(H5HF_hdr_t *hdr) +H5HF__hdr_fuse_decr(H5HF_hdr_t *hdr) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ HDassert(hdr); @@ -692,37 +681,35 @@ H5HF_hdr_fuse_decr(H5HF_hdr_t *hdr) hdr->file_rc--; FUNC_LEAVE_NOAPI(hdr->file_rc) -} /* end H5HF_hdr_fuse_decr() */ +} /* end H5HF__hdr_fuse_decr() */ /*------------------------------------------------------------------------- - * Function: H5HF_hdr_dirty + * Function: H5HF__hdr_dirty * * Purpose: Mark heap header as dirty * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 27 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_hdr_dirty(H5HF_hdr_t *hdr) +H5HF__hdr_dirty(H5HF_hdr_t *hdr) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(hdr); /* Resize pinned header in cache if I/O filter is present. */ - if(hdr->filter_len > 0) { + if(hdr->filter_len > 0) if(H5AC_resize_entry(hdr, (size_t)hdr->heap_size) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, FAIL, "unable to resize fractal heap header") - } /* end if */ /* Mark header as dirty in cache */ if(H5AC_mark_entry_dirty(hdr) < 0) @@ -730,28 +717,27 @@ H5HF_hdr_dirty(H5HF_hdr_t *hdr) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_hdr_dirty() */ +} /* end H5HF__hdr_dirty() */ /*------------------------------------------------------------------------- - * Function: H5HF_hdr_adj_free + * Function: H5HF__hdr_adj_free * * Purpose: Adjust the free space for a heap * * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 9 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_hdr_adj_free(H5HF_hdr_t *hdr, ssize_t amt) +H5HF__hdr_adj_free(H5HF_hdr_t *hdr, ssize_t amt) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -763,33 +749,32 @@ H5HF_hdr_adj_free(H5HF_hdr_t *hdr, ssize_t amt) hdr->total_man_free = (hsize_t)((hssize_t)hdr->total_man_free + amt); /* Mark heap header as modified */ - if(H5HF_hdr_dirty(hdr) < 0) + if(H5HF__hdr_dirty(hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark heap header as dirty") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_hdr_adj_free() */ +} /* end H5HF__hdr_adj_free() */ /*------------------------------------------------------------------------- - * Function: H5HF_hdr_adjust_heap + * Function: H5HF__hdr_adjust_heap * * Purpose: Adjust heap space * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Apr 10 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_hdr_adjust_heap(H5HF_hdr_t *hdr, hsize_t new_size, hssize_t extra_free) +H5HF__hdr_adjust_heap(H5HF_hdr_t *hdr, hsize_t new_size, hssize_t extra_free) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -804,31 +789,30 @@ H5HF_hdr_adjust_heap(H5HF_hdr_t *hdr, hsize_t new_size, hssize_t extra_free) hdr->total_man_free = (hsize_t)((hssize_t)hdr->total_man_free + extra_free); /* Mark heap header as modified */ - if(H5HF_hdr_dirty(hdr) < 0) + if(H5HF__hdr_dirty(hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark header as dirty") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_hdr_adjust_heap() */ +} /* end H5HF__hdr_adjust_heap() */ /*------------------------------------------------------------------------- - * Function: H5HF_hdr_inc_alloc + * Function: H5HF__hdr_inc_alloc * * Purpose: Increase allocated size of heap * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 23 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_hdr_inc_alloc(H5HF_hdr_t *hdr, size_t alloc_size) +H5HF__hdr_inc_alloc(H5HF_hdr_t *hdr, size_t alloc_size) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* * Check arguments. @@ -840,28 +824,27 @@ H5HF_hdr_inc_alloc(H5HF_hdr_t *hdr, size_t alloc_size) hdr->man_alloc_size += alloc_size; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5HF_hdr_inc_alloc() */ +} /* end H5HF__hdr_inc_alloc() */ /*------------------------------------------------------------------------- - * Function: H5HF_hdr_start_iter + * Function: H5HF__hdr_start_iter * * Purpose: Start "next block" iterator at an offset/entry in the heap * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 30 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_hdr_start_iter(H5HF_hdr_t *hdr, H5HF_indirect_t *iblock, hsize_t curr_off, unsigned curr_entry) +H5HF__hdr_start_iter(H5HF_hdr_t *hdr, H5HF_indirect_t *iblock, hsize_t curr_off, unsigned curr_entry) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -870,7 +853,7 @@ H5HF_hdr_start_iter(H5HF_hdr_t *hdr, H5HF_indirect_t *iblock, hsize_t curr_off, HDassert(iblock); /* Set up "next block" iterator at correct location */ - if(H5HF_man_iter_start_entry(hdr, &hdr->next_block, iblock, curr_entry) < 0) + if(H5HF__man_iter_start_entry(hdr, &hdr->next_block, iblock, curr_entry) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize block iterator") /* Set the offset of the iterator in the heap */ @@ -878,28 +861,27 @@ H5HF_hdr_start_iter(H5HF_hdr_t *hdr, H5HF_indirect_t *iblock, hsize_t curr_off, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_hdr_start_iter() */ +} /* end H5HF__hdr_start_iter() */ /*------------------------------------------------------------------------- - * Function: H5HF_hdr_reset_iter + * Function: H5HF__hdr_reset_iter * * Purpose: Reset "next block" iterator * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 31 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_hdr_reset_iter(H5HF_hdr_t *hdr, hsize_t curr_off) +H5HF__hdr_reset_iter(H5HF_hdr_t *hdr, hsize_t curr_off) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -907,7 +889,7 @@ H5HF_hdr_reset_iter(H5HF_hdr_t *hdr, hsize_t curr_off) HDassert(hdr); /* Reset "next block" iterator */ - if(H5HF_man_iter_reset(&hdr->next_block) < 0) + if(H5HF__man_iter_reset(&hdr->next_block) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't reset block iterator") /* Set the offset of the iterator in the heap */ @@ -915,7 +897,7 @@ H5HF_hdr_reset_iter(H5HF_hdr_t *hdr, hsize_t curr_off) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_hdr_reset_iter() */ +} /* end H5HF__hdr_reset_iter() */ /*------------------------------------------------------------------------- @@ -926,7 +908,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Apr 3 2006 * *------------------------------------------------------------------------- @@ -951,11 +932,11 @@ H5HF__hdr_skip_blocks(H5HF_hdr_t *hdr, H5HF_indirect_t *iblock, /* Compute the span within the heap to skip */ row = start_entry / hdr->man_dtable.cparam.width; col = start_entry % hdr->man_dtable.cparam.width; - sect_size = H5HF_dtable_span_size(&hdr->man_dtable, row, col, nentries); + sect_size = H5HF__dtable_span_size(&hdr->man_dtable, row, col, nentries); HDassert(sect_size > 0); /* Advance the new block iterator */ - if(H5HF_hdr_inc_iter(hdr, sect_size, nentries) < 0) + if(H5HF__hdr_inc_iter(hdr, sect_size, nentries) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't increase allocated heap size") /* Add 'indirect' section for blocks skipped in this row */ @@ -978,7 +959,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 14 2006 * *------------------------------------------------------------------------- @@ -1009,17 +989,17 @@ H5HF__hdr_update_iter(H5HF_hdr_t *hdr, size_t min_dblock_size) unsigned min_dblock_row; /* Minimum row for direct block size request */ /* Compute min. row for direct block requested */ - min_dblock_row = H5HF_dtable_size_to_row(&hdr->man_dtable, min_dblock_size); + min_dblock_row = H5HF__dtable_size_to_row(&hdr->man_dtable, min_dblock_size); /* Initialize block iterator, if necessary */ - if(!H5HF_man_iter_ready(&hdr->next_block)) { + if(!H5HF__man_iter_ready(&hdr->next_block)) { /* Start iterator with previous offset of iterator */ if(H5HF__man_iter_start_offset(hdr, &hdr->next_block, hdr->man_iter_off) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "unable to set block iterator location") } /* end if */ /* Get information about current iterator location */ - if(H5HF_man_iter_curr(&hdr->next_block, &next_row, NULL, &next_entry, &iblock) < 0) + if(H5HF__man_iter_curr(&hdr->next_block, &next_row, NULL, &next_entry, &iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "unable to retrieve current block iterator location") /* Check for skipping over blocks in the current block */ @@ -1039,7 +1019,7 @@ H5HF__hdr_update_iter(H5HF_hdr_t *hdr, size_t min_dblock_size) HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't add skipped blocks to heap's free space") /* Get information about new iterator location */ - if(H5HF_man_iter_curr(&hdr->next_block, &next_row, NULL, &next_entry, &iblock) < 0) + if(H5HF__man_iter_curr(&hdr->next_block, &next_row, NULL, &next_entry, &iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "unable to retrieve current block iterator location") } /* end if */ @@ -1057,16 +1037,16 @@ H5HF__hdr_update_iter(H5HF_hdr_t *hdr, size_t min_dblock_size) } /* end if */ else { /* Move iterator up one level */ - if(H5HF_man_iter_up(&hdr->next_block) < 0) + if(H5HF__man_iter_up(&hdr->next_block) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTNEXT, FAIL, "unable to advance current block iterator location") /* Increment location of next block at this level */ - if(H5HF_man_iter_next(hdr, &hdr->next_block, 1) < 0) + if(H5HF__man_iter_next(hdr, &hdr->next_block, 1) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, FAIL, "can't advance fractal heap block location") } /* end else */ /* Get information about new iterator location */ - if(H5HF_man_iter_curr(&hdr->next_block, &next_row, NULL, &next_entry, &iblock) < 0) + if(H5HF__man_iter_curr(&hdr->next_block, &next_row, NULL, &next_entry, &iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "unable to retrieve current block iterator location") /* Indicate that we walked up */ @@ -1081,7 +1061,7 @@ H5HF__hdr_update_iter(H5HF_hdr_t *hdr, size_t min_dblock_size) HDassert(!H5F_addr_defined(iblock->ents[next_entry].addr)); /* Compute # of rows in next child indirect block to use */ - child_nrows = H5HF_dtable_size_to_rows(&hdr->man_dtable, hdr->man_dtable.row_block_size[next_row]); + child_nrows = H5HF__dtable_size_to_rows(&hdr->man_dtable, hdr->man_dtable.row_block_size[next_row]); /* Check for skipping over indirect blocks */ /* (that don't have direct blocks large enough to hold direct block size requested) */ @@ -1114,7 +1094,7 @@ H5HF__hdr_update_iter(H5HF_hdr_t *hdr, size_t min_dblock_size) HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap indirect block") /* Move iterator down one level (pins indirect block) */ - if(H5HF_man_iter_down(&hdr->next_block, new_iblock) < 0) + if(H5HF__man_iter_down(&hdr->next_block, new_iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTNEXT, FAIL, "unable to advance current block iterator location") /* Check for skipping over rows and add free section for skipped rows */ @@ -1135,7 +1115,7 @@ H5HF__hdr_update_iter(H5HF_hdr_t *hdr, size_t min_dblock_size) } /* end else */ /* Get information about new iterator location */ - if(H5HF_man_iter_curr(&hdr->next_block, &next_row, NULL, &next_entry, &iblock) < 0) + if(H5HF__man_iter_curr(&hdr->next_block, &next_row, NULL, &next_entry, &iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "unable to retrieve current block iterator location") /* Indicate that we walked down */ @@ -1150,24 +1130,23 @@ done: /*------------------------------------------------------------------------- - * Function: H5HF_hdr_inc_iter + * Function: H5HF__hdr_inc_iter * * Purpose: Advance "next block" iterator * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 23 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_hdr_inc_iter(H5HF_hdr_t *hdr, hsize_t adv_size, unsigned nentries) +H5HF__hdr_inc_iter(H5HF_hdr_t *hdr, hsize_t adv_size, unsigned nentries) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -1177,7 +1156,7 @@ H5HF_hdr_inc_iter(H5HF_hdr_t *hdr, hsize_t adv_size, unsigned nentries) /* Advance the iterator for the current location within the indirect block */ if(hdr->next_block.curr) - if(H5HF_man_iter_next(hdr, &hdr->next_block, nentries) < 0) + if(H5HF__man_iter_next(hdr, &hdr->next_block, nentries) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTNEXT, FAIL, "unable to advance current block iterator location") /* Increment the offset of the iterator in the heap */ @@ -1185,7 +1164,7 @@ H5HF_hdr_inc_iter(H5HF_hdr_t *hdr, hsize_t adv_size, unsigned nentries) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_hdr_inc_iter() */ +} /* end H5HF__hdr_inc_iter() */ /*------------------------------------------------------------------------- @@ -1197,7 +1176,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 31 2006 * *------------------------------------------------------------------------- @@ -1219,7 +1197,7 @@ H5HF__hdr_reverse_iter(H5HF_hdr_t *hdr, haddr_t dblock_addr) HDassert(hdr); /* Initialize block iterator, if necessary */ - if(!H5HF_man_iter_ready(&hdr->next_block)) + if(!H5HF__man_iter_ready(&hdr->next_block)) /* Start iterator with previous offset of iterator */ if(H5HF__man_iter_start_offset(hdr, &hdr->next_block, hdr->man_iter_off) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "unable to set block iterator location") @@ -1227,7 +1205,7 @@ H5HF__hdr_reverse_iter(H5HF_hdr_t *hdr, haddr_t dblock_addr) /* Walk backwards through heap, looking for direct block to place iterator after */ /* Get information about current iterator location */ - if(H5HF_man_iter_curr(&hdr->next_block, NULL, NULL, &curr_entry, &iblock) < 0) + if(H5HF__man_iter_curr(&hdr->next_block, NULL, NULL, &curr_entry, &iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "unable to retrieve current block iterator information") /* Move current iterator position backwards once */ @@ -1253,11 +1231,11 @@ H5HF__hdr_reverse_iter(H5HF_hdr_t *hdr, haddr_t dblock_addr) /* Check for parent of current indirect block */ if(iblock->parent) { /* Move iterator to parent of current block */ - if(H5HF_man_iter_up(&hdr->next_block) < 0) + if(H5HF__man_iter_up(&hdr->next_block) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTNEXT, FAIL, "unable to move current block iterator location up") /* Get information about current iterator location */ - if(H5HF_man_iter_curr(&hdr->next_block, NULL, NULL, &curr_entry, &iblock) < 0) + if(H5HF__man_iter_curr(&hdr->next_block, NULL, NULL, &curr_entry, &iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "unable to retrieve current block iterator information") /* Move current iterator position backwards once */ @@ -1271,7 +1249,7 @@ H5HF__hdr_reverse_iter(H5HF_hdr_t *hdr, haddr_t dblock_addr) hdr->man_iter_off = 0; /* Reset 'next block' iterator */ - if(H5HF_man_iter_reset(&hdr->next_block) < 0) + if(H5HF__man_iter_reset(&hdr->next_block) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't reset block iterator") } /* end else */ } /* end if */ @@ -1287,7 +1265,7 @@ H5HF__hdr_reverse_iter(H5HF_hdr_t *hdr, haddr_t dblock_addr) curr_entry++; /* Set the current location of the iterator to next entry after the existing direct block */ - if(H5HF_man_iter_set_entry(hdr, &hdr->next_block, curr_entry) < 0) + if(H5HF__man_iter_set_entry(hdr, &hdr->next_block, curr_entry) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTSET, FAIL, "unable to set current block iterator location") /* Update iterator offset */ @@ -1301,18 +1279,18 @@ H5HF__hdr_reverse_iter(H5HF_hdr_t *hdr, haddr_t dblock_addr) unsigned child_nrows; /* # of rows in child block */ /* Compute # of rows in next child indirect block to use */ - child_nrows = H5HF_dtable_size_to_rows(&hdr->man_dtable, hdr->man_dtable.row_block_size[row]); + child_nrows = H5HF__dtable_size_to_rows(&hdr->man_dtable, hdr->man_dtable.row_block_size[row]); /* Lock child indirect block */ if(NULL == (child_iblock = H5HF__man_iblock_protect(hdr, iblock->ents[curr_entry].addr, child_nrows, iblock, curr_entry, FALSE, H5AC__NO_FLAGS_SET, &did_protect))) HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap indirect block") /* Set the current location of the iterator */ - if(H5HF_man_iter_set_entry(hdr, &hdr->next_block, curr_entry) < 0) + if(H5HF__man_iter_set_entry(hdr, &hdr->next_block, curr_entry) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTSET, FAIL, "unable to set current block iterator location") /* Walk down into child indirect block (pins child block) */ - if(H5HF_man_iter_down(&hdr->next_block, child_iblock) < 0) + if(H5HF__man_iter_down(&hdr->next_block, child_iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTNEXT, FAIL, "unable to advance current block iterator location") /* Update iterator location */ @@ -1342,7 +1320,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 17 2006 * *------------------------------------------------------------------------- @@ -1358,10 +1335,9 @@ H5HF__hdr_empty(H5HF_hdr_t *hdr) HDassert(hdr); /* Reset block iterator, if necessary */ - if(H5HF_man_iter_ready(&hdr->next_block)) { - if(H5HF_man_iter_reset(&hdr->next_block) < 0) + if(H5HF__man_iter_ready(&hdr->next_block)) + if(H5HF__man_iter_reset(&hdr->next_block) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't reset block iterator") - } /* end if */ /* Shrink managed heap size */ hdr->man_size = 0; @@ -1378,7 +1354,7 @@ H5HF__hdr_empty(H5HF_hdr_t *hdr) hdr->total_man_free = 0; /* Mark heap header as modified */ - if(H5HF_hdr_dirty(hdr) < 0) + if(H5HF__hdr_dirty(hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark header as dirty") done: @@ -1387,24 +1363,23 @@ done: /*------------------------------------------------------------------------- - * Function: H5HF_hdr_free + * 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) +H5HF__hdr_free(H5HF_hdr_t *hdr) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -1412,7 +1387,7 @@ H5HF_hdr_free(H5HF_hdr_t *hdr) HDassert(hdr); /* Free the block size lookup table for the doubling table */ - if(H5HF_dtable_dest(&hdr->man_dtable) < 0) + if(H5HF__dtable_dest(&hdr->man_dtable) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy fractal heap doubling table") /* Release any I/O pipeline filter information */ @@ -1425,7 +1400,7 @@ H5HF_hdr_free(H5HF_hdr_t *hdr) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_hdr_free() */ +} /* end H5HF__hdr_free() */ /*------------------------------------------------------------------------- @@ -1436,7 +1411,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jan 5 2007 * *------------------------------------------------------------------------- diff --git a/src/H5HFhuge.c b/src/H5HFhuge.c index d496d62..065e7c3 100644 --- a/src/H5HFhuge.c +++ b/src/H5HFhuge.c @@ -15,7 +15,7 @@ * * Created: H5HFhuge.c * Aug 7 2006 - * Quincey Koziol + * Quincey Koziol * * Purpose: Routines for "huge" objects in fractal heap * @@ -67,7 +67,7 @@ static herr_t H5HF__huge_bt2_create(H5HF_hdr_t *hdr); /* Local 'huge' object support routines */ -static hsize_t H5HF_huge_new_id(H5HF_hdr_t *hdr); +static hsize_t H5HF__huge_new_id(H5HF_hdr_t *hdr); static herr_t H5HF__huge_op_real(H5HF_hdr_t *hdr, const uint8_t *id, hbool_t is_read, H5HF_operator_t op, void *op_data); @@ -95,7 +95,6 @@ static herr_t H5HF__huge_op_real(H5HF_hdr_t *hdr, const uint8_t *id, * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 7 2006 * *------------------------------------------------------------------------- @@ -168,22 +167,21 @@ done: /*------------------------------------------------------------------------- - * Function: H5HF_huge_init + * Function: H5HF__huge_init * * Purpose: Initialize information for tracking 'huge' objects * * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 7 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_huge_init(H5HF_hdr_t *hdr) +H5HF__huge_init(H5HF_hdr_t *hdr) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* * Check arguments. @@ -196,10 +194,6 @@ H5HF_huge_init(H5HF_hdr_t *hdr) * the file in the heap ID (which will speed up accessing it) and we don't * have any I/O pipeline filters. */ -#ifdef QAK -HDfprintf(stderr, "%s: hdr->id_len = %u\n", "H5HF_huge_init", (unsigned)hdr->id_len); -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) >= (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 */ @@ -238,11 +232,11 @@ HDfprintf(stderr, "%s: hdr->filter_len = %u\n", "H5HF_huge_init", (unsigned)hdr- hdr->huge_bt2 = NULL; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5HF_huge_init() */ +} /* end H5HF__huge_init() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_new_id + * Function: H5HF__huge_new_id * * Purpose: Determine a new ID for an indirectly accessed 'huge' object * (either filtered or not) @@ -250,18 +244,17 @@ HDfprintf(stderr, "%s: hdr->filter_len = %u\n", "H5HF_huge_init", (unsigned)hdr- * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 15 2006 * *------------------------------------------------------------------------- */ static hsize_t -H5HF_huge_new_id(H5HF_hdr_t *hdr) +H5HF__huge_new_id(H5HF_hdr_t *hdr) { hsize_t new_id; /* New object's ID */ hsize_t ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* * Check arguments. @@ -287,7 +280,7 @@ H5HF_huge_new_id(H5HF_hdr_t *hdr) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_huge_new_id() */ +} /* end H5HF__huge_new_id() */ /*------------------------------------------------------------------------- @@ -298,7 +291,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 7 2006 * *------------------------------------------------------------------------- @@ -314,9 +306,6 @@ H5HF__huge_insert(H5HF_hdr_t *hdr, size_t obj_size, void *obj, void *_id) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE -#ifdef QAK -HDfprintf(stderr, "%s: obj_size = %Zu\n", FUNC, obj_size); -#endif /* QAK */ /* * Check arguments. @@ -362,10 +351,6 @@ HDfprintf(stderr, "%s: obj_size = %Zu\n", FUNC, obj_size); if(H5Z_pipeline(&(hdr->pline), 0, &filter_mask, H5Z_NO_EDC, filter_cb, &nbytes, &write_size, &write_buf) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTFILTER, FAIL, "output pipeline failed") -#ifdef QAK -HDfprintf(stderr, "%s: nbytes = %Zu, write_size = %Zu, write_buf = %p\n", FUNC, nbytes, write_size, write_buf); -HDfprintf(stderr, "%s: obj_size = %Zu, obj = %p\n", FUNC, obj_size, obj); -#endif /* QAK */ /* Update size of object on disk */ write_size = nbytes; @@ -399,9 +384,6 @@ HDfprintf(stderr, "%s: obj_size = %Zu, obj = %p\n", FUNC, obj_size, obj); obj_rec.len = write_size; obj_rec.filter_mask = filter_mask; obj_rec.obj_size = obj_size; -#ifdef QAK -HDfprintf(stderr, "%s: obj_rec = {%a, %Hu, %x, %Hu}\n", FUNC, obj_rec.addr, obj_rec.len, obj_rec.filter_mask, obj_rec.obj_size); -#endif /* QAK */ /* Insert record for object in v2 B-tree */ if(H5B2_insert(hdr->huge_bt2, &obj_rec) < 0) @@ -420,9 +402,6 @@ HDfprintf(stderr, "%s: obj_rec = {%a, %Hu, %x, %Hu}\n", FUNC, obj_rec.addr, obj_ /* Initialize record for tracking object in v2 B-tree */ obj_rec.addr = obj_addr; obj_rec.len = write_size; -#ifdef QAK -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->huge_bt2, &obj_rec) < 0) @@ -441,7 +420,7 @@ HDfprintf(stderr, "%s: obj_rec = {%a, %Hu}\n", FUNC, obj_rec.addr, obj_rec.len); hsize_t new_id; /* New ID for object */ /* Get new ID for object */ - if(0 == (new_id = H5HF_huge_new_id(hdr))) + if(0 == (new_id = H5HF__huge_new_id(hdr))) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't generate new ID for object") if(hdr->filter_len > 0) { @@ -451,9 +430,6 @@ HDfprintf(stderr, "%s: obj_rec = {%a, %Hu}\n", FUNC, obj_rec.addr, obj_rec.len); filt_indir_rec.filter_mask = filter_mask; filt_indir_rec.obj_size = obj_size; filt_indir_rec.id = new_id; -#ifdef QAK -HDfprintf(stderr, "%s: filt_indir_rec = {%a, %Hu, %x, %Hu, %Hu}\n", FUNC, filt_indir_rec.addr, filt_indir_rec.len, filt_indir_rec.filter_mask, filt_indir_rec.obj_size, filt_indir_rec.id); -#endif /* QAK */ /* Set pointer to record to insert */ ins_rec = &filt_indir_rec; @@ -463,9 +439,6 @@ HDfprintf(stderr, "%s: filt_indir_rec = {%a, %Hu, %x, %Hu, %Hu}\n", FUNC, filt_i indir_rec.addr = obj_addr; indir_rec.len = write_size; indir_rec.id = new_id; -#ifdef QAK -HDfprintf(stderr, "%s: indir_rec = {%a, %Hu, %Hu}\n", FUNC, indir_rec.addr, indir_rec.len, indir_rec.id); -#endif /* QAK */ /* Set pointer to record to insert */ ins_rec = &indir_rec; @@ -485,7 +458,7 @@ HDfprintf(stderr, "%s: indir_rec = {%a, %Hu, %Hu}\n", FUNC, indir_rec.addr, indi hdr->huge_nobjs++; /* Mark heap header as modified */ - if(H5HF_hdr_dirty(hdr) < 0) + if(H5HF__hdr_dirty(hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark heap header as dirty") done: @@ -501,7 +474,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 8 2006 * *------------------------------------------------------------------------- @@ -592,7 +564,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 8 2006 * *------------------------------------------------------------------------- @@ -678,7 +649,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 8 2006 * *------------------------------------------------------------------------- @@ -829,7 +799,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Feb 21 2007 * *------------------------------------------------------------------------- @@ -907,7 +876,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Sept 11 2006 * *------------------------------------------------------------------------- @@ -943,7 +911,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Sept 11 2006 * *------------------------------------------------------------------------- @@ -980,7 +947,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 8 2006 * *------------------------------------------------------------------------- @@ -1072,7 +1038,7 @@ H5HF__huge_remove(H5HF_hdr_t *hdr, const uint8_t *id) hdr->huge_nobjs--; /* Mark heap header as modified */ - if(H5HF_hdr_dirty(hdr) < 0) + if(H5HF__hdr_dirty(hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark heap header as dirty") done: @@ -1088,7 +1054,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 8 2006 * *------------------------------------------------------------------------- @@ -1134,7 +1099,7 @@ H5HF__huge_term(H5HF_hdr_t *hdr) hdr->huge_ids_wrapped = FALSE; /* Mark heap header as modified */ - if(H5HF_hdr_dirty(hdr) < 0) + if(H5HF__hdr_dirty(hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark heap header as dirty") } /* end if */ @@ -1152,7 +1117,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 8 2006 * *------------------------------------------------------------------------- diff --git a/src/H5HFiblock.c b/src/H5HFiblock.c index 07eb9cd..2714ac7 100644 --- a/src/H5HFiblock.c +++ b/src/H5HFiblock.c @@ -15,7 +15,7 @@ * * Created: H5HFiblock.c * Apr 10 2006 - * Quincey Koziol + * Quincey Koziol * * Purpose: Indirect block routines for fractal heaps. * @@ -99,7 +99,6 @@ H5FL_SEQ_DEFINE(H5HF_indirect_ptr_t); * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 17 2006 * *------------------------------------------------------------------------- @@ -166,7 +165,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 17 2006 * *------------------------------------------------------------------------- @@ -191,24 +189,23 @@ done: /*------------------------------------------------------------------------- - * Function: H5HF_iblock_incr + * Function: H5HF__iblock_incr * * Purpose: Increment reference count on shared indirect block * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 27 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_iblock_incr(H5HF_indirect_t *iblock) +H5HF__iblock_incr(H5HF_indirect_t *iblock) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Sanity checks */ HDassert(iblock); @@ -224,7 +221,7 @@ H5HF_iblock_incr(H5HF_indirect_t *iblock) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_iblock_incr() */ +} /* end H5HF__iblock_incr() */ /*------------------------------------------------------------------------- @@ -235,7 +232,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 27 2006 * *------------------------------------------------------------------------- @@ -299,8 +295,8 @@ H5HF__iblock_decr(H5HF_indirect_t *iblock) } /* end if */ else { /* Destroy the indirect block */ - if(H5HF_man_iblock_dest(iblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy fractal heap indirect block") + if(H5HF__man_iblock_dest(iblock) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy fractal heap indirect block") } /* end else */ } /* end if */ @@ -310,24 +306,23 @@ done: /*------------------------------------------------------------------------- - * Function: H5HF_iblock_dirty + * Function: H5HF__iblock_dirty * * Purpose: Mark indirect block as dirty * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 21 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_iblock_dirty(H5HF_indirect_t *iblock) +H5HF__iblock_dirty(H5HF_indirect_t *iblock) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(iblock); @@ -338,7 +333,7 @@ H5HF_iblock_dirty(H5HF_indirect_t *iblock) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_iblock_dirty() */ +} /* end H5HF__iblock_dirty() */ /*------------------------------------------------------------------------- @@ -349,7 +344,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 2 2006 * *------------------------------------------------------------------------- @@ -418,7 +412,7 @@ H5HF__man_iblock_root_create(H5HF_hdr_t *hdr, size_t min_dblock_size) HGOTO_ERROR(H5E_HEAP, H5E_CANTDEPEND, FAIL, "unable to create flush dependency") dblock->fd_parent = iblock; - if(H5HF_man_iblock_attach(iblock, 0, hdr->man_dtable.table_addr) < 0) + if(H5HF__man_iblock_attach(iblock, 0, hdr->man_dtable.table_addr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTATTACH, FAIL, "can't attach root direct block to parent indirect block") /* Check for I/O filters on this heap */ @@ -443,7 +437,7 @@ H5HF__man_iblock_root_create(H5HF_hdr_t *hdr, size_t min_dblock_size) } /* end if */ /* Start iterator at correct location */ - if(H5HF_hdr_start_iter(hdr, iblock, (hsize_t)(have_direct_block ? hdr->man_dtable.cparam.start_block_size : 0), have_direct_block) < 0) + if(H5HF__hdr_start_iter(hdr, iblock, (hsize_t)(have_direct_block ? hdr->man_dtable.cparam.start_block_size : 0), have_direct_block) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize block iterator") /* Check for skipping over direct blocks, in order to get to large enough block */ @@ -454,7 +448,7 @@ H5HF__man_iblock_root_create(H5HF_hdr_t *hdr, size_t min_dblock_size) HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't add skipped blocks to heap's free space") /* Mark indirect block as modified */ - if(H5HF_iblock_dirty(iblock) < 0) + if(H5HF__iblock_dirty(iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark indirect block as dirty") /* Unprotect root indirect block (it's pinned by the iterator though) */ @@ -476,7 +470,7 @@ H5HF__man_iblock_root_create(H5HF_hdr_t *hdr, size_t min_dblock_size) acc_dblock_free -= hdr->man_dtable.row_tot_dblock_free[0]; /* Extend heap to cover new root indirect block */ - if(H5HF_hdr_adjust_heap(hdr, hdr->man_dtable.row_block_off[nrows], (hssize_t)acc_dblock_free) < 0) + if(H5HF__hdr_adjust_heap(hdr, hdr->man_dtable.row_block_off[nrows], (hssize_t)acc_dblock_free) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTEXTEND, FAIL, "can't increase space to cover root direct block") done: @@ -492,7 +486,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Apr 17 2006 * *------------------------------------------------------------------------- @@ -518,7 +511,7 @@ H5HF__man_iblock_root_double(H5HF_hdr_t *hdr, size_t min_dblock_size) FUNC_ENTER_PACKAGE /* Get "new block" iterator information */ - if(H5HF_man_iter_curr(&hdr->next_block, &next_row, NULL, &next_entry, &iblock) < 0) + if(H5HF__man_iter_curr(&hdr->next_block, &next_row, NULL, &next_entry, &iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "unable to retrieve current block iterator location") next_size = hdr->man_dtable.row_block_size[next_row]; @@ -538,7 +531,7 @@ H5HF__man_iblock_root_double(H5HF_hdr_t *hdr, size_t min_dblock_size) skip_direct_rows = TRUE; /* Make certain we allocate at least the required row for the block requested */ - min_nrows = 1 + H5HF_dtable_size_to_row(&hdr->man_dtable, min_dblock_size); + min_nrows = 1 + H5HF__dtable_size_to_row(&hdr->man_dtable, min_dblock_size); /* Set the information for the next block, of the appropriate size */ new_next_entry = (min_nrows - 1) * hdr->man_dtable.cparam.width; @@ -644,7 +637,7 @@ H5HF__man_iblock_root_double(H5HF_hdr_t *hdr, size_t min_dblock_size) } /* end if */ /* Mark indirect block as dirty */ - if(H5HF_iblock_dirty(iblock) < 0) + if(H5HF__iblock_dirty(iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark indirect block as dirty") /* Update other shared header info */ @@ -652,7 +645,7 @@ H5HF__man_iblock_root_double(H5HF_hdr_t *hdr, size_t min_dblock_size) hdr->man_dtable.table_addr = new_addr; /* Extend heap to cover new root indirect block */ - if(H5HF_hdr_adjust_heap(hdr, 2 * hdr->man_dtable.row_block_off[new_nrows - 1], (hssize_t)acc_dblock_free) < 0) + if(H5HF__hdr_adjust_heap(hdr, 2 * hdr->man_dtable.row_block_off[new_nrows - 1], (hssize_t)acc_dblock_free) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTEXTEND, FAIL, "can't increase space to cover root direct block") done: @@ -668,7 +661,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Jun 12 2006 * *------------------------------------------------------------------------- @@ -769,7 +761,7 @@ H5HF__man_iblock_root_halve(H5HF_indirect_t *iblock) } /* end if */ /* Mark indirect block as dirty */ - if(H5HF_iblock_dirty(iblock) < 0) + if(H5HF__iblock_dirty(iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark indirect block as dirty") /* Update other shared header info */ @@ -777,7 +769,7 @@ H5HF__man_iblock_root_halve(H5HF_indirect_t *iblock) hdr->man_dtable.table_addr = new_addr; /* Shrink heap to only cover new root indirect block */ - if(H5HF_hdr_adjust_heap(hdr, 2 * hdr->man_dtable.row_block_off[new_nrows - 1], -(hssize_t)acc_dblock_free) < 0) + if(H5HF__hdr_adjust_heap(hdr, 2 * hdr->man_dtable.row_block_off[new_nrows - 1], -(hssize_t)acc_dblock_free) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTSHRINK, FAIL, "can't reduce space to cover root direct block") done: @@ -796,7 +788,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 31 2006 * *------------------------------------------------------------------------- @@ -856,11 +847,11 @@ H5HF__man_iblock_root_revert(H5HF_indirect_t *root_iblock) hdr->man_dtable.table_addr = dblock_addr; /* Reset 'next block' iterator */ - if(H5HF_hdr_reset_iter(hdr, (hsize_t)dblock_size) < 0) + if(H5HF__hdr_reset_iter(hdr, (hsize_t)dblock_size) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't reset block iterator") /* Extend heap to just cover first direct block */ - if(H5HF_hdr_adjust_heap(hdr, (hsize_t)hdr->man_dtable.cparam.start_block_size, (hssize_t)hdr->man_dtable.row_tot_dblock_free[0]) < 0) + if(H5HF__hdr_adjust_heap(hdr, (hsize_t)hdr->man_dtable.cparam.start_block_size, (hssize_t)hdr->man_dtable.row_tot_dblock_free[0]) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTEXTEND, FAIL, "can't increase space to cover root direct block") /* Scan free space sections to reset any 'parent' pointers */ @@ -886,7 +877,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 6 2006 * *------------------------------------------------------------------------- @@ -919,11 +909,11 @@ H5HF__man_iblock_alloc_row(H5HF_hdr_t *hdr, H5HF_free_section_t **sec_node) HGOTO_ERROR(H5E_HEAP, H5E_CANTREVIVE, FAIL, "can't revive indirect section") /* Get a pointer to the indirect block covering the section */ - if(NULL == (iblock = H5HF_sect_row_get_iblock(old_sec_node))) + if(NULL == (iblock = H5HF__sect_row_get_iblock(old_sec_node))) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't retrieve indirect block for row section") /* Hold indirect block in memory, until direct block can point to it */ - if(H5HF_iblock_incr(iblock) < 0) + if(H5HF__iblock_incr(iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, FAIL, "can't increment reference count on shared indirect block") iblock_held = TRUE; @@ -953,7 +943,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 6 2006 * *------------------------------------------------------------------------- @@ -986,7 +975,7 @@ H5HF__man_iblock_create(H5HF_hdr_t *hdr, H5HF_indirect_t *par_iblock, /* Share common heap information */ iblock->hdr = hdr; - if(H5HF_hdr_incr(hdr) < 0) + if(H5HF__hdr_incr(hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, FAIL, "can't increment reference count on shared heap header") /* Set info for indirect block */ @@ -1050,7 +1039,7 @@ H5HF__man_iblock_create(H5HF_hdr_t *hdr, H5HF_indirect_t *par_iblock, iblock->par_entry = par_entry; if(iblock->parent) { /* Attach new block to parent */ - if(H5HF_man_iblock_attach(iblock->parent, par_entry, *addr_p) < 0) + if(H5HF__man_iblock_attach(iblock->parent, par_entry, *addr_p) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTATTACH, FAIL, "can't attach indirect block to parent indirect block") /* Compute the indirect block's offset in the heap's address space */ @@ -1080,7 +1069,7 @@ H5HF__man_iblock_create(H5HF_hdr_t *hdr, H5HF_indirect_t *par_iblock, done: if(ret_value < 0) if(iblock) - if(H5HF_man_iblock_dest(iblock) < 0) + if(H5HF__man_iblock_dest(iblock) < 0) HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy fractal heap indirect block") FUNC_LEAVE_NOAPI(ret_value) @@ -1095,7 +1084,6 @@ done: * Return: Pointer to indirect block on success, NULL on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Apr 17 2006 * *------------------------------------------------------------------------- @@ -1226,7 +1214,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 17 2006 * *------------------------------------------------------------------------- @@ -1273,24 +1260,23 @@ done: /*------------------------------------------------------------------------- - * Function: H5HF_man_iblock_attach + * Function: H5HF__man_iblock_attach * * Purpose: Attach a child block (direct or indirect) to an indirect block * * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 30 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_man_iblock_attach(H5HF_indirect_t *iblock, unsigned entry, haddr_t child_addr) +H5HF__man_iblock_attach(H5HF_indirect_t *iblock, unsigned entry, haddr_t child_addr) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -1300,7 +1286,7 @@ H5HF_man_iblock_attach(H5HF_indirect_t *iblock, unsigned entry, haddr_t child_ad HDassert(!H5F_addr_defined(iblock->ents[entry].addr)); /* Increment the reference count on this indirect block */ - if(H5HF_iblock_incr(iblock) < 0) + if(H5HF__iblock_incr(iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, FAIL, "can't increment reference count on shared indirect block") /* Point at the child block */ @@ -1329,12 +1315,12 @@ H5HF_man_iblock_attach(H5HF_indirect_t *iblock, unsigned entry, haddr_t child_ad iblock->nchildren++; /* Mark indirect block as modified */ - if(H5HF_iblock_dirty(iblock) < 0) + if(H5HF__iblock_dirty(iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark indirect block as dirty") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_man_iblock_attach() */ +} /* end H5HF__man_iblock_attach() */ /*------------------------------------------------------------------------- @@ -1345,7 +1331,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 31 2006 * *------------------------------------------------------------------------- @@ -1451,7 +1436,7 @@ H5HF__man_iblock_detach(H5HF_indirect_t *iblock, unsigned entry) /* If the indirect block wasn't removed already (by reverting it) */ if(!iblock->removed_from_cache) { /* Mark indirect block as modified */ - if(H5HF_iblock_dirty(iblock) < 0) + if(H5HF__iblock_dirty(iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark indirect block as dirty") /* Check for last child being removed from indirect block */ @@ -1551,22 +1536,21 @@ done: /*------------------------------------------------------------------------- - * Function: H5HF_man_iblock_entry_addr + * Function: H5HF__man_iblock_entry_addr * * Purpose: Retrieve the address of an indirect block's child * * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 10 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_man_iblock_entry_addr(H5HF_indirect_t *iblock, unsigned entry, haddr_t *child_addr) +H5HF__man_iblock_entry_addr(H5HF_indirect_t *iblock, unsigned entry, haddr_t *child_addr) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* * Check arguments. @@ -1578,7 +1562,7 @@ H5HF_man_iblock_entry_addr(H5HF_indirect_t *iblock, unsigned entry, haddr_t *chi *child_addr = iblock->ents[entry].addr; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5HF_man_iblock_entry_addr() */ +} /* end H5HF__man_iblock_entry_addr() */ /*------------------------------------------------------------------------- @@ -1593,7 +1577,6 @@ H5HF_man_iblock_entry_addr(H5HF_indirect_t *iblock, unsigned entry, haddr_t *chi * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 7 2006 * *------------------------------------------------------------------------- @@ -1653,7 +1636,7 @@ H5HF__man_iblock_delete(H5HF_hdr_t *hdr, haddr_t iblock_addr, row_block_size = (hsize_t)hdr->man_dtable.row_block_size[row]; /* Compute # of rows in next child indirect block to use */ - child_nrows = H5HF_dtable_size_to_rows(&hdr->man_dtable, row_block_size); + child_nrows = H5HF__dtable_size_to_rows(&hdr->man_dtable, row_block_size); /* Delete child indirect block */ if(H5HF__man_iblock_delete(hdr, iblock->ents[entry].addr, child_nrows, iblock, entry) < 0) @@ -1774,7 +1757,6 @@ done: * Return: Non-negative on success / Negative on failure * * Programmer: Quincey Koziol - * koziol@lbl.gov * Jan 14 2018 * *------------------------------------------------------------------------- @@ -1799,7 +1781,7 @@ H5HF__man_iblock_parent_info(const H5HF_hdr_t *hdr, hsize_t block_off, HDassert(ret_entry); /* Look up row & column for object */ - if(H5HF_dtable_lookup(&hdr->man_dtable, block_off, &row, &col) < 0) + if(H5HF__dtable_lookup(&hdr->man_dtable, block_off, &row, &col) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPUTE, FAIL, "can't compute row & column of block") /* Sanity check - first lookup must be an indirect block */ @@ -1823,7 +1805,7 @@ H5HF__man_iblock_parent_info(const H5HF_hdr_t *hdr, hsize_t block_off, prev_col = col; /* Look up row & column in new indirect block for object */ - if(H5HF_dtable_lookup(&hdr->man_dtable, (block_off - par_block_off), &row, &col) < 0) + if(H5HF__dtable_lookup(&hdr->man_dtable, (block_off - par_block_off), &row, &col) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPUTE, FAIL, "can't compute row & column of block") } /* end while */ @@ -1841,24 +1823,23 @@ done: /*------------------------------------------------------------------------- - * Function: H5HF_man_iblock_dest + * Function: H5HF__man_iblock_dest * * Purpose: Destroys a fractal heap indirect block in memory. * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 6 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_man_iblock_dest(H5HF_indirect_t *iblock) +H5HF__man_iblock_dest(H5HF_indirect_t *iblock) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -1868,7 +1849,7 @@ H5HF_man_iblock_dest(H5HF_indirect_t *iblock) /* Decrement reference count on shared info */ HDassert(iblock->hdr); - if(H5HF_hdr_decr(iblock->hdr) < 0) + if(H5HF__hdr_decr(iblock->hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement reference count on shared heap header") if(iblock->parent) if(H5HF__iblock_decr(iblock->parent) < 0) @@ -1887,5 +1868,5 @@ H5HF_man_iblock_dest(H5HF_indirect_t *iblock) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_man_iblock_dest() */ +} /* end H5HF__man_iblock_dest() */ diff --git a/src/H5HFiter.c b/src/H5HFiter.c index ceebc3b..43cb76a 100644 --- a/src/H5HFiter.c +++ b/src/H5HFiter.c @@ -15,7 +15,7 @@ * * Created: H5HFiter.c * Apr 24 2006 - * Quincey Koziol + * Quincey Koziol * * Purpose: Block iteration routines for fractal heaps. * @@ -77,7 +77,7 @@ H5FL_DEFINE(H5HF_block_loc_t); /*------------------------------------------------------------------------- - * Function: H5HF_man_iter_init + * Function: H5HF__man_iter_init * * Purpose: Initialize a block iterator for walking over all the blocks * in a fractal heap. (initialization finishes when iterator is @@ -86,15 +86,14 @@ H5FL_DEFINE(H5HF_block_loc_t); * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Apr 24 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_man_iter_init(H5HF_block_iter_t *biter) +H5HF__man_iter_init(H5HF_block_iter_t *biter) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* * Check arguments. @@ -105,7 +104,7 @@ H5HF_man_iter_init(H5HF_block_iter_t *biter) HDmemset(biter, 0, sizeof(H5HF_block_iter_t)); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5HF_man_iter_init() */ +} /* end H5HF__man_iter_init() */ /*------------------------------------------------------------------------- @@ -117,7 +116,6 @@ H5HF_man_iter_init(H5HF_block_iter_t *biter) * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Apr 24 2006 * *------------------------------------------------------------------------- @@ -223,7 +221,7 @@ H5HF__man_iter_start_offset(H5HF_hdr_t *hdr, H5HF_block_iter_t *biter, biter->curr->context = iblock; /* Hold the indirect block with the location */ - if(H5HF_iblock_incr(biter->curr->context) < 0) + if(H5HF__iblock_incr(biter->curr->context) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, FAIL, "can't increment reference count on shared indirect block") /* Release the current indirect block */ @@ -265,22 +263,21 @@ done: /*------------------------------------------------------------------------- - * Function: H5HF_man_iter_set_entry + * Function: H5HF__man_iter_set_entry * * Purpose: Set the current entry for the iterator * * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 31 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_man_iter_set_entry(const H5HF_hdr_t *hdr, H5HF_block_iter_t *biter, unsigned entry) +H5HF__man_iter_set_entry(const H5HF_hdr_t *hdr, H5HF_block_iter_t *biter, unsigned entry) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* * Check arguments. @@ -293,11 +290,11 @@ H5HF_man_iter_set_entry(const H5HF_hdr_t *hdr, H5HF_block_iter_t *biter, unsigne biter->curr->col = entry % hdr->man_dtable.cparam.width; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5HF_man_iter_set_entry() */ +} /* end H5HF__man_iter_set_entry() */ /*------------------------------------------------------------------------- - * Function: H5HF_man_iter_start_entry + * Function: H5HF__man_iter_start_entry * * Purpose: Initialize a block iterator to a particular location within * an indirect block @@ -305,19 +302,18 @@ H5HF_man_iter_set_entry(const H5HF_hdr_t *hdr, H5HF_block_iter_t *biter, unsigne * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Apr 24 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_man_iter_start_entry(H5HF_hdr_t *hdr, H5HF_block_iter_t *biter, +H5HF__man_iter_start_entry(H5HF_hdr_t *hdr, H5HF_block_iter_t *biter, H5HF_indirect_t *iblock, unsigned start_entry) { H5HF_block_loc_t *new_loc = NULL; /* Pointer to new block location */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -339,7 +335,7 @@ H5HF_man_iter_start_entry(H5HF_hdr_t *hdr, H5HF_block_iter_t *biter, new_loc->up = NULL; /* Increment reference count on indirect block */ - if(H5HF_iblock_incr(new_loc->context) < 0) + if(H5HF__iblock_incr(new_loc->context) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, FAIL, "can't increment reference count on shared indirect block") /* Make new location the current location */ @@ -353,11 +349,11 @@ done: new_loc = H5FL_FREE(H5HF_block_loc_t, new_loc); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_man_iter_start_entry() */ +} /* end H5HF__man_iter_start_entry() */ /*------------------------------------------------------------------------- - * Function: H5HF_man_iter_reset + * Function: H5HF__man_iter_reset * * Purpose: Reset a block iterator to it's initial state, freeing any * location context it currently has @@ -365,17 +361,16 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Apr 24 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_man_iter_reset(H5HF_block_iter_t *biter) +H5HF__man_iter_reset(H5HF_block_iter_t *biter) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -414,26 +409,25 @@ H5HF_man_iter_reset(H5HF_block_iter_t *biter) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_man_iter_reset() */ +} /* end H5HF__man_iter_reset() */ /*------------------------------------------------------------------------- - * Function: H5HF_man_iter_next + * Function: H5HF__man_iter_next * * Purpose: Advance to the next block within the current block of the heap * * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Apr 24 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_man_iter_next(H5HF_hdr_t *hdr, H5HF_block_iter_t *biter, unsigned nentries) +H5HF__man_iter_next(H5HF_hdr_t *hdr, H5HF_block_iter_t *biter, unsigned nentries) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* * Check arguments. @@ -450,29 +444,28 @@ H5HF_man_iter_next(H5HF_hdr_t *hdr, H5HF_block_iter_t *biter, unsigned nentries) /* HDassert(biter->curr->row <= biter->curr->context->nrows); */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5HF_man_iter_next() */ +} /* end H5HF__man_iter_next() */ /*------------------------------------------------------------------------- - * Function: H5HF_man_iter_up + * Function: H5HF__man_iter_up * * Purpose: Move iterator up one level * * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Apr 24 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_man_iter_up(H5HF_block_iter_t *biter) +H5HF__man_iter_up(H5HF_block_iter_t *biter) { H5HF_block_loc_t *up_loc; /* Pointer to 'up' block location */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -498,29 +491,28 @@ H5HF_man_iter_up(H5HF_block_iter_t *biter) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_man_iter_up() */ +} /* end H5HF__man_iter_up() */ /*------------------------------------------------------------------------- - * Function: H5HF_man_iter_down + * Function: H5HF__man_iter_down * * Purpose: Move iterator down one level * * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Apr 24 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_man_iter_down(H5HF_block_iter_t *biter, H5HF_indirect_t *iblock) +H5HF__man_iter_down(H5HF_block_iter_t *biter, H5HF_indirect_t *iblock) { H5HF_block_loc_t *down_loc = NULL; /* Pointer to new 'down' block location */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -542,7 +534,7 @@ H5HF_man_iter_down(H5HF_block_iter_t *biter, H5HF_indirect_t *iblock) down_loc->up = biter->curr; /* Increment reference count on indirect block */ - if(H5HF_iblock_incr(down_loc->context) < 0) + if(H5HF__iblock_incr(down_loc->context) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, FAIL, "can't increment reference count on shared indirect block") /* Make down location the current location */ @@ -553,27 +545,26 @@ done: down_loc = H5FL_FREE(H5HF_block_loc_t, down_loc); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_man_iter_down() */ +} /* end H5HF__man_iter_down() */ /*------------------------------------------------------------------------- - * Function: H5HF_man_iter_curr + * Function: H5HF__man_iter_curr * * Purpose: Retrieve information about the current block iterator location * * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Apr 24 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_man_iter_curr(H5HF_block_iter_t *biter, unsigned *row, unsigned *col, +H5HF__man_iter_curr(H5HF_block_iter_t *biter, unsigned *row, unsigned *col, unsigned *entry, H5HF_indirect_t **block) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* * Check arguments. @@ -592,66 +583,25 @@ H5HF_man_iter_curr(H5HF_block_iter_t *biter, unsigned *row, unsigned *col, *block = biter->curr->context; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5HF_man_iter_curr() */ - - -/*------------------------------------------------------------------------- - * Function: H5HF_man_iter_offset - * - * Purpose: Retrieve offset of iterator in heap - * - * Return: SUCCEED/FAIL - * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * Apr 25 2006 - * - *------------------------------------------------------------------------- - */ -herr_t -H5HF_man_iter_offset(H5HF_hdr_t *hdr, H5HF_block_iter_t *biter, hsize_t *offset) -{ - hsize_t curr_offset; /* For computing offset in heap */ - - FUNC_ENTER_NOAPI_NOINIT_NOERR - - /* - * Check arguments. - */ - HDassert(biter); - HDassert(biter->ready); - HDassert(biter->curr->context); - HDassert(offset); - - /* Compute the offset in the heap */ - curr_offset = biter->curr->context->block_off; - curr_offset += hdr->man_dtable.row_block_off[biter->curr->row]; - curr_offset += biter->curr->col * hdr->man_dtable.row_block_size[biter->curr->row]; - - /* Assign the return value */ - *offset = curr_offset; - - FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5HF_man_iter_offset() */ +} /* end H5HF__man_iter_curr() */ /*------------------------------------------------------------------------- - * Function: H5HF_man_iter_ready + * Function: H5HF__man_iter_ready * * Purpose: Query if iterator is ready to use * * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Apr 25 2006 * *------------------------------------------------------------------------- */ hbool_t -H5HF_man_iter_ready(H5HF_block_iter_t *biter) +H5HF__man_iter_ready(H5HF_block_iter_t *biter) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* * Check arguments. @@ -659,5 +609,5 @@ H5HF_man_iter_ready(H5HF_block_iter_t *biter) HDassert(biter); FUNC_LEAVE_NOAPI(biter->ready) -} /* end H5HF_man_iter_ready() */ +} /* end H5HF__man_iter_ready() */ diff --git a/src/H5HFman.c b/src/H5HFman.c index ea00546..7a2f93c 100644 --- a/src/H5HFman.c +++ b/src/H5HFman.c @@ -15,7 +15,7 @@ * * Created: H5HFman.c * Feb 24 2006 - * Quincey Koziol + * Quincey Koziol * * Purpose: "Managed" object routines for fractal heaps. * @@ -97,7 +97,6 @@ static herr_t H5HF__man_op_real(H5HF_hdr_t *hdr, const uint8_t *id, * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 13 2006 * *------------------------------------------------------------------------- @@ -154,7 +153,7 @@ H5HF__man_insert(H5HF_hdr_t *hdr, size_t obj_size, const void *obj, void *_id) HDassert(sec_node->sect_info.state == H5FS_SECT_LIVE); /* Retrieve direct block address from section */ - if(H5HF_sect_single_dblock_info(hdr, sec_node, &dblock_addr, &dblock_size) < 0) + if(H5HF__sect_single_dblock_info(hdr, sec_node, &dblock_addr, &dblock_size) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't retrieve direct block information") /* Lock direct block */ @@ -197,7 +196,7 @@ H5HF__man_insert(H5HF_hdr_t *hdr, size_t obj_size, const void *obj, void *_id) hdr->man_nobjs++; /* Reduce space available in heap (marks header dirty) */ - if(H5HF_hdr_adj_free(hdr, -(ssize_t)obj_size) < 0) + if(H5HF__hdr_adj_free(hdr, -(ssize_t)obj_size) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't adjust free space for heap") done: @@ -215,22 +214,22 @@ done: /*------------------------------------------------------------------------- - * Function: H5HF_man_get_obj_len + * Function: H5HF__man_get_obj_len * * Purpose: Get the size of a managed heap object * * Return: SUCCEED (Can't fail) * - * Programmer: Dana Robinson (derobins@hdfgroup.org) + * Programmer: Dana Robinson * August 2012 * *------------------------------------------------------------------------- */ herr_t -H5HF_man_get_obj_len(H5HF_hdr_t *hdr, const uint8_t *id, size_t *obj_len_p) +H5HF__man_get_obj_len(H5HF_hdr_t *hdr, const uint8_t *id, size_t *obj_len_p) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* * Check arguments. @@ -249,7 +248,7 @@ H5HF_man_get_obj_len(H5HF_hdr_t *hdr, const uint8_t *id, size_t *obj_len_p) UINT64DECODE_VAR(id, *obj_len_p, hdr->heap_len_size); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5HF_man_get_obj_len() */ +} /* end H5HF__man_get_obj_len() */ /*------------------------------------------------------------------------- @@ -260,7 +259,6 @@ H5HF_man_get_obj_len(H5HF_hdr_t *hdr, const uint8_t *id, size_t *obj_len_p) * Return: SUCCEED (Can't fail) * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 20 2015 * *------------------------------------------------------------------------- @@ -296,7 +294,6 @@ H5HF__man_get_obj_off(const H5HF_hdr_t *hdr, const uint8_t *id, hsize_t *obj_off * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 17 2006 * *------------------------------------------------------------------------- @@ -445,7 +442,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 17 2006 * *------------------------------------------------------------------------- @@ -465,7 +461,7 @@ H5HF__man_read(H5HF_hdr_t *hdr, const uint8_t *id, void *obj) HDassert(obj); /* Call the internal 'op' routine routine */ - if(H5HF__man_op_real(hdr, id, H5HF_op_read, obj, 0) < 0) + if(H5HF__man_op_real(hdr, id, H5HF__op_read, obj, 0) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTOPERATE, FAIL, "unable to operate on heap object") done: @@ -481,7 +477,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Dec 18 2006 * *------------------------------------------------------------------------- @@ -502,7 +497,7 @@ H5HF__man_write(H5HF_hdr_t *hdr, const uint8_t *id, const void *obj) /* Call the internal 'op' routine routine */ /* (Casting away const OK - QAK) */ - if(H5HF__man_op_real(hdr, id, H5HF_op_write, (void *)obj, H5HF_OP_MODIFY) < 0) + if(H5HF__man_op_real(hdr, id, H5HF__op_write, (void *)obj, H5HF_OP_MODIFY) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTOPERATE, FAIL, "unable to operate on heap object") done: @@ -518,7 +513,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Sept 11 2006 * *------------------------------------------------------------------------- @@ -554,7 +548,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 15 2006 * *------------------------------------------------------------------------- @@ -643,7 +636,7 @@ H5HF__man_remove(H5HF_hdr_t *hdr, const uint8_t *id) HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "object overruns end of direct block") /* Create free space section node */ - if(NULL == (sec_node = H5HF_sect_single_new(obj_off, obj_len, iblock, dblock_entry))) + if(NULL == (sec_node = H5HF__sect_single_new(obj_off, obj_len, iblock, dblock_entry))) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't create section for direct block's free space") /* Unlock indirect block */ @@ -654,7 +647,7 @@ H5HF__man_remove(H5HF_hdr_t *hdr, const uint8_t *id) } /* end if */ /* Increase space available in heap (marks header dirty) */ - if(H5HF_hdr_adj_free(hdr, (ssize_t)obj_len) < 0) + if(H5HF__hdr_adj_free(hdr, (ssize_t)obj_len) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't adjust free space for heap") /* Update statistics about heap */ diff --git a/src/H5HFmodule.h b/src/H5HFmodule.h index dd6576a..0334673 100644 --- a/src/H5HFmodule.h +++ b/src/H5HFmodule.h @@ -11,7 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, September 12, 2015 * * Purpose: This file contains declarations which define macros for the diff --git a/src/H5HFpkg.h b/src/H5HFpkg.h index 83e46fc..5324bc4 100644 --- a/src/H5HFpkg.h +++ b/src/H5HFpkg.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Friday, February 24, 2006 * * Purpose: This file contains declarations which are visible only within @@ -220,9 +220,6 @@ typedef struct H5HF_dtable_t { /* Fractal heap free list info (forward decl - defined in H5HFflist.c) */ typedef struct H5HF_freelist_t H5HF_freelist_t; -/* Forward decl indirect block info */ -typedef struct H5HF_indirect_t H5HF_indirect_t; - /* Fractal heap block location */ typedef struct H5HF_block_loc_t { /* Necessary table fields */ @@ -293,7 +290,7 @@ typedef struct H5HF_free_section_t { /* (Each fractal heap header has certain information that is shared across all * the instances of blocks in that fractal heap) */ -typedef struct H5HF_hdr_t { +struct H5HF_hdr_t { /* Information for H5AC cache functions, _must_ be first field in structure */ H5AC_info_t cache_info; @@ -358,7 +355,7 @@ typedef struct H5HF_hdr_t { 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 */ /* (common between entries pointing to direct & indirect child blocks) */ @@ -606,46 +603,45 @@ H5FL_BLK_EXTERN(direct_block); /******************************/ /* Doubling table routines */ -H5_DLL herr_t H5HF_dtable_init(H5HF_dtable_t *dtable); -H5_DLL herr_t H5HF_dtable_dest(H5HF_dtable_t *dtable); -H5_DLL herr_t H5HF_dtable_lookup(const H5HF_dtable_t *dtable, hsize_t off, +H5_DLL herr_t H5HF__dtable_init(H5HF_dtable_t *dtable); +H5_DLL herr_t H5HF__dtable_dest(H5HF_dtable_t *dtable); +H5_DLL herr_t H5HF__dtable_lookup(const H5HF_dtable_t *dtable, hsize_t off, unsigned *row, unsigned *col); -H5_DLL unsigned H5HF_dtable_size_to_row(const H5HF_dtable_t *dtable, size_t block_size); -H5_DLL unsigned H5HF_dtable_size_to_rows(const H5HF_dtable_t *dtable, hsize_t size); -H5_DLL hsize_t H5HF_dtable_span_size(const H5HF_dtable_t *dtable, unsigned start_row, +H5_DLL unsigned H5HF__dtable_size_to_row(const H5HF_dtable_t *dtable, size_t block_size); +H5_DLL unsigned H5HF__dtable_size_to_rows(const H5HF_dtable_t *dtable, hsize_t size); +H5_DLL hsize_t H5HF__dtable_span_size(const H5HF_dtable_t *dtable, unsigned start_row, unsigned start_col, unsigned num_entries); /* Heap header routines */ -H5_DLL H5HF_hdr_t * H5HF_hdr_alloc(H5F_t *f); -H5_DLL haddr_t H5HF_hdr_create(H5F_t *f, const H5HF_create_t *cparam); +H5_DLL H5HF_hdr_t * H5HF__hdr_alloc(H5F_t *f); +H5_DLL haddr_t H5HF__hdr_create(H5F_t *f, const H5HF_create_t *cparam); H5_DLL H5HF_hdr_t *H5HF__hdr_protect(H5F_t *f, haddr_t addr, unsigned flags); -H5_DLL herr_t H5HF_hdr_finish_init_phase1(H5HF_hdr_t *hdr); -H5_DLL herr_t H5HF_hdr_finish_init_phase2(H5HF_hdr_t *hdr); -H5_DLL herr_t H5HF_hdr_finish_init(H5HF_hdr_t *hdr); -H5_DLL herr_t H5HF_hdr_incr(H5HF_hdr_t *hdr); -H5_DLL herr_t H5HF_hdr_decr(H5HF_hdr_t *hdr); -H5_DLL herr_t H5HF_hdr_fuse_incr(H5HF_hdr_t *hdr); -H5_DLL size_t H5HF_hdr_fuse_decr(H5HF_hdr_t *hdr); -H5_DLL herr_t H5HF_hdr_dirty(H5HF_hdr_t *hdr); -H5_DLL herr_t H5HF_hdr_adj_free(H5HF_hdr_t *hdr, ssize_t amt); -H5_DLL herr_t H5HF_hdr_adjust_heap(H5HF_hdr_t *hdr, hsize_t new_size, hssize_t extra_free); -H5_DLL herr_t H5HF_hdr_inc_alloc(H5HF_hdr_t *hdr, size_t alloc_size); -H5_DLL herr_t H5HF_hdr_start_iter(H5HF_hdr_t *hdr, H5HF_indirect_t *iblock, hsize_t curr_off, unsigned curr_entry); +H5_DLL herr_t H5HF__hdr_finish_init_phase1(H5HF_hdr_t *hdr); +H5_DLL herr_t H5HF__hdr_finish_init_phase2(H5HF_hdr_t *hdr); +H5_DLL herr_t H5HF__hdr_finish_init(H5HF_hdr_t *hdr); +H5_DLL herr_t H5HF__hdr_incr(H5HF_hdr_t *hdr); +H5_DLL herr_t H5HF__hdr_decr(H5HF_hdr_t *hdr); +H5_DLL herr_t H5HF__hdr_fuse_incr(H5HF_hdr_t *hdr); +H5_DLL size_t H5HF__hdr_fuse_decr(H5HF_hdr_t *hdr); +H5_DLL herr_t H5HF__hdr_dirty(H5HF_hdr_t *hdr); +H5_DLL herr_t H5HF__hdr_adj_free(H5HF_hdr_t *hdr, ssize_t amt); +H5_DLL herr_t H5HF__hdr_adjust_heap(H5HF_hdr_t *hdr, hsize_t new_size, hssize_t extra_free); +H5_DLL herr_t H5HF__hdr_inc_alloc(H5HF_hdr_t *hdr, size_t alloc_size); +H5_DLL herr_t H5HF__hdr_start_iter(H5HF_hdr_t *hdr, H5HF_indirect_t *iblock, hsize_t curr_off, unsigned curr_entry); H5_DLL herr_t H5HF__hdr_skip_blocks(H5HF_hdr_t *hdr, H5HF_indirect_t *iblock, unsigned start_entry, unsigned nentries); H5_DLL herr_t H5HF__hdr_update_iter(H5HF_hdr_t *hdr, size_t min_dblock_size); -H5_DLL herr_t H5HF_hdr_inc_iter(H5HF_hdr_t *hdr, hsize_t adv_size, unsigned nentries); +H5_DLL herr_t H5HF__hdr_inc_iter(H5HF_hdr_t *hdr, hsize_t adv_size, unsigned nentries); H5_DLL herr_t H5HF__hdr_reverse_iter(H5HF_hdr_t *hdr, 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_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_free(H5HF_hdr_t *hdr); H5_DLL herr_t H5HF__hdr_delete(H5HF_hdr_t *hdr); -H5_DLL herr_t H5HF_hdr_dest(H5HF_hdr_t *hdr); /* Indirect block routines */ -H5_DLL herr_t H5HF_iblock_incr(H5HF_indirect_t *iblock); +H5_DLL herr_t H5HF__iblock_incr(H5HF_indirect_t *iblock); H5_DLL herr_t H5HF__iblock_decr(H5HF_indirect_t *iblock); -H5_DLL herr_t H5HF_iblock_dirty(H5HF_indirect_t *iblock); +H5_DLL herr_t H5HF__iblock_dirty(H5HF_indirect_t *iblock); H5_DLL herr_t H5HF__man_iblock_root_create(H5HF_hdr_t *hdr, size_t min_dblock_size); H5_DLL herr_t H5HF__man_iblock_root_double(H5HF_hdr_t *hdr, @@ -659,10 +655,10 @@ H5_DLL H5HF_indirect_t *H5HF__man_iblock_protect(H5HF_hdr_t *hdr, haddr_t iblock hbool_t must_protect, unsigned flags, hbool_t *did_protect); H5_DLL herr_t H5HF__man_iblock_unprotect(H5HF_indirect_t *iblock, unsigned cache_flags, hbool_t did_protect); -H5_DLL herr_t H5HF_man_iblock_attach(H5HF_indirect_t *iblock, unsigned entry, +H5_DLL herr_t H5HF__man_iblock_attach(H5HF_indirect_t *iblock, unsigned entry, haddr_t dblock_addr); H5_DLL herr_t H5HF__man_iblock_detach(H5HF_indirect_t *iblock, unsigned entry); -H5_DLL herr_t H5HF_man_iblock_entry_addr(H5HF_indirect_t *iblock, unsigned entry, +H5_DLL herr_t H5HF__man_iblock_entry_addr(H5HF_indirect_t *iblock, unsigned entry, haddr_t *child_addr); H5_DLL herr_t H5HF__man_iblock_delete(H5HF_hdr_t *hdr, haddr_t iblock_addr, unsigned iblock_nrows, H5HF_indirect_t *par_iblock, unsigned par_entry); @@ -670,7 +666,7 @@ H5_DLL herr_t H5HF__man_iblock_size(H5F_t *f, H5HF_hdr_t *hdr, haddr_t iblock_addr, unsigned nrows, H5HF_indirect_t *par_iblock, unsigned par_entry, hsize_t *heap_size/*out*/); H5_DLL herr_t H5HF__man_iblock_parent_info(const H5HF_hdr_t *hdr, hsize_t block_off, hsize_t *ret_par_block_off, unsigned *ret_entry); -H5_DLL herr_t H5HF_man_iblock_dest(H5HF_indirect_t *iblock); +H5_DLL herr_t H5HF__man_iblock_dest(H5HF_indirect_t *iblock); /* Direct block routines */ H5_DLL herr_t H5HF__man_dblock_new(H5HF_hdr_t *fh, size_t request, @@ -688,12 +684,12 @@ H5_DLL herr_t H5HF__man_dblock_locate(H5HF_hdr_t *hdr, hsize_t obj_off, unsigned flags); H5_DLL herr_t H5HF__man_dblock_delete(H5F_t *f, haddr_t dblock_addr, hsize_t dblock_size); -H5_DLL herr_t H5HF_man_dblock_dest(H5HF_direct_t *dblock); +H5_DLL herr_t H5HF__man_dblock_dest(H5HF_direct_t *dblock); /* Managed object routines */ H5_DLL herr_t H5HF__man_insert(H5HF_hdr_t *fh, size_t obj_size, const void *obj, void *id); -H5_DLL herr_t H5HF_man_get_obj_len(H5HF_hdr_t *hdr, const uint8_t *id, +H5_DLL herr_t H5HF__man_get_obj_len(H5HF_hdr_t *hdr, const uint8_t *id, size_t *obj_len_p); H5_DLL void H5HF__man_get_obj_off(const H5HF_hdr_t *hdr, const uint8_t *id, hsize_t *obj_off_p); @@ -704,7 +700,7 @@ H5_DLL herr_t H5HF__man_op(H5HF_hdr_t *hdr, const uint8_t *id, H5HF_operator_t o H5_DLL herr_t H5HF__man_remove(H5HF_hdr_t *hdr, const uint8_t *id); /* 'Huge' object routines */ -H5_DLL herr_t H5HF_huge_init(H5HF_hdr_t *hdr); +H5_DLL herr_t H5HF__huge_init(H5HF_hdr_t *hdr); H5_DLL herr_t H5HF__huge_insert(H5HF_hdr_t *hdr, size_t obj_size, void *obj, void *id); H5_DLL herr_t H5HF__huge_get_obj_len(H5HF_hdr_t *hdr, const uint8_t *id, @@ -731,46 +727,32 @@ H5_DLL herr_t H5HF__huge_bt2_filt_dir_found(const void *nrecord, void *op_data); H5_DLL herr_t H5HF__huge_bt2_filt_dir_remove(const void *nrecord, void *op_data); /* 'Tiny' object routines */ -H5_DLL herr_t H5HF_tiny_init(H5HF_hdr_t *hdr); -H5_DLL herr_t H5HF_tiny_insert(H5HF_hdr_t *hdr, size_t obj_size, const void *obj, +H5_DLL herr_t H5HF__tiny_init(H5HF_hdr_t *hdr); +H5_DLL herr_t H5HF__tiny_insert(H5HF_hdr_t *hdr, size_t obj_size, const void *obj, void *id); -H5_DLL herr_t H5HF_tiny_get_obj_len(H5HF_hdr_t *hdr, const uint8_t *id, +H5_DLL herr_t H5HF__tiny_get_obj_len(H5HF_hdr_t *hdr, const uint8_t *id, size_t *obj_len_p); -H5_DLL herr_t H5HF_tiny_read(H5HF_hdr_t *fh, const uint8_t *id, void *obj); -H5_DLL herr_t H5HF_tiny_op(H5HF_hdr_t *hdr, const uint8_t *id, +H5_DLL herr_t H5HF__tiny_read(H5HF_hdr_t *fh, const uint8_t *id, void *obj); +H5_DLL herr_t H5HF__tiny_op(H5HF_hdr_t *hdr, const uint8_t *id, H5HF_operator_t op, void *op_data); -H5_DLL herr_t H5HF_tiny_remove(H5HF_hdr_t *fh, const uint8_t *id); - -/* Debugging routines for dumping file structures */ -H5_DLL void H5HF_hdr_print(const H5HF_hdr_t *hdr, hbool_t dump_internal, - FILE *stream, int indent, int fwidth); -H5_DLL herr_t H5HF_hdr_debug(H5F_t *f, haddr_t addr, - FILE *stream, int indent, int fwidth); -H5_DLL herr_t H5HF_dblock_debug(H5F_t *f, haddr_t addr, - FILE *stream, int indent, int fwidth, haddr_t hdr_addr, size_t nrec); -H5_DLL void H5HF_iblock_print(const H5HF_indirect_t *iblock, hbool_t dump_internal, - FILE *stream, int indent, int fwidth); -H5_DLL herr_t H5HF_iblock_debug(H5F_t *f, haddr_t addr, - FILE *stream, int indent, int fwidth, haddr_t hdr_addr, unsigned nrows); +H5_DLL herr_t H5HF__tiny_remove(H5HF_hdr_t *fh, const uint8_t *id); /* Block iteration routines */ -H5_DLL herr_t H5HF_man_iter_init(H5HF_block_iter_t *biter); +H5_DLL herr_t H5HF__man_iter_init(H5HF_block_iter_t *biter); H5_DLL herr_t H5HF__man_iter_start_offset(H5HF_hdr_t *hdr, H5HF_block_iter_t *biter, hsize_t offset); -H5_DLL herr_t H5HF_man_iter_start_entry(H5HF_hdr_t *hdr, H5HF_block_iter_t *biter, +H5_DLL herr_t H5HF__man_iter_start_entry(H5HF_hdr_t *hdr, H5HF_block_iter_t *biter, H5HF_indirect_t *iblock, unsigned start_entry); -H5_DLL herr_t H5HF_man_iter_set_entry(const H5HF_hdr_t *hdr, +H5_DLL herr_t H5HF__man_iter_set_entry(const H5HF_hdr_t *hdr, H5HF_block_iter_t *biter, unsigned entry); -H5_DLL herr_t H5HF_man_iter_next(H5HF_hdr_t *hdr, H5HF_block_iter_t *biter, +H5_DLL herr_t H5HF__man_iter_next(H5HF_hdr_t *hdr, H5HF_block_iter_t *biter, unsigned nentries); -H5_DLL herr_t H5HF_man_iter_up(H5HF_block_iter_t *biter); -H5_DLL herr_t H5HF_man_iter_down(H5HF_block_iter_t *biter, H5HF_indirect_t *iblock); -H5_DLL herr_t H5HF_man_iter_reset(H5HF_block_iter_t *biter); -H5_DLL herr_t H5HF_man_iter_curr(H5HF_block_iter_t *biter, unsigned *row, unsigned *col, +H5_DLL herr_t H5HF__man_iter_up(H5HF_block_iter_t *biter); +H5_DLL herr_t H5HF__man_iter_down(H5HF_block_iter_t *biter, H5HF_indirect_t *iblock); +H5_DLL herr_t H5HF__man_iter_reset(H5HF_block_iter_t *biter); +H5_DLL herr_t H5HF__man_iter_curr(H5HF_block_iter_t *biter, unsigned *row, unsigned *col, unsigned *entry, H5HF_indirect_t **block); -H5_DLL herr_t H5HF_man_iter_offset(H5HF_hdr_t *hdr, H5HF_block_iter_t *biter, - hsize_t *offset); -H5_DLL hbool_t H5HF_man_iter_ready(H5HF_block_iter_t *biter); +H5_DLL hbool_t H5HF__man_iter_ready(H5HF_block_iter_t *biter); /* Free space manipulation routines */ H5_DLL herr_t H5HF__space_start(H5HF_hdr_t *hdr, hbool_t may_create); @@ -789,24 +771,24 @@ H5_DLL herr_t H5HF__space_sect_change_class(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, uint16_t new_class); /* Free space section routines */ -H5_DLL H5HF_free_section_t *H5HF_sect_single_new(hsize_t sect_off, +H5_DLL H5HF_free_section_t *H5HF__sect_single_new(hsize_t sect_off, size_t sect_size, H5HF_indirect_t *parent, unsigned par_entry); H5_DLL herr_t H5HF__sect_single_revive(H5HF_hdr_t *hdr, H5HF_free_section_t *sect); -H5_DLL herr_t H5HF_sect_single_dblock_info(H5HF_hdr_t *hdr, +H5_DLL herr_t H5HF__sect_single_dblock_info(H5HF_hdr_t *hdr, const H5HF_free_section_t *sect, haddr_t *dblock_addr, size_t *dblock_size); H5_DLL herr_t H5HF__sect_single_reduce(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, size_t amt); H5_DLL herr_t H5HF__sect_row_revive(H5HF_hdr_t *hdr, H5HF_free_section_t *sect); H5_DLL herr_t H5HF__sect_row_reduce(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, unsigned *entry_p); -H5_DLL H5HF_indirect_t *H5HF_sect_row_get_iblock(H5HF_free_section_t *sect); +H5_DLL H5HF_indirect_t *H5HF__sect_row_get_iblock(H5HF_free_section_t *sect); H5_DLL herr_t H5HF__sect_indirect_add(H5HF_hdr_t *hdr, H5HF_indirect_t *iblock, unsigned start_entry, unsigned nentries); H5_DLL herr_t H5HF__sect_single_free(H5FS_section_info_t *sect); /* Internal operator callbacks */ -H5_DLL herr_t H5HF_op_read(const void *obj, size_t obj_len, void *op_data); -H5_DLL herr_t H5HF_op_write(const void *obj, size_t obj_len, void *op_data); +H5_DLL herr_t H5HF__op_read(const void *obj, size_t obj_len, void *op_data); +H5_DLL herr_t H5HF__op_write(const void *obj, size_t obj_len, void *op_data); /* Testing routines */ #ifdef H5HF_TESTING diff --git a/src/H5HFprivate.h b/src/H5HFprivate.h index 4eec1c1..4919b90 100644 --- a/src/H5HFprivate.h +++ b/src/H5HFprivate.h @@ -15,7 +15,7 @@ * * Created: H5HFprivate.h * Feb 24 2006 - * Quincey Koziol + * Quincey Koziol * * Purpose: Private header for library accessible fractal heap routines. * @@ -86,8 +86,10 @@ typedef struct H5HF_stat_t { hsize_t tiny_nobjs; /* Number of 'tiny' objects in heap */ } H5HF_stat_t; -/* Fractal heap info (forward decl - defined in H5HFpkg.h) */ +/* Fractal heap info (forward decls - defined in H5HFpkg.h) */ typedef struct H5HF_t H5HF_t; +typedef struct H5HF_hdr_t H5HF_hdr_t; +typedef struct H5HF_indirect_t H5HF_indirect_t; /* Typedef for 'op' operations */ typedef herr_t (*H5HF_operator_t)(const void *obj/*in*/, size_t obj_len, @@ -128,5 +130,17 @@ H5_DLL herr_t H5HF_id_print(H5HF_t *fh, const void *id, FILE *stream, int indent H5_DLL herr_t H5HF_sects_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth); #endif /* H5HF_DEBUGGING */ +/* Debugging routines for dumping file structures */ +H5_DLL void H5HF_hdr_print(const H5HF_hdr_t *hdr, hbool_t dump_internal, + FILE *stream, int indent, int fwidth); +H5_DLL herr_t H5HF_hdr_debug(H5F_t *f, haddr_t addr, + FILE *stream, int indent, int fwidth); +H5_DLL herr_t H5HF_dblock_debug(H5F_t *f, haddr_t addr, + FILE *stream, int indent, int fwidth, haddr_t hdr_addr, size_t nrec); +H5_DLL void H5HF_iblock_print(const H5HF_indirect_t *iblock, hbool_t dump_internal, + FILE *stream, int indent, int fwidth); +H5_DLL herr_t H5HF_iblock_debug(H5F_t *f, haddr_t addr, + FILE *stream, int indent, int fwidth, haddr_t hdr_addr, unsigned nrows); + #endif /* _H5HFprivate_H */ diff --git a/src/H5HFsection.c b/src/H5HFsection.c index a0f984b..b2d1e3c 100644 --- a/src/H5HFsection.c +++ b/src/H5HFsection.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, May 1, 2006 * * Purpose: Free space section routines for fractal heaps @@ -68,12 +68,12 @@ typedef struct { /********************/ /* Shared routines */ -static herr_t H5HF_sect_init_cls(H5FS_section_class_t *cls, +static herr_t H5FS__sect_init_cls(H5FS_section_class_t *cls, H5HF_hdr_t *hdr); -static herr_t H5HF_sect_term_cls(H5FS_section_class_t *cls); -static H5HF_free_section_t *H5HF_sect_node_new(unsigned sect_type, +static herr_t H5FS__sect_term_cls(H5FS_section_class_t *cls); +static H5HF_free_section_t *H5FS__sect_node_new(unsigned sect_type, haddr_t sect_addr, hsize_t sect_size, H5FS_section_state_t state); -static herr_t H5HF_sect_node_free(H5HF_free_section_t *sect, +static herr_t H5HF__sect_node_free(H5HF_free_section_t *sect, H5HF_indirect_t *parent); /* 'single' section routines */ @@ -99,12 +99,12 @@ static herr_t H5HF__sect_single_valid(const H5FS_section_class_t *cls, const H5FS_section_info_t *sect); /* 'row' section routines */ -static H5HF_free_section_t *H5HF_sect_row_create(haddr_t sect_off, +static H5HF_free_section_t *H5HF__sect_row_create(haddr_t sect_off, hsize_t sect_size, hbool_t is_first, unsigned row, unsigned col, unsigned nentries, H5HF_free_section_t *under_sect); static herr_t H5HF__sect_row_first(H5HF_hdr_t *hdr, H5HF_free_section_t *sect); static herr_t H5HF__sect_row_parent_removed(H5HF_free_section_t *sect); -static herr_t H5HF_sect_row_from_single(H5HF_hdr_t *hdr, +static herr_t H5HF__sect_row_from_single(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, H5HF_direct_t *dblock); static herr_t H5HF__sect_row_free_real(H5HF_free_section_t *sect); @@ -131,7 +131,7 @@ static herr_t H5HF__sect_row_debug(const H5FS_section_info_t *sect, FILE *stream, int indent, int fwidth); /* 'indirect' section routines */ -static H5HF_free_section_t *H5HF_sect_indirect_new(H5HF_hdr_t *hdr, +static H5HF_free_section_t *H5HF__sect_indirect_new(H5HF_hdr_t *hdr, haddr_t sect_off, hsize_t sect_size, H5HF_indirect_t *iblock, hsize_t iblock_off, unsigned row, unsigned col, unsigned nentries); @@ -139,9 +139,9 @@ static herr_t H5HF__sect_indirect_init_rows(H5HF_hdr_t *hdr, H5HF_free_section_t hbool_t first_child, H5HF_free_section_t **first_row_sect, unsigned space_flags, unsigned start_row, unsigned start_col, unsigned end_row, unsigned end_col); -static H5HF_free_section_t *H5HF_sect_indirect_for_row(H5HF_hdr_t *hdr, +static H5HF_free_section_t *H5HF__sect_indirect_for_row(H5HF_hdr_t *hdr, H5HF_indirect_t *iblock, H5HF_free_section_t *row_sect); -static herr_t H5HF_sect_indirect_decr(H5HF_free_section_t *sect); +static herr_t H5HF__sect_indirect_decr(H5HF_free_section_t *sect); static herr_t H5HF__sect_indirect_revive_row(H5HF_hdr_t *hdr, H5HF_free_section_t *sect); static herr_t H5HF__sect_indirect_revive(H5HF_hdr_t *hdr, @@ -152,28 +152,28 @@ static herr_t H5HF__sect_indirect_reduce(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, unsigned child_entry); static herr_t H5HF__sect_indirect_first(H5HF_hdr_t *hdr, H5HF_free_section_t *sect); -static hbool_t H5HF_sect_indirect_is_first(H5HF_free_section_t *sect); -static H5HF_indirect_t * H5HF_sect_indirect_get_iblock(H5HF_free_section_t *sect); -static hsize_t H5HF_sect_indirect_iblock_off(const H5HF_free_section_t *sect); -static H5HF_free_section_t * H5HF_sect_indirect_top(H5HF_free_section_t *sect); +static hbool_t H5HF__sect_indirect_is_first(H5HF_free_section_t *sect); +static H5HF_indirect_t * H5HF__sect_indirect_get_iblock(H5HF_free_section_t *sect); +static hsize_t H5HF__sect_indirect_iblock_off(const H5HF_free_section_t *sect); +static H5HF_free_section_t *H5HF__sect_indirect_top(H5HF_free_section_t *sect); static herr_t H5HF__sect_indirect_merge_row(H5HF_hdr_t *hdr, H5HF_free_section_t *sect1, H5HF_free_section_t *sect2); static herr_t H5HF__sect_indirect_build_parent(H5HF_hdr_t *hdr, H5HF_free_section_t *sect); static herr_t H5HF__sect_indirect_shrink(H5HF_hdr_t *hdr, H5HF_free_section_t *sect); -static herr_t H5HF_sect_indirect_serialize(H5HF_hdr_t *hdr, +static herr_t H5HF__sect_indirect_serialize(H5HF_hdr_t *hdr, const H5HF_free_section_t *sect, uint8_t *buf); static H5FS_section_info_t *H5HF__sect_indirect_deserialize(H5HF_hdr_t *hdr, const uint8_t *buf, haddr_t sect_addr, hsize_t sect_size, unsigned *des_flags); -static herr_t H5HF_sect_indirect_free(H5HF_free_section_t *sect); -static herr_t H5HF_sect_indirect_valid(const H5HF_hdr_t *hdr, +static herr_t H5HF__sect_indirect_free(H5HF_free_section_t *sect); +static herr_t H5HF__sect_indirect_valid(const H5HF_hdr_t *hdr, const H5HF_free_section_t *sect); -static herr_t H5HF_sect_indirect_debug(const H5HF_free_section_t *sect, +static herr_t H5HF__sect_indirect_debug(const H5HF_free_section_t *sect, FILE *stream, int indent, int fwidth); /* 'indirect' section callbacks */ -static herr_t H5HF_sect_indirect_init_cls(H5FS_section_class_t *cls, void *udata); -static herr_t H5HF_sect_indirect_term_cls(H5FS_section_class_t *cls); +static herr_t H5HF__sect_indirect_init_cls(H5FS_section_class_t *cls, void *udata); +static herr_t H5HF__sect_indirect_term_cls(H5FS_section_class_t *cls); /*********************/ @@ -273,8 +273,8 @@ H5FS_section_class_t H5HF_FSPACE_SECT_CLS_INDIRECT[1] = {{ NULL, /* Class private info */ /* Class methods */ - H5HF_sect_indirect_init_cls, /* Initialize section class */ - H5HF_sect_indirect_term_cls, /* Terminate section class */ + H5HF__sect_indirect_init_cls, /* Initialize section class */ + H5HF__sect_indirect_term_cls, /* Terminate section class */ /* Object methods */ NULL, /* Add section */ @@ -306,7 +306,7 @@ H5FL_DEFINE(H5HF_free_section_t); /*------------------------------------------------------------------------- - * Function: H5HF_sect_init_cls + * Function: H5FS__sect_init_cls * * Purpose: Initialize the common class structure * @@ -319,12 +319,12 @@ H5FL_DEFINE(H5HF_free_section_t); *------------------------------------------------------------------------- */ static herr_t -H5HF_sect_init_cls(H5FS_section_class_t *cls, H5HF_hdr_t *hdr) +H5FS__sect_init_cls(H5FS_section_class_t *cls, H5HF_hdr_t *hdr) { H5HF_sect_private_t *cls_prvt; /* Pointer to class private info */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(cls); @@ -339,16 +339,16 @@ H5HF_sect_init_cls(H5FS_section_class_t *cls, H5HF_hdr_t *hdr) cls->cls_private = cls_prvt; /* Increment reference count on heap header */ - if(H5HF_hdr_incr(hdr) < 0) + if(H5HF__hdr_incr(hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, FAIL, "can't increment reference count on shared heap header") done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5HF_sect_init_cls() */ +} /* H5FS__sect_init_cls() */ /*------------------------------------------------------------------------- - * Function: H5HF_sect_term_cls + * Function: H5FS__sect_term_cls * * Purpose: Terminate the common class structure * @@ -361,12 +361,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5HF_sect_term_cls(H5FS_section_class_t *cls) +H5FS__sect_term_cls(H5FS_section_class_t *cls) { H5HF_sect_private_t *cls_prvt; /* Pointer to class private info */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(cls); @@ -375,7 +375,7 @@ H5HF_sect_term_cls(H5FS_section_class_t *cls) cls_prvt = (H5HF_sect_private_t *)cls->cls_private; /* Decrement reference count on heap header */ - if(H5HF_hdr_decr(cls_prvt->hdr) < 0) + if(H5HF__hdr_decr(cls_prvt->hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement reference count on shared heap header") /* Free the class private information */ @@ -383,11 +383,11 @@ H5HF_sect_term_cls(H5FS_section_class_t *cls) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5HF_sect_term_cls() */ +} /* H5FS__sect_term_cls() */ /*------------------------------------------------------------------------- - * Function: H5HF_sect_node_new + * Function: H5FS__sect_node_new * * Purpose: Allocate a free space section node of a particular type * @@ -401,13 +401,13 @@ done: *------------------------------------------------------------------------- */ static H5HF_free_section_t * -H5HF_sect_node_new(unsigned sect_type, haddr_t sect_addr, hsize_t sect_size, +H5FS__sect_node_new(unsigned sect_type, haddr_t sect_addr, hsize_t sect_size, H5FS_section_state_t sect_state) { H5HF_free_section_t *new_sect; /* New section */ H5HF_free_section_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(H5F_addr_defined(sect_addr)); @@ -429,11 +429,11 @@ H5HF_sect_node_new(unsigned sect_type, haddr_t sect_addr, hsize_t sect_size, done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5HF_sect_node_new() */ +} /* H5FS__sect_node_new() */ /*------------------------------------------------------------------------- - * Function: H5HF_sect_node_free + * Function: H5HF__sect_node_free * * Purpose: Free a section node * @@ -447,11 +447,11 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5HF_sect_node_free(H5HF_free_section_t *sect, H5HF_indirect_t *iblock) +H5HF__sect_node_free(H5HF_free_section_t *sect, H5HF_indirect_t *iblock) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(sect); @@ -465,30 +465,29 @@ H5HF_sect_node_free(H5HF_free_section_t *sect, H5HF_indirect_t *iblock) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5HF_sect_node_free() */ +} /* H5HF__sect_node_free() */ /*------------------------------------------------------------------------- - * Function: H5HF_sect_single_new + * Function: H5HF__sect_single_new * * Purpose: Create a new 'single' section and return it to the caller * * Return: Pointer to new section on success/NULL on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 30 2006 * *------------------------------------------------------------------------- */ H5HF_free_section_t * -H5HF_sect_single_new(hsize_t sect_off, size_t sect_size, +H5HF__sect_single_new(hsize_t sect_off, size_t sect_size, H5HF_indirect_t *parent, unsigned par_entry) { H5HF_free_section_t *sect = NULL; /* 'Single' free space section to add */ H5HF_free_section_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -496,13 +495,13 @@ H5HF_sect_single_new(hsize_t sect_off, size_t sect_size, HDassert(sect_size); /* Create free space section node */ - if(NULL == (sect = H5HF_sect_node_new(H5HF_FSPACE_SECT_SINGLE, sect_off, (hsize_t)sect_size, H5FS_SECT_LIVE))) + if(NULL == (sect = H5FS__sect_node_new(H5HF_FSPACE_SECT_SINGLE, sect_off, (hsize_t)sect_size, H5FS_SECT_LIVE))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for single section") /* Set the 'single' specific fields */ sect->u.single.parent = parent; if(sect->u.single.parent) { - if(H5HF_iblock_incr(sect->u.single.parent) < 0) + if(H5HF__iblock_incr(sect->u.single.parent) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't increment reference count on shared indirect block") } /* end if */ sect->u.single.par_entry = par_entry; @@ -517,7 +516,7 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_sect_single_new() */ +} /* end H5HF__sect_single_new() */ /*------------------------------------------------------------------------- @@ -528,7 +527,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * October 24 2006 * *------------------------------------------------------------------------- @@ -556,7 +554,7 @@ H5HF__sect_single_locate_parent(H5HF_hdr_t *hdr, hbool_t refresh, HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPUTE, FAIL, "can't compute row & column of section") /* Increment reference count on indirect block that free section is in */ - if(H5HF_iblock_incr(sec_iblock) < 0) + if(H5HF__iblock_incr(sec_iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, FAIL, "can't increment reference count on shared indirect block") /* Check for refreshing existing parent information */ @@ -590,7 +588,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * May 8 2006 * *------------------------------------------------------------------------- @@ -631,23 +628,22 @@ done: /*------------------------------------------------------------------------- - * Function: H5HF_sect_single_dblock_info + * Function: H5HF__sect_single_dblock_info * * Purpose: Retrieve the direct block information for a single section * * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * October 24 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_sect_single_dblock_info(H5HF_hdr_t *hdr, const H5HF_free_section_t *sect, +H5HF__sect_single_dblock_info(H5HF_hdr_t *hdr, const H5HF_free_section_t *sect, haddr_t *dblock_addr, size_t *dblock_size) { - FUNC_ENTER_NOAPI_NOERR + FUNC_ENTER_PACKAGE_NOERR /* * Check arguments. @@ -673,7 +669,7 @@ H5HF_sect_single_dblock_info(H5HF_hdr_t *hdr, const H5HF_free_section_t *sect, } /* end else */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5HF_sect_single_dblock_info() */ +} /* end H5HF__sect_single_dblock_info() */ /*------------------------------------------------------------------------- @@ -686,7 +682,6 @@ H5HF_sect_single_dblock_info(H5HF_hdr_t *hdr, const H5HF_free_section_t *sect, * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 31 2006 * *------------------------------------------------------------------------- @@ -752,7 +747,7 @@ H5HF__sect_single_full_dblock(H5HF_hdr_t *hdr, H5HF_free_section_t *sect) size_t dblock_overhead; /* Direct block's overhead */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(sect); @@ -760,7 +755,7 @@ H5HF__sect_single_full_dblock(H5HF_hdr_t *hdr, H5HF_free_section_t *sect) HDassert(hdr); /* Retrieve direct block address from section */ - if(H5HF_sect_single_dblock_info(hdr, sect, &dblock_addr, &dblock_size) < 0) + if(H5HF__sect_single_dblock_info(hdr, sect, &dblock_addr, &dblock_size) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't retrieve direct block information") /* Check for section occupying entire direct block */ @@ -776,7 +771,7 @@ H5HF__sect_single_full_dblock(H5HF_hdr_t *hdr, H5HF_free_section_t *sect) HDassert(H5F_addr_eq(dblock->block_off + dblock_overhead, sect->sect_info.addr)); /* Convert 'single' section into 'row' section */ - if(H5HF_sect_row_from_single(hdr, sect, dblock) < 0) + if(H5HF__sect_row_from_single(hdr, sect, dblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTCONVERT, FAIL, "can't convert single section into row section") /* Destroy direct block */ @@ -876,7 +871,7 @@ H5HF__sect_single_deserialize(const H5FS_section_class_t H5_ATTR_UNUSED *cls, HDassert(sect_size); /* Create free list section node */ - if(NULL == (new_sect = H5HF_sect_node_new(H5HF_FSPACE_SECT_SINGLE, sect_addr, sect_size, H5FS_SECT_SERIALIZED))) + if(NULL == (new_sect = H5FS__sect_node_new(H5HF_FSPACE_SECT_SINGLE, sect_addr, sect_size, H5FS_SECT_SERIALIZED))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "allocation failed for direct block free list section") /* Set return value */ @@ -1086,7 +1081,7 @@ H5HF__sect_single_shrink(H5FS_section_info_t **_sect, void *_udata) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't revive single free section") /* Retrieve direct block address from section */ - if(H5HF_sect_single_dblock_info(hdr, (*sect), &dblock_addr, &dblock_size) < 0) + if(H5HF__sect_single_dblock_info(hdr, (*sect), &dblock_addr, &dblock_size) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't retrieve direct block information") /* Protect the direct block for the section */ @@ -1140,14 +1135,13 @@ H5HF__sect_single_free(H5FS_section_info_t *_sect) HDassert(sect); /* Check for live reference to an indirect block */ - if(sect->sect_info.state == H5FS_SECT_LIVE) { + if(sect->sect_info.state == H5FS_SECT_LIVE) /* Get parent indirect block, if there was one */ if(sect->u.single.parent) parent = sect->u.single.parent; - } /* end if */ /* Release the section */ - if(H5HF_sect_node_free(sect, parent) < 0) + if(H5HF__sect_node_free(sect, parent) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free section node") done: @@ -1194,7 +1188,7 @@ H5HF__sect_single_valid(const H5FS_section_class_t H5_ATTR_UNUSED *cls, const H5 HDassert(H5F_addr_defined(iblock->ents[sect->u.single.par_entry].addr)); /* Retrieve direct block address from section */ - status = H5HF_sect_single_dblock_info(iblock->hdr, (const H5HF_free_section_t *)sect, &dblock_addr, &dblock_size); + status = H5HF__sect_single_dblock_info(iblock->hdr, (const H5HF_free_section_t *)sect, &dblock_addr, &dblock_size); HDassert(status >= 0); HDassert(H5F_addr_eq(iblock->ents[sect->u.single.par_entry].addr, dblock_addr)); HDassert(dblock_size > 0); @@ -1239,7 +1233,7 @@ H5HF__sect_single_valid(const H5FS_section_class_t H5_ATTR_UNUSED *cls, const H5 /*------------------------------------------------------------------------- - * Function: H5HF_sect_row_create + * Function: H5HF__sect_row_create * * Purpose: Create a new 'row' section * @@ -1253,13 +1247,13 @@ H5HF__sect_single_valid(const H5FS_section_class_t H5_ATTR_UNUSED *cls, const H5 *------------------------------------------------------------------------- */ static H5HF_free_section_t * -H5HF_sect_row_create(haddr_t sect_off, hsize_t sect_size, hbool_t is_first, +H5HF__sect_row_create(haddr_t sect_off, hsize_t sect_size, hbool_t is_first, unsigned row, unsigned col, unsigned nentries, H5HF_free_section_t *under_sect) { H5HF_free_section_t *sect = NULL; /* 'Row' section created */ H5HF_free_section_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(sect_size); @@ -1268,7 +1262,7 @@ H5HF_sect_row_create(haddr_t sect_off, hsize_t sect_size, hbool_t is_first, /* Create 'row' free space section node */ /* ("inherits" underlying indirect section's state) */ - if(NULL == (sect = H5HF_sect_node_new((unsigned)(is_first ? H5HF_FSPACE_SECT_FIRST_ROW : H5HF_FSPACE_SECT_NORMAL_ROW), sect_off, sect_size, under_sect->sect_info.state))) + if(NULL == (sect = H5FS__sect_node_new((unsigned)(is_first ? H5HF_FSPACE_SECT_FIRST_ROW : H5HF_FSPACE_SECT_NORMAL_ROW), sect_off, sect_size, under_sect->sect_info.state))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for row section") /* Set the 'row' specific fields */ @@ -1283,29 +1277,28 @@ H5HF_sect_row_create(haddr_t sect_off, hsize_t sect_size, hbool_t is_first, done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5HF_sect_row_create() */ +} /* H5HF__sect_row_create() */ /*------------------------------------------------------------------------- - * Function: H5HF_sect_row_from_single + * Function: H5HF__sect_row_from_single * * Purpose: Convert a 'single' section into a 'row' section * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 6 2006 * *------------------------------------------------------------------------- */ static herr_t -H5HF_sect_row_from_single(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, +H5HF__sect_row_from_single(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, H5HF_direct_t *dblock) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* * Check arguments. @@ -1323,7 +1316,7 @@ H5HF_sect_row_from_single(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, sect->u.row.checked_out = FALSE; /* Create indirect section that underlies the row section */ - if(NULL == (sect->u.row.under = H5HF_sect_indirect_for_row(hdr, dblock->parent, sect))) + if(NULL == (sect->u.row.under = H5HF__sect_indirect_for_row(hdr, dblock->parent, sect))) HGOTO_ERROR(H5E_HEAP, H5E_CANTCREATE, FAIL, "serializing row section not supported yet") /* Release single section's hold on underlying indirect block */ @@ -1332,7 +1325,7 @@ H5HF_sect_row_from_single(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_sect_row_from_single() */ +} /* end H5HF__sect_row_from_single() */ /*------------------------------------------------------------------------- @@ -1343,7 +1336,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 6 2006 * *------------------------------------------------------------------------- @@ -1391,7 +1383,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 6 2006 * *------------------------------------------------------------------------- @@ -1467,7 +1458,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 10 2006 * *------------------------------------------------------------------------- @@ -1501,24 +1491,23 @@ done: /*------------------------------------------------------------------------- - * Function: H5HF_sect_row_get_iblock + * Function: H5HF__sect_row_get_iblock * * Purpose: Retrieve the indirect block for a row section * * Return: Pointer to indirect block on success/NULL on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 9 2006 * *------------------------------------------------------------------------- */ H5HF_indirect_t * -H5HF_sect_row_get_iblock(H5HF_free_section_t *sect) +H5HF__sect_row_get_iblock(H5HF_free_section_t *sect) { H5HF_indirect_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* * Check arguments. @@ -1528,10 +1517,10 @@ H5HF_sect_row_get_iblock(H5HF_free_section_t *sect) sect->sect_info.type == H5HF_FSPACE_SECT_NORMAL_ROW); HDassert(sect->sect_info.state == H5FS_SECT_LIVE); - ret_value = H5HF_sect_indirect_get_iblock(sect->u.row.under); + ret_value = H5HF__sect_indirect_get_iblock(sect->u.row.under); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_sect_row_get_iblock() */ +} /* end H5HF__sect_row_get_iblock() */ /*------------------------------------------------------------------------- @@ -1543,7 +1532,6 @@ H5HF_sect_row_get_iblock(H5HF_free_section_t *sect) * Return: Non-negative on success / Negative on failure * * Programmer: Quincey Koziol - * koziol@lbl.gov * February 4 2018 * *------------------------------------------------------------------------- @@ -1617,7 +1605,7 @@ H5HF__sect_row_init_cls(H5FS_section_class_t *cls, void *_udata) HDassert(hdr); /* Call common class initialization */ - if(H5HF_sect_init_cls(cls, hdr) < 0) + if(H5FS__sect_init_cls(cls, hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize common section class") /* First row sections actually are proxies for indirection sections on disk */ @@ -1659,7 +1647,7 @@ H5HF__sect_row_term_cls(H5FS_section_class_t *cls) HDassert(cls); /* Call common class termination */ - if(H5HF_sect_term_cls(cls) < 0) + if(H5FS__sect_term_cls(cls) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't terminate common section class") done: @@ -1700,7 +1688,7 @@ H5HF__sect_row_serialize(const H5FS_section_class_t *cls, /* Forward to indirect routine to serialize underlying section */ hdr = ((H5HF_sect_private_t *)(cls->cls_private))->hdr; - if(H5HF_sect_indirect_serialize(hdr, sect->u.row.under, buf) < 0) + if(H5HF__sect_indirect_serialize(hdr, sect->u.row.under, buf) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTSERIALIZE, FAIL, "can't serialize row section's underlying indirect section") done: @@ -1785,22 +1773,20 @@ H5HF__sect_row_can_merge(const H5FS_section_info_t *_sect1, HDassert(H5F_addr_lt(sect1->sect_info.addr, sect2->sect_info.addr)); /* Get the top indirect section underlying each row */ - top_indir_sect1 = H5HF_sect_indirect_top(sect1->u.row.under); + top_indir_sect1 = H5HF__sect_indirect_top(sect1->u.row.under); HDassert(top_indir_sect1); - top_indir_sect2 = H5HF_sect_indirect_top(sect2->u.row.under); + top_indir_sect2 = H5HF__sect_indirect_top(sect2->u.row.under); HDassert(top_indir_sect2); /* Check if second section shares the same underlying indirect block as * the first section, but doesn't already have same underlying indirect * section. */ - if(top_indir_sect1 != top_indir_sect2) { - if(H5HF_sect_indirect_iblock_off(sect1->u.row.under) == H5HF_sect_indirect_iblock_off(sect2->u.row.under)) { + if(top_indir_sect1 != top_indir_sect2) + if(H5HF__sect_indirect_iblock_off(sect1->u.row.under) == H5HF__sect_indirect_iblock_off(sect2->u.row.under)) /* Check if second section adjoins first section */ if(H5F_addr_eq((top_indir_sect1->sect_info.addr + top_indir_sect1->u.indirect.span_size), top_indir_sect2->sect_info.addr)) HGOTO_DONE(TRUE) - } /* end if */ - } /* end if */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -1846,7 +1832,7 @@ H5HF__sect_row_merge(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect2, H5HF_free_section_t *top_indir_sect; /* Top indirect section for row */ /* Get the top indirect section underlying second row section */ - top_indir_sect = H5HF_sect_indirect_top(sect2->u.row.under); + top_indir_sect = H5HF__sect_indirect_top(sect2->u.row.under); /* Shrink away underlying indirect section */ if(H5HF__sect_indirect_shrink(hdr, top_indir_sect) < 0) @@ -1934,7 +1920,7 @@ H5HF__sect_row_shrink(H5FS_section_info_t **_sect, void *_udata) HDassert((*sect)->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW); /* Get the top indirect section underlying each row */ - top_indir_sect = H5HF_sect_indirect_top((*sect)->u.row.under); + top_indir_sect = H5HF__sect_indirect_top((*sect)->u.row.under); /* Shrink away underlying indirect section */ if(H5HF__sect_indirect_shrink(hdr, top_indir_sect) < 0) @@ -1972,7 +1958,7 @@ H5HF__sect_row_free_real(H5HF_free_section_t *sect) HDassert(sect); /* Release the section */ - if(H5HF_sect_node_free(sect, NULL) < 0) + if(H5HF__sect_node_free(sect, NULL) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free section node") done: @@ -2006,7 +1992,7 @@ H5HF__sect_row_free(H5FS_section_info_t *_sect) HDassert(sect->u.row.under); /* Decrement the ref. count on the row section's underlying indirect section */ - if(H5HF_sect_indirect_decr(sect->u.row.under) < 0) + if(H5HF__sect_indirect_decr(sect->u.row.under) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't detach section node") /* Release the section */ @@ -2069,10 +2055,10 @@ H5HF__sect_row_valid(const H5FS_section_class_t *cls, const H5FS_section_info_t HDassert(sect->u.row.row == indir_sect->u.indirect.row); /* Get the top indirect section underlying row */ - top_indir_sect = H5HF_sect_indirect_top(sect->u.row.under); + top_indir_sect = H5HF__sect_indirect_top(sect->u.row.under); /* Check that the row's underlying indirect section is valid */ - H5HF_sect_indirect_valid(hdr, top_indir_sect); + H5HF__sect_indirect_valid(hdr, top_indir_sect); } /* end if */ FUNC_LEAVE_NOAPI(SUCCEED) @@ -2119,7 +2105,7 @@ H5HF__sect_row_debug(const H5FS_section_info_t *_sect, FILE *stream, int indent, HDfprintf(stream, "%*s%-*s\n", indent, "", fwidth, "Underlying indirect section:"); - H5HF_sect_indirect_debug(sect->u.row.under, stream, indent + 3, MAX(0, fwidth - 3)); + H5HF__sect_indirect_debug(sect->u.row.under, stream, indent + 3, MAX(0, fwidth - 3)); } /* end if */ FUNC_LEAVE_NOAPI(SUCCEED) @@ -2127,24 +2113,23 @@ H5HF__sect_row_debug(const H5FS_section_info_t *_sect, FILE *stream, int indent, /*------------------------------------------------------------------------- - * Function: H5HF_sect_indirect_iblock_off + * Function: H5HF__sect_indirect_iblock_off * * Purpose: Get the offset of the indirect block for the section * * Return: Offset of indirect block in "heap space" (can't fail) * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 6 2006 * *------------------------------------------------------------------------- */ static hsize_t -H5HF_sect_indirect_iblock_off(const H5HF_free_section_t *sect) +H5HF__sect_indirect_iblock_off(const H5HF_free_section_t *sect) { hsize_t ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* * Check arguments. @@ -2154,28 +2139,27 @@ H5HF_sect_indirect_iblock_off(const H5HF_free_section_t *sect) ret_value = sect->sect_info.state == H5FS_SECT_LIVE ? sect->u.indirect.u.iblock->block_off : sect->u.indirect.u.iblock_off; FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_sect_indirect_iblock_off() */ +} /* end H5HF__sect_indirect_iblock_off() */ /*------------------------------------------------------------------------- - * Function: H5HF_sect_indirect_top + * Function: H5HF__sect_indirect_top * * Purpose: Get the "top" indirect section * * Return: Pointer to the top indirect section (can't fail) * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 6 2006 * *------------------------------------------------------------------------- */ static H5HF_free_section_t * -H5HF_sect_indirect_top(H5HF_free_section_t *sect) +H5HF__sect_indirect_top(H5HF_free_section_t *sect) { H5HF_free_section_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* * Check arguments. @@ -2183,16 +2167,16 @@ H5HF_sect_indirect_top(H5HF_free_section_t *sect) HDassert(sect); if(sect->u.indirect.parent) - ret_value = H5HF_sect_indirect_top(sect->u.indirect.parent); + ret_value = H5HF__sect_indirect_top(sect->u.indirect.parent); else ret_value = sect; FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_sect_indirect_top() */ +} /* end H5HF__sect_indirect_top() */ /*------------------------------------------------------------------------- - * Function: H5HF_sect_indirect_init_cls + * Function: H5HF__sect_indirect_init_cls * * Purpose: Initialize the "indirect" class structure * @@ -2206,19 +2190,19 @@ H5HF_sect_indirect_top(H5HF_free_section_t *sect) *------------------------------------------------------------------------- */ static herr_t -H5HF_sect_indirect_init_cls(H5FS_section_class_t *cls, void *_udata) +H5HF__sect_indirect_init_cls(H5FS_section_class_t *cls, void *_udata) { H5HF_hdr_t *hdr = (H5HF_hdr_t *)_udata; /* Fractal heap header */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(cls); HDassert(hdr); /* Call to common class initialization */ - if(H5HF_sect_init_cls(cls, hdr) < 0) + if(H5FS__sect_init_cls(cls, hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize common section class") /* Set the size of all serialized objects of this class of sections */ @@ -2226,11 +2210,11 @@ H5HF_sect_indirect_init_cls(H5FS_section_class_t *cls, void *_udata) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5HF_sect_indirect_init_cls() */ +} /* H5HF__sect_indirect_init_cls() */ /*------------------------------------------------------------------------- - * Function: H5HF_sect_indirect_term_cls + * Function: H5HF__sect_indirect_term_cls * * Purpose: Terminate the "indirect" class structure * @@ -2244,26 +2228,26 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5HF_sect_indirect_term_cls(H5FS_section_class_t *cls) +H5HF__sect_indirect_term_cls(H5FS_section_class_t *cls) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(cls); /* Call common class termination */ - if(H5HF_sect_term_cls(cls) < 0) + if(H5FS__sect_term_cls(cls) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't terminate common section class") done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5HF_sect_indirect_term_cls() */ +} /* H5HF__sect_indirect_term_cls() */ /*------------------------------------------------------------------------- - * Function: H5HF_sect_indirect_new + * Function: H5HF__sect_indirect_new * * Purpose: Create a new 'indirect' section for other routines to finish * initializing. @@ -2271,20 +2255,19 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 6 2006 * *------------------------------------------------------------------------- */ static H5HF_free_section_t * -H5HF_sect_indirect_new(H5HF_hdr_t *hdr, haddr_t sect_off, hsize_t sect_size, +H5HF__sect_indirect_new(H5HF_hdr_t *hdr, haddr_t sect_off, hsize_t sect_size, H5HF_indirect_t *iblock, hsize_t iblock_off, unsigned row, unsigned col, unsigned nentries) { H5HF_free_section_t *sect = NULL; /* 'Indirect' free space section to add */ H5HF_free_section_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* * Check arguments. @@ -2293,7 +2276,7 @@ H5HF_sect_indirect_new(H5HF_hdr_t *hdr, haddr_t sect_off, hsize_t sect_size, HDassert(nentries); /* Create free space section node */ - if(NULL == (sect = H5HF_sect_node_new(H5HF_FSPACE_SECT_INDIRECT, sect_off, + if(NULL == (sect = H5FS__sect_node_new(H5HF_FSPACE_SECT_INDIRECT, sect_off, sect_size, (iblock ? H5FS_SECT_LIVE : H5FS_SECT_SERIALIZED)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for indirect section") @@ -2302,7 +2285,7 @@ H5HF_sect_indirect_new(H5HF_hdr_t *hdr, haddr_t sect_off, hsize_t sect_size, sect->u.indirect.u.iblock = iblock; sect->u.indirect.iblock_entries = hdr->man_dtable.cparam.width * sect->u.indirect.u.iblock->max_rows; - if(H5HF_iblock_incr(sect->u.indirect.u.iblock) < 0) + if(H5HF__iblock_incr(sect->u.indirect.u.iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't increment reference count on shared indirect block") } /* end if */ else { @@ -2314,7 +2297,7 @@ H5HF_sect_indirect_new(H5HF_hdr_t *hdr, haddr_t sect_off, hsize_t sect_size, sect->u.indirect.num_entries = nentries; /* Compute span size of indirect section */ - sect->u.indirect.span_size = H5HF_dtable_span_size(&hdr->man_dtable, + sect->u.indirect.span_size = H5HF__dtable_span_size(&hdr->man_dtable, row, col, nentries); HDassert(sect->u.indirect.span_size > 0); @@ -2332,30 +2315,29 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_sect_indirect_new() */ +} /* end H5HF__sect_indirect_new() */ /*------------------------------------------------------------------------- - * Function: H5HF_sect_indirect_for_row + * Function: H5HF__sect_indirect_for_row * * Purpose: Create the underlying indirect section for a new row section * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 6 2006 * *------------------------------------------------------------------------- */ static H5HF_free_section_t * -H5HF_sect_indirect_for_row(H5HF_hdr_t *hdr, H5HF_indirect_t *iblock, +H5HF__sect_indirect_for_row(H5HF_hdr_t *hdr, H5HF_indirect_t *iblock, H5HF_free_section_t *row_sect) { H5HF_free_section_t *sect = NULL; /* 'Indirect' free space section to add */ H5HF_free_section_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* * Check arguments. @@ -2366,7 +2348,7 @@ H5HF_sect_indirect_for_row(H5HF_hdr_t *hdr, H5HF_indirect_t *iblock, HDassert(row_sect->u.row.row < hdr->man_dtable.max_direct_rows); /* Create free space section node */ - if(NULL == (sect = H5HF_sect_indirect_new(hdr, row_sect->sect_info.addr, + if(NULL == (sect = H5HF__sect_indirect_new(hdr, row_sect->sect_info.addr, row_sect->sect_info.size, iblock, iblock->block_off, row_sect->u.row.row, row_sect->u.row.col, row_sect->u.row.num_entries))) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, NULL, "can't create indirect section") @@ -2391,11 +2373,11 @@ H5HF_sect_indirect_for_row(H5HF_hdr_t *hdr, H5HF_indirect_t *iblock, done: if(!ret_value && sect) - if(H5HF_sect_indirect_free(sect) < 0) + if(H5HF__sect_indirect_free(sect) < 0) HDONE_ERROR(H5E_HEAP, H5E_CANTRELEASE, NULL, "can't free indirect section node") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_sect_indirect_for_row() */ +} /* end H5HF__sect_indirect_for_row() */ /*------------------------------------------------------------------------- @@ -2407,7 +2389,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 6 2006 * *------------------------------------------------------------------------- @@ -2521,7 +2502,7 @@ H5HF__sect_indirect_init_rows(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, H5HF_free_section_t *row_sect = NULL; /* 'Row' free space section to add */ /* Create 'row' free space section node */ - if(NULL == (row_sect = H5HF_sect_row_create(curr_off, + if(NULL == (row_sect = H5HF__sect_row_create(curr_off, (hdr->man_dtable.row_block_size[u] - dblock_overhead), first_child, u, row_col, row_entries, sect))) HGOTO_ERROR(H5E_HEAP, H5E_CANTCREATE, FAIL, "creation failed for child row section") @@ -2558,7 +2539,7 @@ H5HF__sect_indirect_init_rows(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, unsigned v; /* Local index variable */ /* Compute info about row's indirect blocks for child section */ - child_nrows = H5HF_dtable_size_to_rows(&hdr->man_dtable, hdr->man_dtable.row_block_size[u]); + child_nrows = H5HF__dtable_size_to_rows(&hdr->man_dtable, hdr->man_dtable.row_block_size[u]); child_nentries = child_nrows * hdr->man_dtable.cparam.width; /* Add an indirect section for each indirect block in the row */ @@ -2570,7 +2551,7 @@ H5HF__sect_indirect_init_rows(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, haddr_t child_iblock_addr; /* Child indirect block's address on disk */ /* Get the address of the child indirect block */ - if(H5HF_man_iblock_entry_addr(sect->u.indirect.u.iblock, curr_entry, &child_iblock_addr) < 0) + if(H5HF__man_iblock_entry_addr(sect->u.indirect.u.iblock, curr_entry, &child_iblock_addr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "unable to retrieve child indirect block's address") /* If the child indirect block's address is defined, protect it */ @@ -2585,7 +2566,7 @@ H5HF__sect_indirect_init_rows(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, child_iblock = NULL; /* Create free space section node */ - if(NULL == (child_sect = H5HF_sect_indirect_new(hdr, curr_off, (hsize_t)0, + if(NULL == (child_sect = H5HF__sect_indirect_new(hdr, curr_off, (hsize_t)0, child_iblock, curr_off, 0, 0, child_nentries))) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't create indirect section") @@ -2658,7 +2639,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 3 2006 * *------------------------------------------------------------------------- @@ -2702,7 +2682,7 @@ H5HF__sect_indirect_add(H5HF_hdr_t *hdr, H5HF_indirect_t *iblock, unsigned start sect_off += hdr->man_dtable.row_block_size[start_row] * start_col; /* Create free space section node */ - if(NULL == (sect = H5HF_sect_indirect_new(hdr, sect_off, (hsize_t)0, iblock, + if(NULL == (sect = H5HF__sect_indirect_new(hdr, sect_off, (hsize_t)0, iblock, iblock->block_off, start_row, start_col, nentries))) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't create indirect section") @@ -2720,7 +2700,7 @@ H5HF__sect_indirect_add(H5HF_hdr_t *hdr, H5HF_indirect_t *iblock, unsigned start done: if(ret_value < 0 && sect) - if(H5HF_sect_indirect_free(sect) < 0) + if(H5HF__sect_indirect_free(sect) < 0) HDONE_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free indirect section node") FUNC_LEAVE_NOAPI(ret_value) @@ -2728,24 +2708,23 @@ done: /*------------------------------------------------------------------------- - * Function: H5HF_sect_indirect_decr + * Function: H5HF__sect_indirect_decr * * Purpose: Decrement ref. count on indirect section * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 6 2006 * *------------------------------------------------------------------------- */ static herr_t -H5HF_sect_indirect_decr(H5HF_free_section_t *sect) +H5HF__sect_indirect_decr(H5HF_free_section_t *sect) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* * Check arguments. @@ -2764,18 +2743,18 @@ H5HF_sect_indirect_decr(H5HF_free_section_t *sect) par_sect = sect->u.indirect.parent; /* Free indirect section */ - if(H5HF_sect_indirect_free(sect) < 0) + if(H5HF__sect_indirect_free(sect) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free indirect section node") /* Decrement ref. count on indirect section's parent */ if(par_sect) - if(H5HF_sect_indirect_decr(par_sect) < 0) + if(H5HF__sect_indirect_decr(par_sect) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't decrement ref. count on parent indirect section") } /* end if */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_sect_indirect_decr() */ +} /* end H5HF__sect_indirect_decr() */ /*------------------------------------------------------------------------- @@ -2786,7 +2765,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 3 2006 * *------------------------------------------------------------------------- @@ -2832,7 +2810,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 10 2006 * *------------------------------------------------------------------------- @@ -2854,7 +2831,7 @@ H5HF__sect_indirect_revive(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, H5HF_indi HDassert(sect_iblock); /* Increment reference count on indirect block that free section is in */ - if(H5HF_iblock_incr(sect_iblock) < 0) + if(H5HF__iblock_incr(sect_iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement reference count on shared indirect block") /* Set the pointer to the section's indirect block */ @@ -2891,7 +2868,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 10 2006 * *------------------------------------------------------------------------- @@ -2954,7 +2930,7 @@ H5HF__sect_indirect_reduce_row(H5HF_hdr_t *hdr, H5HF_free_section_t *row_sect, hbool_t is_first; /* Flag to indicate that this section is the first section in hierarchy */ /* Check if this section is the first section */ - is_first = H5HF_sect_indirect_is_first(sect); + is_first = H5HF__sect_indirect_is_first(sect); /* Remove this indirect section from parent indirect section */ if(H5HF__sect_indirect_reduce(hdr, sect->u.indirect.parent, sect->u.indirect.par_entry) < 0) @@ -3069,7 +3045,7 @@ H5HF__sect_indirect_reduce_row(H5HF_hdr_t *hdr, H5HF_free_section_t *row_sect, } /* end else */ /* Create peer indirect section */ - if(NULL == (peer_sect = H5HF_sect_indirect_new(hdr, sect->sect_info.addr, + if(NULL == (peer_sect = H5HF__sect_indirect_new(hdr, sect->sect_info.addr, sect->sect_info.size, iblock, iblock_off, start_row, start_col, peer_nentries))) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't create indirect section") @@ -3144,7 +3120,7 @@ done: /* Sanity check - we should only be here if an error occurred */ HDassert(ret_value < 0); - if(H5HF_sect_indirect_free(peer_sect) < 0) + if(H5HF__sect_indirect_free(peer_sect) < 0) HDONE_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free indirect section node") } /* end if */ @@ -3162,7 +3138,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 10 2006 * *------------------------------------------------------------------------- @@ -3203,7 +3178,7 @@ H5HF__sect_indirect_reduce(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, hbool_t is_first; /* Flag to indicate that this section is the first section in hierarchy */ /* Check if this section is the first section */ - is_first = H5HF_sect_indirect_is_first(sect); + is_first = H5HF__sect_indirect_is_first(sect); /* Reduce parent indirect section */ if(H5HF__sect_indirect_reduce(hdr, sect->u.indirect.parent, sect->u.indirect.par_entry) < 0) @@ -3298,7 +3273,7 @@ H5HF__sect_indirect_reduce(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, /* Update the number of entries in current section & calculate it's span size */ /* (Will use this to compute the section address for the peer section */ sect->u.indirect.num_entries = new_nentries; - sect->u.indirect.span_size = H5HF_dtable_span_size(&hdr->man_dtable, + sect->u.indirect.span_size = H5HF__dtable_span_size(&hdr->man_dtable, sect->u.indirect.row, sect->u.indirect.col, new_nentries); HDassert(sect->u.indirect.span_size > 0); @@ -3308,7 +3283,7 @@ H5HF__sect_indirect_reduce(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, peer_sect_addr += hdr->man_dtable.row_block_size[child_row]; /* Create peer indirect section */ - if(NULL == (peer_sect = H5HF_sect_indirect_new(hdr, peer_sect_addr, + if(NULL == (peer_sect = H5HF__sect_indirect_new(hdr, peer_sect_addr, sect->sect_info.size, iblock, iblock_off, peer_start_row, peer_start_col, peer_nentries))) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't create indirect section") @@ -3370,7 +3345,7 @@ H5HF__sect_indirect_reduce(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, /* Decrement # of sections which depend on this row */ /* (Must be last as section can be freed) */ - if(H5HF_sect_indirect_decr(sect) < 0) + if(H5HF__sect_indirect_decr(sect) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't decrement section's ref. count ") done: @@ -3380,7 +3355,7 @@ done: /* Sanity check - we should only be here if an error occurred */ HDassert(ret_value < 0); - if(H5HF_sect_indirect_free(peer_sect) < 0) + if(H5HF__sect_indirect_free(peer_sect) < 0) HDONE_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free indirect section node") } /* end if */ @@ -3389,24 +3364,23 @@ done: /*------------------------------------------------------------------------- - * Function: H5HF_sect_indirect_is_first + * Function: H5HF__sect_indirect_is_first * * Purpose: Check if indirect section is first in all parents * * Return: Non-negative (TRUE/FALSE) on success/ * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 17 2006 * *------------------------------------------------------------------------- */ static hbool_t -H5HF_sect_indirect_is_first(H5HF_free_section_t *sect) +H5HF__sect_indirect_is_first(H5HF_free_section_t *sect) { hbool_t ret_value = FALSE; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity check */ HDassert(sect); @@ -3414,13 +3388,13 @@ H5HF_sect_indirect_is_first(H5HF_free_section_t *sect) /* Recurse to parent */ if(sect->u.indirect.parent) { if(sect->sect_info.addr == sect->u.indirect.parent->sect_info.addr) - ret_value = H5HF_sect_indirect_is_first(sect->u.indirect.parent); + ret_value = H5HF__sect_indirect_is_first(sect->u.indirect.parent); } /* end if */ else ret_value = TRUE; FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_sect_indirect_is_first() */ +} /* end H5HF__sect_indirect_is_first() */ /*------------------------------------------------------------------------- @@ -3431,7 +3405,6 @@ H5HF_sect_indirect_is_first(H5HF_free_section_t *sect) * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 10 2006 * *------------------------------------------------------------------------- @@ -3476,22 +3449,21 @@ done: /*------------------------------------------------------------------------- - * Function: H5HF_sect_indirect_get_iblock + * Function: H5HF__sect_indirect_get_iblock * * Purpose: Retrieve the indirect block for a indirect section * * Return: Pointer to indirect block on success/NULL on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 9 2006 * *------------------------------------------------------------------------- */ static H5HF_indirect_t * -H5HF_sect_indirect_get_iblock(H5HF_free_section_t *sect) +H5HF__sect_indirect_get_iblock(H5HF_free_section_t *sect) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* * Check arguments. @@ -3501,7 +3473,7 @@ H5HF_sect_indirect_get_iblock(H5HF_free_section_t *sect) HDassert(sect->sect_info.state == H5FS_SECT_LIVE); FUNC_LEAVE_NOAPI(sect->u.indirect.u.iblock) -} /* end H5HF_sect_indirect_get_iblock() */ +} /* end H5HF__sect_indirect_get_iblock() */ /*------------------------------------------------------------------------- @@ -3545,9 +3517,9 @@ H5HF__sect_indirect_merge_row(H5HF_hdr_t *hdr, H5HF_free_section_t *row_sect1, HDassert(row_sect2->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW); /* Set up indirect section information */ - sect1 = H5HF_sect_indirect_top(row_sect1->u.row.under); + sect1 = H5HF__sect_indirect_top(row_sect1->u.row.under); HDassert(sect1); - sect2 = H5HF_sect_indirect_top(row_sect2->u.row.under); + sect2 = H5HF__sect_indirect_top(row_sect2->u.row.under); HDassert(sect2); /* Sanity check some assumptions about the indirect sections */ @@ -3722,11 +3694,11 @@ H5HF__sect_indirect_merge_row(H5HF_hdr_t *hdr, H5HF_free_section_t *row_sect1, /* Decrement ref. count on second indirect section's parent */ HDassert(sect2->u.indirect.rc == 0); if(sect2->u.indirect.parent) - if(H5HF_sect_indirect_decr(sect2->u.indirect.parent) < 0) + if(H5HF__sect_indirect_decr(sect2->u.indirect.parent) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't decrement ref. count on parent indirect section") /* Free second indirect section */ - if(H5HF_sect_indirect_free(sect2) < 0) + if(H5HF__sect_indirect_free(sect2) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free indirect section node") /* Re-add the second section's first row */ @@ -3806,7 +3778,7 @@ H5HF__sect_indirect_build_parent(H5HF_hdr_t *hdr, H5HF_free_section_t *sect) HDassert(par_row >= hdr->man_dtable.max_direct_rows); /* Create parent indirect section */ - if(NULL == (par_sect = H5HF_sect_indirect_new(hdr, sect->sect_info.addr, + if(NULL == (par_sect = H5HF__sect_indirect_new(hdr, sect->sect_info.addr, sect->sect_info.size, par_iblock, par_block_off, par_row, par_col, 1))) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't create indirect section") @@ -3828,7 +3800,7 @@ H5HF__sect_indirect_build_parent(H5HF_hdr_t *hdr, H5HF_free_section_t *sect) done: if(ret_value < 0) - if(par_sect && H5HF_sect_indirect_free(par_sect) < 0) + if(par_sect && H5HF__sect_indirect_free(par_sect) < 0) HDONE_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free indirect section node") FUNC_LEAVE_NOAPI(ret_value) @@ -3883,7 +3855,7 @@ H5HF__sect_indirect_shrink(H5HF_hdr_t *hdr, H5HF_free_section_t *sect) HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free child section node") /* Free the indirect section itself */ - if(H5HF_sect_indirect_free(sect) < 0) + if(H5HF__sect_indirect_free(sect) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free indirect section node") done: @@ -3892,7 +3864,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5HF_sect_indirect_serialize + * Function: H5HF__sect_indirect_serialize * * Purpose: Serialize a "live" indirect section into a buffer * @@ -3906,12 +3878,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5HF_sect_indirect_serialize(H5HF_hdr_t *hdr, const H5HF_free_section_t *sect, +H5HF__sect_indirect_serialize(H5HF_hdr_t *hdr, const H5HF_free_section_t *sect, uint8_t *buf) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(hdr); @@ -3921,7 +3893,7 @@ H5HF_sect_indirect_serialize(H5HF_hdr_t *hdr, const H5HF_free_section_t *sect, /* Check if this indirect section has a parent & forward if this section is first */ if(sect->u.indirect.parent) { if(sect->sect_info.addr == sect->u.indirect.parent->sect_info.addr) - if(H5HF_sect_indirect_serialize(hdr, sect->u.indirect.parent, buf) < 0) + if(H5HF__sect_indirect_serialize(hdr, sect->u.indirect.parent, buf) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTSERIALIZE, FAIL, "can't serialize indirect section's parent indirect section") } /* end if */ else { @@ -3945,7 +3917,7 @@ H5HF_sect_indirect_serialize(H5HF_hdr_t *hdr, const H5HF_free_section_t *sect, done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5HF_sect_indirect_serialize() */ +} /* H5HF__sect_indirect_serialize() */ /*------------------------------------------------------------------------- @@ -3997,7 +3969,7 @@ H5HF__sect_indirect_deserialize(H5HF_hdr_t *hdr, const uint8_t *buf, UINT16DECODE(buf, nentries); /* Create free space section node */ - if(NULL == (new_sect = H5HF_sect_indirect_new(hdr, sect_addr, sect_size, + if(NULL == (new_sect = H5HF__sect_indirect_new(hdr, sect_addr, sect_size, NULL, iblock_off, start_row, start_col, nentries))) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, NULL, "can't create indirect section") @@ -4027,7 +3999,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5HF_sect_indirect_free + * Function: H5HF__sect_indirect_free * * Purpose: Free a 'indirect' section node * @@ -4041,12 +4013,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5HF_sect_indirect_free(H5HF_free_section_t *sect) +H5HF__sect_indirect_free(H5HF_free_section_t *sect) { H5HF_indirect_t *iblock = NULL; /* Indirect block for section */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(sect); @@ -4057,23 +4029,22 @@ H5HF_sect_indirect_free(H5HF_free_section_t *sect) sect->u.indirect.indir_ents = (H5HF_free_section_t **)H5MM_xfree(sect->u.indirect.indir_ents); /* Check for live reference to an indirect block */ - if(sect->sect_info.state == H5FS_SECT_LIVE) { + if(sect->sect_info.state == H5FS_SECT_LIVE) /* Get indirect block, if there was one */ if(sect->u.indirect.u.iblock) iblock = sect->u.indirect.u.iblock; - } /* end if */ /* Release the sections */ - if(H5HF_sect_node_free(sect, iblock) < 0) + if(H5HF__sect_node_free(sect, iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free section node") done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5HF_sect_indirect_free() */ +} /* H5HF__sect_indirect_free() */ /*------------------------------------------------------------------------- - * Function: H5HF_sect_indirect_valid + * Function: H5HF__sect_indirect_valid * * Purpose: Check the validity of a section * @@ -4086,7 +4057,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5HF_sect_indirect_valid(const H5HF_hdr_t *hdr, const H5HF_free_section_t *sect) +H5HF__sect_indirect_valid(const H5HF_hdr_t *hdr, const H5HF_free_section_t *sect) { unsigned start_row; /* Row for first block covered */ unsigned start_col; /* Column for first block covered */ @@ -4095,7 +4066,7 @@ H5HF_sect_indirect_valid(const H5HF_hdr_t *hdr, const H5HF_free_section_t *sect) unsigned end_entry; /* Entry for last block covered */ unsigned u; /* Local index variable */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity check arguments */ HDassert(hdr); @@ -4167,16 +4138,16 @@ H5HF_sect_indirect_valid(const H5HF_hdr_t *hdr, const H5HF_free_section_t *sect) } /* end if */ /* Recursively check child indirect section */ - H5HF_sect_indirect_valid(hdr, tmp_child_sect); + H5HF__sect_indirect_valid(hdr, tmp_child_sect); } /* end for */ } /* end if */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5HF_sect_indirect_valid() */ +} /* H5HF__sect_indirect_valid() */ /*------------------------------------------------------------------------- - * Function: H5HF_sect_indirect_debug + * Function: H5HF__sect_indirect_debug * * Purpose: Dump debugging information about an indirect free space section * @@ -4190,10 +4161,10 @@ H5HF_sect_indirect_valid(const H5HF_hdr_t *hdr, const H5HF_free_section_t *sect) *------------------------------------------------------------------------- */ static herr_t -H5HF_sect_indirect_debug(const H5HF_free_section_t *sect, +H5HF__sect_indirect_debug(const H5HF_free_section_t *sect, FILE *stream, int indent, int fwidth) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check arguments. */ HDassert(sect); @@ -4210,5 +4181,5 @@ H5HF_sect_indirect_debug(const H5HF_free_section_t *sect, sect->u.indirect.num_entries); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5HF_sect_indirect_debug() */ +} /* H5HF__sect_indirect_debug() */ diff --git a/src/H5HFspace.c b/src/H5HFspace.c index ad5ff0f..b518996 100644 --- a/src/H5HFspace.c +++ b/src/H5HFspace.c @@ -15,7 +15,7 @@ * * Created: H5HFspace.c * May 2 2006 - * Quincey Koziol + * Quincey Koziol * * Purpose: Space allocation routines for fractal heaps. * @@ -89,7 +89,6 @@ * Failure: negative * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 2 2006 * *------------------------------------------------------------------------- @@ -153,7 +152,6 @@ done: * Failure: negative * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 15 2006 * *------------------------------------------------------------------------- @@ -198,7 +196,6 @@ done: * Failure: negative * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 2 2006 * *------------------------------------------------------------------------- @@ -237,7 +234,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5HF_space_revert_root_cb + * Function: H5HF__space_revert_root_cb * * Purpose: Callback routine from iterator, to reset 'parent' pointers in * sections, when the heap is changing from having a root indirect @@ -247,18 +244,17 @@ done: * Failure: negative * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Feb 24 2012 * *------------------------------------------------------------------------- */ static herr_t -H5HF_space_revert_root_cb(H5FS_section_info_t *_sect, void H5_ATTR_UNUSED *_udata) +H5HF__space_revert_root_cb(H5FS_section_info_t *_sect, void H5_ATTR_UNUSED *_udata) { H5HF_free_section_t *sect = (H5HF_free_section_t *)_sect; /* Section to dump info */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* * Check arguments. @@ -279,7 +275,7 @@ H5HF_space_revert_root_cb(H5FS_section_info_t *_sect, void H5_ATTR_UNUSED *_udat done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_space_revert_root_cb() */ +} /* end H5HF__space_revert_root_cb() */ /*------------------------------------------------------------------------- @@ -292,7 +288,6 @@ done: * Failure: negative * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Feb 23 2012 * *------------------------------------------------------------------------- @@ -312,7 +307,7 @@ H5HF__space_revert_root(const H5HF_hdr_t *hdr) /* Only need to scan the sections if the free space has been initialized */ if(hdr->fspace) /* Iterate over all sections, resetting the parent pointers in 'single' sections */ - if(H5FS_sect_iterate(hdr->f, hdr->fspace, H5HF_space_revert_root_cb, NULL) < 0) + if(H5FS_sect_iterate(hdr->f, hdr->fspace, H5HF__space_revert_root_cb, NULL) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_BADITER, FAIL, "can't iterate over sections to reset parent pointers") done: @@ -321,7 +316,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5HF_space_create_root_cb + * Function: H5HF__space_create_root_cb * * Purpose: Callback routine from iterator, to set 'parent' pointers in * sections to newly created root indirect block, when the heap @@ -331,19 +326,18 @@ done: * Failure: negative * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Feb 24 2012 * *------------------------------------------------------------------------- */ static herr_t -H5HF_space_create_root_cb(H5FS_section_info_t *_sect, void *_udata) +H5HF__space_create_root_cb(H5FS_section_info_t *_sect, void *_udata) { H5HF_free_section_t *sect = (H5HF_free_section_t *)_sect; /* Section to dump info */ H5HF_indirect_t *root_iblock = (H5HF_indirect_t *)_udata; /* User data for callback */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* * Check arguments. @@ -357,7 +351,7 @@ H5HF_space_create_root_cb(H5FS_section_info_t *_sect, void *_udata) HDassert(sect->sect_info.type == H5HF_FSPACE_SECT_SINGLE); /* Increment ref. count on new root indirect block */ - if(H5HF_iblock_incr(root_iblock) < 0) + if(H5HF__iblock_incr(root_iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, FAIL, "can't increment reference count on section's indirect block") /* Set parent info ("live" section must _NOT_ have a parent right now) */ @@ -370,7 +364,7 @@ H5HF_space_create_root_cb(H5FS_section_info_t *_sect, void *_udata) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_space_create_root_cb() */ +} /* end H5HF__space_create_root_cb() */ /*------------------------------------------------------------------------- @@ -384,7 +378,6 @@ done: * Failure: negative * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Feb 24 2012 * *------------------------------------------------------------------------- @@ -405,7 +398,7 @@ H5HF__space_create_root(const H5HF_hdr_t *hdr, H5HF_indirect_t *root_iblock) /* Only need to scan the sections if the free space has been initialized */ if(hdr->fspace) /* Iterate over all sections, seting the parent pointers in 'single' sections to the new indirect block */ - if(H5FS_sect_iterate(hdr->f, hdr->fspace, H5HF_space_create_root_cb, root_iblock) < 0) + if(H5FS_sect_iterate(hdr->f, hdr->fspace, H5HF__space_create_root_cb, root_iblock) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_BADITER, FAIL, "can't iterate over sections to set parent pointers") done: @@ -422,7 +415,6 @@ done: * Failure: negative * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * August 14 2007 * *------------------------------------------------------------------------- @@ -467,7 +459,6 @@ done: * Failure: negative * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 24 2006 * *------------------------------------------------------------------------- @@ -505,7 +496,6 @@ done: * Failure: negative * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 2 2006 * *------------------------------------------------------------------------- @@ -529,9 +519,6 @@ H5HF__space_close(H5HF_hdr_t *hdr) /* Retrieve the number of sections for this heap */ if(H5FS_sect_stats(hdr->fspace, NULL, &nsects) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTCOUNT, FAIL, "can't query free space section count") -#ifdef QAK -HDfprintf(stderr, "%s: nsects = %Hu\n", FUNC, nsects); -#endif /* QAK */ /* Close the free space for the heap */ if(H5FS_close(hdr->f, hdr->fspace) < 0) @@ -560,7 +547,6 @@ done: * Failure: negative * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Aug 7 2006 * *------------------------------------------------------------------------- @@ -596,7 +582,6 @@ done: * Failure: negative * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 10 2006 * *------------------------------------------------------------------------- @@ -607,9 +592,6 @@ H5HF__space_sect_change_class(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, uint16 herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE -#ifdef QAK -HDfprintf(stderr, "%s: Called\n", FUNC); -#endif /* QAK */ /* * Check arguments. diff --git a/src/H5HFstat.c b/src/H5HFstat.c index 7d18ba6..456fd60 100644 --- a/src/H5HFstat.c +++ b/src/H5HFstat.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol +/* Programmer: Quincey Koziol * Monday, March 6, 2006 * * Purpose: Fractal heap metadata statistics functions. diff --git a/src/H5HFtest.c b/src/H5HFtest.c index d6eecd7..14b20eb 100644 --- a/src/H5HFtest.c +++ b/src/H5HFtest.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol +/* Programmer: Quincey Koziol * Thursday, February 3, 2006 * * Purpose: Fractal heap testing functions. @@ -189,13 +189,10 @@ H5HF_cmp_cparam_test(const H5HF_create_t *cparam1, const H5HF_create_t *cparam2) /* Don't worry about comparing the filter names right now... */ /* (they are expanded during the encode/decode process, but aren't copied - * during the H5Z_append operation, generating false positive failures) + * during the H5Z_append operation, generating false positive failures -QAK) */ -#ifdef QAK +#if 0 /* Check filter name */ -HDfprintf(stderr, "%s: Check 1.0\n", "H5HF_cmp_cparam_test"); -HDfprintf(stderr, "%s: cparam1->pline.filter[%Zu].name = %s\n", "H5HF_cmp_cparam_test", u, (cparam1->pline.filter[u].name ? cparam1->pline.filter[u].name : "")); -HDfprintf(stderr, "%s: cparam2->pline.filter[%Zu].name = %s\n", "H5HF_cmp_cparam_test", u, (cparam2->pline.filter[u].name ? cparam2->pline.filter[u].name : "")); if(!cparam1->pline.filter[u].name && cparam2->pline.filter[u].name) HGOTO_DONE(-1) else if(cparam1->pline.filter[u].name && !cparam2->pline.filter[u].name) @@ -204,7 +201,7 @@ HDfprintf(stderr, "%s: cparam2->pline.filter[%Zu].name = %s\n", "H5HF_cmp_cparam if((ret_value = HDstrcmp(cparam1->pline.filter[u].name, cparam2->pline.filter[u].name))) HGOTO_DONE(ret_value) } /* end if */ -#endif /* QAK */ +#endif /* Check # of filter parameters */ if(cparam1->pline.filter[u].cd_nelmts < cparam2->pline.filter[u].cd_nelmts) diff --git a/src/H5HFtiny.c b/src/H5HFtiny.c index 113124c..21da6da 100644 --- a/src/H5HFtiny.c +++ b/src/H5HFtiny.c @@ -15,7 +15,7 @@ * * Created: H5HFtiny.c * Aug 14 2006 - * Quincey Koziol + * Quincey Koziol * * Purpose: Routines for "tiny" objects in fractal heap * @@ -63,7 +63,7 @@ /********************/ /* Local Prototypes */ /********************/ -static herr_t H5HF_tiny_op_real(H5HF_hdr_t *hdr, const uint8_t *id, +static herr_t H5HF__tiny_op_real(H5HF_hdr_t *hdr, const uint8_t *id, H5HF_operator_t op, void *op_data); @@ -83,22 +83,21 @@ static herr_t H5HF_tiny_op_real(H5HF_hdr_t *hdr, const uint8_t *id, /*------------------------------------------------------------------------- - * Function: H5HF_tiny_init + * Function: H5HF__tiny_init * * Purpose: Initialize information for tracking 'tiny' objects * * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 14 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_tiny_init(H5HF_hdr_t *hdr) +H5HF__tiny_init(H5HF_hdr_t *hdr) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* * Check arguments. @@ -126,33 +125,29 @@ H5HF_tiny_init(H5HF_hdr_t *hdr) } /* end else */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5HF_tiny_init() */ +} /* end H5HF__tiny_init() */ /*------------------------------------------------------------------------- - * Function: H5HF_tiny_insert + * Function: H5HF__tiny_insert * * Purpose: Pack a 'tiny' object in a heap ID * * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 14 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_tiny_insert(H5HF_hdr_t *hdr, size_t obj_size, const void *obj, void *_id) +H5HF__tiny_insert(H5HF_hdr_t *hdr, size_t obj_size, const void *obj, void *_id) { uint8_t *id = (uint8_t *)_id; /* Pointer to ID buffer */ size_t enc_obj_size; /* Encoded object size */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT -#ifdef QAK -HDfprintf(stderr, "%s: obj_size = %Zu\n", FUNC, obj_size); -#endif /* QAK */ + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -185,33 +180,32 @@ HDfprintf(stderr, "%s: obj_size = %Zu\n", FUNC, obj_size); hdr->tiny_nobjs++; /* Mark heap header as modified */ - if(H5HF_hdr_dirty(hdr) < 0) + if(H5HF__hdr_dirty(hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark heap header as dirty") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_tiny_insert() */ +} /* end H5HF__tiny_insert() */ /*------------------------------------------------------------------------- - * Function: H5HF_tiny_get_obj_len + * Function: H5HF__tiny_get_obj_len * * Purpose: Get the size of a 'tiny' object in a fractal heap * * Return: SUCCEED (Can't fail) * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 14 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_tiny_get_obj_len(H5HF_hdr_t *hdr, const uint8_t *id, size_t *obj_len_p) +H5HF__tiny_get_obj_len(H5HF_hdr_t *hdr, const uint8_t *id, size_t *obj_len_p) { size_t enc_obj_size; /* Encoded object size */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* * Check arguments. @@ -233,30 +227,29 @@ H5HF_tiny_get_obj_len(H5HF_hdr_t *hdr, const uint8_t *id, size_t *obj_len_p) *obj_len_p = enc_obj_size + 1; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5HF_tiny_get_obj_len() */ +} /* end H5HF__tiny_get_obj_len() */ /*------------------------------------------------------------------------- - * Function: H5HF_tiny_op_real + * Function: H5HF__tiny_op_real * * Purpose: Internal routine to perform operation on 'tiny' object * * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 11 2006 * *------------------------------------------------------------------------- */ static herr_t -H5HF_tiny_op_real(H5HF_hdr_t *hdr, const uint8_t *id, H5HF_operator_t op, +H5HF__tiny_op_real(H5HF_hdr_t *hdr, const uint8_t *id, H5HF_operator_t op, void *op_data) { size_t enc_obj_size; /* Encoded object size */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* * Check arguments. @@ -266,8 +259,8 @@ H5HF_tiny_op_real(H5HF_hdr_t *hdr, const uint8_t *id, H5HF_operator_t op, HDassert(op); /* Get the object's encoded length */ - /* H5HF_tiny_obj_len can't fail */ - ret_value = H5HF_tiny_get_obj_len(hdr, id, &enc_obj_size); + /* H5HF__tiny_obj_len can't fail */ + ret_value = H5HF__tiny_get_obj_len(hdr, id, &enc_obj_size); /* Advance past flag byte(s) */ if(!hdr->tiny_len_extended) @@ -285,28 +278,27 @@ H5HF_tiny_op_real(H5HF_hdr_t *hdr, const uint8_t *id, H5HF_operator_t op, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_tiny_op_real() */ +} /* end H5HF__tiny_op_real() */ /*------------------------------------------------------------------------- - * Function: H5HF_tiny_read + * Function: H5HF__tiny_read * * Purpose: Read a 'tiny' object from the heap * * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 8 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_tiny_read(H5HF_hdr_t *hdr, const uint8_t *id, void *obj) +H5HF__tiny_read(H5HF_hdr_t *hdr, const uint8_t *id, void *obj) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -316,34 +308,33 @@ H5HF_tiny_read(H5HF_hdr_t *hdr, const uint8_t *id, void *obj) HDassert(obj); /* Call the internal 'op' routine */ - if(H5HF_tiny_op_real(hdr, id, H5HF_op_read, obj) < 0) + if(H5HF__tiny_op_real(hdr, id, H5HF__op_read, obj) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTOPERATE, FAIL, "unable to operate on heap object") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_tiny_read() */ +} /* end H5HF__tiny_read() */ /*------------------------------------------------------------------------- - * Function: H5HF_tiny_op + * Function: H5HF__tiny_op * * Purpose: Operate directly on a 'tiny' object * * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sept 11 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_tiny_op(H5HF_hdr_t *hdr, const uint8_t *id, H5HF_operator_t op, +H5HF__tiny_op(H5HF_hdr_t *hdr, const uint8_t *id, H5HF_operator_t op, void *op_data) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -353,34 +344,33 @@ H5HF_tiny_op(H5HF_hdr_t *hdr, const uint8_t *id, H5HF_operator_t op, HDassert(op); /* Call the internal 'op' routine routine */ - if(H5HF_tiny_op_real(hdr, id, op, op_data) < 0) + if(H5HF__tiny_op_real(hdr, id, op, op_data) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTOPERATE, FAIL, "unable to operate on heap object") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_tiny_op() */ +} /* end H5HF__tiny_op() */ /*------------------------------------------------------------------------- - * Function: H5HF_tiny_remove + * Function: H5HF__tiny_remove * * Purpose: Remove a 'tiny' object from the heap statistics * * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 14 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_tiny_remove(H5HF_hdr_t *hdr, const uint8_t *id) +H5HF__tiny_remove(H5HF_hdr_t *hdr, const uint8_t *id) { size_t enc_obj_size; /* Encoded object size */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -389,17 +379,17 @@ H5HF_tiny_remove(H5HF_hdr_t *hdr, const uint8_t *id) HDassert(id); /* Get the object's encoded length */ - /* H5HF_tiny_obj_len can't fail */ - ret_value = H5HF_tiny_get_obj_len(hdr, id, &enc_obj_size); + /* H5HF__tiny_obj_len can't fail */ + ret_value = H5HF__tiny_get_obj_len(hdr, id, &enc_obj_size); /* Update statistics about heap */ hdr->tiny_size -= enc_obj_size; hdr->tiny_nobjs--; /* Mark heap header as modified */ - if(H5HF_hdr_dirty(hdr) < 0) + if(H5HF__hdr_dirty(hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark heap header as dirty") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_tiny_remove() */ +} /* end H5HF__tiny_remove() */ diff --git a/src/H5HG.c b/src/H5HG.c index f9d780c..f7a44ce 100644 --- a/src/H5HG.c +++ b/src/H5HG.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, March 27, 1998 * * Purpose: Operations on the global heap. The global heap is the set of @@ -141,7 +141,7 @@ H5HG__create(H5F_t *f, size_t size) size_t n; haddr_t ret_value = HADDR_UNDEF; /* Return value */ - FUNC_ENTER_STATIC_TAG(H5AC__GLOBALHEAP_TAG) + FUNC_ENTER_STATIC /* Check args */ HDassert(f); @@ -228,7 +228,7 @@ done: } /* end if */ } /* end if */ - FUNC_LEAVE_NOAPI_TAG(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5HG__create() */ @@ -763,7 +763,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5HG_remove (H5F_t *f, H5HG_t *hobj) +H5HG_remove(H5F_t *f, H5HG_t *hobj) { H5HG_heap_t *heap = NULL; uint8_t *p = NULL, *obj_start = NULL; diff --git a/src/H5HGcache.c b/src/H5HGcache.c index 7485aad..f85df33 100644 --- a/src/H5HGcache.c +++ b/src/H5HGcache.c @@ -15,7 +15,7 @@ * * Created: H5HGcache.c * Feb 5 2008 - * Quincey Koziol + * Quincey Koziol * * Purpose: Implement global heap metadata cache methods. * diff --git a/src/H5HGdbg.c b/src/H5HGdbg.c index a5e5363..a0697aa 100644 --- a/src/H5HGdbg.c +++ b/src/H5HGdbg.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol +/* Programmer: Quincey Koziol * Wednesday, July 9, 2003 * * Purpose: Global Heap object debugging functions. @@ -77,7 +77,6 @@ * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Mar 27, 1998 * *------------------------------------------------------------------------- diff --git a/src/H5HGmodule.h b/src/H5HGmodule.h index 1c68206..e661328 100644 --- a/src/H5HGmodule.h +++ b/src/H5HGmodule.h @@ -11,7 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, September 12, 2015 * * Purpose: This file contains declarations which define macros for the diff --git a/src/H5HGpkg.h b/src/H5HGpkg.h index 3119de4..735b4fb 100644 --- a/src/H5HGpkg.h +++ b/src/H5HGpkg.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Wednesday, July 9, 2003 * * Purpose: This file contains declarations which are visible diff --git a/src/H5HGprivate.h b/src/H5HGprivate.h index 573ef39..1a22d56 100644 --- a/src/H5HGprivate.h +++ b/src/H5HGprivate.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, March 27, 1998 */ #ifndef _H5HGprivate_H diff --git a/src/H5HGquery.c b/src/H5HGquery.c index 35abc2e..005235c 100644 --- a/src/H5HGquery.c +++ b/src/H5HGquery.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Wednesday, July 20, 2011 * * Purpose: Query routines for global heaps. diff --git a/src/H5HL.c b/src/H5HL.c index f290294..f628e93 100644 --- a/src/H5HL.c +++ b/src/H5HL.c @@ -15,7 +15,7 @@ * * Created: H5HL.c * Jul 16 1997 - * Robb Matzke + * Robb Matzke * * Purpose: Heap functions for the local heaps used by symbol * tables to store names (among other things). diff --git a/src/H5HLcache.c b/src/H5HLcache.c index 734ec5c..006ddc0 100644 --- a/src/H5HLcache.c +++ b/src/H5HLcache.c @@ -15,7 +15,7 @@ * * Created: H5HLcache.c * Feb 5 2008 - * Quincey Koziol + * Quincey Koziol * * Purpose: Implement local heap metadata cache methods. * @@ -486,11 +486,11 @@ done: if(!ret_value) { if(prfx) { if(FAIL == H5HL__prfx_dest(prfx)) - HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, NULL, "unable to destroy local heap prefix"); + HDONE_ERROR(H5E_HEAP, H5E_CANTRELEASE, NULL, "unable to destroy local heap prefix"); } /* end if */ else { if(heap && FAIL == H5HL__dest(heap)) - HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, NULL, "unable to destroy local heap"); + HDONE_ERROR(H5E_HEAP, H5E_CANTRELEASE, NULL, "unable to destroy local heap"); } /* end else */ } /* end if */ @@ -771,7 +771,7 @@ done: /* Release the [possibly partially initialized] local heap on errors */ if(!ret_value && dblk) if(FAIL == H5HL__dblk_dest(dblk)) - HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, NULL, "unable to destroy local heap data block"); + HDONE_ERROR(H5E_HEAP, H5E_CANTRELEASE, NULL, "unable to destroy local heap data block"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5HL__cache_datablock_deserialize() */ diff --git a/src/H5HLdbg.c b/src/H5HLdbg.c index edb0261..c0ec68b 100644 --- a/src/H5HLdbg.c +++ b/src/H5HLdbg.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol +/* Programmer: Quincey Koziol * Wednesday, July 9, 2003 * * Purpose: Local Heap object debugging functions. diff --git a/src/H5HLdblk.c b/src/H5HLdblk.c index c3fcffe..88348a0 100644 --- a/src/H5HLdblk.c +++ b/src/H5HLdblk.c @@ -15,7 +15,7 @@ * * Created: H5HLdblk.c * Summer 2012 - * Dana Robinson + * Dana Robinson * * Purpose: Data block routines for local heaps. * diff --git a/src/H5HLint.c b/src/H5HLint.c index cc3e3ea..17527c1 100644 --- a/src/H5HLint.c +++ b/src/H5HLint.c @@ -15,7 +15,7 @@ * * Created: H5HLint.c * Oct 12 2008 - * Quincey Koziol + * Quincey Koziol * * Purpose: Local heap internal routines. * diff --git a/src/H5HLmodule.h b/src/H5HLmodule.h index b0fd750..712c7c1 100644 --- a/src/H5HLmodule.h +++ b/src/H5HLmodule.h @@ -11,7 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, September 12, 2015 * * Purpose: This file contains declarations which define macros for the diff --git a/src/H5HLpkg.h b/src/H5HLpkg.h index 44a2cfb..9891e10 100644 --- a/src/H5HLpkg.h +++ b/src/H5HLpkg.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Wednesday, July 9, 2003 * * Purpose: This file contains declarations which are visible diff --git a/src/H5HLprfx.c b/src/H5HLprfx.c index 41c254a..8c4ffad 100644 --- a/src/H5HLprfx.c +++ b/src/H5HLprfx.c @@ -15,7 +15,7 @@ * * Created: H5HLprfx.c * Summer 2012 - * Dana Robinson + * Dana Robinson * * Purpose: Prefix routines for local heaps. * diff --git a/src/H5HLprivate.h b/src/H5HLprivate.h index 7a53b25..60505ee 100644 --- a/src/H5HLprivate.h +++ b/src/H5HLprivate.h @@ -15,7 +15,7 @@ * * Created: H5HLprivate.h * Jul 16 1997 - * Robb Matzke + * Robb Matzke * * Purpose: Private declarations for the H5HL (local heap) package. * diff --git a/src/H5HP.c b/src/H5HP.c index 4ef5662..340457b 100644 --- a/src/H5HP.c +++ b/src/H5HP.c @@ -46,10 +46,10 @@ struct H5HP_t { }; /* Static functions */ -static herr_t H5HP_swim_max(H5HP_t *heap, size_t loc); -static herr_t H5HP_swim_min(H5HP_t *heap, size_t loc); -static herr_t H5HP_sink_max(H5HP_t *heap, size_t loc); -static herr_t H5HP_sink_min(H5HP_t *heap, size_t loc); +static herr_t H5HP__swim_max(H5HP_t *heap, size_t loc); +static herr_t H5HP__swim_min(H5HP_t *heap, size_t loc); +static herr_t H5HP__sink_max(H5HP_t *heap, size_t loc); +static herr_t H5HP__sink_min(H5HP_t *heap, size_t loc); /* Declare a free list to manage the H5HP_t struct */ H5FL_DEFINE_STATIC(H5HP_t); @@ -60,11 +60,11 @@ H5FL_SEQ_DEFINE_STATIC(H5HP_ent_t); /*-------------------------------------------------------------------------- NAME - H5HP_swim_max + H5HP__swim_max PURPOSE Restore heap condition by moving an object upward USAGE - herr_t H5HP_swim_max(heap, loc) + herr_t H5HP__swim_max(heap, loc) H5HP_t *heap; IN/OUT: Pointer to heap to modify size_t loc; IN: Location to start from @@ -80,13 +80,13 @@ H5FL_SEQ_DEFINE_STATIC(H5HP_ent_t); REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5HP_swim_max(H5HP_t *heap, size_t loc) +H5HP__swim_max(H5HP_t *heap, size_t loc) { int val; /* Temporary copy value of object to move in heap */ H5HP_info_t *obj; /* Temporary pointer to object to move in heap */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Get copies of the information about the object to move in the heap */ val=heap->heap[loc].val; @@ -113,16 +113,16 @@ H5HP_swim_max(H5HP_t *heap, size_t loc) heap->heap[loc].obj->heap_loc=loc; FUNC_LEAVE_NOAPI(ret_value); -} /* end H5HP_swim_max() */ +} /* end H5HP__swim_max() */ /*-------------------------------------------------------------------------- NAME - H5HP_swim_min + H5HP__swim_min PURPOSE Restore heap condition by moving an object upward USAGE - herr_t H5HP_swim_min(heap, loc) + herr_t H5HP__swim_min(heap, loc) H5HP_t *heap; IN/OUT: Pointer to heap to modify size_t loc; IN: Location to start from @@ -138,13 +138,13 @@ H5HP_swim_max(H5HP_t *heap, size_t loc) REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5HP_swim_min(H5HP_t *heap, size_t loc) +H5HP__swim_min(H5HP_t *heap, size_t loc) { int val; /* Temporary copy value of object to move in heap */ H5HP_info_t *obj; /* Temporary pointer to object to move in heap */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Get copies of the information about the object to move in the heap */ val=heap->heap[loc].val; @@ -171,16 +171,16 @@ H5HP_swim_min(H5HP_t *heap, size_t loc) heap->heap[loc].obj->heap_loc=loc; FUNC_LEAVE_NOAPI(ret_value); -} /* end H5HP_swim_min() */ +} /* end H5HP__swim_min() */ /*-------------------------------------------------------------------------- NAME - H5HP_sink_max + H5HP__sink_max PURPOSE Restore heap condition by moving an object downward USAGE - herr_t H5HP_sink_max(heap, loc) + herr_t H5HP__sink_max(heap, loc) H5HP_t *heap; IN/OUT: Pointer to heap to modify size_t loc; IN: Location to start from @@ -196,13 +196,13 @@ H5HP_swim_min(H5HP_t *heap, size_t loc) REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5HP_sink_max(H5HP_t *heap, size_t loc) +H5HP__sink_max(H5HP_t *heap, size_t loc) { int val; /* Temporary copy value of object to move in heap */ void *obj; /* Temporary pointer to object to move in heap */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Get copies of the information about the object to move in the heap */ val=heap->heap[loc].val; @@ -240,16 +240,16 @@ H5HP_sink_max(H5HP_t *heap, size_t loc) heap->heap[loc].obj->heap_loc = loc; FUNC_LEAVE_NOAPI(ret_value); -} /* end H5HP_sink_max() */ +} /* end H5HP__sink_max() */ /*-------------------------------------------------------------------------- NAME - H5HP_sink_min + H5HP__sink_min PURPOSE Restore heap condition by moving an object downward USAGE - herr_t H5HP_sink_min(heap, loc) + herr_t H5HP__sink_min(heap, loc) H5HP_t *heap; IN/OUT: Pointer to heap to modify size_t loc; IN: Location to start from @@ -265,13 +265,13 @@ H5HP_sink_max(H5HP_t *heap, size_t loc) REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5HP_sink_min(H5HP_t *heap, size_t loc) +H5HP__sink_min(H5HP_t *heap, size_t loc) { int val; /* Temporary copy value of object to move in heap */ void *obj; /* Temporary pointer to object to move in heap */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Get copies of the information about the object to move in the heap */ val=heap->heap[loc].val; @@ -309,7 +309,7 @@ H5HP_sink_min(H5HP_t *heap, size_t loc) heap->heap[loc].obj->heap_loc = loc; FUNC_LEAVE_NOAPI(ret_value); -} /* end H5HP_sink_min() */ +} /* end H5HP__sink_min() */ /*-------------------------------------------------------------------------- @@ -493,11 +493,11 @@ H5HP_insert(H5HP_t *heap, int val, void *obj) /* Restore heap condition */ if(heap->type==H5HP_MAX_HEAP) { - if(H5HP_swim_max(heap,heap->nobjs)<0) + if(H5HP__swim_max(heap,heap->nobjs)<0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINSERT, FAIL, "unable to restore heap condition"); } /* end if */ else { - if(H5HP_swim_min(heap,heap->nobjs)<0) + if(H5HP__swim_min(heap,heap->nobjs)<0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINSERT, FAIL, "unable to restore heap condition"); } /* end else */ @@ -619,11 +619,11 @@ H5HP_remove(H5HP_t *heap, int *val, void **obj) /* Restore heap condition, if there are objects on the heap */ if(heap->nobjs>0) { if(heap->type==H5HP_MAX_HEAP) { - if(H5HP_sink_max(heap, (size_t)1) < 0) + if(H5HP__sink_max(heap, (size_t)1) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDELETE, FAIL, "unable to restore heap condition"); } /* end if */ else { - if(H5HP_sink_min(heap, (size_t)1) < 0) + if(H5HP__sink_min(heap, (size_t)1) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDELETE, FAIL, "unable to restore heap condition"); } /* end else */ } /* end if */ @@ -695,21 +695,21 @@ H5HP_change(H5HP_t *heap, int val, void *_obj) /* Restore heap condition */ if(valtype==H5HP_MAX_HEAP) { - if(H5HP_sink_max(heap,obj_loc)<0) + if(H5HP__sink_max(heap,obj_loc)<0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRESTORE, FAIL, "unable to restore heap condition"); } /* end if */ else { - if(H5HP_swim_min(heap,obj_loc)<0) + if(H5HP__swim_min(heap,obj_loc)<0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRESTORE, FAIL, "unable to restore heap condition"); } /* end else */ } /* end if */ else { if(heap->type==H5HP_MAX_HEAP) { - if(H5HP_swim_max(heap,obj_loc)<0) + if(H5HP__swim_max(heap,obj_loc)<0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRESTORE, FAIL, "unable to restore heap condition"); } /* end if */ else { - if(H5HP_sink_min(heap,obj_loc)<0) + if(H5HP__sink_min(heap,obj_loc)<0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRESTORE, FAIL, "unable to restore heap condition"); } /* end else */ } /* end else */ @@ -778,11 +778,11 @@ H5HP_incr(H5HP_t *heap, unsigned amt, void *_obj) /* Restore heap condition */ if(H5HP_MAX_HEAP == heap->type) { - if(H5HP_swim_max(heap, obj_loc) < 0) + if(H5HP__swim_max(heap, obj_loc) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRESTORE, FAIL, "unable to restore heap condition") } /* end if */ else { - if(H5HP_sink_min(heap, obj_loc) < 0) + if(H5HP__sink_min(heap, obj_loc) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRESTORE, FAIL, "unable to restore heap condition") } /* end else */ @@ -851,11 +851,11 @@ H5HP_decr(H5HP_t *heap, unsigned amt, void *_obj) /* Restore heap condition */ if(heap->type==H5HP_MAX_HEAP) { - if(H5HP_sink_max(heap,obj_loc)<0) + if(H5HP__sink_max(heap,obj_loc)<0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRESTORE, FAIL, "unable to restore heap condition"); } /* end if */ else { - if(H5HP_swim_min(heap,obj_loc)<0) + if(H5HP__swim_min(heap,obj_loc)<0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRESTORE, FAIL, "unable to restore heap condition"); } /* end else */ diff --git a/src/H5I.c b/src/H5I.c index 1752e5e..c1d966c 100644 --- a/src/H5I.c +++ b/src/H5I.c @@ -33,9 +33,9 @@ #include "H5ACprivate.h" /* Metadata cache */ #include "H5CXprivate.h" /* API Contexts */ #include "H5Dprivate.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fprivate.h" /* File access */ -#include "H5FLprivate.h" /* Free Lists */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* File access */ +#include "H5FLprivate.h" /* Free Lists */ #include "H5Gprivate.h" /* Groups */ #include "H5Ipkg.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ @@ -48,25 +48,25 @@ /* Local Macros */ /* Combine a Type number and an atom index into an atom */ -#define H5I_MAKE(g,i) ((((hid_t)(g) & TYPE_MASK) << ID_BITS) | \ - ((hid_t)(i) & ID_MASK)) +#define H5I_MAKE(g,i) ((((hid_t)(g) & TYPE_MASK) << ID_BITS) | \ + ((hid_t)(i) & ID_MASK)) /* Local typedefs */ /* Atom information structure used */ typedef struct H5I_id_info_t { - hid_t id; /* ID for this info */ - unsigned count; /* ref. count for this atom */ + hid_t id; /* ID for this info */ + unsigned count; /* ref. count for this atom */ unsigned app_count; /* ref. count of application visible atoms */ - const void *obj_ptr; /* pointer associated with the atom */ + const void *obj_ptr; /* pointer associated with the atom */ } H5I_id_info_t; /* ID type structure used */ typedef struct { const H5I_class_t *cls; /* Pointer to ID class */ - unsigned init_count; /* # of times this type has been initialized*/ - uint64_t id_count; /* Current number of IDs held */ - uint64_t nextid; /* ID to use for the next atom */ + unsigned init_count; /* # of times this type has been initialized*/ + uint64_t id_count; /* Current number of IDs held */ + uint64_t nextid; /* ID to use for the next atom */ H5I_id_info_t *last_info; /* Info for most recent ID looked up */ H5SL_t *ids; /* Pointer to skip list that stores IDs */ } H5I_id_type_t; @@ -156,14 +156,14 @@ static int H5I__id_dump_cb(void *_item, void *_key, void *_udata); * Return: Success: Positive if any action was taken that might * affect some other interface; zero otherwise. * - * Failure: Negative + * Failure: Negative * *------------------------------------------------------------------------- */ int H5I_term_package(void) { - int n = 0; + int n = 0; FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -293,7 +293,7 @@ done: herr_t H5I_register_type(const H5I_class_t *cls) { - H5I_id_type_t *type_ptr = NULL; /* Ptr to the atomic type*/ + H5I_id_type_t *type_ptr = NULL; /* Ptr to the atomic type*/ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -328,7 +328,7 @@ H5I_register_type(const H5I_class_t *cls) type_ptr->init_count++; done: - if(ret_value < 0) { /* Clean up on error */ + if(ret_value < 0) { /* Clean up on error */ if(type_ptr) { if(type_ptr->ids) H5SL_close(type_ptr->ids); @@ -382,8 +382,8 @@ done: * * Return: SUCCEED/FAIL * - * Programmer: James Laird - * Nathaniel Furrer + * Programmer: James Laird + * Nathaniel Furrer * Friday, April 23, 2004 * *------------------------------------------------------------------------- @@ -432,7 +432,7 @@ done: * * Failure: Negative * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, March 24, 1999 * *------------------------------------------------------------------------- @@ -512,8 +512,8 @@ H5I__unwrap(void *obj_ptr, H5I_type_t type) * * Return: SUCCEED/FAIL * - * Programmer: James Laird - * Nathaniel Furrer + * Programmer: James Laird + * Nathaniel Furrer * Friday, April 23, 2004 * *------------------------------------------------------------------------- @@ -544,7 +544,7 @@ done: * * Return: SUCCEED/FAIL * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, March 24, 1999 * *------------------------------------------------------------------------- @@ -655,8 +655,8 @@ H5I__clear_type_cb(void *_id, void H5_ATTR_UNUSED *key, void *_udata) * * Return: SUCCEED/FAIL * - * Programmer: Nathaniel Furrer - * James Laird + * Programmer: Nathaniel Furrer + * James Laird * *------------------------------------------------------------------------- */ @@ -688,15 +688,15 @@ done: * * Return: SUCCEED/FAIL * - * Programmer: Nathaniel Furrer - * James Laird + * Programmer: Nathaniel Furrer + * James Laird * *------------------------------------------------------------------------- */ static herr_t H5I__destroy_type(H5I_type_t type) { - H5I_id_type_t *type_ptr; /* ptr to the atomic type */ + H5I_id_type_t *type_ptr; /* ptr to the atomic type */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -900,8 +900,8 @@ done: * with the specified ID. * Failure: NULL * - * Programmer: Quincey Koziol - * Saturday, February 27, 2010 + * Programmer: Quincey Koziol + * Saturday, February 27, 2010 * *------------------------------------------------------------------------- */ @@ -909,7 +909,7 @@ void * H5I_subst(hid_t id, const void *new_object) { H5I_id_info_t *id_ptr; /* Pointer to the atom */ - void *ret_value = NULL; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -943,8 +943,8 @@ done: void * H5I_object(hid_t id) { - H5I_id_info_t *id_ptr; /* Pointer to the new atom */ - void *ret_value = NULL; /* Return value */ + H5I_id_info_t *id_ptr; /* Pointer to the new atom */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOERR @@ -1002,8 +1002,8 @@ done: * specified ID. * Failure: NULL * - * Programmer: Quincey Koziol - * Wednesday, July 31, 2002 + * Programmer: Quincey Koziol + * Wednesday, July 31, 2002 * *------------------------------------------------------------------------- */ @@ -1040,8 +1040,8 @@ H5I_object_verify(hid_t id, H5I_type_t id_type) * ID types). * Failure: H5I_BADID * - * Programmer: Robb Matzke - * Friday, February 19, 1999 + * Programmer: Robb Matzke + * Friday, February 19, 1999 * *------------------------------------------------------------------------- */ @@ -1087,7 +1087,7 @@ H5Iget_type(hid_t id) ret_value = H5I_get_type(id); if(ret_value <= H5I_BADID || (int)ret_value >= H5I_next_type || NULL == H5I_object(id)) - HGOTO_DONE(H5I_BADID); + HGOTO_DONE(H5I_BADID); done: FUNC_LEAVE_API(ret_value) @@ -1124,9 +1124,8 @@ H5I_is_file_object(hid_t id) /* Return TRUE if the ID is a file object (dataset, group, map, or committed * datatype), FALSE otherwise. */ - if (H5I_DATASET == id_type || H5I_GROUP == id_type || H5I_MAP == id_type) { + if (H5I_DATASET == id_type || H5I_GROUP == id_type || H5I_MAP == id_type) ret_value = TRUE; - } else if (H5I_DATATYPE == id_type) { H5T_t *dt = NULL; @@ -1136,9 +1135,8 @@ H5I_is_file_object(hid_t id) ret_value = H5T_is_named(dt); } - else { + else ret_value = FALSE; - } done: FUNC_LEAVE_NOAPI(ret_value); @@ -1157,8 +1155,8 @@ done: * calling H5I_object(). * Failure: NULL * - * Programmer: James Laird - * Nathaniel Furrer + * Programmer: James Laird + * Nathaniel Furrer * *------------------------------------------------------------------------- */ @@ -1192,15 +1190,15 @@ done: * calling H5I_object(). * Failure: NULL * - * Programmer: James Laird - * Nat Furrer + * Programmer: James Laird + * Nat Furrer * *------------------------------------------------------------------------- */ static void * H5I__remove_verify(hid_t id, H5I_type_t id_type) { - void * ret_value = NULL; /*return value */ + void * ret_value = NULL; /*return value */ FUNC_ENTER_STATIC_NOERR @@ -1232,8 +1230,8 @@ H5I__remove_verify(hid_t id, H5I_type_t id_type) static void * H5I__remove_common(H5I_id_type_t *type_ptr, hid_t id) { - H5I_id_info_t *curr_id; /* Pointer to the current atom */ - void *ret_value = NULL; /* Return value */ + H5I_id_info_t *curr_id; /* Pointer to the current atom */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC @@ -1269,16 +1267,16 @@ done: * calling H5I_object(). * Failure: NULL * - * Programmer: Unknown + * Programmer: Unknown * *------------------------------------------------------------------------- */ void * H5I_remove(hid_t id) { - H5I_id_type_t *type_ptr; /* Pointer to the atomic type */ - H5I_type_t type; /* Atom's atomic type */ - void * ret_value = NULL; /* Return value */ + H5I_id_type_t *type_ptr; /* Pointer to the atomic type */ + H5I_type_t type; /* Atom's atomic type */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -1380,7 +1378,7 @@ H5I_dec_ref(hid_t id) * file. We have to close the dataset anyway. (SLU - 2010/9/7) */ if(1 == id_ptr->count) { - H5I_id_type_t *type_ptr; /*ptr to the type */ + H5I_id_type_t *type_ptr; /*ptr to the type */ /* Get the ID's type */ type_ptr = H5I_id_type_list_g[H5I_TYPE(id)]; @@ -1701,7 +1699,7 @@ done: * Purpose: Decrements the reference count on an entire type of IDs. * If the type reference count becomes zero then the type is * destroyed along with all atoms in that type regardless of - * their reference counts. Destroying IDs involves calling + * their reference counts. Destroying IDs involves calling * the free-func for each ID's object and then adding the ID * struct to the ID free list. Public interface to * H5I_dec_type_ref. @@ -1743,7 +1741,7 @@ done: * Purpose: Decrements the reference count on an entire type of IDs. * If the type reference count becomes zero then the type is * destroyed along with all atoms in that type regardless of - * their reference counts. Destroying IDs involves calling + * their reference counts. Destroying IDs involves calling * the free-func for each ID's object and then adding the ID * struct to the ID free list. * Returns the number of references to the type on success; a @@ -1913,7 +1911,7 @@ H5I__search_cb(void *obj, hid_t id, void *_udata) /* Set the return value based on the callback's return value */ if(cb_ret_val > 0) { - ret_value = H5_ITER_STOP; /* terminate iteration early */ + ret_value = H5_ITER_STOP; /* terminate iteration early */ udata->ret_obj = obj; /* also set out parameter */ } else if(cb_ret_val < 0) @@ -2004,7 +2002,7 @@ H5I__iterate_pub_cb(void H5_ATTR_UNUSED *obj, hid_t id, void *_udata) /* Set the return value based on the callback's return value */ if(cb_ret_val > 0) - ret_value = H5_ITER_STOP; /* terminate iteration early */ + ret_value = H5_ITER_STOP; /* terminate iteration early */ else if(cb_ret_val < 0) ret_value = H5_ITER_ERROR; /* indicate failure (which terminates iteration) */ else @@ -2100,7 +2098,7 @@ H5I__iterate_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) /* Set the return value based on the callback's return value */ if(cb_ret_val > 0) - ret_value = H5_ITER_STOP; /* terminate iteration early */ + ret_value = H5_ITER_STOP; /* terminate iteration early */ else if(cb_ret_val < 0) ret_value = H5_ITER_ERROR; /* indicate failure (which terminates iteration) */ } /* end if */ @@ -2110,7 +2108,7 @@ H5I__iterate_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) /*------------------------------------------------------------------------- - * Function: H5I_iterate + * Function: H5I_iterate * * Purpose: Apply function FUNC to each member of type TYPE (with * non-zero application reference count if app_ref is TRUE). @@ -2138,7 +2136,7 @@ herr_t H5I_iterate(H5I_type_t type, H5I_search_func_t func, void *udata, hbool_t app_ref) { H5I_id_type_t *type_ptr; /* Pointer to the type */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -2183,9 +2181,9 @@ done: static H5I_id_info_t * H5I__find_id(hid_t id) { - H5I_type_t type; /*ID's type */ - H5I_id_type_t *type_ptr; /*ptr to the type */ - H5I_id_info_t *ret_value = NULL; /* Return value */ + H5I_type_t type; /*ID's type */ + H5I_id_type_t *type_ptr; /*ptr to the type */ + H5I_id_info_t *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC_NOERR @@ -2414,9 +2412,9 @@ H5I__id_dump_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) FUNC_ENTER_STATIC_NOERR - HDfprintf(stderr, " id = %lu\n", (unsigned long)(item->id)); - HDfprintf(stderr, " count = %u\n", item->count); - HDfprintf(stderr, " obj = 0x%08lx\n", (unsigned long)(item->obj_ptr)); + HDfprintf(stderr, " id = %lu\n", (unsigned long)(item->id)); + HDfprintf(stderr, " count = %u\n", item->count); + HDfprintf(stderr, " obj = 0x%08p\n", item->obj_ptr); /* Get the group location, so we get get the name */ switch (type) { @@ -2505,14 +2503,14 @@ H5I_dump_ids_for_type(H5I_type_t type) if(type_ptr) { /* Header */ - HDfprintf(stderr, " init_count = %u\n", type_ptr->init_count); - HDfprintf(stderr, " reserved = %u\n", type_ptr->cls->reserved); - HDfprintf(stderr, " id_count = %llu\n", (unsigned long long)type_ptr->id_count); - HDfprintf(stderr, " nextid = %llu\n", (unsigned long long)type_ptr->nextid); + HDfprintf(stderr, " init_count = %u\n", type_ptr->init_count); + HDfprintf(stderr, " reserved = %u\n", type_ptr->cls->reserved); + HDfprintf(stderr, " id_count = %llu\n", (unsigned long long)type_ptr->id_count); + HDfprintf(stderr, " nextid = %llu\n", (unsigned long long)type_ptr->nextid); /* List */ if(type_ptr->id_count > 0) { - HDfprintf(stderr, " List:\n"); + HDfprintf(stderr, " List:\n"); H5SL_iterate(type_ptr->ids, H5I__id_dump_cb, &type); } } diff --git a/src/H5Imodule.h b/src/H5Imodule.h index 60bda5a..9c56842 100644 --- a/src/H5Imodule.h +++ b/src/H5Imodule.h @@ -11,7 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, September 12, 2015 * * Purpose: This file contains declarations which define macros for the diff --git a/src/H5Ipkg.h b/src/H5Ipkg.h index 2c1d81f..54b7b43 100644 --- a/src/H5Ipkg.h +++ b/src/H5Ipkg.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, May 15, 2003 * * Purpose: This file contains declarations which are visible only within diff --git a/src/H5Itest.c b/src/H5Itest.c index 07c1965..a51f860 100644 --- a/src/H5Itest.c +++ b/src/H5Itest.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol +/* Programmer: Quincey Koziol * Tuesday, July 27, 2010 * * Purpose: ID testing functions. diff --git a/src/H5L.c b/src/H5L.c index 4ef045d..f6b361a 100644 --- a/src/H5L.c +++ b/src/H5L.c @@ -98,7 +98,7 @@ typedef struct { /* Local Prototypes */ /********************/ -static int H5L_find_class_idx(H5L_type_t id); +static int H5L__find_class_idx(H5L_type_t id); static herr_t H5L__link_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*/); @@ -1559,7 +1559,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5L_find_class_idx + * Function: H5L__find_class_idx * * Purpose: Given a link class ID, return the offset in the global array * that holds all the registered link classes. @@ -1574,12 +1574,12 @@ done: *------------------------------------------------------------------------- */ static int -H5L_find_class_idx(H5L_type_t id) +H5L__find_class_idx(H5L_type_t id) { size_t i; /* Local index variable */ int ret_value = FAIL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR for(i = 0; i < H5L_table_used_g; i++) if(H5L_table_g[i].id == id) @@ -1587,7 +1587,7 @@ H5L_find_class_idx(H5L_type_t id) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5L_find_class_idx */ +} /* end H5L__find_class_idx */ /*------------------------------------------------------------------------- @@ -1613,7 +1613,7 @@ H5L_find_class(H5L_type_t id) FUNC_ENTER_NOAPI(NULL) /* Get the index in the global table */ - if((idx = H5L_find_class_idx(id)) < 0) + if((idx = H5L__find_class_idx(id)) < 0) HGOTO_ERROR(H5E_LINK, H5E_NOTREGISTERED, NULL, "unable to find link class") /* Set return value */ @@ -2054,7 +2054,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5L_create_hard + * Function: H5L__create_hard * * Purpose: Creates a hard link from NEW_NAME to CUR_NAME. * @@ -2066,7 +2066,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5L_create_hard(H5G_loc_t *cur_loc, const char *cur_name, +H5L__create_hard(H5G_loc_t *cur_loc, const char *cur_name, const H5G_loc_t *link_loc, const char *link_name, hid_t lcpl_id) { char *norm_cur_name = NULL; /* Pointer to normalized current name */ @@ -2078,7 +2078,7 @@ H5L_create_hard(H5G_loc_t *cur_loc, const char *cur_name, hbool_t loc_valid = FALSE; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Check args */ HDassert(cur_loc); @@ -2123,11 +2123,11 @@ done: H5MM_xfree(norm_cur_name); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5L_create_hard() */ +} /* end H5L__create_hard() */ /*------------------------------------------------------------------------- - * Function: H5L_create_soft + * Function: H5L__create_soft * * Purpose: Creates a soft link from LINK_NAME to TARGET_PATH. * @@ -2139,14 +2139,14 @@ done: *------------------------------------------------------------------------- */ herr_t -H5L_create_soft(const char *target_path, const H5G_loc_t *link_loc, +H5L__create_soft(const char *target_path, const H5G_loc_t *link_loc, const char *link_name, hid_t lcpl_id) { char *norm_target = NULL; /* Pointer to normalized current name */ H5O_link_t lnk; /* Link to insert */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Check args */ HDassert(link_loc); @@ -2171,7 +2171,7 @@ done: H5MM_xfree(norm_target); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5L_create_soft() */ +} /* end H5L__create_soft() */ /*------------------------------------------------------------------------- @@ -2206,7 +2206,7 @@ H5L__create_ud(const H5G_loc_t *link_loc, const char *link_name, lnk.u.ud.udata = NULL; /* Make sure that this link class is registered */ - if(H5L_find_class_idx(type) < 0) + if(H5L__find_class_idx(type) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "link class has not been registered with library") /* Fill in UD link-specific information in the link struct*/ @@ -2327,7 +2327,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5L_get_val + * Function: H5L__get_val * * Purpose: Returns the value of a symbolic link or the udata for a * user-defined link. @@ -2346,12 +2346,12 @@ done: *------------------------------------------------------------------------- */ herr_t -H5L_get_val(const H5G_loc_t *loc, const char *name, void *buf/*out*/, size_t size) +H5L__get_val(const H5G_loc_t *loc, const char *name, void *buf/*out*/, size_t size) { H5L_trav_gv_t udata; /* User data for callback */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(loc); @@ -2367,7 +2367,7 @@ H5L_get_val(const H5G_loc_t *loc, const char *name, void *buf/*out*/, size_t siz done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5L_get_val() */ +} /* H5L__get_val() */ /*------------------------------------------------------------------------- @@ -2422,7 +2422,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5L_get_val_by_idx + * Function: H5L__get_val_by_idx * * Purpose: Internal routine to query a link value according to the * index within a group @@ -2435,13 +2435,13 @@ done: *------------------------------------------------------------------------- */ herr_t -H5L_get_val_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, +H5L__get_val_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, void *buf/*out*/, size_t size) { H5L_trav_gvbi_t udata; /* User data for callback */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Check arguments */ HDassert(loc); @@ -2460,7 +2460,7 @@ H5L_get_val_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5L_get_val_by_idx() */ +} /* end H5L__get_val_by_idx() */ /*------------------------------------------------------------------------- @@ -2513,7 +2513,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5L_delete + * Function: H5L__delete * * Purpose: Delete a link from a group. * @@ -2525,12 +2525,12 @@ done: *------------------------------------------------------------------------- */ herr_t -H5L_delete(const H5G_loc_t *loc, const char *name) +H5L__delete(const H5G_loc_t *loc, const char *name) { char *norm_name = NULL; /* Pointer to normalized name */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(loc); @@ -2550,7 +2550,7 @@ done: H5MM_xfree(norm_name); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5L_delete() */ +} /* end H5L__delete() */ /*------------------------------------------------------------------------- @@ -2593,7 +2593,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5L_delete_by_idx + * Function: H5L__delete_by_idx * * Purpose: Internal routine to delete a link according to its index * within a group. @@ -2606,13 +2606,13 @@ done: *------------------------------------------------------------------------- */ herr_t -H5L_delete_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, +H5L__delete_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n) { H5L_trav_rmbi_t udata; /* User data for callback */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(loc); @@ -2629,7 +2629,7 @@ H5L_delete_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5L_delete_by_idx() */ +} /* end H5L__delete_by_idx() */ /*------------------------------------------------------------------------- @@ -2859,7 +2859,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5L_move + * Function: H5L__move * * Purpose: Atomically move or copy a link. * @@ -2879,7 +2879,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5L_move(const H5G_loc_t *src_loc, const char *src_name, const H5G_loc_t *dst_loc, +H5L__move(const H5G_loc_t *src_loc, const char *src_name, const H5G_loc_t *dst_loc, const char *dst_name, hbool_t copy_flag, hid_t lcpl_id) { unsigned dst_target_flags = H5G_TARGET_NORMAL; @@ -2888,7 +2888,7 @@ H5L_move(const H5G_loc_t *src_loc, const char *src_name, const H5G_loc_t *dst_lo H5L_trav_mv_t udata; /* User data for traversal */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(src_loc); @@ -2935,7 +2935,7 @@ H5L_move(const H5G_loc_t *src_loc, const char *src_name, const H5G_loc_t *dst_lo done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5L_move() */ +} /* end H5L__move() */ /*------------------------------------------------------------------------- @@ -3036,7 +3036,7 @@ done: * * Purpose: Returns whether a link exists in a group * - * Note: Same as H5L_exists, except that missing links are reported + * Note: Same as H5L__exists, except that missing links are reported * as 'FALSE' instead of causing failures * * Return: Non-negative (TRUE/FALSE) on success/Negative on failure @@ -3099,7 +3099,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5L_exists + * Function: H5L__exists * * Purpose: Returns whether a link exists in a group * @@ -3114,12 +3114,12 @@ done: *------------------------------------------------------------------------- */ htri_t -H5L_exists(const H5G_loc_t *loc, const char *name) +H5L__exists(const H5G_loc_t *loc, const char *name) { H5L_trav_le_t udata; /* User data for traversal */ htri_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* A path of "/" will always exist in a file */ if(0 == HDstrcmp(name, "/")) @@ -3135,7 +3135,7 @@ H5L_exists(const H5G_loc_t *loc, const char *name) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5L_exists() */ +} /* H5L__exists() */ /*------------------------------------------------------------------------- @@ -3260,7 +3260,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5L_get_info_by_idx + * Function: H5L__get_info_by_idx * * Purpose: Internal routine to retrieve link info according to an * index's order. @@ -3270,13 +3270,13 @@ done: *------------------------------------------------------------------------- */ herr_t -H5L_get_info_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, +H5L__get_info_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5L_info2_t *linfo /*out*/) { H5L_trav_gibi_t udata; /* User data for callback */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Check arguments */ HDassert(loc); @@ -3295,7 +3295,7 @@ H5L_get_info_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5L_get_info_by_idx() */ +} /* end H5L__get_info_by_idx() */ /*------------------------------------------------------------------------- @@ -3339,7 +3339,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5L_get_name_by_idx + * Function: H5L__get_name_by_idx * * Purpose: Internal routine to retrieve link name according to an * index's order. @@ -3349,14 +3349,14 @@ done: *------------------------------------------------------------------------- */ ssize_t -H5L_get_name_by_idx(const H5G_loc_t *loc, const char *group_name, +H5L__get_name_by_idx(const H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, char *name /*out*/, size_t size) { H5L_trav_gnbi_t udata; /* User data for callback */ ssize_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Check arguments */ HDassert(loc); @@ -3379,7 +3379,7 @@ H5L_get_name_by_idx(const H5G_loc_t *loc, const char *group_name, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5L_get_name_by_idx() */ +} /* end H5L__get_name_by_idx() */ /*------------------------------------------------------------------------- @@ -3391,7 +3391,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 29 2006 * *------------------------------------------------------------------------- diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c index 8a3e3e1..b8c7819 100644 --- a/src/H5Lexternal.c +++ b/src/H5Lexternal.c @@ -291,7 +291,7 @@ H5L__extern_query(const char H5_ATTR_UNUSED * link_name, const void *_udata, siz const uint8_t *udata = (const uint8_t *)_udata; /* Pointer to external link buffer */ ssize_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check external link version & flags */ if(((*udata >> 4) & 0x0F) != H5L_EXT_VERSION) diff --git a/src/H5Lmodule.h b/src/H5Lmodule.h index cba4de4..d80126d 100644 --- a/src/H5Lmodule.h +++ b/src/H5Lmodule.h @@ -11,7 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, September 12, 2015 * * Purpose: This file contains declarations which define macros for the diff --git a/src/H5Lpkg.h b/src/H5Lpkg.h index f0e9cfc..34890a1 100644 --- a/src/H5Lpkg.h +++ b/src/H5Lpkg.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: James Laird + * Programmer: James Laird * Friday, December 1, 2005 * * Purpose: This file contains declarations which are visible @@ -51,9 +51,31 @@ /* Package Private Prototypes */ /******************************/ +H5_DLL herr_t H5L__create_hard(H5G_loc_t *cur_loc, const char *cur_name, + const H5G_loc_t *link_loc, const char *link_name, hid_t lcpl_id); +H5_DLL herr_t H5L__create_soft(const char *target_path, const H5G_loc_t *cur_loc, + const char *cur_name, hid_t lcpl_id); H5_DLL herr_t H5L__create_ud(const H5G_loc_t *link_loc, const char *link_name, const void * ud_data, size_t ud_data_size, H5L_type_t type, hid_t lcpl_id); +H5_DLL htri_t H5L__exists(const H5G_loc_t *loc, const char *name); +H5_DLL herr_t H5L__get_info_by_idx(const H5G_loc_t *loc, const char *name, + H5_index_t idx_type, H5_iter_order_t order, hsize_t n, + H5L_info2_t *linfo /*out*/); +H5_DLL ssize_t H5L__get_name_by_idx(const H5G_loc_t *loc, const char *group_name, + H5_index_t idx_type, H5_iter_order_t order, hsize_t n, + char *name /*out*/, size_t size); +H5_DLL herr_t H5L__get_val(const H5G_loc_t *loc, const char *name, void *buf/*out*/, + size_t size); +H5_DLL herr_t H5L__get_val_by_idx(const H5G_loc_t *loc, const char *name, + H5_index_t idx_type, H5_iter_order_t order, hsize_t n, + void *buf/*out*/, size_t size); +H5_DLL herr_t H5L__move(const H5G_loc_t *src_loc, const char *src_name, + const H5G_loc_t *dst_loc, const char *dst_name, hbool_t copy_flag, + hid_t lcpl_id); +H5_DLL herr_t H5L__delete(const H5G_loc_t *loc, const char *name); +H5_DLL herr_t H5L__delete_by_idx(const H5G_loc_t *loc, const char *name, + H5_index_t idx_type, H5_iter_order_t order, hsize_t n); H5_DLL herr_t H5L__link_copy_file(H5F_t *dst_file, const H5O_link_t *_src_lnk, const H5O_loc_t *src_oloc, H5O_link_t *dst_lnk, H5O_copy_t *cpy_info); diff --git a/src/H5Lprivate.h b/src/H5Lprivate.h index 0487557..df842f3 100644 --- a/src/H5Lprivate.h +++ b/src/H5Lprivate.h @@ -113,31 +113,9 @@ H5_DLL herr_t H5L_link(const H5G_loc_t *new_loc, const char *new_name, H5G_loc_t *obj_loc, hid_t lcpl_id); H5_DLL herr_t H5L_link_object(const H5G_loc_t *new_loc, const char *new_name, H5O_obj_create_t *ocrt_info, hid_t lcpl_id); -H5_DLL herr_t H5L_create_hard(H5G_loc_t *cur_loc, const char *cur_name, - const H5G_loc_t *link_loc, const char *link_name, hid_t lcpl_id); -H5_DLL herr_t H5L_create_soft(const char *target_path, const H5G_loc_t *cur_loc, - const char *cur_name, hid_t lcpl_id); -H5_DLL herr_t H5L_move(const H5G_loc_t *src_loc, const char *src_name, - const H5G_loc_t *dst_loc, const char *dst_name, hbool_t copy_flag, - hid_t lcpl_id); H5_DLL htri_t H5L_exists_tolerant(const H5G_loc_t *loc, const char *name); -H5_DLL htri_t H5L_exists(const H5G_loc_t *loc, const char *name); H5_DLL herr_t H5L_get_info(const H5G_loc_t *loc, const char *name, H5L_info2_t *linkbuf/*out*/); -H5_DLL herr_t H5L_delete(const H5G_loc_t *loc, const char *name); -H5_DLL herr_t H5L_delete_by_idx(const H5G_loc_t *loc, const char *name, - H5_index_t idx_type, H5_iter_order_t order, hsize_t n); -H5_DLL herr_t H5L_get_info_by_idx(const H5G_loc_t *loc, const char *name, - H5_index_t idx_type, H5_iter_order_t order, hsize_t n, - H5L_info2_t *linfo /*out*/); -H5_DLL ssize_t H5L_get_name_by_idx(const H5G_loc_t *loc, const char *group_name, - H5_index_t idx_type, H5_iter_order_t order, hsize_t n, - char *name /*out*/, size_t size); -H5_DLL herr_t H5L_get_val(const H5G_loc_t *loc, const char *name, void *buf/*out*/, - size_t size); -H5_DLL herr_t H5L_get_val_by_idx(const H5G_loc_t *loc, const char *name, - H5_index_t idx_type, H5_iter_order_t order, hsize_t n, - void *buf/*out*/, size_t size); H5_DLL herr_t H5L_register_external(void); H5_DLL herr_t H5L_iterate(H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx_p, diff --git a/src/H5Lpublic.h b/src/H5Lpublic.h index 3bac5ac..861fafc 100644 --- a/src/H5Lpublic.h +++ b/src/H5Lpublic.h @@ -57,7 +57,7 @@ extern "C" { * Values 64 to 255 are for "user-defined" link class types; these types are * defined by HDF5 but their behavior can be overridden by users. * Users who want to create new classes of links should contact the HDF5 - * development team at hdfhelp@ncsa.uiuc.edu . + * development team at help@hdfgroup.org. * These values can never change because they appear in HDF5 files. */ typedef enum { diff --git a/src/H5MF.c b/src/H5MF.c index fac6620..7531306 100644 --- a/src/H5MF.c +++ b/src/H5MF.c @@ -15,7 +15,7 @@ * * Created: H5MF.c * Jul 11 1997 - * Robb Matzke + * Robb Matzke * * Purpose: File memory management functions. * @@ -51,9 +51,11 @@ #define H5MF_FSPACE_EXPAND 120 /* Percent of "normal" size to expand serialized free space size */ #define H5MF_CHECK_FSM(FSM, CF) \ - HDassert(*CF == FALSE); \ - if(!H5F_addr_defined(FSM->addr) || !H5F_addr_defined(FSM->sect_addr)) \ - *CF = TRUE; + do { \ + HDassert(*CF == FALSE); \ + if(!H5F_addr_defined(FSM->addr) || !H5F_addr_defined(FSM->sect_addr)) \ + *CF = TRUE; \ + } while(0) /* For non-paged aggregation: map allocation request type to tracked free-space type */ /* F_SH -- pointer to H5F_shared_t; T -- H5FD_mem_t */ @@ -300,7 +302,6 @@ H5MF__alloc_to_fs_type(H5F_shared_t *f_sh, H5FD_mem_t alloc_type, hsize_t size, * Failure: negative * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jan 8 2008 * *------------------------------------------------------------------------- @@ -380,7 +381,6 @@ done: * Failure: negative * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jan 8 2008 * *------------------------------------------------------------------------- @@ -399,7 +399,7 @@ H5MF__create_fstype(H5F_t *f, H5F_mem_page_t type) H5AC_ring_t fsm_ring; /* Ring of FSM */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC_TAG(H5AC__FREESPACE_TAG) + FUNC_ENTER_STATIC /* * Check arguments. @@ -452,7 +452,7 @@ done: if(orig_ring != H5AC_RING_INV) H5AC_set_ring(orig_ring, NULL); - FUNC_LEAVE_NOAPI_TAG(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5MF__create_fstype() */ @@ -466,7 +466,6 @@ done: * Failure: negative * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jan 8 2008 * *------------------------------------------------------------------------- @@ -476,7 +475,7 @@ H5MF__start_fstype(H5F_t *f, H5F_mem_page_t type) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_TAG(H5AC__FREESPACE_TAG) + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -503,7 +502,7 @@ H5MF__start_fstype(H5F_t *f, H5F_mem_page_t type) } /* end else */ done: - FUNC_LEAVE_NOAPI_TAG(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5MF__start_fstype() */ @@ -528,7 +527,7 @@ H5MF__delete_fstype(H5F_t *f, H5F_mem_page_t type) haddr_t tmp_fs_addr; /* Temporary holder for free space manager address */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC_TAG(H5AC__FREESPACE_TAG) + FUNC_ENTER_STATIC /* check args */ HDassert(f); @@ -575,7 +574,7 @@ done: if(orig_ring != H5AC_RING_INV) H5AC_set_ring(orig_ring, NULL); - FUNC_LEAVE_NOAPI_TAG(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5MF__delete_fstype() */ @@ -597,7 +596,7 @@ H5MF__close_fstype(H5F_t *f, H5F_mem_page_t type) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC_TAG(H5AC__FREESPACE_TAG) + FUNC_ENTER_STATIC /* * Check arguments. @@ -622,7 +621,7 @@ HDfprintf(stderr, "%s: Before closing free space manager\n", FUNC); f->shared->fs_state[type] = H5F_FS_STATE_CLOSED; done: - FUNC_LEAVE_NOAPI_TAG(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5MF__close_fstype() */ @@ -647,7 +646,7 @@ H5MF__add_sect(H5F_t *f, H5FD_mem_t alloc_type, H5FS_t *fspace, H5MF_free_sectio H5F_mem_page_t fs_type; /* Free space type (mapped from allocation type) */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_TAG(H5AC__FREESPACE_TAG) + FUNC_ENTER_PACKAGE HDassert(f); HDassert(fspace); @@ -680,7 +679,7 @@ done: if(orig_ring != H5AC_RING_INV) H5AC_set_ring(orig_ring, NULL); - FUNC_LEAVE_NOAPI_TAG(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5MF__add_sect() */ @@ -706,7 +705,7 @@ H5MF__find_sect(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size, H5FS_t *fspace, H5MF_free_section_t *node; /* Free space section pointer */ htri_t ret_value = FAIL; /* Whether an existing free list node was found */ - FUNC_ENTER_PACKAGE_TAG(H5AC__FREESPACE_TAG) + FUNC_ENTER_PACKAGE HDassert(f); HDassert(fspace); @@ -765,7 +764,7 @@ done: if(orig_ring != H5AC_RING_INV) H5AC_set_ring(orig_ring, NULL); - FUNC_LEAVE_NOAPI_TAG(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5MF__find_sect() */ @@ -781,7 +780,6 @@ done: * Failure: HADDR_UNDEF * * Programmer: Robb Matzke - * matzke@llnl.gov * Jul 11 1997 * *------------------------------------------------------------------------- @@ -905,7 +903,7 @@ H5MF__alloc_pagefs(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size) H5MF_free_section_t *node = NULL; /* Free space section pointer */ haddr_t ret_value = HADDR_UNDEF; /* Return value */ - FUNC_ENTER_STATIC_TAG(H5AC__FREESPACE_TAG) + FUNC_ENTER_STATIC #ifdef H5MF_ALLOC_DEBUG HDfprintf(stderr, "%s: alloc_type = %u, size = %Hu\n", FUNC, (unsigned)alloc_type, size); @@ -1013,7 +1011,7 @@ H5MF__sects_dump(f, stderr); if(H5MF__sect_free((H5FS_section_info_t *)node) < 0) HDONE_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, HADDR_UNDEF, "can't free section node") - FUNC_LEAVE_NOAPI_TAG(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5MF__alloc_pagefs() */ @@ -1086,7 +1084,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Jul 17 1997 * *------------------------------------------------------------------------- @@ -1448,7 +1445,6 @@ H5MF__sects_dump(f, stderr); * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Feb 14 2008 * *------------------------------------------------------------------------- @@ -1557,11 +1553,11 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); if(H5F_PAGED_AGGR(f)) { if((ret_value = H5MF__close_pagefs(f)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTFREE, FAIL, "can't close free-space managers for 'page' file space") - } /* end if */ + } else { if((ret_value = H5MF__close_aggrfs(f)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTFREE, FAIL, "can't close free-space managers for 'aggr' file space") - } /* end else */ + } done: #ifdef H5MF_ALLOC_DEBUG @@ -1590,7 +1586,7 @@ H5MF__close_delete_fstype(H5F_t *f, H5F_mem_page_t type) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC_TAG(H5AC__FREESPACE_TAG) + FUNC_ENTER_STATIC #ifdef H5MF_ALLOC_DEBUG HDfprintf(stderr, "%s: Entering\n", FUNC); #endif /* H5MF_ALLOC_DEBUG */ @@ -1625,7 +1621,7 @@ done: #ifdef H5MF_ALLOC_DEBUG HDfprintf(stderr, "%s: Leaving\n", FUNC); #endif /* H5MF_ALLOC_DEBUG */ - FUNC_LEAVE_NOAPI_TAG(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5MF__close_delete() */ @@ -1759,7 +1755,7 @@ H5MF__close_aggrfs(H5F_t *f) H5FD_mem_t type; /* Memory type for iteration */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC_TAG(H5AC__FREESPACE_TAG) + FUNC_ENTER_STATIC #ifdef H5MF_ALLOC_DEBUG HDfprintf(stderr, "%s: Entering\n", FUNC); #endif /* H5MF_ALLOC_DEBUG */ @@ -1901,7 +1897,7 @@ done: #ifdef H5MF_ALLOC_DEBUG HDfprintf(stderr, "%s: Leaving\n", FUNC); #endif /* H5MF_ALLOC_DEBUG */ - FUNC_LEAVE_NOAPI_TAG(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5MF__close_aggrfs() */ @@ -1926,7 +1922,7 @@ H5MF__close_pagefs(H5F_t *f) H5O_fsinfo_t fsinfo; /* File space info message */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC_TAG(H5AC__FREESPACE_TAG) + FUNC_ENTER_STATIC #ifdef H5MF_ALLOC_DEBUG HDfprintf(stderr, "%s: Entering\n", FUNC); #endif /* H5MF_ALLOC_DEBUG */ @@ -2076,7 +2072,7 @@ done: #ifdef H5MF_ALLOC_DEBUG HDfprintf(stderr, "%s: Leaving\n", FUNC); #endif /* H5MF_ALLOC_DEBUG */ - FUNC_LEAVE_NOAPI_TAG(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5MF__close_pagefs() */ @@ -2105,7 +2101,7 @@ H5MF__close_shrink_eoa(H5F_t *f) H5MF_sect_ud_t udata; /* User data for callback */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC_TAG(H5AC__FREESPACE_TAG) + FUNC_ENTER_STATIC /* check args */ HDassert(f); @@ -2173,7 +2169,7 @@ H5MF__close_shrink_eoa(H5F_t *f) } /* end for */ /* check the two aggregators */ - if((status = H5MF_aggrs_try_shrink_eoa(f)) < 0) + if((status = H5MF__aggrs_try_shrink_eoa(f)) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSHRINK, FAIL, "can't check for shrinking eoa") else if(status > 0) eoa_shrank = TRUE; @@ -2185,7 +2181,7 @@ done: if(orig_ring != H5AC_RING_INV) H5AC_set_ring(orig_ring, NULL); - FUNC_LEAVE_NOAPI_TAG(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5MF__close_shrink_eoa() */ @@ -2503,7 +2499,7 @@ H5MF__get_free_sects(H5F_t *f, H5FS_t *fspace, H5MF_sect_iter_ud_t *sect_udata, hsize_t hnums = 0; /* # of sections */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE + FUNC_ENTER_STATIC /* check args */ HDassert(f); @@ -2649,6 +2645,10 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled) HDassert(f->shared); HDassert(fsm_settled); + /* Initialize structs */ + HDmemset(&fsinfo, 0, sizeof(fsinfo)); + HDmemset(&fs_stat, 0, sizeof(fs_stat)); + /* * Only need to settle things if we are persisting free space and * the private property in f->shared->null_fsm_addr is not enabled. @@ -2991,7 +2991,6 @@ done: FUNC_LEAVE_NOAPI_TAG(ret_value) } /* H5MF_settle_raw_data_fsm() */ - /*------------------------------------------------------------------------- * Function: H5MF_settle_meta_data_fsm() @@ -3051,7 +3050,7 @@ done: * 3) Reduce the EOA to the extent possible, and make note * of the resulting value. This value will be stored * in the fsinfo superblock extension message and be used - * in the subsequent file open. + * in the subsequent file open. * * 4) Re-allocate space for any free space manager(s) that: * @@ -3334,35 +3333,31 @@ static herr_t H5MF__continue_alloc_fsm(H5F_shared_t *f_sh, H5FS_t *sm_hdr_fspace, H5FS_t *sm_sinfo_fspace, H5FS_t *lg_hdr_fspace, H5FS_t *lg_sinfo_fspace, hbool_t *continue_alloc_fsm) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity checks */ HDassert(f_sh); HDassert(continue_alloc_fsm); /* Check sm_hdr_fspace */ - if(sm_hdr_fspace && sm_hdr_fspace->serial_sect_count > 0 && sm_hdr_fspace->sinfo) { + if(sm_hdr_fspace && sm_hdr_fspace->serial_sect_count > 0 && sm_hdr_fspace->sinfo) H5MF_CHECK_FSM(sm_hdr_fspace, continue_alloc_fsm); - } /* end if */ if(!(*continue_alloc_fsm)) if(sm_sinfo_fspace && sm_sinfo_fspace != sm_hdr_fspace && - sm_sinfo_fspace->serial_sect_count > 0 && sm_sinfo_fspace->sinfo) { + sm_sinfo_fspace->serial_sect_count > 0 && sm_sinfo_fspace->sinfo) H5MF_CHECK_FSM(sm_hdr_fspace, continue_alloc_fsm); - } /* end if */ if(H5F_SHARED_PAGED_AGGR(f_sh) && !(*continue_alloc_fsm)) { /* Check lg_hdr_fspace */ - if(lg_hdr_fspace && lg_hdr_fspace->serial_sect_count > 0 && lg_hdr_fspace->sinfo) { + if(lg_hdr_fspace && lg_hdr_fspace->serial_sect_count > 0 && lg_hdr_fspace->sinfo) H5MF_CHECK_FSM(lg_hdr_fspace, continue_alloc_fsm); - } /* end if */ /* Check lg_sinfo_fspace */ if(!(*continue_alloc_fsm)) if(lg_sinfo_fspace && lg_sinfo_fspace != lg_hdr_fspace && - lg_sinfo_fspace->serial_sect_count > 0 && lg_sinfo_fspace->sinfo) { + lg_sinfo_fspace->serial_sect_count > 0 && lg_sinfo_fspace->sinfo) H5MF_CHECK_FSM(lg_sinfo_fspace, continue_alloc_fsm); - } /* end if */ } /* end if */ FUNC_LEAVE_NOAPI(SUCCEED) diff --git a/src/H5MFaggr.c b/src/H5MFaggr.c index 0124555..ce7db6b 100644 --- a/src/H5MFaggr.c +++ b/src/H5MFaggr.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, January 8, 2008 * * Purpose: Routines for aggregating free space allocations @@ -874,7 +874,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5MF_aggrs_try_shrink_eoa + * Function: H5MF__aggrs_try_shrink_eoa * * Purpose: Check the metadata & small block aggregators to see if * EOA shrink is possible; if so, shrink each aggregator @@ -887,13 +887,13 @@ done: *------------------------------------------------------------------------- */ htri_t -H5MF_aggrs_try_shrink_eoa(H5F_t *f) +H5MF__aggrs_try_shrink_eoa(H5F_t *f) { htri_t ma_status; /* Whether the metadata aggregator can shrink the EOA */ htri_t sda_status; /* Whether the small data aggregator can shrink the EOA */ htri_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Check args */ HDassert(f); @@ -915,5 +915,5 @@ H5MF_aggrs_try_shrink_eoa(H5F_t *f) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5MF_aggrs_try_shrink_eoa() */ +} /* end H5MF__aggrs_try_shrink_eoa() */ diff --git a/src/H5MFdbg.c b/src/H5MFdbg.c index 43e2305..abdecce 100644 --- a/src/H5MFdbg.c +++ b/src/H5MFdbg.c @@ -15,7 +15,7 @@ * * Created: H5MFdbg.c * Jan 31 2008 - * Quincey Koziol + * Quincey Koziol * * Purpose: File memory management debugging functions. * @@ -92,7 +92,6 @@ static herr_t H5MF__sects_debug_cb(H5FS_section_info_t *_sect, void *_udata); * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * January 31 2008 * *------------------------------------------------------------------------- @@ -148,7 +147,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * January 31 2008 * *------------------------------------------------------------------------- @@ -209,7 +207,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jan 31 2008 * *------------------------------------------------------------------------- diff --git a/src/H5MFmodule.h b/src/H5MFmodule.h index 53daabf..6b3aba5 100644 --- a/src/H5MFmodule.h +++ b/src/H5MFmodule.h @@ -11,7 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, September 12, 2015 * * Purpose: This file contains declarations which define macros for the diff --git a/src/H5MFpkg.h b/src/H5MFpkg.h index fc398db..7d72658 100644 --- a/src/H5MFpkg.h +++ b/src/H5MFpkg.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, January 8, 2008 * * Purpose: This file contains declarations which are visible only within @@ -191,6 +191,7 @@ H5_DLL herr_t H5MF__sect_free(H5FS_section_info_t *sect); /* Block aggregator routines */ H5_DLL htri_t H5MF__aggr_try_extend(H5F_t *f, H5F_blk_aggr_t *aggr, H5FD_mem_t type, haddr_t abs_blk_end, hsize_t extra_requested); +H5_DLL htri_t H5MF__aggrs_try_shrink_eoa(H5F_t *f); H5_DLL htri_t H5MF__aggr_can_absorb(const H5F_t *f, const H5F_blk_aggr_t *aggr, const H5MF_free_section_t *sect, H5MF_shrink_type_t *shrink); H5_DLL herr_t H5MF__aggr_absorb(const H5F_t *f, H5F_blk_aggr_t *aggr, diff --git a/src/H5MFprivate.h b/src/H5MFprivate.h index acd773b..2e9ea99 100644 --- a/src/H5MFprivate.h +++ b/src/H5MFprivate.h @@ -15,7 +15,7 @@ * * Created: H5MFprivate.h * Jul 11 1997 - * Robb Matzke + * Robb Matzke * * Purpose: Private header file for file memory management. * @@ -69,7 +69,6 @@ H5_DLL haddr_t H5MF_alloc_tmp(H5F_t *f, hsize_t size); /* 'block aggregator' routines */ H5_DLL herr_t H5MF_free_aggrs(H5F_t *f); -H5_DLL htri_t H5MF_aggrs_try_shrink_eoa(H5F_t *f); /* Free space manager settling routines */ H5_DLL herr_t H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled); diff --git a/src/H5MFsection.c b/src/H5MFsection.c index 715ece4..f69df41 100644 --- a/src/H5MFsection.c +++ b/src/H5MFsection.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, January 8, 2008 * * Purpose: Free space section callbacks for file. @@ -112,7 +112,7 @@ H5FS_section_class_t H5MF_FSPACE_SECT_CLS_SIMPLE[1] = {{ NULL, /* Add section */ NULL, /* Serialize section */ H5MF__sect_deserialize, /* Deserialize section */ - H5MF__sect_simple_can_merge, /* Can sections merge? */ + H5MF__sect_simple_can_merge, /* Can sections merge? */ H5MF__sect_simple_merge, /* Merge sections */ H5MF__sect_simple_can_shrink, /* Can section shrink container?*/ H5MF__sect_simple_shrink, /* Shrink container w/section */ @@ -136,16 +136,16 @@ H5FS_section_class_t H5MF_FSPACE_SECT_CLS_SMALL[1] = {{ /* Object methods */ H5MF__sect_small_add, /* Add section */ - NULL, /* Serialize section */ - H5MF__sect_deserialize, /* Deserialize section */ + NULL, /* Serialize section */ + H5MF__sect_deserialize, /* Deserialize section */ H5MF__sect_small_can_merge, /* Can sections merge? */ H5MF__sect_small_merge, /* Merge sections */ - NULL, /* Can section shrink container?*/ - NULL, /* Shrink container w/section */ + NULL, /* Can section shrink container?*/ + NULL, /* Shrink container w/section */ H5MF__sect_free, /* Free section */ H5MF__sect_valid, /* Check validity of section */ H5MF__sect_split, /* Split section node for alignment */ - NULL, /* Dump debugging for section */ + NULL, /* Dump debugging for section */ }}; /* Class info for "large" free space sections */ @@ -166,7 +166,7 @@ H5FS_section_class_t H5MF_FSPACE_SECT_CLS_LARGE[1] = {{ H5MF__sect_deserialize, /* Deserialize section */ H5MF__sect_large_can_merge, /* Can sections merge? */ H5MF__sect_large_merge, /* Merge sections */ - H5MF__sect_large_can_shrink, /* Can section shrink container?*/ + H5MF__sect_large_can_shrink, /* Can section shrink container?*/ H5MF__sect_large_shrink, /* Shrink container w/section */ H5MF__sect_free, /* Free section */ H5MF__sect_valid, /* Check validity of section */ @@ -199,7 +199,6 @@ H5FL_DEFINE(H5MF_free_section_t); * Return: Pointer to new section on success/NULL on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * January 8 2008 * *------------------------------------------------------------------------- diff --git a/src/H5MM.c b/src/H5MM.c index cceac4f..efe955a 100644 --- a/src/H5MM.c +++ b/src/H5MM.c @@ -15,7 +15,7 @@ * * Created: H5MM.c * Jul 10 1997 - * Robb Matzke + * Robb Matzke * * Purpose: Memory management functions * diff --git a/src/H5MMprivate.h b/src/H5MMprivate.h index 0787eb2..b6c1002 100644 --- a/src/H5MMprivate.h +++ b/src/H5MMprivate.h @@ -15,7 +15,7 @@ * * Created: H5MMprivate.h * Jul 10 1997 - * Robb Matzke + * Robb Matzke * * Purpose: Private header for memory management. * diff --git a/src/H5MMpublic.h b/src/H5MMpublic.h index 4e54c33..faa3032 100644 --- a/src/H5MMpublic.h +++ b/src/H5MMpublic.h @@ -13,15 +13,13 @@ /*------------------------------------------------------------------------- * - * Created: H5MMproto.h + * Created: H5MMpublic.h * Jul 10 1997 - * Robb Matzke + * Robb Matzke * * Purpose: Public declarations for the H5MM (memory management) * package. * - * Modifications: - * *------------------------------------------------------------------------- */ #ifndef _H5MMpublic_H diff --git a/src/H5MP.c b/src/H5MP.c index 7947e7d..e773655 100644 --- a/src/H5MP.c +++ b/src/H5MP.c @@ -15,7 +15,7 @@ * * Created: H5MP.c * May 2 2005 - * Quincey Koziol + * Quincey Koziol * * Purpose: Implements memory pools. (Similar to Apache's APR * memory pools) @@ -82,7 +82,6 @@ H5FL_DEFINE(H5MP_pool_t); * Return: Pointer to the memory pool "header" on success/NULL on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 2 2005 * *------------------------------------------------------------------------- @@ -125,26 +124,25 @@ done: /*------------------------------------------------------------------------- - * Function: H5MP_new_page + * Function: H5MP__new_page * * Purpose: Allocate new page for a memory pool * * Return: Pointer to the page allocated on success/NULL on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 4 2005 * *------------------------------------------------------------------------- */ static H5MP_page_t * -H5MP_new_page(H5MP_pool_t *mp, size_t page_size) +H5MP__new_page(H5MP_pool_t *mp, size_t page_size) { H5MP_page_t *new_page; /* New page created */ H5MP_page_blk_t *first_blk; /* Pointer to first block in page */ H5MP_page_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity check */ HDassert(mp); @@ -163,9 +161,6 @@ H5MP_new_page(H5MP_pool_t *mp, size_t page_size) new_page->free_size = mp->max_size; new_page->fac_alloc = TRUE; } /* end else */ -#ifdef QAK -HDfprintf(stderr,"%s: Allocating new page = %p\n", FUNC, new_page); -#endif /* QAK */ /* Initialize page information */ first_blk = H5MP_PAGE_FIRST_BLOCK(new_page); @@ -191,7 +186,7 @@ HDfprintf(stderr,"%s: Allocating new page = %p\n", FUNC, new_page); done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5MP_new_page() */ +} /* end H5MP__new_page() */ /*------------------------------------------------------------------------- @@ -202,7 +197,6 @@ done: * Return: Pointer to the space allocated on success/NULL on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 2 2005 * *------------------------------------------------------------------------- @@ -223,10 +217,6 @@ H5MP_malloc (H5MP_pool_t *mp, size_t request) /* Compute actual size needed */ needed = H5MP_BLOCK_ALIGN(request) + H5MP_BLOCK_ALIGN(sizeof(H5MP_page_blk_t)); -#ifdef QAK -HDfprintf(stderr,"%s: sizeof(H5MP_page_blk_t) = %Zu\n", FUNC, sizeof(H5MP_page_blk_t)); -HDfprintf(stderr,"%s: request = %Zu, needed = %Zu\n", FUNC, request, needed); -#endif /* QAK */ /* See if the request can be handled by existing free space */ if(needed <= mp->free_size) { @@ -275,7 +265,7 @@ HDfprintf(stderr,"%s: request = %Zu, needed = %Zu\n", FUNC, request, needed); (needed + H5MP_BLOCK_ALIGN(sizeof(H5MP_page_t))) : mp->page_size; /* Allocate new page */ - if(NULL == (alloc_page = H5MP_new_page(mp, page_size))) + if(NULL == (alloc_page = H5MP__new_page(mp, page_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for page") /* Set the block to allocate from */ @@ -323,9 +313,6 @@ found: /* Set new space pointer for the return value */ ret_value = ((unsigned char *)alloc_free) + H5MP_BLOCK_ALIGN(sizeof(H5MP_page_blk_t)); -#ifdef QAK -HDfprintf(stderr,"%s: Allocating space from page, ret_value = %p\n", FUNC, ret_value); -#endif /* QAK */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -340,7 +327,6 @@ done: * Return: NULL on success/NULL on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 3 2005 * * Note: Should we release pages that have no used blocks? @@ -369,9 +355,6 @@ H5MP_free(H5MP_pool_t *mp, void *spc) /* Add it's space to the amount of free space in the page & pool */ spc_page = spc_blk->page; -#ifdef QAK -HDfprintf(stderr,"%s: Freeing from page = %p\n", "H5MP_free", spc_page); -#endif /* QAK */ spc_page->free_size += spc_blk->size; mp->free_size += spc_blk->size; @@ -429,7 +412,6 @@ HDfprintf(stderr,"%s: Freeing from page = %p\n", "H5MP_free", spc_page); * Return: Non-negative on success/negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 3 2005 * *------------------------------------------------------------------------- diff --git a/src/H5MPmodule.h b/src/H5MPmodule.h index 27f7706..19b137f 100644 --- a/src/H5MPmodule.h +++ b/src/H5MPmodule.h @@ -11,7 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, September 12, 2015 * * Purpose: This file contains declarations which define macros for the diff --git a/src/H5MPpkg.h b/src/H5MPpkg.h index 29a25fa..ee2eb34 100644 --- a/src/H5MPpkg.h +++ b/src/H5MPpkg.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, May 2, 2005 * * Purpose: This file contains declarations which are visible only within diff --git a/src/H5MPprivate.h b/src/H5MPprivate.h index 009cb50..be97e5d 100644 --- a/src/H5MPprivate.h +++ b/src/H5MPprivate.h @@ -15,7 +15,7 @@ * * Created: H5MPprivate.h * May 2 2005 - * Quincey Koziol + * Quincey Koziol * * Purpose: Private header for memory pool routines. * diff --git a/src/H5MPtest.c b/src/H5MPtest.c index 0cba847..fa5b165 100644 --- a/src/H5MPtest.c +++ b/src/H5MPtest.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol +/* Programmer: Quincey Koziol * Tuesday, May 3, 2005 * * Purpose: Memory pool testing functions. @@ -42,8 +42,6 @@ * Programmer: Quincey Koziol * Tuesday, May 3, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -74,8 +72,6 @@ H5MP_get_pool_free_size(const H5MP_pool_t *mp, size_t *free_size) * Programmer: Quincey Koziol * Tuesday, May 3, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -109,8 +105,6 @@ H5MP_get_pool_first_page(const H5MP_pool_t *mp, H5MP_page_t **page) * Programmer: Quincey Koziol * Wednesday, May 3, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ htri_t @@ -144,9 +138,6 @@ H5MP_pool_is_free_size_correct(const H5MP_pool_t *mp) /* Check that the free space from the blocks on the free list * corresponds to space in page */ -#ifdef QAK -HDfprintf(stderr,"%s: page_free = %Zu, page->free_size = %Zu\n", "H5MP_pool_is_free_size_correct", page_free, page->free_size); -#endif /* QAK */ if(page_free != page->free_size) HGOTO_DONE (FALSE) @@ -159,9 +150,6 @@ HDfprintf(stderr,"%s: page_free = %Zu, page->free_size = %Zu\n", "H5MP_pool_is_f /* Check that the free space from the pages * corresponds to free space in pool */ -#ifdef QAK -HDfprintf(stderr,"%s: pool_free = %Zu, mp->free_size = %Zu\n", "H5MP_pool_is_free_size_correct", pool_free, mp->free_size); -#endif /* QAK */ if(pool_free != mp->free_size) HGOTO_DONE (FALSE) @@ -182,8 +170,6 @@ done: * Programmer: Quincey Koziol * Tuesday, May 3, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -214,8 +200,6 @@ H5MP_get_page_free_size(const H5MP_page_t *page, size_t *free_size) * Programmer: Quincey Koziol * Tuesday, May 3, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t diff --git a/src/H5Oainfo.c b/src/H5Oainfo.c index 2d95ee9..fb08048 100644 --- a/src/H5Oainfo.c +++ b/src/H5Oainfo.c @@ -15,7 +15,7 @@ * * Created: H5Oainfo.c * Mar 6 2007 - * Quincey Koziol + * Quincey Koziol * * Purpose: Attribute Information messages. * @@ -36,12 +36,12 @@ /* PRIVATE PROTOTYPES */ static void *H5O__ainfo_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p); -static herr_t H5O_ainfo_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); -static void *H5O_ainfo_copy(const void *_mesg, void *_dest); -static size_t H5O_ainfo_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); +static herr_t H5O__ainfo_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); +static void *H5O__ainfo_copy(const void *_mesg, void *_dest); +static size_t H5O__ainfo_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); static herr_t H5O__ainfo_free(void *_mesg); static herr_t H5O__ainfo_delete(H5F_t *f, H5O_t *open_oh, void *_mesg); -static herr_t H5O_ainfo_pre_copy_file(H5F_t *file_src, const void *mesg_src, +static herr_t H5O__ainfo_pre_copy_file(H5F_t *file_src, const void *mesg_src, hbool_t *deleted, const H5O_copy_t *cpy_info, void *udata); static void *H5O__ainfo_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst, hbool_t *recompute_size, unsigned *mesg_flags, @@ -59,16 +59,16 @@ const H5O_msg_class_t H5O_MSG_AINFO[1] = {{ sizeof(H5O_ainfo_t), /*native message size */ 0, /* messages are sharable? */ H5O__ainfo_decode, /*decode message */ - H5O_ainfo_encode, /*encode message */ - H5O_ainfo_copy, /*copy the native value */ - H5O_ainfo_size, /*size of symbol table entry */ + H5O__ainfo_encode, /*encode message */ + H5O__ainfo_copy, /*copy the native value */ + H5O__ainfo_size, /*size of symbol table entry */ NULL, /*default reset method */ H5O__ainfo_free, /* free method */ H5O__ainfo_delete, /* file delete method */ NULL, /* link method */ NULL, /*set share method */ NULL, /*can share method */ - H5O_ainfo_pre_copy_file, /* pre copy native value to file */ + H5O__ainfo_pre_copy_file, /* pre copy native value to file */ H5O__ainfo_copy_file, /* copy native value to file */ H5O__ainfo_post_copy_file, /* post copy native value to file */ NULL, /* get creation index */ @@ -97,7 +97,6 @@ H5FL_DEFINE_STATIC(H5O_ainfo_t); * Failure: NULL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Mar 6 2007 * *------------------------------------------------------------------------- @@ -165,25 +164,24 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_ainfo_encode + * Function: H5O__ainfo_encode * * Purpose: Encodes a message. * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Mar 6 2007 * *------------------------------------------------------------------------- */ static herr_t -H5O_ainfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) +H5O__ainfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) { const H5O_ainfo_t *ainfo = (const H5O_ainfo_t *)_mesg; unsigned char flags; /* Flags for encoding attribute info */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* check args */ HDassert(f); @@ -215,11 +213,11 @@ H5O_ainfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, co HDassert(!H5F_addr_defined(ainfo->corder_bt2_addr)); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5O_ainfo_encode() */ +} /* end H5O__ainfo_encode() */ /*------------------------------------------------------------------------- - * Function: H5O_ainfo_copy + * Function: H5O__ainfo_copy * * Purpose: Copies a message from _MESG to _DEST, allocating _DEST if * necessary. @@ -228,19 +226,18 @@ H5O_ainfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, co * Failure: NULL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Mar 6 2007 * *------------------------------------------------------------------------- */ static void * -H5O_ainfo_copy(const void *_mesg, void *_dest) +H5O__ainfo_copy(const void *_mesg, void *_dest) { const H5O_ainfo_t *ainfo = (const H5O_ainfo_t *)_mesg; H5O_ainfo_t *dest = (H5O_ainfo_t *) _dest; void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(ainfo); @@ -255,11 +252,11 @@ H5O_ainfo_copy(const void *_mesg, void *_dest) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_ainfo_copy() */ +} /* end H5O__ainfo_copy() */ /*------------------------------------------------------------------------- - * Function: H5O_ainfo_size + * Function: H5O__ainfo_size * * Purpose: Returns the size of the raw message in bytes not counting * the message type or size fields, but only the data fields. @@ -269,18 +266,17 @@ done: * Failure: zero * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Mar 6 2007 * *------------------------------------------------------------------------- */ static size_t -H5O_ainfo_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void *_mesg) +H5O__ainfo_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void *_mesg) { const H5O_ainfo_t *ainfo = (const H5O_ainfo_t *)_mesg; size_t ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Set return value */ ret_value = (size_t)(1 /* Version */ @@ -291,7 +287,7 @@ H5O_ainfo_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void + (ainfo->index_corder ? H5F_SIZEOF_ADDR(f) : 0)); /* Address of v2 B-tree for indexing creation order values of attributes */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_ainfo_size() */ +} /* end H5O__ainfo_size() */ /*------------------------------------------------------------------------- @@ -358,7 +354,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_ainfo_pre_copy_file + * Function: H5O__ainfo_pre_copy_file * * Purpose: Perform any necessary actions before copying message between * files. @@ -372,10 +368,10 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_ainfo_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void H5_ATTR_UNUSED *native_src, +H5O__ainfo_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void H5_ATTR_UNUSED *native_src, hbool_t *deleted, const H5O_copy_t *cpy_info, void H5_ATTR_UNUSED *udata) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* check args */ HDassert(deleted); @@ -388,7 +384,7 @@ H5O_ainfo_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void H5_ATTR_UNUSE *deleted = TRUE; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5O_ainfo_pre_copy_file() */ +} /* end H5O__ainfo_pre_copy_file() */ /*------------------------------------------------------------------------- @@ -499,7 +495,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Mar 6 2007 * *------------------------------------------------------------------------- diff --git a/src/H5Oalloc.c b/src/H5Oalloc.c index 8850ef6..3c19cf4 100644 --- a/src/H5Oalloc.c +++ b/src/H5Oalloc.c @@ -15,7 +15,7 @@ * * Created: H5Oalloc.c * Nov 17 2006 - * Quincey Koziol + * Quincey Koziol * * Purpose: Object header allocation routines. * @@ -105,7 +105,6 @@ H5FL_EXTERN(H5O_cont_t); * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Oct 17 2006 * *------------------------------------------------------------------------- @@ -231,7 +230,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Oct 17 2006 * *------------------------------------------------------------------------- @@ -332,7 +330,6 @@ H5O__eliminate_gap(H5O_t *oh, hbool_t *chk_dirtied, H5O_mesg_t *mesg, * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Oct 22 2006 * *------------------------------------------------------------------------- @@ -440,7 +437,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Nov 21 2005 * *------------------------------------------------------------------------- @@ -729,7 +725,6 @@ done: * Failure: Negative * * Programmer: Quincey Koziol - * koziol@lbl.gov * Oct 21 2016 * *------------------------------------------------------------------------- @@ -878,7 +873,6 @@ H5O__alloc_find_best_nonnull(const H5F_t *f, const H5O_t *oh, size_t *size, * Failure: Negative * * Programmer: Quincey Koziol - * koziol@lbl.gov * Oct 21 2016 * *------------------------------------------------------------------------- @@ -1157,7 +1151,6 @@ done: * Failure: Negative * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 7 1997 * *------------------------------------------------------------------------- @@ -1208,7 +1201,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@lbl.gov * Oct 21 2016 * *------------------------------------------------------------------------- @@ -1283,7 +1275,6 @@ H5O__alloc_find_best_null(const H5O_t *oh, size_t size, size_t *mesg_idx) * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 6 1997 * *------------------------------------------------------------------------- @@ -1369,7 +1360,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Oct 22 2006 * *------------------------------------------------------------------------- @@ -1607,7 +1597,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Oct 17 2005 * *------------------------------------------------------------------------- @@ -1958,7 +1947,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Oct 10 2005 * *------------------------------------------------------------------------- @@ -2101,7 +2089,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Oct 17 2005 * *------------------------------------------------------------------------- @@ -2286,7 +2273,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Oct 4 2005 * *------------------------------------------------------------------------- @@ -2347,7 +2333,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Neil Fortner - * nfortne2@hdfgroup.org * Oct 20 2008 * *------------------------------------------------------------------------- diff --git a/src/H5Oattr.c b/src/H5Oattr.c index aeaebea..8b02724 100644 --- a/src/H5Oattr.c +++ b/src/H5Oattr.c @@ -24,13 +24,13 @@ #include "H5Spkg.h" /* Dataspaces */ /* PRIVATE PROTOTYPES */ -static herr_t H5O_attr_encode(H5F_t *f, uint8_t *p, const void *mesg); -static void *H5O_attr_decode(H5F_t *f, H5O_t *open_oh, +static herr_t H5O__attr_encode(H5F_t *f, uint8_t *p, const void *mesg); +static void *H5O__attr_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p); -static void *H5O_attr_copy(const void *_mesg, void *_dest); -static size_t H5O_attr_size(const H5F_t *f, const void *_mesg); +static void *H5O__attr_copy(const void *_mesg, void *_dest); +static size_t H5O__attr_size(const H5F_t *f, const void *_mesg); static herr_t H5O__attr_free(void *mesg); -static herr_t H5O_attr_pre_copy_file(H5F_t *file_src, const void *mesg_src, +static herr_t H5O__attr_pre_copy_file(H5F_t *file_src, const void *mesg_src, hbool_t *deleted, const H5O_copy_t *cpy_info, void *udata); static void *H5O__attr_copy_file(H5F_t *file_src, const H5O_msg_class_t *mesg_type, void *native_src, H5F_t *file_dst, hbool_t *recompute_size, @@ -38,29 +38,29 @@ static void *H5O__attr_copy_file(H5F_t *file_src, const H5O_msg_class_t *mesg_ty static herr_t H5O__attr_post_copy_file(const H5O_loc_t *src_oloc, const void *mesg_src, H5O_loc_t *dst_oloc, void *mesg_dst, H5O_copy_t *cpy_info); -static herr_t H5O_attr_get_crt_index(const void *_mesg, H5O_msg_crt_idx_t *crt_idx); -static herr_t H5O_attr_set_crt_index(void *_mesg, H5O_msg_crt_idx_t crt_idx); +static herr_t H5O__attr_get_crt_index(const void *_mesg, H5O_msg_crt_idx_t *crt_idx); +static herr_t H5O__attr_set_crt_index(void *_mesg, H5O_msg_crt_idx_t crt_idx); static herr_t H5O__attr_debug(H5F_t *f, const void *_mesg, FILE * stream, int indent, int fwidth); /* Set up & include shared message "interface" info */ #define H5O_SHARED_TYPE H5O_MSG_ATTR -#define H5O_SHARED_DECODE H5O_attr_shared_decode -#define H5O_SHARED_DECODE_REAL H5O_attr_decode -#define H5O_SHARED_ENCODE H5O_attr_shared_encode -#define H5O_SHARED_ENCODE_REAL H5O_attr_encode -#define H5O_SHARED_SIZE H5O_attr_shared_size -#define H5O_SHARED_SIZE_REAL H5O_attr_size +#define H5O_SHARED_DECODE H5O__attr_shared_decode +#define H5O_SHARED_DECODE_REAL H5O__attr_decode +#define H5O_SHARED_ENCODE H5O__attr_shared_encode +#define H5O_SHARED_ENCODE_REAL H5O__attr_encode +#define H5O_SHARED_SIZE H5O__attr_shared_size +#define H5O_SHARED_SIZE_REAL H5O__attr_size #define H5O_SHARED_DELETE H5O__attr_shared_delete #define H5O_SHARED_DELETE_REAL H5O__attr_delete #define H5O_SHARED_LINK H5O__attr_shared_link #define H5O_SHARED_LINK_REAL H5O__attr_link #define H5O_SHARED_COPY_FILE H5O__attr_shared_copy_file #define H5O_SHARED_COPY_FILE_REAL H5O__attr_copy_file -#define H5O_SHARED_POST_COPY_FILE H5O_attr_shared_post_copy_file +#define H5O_SHARED_POST_COPY_FILE H5O__attr_shared_post_copy_file #define H5O_SHARED_POST_COPY_FILE_REAL H5O__attr_post_copy_file #undef H5O_SHARED_POST_COPY_FILE_UPD -#define H5O_SHARED_DEBUG H5O_attr_shared_debug +#define H5O_SHARED_DEBUG H5O__attr_shared_debug #define H5O_SHARED_DEBUG_REAL H5O__attr_debug #include "H5Oshared.h" /* Shared Object Header Message Callbacks */ @@ -70,22 +70,22 @@ const H5O_msg_class_t H5O_MSG_ATTR[1] = {{ "attribute", /* message name for debugging */ sizeof(H5A_t), /* native message size */ H5O_SHARE_IS_SHARABLE, /* messages are sharable? */ - H5O_attr_shared_decode, /* decode message */ - H5O_attr_shared_encode, /* encode message */ - H5O_attr_copy, /* copy the native value */ - H5O_attr_shared_size, /* size of raw message */ + H5O__attr_shared_decode, /* decode message */ + H5O__attr_shared_encode, /* encode message */ + H5O__attr_copy, /* copy the native value */ + H5O__attr_shared_size, /* size of raw message */ H5O__attr_reset, /* reset method */ H5O__attr_free, /* free method */ H5O__attr_shared_delete, /* file delete method */ H5O__attr_shared_link, /* link method */ NULL, /* set share method */ NULL, /* can share method */ - H5O_attr_pre_copy_file, /* pre copy native value to file */ + H5O__attr_pre_copy_file, /* pre copy native value to file */ H5O__attr_shared_copy_file, /* copy native value to file */ - H5O_attr_shared_post_copy_file, /* post copy native value to file */ - H5O_attr_get_crt_index, /* get creation index */ - H5O_attr_set_crt_index, /* set creation index */ - H5O_attr_shared_debug /* debug the message */ + H5O__attr_shared_post_copy_file, /* post copy native value to file */ + H5O__attr_get_crt_index, /* get creation index */ + H5O__attr_set_crt_index, /* set creation index */ + H5O__attr_shared_debug /* debug the message */ }}; /* Flags for attribute flag encoding */ @@ -102,14 +102,17 @@ H5FL_EXTERN(H5S_extent_t); /*-------------------------------------------------------------------------- NAME - H5O_attr_decode + H5O__attr_decode PURPOSE Decode a attribute message and return a pointer to a memory struct with the decoded information USAGE - void *H5O_attr_decode(f, mesg_flags, p) - H5F_t *f; IN: pointer to the HDF5 file struct - unsigned mesg_flags; IN: Message flags to influence decoding + void *H5O__attr_decode(f, mesg_flags, p) + H5F_t *f; IN: pointer to the HDF5 file struct + H5O_t *open_oh; IN: pointer to the object header + unsigned mesg_flags; IN: message flags to influence decoding + unsigned *ioflags; IN/OUT: flags for decoding + size_t p_size; IN: size of buffer *p const uint8_t *p; IN: the raw information buffer RETURNS Pointer to the new message in native order on success, NULL on failure @@ -119,26 +122,26 @@ H5FL_EXTERN(H5S_extent_t); function using malloc() and is returned to the caller. --------------------------------------------------------------------------*/ static void * -H5O_attr_decode(H5F_t *f, H5O_t *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, - unsigned *ioflags, size_t H5_ATTR_UNUSED p_size, const uint8_t *p) +H5O__attr_decode(H5F_t *f, H5O_t *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, + unsigned *ioflags, size_t p_size, const uint8_t *p) { - H5A_t *attr = NULL; - H5S_extent_t *extent; /*extent dimensionality information */ - size_t name_len; /*attribute name length */ - size_t dt_size; /* Datatype size */ - hssize_t sds_size; /* Signed Dataspace size */ - hsize_t ds_size; /* Dataspace size */ - unsigned flags = 0; /* Attribute flags */ - H5A_t *ret_value = NULL; /* Return value */ + H5A_t *attr = NULL; + H5S_extent_t *extent; /*extent dimensionality information */ + size_t name_len; /*attribute name length */ + size_t dt_size; /* Datatype size */ + hssize_t sds_size; /* Signed Dataspace size */ + hsize_t ds_size; /* Dataspace size */ + unsigned flags = 0; /* Attribute flags */ + H5A_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(f); HDassert(p); if(NULL == (attr = H5FL_CALLOC(H5A_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") if(NULL == (attr->shared = H5FL_CALLOC(H5A_shared_t))) HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, NULL, "can't allocate shared attr structure") @@ -146,7 +149,7 @@ H5O_attr_decode(H5F_t *f, H5O_t *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, /* Version number */ attr->shared->version = *p++; if(attr->shared->version < H5O_ATTR_VERSION_1 || attr->shared->version > H5O_ATTR_VERSION_LATEST) - HGOTO_ERROR(H5E_ATTR, H5E_CANTLOAD, NULL, "bad version number for attribute message") + HGOTO_ERROR(H5E_ATTR, H5E_CANTLOAD, NULL, "bad version number for attribute message") /* Get the flags byte if we have a later version of the attribute */ if(attr->shared->version >= H5O_ATTR_VERSION_2) { @@ -238,6 +241,11 @@ H5O_attr_decode(H5F_t *f, H5O_t *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, /* Go get the data */ if(attr->shared->data_size) { + /* Ensure that data size doesn't exceed buffer size, in case of + it's being corrupted in the file */ + if(attr->shared->data_size > p_size) + HGOTO_ERROR(H5E_RESOURCE, H5E_OVERFLOW, NULL, "data size exceeds buffer size") + if(NULL == (attr->shared->data = H5FL_BLK_MALLOC(attr_buf, attr->shared->data_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") H5MM_memcpy(attr->shared->data, p, attr->shared->data_size); @@ -262,16 +270,16 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_attr_decode() */ +} /* end H5O__attr_decode() */ /*-------------------------------------------------------------------------- NAME - H5O_attr_encode + H5O__attr_encode PURPOSE Encode a simple attribute message USAGE - herr_t H5O_attr_encode(f, p, mesg) + herr_t H5O__attr_encode(f, p, mesg) H5F_t *f; IN: pointer to the HDF5 file struct const uint8 *p; IN: the raw information buffer const void *mesg; IN: Pointer to the simple datatype struct @@ -282,7 +290,7 @@ done: message in the "raw" disk form. --------------------------------------------------------------------------*/ static herr_t -H5O_attr_encode(H5F_t *f, uint8_t *p, const void *mesg) +H5O__attr_encode(H5F_t *f, uint8_t *p, const void *mesg) { const H5A_t *attr = (const H5A_t *) mesg; size_t name_len; /* Attribute name length */ @@ -291,7 +299,7 @@ H5O_attr_encode(H5F_t *f, uint8_t *p, const void *mesg) unsigned flags = 0; /* Attribute flags */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(f); @@ -371,16 +379,16 @@ H5O_attr_encode(H5F_t *f, uint8_t *p, const void *mesg) done: FUNC_LEAVE_NOAPI(ret_value); -} /* end H5O_attr_encode() */ +} /* end H5O__attr_encode() */ /*-------------------------------------------------------------------------- NAME - H5O_attr_copy + H5O__attr_copy PURPOSE Copies a message from MESG to DEST, allocating DEST if necessary. USAGE - void *H5O_attr_copy(mesg, dest) + void *H5O__attr_copy(mesg, dest) const void *mesg; IN: Pointer to the source attribute struct const void *dest; IN: Pointer to the destination attribute struct RETURNS @@ -390,11 +398,11 @@ done: allocating the destination structure if necessary. --------------------------------------------------------------------------*/ static void * -H5O_attr_copy(const void *_src, void *_dst) +H5O__attr_copy(const void *_src, void *_dst) { void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(_src); @@ -405,16 +413,16 @@ H5O_attr_copy(const void *_src, void *_dst) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_attr_copy() */ +} /* end H5O__attr_copy() */ /*-------------------------------------------------------------------------- NAME - H5O_attr_size + H5O__attr_size PURPOSE Return the raw message size in bytes USAGE - size_t H5O_attr_size(f, mesg) + size_t H5O__attr_size(f, mesg) H5F_t *f; IN: pointer to the HDF5 file struct const void *mesg; IN: Pointer to the source attribute struct RETURNS @@ -425,13 +433,13 @@ done: portion of the message). It doesn't take into account alignment. --------------------------------------------------------------------------*/ static size_t -H5O_attr_size(const H5F_t H5_ATTR_UNUSED *f, const void *_mesg) +H5O__attr_size(const H5F_t H5_ATTR_UNUSED *f, const void *_mesg) { const H5A_t *attr = (const H5A_t *)_mesg; size_t name_len; size_t ret_value = 0; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(attr); @@ -466,7 +474,7 @@ H5O_attr_size(const H5F_t H5_ATTR_UNUSED *f, const void *_mesg) HDassert(0 && "Bad attribute version"); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_attr_size() */ +} /* end H5O__attr_size() */ /*------------------------------------------------------------------------- @@ -600,7 +608,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_attr_pre_copy_file + * Function: H5O__attr_pre_copy_file * * Purpose: Perform any necessary actions before copying message between * files for attribute messages. @@ -613,13 +621,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_attr_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void *native_src, +H5O__attr_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void *native_src, hbool_t *deleted, const H5O_copy_t *cpy_info, void H5_ATTR_UNUSED *udata) { const H5A_t *attr_src = (const H5A_t *)native_src; /* Source attribute */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(deleted); @@ -640,7 +648,7 @@ H5O_attr_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void *native_src, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_attr_pre_copy_file() */ +} /* end H5O__attr_pre_copy_file() */ /*------------------------------------------------------------------------- @@ -718,7 +726,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_attr_get_crt_index + * Function: H5O__attr_get_crt_index * * Purpose: Get creation index from the message * @@ -730,11 +738,11 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_attr_get_crt_index(const void *_mesg, H5O_msg_crt_idx_t *crt_idx /*out*/) +H5O__attr_get_crt_index(const void *_mesg, H5O_msg_crt_idx_t *crt_idx /*out*/) { const H5A_t *attr = (const H5A_t *)_mesg; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(attr); HDassert(crt_idx); @@ -743,11 +751,11 @@ H5O_attr_get_crt_index(const void *_mesg, H5O_msg_crt_idx_t *crt_idx /*out*/) *crt_idx = attr->shared->crt_idx; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5O_attr_get_crt_index() */ +} /* end H5O__attr_get_crt_index() */ /*------------------------------------------------------------------------- - * Function: H5O_attr_set_crt_index + * Function: H5O__attr_set_crt_index * * Purpose: Set creation index from the message * @@ -759,11 +767,11 @@ H5O_attr_get_crt_index(const void *_mesg, H5O_msg_crt_idx_t *crt_idx /*out*/) *------------------------------------------------------------------------- */ static herr_t -H5O_attr_set_crt_index(void *_mesg, H5O_msg_crt_idx_t crt_idx) +H5O__attr_set_crt_index(void *_mesg, H5O_msg_crt_idx_t crt_idx) { H5A_t *attr = (H5A_t *)_mesg; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(attr); @@ -771,7 +779,7 @@ H5O_attr_set_crt_index(void *_mesg, H5O_msg_crt_idx_t crt_idx) attr->shared->crt_idx = crt_idx; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5O_attr_set_crt_index() */ +} /* end H5O__attr_set_crt_index() */ /*-------------------------------------------------------------------------- diff --git a/src/H5Oattribute.c b/src/H5Oattribute.c index d498be5..d6b9f7a 100644 --- a/src/H5Oattribute.c +++ b/src/H5Oattribute.c @@ -13,7 +13,7 @@ /*------------------------------------------------------------------------- * - * Created: H5Oattribute.c + * Created: H5Oattribute.c * * Purpose: Object header attribute routines. * @@ -149,7 +149,6 @@ static herr_t H5O__attr_exists_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg, * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Dec 4 2006 * *------------------------------------------------------------------------- @@ -393,7 +392,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Dec 11 2006 * *------------------------------------------------------------------------- @@ -541,7 +539,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Dec 18 2006 * *------------------------------------------------------------------------- @@ -727,7 +724,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jan 2 2007 * *------------------------------------------------------------------------- @@ -802,7 +798,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Dec 4 2006 * *------------------------------------------------------------------------- @@ -960,7 +955,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Dec 5 2006 * *------------------------------------------------------------------------- @@ -1006,7 +1000,6 @@ H5O__attr_rename_chk_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg/*in,out*/, * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Dec 5 2006 * *------------------------------------------------------------------------- @@ -1468,7 +1461,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Dec 11 2006 * *------------------------------------------------------------------------- @@ -1699,7 +1691,7 @@ H5O__attr_count_real(H5F_t *f, H5O_t *oh, hsize_t *nattrs) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_TAG(oh->cache_info.addr) + FUNC_ENTER_PACKAGE /* Check arguments */ HDassert(f); @@ -1732,7 +1724,7 @@ H5O__attr_count_real(H5F_t *f, H5O_t *oh, hsize_t *nattrs) } /* end else */ done: - FUNC_LEAVE_NOAPI_TAG(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__attr_count_real */ @@ -1745,7 +1737,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Dec 11 2006 * *------------------------------------------------------------------------- @@ -1928,48 +1919,3 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5O__attr_bh_info() */ -#ifndef H5_NO_DEPRECATED_SYMBOLS - -/*------------------------------------------------------------------------- - * Function: H5O__attr_count - * - * Purpose: Determine the # of attributes on an object - * - * Return: SUCCEED/FAIL - * - * Programmer: Quincey Koziol - * Monday, December 11, 2006 - * - *------------------------------------------------------------------------- - */ -int -H5O__attr_count(const H5O_loc_t *loc) -{ - H5O_t *oh = NULL; /* Pointer to actual object header */ - hsize_t nattrs; /* Number of attributes */ - int ret_value = -1; /* Return value */ - - FUNC_ENTER_PACKAGE - - /* Check arguments */ - HDassert(loc); - - /* Protect the object header to iterate over */ - if(NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, FAIL, "unable to load object header") - - /* Retrieve # of attributes on object */ - if(H5O__attr_count_real(loc->file, oh, &nattrs) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't retrieve attribute count") - - /* Set return value */ - ret_value = (int)nattrs; - -done: - if(oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O__attr_count */ -#endif /* H5_NO_DEPRECATED_SYMBOLS */ - diff --git a/src/H5Obogus.c b/src/H5Obogus.c index f3cca0f..08b03b3 100644 --- a/src/H5Obogus.c +++ b/src/H5Obogus.c @@ -15,7 +15,7 @@ * * Created: H5Obogus.c * Jan 21 2003 - * Quincey Koziol + * Quincey Koziol * * Purpose: "bogus" message. This message is guaranteed to never * be found in a valid HDF5 file and is only used to @@ -39,8 +39,8 @@ /* PRIVATE PROTOTYPES */ static void *H5O__bogus_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p); -static herr_t H5O_bogus_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); -static size_t H5O_bogus_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); +static herr_t H5O__bogus_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); +static size_t H5O__bogus_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); static herr_t H5O__bogus_debug(H5F_t *f, const void *_mesg, FILE *stream, int indent, int fwidth); @@ -51,9 +51,9 @@ const H5O_msg_class_t H5O_MSG_BOGUS_VALID[1] = {{ 0, /*native message size */ H5O_SHARE_IS_SHARABLE, /* messages are sharable? */ H5O__bogus_decode, /*decode message */ - H5O_bogus_encode, /*encode message */ + H5O__bogus_encode, /*encode message */ NULL, /*copy the native value */ - H5O_bogus_size, /*raw message size */ + H5O__bogus_size, /*raw message size */ NULL, /*free internal memory */ NULL, /*free method */ NULL, /* file delete method */ @@ -75,9 +75,9 @@ const H5O_msg_class_t H5O_MSG_BOGUS_INVALID[1] = {{ 0, /*native message size */ H5O_SHARE_IS_SHARABLE, /* messages are sharable? */ H5O__bogus_decode, /*decode message */ - H5O_bogus_encode, /*encode message */ + H5O__bogus_encode, /*encode message */ NULL, /*copy the native value */ - H5O_bogus_size, /*raw message size */ + H5O__bogus_size, /*raw message size */ NULL, /*free internal memory */ NULL, /*free method */ NULL, /* file delete method */ @@ -104,7 +104,6 @@ const H5O_msg_class_t H5O_MSG_BOGUS_INVALID[1] = {{ * Failure: NULL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Jan 21 2003 * *------------------------------------------------------------------------- @@ -146,22 +145,21 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_bogus_encode + * Function: H5O__bogus_encode * * Purpose: Encodes a "bogus" message. * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Jan 21 2003 * *------------------------------------------------------------------------- */ static herr_t -H5O_bogus_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void H5_ATTR_UNUSED *mesg) +H5O__bogus_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void H5_ATTR_UNUSED *mesg) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* check args */ HDassert(f); @@ -172,11 +170,11 @@ H5O_bogus_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, UINT32ENCODE(p, H5O_BOGUS_VALUE); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5O_bogus_encode() */ +} /* end H5O__bogus_encode() */ /*------------------------------------------------------------------------- - * Function: H5O_bogus_size + * Function: H5O__bogus_size * * Purpose: Returns the size of the raw message in bytes not * counting the message typ or size fields, but only the data @@ -188,18 +186,17 @@ H5O_bogus_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, * Failure: Negative * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Jan 21 2003 * *------------------------------------------------------------------------- */ static size_t -H5O_bogus_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, const void H5_ATTR_UNUSED *mesg) +H5O__bogus_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, const void H5_ATTR_UNUSED *mesg) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR FUNC_LEAVE_NOAPI(4) -} /* end H5O_bogus_size() */ +} /* end H5O__bogus_size() */ /*------------------------------------------------------------------------- @@ -210,11 +207,8 @@ H5O_bogus_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_sha * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Jan 21 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t diff --git a/src/H5Obtreek.c b/src/H5Obtreek.c index 5a98e59..4d3c64e 100644 --- a/src/H5Obtreek.c +++ b/src/H5Obtreek.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol +/* Programmer: Quincey Koziol * Thursday, March 1, 2007 * * Purpose: A message holding non-default v1 B-tree 'K' value @@ -27,11 +27,11 @@ #include "H5Opkg.h" /* Object headers */ #include "H5MMprivate.h" /* Memory management */ -static void *H5O_btreek_decode(H5F_t *f, H5O_t *open_oh, +static void *H5O__btreek_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p); -static herr_t H5O_btreek_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); -static void *H5O_btreek_copy(const void *_mesg, void *_dest); -static size_t H5O_btreek_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); +static herr_t H5O__btreek_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); +static void *H5O__btreek_copy(const void *_mesg, void *_dest); +static size_t H5O__btreek_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); static herr_t H5O__btreek_debug(H5F_t *f, const void *_mesg, FILE *stream, int indent, int fwidth); @@ -40,11 +40,11 @@ const H5O_msg_class_t H5O_MSG_BTREEK[1] = {{ H5O_BTREEK_ID, /*message id number */ "v1 B-tree 'K' values", /*message name for debugging */ sizeof(H5O_btreek_t), /*native message size */ - 0, /* messages are sharable? */ - H5O_btreek_decode, /*decode message */ - H5O_btreek_encode, /*encode message */ - H5O_btreek_copy, /*copy the native value */ - H5O_btreek_size, /*raw message size */ + 0, /* messages are sharable? */ + H5O__btreek_decode, /*decode message */ + H5O__btreek_encode, /*encode message */ + H5O__btreek_copy, /*copy the native value */ + H5O__btreek_size, /*raw message size */ NULL, /*free internal memory */ NULL, /* free method */ NULL, /* file delete method */ @@ -56,7 +56,7 @@ const H5O_msg_class_t H5O_MSG_BTREEK[1] = {{ NULL, /* post copy native value to file */ NULL, /* get creation index */ NULL, /* set creation index */ - H5O__btreek_debug /*debug the message */ + H5O__btreek_debug /*debug the message */ }}; /* Current version of v1 B-tree 'K' value information */ @@ -64,7 +64,7 @@ const H5O_msg_class_t H5O_MSG_BTREEK[1] = {{ /*------------------------------------------------------------------------- - * Function: H5O_btreek_decode + * Function: H5O__btreek_decode * * Purpose: Decode a shared message table message and return a pointer * to a newly allocated H5O_btreek_t struct. @@ -78,14 +78,14 @@ const H5O_msg_class_t H5O_MSG_BTREEK[1] = {{ *------------------------------------------------------------------------- */ static void * -H5O_btreek_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, +H5O__btreek_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, size_t H5_ATTR_UNUSED p_size, const uint8_t *p) { H5O_btreek_t *mesg; /* Native message */ void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity check */ HDassert(f); @@ -109,11 +109,11 @@ H5O_btreek_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_btreek_decode() */ +} /* end H5O__btreek_decode() */ /*------------------------------------------------------------------------- - * Function: H5O_btreek_encode + * Function: H5O__btreek_encode * * Purpose: Encode a v1 B-tree 'K' value message. * @@ -125,11 +125,11 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_btreek_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) +H5O__btreek_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) { const H5O_btreek_t *mesg = (const H5O_btreek_t *)_mesg; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity check */ HDassert(f); @@ -143,11 +143,11 @@ H5O_btreek_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared UINT16ENCODE(p, mesg->sym_leaf_k); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5O_btreek_encode() */ +} /* end H5O__btreek_encode() */ /*------------------------------------------------------------------------- - * Function: H5O_btreek_copy + * Function: H5O__btreek_copy * * Purpose: Copies a message from _MESG to _DEST, allocating _DEST if * necessary. @@ -161,13 +161,13 @@ H5O_btreek_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared *------------------------------------------------------------------------- */ static void * -H5O_btreek_copy(const void *_mesg, void *_dest) +H5O__btreek_copy(const void *_mesg, void *_dest) { const H5O_btreek_t *mesg = (const H5O_btreek_t *)_mesg; H5O_btreek_t *dest = (H5O_btreek_t *)_dest; void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity check */ HDassert(mesg); @@ -183,11 +183,11 @@ H5O_btreek_copy(const void *_mesg, void *_dest) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_btreek_copy() */ +} /* end H5O__btreek_copy() */ /*------------------------------------------------------------------------- - * Function: H5O_btreek_size + * Function: H5O__btreek_size * * Purpose: Returns the size of the raw message in bytes not counting the * message type or size fields, but only the data fields. @@ -201,11 +201,11 @@ done: *------------------------------------------------------------------------- */ static size_t -H5O_btreek_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, const void H5_ATTR_UNUSED *_mesg) +H5O__btreek_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, const void H5_ATTR_UNUSED *_mesg) { size_t ret_value; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity check */ HDassert(f); @@ -216,7 +216,7 @@ H5O_btreek_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_sh 2; /* Symbol table node leaf 'K' value */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_btreek_size() */ +} /* end H5O__btreek_size() */ /*------------------------------------------------------------------------- diff --git a/src/H5Ocache.c b/src/H5Ocache.c index 45c55fd..58db827 100644 --- a/src/H5Ocache.c +++ b/src/H5Ocache.c @@ -15,7 +15,7 @@ * * Created: H5Ocache.c * Sep 28 2005 - * Quincey Koziol + * Quincey Koziol * * Purpose: Object header metadata cache virtual functions. * @@ -84,8 +84,7 @@ static herr_t H5O__cache_chk_notify(H5AC_notify_action_t action, void *_thing); static herr_t H5O__cache_chk_free_icr(void *thing); /* Prefix routines */ -static herr_t H5O__prefix_deserialize(const uint8_t *image, - H5O_cache_ud_t *udata); +static herr_t H5O__prefix_deserialize(const uint8_t *image, H5O_cache_ud_t *udata); /* Chunk routines */ static herr_t H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, @@ -294,7 +293,7 @@ H5O__cache_verify_chksum(const void *_image, size_t len, void *_udata) * * Note that the object header is read with with a speculative read. * If the initial read is too small, make note of this fact and return - * without error. H5C_load_entry() will note the size discrepency + * without error. H5C__load_entry() will note the size discrepency * and retry the deserialize operation with the correct size read. * * Return: Success: Pointer to in core representation @@ -1081,7 +1080,6 @@ done: * Failure: FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 12, 2008 * *------------------------------------------------------------------------- @@ -1300,7 +1298,6 @@ done: * Failure: FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 12, 2008 * *------------------------------------------------------------------------- @@ -1644,7 +1641,6 @@ done: * Failure: FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 12, 2008 * *------------------------------------------------------------------------- diff --git a/src/H5Ocache_image.c b/src/H5Ocache_image.c index 6ac04c8..ac51aff 100644 --- a/src/H5Ocache_image.c +++ b/src/H5Ocache_image.c @@ -294,39 +294,8 @@ H5O__mdci_delete(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, void *_mesg) * from the VFD layer at the end of file. As this was the * last file space allocation before shutdown, the cache image * should still be the last item in the file. - * - * If the hack to work around the self referential free space - * manager issue is in use, file space for the non-empty self - * referential free space managers was also allocated from VFD - * layer at the end of file. Since these allocations directly - * preceeded the cache image allocation they should be directly - * adjacent to the cache image block at the end of file. - * - * In this case, just call H5MF_tidy_self_referential_fsm_hack(). - * - * That routine will float the self referential free space - * managers, and reduce the eoa to its value just prior to - * allocation of space for same. Since the cache image appears - * just after the self referential free space managers, this - * will release the file space for the cache image as well. - * - * Note that in this case, there must not have been any file - * space allocations / deallocations prior to the free of the - * cache image. Verify this to the extent possible. - * - * If the hack to work around the persistent self referential - * free space manager issue is NOT in use, just call H5MF_xfree() - * to release the cache iamge. In principle, we should be able - * to just reduce the EOA to the base address of the cache - * image block, as there shouldn't be any file space allocation - * before the first metadata cache access. However, given - * time constraints, I don't want to go there now. */ - - - if(f->shared->closing) { - /* Get the eoa, and verify that it has the expected value */ if(HADDR_UNDEF == (final_eoa = H5FD_get_eoa(f->shared->lf, H5FD_MEM_DEFAULT)) ) HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "unable to get file size") @@ -335,11 +304,10 @@ H5O__mdci_delete(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, void *_mesg) if(H5FD_free(f->shared->lf, H5FD_MEM_SUPER, f, mesg->addr, mesg->size) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, "can't free MDC image") - } else { + } + else if(H5MF_xfree(f, H5FD_MEM_SUPER, mesg->addr, mesg->size) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free file space for cache image block") - } - } /* end if */ done: diff --git a/src/H5Ochunk.c b/src/H5Ochunk.c index 72402e4..cb31cec 100644 --- a/src/H5Ochunk.c +++ b/src/H5Ochunk.c @@ -15,7 +15,7 @@ * * Created: H5Ochunk.c * Jul 13 2008 - * Quincey Koziol + * Quincey Koziol * * Purpose: Object header chunk routines. * @@ -84,7 +84,6 @@ H5FL_DEFINE(H5O_chunk_proxy_t); * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jul 13 2008 * *------------------------------------------------------------------------- @@ -146,14 +145,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_chunk_protect + * Function: H5O__chunk_protect * * Purpose: Protect an object header chunk for modifications * * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jul 17 2008 * *------------------------------------------------------------------------- @@ -227,7 +225,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jul 17 2008 * *------------------------------------------------------------------------- @@ -278,7 +275,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * May 6 2010 * *------------------------------------------------------------------------- @@ -319,7 +315,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jul 13 2008 * *------------------------------------------------------------------------- @@ -370,7 +365,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jul 13 2008 * *------------------------------------------------------------------------- @@ -415,7 +409,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 13, 2008 * *------------------------------------------------------------------------- diff --git a/src/H5Ocont.c b/src/H5Ocont.c index ad54272..68a88e2 100644 --- a/src/H5Ocont.c +++ b/src/H5Ocont.c @@ -15,7 +15,7 @@ * * Created: H5Ocont.c * Aug 6 1997 - * Robb Matzke + * Robb Matzke * * Purpose: The object header continuation message. This * message is only generated and read from within @@ -83,7 +83,6 @@ H5FL_DEFINE(H5O_cont_t); * Failure: NULL * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 6 1997 * *------------------------------------------------------------------------- @@ -127,7 +126,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 7 1997 * *------------------------------------------------------------------------- @@ -166,7 +164,6 @@ H5O__cont_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, co * Failure: zero * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Sep 6 2005 * *------------------------------------------------------------------------- @@ -253,7 +250,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 6 1997 * *------------------------------------------------------------------------- diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c index 469a9e0..6718501 100644 --- a/src/H5Ocopy.c +++ b/src/H5Ocopy.c @@ -256,7 +256,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_copy + * Function: H5O__copy * * Purpose: Private version of H5Ocopy * @@ -268,7 +268,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_copy(const H5G_loc_t *loc, const char *src_name, H5G_loc_t *dst_loc, +H5O__copy(const H5G_loc_t *loc, const char *src_name, H5G_loc_t *dst_loc, const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id) { H5G_loc_t src_loc; /* Source object group location */ @@ -279,7 +279,7 @@ H5O_copy(const H5G_loc_t *loc, const char *src_name, H5G_loc_t *dst_loc, hbool_t obj_open = FALSE; /* Entry at 'name' found */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Check arguments */ HDassert(loc); @@ -319,7 +319,7 @@ done: HDONE_ERROR(H5E_OHDR, H5E_CLOSEERROR, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_copy() */ +} /* end H5O__copy() */ /*------------------------------------------------------------------------- @@ -1307,10 +1307,10 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_copy_search_comm_dt_attr_cb + * Function: H5O__copy_search_comm_dt_attr_cb * * Purpose: Callback for H5O_attr_iterate_real from - * H5O_copy_search_comm_dt_check. Checks if the attribute's + * H5O__copy_search_comm_dt_check. Checks if the attribute's * datatype is committed. If it is, adds it to the merge * committed dt skiplist present in udata if it does not match * any already present. @@ -1323,7 +1323,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_copy_search_comm_dt_attr_cb(const H5A_t *attr, void *_udata) +H5O__copy_search_comm_dt_attr_cb(const H5A_t *attr, void *_udata) { H5O_copy_search_comm_dt_ud_t *udata = (H5O_copy_search_comm_dt_ud_t *)_udata; H5T_t *dt = NULL; /* Datatype */ @@ -1332,7 +1332,7 @@ H5O_copy_search_comm_dt_attr_cb(const H5A_t *attr, void *_udata) hbool_t obj_inserted = FALSE; /* Object inserted into skip list */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity checks */ HDassert(attr); @@ -1385,11 +1385,11 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_copy_search_comm_dt_attr_cb */ +} /* end H5O__copy_search_comm_dt_attr_cb */ /*------------------------------------------------------------------------- - * Function: H5O_copy_search_comm_dt_check + * Function: H5O__copy_search_comm_dt_check * * Purpose: Check if the object at obj_oloc is or contains a reference * to a committed datatype. If it does, adds it to the merge @@ -1404,7 +1404,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_copy_search_comm_dt_check(H5O_loc_t *obj_oloc, +H5O__copy_search_comm_dt_check(H5O_loc_t *obj_oloc, H5O_copy_search_comm_dt_ud_t *udata) { H5O_copy_search_comm_dt_key_t *key = NULL; /* Skiplist key */ @@ -1414,7 +1414,7 @@ H5O_copy_search_comm_dt_check(H5O_loc_t *obj_oloc, const H5O_obj_class_t *obj_class = NULL; /* Type of object */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity checks */ HDassert(obj_oloc); @@ -1483,7 +1483,7 @@ H5O_copy_search_comm_dt_check(H5O_loc_t *obj_oloc, /* Search within attributes */ attr_op.op_type = H5A_ATTR_OP_LIB; - attr_op.u.lib_op = H5O_copy_search_comm_dt_attr_cb; + attr_op.u.lib_op = H5O__copy_search_comm_dt_attr_cb; udata->obj_oloc.file = obj_oloc->file; udata->obj_oloc.addr = obj_oloc->addr; if(H5O_attr_iterate_real((hid_t)-1, obj_oloc, H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)0, NULL, &attr_op, udata) < 0) @@ -1504,7 +1504,7 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_copy_search_comm_dt_check */ +} /* end H5O__copy_search_comm_dt_check */ /*------------------------------------------------------------------------- @@ -1512,7 +1512,7 @@ done: * * Purpose: H5G_visit callback to add committed datatypes to the merge * committed dt skiplist. Mostly a wrapper for - * H5O_copy_search_comm_dt_check. + * H5O__copy_search_comm_dt_check. * * Return: Non-negative on success/Negative on failure * @@ -1554,7 +1554,7 @@ H5O__copy_search_comm_dt_cb(hid_t H5_ATTR_UNUSED group, const char *name, obj_found = TRUE; /* Check object and add to skip list if appropriate */ - if(H5O_copy_search_comm_dt_check(&obj_oloc, udata) < 0) + if(H5O__copy_search_comm_dt_check(&obj_oloc, udata) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, H5_ITER_ERROR, "can't check object") } /* end if */ @@ -1653,7 +1653,7 @@ H5O__copy_search_comm_dt(H5F_t *file_src, H5O_t *oh_src, H5E_clear_stack(NULL); else /* Check object and add to skip list if appropriate */ - if(H5O_copy_search_comm_dt_check(&obj_oloc, &udata) < 0) { + if(H5O__copy_search_comm_dt_check(&obj_oloc, &udata) < 0) { if(H5G_loc_free(&obj_loc) < 0) HERROR(H5E_OHDR, H5E_CANTRELEASE, "can't free location"); HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't check object") diff --git a/src/H5Ocopy_ref.c b/src/H5Ocopy_ref.c index 0de661f..e03bb69 100644 --- a/src/H5Ocopy_ref.c +++ b/src/H5Ocopy_ref.c @@ -178,30 +178,29 @@ H5O__copy_expand_ref_object1(H5O_loc_t *src_oloc, const void *buf_src, H5O_token_t tmp_token = { 0 }; /* If data is not initialized, copy zeros and skip */ - if(0 == HDmemcmp(src_buf, zeros, buf_size)) { + if(0 == HDmemcmp(src_buf, zeros, buf_size)) HDmemset(dst_buf, 0, buf_size); - continue; - } - - /* Set up for the object copy for the reference */ - if(H5R__decode_token_obj_compat(src_buf, &buf_size, &tmp_token, token_size) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, FAIL, "unable to decode src object address") - if(H5VL_native_token_to_addr(src_oloc->file, H5I_FILE, tmp_token, &src_oloc->addr) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTUNSERIALIZE, FAIL, "can't deserialize object token into address") - - if(!H5F_addr_defined(src_oloc->addr) || src_oloc->addr == 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "undefined reference pointer") - dst_oloc->addr = HADDR_UNDEF; - - /* Attempt to copy object from source to destination file */ - if(H5O__copy_obj_by_ref(src_oloc, dst_oloc, dst_root_loc, cpy_info) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object") - - /* Set the object reference info for the destination file */ - if(H5VL_native_addr_to_token(dst_oloc->file, H5I_FILE, dst_oloc->addr, &tmp_token) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSERIALIZE, FAIL, "can't serialize address into object token") - if(H5R__encode_token_obj_compat((const H5O_token_t *)&tmp_token, token_size, dst_buf, &buf_size) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, FAIL, "unable to encode dst object address") + else { + /* Set up for the object copy for the reference */ + if(H5R__decode_token_obj_compat(src_buf, &buf_size, &tmp_token, token_size) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, FAIL, "unable to decode src object address") + if(H5VL_native_token_to_addr(src_oloc->file, H5I_FILE, tmp_token, &src_oloc->addr) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTUNSERIALIZE, FAIL, "can't deserialize object token into address") + + if(!H5F_addr_defined(src_oloc->addr) || src_oloc->addr == 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "undefined reference pointer") + dst_oloc->addr = HADDR_UNDEF; + + /* Attempt to copy object from source to destination file */ + if(H5O__copy_obj_by_ref(src_oloc, dst_oloc, dst_root_loc, cpy_info) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object") + + /* Set the object reference info for the destination file */ + if(H5VL_native_addr_to_token(dst_oloc->file, H5I_FILE, dst_oloc->addr, &tmp_token) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSERIALIZE, FAIL, "can't serialize address into object token") + if(H5R__encode_token_obj_compat((const H5O_token_t *)&tmp_token, token_size, dst_buf, &buf_size) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, FAIL, "unable to encode dst object address") + } /* end else */ } /* end for */ done: @@ -242,42 +241,41 @@ H5O__copy_expand_ref_region1(H5O_loc_t *src_oloc, const void *buf_src, uint8_t *q; /* If data is not initialized, copy zeros and skip */ - if(0 == HDmemcmp(src_buf, zeros, buf_size)) { + if(0 == HDmemcmp(src_buf, zeros, buf_size)) HDmemset(dst_buf, 0, buf_size); - continue; - } - - /* Read from heap */ - if(H5R__decode_heap(src_oloc->file, src_buf, &buf_size, &data, &data_size) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, FAIL, "unable to decode dataset region information") - - /* Get object address */ - p = (const uint8_t *)data; - H5F_addr_decode(src_oloc->file, &p, &src_oloc->addr); - if(!H5F_addr_defined(src_oloc->addr) || src_oloc->addr == 0) { - H5MM_free(data); - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "undefined reference pointer") - } - dst_oloc->addr = HADDR_UNDEF; - - /* Attempt to copy object from source to destination file */ - if(H5O__copy_obj_by_ref(src_oloc, dst_oloc, dst_root_loc, cpy_info) < 0) { + else { + /* Read from heap */ + if(H5R__decode_heap(src_oloc->file, src_buf, &buf_size, &data, &data_size) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, FAIL, "unable to decode dataset region information") + + /* Get object address */ + p = (const uint8_t *)data; + H5F_addr_decode(src_oloc->file, &p, &src_oloc->addr); + if(!H5F_addr_defined(src_oloc->addr) || src_oloc->addr == 0) { + H5MM_free(data); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "undefined reference pointer") + } + dst_oloc->addr = HADDR_UNDEF; + + /* Attempt to copy object from source to destination file */ + if(H5O__copy_obj_by_ref(src_oloc, dst_oloc, dst_root_loc, cpy_info) < 0) { + H5MM_free(data); + HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object") + } /* end if */ + + /* Serialize object addr */ + q = (uint8_t *)data; + H5F_addr_encode(dst_oloc->file, &q, dst_oloc->addr); + + /* Write to heap */ + if(H5R__encode_heap(dst_oloc->file, dst_buf, &buf_size, data, (size_t)data_size) < 0) { + H5MM_free(data); + HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode dataset region information") + } + + /* Free the buffer allocated in H5R__decode_heap() */ H5MM_free(data); - HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object") - } /* end if */ - - /* Serialize object addr */ - q = (uint8_t *)data; - H5F_addr_encode(dst_oloc->file, &q, dst_oloc->addr); - - /* Write to heap */ - if(H5R__encode_heap(dst_oloc->file, dst_buf, &buf_size, data, (size_t)data_size) < 0) { - H5MM_free(data); - HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode dataset region information") - } - - /* Free the buffer allocated in H5R__decode_heap() */ - H5MM_free(data); + } /* end else */ } /* end for */ done: diff --git a/src/H5Odbg.c b/src/H5Odbg.c index 3c91cae..b476b17 100644 --- a/src/H5Odbg.c +++ b/src/H5Odbg.c @@ -15,7 +15,7 @@ * * Created: H5Odbg.c * Nov 17 2006 - * Quincey Koziol + * Quincey Koziol * * Purpose: Object header debugging routines. * @@ -84,7 +84,6 @@ * Return: SUCCEED (Doesn't fail, just crashes) * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Oct 17 2006 * *------------------------------------------------------------------------- @@ -236,7 +235,6 @@ H5O__assert(const H5O_t *oh) * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 13 2003 * *------------------------------------------------------------------------- @@ -277,7 +275,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 6 1997 * *------------------------------------------------------------------------- @@ -544,7 +541,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 6 1997 * *------------------------------------------------------------------------- diff --git a/src/H5Odeprec.c b/src/H5Odeprec.c index aca0d59..b37fde5 100644 --- a/src/H5Odeprec.c +++ b/src/H5Odeprec.c @@ -13,7 +13,7 @@ /*------------------------------------------------------------------------- * - * Purpose: Deprecated functions from the H5O interface. These + * Purpose: Deprecated functions from the H5O interface. These * functions are here for compatibility purposes and may be * removed in the future. Applications should switch to the * newer APIs. diff --git a/src/H5Odrvinfo.c b/src/H5Odrvinfo.c index eb678e4..dffacfd 100644 --- a/src/H5Odrvinfo.c +++ b/src/H5Odrvinfo.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol +/* Programmer: Quincey Koziol * Thursday, March 1, 2007 * * Purpose: A message holding driver info settings @@ -27,11 +27,11 @@ #include "H5Opkg.h" /* Object headers */ #include "H5MMprivate.h" /* Memory management */ -static void *H5O_drvinfo_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, +static void *H5O__drvinfo_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p); -static herr_t H5O_drvinfo_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); -static void *H5O_drvinfo_copy(const void *_mesg, void *_dest); -static size_t H5O_drvinfo_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); +static herr_t H5O__drvinfo_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); +static void *H5O__drvinfo_copy(const void *_mesg, void *_dest); +static size_t H5O__drvinfo_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); static herr_t H5O__drvinfo_reset(void *_mesg); static herr_t H5O__drvinfo_debug(H5F_t *f, const void *_mesg, FILE *stream, int indent, int fwidth); @@ -41,23 +41,23 @@ const H5O_msg_class_t H5O_MSG_DRVINFO[1] = {{ H5O_DRVINFO_ID, /*message id number */ "driver info", /*message name for debugging */ sizeof(H5O_drvinfo_t), /*native message size */ - 0, /* messages are sharable? */ - H5O_drvinfo_decode, /*decode message */ - H5O_drvinfo_encode, /*encode message */ - H5O_drvinfo_copy, /*copy the native value */ - H5O_drvinfo_size, /*raw message size */ + 0, /* messages are sharable? */ + H5O__drvinfo_decode, /*decode message */ + H5O__drvinfo_encode, /*encode message */ + H5O__drvinfo_copy, /*copy the native value */ + H5O__drvinfo_size, /*raw message size */ H5O__drvinfo_reset, /*free internal memory */ NULL, /* free method */ NULL, /* file delete method */ NULL, /* link method */ - NULL, /*set share 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__drvinfo_debug /*debug the message */ + H5O__drvinfo_debug /*debug the message */ }}; /* Current version of driver info information */ @@ -65,7 +65,7 @@ const H5O_msg_class_t H5O_MSG_DRVINFO[1] = {{ /*------------------------------------------------------------------------- - * Function: H5O_drvinfo_decode + * Function: H5O__drvinfo_decode * * Purpose: Decode a shared message table message and return a pointer * to a newly allocated H5O_drvinfo_t struct. @@ -79,14 +79,14 @@ const H5O_msg_class_t H5O_MSG_DRVINFO[1] = {{ *------------------------------------------------------------------------- */ static void * -H5O_drvinfo_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, +H5O__drvinfo_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, size_t H5_ATTR_UNUSED p_size, const uint8_t *p) { H5O_drvinfo_t *mesg; /* Native message */ void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity check */ HDassert(f); @@ -123,11 +123,11 @@ H5O_drvinfo_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_drvinfo_decode() */ +} /* end H5O__drvinfo_decode() */ /*------------------------------------------------------------------------- - * Function: H5O_drvinfo_encode + * Function: H5O__drvinfo_encode * * Purpose: Encode a v1 B-tree 'K' value message. * @@ -139,11 +139,11 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_drvinfo_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) +H5O__drvinfo_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) { const H5O_drvinfo_t *mesg = (const H5O_drvinfo_t *)_mesg; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity check */ HDassert(f); @@ -159,11 +159,11 @@ H5O_drvinfo_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_share H5MM_memcpy(p, mesg->buf, mesg->len); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5O_drvinfo_encode() */ +} /* end H5O__drvinfo_encode() */ /*------------------------------------------------------------------------- - * Function: H5O_drvinfo_copy + * Function: H5O__drvinfo_copy * * Purpose: Copies a message from _MESG to _DEST, allocating _DEST if * necessary. @@ -177,13 +177,13 @@ H5O_drvinfo_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_share *------------------------------------------------------------------------- */ static void * -H5O_drvinfo_copy(const void *_mesg, void *_dest) +H5O__drvinfo_copy(const void *_mesg, void *_dest) { const H5O_drvinfo_t *mesg = (const H5O_drvinfo_t *)_mesg; H5O_drvinfo_t *dest = (H5O_drvinfo_t *)_dest; void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity check */ HDassert(mesg); @@ -207,11 +207,11 @@ H5O_drvinfo_copy(const void *_mesg, void *_dest) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_drvinfo_copy() */ +} /* end H5O__drvinfo_copy() */ /*------------------------------------------------------------------------- - * Function: H5O_drvinfo_size + * Function: H5O__drvinfo_size * * Purpose: Returns the size of the raw message in bytes not counting the * message type or size fields, but only the data fields. @@ -225,12 +225,12 @@ done: *------------------------------------------------------------------------- */ static size_t -H5O_drvinfo_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, const void *_mesg) +H5O__drvinfo_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, const void *_mesg) { const H5O_drvinfo_t *mesg = (const H5O_drvinfo_t *)_mesg; size_t ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity check */ HDassert(f); @@ -242,7 +242,7 @@ H5O_drvinfo_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_s mesg->len; /* Buffer */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_drvinfo_size() */ +} /* end H5O__drvinfo_size() */ /*------------------------------------------------------------------------- @@ -254,7 +254,6 @@ H5O_drvinfo_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_s * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Mar 1 2007 * *------------------------------------------------------------------------- diff --git a/src/H5Odtype.c b/src/H5Odtype.c index 6eaaae9..80dbae9 100644 --- a/src/H5Odtype.c +++ b/src/H5Odtype.c @@ -28,16 +28,16 @@ /* PRIVATE PROTOTYPES */ -static herr_t H5O_dtype_encode(H5F_t *f, uint8_t *p, const void *mesg); -static void *H5O_dtype_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, +static herr_t H5O__dtype_encode(H5F_t *f, uint8_t *p, const void *mesg); +static void *H5O__dtype_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p); -static void *H5O_dtype_copy(const void *_mesg, void *_dest); -static size_t H5O_dtype_size(const H5F_t *f, const void *_mesg); +static void *H5O__dtype_copy(const void *_mesg, void *_dest); +static size_t H5O__dtype_size(const H5F_t *f, const void *_mesg); static herr_t H5O__dtype_reset(void *_mesg); static herr_t H5O__dtype_free(void *_mesg); -static herr_t H5O_dtype_set_share(void *_mesg, const H5O_shared_t *sh); -static htri_t H5O_dtype_can_share(const void *_mesg); -static herr_t H5O_dtype_pre_copy_file(H5F_t *file_src, const void *mesg_src, +static herr_t H5O__dtype_set_share(void *_mesg, const H5O_shared_t *sh); +static htri_t H5O__dtype_can_share(const void *_mesg); +static herr_t H5O__dtype_pre_copy_file(H5F_t *file_src, const void *mesg_src, hbool_t *deleted, const H5O_copy_t *cpy_info, void *_udata); static void *H5O__dtype_copy_file(H5F_t *file_src, const H5O_msg_class_t *mesg_type, void *native_src, H5F_t *file_dst, hbool_t *recompute_size, @@ -50,22 +50,22 @@ static herr_t H5O__dtype_debug(H5F_t *f, const void *_mesg, FILE * stream, /* Set up & include shared message "interface" info */ #define H5O_SHARED_TYPE H5O_MSG_DTYPE -#define H5O_SHARED_DECODE H5O_dtype_shared_decode -#define H5O_SHARED_DECODE_REAL H5O_dtype_decode -#define H5O_SHARED_ENCODE H5O_dtype_shared_encode -#define H5O_SHARED_ENCODE_REAL H5O_dtype_encode -#define H5O_SHARED_SIZE H5O_dtype_shared_size -#define H5O_SHARED_SIZE_REAL H5O_dtype_size +#define H5O_SHARED_DECODE H5O__dtype_shared_decode +#define H5O_SHARED_DECODE_REAL H5O__dtype_decode +#define H5O_SHARED_ENCODE H5O__dtype_shared_encode +#define H5O_SHARED_ENCODE_REAL H5O__dtype_encode +#define H5O_SHARED_SIZE H5O__dtype_shared_size +#define H5O_SHARED_SIZE_REAL H5O__dtype_size #define H5O_SHARED_DELETE H5O__dtype_shared_delete #undef H5O_SHARED_DELETE_REAL #define H5O_SHARED_LINK H5O__dtype_shared_link #undef H5O_SHARED_LINK_REAL #define H5O_SHARED_COPY_FILE H5O__dtype_shared_copy_file #define H5O_SHARED_COPY_FILE_REAL H5O__dtype_copy_file -#define H5O_SHARED_POST_COPY_FILE H5O_dtype_shared_post_copy_file +#define H5O_SHARED_POST_COPY_FILE H5O__dtype_shared_post_copy_file #undef H5O_SHARED_POST_COPY_FILE_REAL #define H5O_SHARED_POST_COPY_FILE_UPD H5O__dtype_shared_post_copy_upd -#define H5O_SHARED_DEBUG H5O_dtype_shared_debug +#define H5O_SHARED_DEBUG H5O__dtype_shared_debug #define H5O_SHARED_DEBUG_REAL H5O__dtype_debug #include "H5Oshared.h" /* Shared Object Header Message Callbacks */ @@ -94,27 +94,27 @@ const H5O_msg_class_t H5O_MSG_DTYPE[1] = {{ "datatype", /* message name for debugging */ sizeof(H5T_t), /* native message size */ H5O_SHARE_IS_SHARABLE|H5O_SHARE_IN_OHDR, /* messages are sharable? */ - H5O_dtype_shared_decode, /* decode message */ - H5O_dtype_shared_encode, /* encode message */ - H5O_dtype_copy, /* copy the native value */ - H5O_dtype_shared_size, /* size of raw message */ + H5O__dtype_shared_decode, /* decode message */ + H5O__dtype_shared_encode, /* encode message */ + H5O__dtype_copy, /* copy the native value */ + H5O__dtype_shared_size, /* size of raw message */ H5O__dtype_reset, /* reset method */ H5O__dtype_free, /* free method */ H5O__dtype_shared_delete, /* file delete method */ H5O__dtype_shared_link, /* link method */ - H5O_dtype_set_share, /* set share method */ - H5O_dtype_can_share, /* can share method */ - H5O_dtype_pre_copy_file, /* pre copy native value to file */ + H5O__dtype_set_share, /* set share method */ + H5O__dtype_can_share, /* can share method */ + H5O__dtype_pre_copy_file, /* pre copy native value to file */ H5O__dtype_shared_copy_file, /* copy native value to file */ - H5O_dtype_shared_post_copy_file, /* post copy native value to file */ + H5O__dtype_shared_post_copy_file, /* post copy native value to file */ NULL, /* get creation index */ NULL, /* set creation index */ - H5O_dtype_shared_debug /* debug the message */ + H5O__dtype_shared_debug /* debug the message */ }}; /*------------------------------------------------------------------------- - * Function: H5O_dtype_decode_helper + * Function: H5O__dtype_decode_helper * * Purpose: Decodes a datatype * @@ -129,14 +129,14 @@ const H5O_msg_class_t H5O_MSG_DTYPE[1] = {{ *------------------------------------------------------------------------- */ static htri_t -H5O_dtype_decode_helper(unsigned *ioflags/*in,out*/, const uint8_t **pp, H5T_t *dt) +H5O__dtype_decode_helper(unsigned *ioflags/*in,out*/, const uint8_t **pp, H5T_t *dt) { unsigned flags, version; unsigned i; size_t z; htri_t ret_value = FALSE; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(pp && *pp); @@ -331,7 +331,7 @@ H5O_dtype_decode_helper(unsigned *ioflags/*in,out*/, const uint8_t **pp, H5T_t * HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") /* Decode the field's datatype information */ - if((can_upgrade = H5O_dtype_decode_helper(ioflags, pp, temp_type)) < 0) { + if((can_upgrade = H5O__dtype_decode_helper(ioflags, pp, temp_type)) < 0) { for(j = 0; j <= i; j++) H5MM_xfree(dt->shared->u.compnd.memb[j].name); H5MM_xfree(dt->shared->u.compnd.memb); @@ -439,15 +439,15 @@ H5O_dtype_decode_helper(unsigned *ioflags/*in,out*/, const uint8_t **pp, H5T_t * /* Set reference type */ dt->shared->u.atomic.u.r.rtype = (H5R_type_t)(flags & 0x0f); if(dt->shared->u.atomic.u.r.rtype <= H5R_BADTYPE - || dt->shared->u.atomic.u.r.rtype >= H5R_MAXTYPE) + || dt->shared->u.atomic.u.r.rtype >= H5R_MAXTYPE) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDECODE, FAIL, "invalid reference type"); /* Set generic flag */ if(dt->shared->u.atomic.u.r.rtype == H5R_OBJECT2 - || dt->shared->u.atomic.u.r.rtype == H5R_DATASET_REGION2 - || dt->shared->u.atomic.u.r.rtype == H5R_ATTR) { - dt->shared->u.atomic.u.r.opaque = TRUE; - dt->shared->u.atomic.u.r.version = (unsigned)((flags >> 4) & 0x0f); + || dt->shared->u.atomic.u.r.rtype == H5R_DATASET_REGION2 + || dt->shared->u.atomic.u.r.rtype == H5R_ATTR) { + dt->shared->u.atomic.u.r.opaque = TRUE; + dt->shared->u.atomic.u.r.version = (unsigned)((flags >> 4) & 0x0f); if(dt->shared->u.atomic.u.r.version != H5R_ENCODE_VERSION) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDECODE, FAIL, "reference version does not match"); } else @@ -469,7 +469,7 @@ H5O_dtype_decode_helper(unsigned *ioflags/*in,out*/, const uint8_t **pp, H5T_t * dt->shared->u.enumer.nmembs = dt->shared->u.enumer.nalloc = flags & 0xffff; if(NULL == (dt->shared->parent = H5T__alloc())) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") - if(H5O_dtype_decode_helper(ioflags, pp, dt->shared->parent) < 0) + if(H5O__dtype_decode_helper(ioflags, pp, dt->shared->parent) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDECODE, FAIL, "unable to decode parent datatype") /* Check if the parent of this enum has a version greater than the @@ -511,7 +511,7 @@ H5O_dtype_decode_helper(unsigned *ioflags/*in,out*/, const uint8_t **pp, H5T_t * /* Decode base type of VL information */ if(NULL == (dt->shared->parent = H5T__alloc())) HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "memory allocation failed") - if(H5O_dtype_decode_helper(ioflags, pp, dt->shared->parent) < 0) + if(H5O__dtype_decode_helper(ioflags, pp, dt->shared->parent) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDECODE, FAIL, "unable to decode VL parent type") /* Check if the parent of this vlen has a version greater than the @@ -552,7 +552,7 @@ H5O_dtype_decode_helper(unsigned *ioflags/*in,out*/, const uint8_t **pp, H5T_t * /* Decode base type of array */ if(NULL == (dt->shared->parent = H5T__alloc())) HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "memory allocation failed") - if(H5O_dtype_decode_helper(ioflags, pp, dt->shared->parent) < 0) + if(H5O__dtype_decode_helper(ioflags, pp, dt->shared->parent) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDECODE, FAIL, "unable to decode array parent type") /* Check if the parent of this array has a version greater than the @@ -579,20 +579,19 @@ H5O_dtype_decode_helper(unsigned *ioflags/*in,out*/, const uint8_t **pp, H5T_t * } /* end switch */ done: - if(ret_value < 0) { + if(ret_value < 0) if(dt != NULL) { if(dt->shared != NULL) dt->shared = H5FL_FREE(H5T_shared_t, dt->shared); dt = H5FL_FREE(H5T_t, dt); } /* end if */ - } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_dtype_decode_helper() */ +} /* end H5O__dtype_decode_helper() */ /*------------------------------------------------------------------------- - * Function: H5O_dtype_encode_helper + * Function: H5O__dtype_encode_helper * * Purpose: Encodes a datatype. * @@ -608,7 +607,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_dtype_encode_helper(uint8_t **pp, const H5T_t *dt) +H5O__dtype_encode_helper(uint8_t **pp, const H5T_t *dt) { unsigned flags = 0; uint8_t *hdr = (uint8_t *)*pp; @@ -616,7 +615,7 @@ H5O_dtype_encode_helper(uint8_t **pp, const H5T_t *dt) size_t n, z; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(pp && *pp); @@ -968,7 +967,7 @@ H5O_dtype_encode_helper(uint8_t **pp, const H5T_t *dt) } /* end if */ /* Subtype */ - if(H5O_dtype_encode_helper(pp, dt->shared->u.compnd.memb[i].type) < 0) + if(H5O__dtype_encode_helper(pp, dt->shared->u.compnd.memb[i].type) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "unable to encode member type") } /* end for */ } @@ -990,7 +989,7 @@ H5O_dtype_encode_helper(uint8_t **pp, const H5T_t *dt) flags = dt->shared->u.enumer.nmembs & 0xffff; /* Parent type */ - if(H5O_dtype_encode_helper(pp, dt->shared->parent) < 0) + if(H5O__dtype_encode_helper(pp, dt->shared->parent) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "unable to encode parent datatype") /* Names, each a multiple of eight bytes */ @@ -1026,7 +1025,7 @@ H5O_dtype_encode_helper(uint8_t **pp, const H5T_t *dt) } /* end if */ /* Encode base type of VL information */ - if(H5O_dtype_encode_helper(pp, dt->shared->parent) < 0) + if(H5O__dtype_encode_helper(pp, dt->shared->parent) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "unable to encode VL parent type") break; @@ -1064,7 +1063,7 @@ H5O_dtype_encode_helper(uint8_t **pp, const H5T_t *dt) } /* end if */ /* Encode base type of array's information */ - if(H5O_dtype_encode_helper(pp, dt->shared->parent) < 0) + if(H5O__dtype_encode_helper(pp, dt->shared->parent) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "unable to encode VL parent type") break; @@ -1083,20 +1082,23 @@ H5O_dtype_encode_helper(uint8_t **pp, const H5T_t *dt) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_dtype_encode_helper() */ +} /* end H5O__dtype_encode_helper() */ /*-------------------------------------------------------------------------- NAME - H5O_dtype_decode + H5O__dtype_decode PURPOSE Decode a message and return a pointer to a memory struct with the decoded information USAGE - void *H5O_dtype_decode(f, mesg_flags, p) - H5F_t *f; IN: pointer to the HDF5 file struct + void *H5O__dtype_decode(f, mesg_flags, p) + H5F_t *f; IN: pointer to the HDF5 file struct + H5O_t *open_oh; IN: pointer to the object header unsigned mesg_flags; IN: Message flags to influence decoding - const uint8 *p; IN: the raw information buffer + unsigned *ioflags; IN/OUT: flags for decoding + size_t p_size; IN: size of buffer *p + const uint8_t *p; IN: the raw information buffer RETURNS Pointer to the new message in native order on success, NULL on failure DESCRIPTION @@ -1105,13 +1107,13 @@ done: function using malloc() and is returned to the caller. --------------------------------------------------------------------------*/ static void * -H5O_dtype_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, +H5O__dtype_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, unsigned *ioflags/*in,out*/, size_t H5_ATTR_UNUSED p_size, const uint8_t *p) { H5T_t *dt = NULL; void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(p); @@ -1121,7 +1123,7 @@ H5O_dtype_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigne HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Perform actual decode of message */ - if(H5O_dtype_decode_helper(ioflags, &p, dt) < 0) + if(H5O__dtype_decode_helper(ioflags, &p, dt) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDECODE, NULL, "can't decode type") /* Set return value */ @@ -1129,16 +1131,16 @@ H5O_dtype_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigne done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_dtype_decode() */ +} /* end H5O__dtype_decode() */ /*-------------------------------------------------------------------------- NAME - H5O_dtype_encode + H5O__dtype_encode PURPOSE Encode a simple datatype message USAGE - herr_t H5O_dtype_encode(f, raw_size, p, mesg) + herr_t H5O__dtype_encode(f, raw_size, p, mesg) H5F_t *f; IN: pointer to the HDF5 file struct size_t raw_size; IN: size of the raw information buffer const uint8 *p; IN: the raw information buffer @@ -1150,12 +1152,12 @@ done: message in the "raw" disk form. --------------------------------------------------------------------------*/ static herr_t -H5O_dtype_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p, const void *mesg) +H5O__dtype_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p, const void *mesg) { const H5T_t *dt = (const H5T_t *) mesg; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(f); @@ -1163,21 +1165,21 @@ H5O_dtype_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p, const void *mesg) HDassert(dt); /* encode */ - if(H5O_dtype_encode_helper(&p, dt) < 0) + if(H5O__dtype_encode_helper(&p, dt) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "can't encode type") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_dtype_encode() */ +} /* end H5O__dtype_encode() */ /*-------------------------------------------------------------------------- NAME - H5O_dtype_copy + H5O__dtype_copy PURPOSE Copies a message from MESG to DEST, allocating DEST if necessary. USAGE - void *H5O_dtype_copy(mesg, dest) + void *H5O__dtype_copy(mesg, dest) const void *mesg; IN: Pointer to the source simple datatype struct const void *dest; IN: Pointer to the destination simple @@ -1189,13 +1191,13 @@ done: allocating the destination structure if necessary. --------------------------------------------------------------------------*/ static void * -H5O_dtype_copy(const void *_src, void *_dst) +H5O__dtype_copy(const void *_src, void *_dst) { const H5T_t *src = (const H5T_t *) _src; H5T_t *dst; void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(src); @@ -1216,16 +1218,16 @@ H5O_dtype_copy(const void *_src, void *_dst) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_dtype_copy() */ +} /* end H5O__dtype_copy() */ /*-------------------------------------------------------------------------- NAME - H5O_dtype_size + H5O__dtype_size PURPOSE Return the raw message size in bytes USAGE - void *H5O_dtype_size(f, mesg) + void *H5O__dtype_size(f, mesg) H5F_t *f; IN: pointer to the HDF5 file struct const void *mesg; IN: Pointer to the source simple datatype struct RETURNS @@ -1236,13 +1238,13 @@ done: portion of the message). It doesn't take into account alignment. --------------------------------------------------------------------------*/ static size_t -H5O_dtype_size(const H5F_t *f, const void *_mesg) +H5O__dtype_size(const H5F_t *f, const void *_mesg) { const H5T_t *dt = (const H5T_t *)_mesg; unsigned u; /* Local index variable */ size_t ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(f); HDassert(dt); @@ -1306,13 +1308,13 @@ H5O_dtype_size(const H5F_t *f, const void *_mesg) 4 + /*permutation*/ 4 + /*reserved*/ 16; /*dimensions*/ - ret_value += H5O_dtype_size(f, dt->shared->u.compnd.memb[u].type); + ret_value += H5O__dtype_size(f, dt->shared->u.compnd.memb[u].type); } /* end for */ } break; case H5T_ENUM: - ret_value += H5O_dtype_size(f, dt->shared->parent); + ret_value += H5O__dtype_size(f, dt->shared->parent); for(u = 0; u < dt->shared->u.enumer.nmembs; u++) { size_t name_len; /* Length of field's name */ @@ -1329,7 +1331,7 @@ H5O_dtype_size(const H5F_t *f, const void *_mesg) break; case H5T_VLEN: - ret_value += H5O_dtype_size(f, dt->shared->parent); + ret_value += H5O__dtype_size(f, dt->shared->parent); break; case H5T_ARRAY: @@ -1339,7 +1341,7 @@ H5O_dtype_size(const H5F_t *f, const void *_mesg) ret_value += 4 * dt->shared->u.array.ndims; /* dimensions */ if(dt->shared->version < H5O_DTYPE_VERSION_3) ret_value += 4 * dt->shared->u.array.ndims; /* dimension permutations */ - ret_value += H5O_dtype_size(f, dt->shared->parent); + ret_value += H5O__dtype_size(f, dt->shared->parent); break; case H5T_NO_CLASS: @@ -1352,7 +1354,7 @@ H5O_dtype_size(const H5F_t *f, const void *_mesg) } /* end switch */ FUNC_LEAVE_NOAPI(ret_value) -} /* H5O_dtype_size() */ +} /* H5O__dtype_size() */ /*------------------------------------------------------------------------- @@ -1414,7 +1416,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_dtype_set_share + * Function: H5O__dtype_set_share * * Purpose: Copies sharing information from SH into the message. * @@ -1426,12 +1428,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_dtype_set_share(void *_mesg/*in,out*/, const H5O_shared_t *sh) +H5O__dtype_set_share(void *_mesg/*in,out*/, const H5O_shared_t *sh) { H5T_t *dt = (H5T_t *)_mesg; herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(dt); HDassert(sh); @@ -1462,11 +1464,11 @@ H5O_dtype_set_share(void *_mesg/*in,out*/, const H5O_shared_t *sh) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_dtype_set_share() */ +} /* end H5O__dtype_set_share() */ /*------------------------------------------------------------------------- - * Function: H5O_dtype_can_share + * Function: H5O__dtype_can_share * * Purpose: Determines if this datatype is allowed to be shared or * not. Immutable datatypes or datatypes that are already @@ -1482,13 +1484,13 @@ done: *------------------------------------------------------------------------- */ static htri_t -H5O_dtype_can_share(const void *_mesg) +H5O__dtype_can_share(const void *_mesg) { const H5T_t *mesg = (const H5T_t *)_mesg; htri_t tri_ret; htri_t ret_value = TRUE; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(mesg); @@ -1506,11 +1508,11 @@ H5O_dtype_can_share(const void *_mesg) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_dtype_can_share() */ +} /* end H5O__dtype_can_share() */ /*------------------------------------------------------------------------- - * Function: H5O_dtype_pre_copy_file + * Function: H5O__dtype_pre_copy_file * * Purpose: Perform any necessary actions before copying message between * files @@ -1525,7 +1527,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_dtype_pre_copy_file(H5F_t *file_src, const void *mesg_src, +H5O__dtype_pre_copy_file(H5F_t *file_src, const void *mesg_src, hbool_t H5_ATTR_UNUSED *deleted, const H5O_copy_t *cpy_info, void *_udata) { @@ -1533,7 +1535,7 @@ H5O_dtype_pre_copy_file(H5F_t *file_src, const void *mesg_src, H5D_copy_file_ud_t *udata = (H5D_copy_file_ud_t *)_udata; /* Dataset copying user data */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(file_src); @@ -1565,7 +1567,7 @@ H5O_dtype_pre_copy_file(H5F_t *file_src, const void *mesg_src, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_dtype_pre_copy_file() */ +} /* end H5O__dtype_pre_copy_file() */ /*------------------------------------------------------------------------- @@ -1592,7 +1594,7 @@ H5O__dtype_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const H5O_msg_class_t *mesg FUNC_ENTER_STATIC /* Perform a normal copy of the object header message */ - if(NULL == (dst_mesg = (H5T_t *)H5O_dtype_copy(native_src, NULL))) + if(NULL == (dst_mesg = (H5T_t *)H5O__dtype_copy(native_src, NULL))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy") /* The datatype will be in the new file; set its location. */ @@ -1639,9 +1641,8 @@ H5O__dtype_shared_post_copy_upd(const H5O_loc_t H5_ATTR_UNUSED *src_oloc, dt_dst->oloc.file = dt_dst->sh_loc.file; dt_dst->oloc.addr = dt_dst->sh_loc.u.loc.oh_addr; } /* end if */ - else { + else HDassert(!H5T_is_named(dt_dst)); - } done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Oefl.c b/src/H5Oefl.c index b18d819..83bab09 100644 --- a/src/H5Oefl.c +++ b/src/H5Oefl.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, November 25, 1997 */ @@ -27,11 +27,11 @@ #include "H5Opkg.h" /* Object headers */ /* PRIVATE PROTOTYPES */ -static void *H5O_efl_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, +static void *H5O__efl_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p); -static herr_t H5O_efl_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); -static void *H5O_efl_copy(const void *_mesg, void *_dest); -static size_t H5O_efl_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); +static herr_t H5O__efl_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); +static void *H5O__efl_copy(const void *_mesg, void *_dest); +static size_t H5O__efl_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); static herr_t H5O__efl_reset(void *_mesg); static void *H5O__efl_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst, hbool_t *recompute_size, unsigned *mesg_flags, @@ -45,10 +45,10 @@ const H5O_msg_class_t H5O_MSG_EFL[1] = {{ "external file list", /*message name for debugging */ sizeof(H5O_efl_t), /*native message size */ 0, /* messages are sharable? */ - H5O_efl_decode, /*decode message */ - H5O_efl_encode, /*encode message */ - H5O_efl_copy, /*copy native value */ - H5O_efl_size, /*size of message on disk */ + H5O__efl_decode, /*decode message */ + H5O__efl_encode, /*encode message */ + H5O__efl_copy, /*copy native value */ + H5O__efl_size, /*size of message on disk */ H5O__efl_reset, /*reset method */ NULL, /* free method */ NULL, /* file delete method */ @@ -67,7 +67,7 @@ const H5O_msg_class_t H5O_MSG_EFL[1] = {{ /*------------------------------------------------------------------------- - * Function: H5O_efl_decode + * Function: H5O__efl_decode * * Purpose: Decode an external file list message and return a pointer to * the message (and some other data). @@ -87,7 +87,7 @@ const H5O_msg_class_t H5O_MSG_EFL[1] = {{ *------------------------------------------------------------------------- */ static void * -H5O_efl_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, +H5O__efl_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, size_t H5_ATTR_UNUSED p_size, const uint8_t *p) { @@ -98,7 +98,7 @@ H5O_efl_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, size_t u; /* Local index variable */ void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check args */ HDassert(f); @@ -177,11 +177,11 @@ done: H5MM_xfree(mesg); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_efl_decode() */ +} /* end H5O__efl_decode() */ /*------------------------------------------------------------------------- - * Function: H5O_efl_encode + * Function: H5O__efl_encode * * Purpose: Encodes a message. * @@ -193,12 +193,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_efl_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) +H5O__efl_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) { const H5O_efl_t *mesg = (const H5O_efl_t *)_mesg; size_t u; /* Local index variable */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* check args */ HDassert(f); @@ -236,11 +236,11 @@ H5O_efl_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, cons } /* end for */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5O_efl_encode() */ +} /* end H5O__efl_encode() */ /*------------------------------------------------------------------------- - * Function: H5O_efl_copy + * Function: H5O__efl_copy * * Purpose: Copies a message from _MESG to _DEST, allocating _DEST if * necessary. @@ -255,7 +255,7 @@ H5O_efl_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, cons *------------------------------------------------------------------------- */ static void * -H5O_efl_copy(const void *_mesg, void *_dest) +H5O__efl_copy(const void *_mesg, void *_dest) { const H5O_efl_t *mesg = (const H5O_efl_t *) _mesg; H5O_efl_t *dest = (H5O_efl_t *) _dest; @@ -263,7 +263,7 @@ H5O_efl_copy(const void *_mesg, void *_dest) hbool_t slot_allocated = FALSE; /* Flag to indicate that dynamic allocation has begun */ void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(mesg); @@ -303,11 +303,11 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_efl_copy() */ +} /* end H5O__efl_copy() */ /*------------------------------------------------------------------------- - * Function: H5O_efl_size + * Function: H5O__efl_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 @@ -324,27 +324,27 @@ done: *------------------------------------------------------------------------- */ static size_t -H5O_efl_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void *_mesg) +H5O__efl_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void *_mesg) { const H5O_efl_t *mesg = (const H5O_efl_t *) _mesg; size_t ret_value = 0; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* check args */ HDassert(f); HDassert(mesg); ret_value = (size_t)H5F_SIZEOF_ADDR(f) + /*heap address */ - 2 + /*slots allocated*/ - 2 + /*num slots used*/ - 4 + /*reserved */ + 2 + /*slots allocated*/ + 2 + /*num slots used*/ + 4 + /*reserved */ mesg->nused * ((size_t)H5F_SIZEOF_SIZE(f) + /*name offset */ (size_t)H5F_SIZEOF_SIZE(f) + /*file offset */ (size_t)H5F_SIZEOF_SIZE(f)); /*file size */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_efl_size() */ +} /* end H5O__efl_size() */ /*------------------------------------------------------------------------- @@ -402,11 +402,11 @@ H5O__efl_reset(void *_mesg) *------------------------------------------------------------------------- */ hsize_t -H5O_efl_total_size (H5O_efl_t *efl) +H5O_efl_total_size(H5O_efl_t *efl) { hsize_t ret_value = 0, tmp; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_NOAPI(0) if(efl->nused > 0 && H5O_EFL_UNLIMITED == efl->slot[efl->nused - 1].size) ret_value = H5O_EFL_UNLIMITED; diff --git a/src/H5Ofill.c b/src/H5Ofill.c index cb75bc3..b9422fb 100644 --- a/src/H5Ofill.c +++ b/src/H5Ofill.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Robb Matzke +/* Programmer: Robb Matzke * Wednesday, September 30, 1998 * * Purpose: The fill message indicates a bit pattern to use for @@ -32,15 +32,15 @@ #include "H5Sprivate.h" /* Dataspaces */ -static void *H5O_fill_old_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, +static void *H5O__fill_old_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p); -static herr_t H5O_fill_old_encode(H5F_t *f, uint8_t *p, const void *_mesg); -static size_t H5O_fill_old_size(const H5F_t *f, const void *_mesg); -static void *H5O_fill_new_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, +static herr_t H5O__fill_old_encode(H5F_t *f, uint8_t *p, const void *_mesg); +static size_t H5O__fill_old_size(const H5F_t *f, const void *_mesg); +static void *H5O__fill_new_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p); -static herr_t H5O_fill_new_encode(H5F_t *f, uint8_t *p, const void *_mesg); -static size_t H5O_fill_new_size(const H5F_t *f, const void *_mesg); -static void *H5O_fill_copy(const void *_mesg, void *_dest); +static herr_t H5O__fill_new_encode(H5F_t *f, uint8_t *p, const void *_mesg); +static size_t H5O__fill_new_size(const H5F_t *f, const void *_mesg); +static void *H5O__fill_copy(const void *_mesg, void *_dest); static herr_t H5O__fill_reset(void *_mesg); static herr_t H5O__fill_free(void *_mesg); static herr_t H5O__fill_pre_copy_file(H5F_t *file_src, const void *mesg_src, @@ -49,59 +49,59 @@ static herr_t H5O__fill_debug(H5F_t *f, const void *_mesg, FILE *stream, int indent, int fwidth); /* Set up & include shared message "interface" info */ -#define H5O_SHARED_TYPE H5O_MSG_FILL -#define H5O_SHARED_DECODE H5O_fill_shared_decode -#define H5O_SHARED_DECODE_REAL H5O_fill_old_decode -#define H5O_SHARED_ENCODE H5O_fill_shared_encode -#define H5O_SHARED_ENCODE_REAL H5O_fill_old_encode -#define H5O_SHARED_SIZE H5O_fill_shared_size -#define H5O_SHARED_SIZE_REAL H5O_fill_old_size -#define H5O_SHARED_DELETE H5O__fill_shared_delete +#define H5O_SHARED_TYPE H5O_MSG_FILL +#define H5O_SHARED_DECODE H5O__fill_shared_decode +#define H5O_SHARED_DECODE_REAL H5O__fill_old_decode +#define H5O_SHARED_ENCODE H5O__fill_shared_encode +#define H5O_SHARED_ENCODE_REAL H5O__fill_old_encode +#define H5O_SHARED_SIZE H5O__fill_shared_size +#define H5O_SHARED_SIZE_REAL H5O__fill_old_size +#define H5O_SHARED_DELETE H5O__fill_shared_delete #undef H5O_SHARED_DELETE_REAL -#define H5O_SHARED_LINK H5O__fill_shared_link +#define H5O_SHARED_LINK H5O__fill_shared_link #undef H5O_SHARED_LINK_REAL -#define H5O_SHARED_COPY_FILE H5O__fill_shared_copy_file +#define H5O_SHARED_COPY_FILE H5O__fill_shared_copy_file #undef H5O_SHARED_COPY_FILE_REAL -#define H5O_SHARED_POST_COPY_FILE H5O_fill_shared_post_copy_file +#define H5O_SHARED_POST_COPY_FILE H5O__fill_shared_post_copy_file #undef H5O_SHARED_POST_COPY_FILE_REAL #undef H5O_SHARED_POST_COPY_FILE_UPD -#define H5O_SHARED_DEBUG H5O_fill_shared_debug -#define H5O_SHARED_DEBUG_REAL H5O__fill_debug -#include "H5Oshared.h" /* Shared Object Header Message Callbacks */ +#define H5O_SHARED_DEBUG H5O__fill_shared_debug +#define H5O_SHARED_DEBUG_REAL H5O__fill_debug +#include "H5Oshared.h" /* Shared Object Header Message Callbacks */ /* Set up & include shared message "interface" info */ /* (Kludgy 'undef's in order to re-include the H5Oshared.h header) */ #undef H5O_SHARED_TYPE -#define H5O_SHARED_TYPE H5O_MSG_FILL_NEW +#define H5O_SHARED_TYPE H5O_MSG_FILL_NEW #undef H5O_SHARED_DECODE -#define H5O_SHARED_DECODE H5O_fill_new_shared_decode +#define H5O_SHARED_DECODE H5O__fill_new_shared_decode #undef H5O_SHARED_DECODE_REAL -#define H5O_SHARED_DECODE_REAL H5O_fill_new_decode +#define H5O_SHARED_DECODE_REAL H5O__fill_new_decode #undef H5O_SHARED_ENCODE -#define H5O_SHARED_ENCODE H5O_fill_new_shared_encode +#define H5O_SHARED_ENCODE H5O__fill_new_shared_encode #undef H5O_SHARED_ENCODE_REAL -#define H5O_SHARED_ENCODE_REAL H5O_fill_new_encode +#define H5O_SHARED_ENCODE_REAL H5O__fill_new_encode #undef H5O_SHARED_SIZE -#define H5O_SHARED_SIZE H5O_fill_new_shared_size +#define H5O_SHARED_SIZE H5O__fill_new_shared_size #undef H5O_SHARED_SIZE_REAL -#define H5O_SHARED_SIZE_REAL H5O_fill_new_size +#define H5O_SHARED_SIZE_REAL H5O__fill_new_size #undef H5O_SHARED_DELETE -#define H5O_SHARED_DELETE H5O__fill_new_shared_delete +#define H5O_SHARED_DELETE H5O__fill_new_shared_delete #undef H5O_SHARED_DELETE_REAL #undef H5O_SHARED_LINK -#define H5O_SHARED_LINK H5O__fill_new_shared_link +#define H5O_SHARED_LINK H5O__fill_new_shared_link #undef H5O_SHARED_LINK_REAL #undef H5O_SHARED_COPY_FILE -#define H5O_SHARED_COPY_FILE H5O__fill_new_shared_copy_file +#define H5O_SHARED_COPY_FILE H5O__fill_new_shared_copy_file #undef H5O_SHARED_COPY_FILE_REAL #undef H5O_SHARED_POST_COPY_FILE -#define H5O_SHARED_POST_COPY_FILE H5O_fill_new_shared_post_copy_file +#define H5O_SHARED_POST_COPY_FILE H5O__fill_new_shared_post_copy_file #undef H5O_SHARED_POST_COPY_FILE_REAL #undef H5O_SHARED_POST_COPY_FILE_UPD #undef H5O_SHARED_DEBUG -#define H5O_SHARED_DEBUG H5O_fill_new_shared_debug +#define H5O_SHARED_DEBUG H5O__fill_new_shared_debug #undef H5O_SHARED_DEBUG_REAL -#define H5O_SHARED_DEBUG_REAL H5O__fill_debug +#define H5O_SHARED_DEBUG_REAL H5O__fill_debug #undef H5Oshared_H #include "H5Oshared.h" /* Shared Object Header Message Callbacks */ @@ -110,11 +110,11 @@ const H5O_msg_class_t H5O_MSG_FILL[1] = {{ H5O_FILL_ID, /*message id number */ "fill", /*message name for debugging */ sizeof(H5O_fill_t), /*native message size */ - H5O_SHARE_IS_SHARABLE|H5O_SHARE_IN_OHDR, /* messages are sharable? */ - H5O_fill_shared_decode, /*decode message */ - H5O_fill_shared_encode, /*encode message */ - H5O_fill_copy, /*copy the native value */ - H5O_fill_shared_size, /*raw message size */ + H5O_SHARE_IS_SHARABLE | H5O_SHARE_IN_OHDR, /* messages are sharable? */ + H5O__fill_shared_decode, /*decode message */ + H5O__fill_shared_encode, /*encode message */ + H5O__fill_copy, /*copy the native value */ + H5O__fill_shared_size, /*raw message size */ H5O__fill_reset, /*free internal memory */ H5O__fill_free, /* free method */ H5O__fill_shared_delete, /* file delete method */ @@ -123,10 +123,10 @@ const H5O_msg_class_t H5O_MSG_FILL[1] = {{ NULL, /*can share method */ H5O__fill_pre_copy_file, /* pre copy native value to file */ H5O__fill_shared_copy_file, /* copy native value to file */ - H5O_fill_shared_post_copy_file, /* post copy native value to file */ + H5O__fill_shared_post_copy_file, /* post copy native value to file */ NULL, /* get creation index */ NULL, /* set creation index */ - H5O_fill_shared_debug /*debug the message */ + H5O__fill_shared_debug /*debug the message */ }}; /* This message derives from H5O message class, for new fill value after version 1.4 */ @@ -134,11 +134,11 @@ const H5O_msg_class_t H5O_MSG_FILL_NEW[1] = {{ H5O_FILL_NEW_ID, /*message id number */ "fill_new", /*message name for debugging */ sizeof(H5O_fill_t), /*native message size */ - H5O_SHARE_IS_SHARABLE|H5O_SHARE_IN_OHDR, /* messages are sharable? */ - H5O_fill_new_shared_decode, /*decode message */ - H5O_fill_new_shared_encode, /*encode message */ - H5O_fill_copy, /*copy the native value */ - H5O_fill_new_shared_size, /*raw message size */ + H5O_SHARE_IS_SHARABLE | H5O_SHARE_IN_OHDR, /* messages are sharable? */ + H5O__fill_new_shared_decode, /*decode message */ + H5O__fill_new_shared_encode, /*encode message */ + H5O__fill_copy, /*copy the native value */ + H5O__fill_new_shared_size, /*raw message size */ H5O__fill_reset, /*free internal memory */ H5O__fill_free, /* free method */ H5O__fill_new_shared_delete, /* file delete method */ @@ -146,11 +146,11 @@ const H5O_msg_class_t H5O_MSG_FILL_NEW[1] = {{ NULL, /* set share method */ NULL, /*can share method */ H5O__fill_pre_copy_file, /* pre copy native value to file */ - H5O__fill_new_shared_copy_file, /* copy native value to file */ - H5O_fill_new_shared_post_copy_file, /* post copy native value to file */ + H5O__fill_new_shared_copy_file, /* copy native value to file */ + H5O__fill_new_shared_post_copy_file, /* post copy native value to file */ NULL, /* get creation index */ NULL, /* set creation index */ - H5O_fill_new_shared_debug /*debug the message */ + H5O__fill_new_shared_debug /*debug the message */ }}; /* Format version bounds for fill value */ @@ -179,7 +179,7 @@ H5FL_BLK_EXTERN(type_conv); /*------------------------------------------------------------------------- - * Function: H5O_fill_new_decode + * Function: H5O__fill_new_decode * * Purpose: Decode a new fill value message. The new fill value * message is fill value plus space allocation time and @@ -194,14 +194,14 @@ H5FL_BLK_EXTERN(type_conv); *------------------------------------------------------------------------- */ static void * -H5O_fill_new_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, +H5O__fill_new_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, size_t p_size, const uint8_t *p) { H5O_fill_t *fill = NULL; void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(f); HDassert(p); @@ -277,10 +277,9 @@ H5O_fill_new_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, /* Set the "defined" flag */ fill->fill_defined = TRUE; } /* end else */ - else { + else /* Set the "defined" flag */ fill->fill_defined = TRUE; - } /* end else */ } /* end else */ /* Set return value */ @@ -294,11 +293,11 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_fill_new_decode() */ +} /* end H5O__fill_new_decode() */ /*------------------------------------------------------------------------- - * Function: H5O_fill_old_decode + * Function: H5O__fill_old_decode * * Purpose: Decode an old fill value message. * @@ -311,7 +310,7 @@ done: *------------------------------------------------------------------------- */ static void * -H5O_fill_old_decode(H5F_t *f, H5O_t *open_oh, +H5O__fill_old_decode(H5F_t *f, H5O_t *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, size_t p_size, const uint8_t *p) { @@ -320,7 +319,7 @@ H5O_fill_old_decode(H5F_t *f, H5O_t *open_oh, H5T_t *dt = NULL; void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(f); HDassert(p); @@ -375,11 +374,11 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_fill_old_decode() */ +} /* end H5O__fill_old_decode() */ /*------------------------------------------------------------------------- - * Function: H5O_fill_new_encode + * Function: H5O__fill_new_encode * * Purpose: Encode a new fill value message. The new fill value * message is fill value plus space allocation time and @@ -393,11 +392,11 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_fill_new_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p, const void *_fill) +H5O__fill_new_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p, const void *_fill) { const H5O_fill_t *fill = (const H5O_fill_t *)_fill; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(f); HDassert(p); @@ -473,11 +472,11 @@ H5O_fill_new_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p, const void *_fill) } /* end else */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5O_fill_new_encode() */ +} /* end H5O__fill_new_encode() */ /*------------------------------------------------------------------------- - * Function: H5O_fill_old_encode + * Function: H5O__fill_old_encode * * Purpose: Encode an old fill value message. * @@ -489,11 +488,11 @@ H5O_fill_new_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p, const void *_fill) *------------------------------------------------------------------------- */ static herr_t -H5O_fill_old_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p, const void *_fill) +H5O__fill_old_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p, const void *_fill) { const H5O_fill_t *fill = (const H5O_fill_t *)_fill; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(f); HDassert(p); @@ -504,11 +503,11 @@ H5O_fill_old_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p, const void *_fill) H5MM_memcpy(p, fill->buf, (size_t)fill->size); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5O_fill_old_encode() */ +} /* end H5O__fill_old_encode() */ /*------------------------------------------------------------------------- - * Function: H5O_fill_copy + * Function: H5O__fill_copy * * Purpose: Copies a message from _MESG to _DEST, allocating _DEST if * necessary. The new fill value message is fill value plus @@ -524,13 +523,13 @@ H5O_fill_old_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p, const void *_fill) *------------------------------------------------------------------------- */ static void * -H5O_fill_copy(const void *_src, void *_dst) +H5O__fill_copy(const void *_src, void *_dst) { const H5O_fill_t *src = (const H5O_fill_t *)_src; H5O_fill_t *dst = (H5O_fill_t *)_dst; void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(src); @@ -621,11 +620,11 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_fill_copy() */ +} /* end H5O__fill_copy() */ /*------------------------------------------------------------------------- - * Function: H5O_fill_new_size + * Function: H5O__fill_new_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 @@ -642,40 +641,40 @@ done: *------------------------------------------------------------------------- */ static size_t -H5O_fill_new_size(const H5F_t H5_ATTR_UNUSED *f, const void *_fill) +H5O__fill_new_size(const H5F_t H5_ATTR_UNUSED *f, const void *_fill) { const H5O_fill_t *fill = (const H5O_fill_t *)_fill; size_t ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(f); HDassert(fill); /* Determine size for different versions */ if(fill->version < H5O_FILL_VERSION_3) { - ret_value = 1 + /* Version number */ - 1 + /* Space allocation time */ - 1 + /* Fill value write time */ - 1; /* Fill value defined */ + ret_value = 1 + /* Version number */ + 1 + /* Space allocation time */ + 1 + /* Fill value write time */ + 1; /* Fill value defined */ if(fill->fill_defined) - ret_value += 4 + /* Fill value size */ + ret_value += 4 + /* Fill value size */ (fill->size > 0 ? (size_t)fill->size : 0); /* Size of fill value */ } /* end if */ else { - ret_value = 1 + /* Version number */ - 1; /* Status flags */ + ret_value = 1 + /* Version number */ + 1; /* Status flags */ if(fill->size > 0) - ret_value += 4 + /* Fill value size */ - (size_t)fill->size; /* Size of fill value */ + ret_value += 4 + /* Fill value size */ + (size_t)fill->size; /* Size of fill value */ } /* end else */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_fill_new_size() */ +} /* end H5O__fill_new_size() */ /*------------------------------------------------------------------------- - * Function: H5O_fill_old_size + * Function: H5O__fill_old_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 @@ -690,16 +689,16 @@ H5O_fill_new_size(const H5F_t H5_ATTR_UNUSED *f, const void *_fill) *------------------------------------------------------------------------- */ static size_t -H5O_fill_old_size(const H5F_t H5_ATTR_UNUSED *f, const void *_fill) +H5O__fill_old_size(const H5F_t H5_ATTR_UNUSED *f, const void *_fill) { const H5O_fill_t *fill = (const H5O_fill_t *)_fill; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(fill); FUNC_LEAVE_NOAPI(4 + (size_t)fill->size) -} /* end H5O_fill_old_size() */ +} /* end H5O__fill_old_size() */ /*------------------------------------------------------------------------- @@ -987,7 +986,7 @@ H5O_fill_convert(H5O_fill_t *fill, H5T_t *dset_type, hbool_t *fill_changed) hid_t src_id = -1, dst_id = -1; /* Datatype identifiers */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_NOAPI(FAIL) HDassert(fill); HDassert(dset_type); diff --git a/src/H5Oflush.c b/src/H5Oflush.c index 898184b..703fbbe 100644 --- a/src/H5Oflush.c +++ b/src/H5Oflush.c @@ -15,7 +15,7 @@ * * Created: H5Oflush.c * Aug 19, 2010 - * Mike McGreevy + * Mike McGreevy * * Purpose: Object flush/refresh routines. * @@ -62,7 +62,7 @@ static herr_t H5O__refresh_metadata_close(hid_t oid, H5O_loc_t oloc, * * Purpose: Flushes all buffers associated with an object to disk. * - * Return: SUCCEED/FAIL + * Return: Non-negative on success, negative on failure * * Programmer: Mike McGreevy * May 19, 2010 @@ -85,7 +85,7 @@ H5Oflush(hid_t obj_id) /* Set up collective metadata if appropriate */ if(H5CX_set_loc(obj_id) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info") + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_SELF; @@ -169,7 +169,7 @@ H5O_flush_common(H5O_loc_t *oloc, hid_t obj_id) /* Flush metadata based on tag value of the object */ if(H5F_flush_tagged_metadata(oloc->file, tag) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush tagged metadata") + HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush tagged metadata") /* Check to invoke callback */ if(H5F_object_flush_cb(oloc->file, obj_id) < 0) @@ -226,7 +226,7 @@ done: * * Purpose: Refreshes all buffers associated with an object. * - * Return: SUCCEED/FAIL + * Return: Non-negative on success, negative on failure * * Programmer: Mike McGreevy * July 28, 2010 @@ -395,32 +395,32 @@ H5O__refresh_metadata_close(hid_t oid, H5O_loc_t oloc, H5G_loc_t *obj_loc) /* Handle close for multiple dataset opens */ if(H5I_get_type(oid) == H5I_DATASET) if(H5D_mult_refresh_close(oid) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to prepare refresh for dataset") + HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to prepare refresh for dataset") /* Retrieve tag for object */ if(H5O__oh_tag(&oloc, &tag) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to get object header address") + HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to get object header address") /* Get cork status of the object with tag */ if(H5AC_cork(oloc.file, tag, H5AC__GET_CORKED, &corked) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_SYSTEM, FAIL, "unable to retrieve an object's cork status") + HGOTO_ERROR(H5E_OHDR, H5E_SYSTEM, FAIL, "unable to retrieve an object's cork status") /* Close the object */ if(H5I_dec_ref(oid) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to close object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to close object") /* Flush metadata based on tag value of the object */ if(H5F_flush_tagged_metadata(oloc.file, tag) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush tagged metadata") + HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush tagged metadata") /* Evict the object's tagged metadata */ if(H5F_evict_tagged_metadata(oloc.file, tag) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to evict metadata") + HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to evict metadata") /* Re-cork object with tag */ if(corked) if(H5AC_cork(oloc.file, tag, H5AC__SET_CORK, &corked) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_SYSTEM, FAIL, "unable to cork the object") + HGOTO_ERROR(H5E_OHDR, H5E_SYSTEM, FAIL, "unable to cork the object") done: FUNC_LEAVE_NOAPI(ret_value); diff --git a/src/H5Ofsinfo.c b/src/H5Ofsinfo.c index 78e8e19..d0f447c 100644 --- a/src/H5Ofsinfo.c +++ b/src/H5Ofsinfo.c @@ -15,7 +15,7 @@ * * Created: H5Ofsinfo.c * Feb 2009 - * Vailin Choi + * Vailin Choi * * Purpose: File space info message. * @@ -25,44 +25,44 @@ #include "H5Omodule.h" /* This source code file is part of the H5O module */ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ #include "H5Fpkg.h" /* File access */ -#include "H5FLprivate.h" /* Free lists */ -#include "H5Opkg.h" /* Object headers */ +#include "H5FLprivate.h" /* Free lists */ +#include "H5Opkg.h" /* Object headers */ /* PRIVATE PROTOTYPES */ -static void *H5O_fsinfo_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, +static void *H5O__fsinfo_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size, 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_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, 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 */ + 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 */ }}; /* Format version bounds for fsinfo message */ @@ -81,7 +81,7 @@ H5FL_DEFINE_STATIC(H5O_fsinfo_t); /*------------------------------------------------------------------------- - * Function: H5O_fsinfo_decode + * Function: H5O__fsinfo_decode * * Purpose: Decode a message and return a pointer to a newly allocated one. * @@ -93,7 +93,7 @@ H5FL_DEFINE_STATIC(H5O_fsinfo_t); *------------------------------------------------------------------------- */ static void * -H5O_fsinfo_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, +H5O__fsinfo_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, size_t H5_ATTR_UNUSED p_size, const uint8_t *p) { @@ -102,7 +102,7 @@ H5O_fsinfo_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned vers; /* message version */ void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(f); @@ -110,7 +110,7 @@ H5O_fsinfo_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, /* Allocate space for message */ if(NULL == (fsinfo = H5FL_CALLOC(H5O_fsinfo_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") for(ptype = H5F_MEM_PAGE_SUPER; ptype < H5F_MEM_PAGE_NTYPES; ptype++) fsinfo->fs_addr[ptype - 1] = HADDR_UNDEF; @@ -134,7 +134,6 @@ H5O_fsinfo_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, /* Map version 0 (deprecated) to version 1 message */ switch(strategy) { - case H5F_FILE_SPACE_ALL_PERSIST: fsinfo->strategy = H5F_FSPACE_STRATEGY_FSM_AGGR; fsinfo->persist = TRUE; @@ -166,8 +165,8 @@ H5O_fsinfo_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, fsinfo->version = H5O_FSINFO_VERSION_1; fsinfo->mapped = TRUE; - - } else { + } + else { HDassert(vers >= H5O_FSINFO_VERSION_1); fsinfo->version = vers; @@ -180,10 +179,9 @@ H5O_fsinfo_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, H5F_addr_decode(f, &p, &(fsinfo->eoa_pre_fsm_fsalloc)); /* EOA before free-space header and section info */ /* Decode addresses of free space managers, if persisting */ - if(fsinfo->persist) { + if(fsinfo->persist) for(ptype = H5F_MEM_PAGE_SUPER; ptype < H5F_MEM_PAGE_NTYPES; ptype++) H5F_addr_decode(f, &p, &(fsinfo->fs_addr[ptype - 1])); - } /* end if */ fsinfo->mapped = FALSE; } @@ -196,11 +194,11 @@ done: fsinfo = H5FL_FREE(H5O_fsinfo_t, fsinfo); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_fsinfo_decode() */ +} /* end H5O__fsinfo_decode() */ /*------------------------------------------------------------------------- - * Function: H5O_fsinfo_encode + * Function: H5O__fsinfo_encode * * Purpose: Encodes a message. * @@ -211,12 +209,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_fsinfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) +H5O__fsinfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) { const H5O_fsinfo_t *fsinfo = (const H5O_fsinfo_t *)_mesg; H5F_mem_page_t ptype; /* Memory type for iteration */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* check args */ HDassert(f); @@ -233,18 +231,17 @@ H5O_fsinfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, c H5F_addr_encode(f, &p, fsinfo->eoa_pre_fsm_fsalloc); /* EOA before free-space header and section info */ /* Store addresses of free-space managers, if persisting */ - if(fsinfo->persist) { + if(fsinfo->persist) /* Addresses of free-space managers */ for(ptype = H5F_MEM_PAGE_SUPER; ptype < H5F_MEM_PAGE_NTYPES; ptype++) H5F_addr_encode(f, &p, fsinfo->fs_addr[ptype - 1]); - } /* end if */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5O_fsinfo_encode() */ +} /* end H5O__fsinfo_encode() */ /*------------------------------------------------------------------------- - * Function: H5O_fsinfo_copy + * Function: H5O__fsinfo_copy * * Purpose: Copies a message from _MESG to _DEST, allocating _DEST if * necessary. @@ -257,13 +254,13 @@ H5O_fsinfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, c *------------------------------------------------------------------------- */ static void * -H5O_fsinfo_copy(const void *_mesg, void *_dest) +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 = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(fsinfo); @@ -278,11 +275,11 @@ H5O_fsinfo_copy(const void *_mesg, void *_dest) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_fsinfo_copy() */ +} /* end H5O__fsinfo_copy() */ /*------------------------------------------------------------------------- - * Function: H5O_fsinfo_size + * 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. @@ -296,12 +293,12 @@ done: *------------------------------------------------------------------------- */ static size_t -H5O_fsinfo_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void *_mesg) +H5O__fsinfo_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void *_mesg) { const H5O_fsinfo_t *fsinfo = (const H5O_fsinfo_t *)_mesg; size_t ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR ret_value = 3 /* Version, strategy & persist */ + (size_t)H5F_SIZEOF_SIZE(f) /* Free-space section threshold */ @@ -314,7 +311,7 @@ H5O_fsinfo_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const voi ret_value += (H5F_MEM_PAGE_NTYPES - 1) * (size_t)H5F_SIZEOF_ADDR(f); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_fsinfo_size() */ +} /* end H5O__fsinfo_size() */ /*------------------------------------------------------------------------- @@ -342,6 +339,79 @@ H5O__fsinfo_free(void *mesg) /*------------------------------------------------------------------------- + * 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 H5_ATTR_UNUSED *f, const void *_mesg, FILE * stream, + int indent, int fwidth) +{ + const H5O_fsinfo_t *fsinfo = (const H5O_fsinfo_t *) _mesg; + H5F_mem_page_t ptype; /* Free-space types for iteration */ + + FUNC_ENTER_STATIC_NOERR + + /* check args */ + HDassert(f); + HDassert(fsinfo); + HDassert(stream); + HDassert(indent >= 0); + HDassert(fwidth >= 0); + + HDfprintf(stream, "%*s%-*s ", indent, "", fwidth, "File space strategy:"); + switch(fsinfo->strategy) { + case H5F_FSPACE_STRATEGY_FSM_AGGR: + HDfprintf(stream, "%s\n", "H5F_FSPACE_STRATEGY_FSM_AGGR"); + break; + + case H5F_FSPACE_STRATEGY_PAGE: + HDfprintf(stream, "%s\n", "H5F_FSPACE_STRATEGY_PAGE"); + break; + + case H5F_FSPACE_STRATEGY_AGGR: + HDfprintf(stream, "%s\n", "H5F_FSPACE_STRATEGY_AGGR"); + break; + + case H5F_FSPACE_STRATEGY_NONE: + HDfprintf(stream, "%s\n", "H5F_FSPACE_STRATEGY_NONE"); + break; + + case H5F_FSPACE_STRATEGY_NTYPES: + default: + HDfprintf(stream, "%s\n", "unknown"); + } /* end switch */ + + HDfprintf(stream, "%*s%-*s %t\n", indent, "", fwidth, + "Free-space persist:", fsinfo->persist); + + HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, + "Free-space section threshold:", fsinfo->threshold); + + HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, + "File space page size:", fsinfo->page_size); + + HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + "Page end metadata threshold:", fsinfo->pgend_meta_thres); + + HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, + "eoa_pre_fsm_fsalloc:", fsinfo->eoa_pre_fsm_fsalloc); + + if(fsinfo->persist) + for(ptype = H5F_MEM_PAGE_SUPER; ptype < H5F_MEM_PAGE_NTYPES; ptype++) + HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, + "Free space manager address:", fsinfo->fs_addr[ptype-1]); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5O__fsinfo_debug() */ + +/*------------------------------------------------------------------------- * Function: H5O_fsinfo_set_version * * Purpose: Set the version to encode the fsinfo message with. @@ -414,77 +484,3 @@ done: } /* end H5O_fsinfo_check_version() */ -/*------------------------------------------------------------------------- - * 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 H5_ATTR_UNUSED *f, const void *_mesg, FILE * stream, - int indent, int fwidth) -{ - const H5O_fsinfo_t *fsinfo = (const H5O_fsinfo_t *) _mesg; - H5F_mem_page_t ptype; /* Free-space types for iteration */ - - FUNC_ENTER_STATIC_NOERR - - /* check args */ - HDassert(f); - HDassert(fsinfo); - HDassert(stream); - HDassert(indent >= 0); - HDassert(fwidth >= 0); - - HDfprintf(stream, "%*s%-*s ", indent, "", fwidth, "File space strategy:"); - switch(fsinfo->strategy) { - case H5F_FSPACE_STRATEGY_FSM_AGGR: - HDfprintf(stream, "%s\n", "H5F_FSPACE_STRATEGY_FSM_AGGR"); - break; - - case H5F_FSPACE_STRATEGY_PAGE: - HDfprintf(stream, "%s\n", "H5F_FSPACE_STRATEGY_PAGE"); - break; - - case H5F_FSPACE_STRATEGY_AGGR: - HDfprintf(stream, "%s\n", "H5F_FSPACE_STRATEGY_AGGR"); - break; - - case H5F_FSPACE_STRATEGY_NONE: - HDfprintf(stream, "%s\n", "H5F_FSPACE_STRATEGY_NONE"); - break; - - case H5F_FSPACE_STRATEGY_NTYPES: - default: - HDfprintf(stream, "%s\n", "unknown"); - } /* end switch */ - - HDfprintf(stream, "%*s%-*s %t\n", indent, "", fwidth, - "Free-space persist:", fsinfo->persist); - - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, - "Free-space section threshold:", fsinfo->threshold); - - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, - "File space page size:", fsinfo->page_size); - - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "Page end metadata threshold:", fsinfo->pgend_meta_thres); - - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, - "eoa_pre_fsm_fsalloc:", fsinfo->eoa_pre_fsm_fsalloc); - - if(fsinfo->persist) { - for(ptype = H5F_MEM_PAGE_SUPER; ptype < H5F_MEM_PAGE_NTYPES; ptype++) - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, - "Free space manager address:", fsinfo->fs_addr[ptype-1]); - } /* end if */ - - FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5O__fsinfo_debug() */ - diff --git a/src/H5Oginfo.c b/src/H5Oginfo.c index d6190c6..75016e5 100644 --- a/src/H5Oginfo.c +++ b/src/H5Oginfo.c @@ -15,7 +15,7 @@ * * Created: H5Oginfo.c * Aug 23 2005 - * Quincey Koziol + * Quincey Koziol * * Purpose: Group Information messages. * @@ -32,11 +32,11 @@ /* PRIVATE PROTOTYPES */ -static void *H5O_ginfo_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, +static void *H5O__ginfo_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p); -static herr_t H5O_ginfo_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); -static void *H5O_ginfo_copy(const void *_mesg, void *_dest); -static size_t H5O_ginfo_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); +static herr_t H5O__ginfo_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); +static void *H5O__ginfo_copy(const void *_mesg, void *_dest); +static size_t H5O__ginfo_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); static herr_t H5O__ginfo_free(void *_mesg); static herr_t H5O__ginfo_debug(H5F_t *f, const void *_mesg, FILE * stream, int indent, int fwidth); @@ -47,10 +47,10 @@ const H5O_msg_class_t H5O_MSG_GINFO[1] = {{ "ginfo", /*message name for debugging */ sizeof(H5O_ginfo_t), /*native message size */ 0, /* messages are sharable? */ - H5O_ginfo_decode, /*decode message */ - H5O_ginfo_encode, /*encode message */ - H5O_ginfo_copy, /*copy the native value */ - H5O_ginfo_size, /*size of symbol table entry */ + H5O__ginfo_decode, /*decode message */ + H5O__ginfo_encode, /*encode message */ + H5O__ginfo_copy, /*copy the native value */ + H5O__ginfo_size, /*size of symbol table entry */ NULL, /*default reset method */ H5O__ginfo_free, /* free method */ NULL, /* file delete method */ @@ -78,7 +78,7 @@ H5FL_DEFINE_STATIC(H5O_ginfo_t); /*------------------------------------------------------------------------- - * Function: H5O_ginfo_decode + * Function: H5O__ginfo_decode * * Purpose: Decode a message and return a pointer to * a newly allocated one. @@ -88,13 +88,12 @@ H5FL_DEFINE_STATIC(H5O_ginfo_t); * Failure: NULL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Aug 30 2005 * *------------------------------------------------------------------------- */ static void * -H5O_ginfo_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, +H5O__ginfo_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, size_t H5_ATTR_UNUSED p_size, const uint8_t *p) { @@ -102,7 +101,7 @@ H5O_ginfo_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned char flags; /* Flags for encoding group info */ void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(p); @@ -151,29 +150,28 @@ done: ginfo = H5FL_FREE(H5O_ginfo_t, ginfo); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_ginfo_decode() */ +} /* end H5O__ginfo_decode() */ /*------------------------------------------------------------------------- - * Function: H5O_ginfo_encode + * Function: H5O__ginfo_encode * * Purpose: Encodes a message. * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Aug 30 2005 * *------------------------------------------------------------------------- */ static herr_t -H5O_ginfo_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) +H5O__ginfo_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) { const H5O_ginfo_t *ginfo = (const H5O_ginfo_t *) _mesg; unsigned char flags = 0; /* Flags for encoding group info */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* check args */ HDassert(p); @@ -200,11 +198,11 @@ H5O_ginfo_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, } /* end if */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5O_ginfo_encode() */ +} /* end H5O__ginfo_encode() */ /*------------------------------------------------------------------------- - * Function: H5O_ginfo_copy + * Function: H5O__ginfo_copy * * Purpose: Copies a message from _MESG to _DEST, allocating _DEST if * necessary. @@ -214,19 +212,18 @@ H5O_ginfo_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, * Failure: NULL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Aug 30 2005 * *------------------------------------------------------------------------- */ static void * -H5O_ginfo_copy(const void *_mesg, void *_dest) +H5O__ginfo_copy(const void *_mesg, void *_dest) { const H5O_ginfo_t *ginfo = (const H5O_ginfo_t *)_mesg; H5O_ginfo_t *dest = (H5O_ginfo_t *)_dest; void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(ginfo); @@ -241,11 +238,11 @@ H5O_ginfo_copy(const void *_mesg, void *_dest) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_ginfo_copy() */ +} /* end H5O__ginfo_copy() */ /*------------------------------------------------------------------------- - * Function: H5O_ginfo_size + * Function: H5O__ginfo_size * * Purpose: Returns the size of the raw message in bytes not counting * the message type or size fields, but only the data fields. @@ -256,33 +253,32 @@ done: * Failure: zero * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Aug 30 2005 * *------------------------------------------------------------------------- */ static size_t -H5O_ginfo_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, const void *_mesg) +H5O__ginfo_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, const void *_mesg) { const H5O_ginfo_t *ginfo = (const H5O_ginfo_t *)_mesg; size_t ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Set return value */ ret_value = 1 + /* Version */ 1 + /* Flags */ (ginfo->store_link_phase_change ? ( - (size_t)(2 + /* "Max compact" links */ - 2) /* "Min dense" links */ + (size_t)(2 + /* "Max compact" links */ + 2) /* "Min dense" links */ ) : 0) + /* "Min dense" links */ (ginfo->store_est_entry_info ? ( - (size_t)(2 + /* Estimated # of entries in group */ - 2) /* Estimated length of name of entry in group */ + (size_t)(2 + /* Estimated # of entries in group */ + 2) /* Estimated length of name of entry in group */ ) : 0); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_ginfo_size() */ +} /* end H5O__ginfo_size() */ /*------------------------------------------------------------------------- @@ -300,7 +296,7 @@ H5O_ginfo_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_sha static herr_t H5O__ginfo_free(void *mesg) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(mesg); @@ -318,7 +314,6 @@ H5O__ginfo_free(void *mesg) * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Aug 30 2005 * *------------------------------------------------------------------------- diff --git a/src/H5Oint.c b/src/H5Oint.c index 04220af..e41f0fe 100644 --- a/src/H5Oint.c +++ b/src/H5Oint.c @@ -99,36 +99,36 @@ hbool_t H5_PKG_INIT_VAR = FALSE; * message. */ const H5O_msg_class_t *const H5O_msg_class_g[] = { - H5O_MSG_NULL, /*0x0000 Null */ - H5O_MSG_SDSPACE, /*0x0001 Dataspace */ - H5O_MSG_LINFO, /*0x0002 Link information */ - H5O_MSG_DTYPE, /*0x0003 Datatype */ - H5O_MSG_FILL, /*0x0004 Old data storage -- fill value */ - H5O_MSG_FILL_NEW, /*0x0005 New data storage -- fill value */ - H5O_MSG_LINK, /*0x0006 Link */ - H5O_MSG_EFL, /*0x0007 Data storage -- external data files */ - H5O_MSG_LAYOUT, /*0x0008 Data Layout */ + H5O_MSG_NULL, /*0x0000 Null */ + H5O_MSG_SDSPACE, /*0x0001 Dataspace */ + H5O_MSG_LINFO, /*0x0002 Link information */ + H5O_MSG_DTYPE, /*0x0003 Datatype */ + H5O_MSG_FILL, /*0x0004 Old data storage -- fill value */ + H5O_MSG_FILL_NEW, /*0x0005 New data storage -- fill value */ + H5O_MSG_LINK, /*0x0006 Link */ + H5O_MSG_EFL, /*0x0007 Data storage -- external data files */ + H5O_MSG_LAYOUT, /*0x0008 Data Layout */ #ifdef H5O_ENABLE_BOGUS - H5O_MSG_BOGUS_VALID, /*0x0009 "Bogus valid" (for testing) */ + H5O_MSG_BOGUS_VALID, /*0x0009 "Bogus valid" (for testing) */ #else /* H5O_ENABLE_BOGUS */ - NULL, /*0x0009 "Bogus valid" (for testing) */ + NULL, /*0x0009 "Bogus valid" (for testing) */ #endif /* H5O_ENABLE_BOGUS */ - H5O_MSG_GINFO, /*0x000A Group information */ - H5O_MSG_PLINE, /*0x000B Data storage -- filter pipeline */ - H5O_MSG_ATTR, /*0x000C Attribute */ - H5O_MSG_NAME, /*0x000D Object name */ - H5O_MSG_MTIME, /*0x000E Object modification date and time */ - H5O_MSG_SHMESG, /*0x000F File-wide shared message table */ - H5O_MSG_CONT, /*0x0010 Object header continuation */ - H5O_MSG_STAB, /*0x0011 Symbol table */ - H5O_MSG_MTIME_NEW, /*0x0012 New Object modification date and time */ - H5O_MSG_BTREEK, /*0x0013 Non-default v1 B-tree 'K' values */ - H5O_MSG_DRVINFO, /*0x0014 Driver info settings */ - H5O_MSG_AINFO, /*0x0015 Attribute information */ - H5O_MSG_REFCOUNT, /*0x0016 Object's ref. count */ - H5O_MSG_FSINFO, /*0x0017 Free-space manager info */ - H5O_MSG_MDCI, /*0x0018 Metadata cache image */ - H5O_MSG_UNKNOWN /*0x0019 Placeholder for unknown message */ + H5O_MSG_GINFO, /*0x000A Group information */ + H5O_MSG_PLINE, /*0x000B Data storage -- filter pipeline */ + H5O_MSG_ATTR, /*0x000C Attribute */ + H5O_MSG_NAME, /*0x000D Object name */ + H5O_MSG_MTIME, /*0x000E Object modification date and time */ + H5O_MSG_SHMESG, /*0x000F File-wide shared message table */ + H5O_MSG_CONT, /*0x0010 Object header continuation */ + H5O_MSG_STAB, /*0x0011 Symbol table */ + H5O_MSG_MTIME_NEW, /*0x0012 New Object modification date and time */ + H5O_MSG_BTREEK, /*0x0013 Non-default v1 B-tree 'K' values */ + H5O_MSG_DRVINFO, /*0x0014 Driver info settings */ + H5O_MSG_AINFO, /*0x0015 Attribute information */ + H5O_MSG_REFCOUNT, /*0x0016 Object's ref. count */ + H5O_MSG_FSINFO, /*0x0017 Free-space manager info */ + H5O_MSG_MDCI, /*0x0018 Metadata cache image */ + H5O_MSG_UNKNOWN /*0x0019 Placeholder for unknown message */ }; /* Format version bounds for object header */ @@ -219,7 +219,7 @@ H5O__init_package(void) /*------------------------------------------------------------------------- - * Function: H5O_set_version + * Function: H5O__set_version * * Purpose: Sets the correct version to encode the object header. * Chooses the oldest version possible, unless the file's @@ -233,12 +233,12 @@ H5O__init_package(void) *------------------------------------------------------------------------- */ static herr_t -H5O_set_version(H5F_t *f, H5O_t *oh, uint8_t oh_flags, hbool_t store_msg_crt_idx) +H5O__set_version(H5F_t *f, H5O_t *oh, uint8_t oh_flags, hbool_t store_msg_crt_idx) { uint8_t version; /* Message version */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_STATIC /* check arguments */ HDassert(f); @@ -262,7 +262,7 @@ H5O_set_version(H5F_t *f, H5O_t *oh, uint8_t oh_flags, hbool_t store_msg_crt_idx done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_set_version() */ +} /* end H5O__set_version() */ /*------------------------------------------------------------------------- @@ -280,17 +280,8 @@ done: * Failure: Negative * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 5 1997 * - * Changes: 2018 August 17 - * Jacob Smith - * Refactor out the operations into two separate steps -- - * preparation and application -- to facilitate overriding the - * library-default size allocated for the object header. This - * function is retained as a wrapper, to minimize changes to - * unaffected calling functions. - * *------------------------------------------------------------------------- */ herr_t @@ -308,13 +299,13 @@ H5O_create(H5F_t *f, size_t size_hint, size_t initial_rc, hid_t ocpl_id, H5O_loc /* create object header in freelist * header version is set internally */ - oh = H5O__create_ohdr(f, ocpl_id); + oh = H5O_create_ohdr(f, ocpl_id); if(NULL == oh) HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "Can't instantiate object header") /* apply object header information to file */ - if(H5O__apply_ohdr(f, oh, ocpl_id, size_hint, initial_rc, loc) < 0) + if(H5O_apply_ohdr(f, oh, ocpl_id, size_hint, initial_rc, loc) < 0) HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "Can't apply object header to file") done: @@ -326,7 +317,7 @@ done: /*----------------------------------------------------------------------------- - * Function: H5O__create_ohdr + * Function: H5O_create_ohdr * * Purpose: Create the object header, set version and flags. * @@ -339,7 +330,7 @@ done: *----------------------------------------------------------------------------- */ H5O_t * -H5O__create_ohdr(H5F_t *f, hid_t ocpl_id) +H5O_create_ohdr(H5F_t *f, hid_t ocpl_id) { H5P_genplist_t *oc_plist; H5O_t *oh = NULL; /* Object header in Freelist */ @@ -364,20 +355,18 @@ H5O__create_ohdr(H5F_t *f, hid_t ocpl_id) HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, NULL, "not a property list") /* Get any object header status flags set by properties */ - if(H5P_DATASET_CREATE_DEFAULT == ocpl_id) - { + if(H5P_DATASET_CREATE_DEFAULT == ocpl_id) { /* If the OCPL is the default DCPL, we can get the header flags from the * API context. Otherwise we have to call H5P_get */ if(H5CX_get_ohdr_flags(&oh_flags) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get object header flags") } - else - { + else { if(H5P_get(oc_plist, H5O_CRT_OHDR_FLAGS_NAME, &oh_flags) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get object header flags") } - if(H5O_set_version(f, oh, oh_flags, H5F_STORE_MSG_CRT_IDX(f)) < 0) + if(H5O__set_version(f, oh, oh_flags, H5F_STORE_MSG_CRT_IDX(f)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, NULL, "can't set version of object header") oh->flags = oh_flags; @@ -389,11 +378,11 @@ done: HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, NULL, "can't delete object header") FUNC_LEAVE_NOAPI(ret_value) -} /* H5O__create_ohdr() */ +} /* H5O_create_ohdr() */ /*----------------------------------------------------------------------------- - * Function: H5O__apply_ohdr + * Function: H5O_apply_ohdr * * Purpose: Initialize and set the object header in the file. * Record some information at `loc_out`. @@ -407,7 +396,7 @@ done: *----------------------------------------------------------------------------- */ herr_t -H5O__apply_ohdr(H5F_t *f, H5O_t *oh, hid_t ocpl_id, size_t size_hint, size_t initial_rc, H5O_loc_t *loc_out) +H5O_apply_ohdr(H5F_t *f, H5O_t *oh, hid_t ocpl_id, size_t size_hint, size_t initial_rc, H5O_loc_t *loc_out) { haddr_t oh_addr; size_t oh_size; @@ -564,7 +553,7 @@ H5O__apply_ohdr(H5F_t *f, H5O_t *oh, hid_t ocpl_id, size_t size_hint, size_t ini done: FUNC_LEAVE_NOAPI(ret_value); -} /* H5O__apply_ohdr() */ +} /* H5O_apply_ohdr() */ /*------------------------------------------------------------------------- @@ -664,7 +653,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_open_by_idx + * Function: H5O__open_by_idx * * Purpose: Internal routine to open an object by index within group * @@ -677,7 +666,7 @@ done: *------------------------------------------------------------------------- */ void * -H5O_open_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, +H5O__open_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5I_type_t *opened_type) { H5G_loc_t obj_loc; /* Location used to open group */ @@ -686,7 +675,7 @@ H5O_open_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, hbool_t loc_found = FALSE; /* Entry at 'name' found */ void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI(NULL) + FUNC_ENTER_PACKAGE /* Check arguments */ HDassert(loc); @@ -712,11 +701,11 @@ done: HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, NULL, "can't free location") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_open_by_idx() */ +} /* end H5O__open_by_idx() */ /*------------------------------------------------------------------------- - * Function: H5O_open_by_addr + * Function: H5O__open_by_addr * * Purpose: Internal routine to open an object by its address * @@ -729,14 +718,14 @@ done: *------------------------------------------------------------------------- */ void * -H5O_open_by_addr(const H5G_loc_t *loc, haddr_t addr, H5I_type_t *opened_type) +H5O__open_by_addr(const H5G_loc_t *loc, haddr_t addr, H5I_type_t *opened_type) { H5G_loc_t obj_loc; /* Location used to open group */ H5G_name_t obj_path; /* Opened object group hier. path */ H5O_loc_t obj_oloc; /* Opened object object location */ void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI(NULL) + FUNC_ENTER_PACKAGE /* Check arguments */ HDassert(loc); @@ -755,7 +744,7 @@ H5O_open_by_addr(const H5G_loc_t *loc, haddr_t addr, H5I_type_t *opened_type) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_open_by_addr() */ +} /* end H5O__open_by_addr() */ /*------------------------------------------------------------------------- @@ -869,7 +858,6 @@ done: * Failure: -1 * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 5 1997 * *------------------------------------------------------------------------- @@ -984,7 +972,6 @@ done: * Failure: Negative * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 5 1997 * *------------------------------------------------------------------------- @@ -1033,7 +1020,6 @@ done: * Failure: NULL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Dec 31 2002 * *------------------------------------------------------------------------- @@ -1219,7 +1205,6 @@ done: * Failure: NULL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jul 13 2008 * *------------------------------------------------------------------------- @@ -1266,7 +1251,6 @@ done: * Failure: Negative * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jul 13 2008 * *------------------------------------------------------------------------- @@ -1302,7 +1286,6 @@ done: * Failure: Negative * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Dec 31 2002 * *------------------------------------------------------------------------- @@ -1498,7 +1481,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * * Tuesday, January 21, 2003 * *------------------------------------------------------------------------- @@ -1570,7 +1552,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 19 2003 * *------------------------------------------------------------------------- @@ -1633,7 +1614,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 19 2003 * *------------------------------------------------------------------------- @@ -1696,7 +1676,7 @@ H5O_obj_type(const H5O_loc_t *loc, H5O_type_t *obj_type) done: if(oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5O_obj_type() */ @@ -1734,10 +1714,9 @@ H5O__obj_type_real(const H5O_t *oh, H5O_type_t *obj_type) /* Set type to "unknown" */ *obj_type = H5O_TYPE_UNKNOWN; } - else { + else /* Set object type */ *obj_type = obj_class->type; - } FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O__obj_type_real() */ @@ -1923,7 +1902,6 @@ H5O_loc_reset(H5O_loc_t *loc) * Failure: Negative * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Monday, September 19, 2005 * *------------------------------------------------------------------------- @@ -2131,7 +2109,7 @@ H5O_get_hdr_info(const H5O_loc_t *loc, H5O_hdr_info_t *hdr) done: if(oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_get_hdr_info() */ @@ -2270,7 +2248,7 @@ H5O_get_info(const H5O_loc_t *loc, H5O_info2_t *oinfo, unsigned fields) /* Set the object's reference count */ oinfo->rc = oh->nlink; - } /* end if */ + } /* Get time information, if requested */ if(fields & H5O_INFO_TIME) { @@ -2566,8 +2544,8 @@ H5O_get_oh_addr(const H5O_t *oh) /*------------------------------------------------------------------------- * Function: H5O_get_oh_flags * - * Programmer: Jacob Smith - * 2018 August 17 + * Programmer: Jacob Smith + * 2018 August 17 * *------------------------------------------------------------------------- */ @@ -2583,12 +2561,12 @@ H5O_get_oh_flags(const H5O_t *oh) /*------------------------------------------------------------------------- * Function: H5O_get_oh_mtime * - * Purpose: Retrieve an object's modification time. Assumes that the + * Purpose: Retrieve an object's modification time. Assumes that the * caller has verified that accessing this variable is appropriate * to the header in question. * - * Programmer: Jacob Smith - * 2018 August 17 + * Programmer: Jacob Smith + * 2018 August 17 * *------------------------------------------------------------------------- */ @@ -2605,8 +2583,8 @@ H5O_get_oh_mtime(const H5O_t *oh) /*------------------------------------------------------------------------- * Function: H5O_get_oh_version * - * Programmer: Jacob Smith - * 2018 August 17 + * Programmer: Jacob Smith + * 2018 August 17 * *------------------------------------------------------------------------- */ @@ -2942,7 +2920,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jul 13 2008 * *------------------------------------------------------------------------- @@ -2978,7 +2955,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jul 13 2008 * *------------------------------------------------------------------------- @@ -3015,7 +2991,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Oct 08 2010 * *------------------------------------------------------------------------- @@ -3081,7 +3056,6 @@ H5O_get_proxy(const H5O_t *oh) * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Jan 15 2003 * *------------------------------------------------------------------------- diff --git a/src/H5Olayout.c b/src/H5Olayout.c index 8e6e204..99e646d 100644 --- a/src/H5Olayout.c +++ b/src/H5Olayout.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Robb Matzke +/* Programmer: Robb Matzke * Wednesday, October 8, 1997 * * Purpose: Messages related to data layout. @@ -425,14 +425,14 @@ H5O__layout_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, tmp_size = HDstrlen((const char *)heap_block_p) + 1; if(NULL == (mesg->storage.u.virt.list[i].source_file_name = (char *)H5MM_malloc(tmp_size))) HGOTO_ERROR(H5E_OHDR, H5E_RESOURCE, NULL, "unable to allocate memory for source file name") - (void)H5MM_memcpy(mesg->storage.u.virt.list[i].source_file_name, heap_block_p, tmp_size); + H5MM_memcpy(mesg->storage.u.virt.list[i].source_file_name, heap_block_p, tmp_size); heap_block_p += tmp_size; /* Source dataset name */ tmp_size = HDstrlen((const char *)heap_block_p) + 1; if(NULL == (mesg->storage.u.virt.list[i].source_dset_name = (char *)H5MM_malloc(tmp_size))) HGOTO_ERROR(H5E_OHDR, H5E_RESOURCE, NULL, "unable to allocate memory for source dataset name") - (void)H5MM_memcpy(mesg->storage.u.virt.list[i].source_dset_name, heap_block_p, tmp_size); + H5MM_memcpy(mesg->storage.u.virt.list[i].source_dset_name, heap_block_p, tmp_size); heap_block_p += tmp_size; /* Source selection */ @@ -967,7 +967,7 @@ H5O__layout_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void *mesg_src, const H5O_layout_t *layout_src = (const H5O_layout_t *)mesg_src; /* Source layout */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(cpy_info); diff --git a/src/H5Olinfo.c b/src/H5Olinfo.c index a2f88d9..ebb34dc 100644 --- a/src/H5Olinfo.c +++ b/src/H5Olinfo.c @@ -15,7 +15,7 @@ * * Created: H5Olinfo.c * Aug 23 2005 - * Quincey Koziol + * Quincey Koziol * * Purpose: Link Information messages. * @@ -38,9 +38,9 @@ /* PRIVATE PROTOTYPES */ static void *H5O__linfo_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p); -static herr_t H5O_linfo_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); -static void *H5O_linfo_copy(const void *_mesg, void *_dest); -static size_t H5O_linfo_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); +static herr_t H5O__linfo_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); +static void *H5O__linfo_copy(const void *_mesg, void *_dest); +static size_t H5O__linfo_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); static herr_t H5O__linfo_free(void *_mesg); static herr_t H5O__linfo_delete(H5F_t *f, H5O_t *open_oh, void *_mesg); static void *H5O__linfo_copy_file(H5F_t *file_src, void *native_src, @@ -59,9 +59,9 @@ const H5O_msg_class_t H5O_MSG_LINFO[1] = {{ sizeof(H5O_linfo_t), /*native message size */ 0, /* messages are sharable? */ H5O__linfo_decode, /*decode message */ - H5O_linfo_encode, /*encode message */ - H5O_linfo_copy, /*copy the native value */ - H5O_linfo_size, /*size of symbol table entry */ + H5O__linfo_encode, /*encode message */ + H5O__linfo_copy, /*copy the native value */ + H5O__linfo_size, /*size of symbol table entry */ NULL, /*default reset method */ H5O__linfo_free, /* free method */ H5O__linfo_delete, /* file delete method */ @@ -105,7 +105,6 @@ H5FL_DEFINE_STATIC(H5O_linfo_t); * Failure: NULL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Aug 23 2005 * *------------------------------------------------------------------------- @@ -174,25 +173,24 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_linfo_encode + * Function: H5O__linfo_encode * * Purpose: Encodes a message. * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Aug 23 2005 * *------------------------------------------------------------------------- */ static herr_t -H5O_linfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) +H5O__linfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) { const H5O_linfo_t *linfo = (const H5O_linfo_t *)_mesg; unsigned char index_flags; /* Flags for encoding link index info */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* check args */ HDassert(f); @@ -224,11 +222,11 @@ H5O_linfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, co HDassert(!H5F_addr_defined(linfo->corder_bt2_addr)); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5O_linfo_encode() */ +} /* end H5O__linfo_encode() */ /*------------------------------------------------------------------------- - * Function: H5O_linfo_copy + * Function: H5O__linfo_copy * * Purpose: Copies a message from _MESG to _DEST, allocating _DEST if * necessary. @@ -237,19 +235,18 @@ H5O_linfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, co * Failure: NULL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Aug 23 2005 * *------------------------------------------------------------------------- */ static void * -H5O_linfo_copy(const void *_mesg, void *_dest) +H5O__linfo_copy(const void *_mesg, void *_dest) { const H5O_linfo_t *linfo = (const H5O_linfo_t *)_mesg; H5O_linfo_t *dest = (H5O_linfo_t *) _dest; void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(linfo); @@ -264,11 +261,11 @@ H5O_linfo_copy(const void *_mesg, void *_dest) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_linfo_copy() */ +} /* end H5O__linfo_copy() */ /*------------------------------------------------------------------------- - * Function: H5O_linfo_size + * Function: H5O__linfo_size * * Purpose: Returns the size of the raw message in bytes not counting * the message type or size fields, but only the data fields. @@ -278,18 +275,17 @@ done: * Failure: zero * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Aug 23 2005 * *------------------------------------------------------------------------- */ static size_t -H5O_linfo_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void *_mesg) +H5O__linfo_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void *_mesg) { const H5O_linfo_t *linfo = (const H5O_linfo_t *)_mesg; size_t ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Set return value */ ret_value = 1 /* Version */ @@ -300,7 +296,7 @@ H5O_linfo_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void + (linfo->index_corder ? (size_t)H5F_SIZEOF_ADDR(f) : 0); /* Address of v2 B-tree for indexing creation order values of links */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_linfo_size() */ +} /* end H5O__linfo_size() */ /*------------------------------------------------------------------------- @@ -393,7 +389,7 @@ H5O__linfo_copy_file(H5F_t H5_ATTR_UNUSED *file_src, void *native_src, H5F_t *fi HDassert(cpy_info); /* Copy the source message */ - if(NULL == (linfo_dst = (H5O_linfo_t *)H5O_linfo_copy(linfo_src, NULL))) + if(NULL == (linfo_dst = (H5O_linfo_t *)H5O__linfo_copy(linfo_src, NULL))) HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "memory allocation failed") /* If we are performing a 'shallow hierarchy' copy, and the links in this @@ -441,7 +437,6 @@ done: * Failure: Negative * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sept 26 2006 * *------------------------------------------------------------------------- @@ -548,7 +543,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Aug 23 2005 * *------------------------------------------------------------------------- diff --git a/src/H5Olink.c b/src/H5Olink.c index 1f0c6c7..70b654f 100644 --- a/src/H5Olink.c +++ b/src/H5Olink.c @@ -15,7 +15,7 @@ * * Created: H5Olink.c * Aug 29 2005 - * Quincey Koziol + * Quincey Koziol * * Purpose: Link messages. * @@ -40,12 +40,12 @@ /* PRIVATE PROTOTYPES */ static void *H5O__link_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p); -static herr_t H5O_link_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); -static void *H5O_link_copy(const void *_mesg, void *_dest); -static size_t H5O_link_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); +static herr_t H5O__link_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); +static void *H5O__link_copy(const void *_mesg, void *_dest); +static size_t H5O__link_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); static herr_t H5O__link_reset(void *_mesg); static herr_t H5O__link_free(void *_mesg); -static herr_t H5O_link_pre_copy_file(H5F_t *file_src, const void *mesg_src, +static herr_t H5O__link_pre_copy_file(H5F_t *file_src, const void *mesg_src, hbool_t *deleted, const H5O_copy_t *cpy_info, void *udata); static void *H5O__link_copy_file(H5F_t *file_src, void *native_src, H5F_t *file_dst, hbool_t *recompute_size, unsigned *mesg_flags, @@ -63,16 +63,16 @@ const H5O_msg_class_t H5O_MSG_LINK[1] = {{ sizeof(H5O_link_t), /*native message size */ 0, /* messages are sharable? */ H5O__link_decode, /*decode message */ - H5O_link_encode, /*encode message */ - H5O_link_copy, /*copy the native value */ - H5O_link_size, /*size of symbol table entry */ + H5O__link_encode, /*encode message */ + H5O__link_copy, /*copy the native value */ + H5O__link_size, /*size of symbol table entry */ H5O__link_reset, /* reset method */ H5O__link_free, /* free method */ H5O_link_delete, /* file delete method */ NULL, /* link method */ NULL, /*set share method */ NULL, /*can share method */ - H5O_link_pre_copy_file, /* pre copy native value to file */ + H5O__link_pre_copy_file, /* pre copy native value to file */ H5O__link_copy_file, /* copy native value to file */ H5O__link_post_copy_file, /* post copy native value to file */ NULL, /* get creation index */ @@ -111,7 +111,6 @@ H5FL_DEFINE_STATIC(H5O_link_t); * Failure: NULL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Aug 29 2005 * *------------------------------------------------------------------------- @@ -119,11 +118,12 @@ H5FL_DEFINE_STATIC(H5O_link_t); static void * H5O__link_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, - size_t H5_ATTR_UNUSED p_size, const uint8_t *p) + size_t p_size, const uint8_t *p) { H5O_link_t *lnk = NULL; /* Pointer to link message */ size_t len = 0; /* Length of a string in the message */ unsigned char link_flags; /* Flags for encoding link info */ + const uint8_t *p_end = p + p_size; /* End of the p buffer */ void *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC @@ -199,6 +199,11 @@ H5O__link_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, if(len == 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "invalid name length") + /* Make sure that length doesn't exceed buffer size, which could occur + when the file is corrupted */ + if(p + len > p_end) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "name length causes read past end of buffer") + /* Get the link's name */ if(NULL == (lnk->name = (char *)H5MM_malloc(len + 1))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") @@ -218,6 +223,12 @@ H5O__link_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, UINT16DECODE(p, len) if(len == 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "invalid link length") + + /* Make sure that length doesn't exceed buffer size, which could occur + when the file is corrupted */ + if(p + len > p_end) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "name length causes read past end of buffer") + if(NULL == (lnk->u.soft.name = (char *)H5MM_malloc((size_t)len + 1))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") H5MM_memcpy(lnk->u.soft.name, p, len); @@ -238,6 +249,11 @@ H5O__link_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, lnk->u.ud.size = len; if(len > 0) { + /* Make sure that length doesn't exceed buffer size, which could + occur when the file is corrupted */ + if(p + len > p_end) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "name length causes read past end of buffer") + if(NULL == (lnk->u.ud.udata = H5MM_malloc((size_t)len))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") H5MM_memcpy(lnk->u.ud.udata, p, len); @@ -267,26 +283,25 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_link_encode + * Function: H5O__link_encode * * Purpose: Encodes a link message. * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Aug 29 2005 * *------------------------------------------------------------------------- */ static herr_t -H5O_link_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) +H5O__link_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) { const H5O_link_t *lnk = (const H5O_link_t *) _mesg; uint64_t len; /* Length of a string in the message */ unsigned char link_flags; /* Flags for encoding link info */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* check args */ HDassert(f); @@ -387,11 +402,11 @@ H5O_link_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, con } /* end switch */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5O_link_encode() */ +} /* end H5O__link_encode() */ /*------------------------------------------------------------------------- - * Function: H5O_link_copy + * Function: H5O__link_copy * * Purpose: Copies a message from _MESG to _DEST, allocating _DEST if * necessary. @@ -401,19 +416,18 @@ H5O_link_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, con * Failure: NULL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Aug 29 2005 * *------------------------------------------------------------------------- */ static void * -H5O_link_copy(const void *_mesg, void *_dest) +H5O__link_copy(const void *_mesg, void *_dest) { const H5O_link_t *lnk = (const H5O_link_t *) _mesg; H5O_link_t *dest = (H5O_link_t *) _dest; void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check args */ HDassert(lnk); @@ -454,11 +468,11 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_link_copy() */ +} /* end H5O__link_copy() */ /*------------------------------------------------------------------------- - * Function: H5O_link_size + * Function: H5O__link_size * * Purpose: Returns the size of the raw message in bytes not counting * the message type or size fields, but only the data fields. @@ -469,20 +483,19 @@ done: * Failure: zero * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Aug 29 2005 * *------------------------------------------------------------------------- */ static size_t -H5O_link_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void *_mesg) +H5O__link_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void *_mesg) { const H5O_link_t *lnk = (const H5O_link_t *)_mesg; uint64_t name_len; /* Length of name */ size_t name_size; /* Size of encoded name length */ size_t ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity check */ HDcompile_assert(sizeof(uint64_t) >= sizeof(size_t)); @@ -531,7 +544,7 @@ H5O_link_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void } /* end switch */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_link_size() */ +} /* end H5O__link_size() */ /*------------------------------------------------------------------------- @@ -666,7 +679,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_link_pre_copy_file + * Function: H5O__link_pre_copy_file * * Purpose: Perform any necessary actions before copying message between * files for link messages. @@ -681,10 +694,10 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_link_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void H5_ATTR_UNUSED *native_src, +H5O__link_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void H5_ATTR_UNUSED *native_src, hbool_t *deleted, const H5O_copy_t *cpy_info, void H5_ATTR_UNUSED *udata) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* check args */ HDassert(deleted); @@ -699,7 +712,7 @@ H5O_link_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void H5_ATTR_UNUSED *deleted = TRUE; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5O_link_pre_copy_file() */ +} /* end H5O__link_pre_copy_file() */ /*------------------------------------------------------------------------- @@ -794,7 +807,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Aug 29 2005 * *------------------------------------------------------------------------- @@ -806,7 +818,7 @@ H5O__link_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, const H5O_link_t *lnk = (const H5O_link_t *) _mesg; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(f); diff --git a/src/H5Omessage.c b/src/H5Omessage.c index d66ea69..283d913 100644 --- a/src/H5Omessage.c +++ b/src/H5Omessage.c @@ -15,7 +15,7 @@ * * Created: H5Omessage.c * Dec 3 2006 - * Quincey Koziol + * Quincey Koziol * * Purpose: Object header message routines. * @@ -105,7 +105,6 @@ static herr_t H5O__copy_mesg(H5F_t *f, H5O_t *oh, size_t idx, * Failure: Negative * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Dec 1 2006 * *------------------------------------------------------------------------- @@ -153,7 +152,6 @@ done: * Failure: Negative * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Dec 31 2002 * *------------------------------------------------------------------------- @@ -196,7 +194,6 @@ done: * Failure: Negative * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Dec 8 2006 * *------------------------------------------------------------------------- @@ -248,7 +245,6 @@ done: * Failure: Negative * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 6 1997 * *------------------------------------------------------------------------- @@ -304,7 +300,6 @@ done: * Failure: Negative * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Dec 6 2007 * *------------------------------------------------------------------------- @@ -352,7 +347,6 @@ done: * Failure: Negative * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 6 1997 * *------------------------------------------------------------------------- @@ -453,7 +447,6 @@ done: * Failure: NULL * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 6 1997 * *------------------------------------------------------------------------- @@ -506,7 +499,6 @@ done: * Failure: NULL * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 6 1997 * *------------------------------------------------------------------------- @@ -563,7 +555,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 12 1997 * *------------------------------------------------------------------------- @@ -600,7 +591,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 12 1997 * *------------------------------------------------------------------------- @@ -951,7 +941,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 28 1997 * *------------------------------------------------------------------------- @@ -1002,7 +991,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Sep 6 2005 * *------------------------------------------------------------------------- @@ -1052,7 +1040,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Sep 6 2005 * *------------------------------------------------------------------------- @@ -1118,7 +1105,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 28 1997 * *------------------------------------------------------------------------- @@ -1175,7 +1161,6 @@ done: * object headers were processed. * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Nov 19 2004 * * Description: @@ -1241,7 +1226,6 @@ done: * object headers were processed. * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Sep 6 2005 * * Description: @@ -1316,7 +1300,7 @@ done: */ if(oh_modified & H5O_MODIFY_CONDENSE) if(H5O__condense_header(f, oh) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTPACK, FAIL, "can't pack object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTPACK, FAIL, "can't pack object header") /* Mark object header as changed */ if(H5O_touch_oh(f, oh, FALSE) < 0) @@ -1340,7 +1324,6 @@ done: * Return: Size of message on success, 0 on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 13 2003 * *------------------------------------------------------------------------- @@ -1383,7 +1366,6 @@ done: * Return: Size of message on success, 0 on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Sep 6 2005 * *------------------------------------------------------------------------- @@ -1447,7 +1429,6 @@ done: * Return: Size of message on success, 0 on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Mar 7 2007 * *------------------------------------------------------------------------- @@ -1584,7 +1565,6 @@ H5O_msg_can_share_in_ohdr(unsigned type_id) * Object is not shared: FALSE * * Programmer: James Laird - * jlaird@ncsa.uiuc.edu * April 5 2006 * *------------------------------------------------------------------------- @@ -1629,7 +1609,6 @@ H5O_msg_is_shared(unsigned type_id, const void *mesg) * Failure: Negative * * Programmer: James Laird - * jlaird@hdfgroup.org * November 1 2006 * *------------------------------------------------------------------------- @@ -1680,7 +1659,6 @@ done: * Failure: Negative * * Programmer: James Laird - * jlaird@hdfgroup.org * Oct 17 2006 * *------------------------------------------------------------------------- @@ -1756,7 +1734,6 @@ done: * Failure: Negative * * Programmer: Raymond Lu - * slu@ncsa.uiuc.edu * July 13, 2004 * *------------------------------------------------------------------------- @@ -1796,14 +1773,8 @@ done: * Failure: NULL * * Programmer: Raymond Lu - * slu@ncsa.uiuc.edu * July 14, 2004 * - * Modifications: Neil Fortner - * Feb 4 2009 - * Added open_oh parameter. This parameter is optional and - * contains this message's protected object header - * *------------------------------------------------------------------------- */ void * @@ -2067,7 +2038,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * September 26 2003 * *------------------------------------------------------------------------- @@ -2107,7 +2077,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * May 14 2007 * *------------------------------------------------------------------------- @@ -2208,7 +2177,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Nov 21 2005 * *------------------------------------------------------------------------- diff --git a/src/H5Omodule.h b/src/H5Omodule.h index df3ab56..6f00fcc 100644 --- a/src/H5Omodule.h +++ b/src/H5Omodule.h @@ -11,7 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, September 12, 2015 * * Purpose: This file contains declarations which define macros for the diff --git a/src/H5Omtime.c b/src/H5Omtime.c index fbf7613..09a8210 100644 --- a/src/H5Omtime.c +++ b/src/H5Omtime.c @@ -11,10 +11,10 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Robb Matzke - * Friday, July 24, 1998 +/* Programmer: Robb Matzke + * Friday, July 24, 1998 * - * Purpose: The object modification time message. + * Purpose: The object modification time message. */ #include "H5Omodule.h" /* This source code file is part of the H5O module */ @@ -29,14 +29,14 @@ static void *H5O__mtime_new_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p); -static herr_t H5O_mtime_new_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); -static size_t H5O_mtime_new_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); +static herr_t H5O__mtime_new_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); +static size_t H5O__mtime_new_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); static void *H5O__mtime_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p); -static herr_t H5O_mtime_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); -static void *H5O_mtime_copy(const void *_mesg, void *_dest); -static size_t H5O_mtime_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); +static herr_t H5O__mtime_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); +static void *H5O__mtime_copy(const void *_mesg, void *_dest); +static size_t H5O__mtime_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); static herr_t H5O__mtime_free(void *_mesg); static herr_t H5O__mtime_debug(H5F_t *f, const void *_mesg, FILE *stream, int indent, int fwidth); @@ -48,9 +48,9 @@ const H5O_msg_class_t H5O_MSG_MTIME[1] = {{ sizeof(time_t), /*native message size */ 0, /* messages are sharable? */ H5O__mtime_decode, /*decode message */ - H5O_mtime_encode, /*encode message */ - H5O_mtime_copy, /*copy the native value */ - H5O_mtime_size, /*raw message size */ + H5O__mtime_encode, /*encode message */ + H5O__mtime_copy, /*copy the native value */ + H5O__mtime_size, /*raw message size */ NULL, /* reset method */ H5O__mtime_free, /* free method */ NULL, /* file delete method */ @@ -73,9 +73,9 @@ const H5O_msg_class_t H5O_MSG_MTIME_NEW[1] = {{ sizeof(time_t), /*native message size */ 0, /* messages are sharable? */ H5O__mtime_new_decode, /*decode message */ - H5O_mtime_new_encode, /*encode message */ - H5O_mtime_copy, /*copy the native value */ - H5O_mtime_new_size, /*raw message size */ + H5O__mtime_new_encode, /*encode message */ + H5O__mtime_copy, /*copy the native value */ + H5O__mtime_new_size, /*raw message size */ NULL, /* reset method */ H5O__mtime_free, /* free method */ NULL, /* file delete method */ @@ -111,7 +111,6 @@ H5FL_DEFINE(time_t); * Failure: NULL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Jan 3 2002 * *------------------------------------------------------------------------- @@ -168,7 +167,6 @@ done: * Failure: NULL * * Programmer: Robb Matzke - * matzke@llnl.gov * Jul 24 1998 * *------------------------------------------------------------------------- @@ -220,24 +218,23 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_mtime_new_encode + * Function: H5O__mtime_new_encode * * Purpose: Encodes a new modification time message. * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Jan 3 2002 * *------------------------------------------------------------------------- */ static herr_t -H5O_mtime_new_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) +H5O__mtime_new_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) { const time_t *mesg = (const time_t *) _mesg; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* check args */ HDassert(f); @@ -256,31 +253,28 @@ H5O_mtime_new_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_sha UINT32ENCODE(p, *mesg); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5O_mtime_new_encode() */ +} /* end H5O__mtime_new_encode() */ /*------------------------------------------------------------------------- - * Function: H5O_mtime_encode + * Function: H5O__mtime_encode * * Purpose: Encodes a modification time message. * * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Jul 24 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5O_mtime_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) +H5O__mtime_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) { const time_t *mesg = (const time_t *) _mesg; struct tm *tm; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* check args */ HDassert(f); @@ -290,15 +284,15 @@ H5O_mtime_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, /* encode */ tm = HDgmtime(mesg); HDsprintf((char*)p, "%04d%02d%02d%02d%02d%02d", - 1900+tm->tm_year, 1+tm->tm_mon, tm->tm_mday, - tm->tm_hour, tm->tm_min, tm->tm_sec); + 1900+tm->tm_year, 1+tm->tm_mon, tm->tm_mday, + tm->tm_hour, tm->tm_min, tm->tm_sec); FUNC_LEAVE_NOAPI(SUCCEED) -} +} /* end H5O__mtime_encode() */ /*------------------------------------------------------------------------- - * Function: H5O_mtime_copy + * Function: H5O__mtime_copy * * Purpose: Copies a message from _MESG to _DEST, allocating _DEST if * necessary. @@ -308,25 +302,22 @@ H5O_mtime_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, * Failure: NULL * * Programmer: Robb Matzke - * matzke@llnl.gov * Jul 24 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ static void * -H5O_mtime_copy(const void *_mesg, void *_dest) +H5O__mtime_copy(const void *_mesg, void *_dest) { const time_t *mesg = (const time_t *) _mesg; time_t *dest = (time_t *) _dest; void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(mesg); - if (!dest && NULL==(dest = H5FL_MALLOC(time_t))) + if(!dest && NULL == (dest = H5FL_MALLOC(time_t))) HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* copy */ @@ -337,11 +328,11 @@ H5O_mtime_copy(const void *_mesg, void *_dest) done: FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5O__mtime_copy() */ /*------------------------------------------------------------------------- - * Function: H5O_mtime_new_size + * Function: H5O__mtime_new_size * * Purpose: Returns the size of the raw message in bytes not * counting the message type or size fields, but only the data @@ -353,28 +344,25 @@ done: * Failure: 0 * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Jan 3 2002 * - * Modifications: - * *------------------------------------------------------------------------- */ static size_t -H5O_mtime_new_size(const H5F_t H5_ATTR_UNUSED * f, hbool_t H5_ATTR_UNUSED disable_shared, const void H5_ATTR_UNUSED * mesg) +H5O__mtime_new_size(const H5F_t H5_ATTR_UNUSED * f, hbool_t H5_ATTR_UNUSED disable_shared, const void H5_ATTR_UNUSED * mesg) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* check args */ HDassert(f); HDassert(mesg); FUNC_LEAVE_NOAPI(8) -} /* end H5O_mtime_new_size() */ +} /* end H5O__mtime_new_size() */ /*------------------------------------------------------------------------- - * Function: H5O_mtime_size + * Function: H5O__mtime_size * * Purpose: Returns the size of the raw message in bytes not * counting the message type or size fields, but only the data @@ -386,24 +374,21 @@ H5O_mtime_new_size(const H5F_t H5_ATTR_UNUSED * f, hbool_t H5_ATTR_UNUSED disabl * Failure: 0 * * Programmer: Robb Matzke - * matzke@llnl.gov * Jul 14 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ static size_t -H5O_mtime_size(const H5F_t H5_ATTR_UNUSED * f, hbool_t H5_ATTR_UNUSED disable_shared, const void H5_ATTR_UNUSED * mesg) +H5O__mtime_size(const H5F_t H5_ATTR_UNUSED * f, hbool_t H5_ATTR_UNUSED disable_shared, const void H5_ATTR_UNUSED * mesg) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* check args */ HDassert(f); HDassert(mesg); FUNC_LEAVE_NOAPI(16) -} +} /* end H5O__mtime_size() */ /*------------------------------------------------------------------------- @@ -439,7 +424,6 @@ H5O__mtime_free(void *mesg) * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Jul 24 1998 * *------------------------------------------------------------------------- diff --git a/src/H5Oname.c b/src/H5Oname.c index 1f20f10..0e1fc62 100644 --- a/src/H5Oname.c +++ b/src/H5Oname.c @@ -15,7 +15,7 @@ * * Created: H5Oname.c * Aug 12 1997 - * Robb Matzke + * Robb Matzke * * Purpose: Object name message. * @@ -34,9 +34,9 @@ /* PRIVATE PROTOTYPES */ static void *H5O__name_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p); -static herr_t H5O_name_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); -static void *H5O_name_copy(const void *_mesg, void *_dest); -static size_t H5O_name_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); +static herr_t H5O__name_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); +static void *H5O__name_copy(const void *_mesg, void *_dest); +static size_t H5O__name_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); static herr_t H5O__name_reset(void *_mesg); static herr_t H5O__name_debug(H5F_t *f, const void *_mesg, FILE * stream, int indent, int fwidth); @@ -48,9 +48,9 @@ const H5O_msg_class_t H5O_MSG_NAME[1] = {{ sizeof(H5O_name_t), /*native message size */ 0, /* messages are sharable? */ H5O__name_decode, /*decode message */ - H5O_name_encode, /*encode message */ - H5O_name_copy, /*copy the native value */ - H5O_name_size, /*raw message size */ + H5O__name_encode, /*encode message */ + H5O__name_copy, /*copy the native value */ + H5O__name_size, /*raw message size */ H5O__name_reset, /*free internal memory */ NULL, /* free method */ NULL, /* file delete method */ @@ -77,7 +77,6 @@ const H5O_msg_class_t H5O_MSG_NAME[1] = {{ * Failure: NULL * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 12 1997 * *------------------------------------------------------------------------- @@ -98,9 +97,9 @@ H5O__name_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, /* decode */ if(NULL == (mesg = (H5O_name_t *)H5MM_calloc(sizeof(H5O_name_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") if(NULL == (mesg->s = (char *)H5MM_strdup((const char *)p))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Set return value */ ret_value = mesg; @@ -115,26 +114,23 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_name_encode + * Function: H5O__name_encode * * Purpose: Encodes a name message. * * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 12 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5O_name_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) +H5O__name_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) { const H5O_name_t *mesg = (const H5O_name_t *) _mesg; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* check args */ HDassert(f); @@ -145,11 +141,11 @@ H5O_name_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, HDstrcpy((char*)p, mesg->s); FUNC_LEAVE_NOAPI(SUCCEED) -} +} /* end H5O__name_encode() */ /*------------------------------------------------------------------------- - * Function: H5O_name_copy + * Function: H5O__name_copy * * Purpose: Copies a message from _MESG to _DEST, allocating _DEST if * necessary. @@ -159,27 +155,24 @@ H5O_name_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, * Failure: NULL * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 12 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ static void * -H5O_name_copy(const void *_mesg, void *_dest) +H5O__name_copy(const void *_mesg, void *_dest) { const H5O_name_t *mesg = (const H5O_name_t *) _mesg; H5O_name_t *dest = (H5O_name_t *) _dest; void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(mesg); if(!dest && NULL == (dest = (H5O_name_t *)H5MM_calloc(sizeof(H5O_name_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* copy */ *dest = *mesg; @@ -195,11 +188,11 @@ done: dest = (H5O_name_t *)H5MM_xfree(dest); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_name_copy() */ +} /* end H5O__name_copy() */ /*------------------------------------------------------------------------- - * Function: H5O_name_size + * Function: H5O__name_size * * Purpose: Returns the size of the raw message in bytes not * counting the message typ or size fields, but only the data @@ -211,20 +204,17 @@ done: * Failure: Negative * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 12 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ static size_t -H5O_name_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, const void *_mesg) +H5O__name_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, const void *_mesg) { const H5O_name_t *mesg = (const H5O_name_t *) _mesg; size_t ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* check args */ HDassert(f); @@ -233,7 +223,7 @@ H5O_name_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shar ret_value = mesg->s ? HDstrlen(mesg->s) + 1 : 0; FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5O__name_size() */ /*------------------------------------------------------------------------- @@ -245,7 +235,6 @@ H5O_name_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shar * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 12 1997 * *------------------------------------------------------------------------- @@ -275,11 +264,8 @@ H5O__name_reset(void *_mesg) * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 12 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -288,7 +274,7 @@ H5O__name_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, { const H5O_name_t *mesg = (const H5O_name_t *)_mesg; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* check args */ HDassert(f); diff --git a/src/H5Onull.c b/src/H5Onull.c index 5697455..43c555f 100644 --- a/src/H5Onull.c +++ b/src/H5Onull.c @@ -15,7 +15,6 @@ * * Created: H5Onull.c * Aug 6 1997 - * Robb Matzke * * Purpose: The null message. * diff --git a/src/H5Opkg.h b/src/H5Opkg.h index 16ea8e5..07e0e8e 100644 --- a/src/H5Opkg.h +++ b/src/H5Opkg.h @@ -554,7 +554,12 @@ H5_DLLVAR const H5O_obj_class_t H5O_OBJ_DATASET[1]; H5_DLLVAR const H5O_obj_class_t H5O_OBJ_DATATYPE[1]; /* Package-local function prototypes */ +H5_DLL void *H5O__open_by_addr(const H5G_loc_t *loc, haddr_t addr, H5I_type_t *opened_type/*out*/); +H5_DLL void *H5O__open_by_idx(const H5G_loc_t *loc, const char *name, + H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5I_type_t *opened_type/*out*/); H5_DLL const H5O_obj_class_t *H5O__obj_class(const H5O_loc_t *loc); +H5_DLL herr_t H5O__copy(const H5G_loc_t *src_loc, const char *src_name, + H5G_loc_t *dst_loc, const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id); H5_DLL int H5O__link_oh(H5F_t *f, int adjust, H5O_t *oh, hbool_t *deleted); H5_DLL herr_t H5O__visit(H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate2_t op, void *op_data, unsigned fields); diff --git a/src/H5Opline.c b/src/H5Opline.c index a956725..6ee0735 100644 --- a/src/H5Opline.c +++ b/src/H5Opline.c @@ -12,81 +12,81 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke - * Wednesday, April 15, 1998 + * Programmer: Robb Matzke + * Wednesday, April 15, 1998 * - * Purpose: Data filter pipeline message. + * Purpose: Data filter pipeline message. */ #include "H5Omodule.h" /* This source code file is part of the H5O module */ -#define H5Z_FRIEND /*suppress error about including H5Zpkg */ +#define H5Z_FRIEND /*suppress error about including H5Zpkg */ -#include "H5private.h" /* Generic Functions */ -#include "H5Dprivate.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FLprivate.h" /* Free Lists */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Opkg.h" /* Object headers */ -#include "H5Zpkg.h" /* Data filters */ +#include "H5private.h" /* Generic Functions */ +#include "H5Dprivate.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Opkg.h" /* Object headers */ +#include "H5Zpkg.h" /* Data filters */ /* PRIVATE PROTOTYPES */ -static herr_t H5O_pline_encode(H5F_t *f, uint8_t *p, const void *mesg); +static herr_t H5O__pline_encode(H5F_t *f, uint8_t *p, const void *mesg); static void *H5O__pline_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p); -static void *H5O_pline_copy(const void *_mesg, void *_dest); -static size_t H5O_pline_size(const H5F_t *f, const void *_mesg); +static void *H5O__pline_copy(const void *_mesg, void *_dest); +static size_t H5O__pline_size(const H5F_t *f, const void *_mesg); static herr_t H5O__pline_reset(void *_mesg); static herr_t H5O__pline_free(void *_mesg); -static herr_t H5O_pline_pre_copy_file(H5F_t *file_src, +static herr_t H5O__pline_pre_copy_file(H5F_t *file_src, const void *mesg_src, hbool_t *deleted, const H5O_copy_t *cpy_info, void *_udata); static herr_t H5O__pline_debug(H5F_t *f, const void *_mesg, FILE * stream, int indent, int fwidth); /* Set up & include shared message "interface" info */ -#define H5O_SHARED_TYPE H5O_MSG_PLINE -#define H5O_SHARED_DECODE H5O_pline_shared_decode -#define H5O_SHARED_DECODE_REAL H5O__pline_decode -#define H5O_SHARED_ENCODE H5O_pline_shared_encode -#define H5O_SHARED_ENCODE_REAL H5O_pline_encode -#define H5O_SHARED_SIZE H5O_pline_shared_size -#define H5O_SHARED_SIZE_REAL H5O_pline_size -#define H5O_SHARED_DELETE H5O__pline_shared_delete +#define H5O_SHARED_TYPE H5O_MSG_PLINE +#define H5O_SHARED_DECODE H5O__pline_shared_decode +#define H5O_SHARED_DECODE_REAL H5O__pline_decode +#define H5O_SHARED_ENCODE H5O__pline_shared_encode +#define H5O_SHARED_ENCODE_REAL H5O__pline_encode +#define H5O_SHARED_SIZE H5O__pline_shared_size +#define H5O_SHARED_SIZE_REAL H5O__pline_size +#define H5O_SHARED_DELETE H5O__pline_shared_delete #undef H5O_SHARED_DELETE_REAL -#define H5O_SHARED_LINK H5O__pline_shared_link +#define H5O_SHARED_LINK H5O__pline_shared_link #undef H5O_SHARED_LINK_REAL -#define H5O_SHARED_COPY_FILE H5O__pline_shared_copy_file +#define H5O_SHARED_COPY_FILE H5O__pline_shared_copy_file #undef H5O_SHARED_COPY_FILE_REAL -#define H5O_SHARED_POST_COPY_FILE H5O_pline_shared_post_copy_file +#define H5O_SHARED_POST_COPY_FILE H5O__pline_shared_post_copy_file #undef H5O_SHARED_POST_COPY_FILE_REAL #undef H5O_SHARED_POST_COPY_FILE_UPD -#define H5O_SHARED_DEBUG H5O_pline_shared_debug -#define H5O_SHARED_DEBUG_REAL H5O__pline_debug -#include "H5Oshared.h" /* Shared Object Header Message Callbacks */ +#define H5O_SHARED_DEBUG H5O__pline_shared_debug +#define H5O_SHARED_DEBUG_REAL H5O__pline_debug +#include "H5Oshared.h" /* Shared Object Header Message Callbacks */ /* This message derives from H5O message class */ const H5O_msg_class_t H5O_MSG_PLINE[1] = {{ - H5O_PLINE_ID, /* message id number */ - "filter pipeline", /* message name for debugging */ - sizeof(H5O_pline_t), /* native message size */ - H5O_SHARE_IS_SHARABLE|H5O_SHARE_IN_OHDR, /* messages are sharable? */ - H5O_pline_shared_decode, /* decode message */ - H5O_pline_shared_encode, /* encode message */ - H5O_pline_copy, /* copy the native value */ - H5O_pline_shared_size, /* size of raw message */ - H5O__pline_reset, /* reset method */ - H5O__pline_free, /* free method */ - H5O__pline_shared_delete, /* file delete method */ - H5O__pline_shared_link, /* link method */ - NULL, /* set share method */ - NULL, /*can share method */ - H5O_pline_pre_copy_file, /* pre copy native value to file */ - H5O__pline_shared_copy_file, /* copy native value to file */ - H5O_pline_shared_post_copy_file, /* post copy native value to file */ - NULL, /* get creation index */ - NULL, /* set creation index */ - H5O_pline_shared_debug /* debug the message */ + H5O_PLINE_ID, /* message id number */ + "filter pipeline", /* message name for debugging */ + sizeof(H5O_pline_t), /* native message size */ + H5O_SHARE_IS_SHARABLE | H5O_SHARE_IN_OHDR, /* messages are sharable? */ + H5O__pline_shared_decode, /* decode message */ + H5O__pline_shared_encode, /* encode message */ + H5O__pline_copy, /* copy the native value */ + H5O__pline_shared_size, /* size of raw message */ + H5O__pline_reset, /* reset method */ + H5O__pline_free, /* free method */ + H5O__pline_shared_delete, /* file delete method */ + H5O__pline_shared_link, /* link method */ + NULL, /* set share method */ + NULL, /*can share method */ + H5O__pline_pre_copy_file, /* pre copy native value to file */ + H5O__pline_shared_copy_file,/* copy native value to file */ + H5O__pline_shared_post_copy_file, /* post copy native value to file */ + NULL, /* get creation index */ + NULL, /* set creation index */ + H5O__pline_shared_debug /* debug the message */ }}; /* Format version bounds for filter pipleline */ @@ -105,12 +105,12 @@ H5FL_DEFINE(H5O_pline_t); /*------------------------------------------------------------------------- * Function: H5O__pline_decode * - * Purpose: Decodes a filter pipeline message. + * Purpose: Decodes a filter pipeline message. * - * Return: Success: Ptr to the native message. - * Failure: NULL + * Return: Success: Ptr to the native message. + * Failure: NULL * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, April 15, 1998 * *------------------------------------------------------------------------- @@ -223,7 +223,7 @@ H5O__pline_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, if (p + 4 - 1 <= p_end) UINT32DECODE(p, filter->cd_values[j]) else - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "ran off the end of the buffer: current p = %p, p_size = %zu, p_end = %p", p, p_size, p_end) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "ran off the end of the buffer: current p = %p, p_size = %zu, p_end = %p", (const void *)p, p_size, (const void *)p_end) } if(pline->version == H5O_PLINE_VERSION_1) @@ -246,7 +246,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_pline_encode + * Function: H5O__pline_encode * * Purpose: Encodes message MESG into buffer P. * @@ -258,13 +258,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_pline_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p/*out*/, const void *mesg) +H5O__pline_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p/*out*/, const void *mesg) { const H5O_pline_t *pline = (const H5O_pline_t*)mesg; /* Pipeline message to encode */ const H5Z_filter_info_t *filter; /* Filter to encode */ size_t i, j; /* Local index variables */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check args */ HDassert(p); @@ -288,7 +288,7 @@ H5O_pline_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p/*out*/, const void *mesg) size_t name_length; /* Length of filter name */ /* Filter ID */ - UINT16ENCODE(p, filter->id); + UINT16ENCODE(p, filter->id); /* Skip writing the name length & name if the filter is an internal filter */ if(pline->version > H5O_PLINE_VERSION_1 && filter->id < H5Z_FILTER_RESERVED) { @@ -312,26 +312,26 @@ H5O_pline_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p/*out*/, const void *mesg) } /* end else */ /* Filter flags */ - UINT16ENCODE(p, filter->flags); + UINT16ENCODE(p, filter->flags); /* # of filter parameters */ - UINT16ENCODE(p, filter->cd_nelmts); + UINT16ENCODE(p, filter->cd_nelmts); /* Encode name, if there is one to encode */ - if(name_length > 0) { + if(name_length > 0) { /* Store name, with null terminator */ - H5MM_memcpy(p, name, name_length); - p += name_length; + H5MM_memcpy(p, name, name_length); + p += name_length; /* Pad out name to alignment, in older versions */ if(pline->version == H5O_PLINE_VERSION_1) while(name_length++ % 8) *p++ = 0; - } /* end if */ + } /* end if */ /* Filter parameters */ - for(j = 0; j < filter->cd_nelmts; j++) - UINT32ENCODE(p, filter->cd_values[j]); + for(j = 0; j < filter->cd_nelmts; j++) + UINT32ENCODE(p, filter->cd_values[j]); /* Align the parameters for older versions of the format */ if(pline->version == H5O_PLINE_VERSION_1) @@ -340,11 +340,11 @@ H5O_pline_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p/*out*/, const void *mesg) } /* end for */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5O_pline_encode() */ +} /* end H5O__pline_encode() */ /*------------------------------------------------------------------------- - * Function: H5O_pline_copy + * Function: H5O__pline_copy * * Purpose: Copies a filter pipeline message from SRC to DST allocating * DST if necessary. If DST is already allocated then we assume @@ -360,18 +360,18 @@ H5O_pline_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p/*out*/, const void *mesg) *------------------------------------------------------------------------- */ static void * -H5O_pline_copy(const void *_src, void *_dst/*out*/) +H5O__pline_copy(const void *_src, void *_dst/*out*/) { const H5O_pline_t *src = (const H5O_pline_t *)_src; /* Source pipeline message */ H5O_pline_t *dst = (H5O_pline_t *)_dst; /* Destination pipeline message */ size_t i; /* Local index variable */ H5O_pline_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Allocate pipeline message, if not provided */ if(!dst && NULL == (dst = H5FL_MALLOC(H5O_pline_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Shallow copy basic fields */ *dst = *src; @@ -428,16 +428,16 @@ H5O_pline_copy(const void *_src, void *_dst/*out*/) done: if(!ret_value && dst) { H5O__pline_reset(dst); - if(!_dst) + if(!_dst) H5O__pline_free(dst); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_pline_copy() */ +} /* end H5O__pline_copy() */ /*------------------------------------------------------------------------- - * Function: H5O_pline_size + * Function: H5O__pline_size * * Purpose: Determines the size of a raw filter pipeline message. * @@ -451,18 +451,18 @@ done: *------------------------------------------------------------------------- */ static size_t -H5O_pline_size(const H5F_t H5_ATTR_UNUSED *f, const void *mesg) +H5O__pline_size(const H5F_t H5_ATTR_UNUSED *f, const void *mesg) { const H5O_pline_t *pline = (const H5O_pline_t*)mesg; /* Pipeline message */ size_t i; /* Local index variable */ size_t ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Message header */ ret_value = (size_t)(1 + /*version */ - 1 + /*number of filters */ - (pline->version == H5O_PLINE_VERSION_1 ? 6 : 0)); /*reserved */ + 1 + /*number of filters */ + (pline->version == H5O_PLINE_VERSION_1 ? 6 : 0)); /*reserved */ /* Calculate size of each filter in pipeline */ for(i = 0; i < pline->nused; i++) { @@ -475,26 +475,26 @@ H5O_pline_size(const H5F_t H5_ATTR_UNUSED *f, const void *mesg) else { H5Z_class2_t *cls; /* Filter class */ - /* Get the name of the filter, same as done with H5O_pline_encode() */ + /* Get the name of the filter, same as done with H5O__pline_encode() */ if(NULL == (name = pline->filter[i].name) && (cls = H5Z_find(pline->filter[i].id))) name = cls->name; name_len = name ? HDstrlen(name) + 1 : 0; } /* end else */ - ret_value += 2 + /*filter identification number */ - (size_t)((pline->version == H5O_PLINE_VERSION_1 || pline->filter[i].id >= H5Z_FILTER_RESERVED) ? 2 : 0) + /*name length */ - 2 + /*flags */ - 2 + /*number of client data values */ - (pline->version == H5O_PLINE_VERSION_1 ? (size_t)H5O_ALIGN_OLD(name_len) : name_len); /*length of the filter name */ + ret_value += 2 + /*filter identification number */ + (size_t)((pline->version == H5O_PLINE_VERSION_1 || pline->filter[i].id >= H5Z_FILTER_RESERVED) ? 2 : 0) + /*name length */ + 2 + /*flags */ + 2 + /*number of client data values */ + (pline->version == H5O_PLINE_VERSION_1 ? (size_t)H5O_ALIGN_OLD(name_len) : name_len); /*length of the filter name */ - ret_value += pline->filter[i].cd_nelmts * 4; + ret_value += pline->filter[i].cd_nelmts * 4; if(pline->version == H5O_PLINE_VERSION_1) if(pline->filter[i].cd_nelmts % 2) ret_value += 4; } /* end for */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_pline_size() */ +} /* end H5O__pline_size() */ /*------------------------------------------------------------------------- @@ -525,8 +525,7 @@ H5O__pline_reset(void *mesg) HDassert(pline); /* Free the filter information and array */ - if (pline->filter) { - + if(pline->filter) { /* Free information for each filter */ for(i = 0; i < pline->nused; i++) { if(pline->filter[i].name && pline->filter[i].name != pline->filter[i]._name) @@ -579,7 +578,7 @@ H5O__pline_free(void *mesg) /*------------------------------------------------------------------------- - * Function: H5O_pline_pre_copy_file + * Function: H5O__pline_pre_copy_file * * Purpose: Perform any necessary actions before copying message between * files @@ -594,14 +593,14 @@ H5O__pline_free(void *mesg) *------------------------------------------------------------------------- */ static herr_t -H5O_pline_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void *mesg_src, +H5O__pline_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void *mesg_src, hbool_t H5_ATTR_UNUSED *deleted, const H5O_copy_t *cpy_info, void *_udata) { const H5O_pline_t *pline_src = (const H5O_pline_t *)mesg_src; /* Source pline */ 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 + FUNC_ENTER_STATIC /* check args */ HDassert(pline_src); @@ -618,12 +617,12 @@ H5O_pline_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void *mesg_src, * the object copying process. */ if(udata) - if(NULL == (udata->src_pline = (H5O_pline_t *)H5O_pline_copy(pline_src, NULL))) + if(NULL == (udata->src_pline = (H5O_pline_t *)H5O__pline_copy(pline_src, NULL))) HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to copy") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_pline_pre_copy_file() */ +} /* end H5O__pline_pre_copy_file() */ /*------------------------------------------------------------------------- @@ -663,36 +662,36 @@ H5O__pline_debug(H5F_t H5_ATTR_UNUSED *f, const void *mesg, FILE *stream, /* Loop over all the filters */ for(i = 0; i < pline->nused; i++) { - char name[32]; - - HDsnprintf(name, sizeof(name), "Filter at position %u", (unsigned)i); - HDfprintf(stream, "%*s%-*s\n", indent, "", fwidth, name); - HDfprintf(stream, "%*s%-*s 0x%04x\n", indent + 3, "", MAX(0, fwidth - 3), - "Filter identification:", - (unsigned)(pline->filter[i].id)); - if(pline->filter[i].name) - HDfprintf(stream, "%*s%-*s \"%s\"\n", indent + 3, "", MAX(0, fwidth - 3), - "Filter name:", - pline->filter[i].name); - else - HDfprintf(stream, "%*s%-*s NONE\n", indent + 3, "", MAX(0, fwidth - 3), - "Filter name:"); - HDfprintf(stream, "%*s%-*s 0x%04x\n", indent + 3, "", MAX(0, fwidth - 3), - "Flags:", - pline->filter[i].flags); - HDfprintf(stream, "%*s%-*s %Zu\n", indent + 3, "", MAX(0, fwidth - 3), - "Num CD values:", - pline->filter[i].cd_nelmts); + char name[32]; + + HDsnprintf(name, sizeof(name), "Filter at position %u", (unsigned)i); + HDfprintf(stream, "%*s%-*s\n", indent, "", fwidth, name); + HDfprintf(stream, "%*s%-*s 0x%04x\n", indent + 3, "", MAX(0, fwidth - 3), + "Filter identification:", + (unsigned)(pline->filter[i].id)); + if(pline->filter[i].name) + HDfprintf(stream, "%*s%-*s \"%s\"\n", indent + 3, "", MAX(0, fwidth - 3), + "Filter name:", + pline->filter[i].name); + else + HDfprintf(stream, "%*s%-*s NONE\n", indent + 3, "", MAX(0, fwidth - 3), + "Filter name:"); + HDfprintf(stream, "%*s%-*s 0x%04x\n", indent + 3, "", MAX(0, fwidth - 3), + "Flags:", + pline->filter[i].flags); + HDfprintf(stream, "%*s%-*s %Zu\n", indent + 3, "", MAX(0, fwidth - 3), + "Num CD values:", + pline->filter[i].cd_nelmts); - /* Filter parameters */ - for(j = 0; j < pline->filter[i].cd_nelmts; j++) { - char field_name[32]; + /* Filter parameters */ + for(j = 0; j < pline->filter[i].cd_nelmts; j++) { + char field_name[32]; - HDsnprintf(field_name, sizeof(field_name), "CD value %lu", (unsigned long)j); - HDfprintf(stream, "%*s%-*s %u\n", indent + 6, "", MAX(0, fwidth - 6), - field_name, - pline->filter[i].cd_values[j]); - } /* end for */ + HDsnprintf(field_name, sizeof(field_name), "CD value %lu", (unsigned long)j); + HDfprintf(stream, "%*s%-*s %u\n", indent + 6, "", MAX(0, fwidth - 6), + field_name, + pline->filter[i].cd_values[j]); + } /* end for */ } /* end for */ FUNC_LEAVE_NOAPI(SUCCEED) diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index 0be6d89..fdbc368 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -15,7 +15,7 @@ * * Created: H5Oprivate.h * Aug 5 1997 - * Robb Matzke + * Robb Matzke * * Purpose: Object header private include file. * @@ -885,13 +885,10 @@ struct H5P_genplist_t; H5_DLL herr_t H5O_init(void); H5_DLL herr_t H5O_create(H5F_t *f, size_t size_hint, size_t initial_rc, hid_t ocpl_id, H5O_loc_t *loc/*out*/); -H5_DLL H5O_t *H5O__create_ohdr(H5F_t *f, hid_t ocpl_id); -H5_DLL herr_t H5O__apply_ohdr(H5F_t *f, H5O_t *oh, hid_t ocpl_id, +H5_DLL H5O_t *H5O_create_ohdr(H5F_t *f, hid_t ocpl_id); +H5_DLL herr_t H5O_apply_ohdr(H5F_t *f, H5O_t *oh, hid_t ocpl_id, size_t size_hint, size_t initial_rc, H5O_loc_t *loc_out); H5_DLL herr_t H5O_open(H5O_loc_t *loc); -H5_DLL void *H5O_open_by_idx(const H5G_loc_t *loc, const char *name, - H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5I_type_t *opened_type/*out*/); -H5_DLL void *H5O_open_by_addr(const H5G_loc_t *loc, haddr_t addr, H5I_type_t *opened_type/*out*/); H5_DLL void *H5O_open_by_loc(const H5G_loc_t *obj_loc, H5I_type_t *opened_type/*out*/); H5_DLL herr_t H5O_close(H5O_loc_t *loc, hbool_t *file_closed/*out*/); H5_DLL int H5O_link(const H5O_loc_t *loc, int adjust); @@ -986,8 +983,6 @@ H5_DLL herr_t H5O_copy_header_map(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst H5_DLL herr_t H5O_copy_expand_ref(H5F_t *file_src, hid_t tid_src, H5T_t *dt_src, void *buf_src, size_t nbytes_src, H5F_t *file_dst, void *buf_dst, H5O_copy_t *cpy_info); -H5_DLL herr_t H5O_copy(const H5G_loc_t *src_loc, const char *src_name, - H5G_loc_t *dst_loc, const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id); /* Debugging routines */ H5_DLL herr_t H5O_debug_id(unsigned type_id, H5F_t *f, const void *mesg, FILE *stream, int indent, int fwidth); diff --git a/src/H5Opublic.h b/src/H5Opublic.h index d0f8ab3..23a6cba 100644 --- a/src/H5Opublic.h +++ b/src/H5Opublic.h @@ -15,7 +15,7 @@ * * Created: H5Opublic.h * Aug 5 1997 - * Robb Matzke + * Robb Matzke * * Purpose: Public declarations for the H5O (object header) * package. diff --git a/src/H5Orefcount.c b/src/H5Orefcount.c index 66b79bb..1ef8486 100644 --- a/src/H5Orefcount.c +++ b/src/H5Orefcount.c @@ -15,7 +15,7 @@ * * Created: H5Orefcount.c * Mar 10 2007 - * Quincey Koziol + * Quincey Koziol * * Purpose: Object ref. count messages. * @@ -34,11 +34,11 @@ /* PRIVATE PROTOTYPES */ static void *H5O__refcount_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p); -static herr_t H5O_refcount_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); -static void *H5O_refcount_copy(const void *_mesg, void *_dest); -static size_t H5O_refcount_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); +static herr_t H5O__refcount_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); +static void *H5O__refcount_copy(const void *_mesg, void *_dest); +static size_t H5O__refcount_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); static herr_t H5O__refcount_free(void *_mesg); -static herr_t H5O_refcount_pre_copy_file(H5F_t *file_src, const void *mesg_src, +static herr_t H5O__refcount_pre_copy_file(H5F_t *file_src, const void *mesg_src, hbool_t *deleted, const H5O_copy_t *cpy_info, void *udata); static herr_t H5O__refcount_debug(H5F_t *f, const void *_mesg, FILE * stream, int indent, int fwidth); @@ -50,16 +50,16 @@ const H5O_msg_class_t H5O_MSG_REFCOUNT[1] = {{ sizeof(H5O_refcount_t), /*native message size */ 0, /* messages are sharable? */ H5O__refcount_decode, /*decode message */ - H5O_refcount_encode, /*encode message */ - H5O_refcount_copy, /*copy the native value */ - H5O_refcount_size, /*size of symbol table entry */ + H5O__refcount_encode, /*encode message */ + H5O__refcount_copy, /*copy the native value */ + H5O__refcount_size, /*size of symbol table entry */ NULL, /*default reset method */ H5O__refcount_free, /* free method */ NULL, /* file delete method */ NULL, /* link method */ NULL, /*set share method */ NULL, /*can share method */ - H5O_refcount_pre_copy_file, /* pre copy native value to file */ + H5O__refcount_pre_copy_file,/* pre copy native value to file */ NULL, /* copy native value to file */ NULL, /* post copy native value to file */ NULL, /* get creation index */ @@ -83,7 +83,6 @@ H5FL_DEFINE_STATIC(H5O_refcount_t); * Failure: NULL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Mar 10 2007 * *------------------------------------------------------------------------- @@ -125,24 +124,23 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_refcount_encode + * Function: H5O__refcount_encode * * Purpose: Encodes a message. * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Mar 10 2007 * *------------------------------------------------------------------------- */ static herr_t -H5O_refcount_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) +H5O__refcount_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) { const H5O_refcount_t *refcount = (const H5O_refcount_t *)_mesg; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* check args */ HDassert(f); @@ -156,11 +154,11 @@ H5O_refcount_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shar UINT32ENCODE(p, *refcount); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5O_refcount_encode() */ +} /* end H5O__refcount_encode() */ /*------------------------------------------------------------------------- - * Function: H5O_refcount_copy + * Function: H5O__refcount_copy * * Purpose: Copies a message from _MESG to _DEST, allocating _DEST if * necessary. @@ -169,19 +167,18 @@ H5O_refcount_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shar * Failure: NULL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Mar 10 2007 * *------------------------------------------------------------------------- */ static void * -H5O_refcount_copy(const void *_mesg, void *_dest) +H5O__refcount_copy(const void *_mesg, void *_dest) { const H5O_refcount_t *refcount = (const H5O_refcount_t *)_mesg; H5O_refcount_t *dest = (H5O_refcount_t *) _dest; void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(refcount); @@ -196,11 +193,11 @@ H5O_refcount_copy(const void *_mesg, void *_dest) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_refcount_copy() */ +} /* end H5O__refcount_copy() */ /*------------------------------------------------------------------------- - * Function: H5O_refcount_size + * Function: H5O__refcount_size * * Purpose: Returns the size of the raw message in bytes not counting * the message type or size fields, but only the data fields. @@ -210,25 +207,24 @@ done: * Failure: zero * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Mar 10 2007 * *------------------------------------------------------------------------- */ static size_t -H5O_refcount_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, +H5O__refcount_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, const void H5_ATTR_UNUSED *_mesg) { - size_t ret_value; /* Return value */ + size_t ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Set return value */ ret_value = 1 /* Version */ + 4; /* Ref. count */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_refcount_size() */ +} /* end H5O__refcount_size() */ /*------------------------------------------------------------------------- @@ -257,7 +253,7 @@ H5O__refcount_free(void *mesg) /*------------------------------------------------------------------------- - * Function: H5O_refcount_pre_copy_file + * Function: H5O__refcount_pre_copy_file * * Purpose: Perform any necessary actions before copying message between * files. @@ -271,10 +267,10 @@ H5O__refcount_free(void *mesg) *------------------------------------------------------------------------- */ static herr_t -H5O_refcount_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void H5_ATTR_UNUSED *native_src, +H5O__refcount_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void H5_ATTR_UNUSED *native_src, hbool_t *deleted, const H5O_copy_t H5_ATTR_UNUSED *cpy_info, void H5_ATTR_UNUSED *udata) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* check args */ HDassert(deleted); @@ -286,7 +282,7 @@ H5O_refcount_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void H5_ATTR_UN *deleted = TRUE; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5O_refcount_pre_copy_file() */ +} /* end H5O__refcount_pre_copy_file() */ /*------------------------------------------------------------------------- @@ -297,7 +293,6 @@ H5O_refcount_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void H5_ATTR_UN * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Mar 6 2007 * *------------------------------------------------------------------------- diff --git a/src/H5Osdspace.c b/src/H5Osdspace.c index 33310dc..54ac71f 100644 --- a/src/H5Osdspace.c +++ b/src/H5Osdspace.c @@ -27,34 +27,34 @@ /* PRIVATE PROTOTYPES */ static void *H5O__sdspace_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p); -static herr_t H5O_sdspace_encode(H5F_t *f, uint8_t *p, const void *_mesg); -static void *H5O_sdspace_copy(const void *_mesg, void *_dest); -static size_t H5O_sdspace_size(const H5F_t *f, const void *_mesg); +static herr_t H5O__sdspace_encode(H5F_t *f, uint8_t *p, const void *_mesg); +static void *H5O__sdspace_copy(const void *_mesg, void *_dest); +static size_t H5O__sdspace_size(const H5F_t *f, const void *_mesg); static herr_t H5O__sdspace_reset(void *_mesg); static herr_t H5O__sdspace_free(void *_mesg); -static herr_t H5O_sdspace_pre_copy_file(H5F_t *file_src, const void *mesg_src, +static herr_t H5O__sdspace_pre_copy_file(H5F_t *file_src, const void *mesg_src, hbool_t *deleted, const H5O_copy_t *cpy_info, void *_udata); static herr_t H5O__sdspace_debug(H5F_t *f, const void *_mesg, FILE * stream, int indent, int fwidth); /* Set up & include shared message "interface" info */ #define H5O_SHARED_TYPE H5O_MSG_SDSPACE -#define H5O_SHARED_DECODE H5O_sdspace_shared_decode +#define H5O_SHARED_DECODE H5O__sdspace_shared_decode #define H5O_SHARED_DECODE_REAL H5O__sdspace_decode -#define H5O_SHARED_ENCODE H5O_sdspace_shared_encode -#define H5O_SHARED_ENCODE_REAL H5O_sdspace_encode -#define H5O_SHARED_SIZE H5O_sdspace_shared_size -#define H5O_SHARED_SIZE_REAL H5O_sdspace_size +#define H5O_SHARED_ENCODE H5O__sdspace_shared_encode +#define H5O_SHARED_ENCODE_REAL H5O__sdspace_encode +#define H5O_SHARED_SIZE H5O__sdspace_shared_size +#define H5O_SHARED_SIZE_REAL H5O__sdspace_size #define H5O_SHARED_DELETE H5O__sdspace_shared_delete #undef H5O_SHARED_DELETE_REAL #define H5O_SHARED_LINK H5O__sdspace_shared_link #undef H5O_SHARED_LINK_REAL #define H5O_SHARED_COPY_FILE H5O__sdspace_shared_copy_file #undef H5O_SHARED_COPY_FILE_REAL -#define H5O_SHARED_POST_COPY_FILE H5O_sdspace_shared_post_copy_file +#define H5O_SHARED_POST_COPY_FILE H5O__sdspace_shared_post_copy_file #undef H5O_SHARED_POST_COPY_FILE_REAL #undef H5O_SHARED_POST_COPY_FILE_UPD -#define H5O_SHARED_DEBUG H5O_sdspace_shared_debug +#define H5O_SHARED_DEBUG H5O__sdspace_shared_debug #define H5O_SHARED_DEBUG_REAL H5O__sdspace_debug #include "H5Oshared.h" /* Shared Object Header Message Callbacks */ @@ -63,23 +63,23 @@ const H5O_msg_class_t H5O_MSG_SDSPACE[1] = {{ H5O_SDSPACE_ID, /* message id number */ "dataspace", /* message name for debugging */ sizeof(H5S_extent_t), /* native message size */ - H5O_SHARE_IS_SHARABLE|H5O_SHARE_IN_OHDR, /* messages are sharable? */ - H5O_sdspace_shared_decode, /* decode message */ - H5O_sdspace_shared_encode, /* encode message */ - H5O_sdspace_copy, /* copy the native value */ - H5O_sdspace_shared_size, /* size of symbol table entry */ + H5O_SHARE_IS_SHARABLE | H5O_SHARE_IN_OHDR, /* messages are sharable? */ + H5O__sdspace_shared_decode, /* decode message */ + H5O__sdspace_shared_encode, /* encode message */ + H5O__sdspace_copy, /* copy the native value */ + H5O__sdspace_shared_size, /* size of symbol table entry */ H5O__sdspace_reset, /* default reset method */ H5O__sdspace_free, /* free method */ - H5O__sdspace_shared_delete, /* file delete method */ - H5O__sdspace_shared_link, /* link method */ - NULL, /* set share method */ - NULL, /*can share method */ - H5O_sdspace_pre_copy_file, /* pre copy native value to file */ - H5O__sdspace_shared_copy_file,/* copy native value to file */ - H5O_sdspace_shared_post_copy_file,/* post copy native value to file */ - NULL, /* get creation index */ - NULL, /* set creation index */ - H5O_sdspace_shared_debug /* debug the message */ + H5O__sdspace_shared_delete, /* file delete method */ + H5O__sdspace_shared_link, /* link method */ + NULL, /* set share method */ + NULL, /*can share method */ + H5O__sdspace_pre_copy_file, /* pre copy native value to file */ + H5O__sdspace_shared_copy_file,/* copy native value to file */ + H5O__sdspace_shared_post_copy_file,/* post copy native value to file*/ + NULL, /* get creation index */ + NULL, /* set creation index */ + H5O__sdspace_shared_debug /* debug the message */ }}; /* Declare external the free list for H5S_extent_t's */ @@ -199,11 +199,11 @@ done: /*-------------------------------------------------------------------------- NAME - H5O_sdspace_encode + H5O__sdspace_encode PURPOSE Encode a simple dimensionality message USAGE - herr_t H5O_sdspace_encode(f, raw_size, p, mesg) + herr_t H5O__sdspace_encode(f, raw_size, p, mesg) H5F_t *f; IN: pointer to the HDF5 file struct size_t raw_size; IN: size of the raw information buffer const uint8 *p; IN: the raw information buffer @@ -214,28 +214,15 @@ done: This function encodes the native memory form of the simple dimensionality message in the "raw" disk form. - MODIFICATIONS - Robb Matzke, 1998-04-09 - The current and maximum dimensions are now H5F_SIZEOF_SIZET bytes - instead of just four bytes. - - Robb Matzke, 1998-07-20 - Added a version number and reformatted the message for aligment. - - Raymond Lu - April 8, 2004 - Added the type of dataspace into this header message using a reserved - byte. - --------------------------------------------------------------------------*/ static herr_t -H5O_sdspace_encode(H5F_t *f, uint8_t *p, const void *_mesg) +H5O__sdspace_encode(H5F_t *f, uint8_t *p, const void *_mesg) { const H5S_extent_t *sdim = (const H5S_extent_t *)_mesg; unsigned flags = 0; unsigned u; /* Local counting variable */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* check args */ HDassert(f); @@ -277,16 +264,16 @@ H5O_sdspace_encode(H5F_t *f, uint8_t *p, const void *_mesg) } /* end if */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5O_sdspace_encode() */ +} /* end H5O__sdspace_encode() */ /*-------------------------------------------------------------------------- NAME - H5O_sdspace_copy + H5O__sdspace_copy PURPOSE Copies a message from MESG to DEST, allocating DEST if necessary. USAGE - void *H5O_sdspace_copy(_mesg, _dest) + void *H5O__sdspace_copy(_mesg, _dest) const void *_mesg; IN: Pointer to the source extent dimensionality struct const void *_dest; IN: Pointer to the destination extent dimensionality struct RETURNS @@ -296,13 +283,13 @@ H5O_sdspace_encode(H5F_t *f, uint8_t *p, const void *_mesg) allocating the destination structure if necessary. --------------------------------------------------------------------------*/ static void * -H5O_sdspace_copy(const void *_mesg, void *_dest) +H5O__sdspace_copy(const void *_mesg, void *_dest) { const H5S_extent_t *mesg = (const H5S_extent_t *)_mesg; H5S_extent_t *dest = (H5S_extent_t *)_dest; void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(mesg); @@ -322,16 +309,16 @@ done: dest = H5FL_FREE(H5S_extent_t, dest); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_sdspace_copy() */ +} /* end H5O__sdspace_copy() */ /*-------------------------------------------------------------------------- NAME - H5O_sdspace_size + H5O__sdspace_size PURPOSE Return the raw message size in bytes USAGE - void *H5O_sdspace_size(f, mesg) + void *H5O__sdspace_size(f, mesg) H5F_t *f; IN: pointer to the HDF5 file struct const void *mesg; IN: Pointer to the source extent dimensionality struct RETURNS @@ -341,18 +328,14 @@ done: success. (Not counting the message type or size fields, only the data portion of the message). It doesn't take into account alignment. - MODIFICATIONS - Robb Matzke, 1998-04-09 - The current and maximum dimensions are now H5F_SIZEOF_SIZET bytes - instead of just four bytes. --------------------------------------------------------------------------*/ static size_t -H5O_sdspace_size(const H5F_t *f, const void *_mesg) +H5O__sdspace_size(const H5F_t *f, const void *_mesg) { const H5S_extent_t *space = (const H5S_extent_t *)_mesg; size_t ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Basic information for all dataspace messages */ ret_value = (size_t)(1 + /* Version */ @@ -368,7 +351,7 @@ H5O_sdspace_size(const H5F_t *f, const void *_mesg) ret_value += space->max ? (space->rank * H5F_SIZEOF_SIZE(f)) : 0; FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_sdspace_size() */ +} /* end H5O__sdspace_size() */ /*------------------------------------------------------------------------- @@ -423,7 +406,7 @@ H5O__sdspace_free(void *mesg) /*------------------------------------------------------------------------- - * Function: H5O_sdspace_pre_copy_file + * Function: H5O__sdspace_pre_copy_file * * Purpose: Perform any necessary actions before copying message between * files @@ -438,14 +421,14 @@ H5O__sdspace_free(void *mesg) *------------------------------------------------------------------------- */ static herr_t -H5O_sdspace_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void *mesg_src, +H5O__sdspace_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void *mesg_src, hbool_t H5_ATTR_UNUSED *deleted, const H5O_copy_t *cpy_info, void *_udata) { const H5S_extent_t *src_space_extent = (const H5S_extent_t *)mesg_src; /* Source dataspace extent */ H5D_copy_file_ud_t *udata = (H5D_copy_file_ud_t *)_udata; /* Dataset copying user data */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(file_src); diff --git a/src/H5Oshared.c b/src/H5Oshared.c index b49e501..ca6c873 100644 --- a/src/H5Oshared.c +++ b/src/H5Oshared.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, April 1, 1998 * * Purpose: Functions that operate on a shared message. The shared @@ -103,7 +103,6 @@ static herr_t H5O__shared_link_adj(H5F_t *f, H5O_t *open_oh, * Failure: NULL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Sep 24 2003 * *------------------------------------------------------------------------- @@ -217,7 +216,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Sep 26 2003 * *------------------------------------------------------------------------- @@ -443,7 +441,6 @@ H5O__shared_encode(const H5F_t *f, uint8_t *buf/*out*/, const H5O_shared_t *sh_m * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Sep 26 2003 * *------------------------------------------------------------------------- @@ -654,7 +651,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Peter Cao - * xcao@hdfgroup.org * May 24 2007 * *------------------------------------------------------------------------- diff --git a/src/H5Oshared.h b/src/H5Oshared.h index e4ad980..6dbf927 100644 --- a/src/H5Oshared.h +++ b/src/H5Oshared.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Friday, January 19, 2007 * * Purpose: This file contains inline definitions for "generic" routines diff --git a/src/H5Oshmesg.c b/src/H5Oshmesg.c index 136268a..10181ad 100644 --- a/src/H5Oshmesg.c +++ b/src/H5Oshmesg.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: James Laird +/* Programmer: James Laird * Monday, January 29, 2007 * * Purpose: A message holding "implicitly shared object header message" @@ -29,9 +29,9 @@ static void *H5O__shmesg_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p); -static herr_t H5O_shmesg_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); -static void *H5O_shmesg_copy(const void *_mesg, void *_dest); -static size_t H5O_shmesg_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); +static herr_t H5O__shmesg_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); +static void *H5O__shmesg_copy(const void *_mesg, void *_dest); +static size_t H5O__shmesg_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); static herr_t H5O__shmesg_debug(H5F_t *f, const void *_mesg, FILE *stream, int indent, int fwidth); @@ -42,9 +42,9 @@ const H5O_msg_class_t H5O_MSG_SHMESG[1] = {{ sizeof(H5O_shmesg_table_t), /*native message size */ 0, /* messages are sharable? */ H5O__shmesg_decode, /*decode message */ - H5O_shmesg_encode, /*encode message */ - H5O_shmesg_copy, /*copy the native value */ - H5O_shmesg_size, /*raw message size */ + H5O__shmesg_encode, /*encode message */ + H5O__shmesg_copy, /*copy the native value */ + H5O__shmesg_size, /*raw message size */ NULL, /*free internal memory */ NULL, /* free method */ NULL, /* file delete method */ @@ -105,7 +105,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_shmesg_encode + * Function: H5O__shmesg_encode * * Purpose: Encode a shared message table message. * @@ -117,11 +117,11 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_shmesg_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) +H5O__shmesg_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) { const H5O_shmesg_table_t *mesg = (const H5O_shmesg_table_t *)_mesg; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity check */ HDassert(f); @@ -134,11 +134,11 @@ H5O_shmesg_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, c *p++ = (uint8_t)mesg->nindexes; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5O_shmesg_encode() */ +} /* end H5O__shmesg_encode() */ /*------------------------------------------------------------------------- - * Function: H5O_shmesg_copy + * Function: H5O__shmesg_copy * * Purpose: Copies a message from _MESG to _DEST, allocating _DEST if * necessary. @@ -152,13 +152,13 @@ H5O_shmesg_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, c *------------------------------------------------------------------------- */ static void * -H5O_shmesg_copy(const void *_mesg, void *_dest) +H5O__shmesg_copy(const void *_mesg, void *_dest) { const H5O_shmesg_table_t *mesg = (const H5O_shmesg_table_t *)_mesg; H5O_shmesg_table_t *dest = (H5O_shmesg_table_t *)_dest; void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity check */ HDassert(mesg); @@ -174,11 +174,11 @@ H5O_shmesg_copy(const void *_mesg, void *_dest) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_shmesg_copy() */ +} /* end H5O__shmesg_copy() */ /*------------------------------------------------------------------------- - * Function: H5O_shmesg_size + * Function: H5O__shmesg_size * * Purpose: Returns the size of the raw message in bytes not counting the * message type or size fields, but only the data fields. @@ -192,11 +192,11 @@ done: *------------------------------------------------------------------------- */ static size_t -H5O_shmesg_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void H5_ATTR_UNUSED *_mesg) +H5O__shmesg_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void H5_ATTR_UNUSED *_mesg) { size_t ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity check */ HDassert(f); @@ -206,7 +206,7 @@ H5O_shmesg_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const voi 1); /* Number of indexes */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_shmesg_size() */ +} /* end H5O__shmesg_size() */ /*------------------------------------------------------------------------- diff --git a/src/H5Ostab.c b/src/H5Ostab.c index 0f14a4b..18f32b3 100644 --- a/src/H5Ostab.c +++ b/src/H5Ostab.c @@ -15,7 +15,7 @@ * * Created: H5Ostab.c * Aug 6 1997 - * Robb Matzke + * Robb Matzke * * Purpose: Symbol table messages. * @@ -90,7 +90,6 @@ H5FL_DEFINE_STATIC(H5O_stab_t); * Failure: NULL * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 6 1997 * *------------------------------------------------------------------------- @@ -103,7 +102,7 @@ H5O__stab_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, H5O_stab_t *stab = NULL; void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(f); @@ -119,10 +118,9 @@ H5O__stab_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, ret_value = stab; done: - if(ret_value == NULL) { + if(ret_value == NULL) if(stab != NULL) stab = H5FL_FREE(H5O_stab_t, stab); - } /* end if */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__stab_decode() */ @@ -136,7 +134,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 6 1997 * *------------------------------------------------------------------------- @@ -172,7 +169,6 @@ H5O__stab_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, co * Failure: NULL * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 6 1997 * *------------------------------------------------------------------------- @@ -189,7 +185,7 @@ H5O__stab_copy(const void *_mesg, void *_dest) /* check args */ HDassert(stab); if(!dest && NULL == (dest = H5FL_MALLOC(H5O_stab_t))) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* copy */ *dest = *stab; @@ -214,7 +210,6 @@ done: * Failure: zero * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 6 1997 * *------------------------------------------------------------------------- @@ -415,11 +410,8 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 6 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t diff --git a/src/H5Otest.c b/src/H5Otest.c index df08ff7..5d242f3 100644 --- a/src/H5Otest.c +++ b/src/H5Otest.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol +/* Programmer: Quincey Koziol * Monday, December 4, 2006 * * Purpose: Object header testing functions. @@ -789,5 +789,5 @@ done: HDONE_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_NOAPI(ret_value) -} /* H5O__msg_get_chunkno_test() */ +} /* H5O__msg_move_to_new_chunk_test() */ diff --git a/src/H5Ounknown.c b/src/H5Ounknown.c index 89c00ad..a7116c8 100644 --- a/src/H5Ounknown.c +++ b/src/H5Ounknown.c @@ -15,7 +15,7 @@ * * Created: H5Ounknown.c * Apr 19 2007 - * Quincey Koziol + * Quincey Koziol * * Purpose: Handle unknown message classes in a minimal way. * diff --git a/src/H5P.c b/src/H5P.c index 9bc293b..d490e7b 100644 --- a/src/H5P.c +++ b/src/H5P.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol +/* Programmer: Quincey Koziol * * Purpose: Generic Property Functions */ diff --git a/src/H5PBmodule.h b/src/H5PBmodule.h index c8aabb6..571d2be 100644 --- a/src/H5PBmodule.h +++ b/src/H5PBmodule.h @@ -11,7 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, September 12, 2015 * * Purpose: This file contains declarations which define macros for the diff --git a/src/H5PLpkg.h b/src/H5PLpkg.h index 8c2367f..a086a2c 100644 --- a/src/H5PLpkg.h +++ b/src/H5PLpkg.h @@ -95,7 +95,7 @@ # define H5PL_HANDLE void * /* Get a handle to a plugin library. Windows: TEXT macro handles Unicode strings */ -# define H5PL_OPEN_DLIB(S) dlopen(S, RTLD_LAZY) +# define H5PL_OPEN_DLIB(S) dlopen(S, RTLD_LAZY | RTLD_LOCAL) /* Get the address of a symbol in dynamic library */ # define H5PL_GET_LIB_FUNC(H,N) dlsym(H,N) diff --git a/src/H5PLprivate.h b/src/H5PLprivate.h index 5ce9b87..623e19a 100644 --- a/src/H5PLprivate.h +++ b/src/H5PLprivate.h @@ -21,8 +21,8 @@ #include "H5PLpublic.h" /* Private headers needed by this file */ -#include "H5private.h" /* Generic Functions */ -#include "H5VLprivate.h" /* Virtual Object Layer */ +#include "H5private.h" /* Generic Functions */ +#include "H5VLprivate.h" /* Virtual Object Layer */ /**************************/ diff --git a/src/H5Pdapl.c b/src/H5Pdapl.c index 5ce12b4..c3cb81d 100644 --- a/src/H5Pdapl.c +++ b/src/H5Pdapl.c @@ -15,7 +15,7 @@ * * Created: H5Pdapl.c * October 27, 2008 - * Neil Fortner + * Neil Fortner * * Purpose: Dataset access property list class routines * @@ -37,7 +37,7 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5Fprivate.h" /* Files */ #include "H5Iprivate.h" /* IDs */ -#include "H5MMprivate.h" /* Memory management */ +#include "H5MMprivate.h" /* Memory management */ #include "H5Ppkg.h" /* Property lists */ @@ -322,7 +322,7 @@ H5P__dapl_vds_file_pref_enc(const void *value, void **_pp, size_t *size) uint64_t enc_value; unsigned enc_size; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); @@ -374,7 +374,7 @@ H5P__dapl_vds_file_pref_dec(const void **_pp, void *_value) unsigned enc_size; /* Size of encoded property */ herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(pp); HDassert(*pp); @@ -418,7 +418,7 @@ static herr_t H5P__dapl_vds_file_pref_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(value); @@ -439,7 +439,7 @@ H5P__dapl_vds_file_pref_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNU static herr_t H5P__dapl_vds_file_pref_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(value); @@ -466,7 +466,7 @@ H5P__dapl_vds_file_pref_cmp(const void *value1, const void *value2, size_t H5_AT const char *pref2 = *(const char * const *)value2; int ret_value = 0; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR if(NULL == pref1 && NULL != pref2) HGOTO_DONE(1); @@ -491,7 +491,7 @@ done: static herr_t H5P__dapl_vds_file_pref_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(value); @@ -570,7 +570,7 @@ H5P__dapl_efile_pref_enc(const void *value, void **_pp, size_t *size) uint64_t enc_value; unsigned enc_size; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); @@ -622,7 +622,7 @@ H5P__dapl_efile_pref_dec(const void **_pp, void *_value) unsigned enc_size; /* Size of encoded property */ herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(pp); HDassert(*pp); @@ -666,7 +666,7 @@ static herr_t H5P__dapl_efile_pref_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(value); @@ -687,7 +687,7 @@ H5P__dapl_efile_pref_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED static herr_t H5P__dapl_efile_pref_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(value); @@ -714,7 +714,7 @@ H5P__dapl_efile_pref_cmp(const void *value1, const void *value2, size_t H5_ATTR_ const char *pref2 = *(const char * const *)value2; int ret_value = 0; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR if(NULL == pref1 && NULL != pref2) HGOTO_DONE(1); @@ -739,7 +739,7 @@ done: static herr_t H5P__dapl_efile_pref_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(value); @@ -885,7 +885,7 @@ H5P__encode_chunk_cache_nslots(const void *value, void **_pp, size_t *size) uint8_t **pp = (uint8_t **)_pp; unsigned enc_size; /* Size of encoded property */ - FUNC_ENTER_PACKAGE_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity checks */ HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); @@ -941,7 +941,7 @@ H5P__decode_chunk_cache_nslots(const void **_pp, void *_value) uint64_t enc_value; /* Decoded property value */ unsigned enc_size; /* Size of encoded property */ - FUNC_ENTER_PACKAGE_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity check */ HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); @@ -987,7 +987,7 @@ H5P__encode_chunk_cache_nbytes(const void *value, void **_pp, size_t *size) uint8_t **pp = (uint8_t **)_pp; unsigned enc_size; /* Size of encoded property */ - FUNC_ENTER_PACKAGE_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity checks */ HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); @@ -1043,7 +1043,7 @@ H5P__decode_chunk_cache_nbytes(const void **_pp, void *_value) uint64_t enc_value; /* Decoded property value */ unsigned enc_size; /* Size of encoded property */ - FUNC_ENTER_PACKAGE_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity check */ HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index 7e49c4b..11ab7b1 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -246,7 +246,7 @@ static hbool_t H5P_dcrt_def_layout_init_g = FALSE; static herr_t H5P__dcrt_reg_prop(H5P_genclass_t *pclass) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -421,13 +421,13 @@ H5P__dcrt_layout_enc(const void *value, void **_pp, size_t *size) for(u = 0; u < layout->storage.u.virt.list_nused; u++) { /* Source file name */ tmp_size = HDstrlen(layout->storage.u.virt.list[u].source_file_name) + (size_t)1; - (void)H5MM_memcpy(*pp, layout->storage.u.virt.list[u].source_file_name, tmp_size); + H5MM_memcpy(*pp, layout->storage.u.virt.list[u].source_file_name, tmp_size); *pp += tmp_size; *size += tmp_size; /* Source dataset name */ tmp_size = HDstrlen(layout->storage.u.virt.list[u].source_dset_name) + (size_t)1; - (void)H5MM_memcpy(*pp, layout->storage.u.virt.list[u].source_dset_name, tmp_size); + H5MM_memcpy(*pp, layout->storage.u.virt.list[u].source_dset_name, tmp_size); *pp += tmp_size; *size += tmp_size; @@ -597,14 +597,14 @@ H5P__dcrt_layout_dec(const void **_pp, void *value) tmp_size = HDstrlen((const char *)*pp) + 1; if(NULL == (tmp_layout.storage.u.virt.list[u].source_file_name = (char *)H5MM_malloc(tmp_size))) HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "unable to allocate memory for source file name") - (void)H5MM_memcpy(tmp_layout.storage.u.virt.list[u].source_file_name, *pp, tmp_size); + H5MM_memcpy(tmp_layout.storage.u.virt.list[u].source_file_name, *pp, tmp_size); *pp += tmp_size; /* Source dataset name */ tmp_size = HDstrlen((const char *)*pp) + 1; if(NULL == (tmp_layout.storage.u.virt.list[u].source_dset_name = (char *)H5MM_malloc(tmp_size))) HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "unable to allocate memory for source dataset name") - (void)H5MM_memcpy(tmp_layout.storage.u.virt.list[u].source_dset_name, *pp, tmp_size); + H5MM_memcpy(tmp_layout.storage.u.virt.list[u].source_dset_name, *pp, tmp_size); *pp += tmp_size; /* Source selection */ @@ -1847,13 +1847,6 @@ H5P__init_def_layout(void) * Programmer: Robb Matzke * Tuesday, January 6, 1998 * - * Modifications: - * - * Raymond Lu - * Tuesday, October 2, 2001 - * Changed the way to check parameter and set property for - * generic property list. - * *------------------------------------------------------------------------- */ herr_t @@ -1928,13 +1921,6 @@ done: * Programmer: Robb Matzke * Wednesday, January 7, 1998 * - * Modifications: - * - * Raymond Lu - * Tuesday, October 2, 2001 - * Changed the way to check parameter and get property for - * generic property list. - * *------------------------------------------------------------------------- */ H5D_layout_t @@ -1978,13 +1964,6 @@ done: * Programmer: Robb Matzke * Tuesday, January 6, 1998 * - * Modifications: - * - * Raymond Lu - * Tuesday, October 2, 2001 - * Changed the way to check parameter and set property for - * generic property list. - * *------------------------------------------------------------------------- */ herr_t @@ -2060,13 +2039,6 @@ done: * Programmer: Robb Matzke * Wednesday, January 7, 1998 * - * Modifications: - * - * Raymond Lu - * Tuesday, October 2, 2001 - * Changed the way to check parameter and set property for - * generic property list. - * *------------------------------------------------------------------------- */ int @@ -2375,7 +2347,7 @@ H5Pget_virtual_vspace(hid_t dcpl_id, size_t idx) /* Get the virtual space */ if(idx >= layout.storage.u.virt.list_nused) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid idx (out of range)") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid index (out of range)") HDassert(layout.storage.u.virt.list_nused <= layout.storage.u.virt.list_nalloc); if(NULL == (space = H5S_copy(layout.storage.u.virt.list[idx].source_dset.virtual_select, FALSE, TRUE))) HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to copy virtual selection") @@ -2431,9 +2403,9 @@ H5Pget_virtual_srcspace(hid_t dcpl_id, size_t idx) if(H5D_VIRTUAL != layout.type) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a virtual storage layout") - /* Check idx */ + /* Check index */ if(idx >= layout.storage.u.virt.list_nused) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid idx (out of range)") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid index (out of range)") HDassert(layout.storage.u.virt.list_nused <= layout.storage.u.virt.list_nalloc); /* Attempt to open source dataset and patch extent if extent status is not @@ -2537,7 +2509,7 @@ H5Pget_virtual_filename(hid_t dcpl_id, size_t idx, char *name/*out*/, /* Get the virtual filename */ if(idx >= layout.storage.u.virt.list_nused) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid idx (out of range)") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid index (out of range)") HDassert(layout.storage.u.virt.list_nused <= layout.storage.u.virt.list_nalloc); HDassert(layout.storage.u.virt.list[idx].source_file_name); if(name && (size > 0)) @@ -2600,7 +2572,7 @@ H5Pget_virtual_dsetname(hid_t dcpl_id, size_t idx, char *name/*out*/, /* Get the virtual filename */ if(idx >= layout.storage.u.virt.list_nused) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid idx (out of range)") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid index (out of range)") HDassert(layout.storage.u.virt.list_nused <= layout.storage.u.virt.list_nalloc); HDassert(layout.storage.u.virt.list[idx].source_dset_name); if(name && (size > 0)) @@ -2828,13 +2800,6 @@ done: * Programmer: Robb Matzke * Tuesday, March 3, 1998 * - * Modifications: - * - * Raymond Lu - * Tuesday, October 2, 2001 - * Changed the way to check parameter and set property for - * generic property list. - * *------------------------------------------------------------------------- */ int @@ -2885,13 +2850,6 @@ done: * Programmer: Robb Matzke * Tuesday, March 3, 1998 * - * Modifications: - * - * Raymond Lu - * Tuesday, October 2, 2001 - * Changed the way to check parameter and get property for - * generic property list. - * *------------------------------------------------------------------------- */ herr_t @@ -3013,8 +2971,6 @@ done: * Programmer: Kent Yang * Wednesday, November 13, 2002 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -3058,9 +3014,6 @@ done: * Programmer: Xiaowen Wu * Wednesday, December 22, 2004 * - * Modifications: - * - * *------------------------------------------------------------------------- */ herr_t @@ -3120,9 +3073,6 @@ done: * Programmer: Xiaowen Wu * Thursday, April 14, 2005 * - * Modifications: - * - * *------------------------------------------------------------------------- */ herr_t @@ -3526,9 +3476,6 @@ done: * Programmer: Raymond Lu * Wednesday, January 16, 2002 * - * Modifications: - * - * *------------------------------------------------------------------------- */ herr_t @@ -3709,9 +3656,6 @@ done: * Programmer: Raymond Lu * Wednesday, January 16, 2002 * - * Modifications: - * - * *------------------------------------------------------------------------- */ herr_t @@ -3760,8 +3704,6 @@ done: * Programmer: Jacob Smith * 2018 August 14 * - * Modifications: None. - * *----------------------------------------------------------------------------- */ herr_t @@ -3807,8 +3749,6 @@ done: * Programmer: Jacob Smith * 2018 August 14 * - * Modifications: None. - * *----------------------------------------------------------------------------- */ herr_t diff --git a/src/H5Pdeprec.c b/src/H5Pdeprec.c index b9efaee..88ebec1 100644 --- a/src/H5Pdeprec.c +++ b/src/H5Pdeprec.c @@ -15,7 +15,7 @@ * * Created: H5Pdeprec.c * October 11 2007 - * Quincey Koziol + * Quincey Koziol * * Purpose: Deprecated functions from the H5P interface. These * functions are here for compatibility purposes and may be diff --git a/src/H5Pdxpl.c b/src/H5Pdxpl.c index 3f5754e..e6db02f 100644 --- a/src/H5Pdxpl.c +++ b/src/H5Pdxpl.c @@ -15,7 +15,7 @@ * * Created: H5Pdxpl.c * March 16 1998 - * Robb Matzke + * Robb Matzke * * Purpose: Data transfer property list class routines * @@ -770,7 +770,7 @@ done: * * Return: Success: SUCCEED, Failure: FAIL * - * Programmer: Leon Arber larber@uiuc.edu + * Programmer: Leon Arber * * Date: April 9, 2004 * @@ -801,7 +801,7 @@ done: * * Return: Success: SUCCEED, Failure: FAIL * - * Programmer: Leon Arber larber@uiuc.edu + * Programmer: Leon Arber * * Date: April 9, 2004 * @@ -887,7 +887,7 @@ done: * * Return: Success: SUCCEED, Failure: FAIL * - * Programmer: Leon Arber larber@uiuc.edu + * Programmer: Leon Arber * * Date: April 9, 2004 * @@ -1297,8 +1297,6 @@ done: * Programmer: Raymond Lu * Jan 14, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -1339,8 +1337,6 @@ done: * Programmer: Raymond Lu * April 15, 2004 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -1381,8 +1377,6 @@ done: * Programmer: Raymond Lu * April 15, 2004 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t diff --git a/src/H5Pencdec.c b/src/H5Pencdec.c index d4b6b5f..5f35a7e 100644 --- a/src/H5Pencdec.c +++ b/src/H5Pencdec.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol +/* Programmer: Quincey Koziol * * Purpose: Generic Property Functions */ @@ -49,9 +49,9 @@ /* Typedef for iterator when encoding a property list */ typedef struct { - hbool_t encode; /* Whether the property list should be encoded */ - size_t *enc_size_ptr; /* Pointer to size of encoded buffer */ - void **pp; /* Pointer to encoding buffer pointer */ + hbool_t encode; /* Whether the property list should be encoded */ + size_t *enc_size_ptr; /* Pointer to size of encoded buffer */ + void **pp; /* Pointer to encoding buffer pointer */ } H5P_enc_iter_ud_t; @@ -332,7 +332,7 @@ static int H5P__encode_cb(H5P_genprop_t *prop, void *_udata) { H5P_enc_iter_ud_t *udata = (H5P_enc_iter_ud_t *)_udata; /* Pointer to user data */ - int ret_value = H5_ITER_CONT; /* Return value */ + int ret_value = H5_ITER_CONT; /* Return value */ FUNC_ENTER_STATIC diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index 30b590f..4539883 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -204,12 +204,12 @@ /* Definition for 'mdc log location' flag */ #define H5F_ACS_MDC_LOG_LOCATION_SIZE sizeof(char *) #define H5F_ACS_MDC_LOG_LOCATION_DEF NULL /* default is no log location */ -#define H5F_ACS_MDC_LOG_LOCATION_ENC H5P_facc_mdc_log_location_enc -#define H5F_ACS_MDC_LOG_LOCATION_DEC H5P_facc_mdc_log_location_dec -#define H5F_ACS_MDC_LOG_LOCATION_DEL H5P_facc_mdc_log_location_del -#define H5F_ACS_MDC_LOG_LOCATION_COPY H5P_facc_mdc_log_location_copy -#define H5F_ACS_MDC_LOG_LOCATION_CMP H5P_facc_mdc_log_location_cmp -#define H5F_ACS_MDC_LOG_LOCATION_CLOSE H5P_facc_mdc_log_location_close +#define H5F_ACS_MDC_LOG_LOCATION_ENC H5P__facc_mdc_log_location_enc +#define H5F_ACS_MDC_LOG_LOCATION_DEC H5P__facc_mdc_log_location_dec +#define H5F_ACS_MDC_LOG_LOCATION_DEL H5P__facc_mdc_log_location_del +#define H5F_ACS_MDC_LOG_LOCATION_COPY H5P__facc_mdc_log_location_copy +#define H5F_ACS_MDC_LOG_LOCATION_CMP H5P__facc_mdc_log_location_cmp +#define H5F_ACS_MDC_LOG_LOCATION_CLOSE H5P__facc_mdc_log_location_close /* Definition for 'start metadata cache logging on access' flag */ #define H5F_ACS_START_MDC_LOG_ON_ACCESS_SIZE sizeof(hbool_t) #define H5F_ACS_START_MDC_LOG_ON_ACCESS_DEF FALSE @@ -281,6 +281,29 @@ #define H5F_ACS_VOL_CONN_COPY H5P__facc_vol_copy #define H5F_ACS_VOL_CONN_CMP H5P__facc_vol_cmp #define H5F_ACS_VOL_CONN_CLOSE H5P__facc_vol_close +/* Definition for using file locking or not. The default is set + * via the configure step. + */ +#define H5F_ACS_USE_FILE_LOCKING_SIZE sizeof(hbool_t) +#if defined H5_USE_FILE_LOCKING && H5_USE_FILE_LOCKING +#define H5F_ACS_USE_FILE_LOCKING_DEF TRUE +#else +#define H5F_ACS_USE_FILE_LOCKING_DEF FALSE +#endif +#define H5F_ACS_USE_FILE_LOCKING_ENC H5P__encode_hbool_t +#define H5F_ACS_USE_FILE_LOCKING_DEC H5P__decode_hbool_t +/* Definition for whether we ignore file locking errors when we can + * tell that file locking has been disabled on the file system. + * The default is set via the configure step. + */ +#define H5F_ACS_IGNORE_DISABLED_FILE_LOCKS_SIZE sizeof(hbool_t) +#if defined H5_IGNORE_DISABLED_FILE_LOCKS && H5_IGNORE_DISABLED_FILE_LOCKS +#define H5F_ACS_IGNORE_DISABLED_FILE_LOCKS_DEF TRUE +#else +#define H5F_ACS_IGNORE_DISABLED_FILE_LOCKS_DEF FALSE +#endif +#define H5F_ACS_IGNORE_DISABLED_FILE_LOCKS_ENC H5P__encode_hbool_t +#define H5F_ACS_IGNORE_DISABLED_FILE_LOCKS_DEC H5P__decode_hbool_t /******************/ @@ -331,12 +354,12 @@ static herr_t H5P__facc_libver_type_enc(const void *value, void **_pp, size_t *s static herr_t H5P__facc_libver_type_dec(const void **_pp, void *value); /* Metadata cache log location property callbacks */ -static herr_t H5P_facc_mdc_log_location_enc(const void *value, void **_pp, size_t *size); -static herr_t H5P_facc_mdc_log_location_dec(const void **_pp, void *value); -static herr_t H5P_facc_mdc_log_location_del(hid_t prop_id, const char *name, size_t size, void *value); -static herr_t H5P_facc_mdc_log_location_copy(const char *name, size_t size, void *value); -static int H5P_facc_mdc_log_location_cmp(const void *value1, const void *value2, size_t size); -static herr_t H5P_facc_mdc_log_location_close(const char *name, size_t size, void *value); +static herr_t H5P__facc_mdc_log_location_enc(const void *value, void **_pp, size_t *size); +static herr_t H5P__facc_mdc_log_location_dec(const void **_pp, void *value); +static herr_t H5P__facc_mdc_log_location_del(hid_t prop_id, const char *name, size_t size, void *value); +static herr_t H5P__facc_mdc_log_location_copy(const char *name, size_t size, void *value); +static int H5P__facc_mdc_log_location_cmp(const void *value1, const void *value2, size_t size); +static herr_t H5P__facc_mdc_log_location_close(const char *name, size_t size, void *value); /* Metadata cache image property callbacks */ static int H5P__facc_cache_image_config_cmp(const void *_config1, const void *_config2, size_t H5_ATTR_UNUSED size); @@ -447,6 +470,8 @@ static const H5AC_cache_image_config_t H5F_def_mdc_initCacheImageCfg_g = H5F_ACS static const size_t H5F_def_page_buf_size_g = H5F_ACS_PAGE_BUFFER_SIZE_DEF; /* Default page buffer size */ static const unsigned H5F_def_page_buf_min_meta_perc_g = H5F_ACS_PAGE_BUFFER_MIN_META_PERC_DEF; /* Default page buffer minimum metadata size */ static const unsigned H5F_def_page_buf_min_raw_perc_g = H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_DEF; /* Default page buffer mininum raw data size */ +static const hbool_t H5F_def_use_file_locking_g = H5F_ACS_USE_FILE_LOCKING_DEF; /* Default use file locking flag */ +static const hbool_t H5F_def_ignore_disabled_file_locks_g = H5F_ACS_IGNORE_DISABLED_FILE_LOCKS_DEF; /* Default ignore disabled file locks flag */ /*------------------------------------------------------------------------- @@ -705,6 +730,16 @@ H5P__facc_reg_prop(H5P_genclass_t *pclass) H5F_ACS_VOL_CONN_DEL, H5F_ACS_VOL_CONN_COPY, H5F_ACS_VOL_CONN_CMP, H5F_ACS_VOL_CONN_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + /* Register the use file locking flag */ + if(H5P__register_real(pclass, H5F_ACS_USE_FILE_LOCKING_NAME, H5F_ACS_USE_FILE_LOCKING_SIZE, &H5F_def_use_file_locking_g, + NULL, NULL, NULL, H5F_ACS_USE_FILE_LOCKING_ENC, H5F_ACS_USE_FILE_LOCKING_DEC, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + /* Register the ignore disabled file locks flag */ + if(H5P__register_real(pclass, H5F_ACS_IGNORE_DISABLED_FILE_LOCKS_NAME, H5F_ACS_IGNORE_DISABLED_FILE_LOCKS_SIZE, &H5F_def_ignore_disabled_file_locks_g, + NULL, NULL, NULL, H5F_ACS_IGNORE_DISABLED_FILE_LOCKS_ENC, H5F_ACS_IGNORE_DISABLED_FILE_LOCKS_DEC, 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__facc_reg_prop() */ @@ -732,12 +767,6 @@ done: * Programmer: Robb Matzke * Tuesday, June 9, 1998 * - * Modifications: - * - * Raymond Lu - * Tuesday, Oct 23, 2001 - * Changed file access property list mechanism to the new - * generic property list. *------------------------------------------------------------------------- */ herr_t @@ -1894,13 +1923,6 @@ done: * Programmer: Quincey Koziol * June, 1999 * - * Modifications: - * - * Raymond Lu - * Tuesday, Oct 23, 2001 - * Changed the file access list to the new generic property - * list. - * *------------------------------------------------------------------------- */ herr_t @@ -1936,13 +1958,6 @@ done: * Programmer: Quincey Koziol * June, 1999 * - * Modifications: - * - * Raymond Lu - * Tuesday, Oct 23, 2001 - * Changed the file access list to the new generic property - * list. - * *------------------------------------------------------------------------- */ herr_t @@ -1978,8 +1993,6 @@ done: * Programmer: Raymond Lu * November, 2001 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -2014,8 +2027,6 @@ done: * Programmer: Raymond Lu * November, 2001 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -2059,13 +2070,6 @@ done: * Programmer: Quincey Koziol * Friday, August 25, 2000 * - * Modifications: - * - * Raymond Lu - * Tuesday, Oct 23, 2001 - * Changed the file access list to the new generic property - * list. - * *------------------------------------------------------------------------- */ herr_t @@ -2101,13 +2105,6 @@ done: * Programmer: Quincey Koziol * Friday, August 29, 2000 * - * Modifications: - * - * Raymond Lu - * Tuesday, Oct 23, 2001 - * Changed the file access list to the new generic property - * list. - * *------------------------------------------------------------------------- */ herr_t @@ -2154,13 +2151,6 @@ done: * Programmer: Quincey Koziol * Thursday, September 21, 2000 * - * Modifications: - * - * Raymond Lu - * Tuesday, Oct 23, 2001 - * Changed the file access list to the new generic property - * list. - * *------------------------------------------------------------------------- */ herr_t @@ -2196,13 +2186,6 @@ done: * Programmer: Quincey Koziol * Thursday, September 21, 2000 * - * Modifications: - * - * Raymond Lu - * Tuesday, Oct 23, 2001 - * Changed the file access list to the new generic property - * list. - * *------------------------------------------------------------------------- */ herr_t @@ -2248,8 +2231,6 @@ done: * Programmer: Quincey Koziol * Wednesday, June 5, 2002 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -2285,8 +2266,6 @@ done: * Programmer: Quincey Koziol * Wednesday, June 5, 2002 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -4047,13 +4026,13 @@ H5Pget_metadata_read_attempts(hid_t plist_id, unsigned *attempts/*out*/) if(NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") - /* Get the # of read attempts set */ + /* Get the # of read attempts set */ if(H5P_get(plist, H5F_ACS_METADATA_READ_ATTEMPTS_NAME, attempts) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get the number of metadata read attempts") - /* If not set, return the default value */ - if(*attempts == H5F_ACS_METADATA_READ_ATTEMPTS_DEF) /* 0 */ - *attempts = H5F_METADATA_READ_ATTEMPTS; + /* If not set, return the default value */ + if(*attempts == H5F_ACS_METADATA_READ_ATTEMPTS_DEF) /* 0 */ + *attempts = H5F_METADATA_READ_ATTEMPTS; } /* end if */ done: @@ -4137,9 +4116,9 @@ H5Pget_object_flush_cb(hid_t plist_id, H5F_flush_cb_t *func, void **udata) /* Assign return value */ if(func) - *func = flush_info.func; + *func = flush_info.func; if(udata) - *udata = flush_info.udata; + *udata = flush_info.udata; done: FUNC_LEAVE_API(ret_value) @@ -4254,7 +4233,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5P_facc_mdc_log_location_enc + * Function: H5P__facc_mdc_log_location_enc * * Purpose: Callback routine which is called whenever the metadata * cache log location property in the file access property @@ -4266,7 +4245,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P_facc_mdc_log_location_enc(const void *value, void **_pp, size_t *size) +H5P__facc_mdc_log_location_enc(const void *value, void **_pp, size_t *size) { const char *log_location = *(const char * const *)value; uint8_t **pp = (uint8_t **)_pp; @@ -4274,7 +4253,7 @@ H5P_facc_mdc_log_location_enc(const void *value, void **_pp, size_t *size) uint64_t enc_value; unsigned enc_size; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); @@ -4303,11 +4282,11 @@ H5P_facc_mdc_log_location_enc(const void *value, void **_pp, size_t *size) *size += len; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5P_facc_mdc_log_location_enc() */ +} /* end H5P__facc_mdc_log_location_enc() */ /*------------------------------------------------------------------------- - * Function: H5P_facc_mdc_log_location_dec + * Function: H5P__facc_mdc_log_location_dec * * Purpose: Callback routine which is called whenever the metadata * cache log location property in the file access property @@ -4319,7 +4298,7 @@ H5P_facc_mdc_log_location_enc(const void *value, void **_pp, size_t *size) *------------------------------------------------------------------------- */ static herr_t -H5P_facc_mdc_log_location_dec(const void **_pp, void *_value) +H5P__facc_mdc_log_location_dec(const void **_pp, void *_value) { char **log_location = (char **)_value; const uint8_t **pp = (const uint8_t **)_pp; @@ -4328,7 +4307,7 @@ H5P_facc_mdc_log_location_dec(const void **_pp, void *_value) unsigned enc_size; /* Size of encoded property */ herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(pp); HDassert(*pp); @@ -4357,11 +4336,11 @@ H5P_facc_mdc_log_location_dec(const void **_pp, void *_value) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_facc_mdc_log_location_dec() */ +} /* end H5P__facc_mdc_log_location_dec() */ /*------------------------------------------------------------------------- - * Function: H5P_facc_mdc_log_location_del + * Function: H5P__facc_mdc_log_location_del * * Purpose: Frees memory used to store the metadata cache log location. * @@ -4370,21 +4349,21 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P_facc_mdc_log_location_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, +H5P__facc_mdc_log_location_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(value); H5MM_xfree(*(void **)value); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5P_facc_mdc_log_location_del() */ +} /* end H5P__facc_mdc_log_location_del() */ /*------------------------------------------------------------------------- - * Function: H5P_facc_mdc_log_location_copy + * Function: H5P__facc_mdc_log_location_copy * * Purpose: Creates a copy of the metadata cache log location string. * @@ -4393,20 +4372,20 @@ H5P_facc_mdc_log_location_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_U *------------------------------------------------------------------------- */ static herr_t -H5P_facc_mdc_log_location_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) +H5P__facc_mdc_log_location_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(value); *(char **)value = H5MM_xstrdup(*(const char **)value); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5P_facc_mdc_log_location_copy() */ +} /* end H5P__facc_mdc_log_location_copy() */ /*------------------------------------------------------------------------- - * Function: H5P_facc_mdc_log_location_cmp + * Function: H5P__facc_mdc_log_location_cmp * * Purpose: Callback routine which is called whenever the metadata * cache log location property in the file creation property @@ -4416,14 +4395,14 @@ H5P_facc_mdc_log_location_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_U * *------------------------------------------------------------------------- */ -static int -H5P_facc_mdc_log_location_cmp(const void *value1, const void *value2, size_t H5_ATTR_UNUSED size) +static H5_ATTR_PURE int +H5P__facc_mdc_log_location_cmp(const void *value1, const void *value2, size_t H5_ATTR_UNUSED size) { const char *pref1 = *(const char * const *)value1; const char *pref2 = *(const char * const *)value2; int ret_value = 0; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR if(NULL == pref1 && NULL != pref2) HGOTO_DONE(1); @@ -4434,11 +4413,11 @@ H5P_facc_mdc_log_location_cmp(const void *value1, const void *value2, size_t H5_ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_facc_mdc_log_location_cmp() */ +} /* end H5P__facc_mdc_log_location_cmp() */ /*------------------------------------------------------------------------- - * Function: H5P_facc_mdc_log_location_close + * Function: H5P__facc_mdc_log_location_close * * Purpose: Frees memory used to store the metadata cache log location * string @@ -4448,16 +4427,16 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P_facc_mdc_log_location_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) +H5P__facc_mdc_log_location_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(value); H5MM_xfree(*(void **)value); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5P_facc_mdc_log_location_close() */ +} /* end H5P__facc_mdc_log_location_close() */ /*------------------------------------------------------------------------- @@ -4551,6 +4530,98 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_evict_on_close() */ + +/*------------------------------------------------------------------------- + * Function: H5Pset_file_locking + * + * Purpose: Sets the file locking property values. + * + * Overrides the default file locking flag setting that was + * set when the library was configured. + * + * Can be overridden by the HDF5_USE_FILE_LOCKING environment + * variable. + * + * File locking is used when creating/opening a file to prevent + * problematic file accesses. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Spring 2020 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pset_file_locking(hid_t fapl_id, hbool_t use_file_locking, hbool_t ignore_when_disabled) +{ + H5P_genplist_t *plist; /* property list pointer */ + herr_t ret_value = SUCCEED; /* return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE3("e", "ibb", fapl_id, use_file_locking, ignore_when_disabled); + + /* Make sure this is a fapl */ + if(TRUE != H5P_isa_class(fapl_id, H5P_FILE_ACCESS)) + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "property list is not a file access plist") + + /* Get the plist structure */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + + /* Set values */ + if(H5P_set(plist, H5F_ACS_USE_FILE_LOCKING_NAME, &use_file_locking) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set use file locking property") + if(H5P_set(plist, H5F_ACS_IGNORE_DISABLED_FILE_LOCKS_NAME, &ignore_when_disabled) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set ignore disabled file locks property") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Pset_file_locking() */ + + +/*------------------------------------------------------------------------- + * Function: H5Pget_file_locking + * + * Purpose: Gets the file locking property values. + * + * File locking is used when creating/opening a file to prevent + * problematic file accesses. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Spring 2020 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pget_file_locking(hid_t fapl_id, hbool_t *use_file_locking, hbool_t *ignore_when_disabled) +{ + H5P_genplist_t *plist; /* property list pointer */ + herr_t ret_value = SUCCEED; /* return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE3("e", "i*b*b", fapl_id, use_file_locking, ignore_when_disabled); + + /* Make sure this is a fapl */ + if(TRUE != H5P_isa_class(fapl_id, H5P_FILE_ACCESS)) + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "property list is not an access plist") + + /* Get the plist structure */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + + /* Get values */ + if(H5P_get(plist, H5F_ACS_USE_FILE_LOCKING_NAME, use_file_locking) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get use file locking property") + if(H5P_get(plist, H5F_ACS_IGNORE_DISABLED_FILE_LOCKS_NAME, ignore_when_disabled) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get ignore disabled file locks property") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Pget_file_locking() */ + #ifdef H5_HAVE_PARALLEL /*------------------------------------------------------------------------- diff --git a/src/H5Pfcpl.c b/src/H5Pfcpl.c index 3b0ce66..db80f19 100644 --- a/src/H5Pfcpl.c +++ b/src/H5Pfcpl.c @@ -15,7 +15,7 @@ * * Created: H5Pfcpl.c * January 6 1998 - * Robb Matzke + * Robb Matzke * * Purpose: File creation property list class routines * @@ -128,7 +128,7 @@ /********************/ /* Property class callbacks */ -static herr_t H5P_fcrt_reg_prop(H5P_genclass_t *pclass); +static herr_t H5P__fcrt_reg_prop(H5P_genclass_t *pclass); /* property callbacks */ static herr_t H5P__fcrt_btree_rank_enc(const void *value, void **_pp, size_t *size); @@ -154,7 +154,7 @@ const H5P_libclass_t H5P_CLS_FCRT[1] = {{ &H5P_CLS_FILE_CREATE_g, /* Pointer to class */ &H5P_CLS_FILE_CREATE_ID_g, /* Pointer to class ID */ &H5P_LST_FILE_CREATE_ID_g, /* Pointer to default property list ID */ - H5P_fcrt_reg_prop, /* Default property registration routine */ + H5P__fcrt_reg_prop, /* Default property registration routine */ NULL, /* Class creation callback */ NULL, /* Class creation callback info */ @@ -194,7 +194,7 @@ static const hsize_t H5F_def_file_space_page_size_g = H5F_CRT_FILE_SPACE_PAGE_SI /*------------------------------------------------------------------------- - * Function: H5P_fcrt_reg_prop + * Function: H5P__fcrt_reg_prop * * Purpose: Register the file creation property list class's properties * @@ -205,11 +205,11 @@ static const hsize_t H5F_def_file_space_page_size_g = H5F_CRT_FILE_SPACE_PAGE_SI *------------------------------------------------------------------------- */ static herr_t -H5P_fcrt_reg_prop(H5P_genclass_t *pclass) +H5P__fcrt_reg_prop(H5P_genclass_t *pclass) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Register the user block size */ if(H5P__register_real(pclass, H5F_CRT_USER_BLOCK_NAME, H5F_CRT_USER_BLOCK_SIZE, &H5F_def_userblock_size_g, @@ -297,7 +297,7 @@ H5P_fcrt_reg_prop(H5P_genclass_t *pclass) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_fcrt_reg_prop() */ +} /* end H5P__fcrt_reg_prop() */ /*------------------------------------------------------------------------- @@ -359,11 +359,6 @@ done: * Programmer: Robb Matzke * Wednesday, January 7, 1998 * - * Modifications: - * - * Raymond Lu, Oct 14, 2001 - * Changed to the new generic property list. - * *------------------------------------------------------------------------- */ herr_t @@ -517,11 +512,6 @@ done: * Programmer: Robb Matzke * Tuesday, January 6, 1998 * - * Modifications: - * - * Raymond Lu, Oct 14, 2001 - * Changed to the new generic property list. - * *------------------------------------------------------------------------- */ herr_t @@ -571,11 +561,6 @@ done: * Programmer: Robb Matzke * Wednesday, January 7, 1998 * - * Modifications: - * - * Raymond Lu - * Changed to the new generic property list. - * *------------------------------------------------------------------------- */ herr_t @@ -619,11 +604,6 @@ done: * Programmer: Robb Matzke * Tuesday, January 6, 1998 * - * Modifications: - * - * Raymond Lu, Oct 14, 2001 - * Changed to the new generic property list. - * *------------------------------------------------------------------------- */ herr_t @@ -673,11 +653,6 @@ done: * Programmer: Robb Matzke * Wednesday, January 7, 1998 * - * Modifications: - * - * Raymond Lu, Oct 14, 2001 - * Changed to the new generic property list. - * *------------------------------------------------------------------------- */ herr_t diff --git a/src/H5Pfmpl.c b/src/H5Pfmpl.c index 41ad078..a0a6d35 100644 --- a/src/H5Pfmpl.c +++ b/src/H5Pfmpl.c @@ -15,7 +15,7 @@ * * Created: H5Pmtpl.c * November 1 2006 - * Quincey Koziol + * Quincey Koziol * * Purpose: File mount property list class routines * @@ -64,7 +64,7 @@ /********************/ /* Property class callbacks */ -static herr_t H5P_fmnt_reg_prop(H5P_genclass_t *pclass); +static herr_t H5P__fmnt_reg_prop(H5P_genclass_t *pclass); /*********************/ @@ -80,7 +80,7 @@ const H5P_libclass_t H5P_CLS_FMNT[1] = {{ &H5P_CLS_FILE_MOUNT_g, /* Pointer to class */ &H5P_CLS_FILE_MOUNT_ID_g, /* Pointer to class ID */ &H5P_LST_FILE_MOUNT_ID_g, /* Pointer to default property list ID */ - H5P_fmnt_reg_prop, /* Default property registration routine */ + H5P__fmnt_reg_prop, /* Default property registration routine */ NULL, /* Class creation callback */ NULL, /* Class creation callback info */ @@ -106,7 +106,7 @@ static const hbool_t H5F_def_local_g = H5F_MNT_SYM_LOCAL_DEF; /* Whether sy /*------------------------------------------------------------------------- - * Function: H5P_fmnt_reg_prop + * Function: H5P__fmnt_reg_prop * * Purpose: Register the file mount property list class's properties * @@ -117,11 +117,11 @@ static const hbool_t H5F_def_local_g = H5F_MNT_SYM_LOCAL_DEF; /* Whether sy *------------------------------------------------------------------------- */ static herr_t -H5P_fmnt_reg_prop(H5P_genclass_t *pclass) +H5P__fmnt_reg_prop(H5P_genclass_t *pclass) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Register property of whether symlinks is local to file */ if(H5P__register_real(pclass, H5F_MNT_SYM_LOCAL_NAME, H5F_MNT_SYM_LOCAL_SIZE, &H5F_def_local_g, @@ -130,5 +130,5 @@ H5P_fmnt_reg_prop(H5P_genclass_t *pclass) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_fmnt_reg_prop() */ +} /* end H5P__fmnt_reg_prop() */ diff --git a/src/H5Pgcpl.c b/src/H5Pgcpl.c index 03874c8..107ca15 100644 --- a/src/H5Pgcpl.c +++ b/src/H5Pgcpl.c @@ -15,7 +15,7 @@ * * Created: H5Pgcpl.c * August 29 2006 - * Quincey Koziol + * Quincey Koziol * * Purpose: Group creation property list class routines * diff --git a/src/H5Pint.c b/src/H5Pint.c index 2e463b2..4d73083 100644 --- a/src/H5Pint.c +++ b/src/H5Pint.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol +/* Programmer: Quincey Koziol * * Purpose: Generic Property Functions */ @@ -5604,7 +5604,7 @@ done: * Return: Success: Non-negative ID of property list. * Failure: H5I_INVALID_HID * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * April 22, 2014 * *------------------------------------------------------------------------- @@ -5632,7 +5632,7 @@ H5P_get_plist_id(const H5P_genplist_t *plist) * Return: Success: Non-NULL class of property list. * Failure: NULL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * April 22, 2014 * *------------------------------------------------------------------------- diff --git a/src/H5Plapl.c b/src/H5Plapl.c index 8fdcc8b..8a0848c 100644 --- a/src/H5Plapl.c +++ b/src/H5Plapl.c @@ -15,7 +15,7 @@ * * Created: H5Plapl.c * July 14 2006 - * James Laird + * James Laird * * Purpose: Link access property list class routines * diff --git a/src/H5Plcpl.c b/src/H5Plcpl.c index 9c32552..2c8e364 100644 --- a/src/H5Plcpl.c +++ b/src/H5Plcpl.c @@ -64,7 +64,7 @@ /********************/ /* Property class callbacks */ -static herr_t H5P_lcrt_reg_prop(H5P_genclass_t *pclass); +static herr_t H5P__lcrt_reg_prop(H5P_genclass_t *pclass); /*********************/ @@ -80,7 +80,7 @@ const H5P_libclass_t H5P_CLS_LCRT[1] = {{ &H5P_CLS_LINK_CREATE_g, /* Pointer to class */ &H5P_CLS_LINK_CREATE_ID_g, /* Pointer to class ID */ &H5P_LST_LINK_CREATE_ID_g, /* Pointer to default property list ID */ - H5P_lcrt_reg_prop, /* Default property registration routine */ + H5P__lcrt_reg_prop, /* Default property registration routine */ NULL, /* Class creation callback */ NULL, /* Class creation callback info */ @@ -106,7 +106,7 @@ static const unsigned H5L_def_intmd_group_g = H5L_CRT_INTERMEDIATE_GROUP_DEF; /*------------------------------------------------------------------------- - * Function: H5P_lcrt_reg_prop + * Function: H5P__lcrt_reg_prop * * Purpose: Register the dataset creation property list class's properties * @@ -116,12 +116,12 @@ static const unsigned H5L_def_intmd_group_g = H5L_CRT_INTERMEDIATE_GROUP_DEF; * October 31, 2006 *------------------------------------------------------------------------- */ -herr_t -H5P_lcrt_reg_prop(H5P_genclass_t *pclass) +static herr_t +H5P__lcrt_reg_prop(H5P_genclass_t *pclass) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_STATIC /* Register create intermediate groups property */ if(H5P__register_real(pclass, H5L_CRT_INTERMEDIATE_GROUP_NAME, H5L_CRT_INTERMEDIATE_GROUP_SIZE, &H5L_def_intmd_group_g, @@ -131,7 +131,7 @@ H5P_lcrt_reg_prop(H5P_genclass_t *pclass) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_lcrt_reg_prop() */ +} /* end H5P__lcrt_reg_prop() */ /*------------------------------------------------------------------------- diff --git a/src/H5Pmodule.h b/src/H5Pmodule.h index d5c471a..11df06d 100644 --- a/src/H5Pmodule.h +++ b/src/H5Pmodule.h @@ -11,7 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, September 12, 2015 * * Purpose: This file contains declarations which define macros for the diff --git a/src/H5Pocpl.c b/src/H5Pocpl.c index a60c593..b576aec 100644 --- a/src/H5Pocpl.c +++ b/src/H5Pocpl.c @@ -15,7 +15,7 @@ * * Created: H5Pocpl.c * Nov 28 2006 - * Quincey Koziol + * Quincey Koziol * * Purpose: Object creation property list class routines * @@ -581,13 +581,6 @@ done: * 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 @@ -652,18 +645,6 @@ done: * 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 @@ -781,13 +762,6 @@ done: * 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 @@ -838,13 +812,6 @@ done: * 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 @@ -980,13 +947,6 @@ done: * 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 @@ -1049,13 +1009,6 @@ done: * 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 @@ -1132,13 +1085,6 @@ done: * 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 @@ -1191,18 +1137,6 @@ done: * 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 @@ -1251,13 +1185,6 @@ done: * 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 diff --git a/src/H5Pocpypl.c b/src/H5Pocpypl.c index 7390cae..d23585c 100644 --- a/src/H5Pocpypl.c +++ b/src/H5Pocpypl.c @@ -15,7 +15,7 @@ * * Created: H5Pocpypl.c * Mar 13 2006 - * Peter Cao + * Peter Cao * * Purpose: Object copying property list class routines * diff --git a/src/H5Ppkg.h b/src/H5Ppkg.h index c8e5e98..2a52cc5 100644 --- a/src/H5Ppkg.h +++ b/src/H5Ppkg.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Friday, November 16, 2001 * * Purpose: This file contains declarations which are visible only within diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index bb33561..9dfa050 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -380,6 +380,8 @@ H5_DLL herr_t H5Pset_mdc_log_options(hid_t plist_id, hbool_t is_enabled, const c H5_DLL herr_t H5Pget_mdc_log_options(hid_t plist_id, hbool_t *is_enabled, char *location, size_t *location_size, hbool_t *start_on_access); H5_DLL herr_t H5Pset_evict_on_close(hid_t fapl_id, hbool_t evict_on_close); H5_DLL herr_t H5Pget_evict_on_close(hid_t fapl_id, hbool_t *evict_on_close); +H5_DLL herr_t H5Pset_file_locking(hid_t fapl_id, hbool_t use_file_locking, hbool_t ignore_when_disabled); +H5_DLL herr_t H5Pget_file_locking(hid_t fapl_id, hbool_t *use_file_locking, hbool_t *ignore_when_disabled); #ifdef H5_HAVE_PARALLEL H5_DLL herr_t H5Pset_all_coll_metadata_ops(hid_t plist_id, hbool_t is_collective); H5_DLL herr_t H5Pget_all_coll_metadata_ops(hid_t plist_id, hbool_t *is_collective); diff --git a/src/H5Pstrcpl.c b/src/H5Pstrcpl.c index 97d6119..6371862 100644 --- a/src/H5Pstrcpl.c +++ b/src/H5Pstrcpl.c @@ -15,7 +15,7 @@ * * Created: H5Pstrcpl.c * October 26 2005 - * James Laird + * James Laird * * Purpose: String creation property list class routines * diff --git a/src/H5Ptest.c b/src/H5Ptest.c index 303fbf7..6bec415 100644 --- a/src/H5Ptest.c +++ b/src/H5Ptest.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol +/* Programmer: Quincey Koziol * Saturday May 31, 2003 * * Purpose: Generic Property Testing Functions diff --git a/src/H5RS.c b/src/H5RS.c index ae500c5..6459f0d 100644 --- a/src/H5RS.c +++ b/src/H5RS.c @@ -39,11 +39,11 @@ H5FL_BLK_DEFINE(str_buf); /*-------------------------------------------------------------------------- NAME - H5RS_xstrdup + H5RS__xstrdup PURPOSE Duplicate the string being reference counted USAGE - char *H5RS_xstrdup(s) + char *H5RS__xstrdup(s) const char *s; IN: String to duplicate RETURNS @@ -57,11 +57,11 @@ H5FL_BLK_DEFINE(str_buf); REVISION LOG --------------------------------------------------------------------------*/ static char * -H5RS_xstrdup(const char *s) +H5RS__xstrdup(const char *s) { char *ret_value; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR if(s) { size_t len = HDstrlen(s) + 1; @@ -74,7 +74,7 @@ H5RS_xstrdup(const char *s) ret_value = NULL; FUNC_LEAVE_NOAPI(ret_value) -} /* end H5RS_xstrdup() */ +} /* end H5RS__xstrdup() */ /*-------------------------------------------------------------------------- @@ -108,7 +108,7 @@ H5RS_create(const char *s) HGOTO_ERROR(H5E_RS, H5E_NOSPACE, NULL, "memory allocation failed") /* Set the internal fields */ - ret_value->s = H5RS_xstrdup(s); + ret_value->s = H5RS__xstrdup(s); ret_value->wrapped = 0; ret_value->n = 1; @@ -270,7 +270,7 @@ H5RS_incr(H5RS_str_t *rs) * scope appropriately. */ if(rs->wrapped) { - rs->s = H5RS_xstrdup(rs->s); + rs->s = H5RS__xstrdup(rs->s); rs->wrapped = 0; } /* end if */ diff --git a/src/H5Rdeprec.c b/src/H5Rdeprec.c index 4e44683..f48af51 100644 --- a/src/H5Rdeprec.c +++ b/src/H5Rdeprec.c @@ -66,6 +66,8 @@ /********************/ /* Local Prototypes */ /********************/ +static herr_t H5R__encode_token_region_compat(H5F_t *f, const H5O_token_t *obj_token, size_t token_size, H5S_t *space, unsigned char *buf, size_t *nalloc); +static herr_t H5R__decode_token_compat(H5VL_object_t *vol_obj, H5I_type_t type, H5R_type_t ref_type, const unsigned char *buf, H5O_token_t *obj_token); /*********************/ @@ -82,9 +84,157 @@ /* Local Variables */ /*******************/ -#ifndef H5_NO_DEPRECATED_SYMBOLS /*------------------------------------------------------------------------- + * Function: H5R__decode_token_compat + * + * Purpose: Decode an object token. (native only) + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5R__decode_token_compat(H5VL_object_t *vol_obj, H5I_type_t type, H5R_type_t ref_type, + const unsigned char *buf, H5O_token_t *obj_token) +{ + hid_t file_id = H5I_INVALID_HID; /* File ID for region reference */ + H5VL_object_t *vol_obj_file = NULL; + H5VL_file_cont_info_t cont_info = {H5VL_CONTAINER_INFO_VERSION, 0, 0, 0}; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + +#ifndef NDEBUG + { + hbool_t is_native = FALSE; /* Whether the src file is using the native VOL connector */ + + /* Check if using native VOL connector */ + if(H5VL_object_is_native(vol_obj, &is_native) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't query if file uses native VOL connector") + + /* Must use native VOL connector for this operation */ + HDassert(is_native); + } +#endif /* NDEBUG */ + + /* Get the file for the object */ + if((file_id = H5F_get_file_id(vol_obj, type, FALSE)) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + + /* Retrieve VOL object */ + if(NULL == (vol_obj_file = H5VL_vol_object(file_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Get container info */ + if(H5VL_file_get((const H5VL_object_t *)vol_obj_file, H5VL_FILE_GET_CONT_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &cont_info) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to get container info") + + if(ref_type == H5R_OBJECT1) { + size_t buf_size = H5R_OBJ_REF_BUF_SIZE; + + /* Get object address */ + if(H5R__decode_token_obj_compat(buf, &buf_size, obj_token, cont_info.token_size) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "unable to get object token") + } /* end if */ + else { + size_t buf_size = H5R_DSET_REG_REF_BUF_SIZE; + H5F_t *f = NULL; + + /* Retrieve file from VOL object */ + if(NULL == (f = (H5F_t *)H5VL_object_data((const H5VL_object_t *)vol_obj_file))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid VOL object") + + /* Get object address */ + if(H5R__decode_token_region_compat(f, buf, &buf_size, obj_token, cont_info.token_size, NULL) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "unable to get object address") + } /* end else */ + +done: + if(file_id != H5I_INVALID_HID && H5I_dec_ref(file_id) < 0) + HDONE_ERROR(H5E_REFERENCE, H5E_CANTDEC, FAIL, "unable to decrement refcount on file") + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5R__decode_token_compat() */ + + +/*------------------------------------------------------------------------- + * Function: H5R__encode_token_region_compat + * + * Purpose: Encode dataset selection and insert data into heap + * (native only). + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5R__encode_token_region_compat(H5F_t *f, const H5O_token_t *obj_token, + size_t token_size, H5S_t *space, unsigned char *buf, size_t *nalloc) +{ + size_t buf_size; + unsigned char *data = NULL; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + HDassert(f); + HDassert(obj_token); + HDassert(token_size); + HDassert(space); + HDassert(nalloc); + + /* Get required buffer size */ + if(H5R__encode_heap(f, NULL, &buf_size, NULL, (size_t)0) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + if(buf && *nalloc >= buf_size) { + ssize_t data_size; + uint8_t *p; + + /* Pass the correct encoding version for the selection depending on the + * file libver bounds, this is later retrieved in H5S hyper encode */ + H5CX_set_libver_bounds(f); + + /* Zero the heap ID out, may leak heap space if user is re-using + * reference and doesn't have garbage collection turned on + */ + HDmemset(buf, 0, buf_size); + + /* Get the amount of space required to serialize the selection */ + if((data_size = H5S_SELECT_SERIAL_SIZE(space)) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "Invalid amount of space for serializing selection") + + /* Increase buffer size to allow for the dataset token */ + data_size += (hssize_t)token_size; + + /* Allocate the space to store the serialized information */ + H5_CHECK_OVERFLOW(data_size, hssize_t, size_t); + if(NULL == (data = (uint8_t *)H5MM_malloc((size_t)data_size))) + HGOTO_ERROR(H5E_REFERENCE, H5E_NOSPACE, FAIL, "memory allocation failed") + + /* Serialize information for dataset OID into heap buffer */ + p = (uint8_t *)data; + H5MM_memcpy(p, obj_token, token_size); + p += token_size; + + /* Serialize the selection into heap buffer */ + if(H5S_SELECT_SERIALIZE(space, &p) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "Unable to serialize selection") + + /* Write to heap */ + if(H5R__encode_heap(f, buf, nalloc, data, (size_t)data_size) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + } + *nalloc = buf_size; + +done: + H5MM_free(data); + FUNC_LEAVE_NOAPI(ret_value) +} /* H5R__encode_token_region_compat() */ + + +#ifndef H5_NO_DEPRECATED_SYMBOLS +/*------------------------------------------------------------------------- * Function: H5Rget_obj_type1 * * Purpose: Retrieves the type of the object that a reference points to. diff --git a/src/H5Rint.c b/src/H5Rint.c index 30f3dbb..38eff9d 100644 --- a/src/H5Rint.c +++ b/src/H5Rint.c @@ -86,7 +86,7 @@ } while(0) /* Debug */ -//#define H5R_DEBUG +// #define H5R_DEBUG #ifdef H5R_DEBUG #define H5R_LOG_DEBUG(...) do { \ HDfprintf(stdout, " # %s(): ", __func__); \ @@ -423,6 +423,10 @@ H5R__destroy(H5R_ref_priv_t *ref) HDassert(ref != NULL); + H5R_LOG_DEBUG("Destroying reference, filename=%s, obj_addr=%s, encode size=%u", + ref->info.obj.filename, H5R__print_token(ref->info.obj.token), + ref->encode_size); + H5MM_xfree(ref->info.obj.filename); ref->info.obj.filename = NULL; @@ -818,7 +822,7 @@ H5R__set_obj_token(H5R_ref_priv_t *ref, const H5O_token_t *obj_token, HDassert(token_size); HDassert(token_size <= H5O_MAX_TOKEN_SIZE); - H5MM_memcpy(&ref->info.obj.token, obj_token, sizeof(H5O_token_t)); + H5MM_memcpy(&ref->info.obj.token, obj_token, token_size); HDassert(token_size <= 255); ref->token_size = (uint8_t)token_size; @@ -1028,6 +1032,10 @@ H5R__encode(const char *filename, const H5R_ref_priv_t *ref, unsigned char *buf, HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "internal error (unknown reference type)") } /* end switch */ + H5R_LOG_DEBUG("Encoded reference, filename=%s, obj_addr=%s, encode size=%u", + ref->info.obj.filename, H5R__print_token(ref->info.obj.token), + encode_size); + *nalloc = encode_size; done: @@ -1491,123 +1499,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5R__free_heap - * - * Purpose: Remove data previously inserted into heap (native only). - * - * Return: SUCCEED/FAIL - * - *------------------------------------------------------------------------- - */ -herr_t -H5R__free_heap(H5F_t *f, const unsigned char *buf, size_t nbytes) -{ - H5HG_t hobjid; - const uint8_t *p = (const uint8_t *)buf; - size_t buf_size; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_PACKAGE - - HDassert(f); - HDassert(buf); - - buf_size = H5HG_HEAP_ID_SIZE(f); - /* Don't decode if buffer size isn't big enough */ - if(nbytes < buf_size) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "Buffer size is too small") - - /* Get the heap information */ - H5F_addr_decode(f, &p, &(hobjid.addr)); - if(!H5F_addr_defined(hobjid.addr) || hobjid.addr == 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Undefined reference pointer") - UINT32DECODE(p, hobjid.idx); - - /* Free heap object */ - if(hobjid.addr > 0) { - /* Free heap object */ - if(H5HG_remove(f, &hobjid) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_WRITEERROR, FAIL, "Unable to remove heap object") - } /* end if */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5R__free_heap() */ - - -/*------------------------------------------------------------------------- - * Function: H5R__decode_token_compat - * - * Purpose: Decode an object token. (native only) - * - * Return: SUCCEED/FAIL - * - *------------------------------------------------------------------------- - */ -herr_t -H5R__decode_token_compat(H5VL_object_t *vol_obj, H5I_type_t type, H5R_type_t ref_type, - const unsigned char *buf, H5O_token_t *obj_token) -{ - hid_t file_id = H5I_INVALID_HID; /* File ID for region reference */ - H5VL_object_t *vol_obj_file = NULL; - H5VL_file_cont_info_t cont_info = {H5VL_CONTAINER_INFO_VERSION, 0, 0, 0}; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_PACKAGE - -#ifndef NDEBUG - { - hbool_t is_native = FALSE; /* Whether the src file is using the native VOL connector */ - - /* Check if using native VOL connector */ - if(H5VL_object_is_native(vol_obj, &is_native) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't query if file uses native VOL connector") - - /* Must use native VOL connector for this operation */ - HDassert(is_native); - } -#endif /* NDEBUG */ - - /* Get the file for the object */ - if((file_id = H5F_get_file_id(vol_obj, type, FALSE)) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") - - /* Retrieve VOL object */ - if(NULL == (vol_obj_file = H5VL_vol_object(file_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") - - /* Get container info */ - if(H5VL_file_get((const H5VL_object_t *)vol_obj_file, H5VL_FILE_GET_CONT_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &cont_info) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to get container info") - - if(ref_type == H5R_OBJECT1) { - size_t buf_size = H5R_OBJ_REF_BUF_SIZE; - - /* Get object address */ - if(H5R__decode_token_obj_compat(buf, &buf_size, obj_token, cont_info.token_size) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "unable to get object token") - } /* end if */ - else { - size_t buf_size = H5R_DSET_REG_REF_BUF_SIZE; - H5F_t *f = NULL; - - /* Retrieve file from VOL object */ - if(NULL == (f = (H5F_t *)H5VL_object_data((const H5VL_object_t *)vol_obj_file))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid VOL object") - - /* Get object address */ - if(H5R__decode_token_region_compat(f, buf, &buf_size, obj_token, cont_info.token_size, NULL) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "unable to get object address") - } /* end else */ - -done: - if(file_id != H5I_INVALID_HID && H5I_dec_ref(file_id) < 0) - HDONE_ERROR(H5E_REFERENCE, H5E_CANTDEC, FAIL, "unable to decrement refcount on file") - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5R__decode_token_compat() */ - - -/*------------------------------------------------------------------------- * Function: H5R__encode_token_obj_compat * * Purpose: Encode an object token. (native only) @@ -1674,82 +1565,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5R__encode_token_region_compat - * - * Purpose: Encode dataset selection and insert data into heap - * (native only). - * - * Return: SUCCEED/FAIL - * - *------------------------------------------------------------------------- - */ -herr_t -H5R__encode_token_region_compat(H5F_t *f, const H5O_token_t *obj_token, - size_t token_size, H5S_t *space, unsigned char *buf, size_t *nalloc) -{ - size_t buf_size; - unsigned char *data = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_PACKAGE - - HDassert(f); - HDassert(obj_token); - HDassert(token_size); - HDassert(space); - HDassert(nalloc); - - /* Get required buffer size */ - if(H5R__encode_heap(f, NULL, &buf_size, NULL, (size_t)0) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") - - if(buf && *nalloc >= buf_size) { - ssize_t data_size; - uint8_t *p; - - /* Pass the correct encoding version for the selection depending on the - * file libver bounds, this is later retrieved in H5S hyper encode */ - H5CX_set_libver_bounds(f); - - /* Zero the heap ID out, may leak heap space if user is re-using - * reference and doesn't have garbage collection turned on - */ - HDmemset(buf, 0, buf_size); - - /* Get the amount of space required to serialize the selection */ - if((data_size = H5S_SELECT_SERIAL_SIZE(space)) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "Invalid amount of space for serializing selection") - - /* Increase buffer size to allow for the dataset token */ - data_size += (hssize_t)token_size; - - /* Allocate the space to store the serialized information */ - H5_CHECK_OVERFLOW(data_size, hssize_t, size_t); - if(NULL == (data = (uint8_t *)H5MM_malloc((size_t)data_size))) - HGOTO_ERROR(H5E_REFERENCE, H5E_NOSPACE, FAIL, "memory allocation failed") - - /* Serialize information for dataset OID into heap buffer */ - p = (uint8_t *)data; - H5MM_memcpy(p, obj_token, token_size); - p += token_size; - - /* Serialize the selection into heap buffer */ - if(H5S_SELECT_SERIALIZE(space, &p) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "Unable to serialize selection") - - /* Write to heap */ - if(H5R__encode_heap(f, buf, nalloc, data, (size_t)data_size) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") - } - *nalloc = buf_size; - -done: - H5MM_free(data); - FUNC_LEAVE_NOAPI(ret_value) -} /* H5R__encode_token_region_compat() */ - - -/*------------------------------------------------------------------------- * Function: H5R__decode_token_region_compat * * Purpose: Decode dataset selection from data inserted into heap diff --git a/src/H5Rpkg.h b/src/H5Rpkg.h index 36cf805..c475951 100644 --- a/src/H5Rpkg.h +++ b/src/H5Rpkg.h @@ -116,14 +116,10 @@ H5_DLL herr_t H5R__decode(const unsigned char *buf, size_t *nbytes, H5R_ref_pr /* Native HDF5 specific routines */ H5_DLL herr_t H5R__encode_heap(H5F_t *f, unsigned char *buf, size_t *nalloc, const unsigned char *data, size_t data_size); H5_DLL herr_t H5R__decode_heap(H5F_t *f, const unsigned char *buf, size_t *nbytes, unsigned char **data_ptr, size_t *data_size); -H5_DLL herr_t H5R__free_heap(H5F_t *f, const unsigned char *buf, size_t nbytes); - -H5_DLL herr_t H5R__decode_token_compat(H5VL_object_t *vol_obj, H5I_type_t type, H5R_type_t ref_type, const unsigned char *buf, H5O_token_t *obj_token); H5_DLL herr_t H5R__encode_token_obj_compat(const H5O_token_t *obj_token, size_t token_size, unsigned char *buf, size_t *nalloc); H5_DLL herr_t H5R__decode_token_obj_compat(const unsigned char *buf, size_t *nbytes, H5O_token_t *obj_token, size_t token_size); -H5_DLL herr_t H5R__encode_token_region_compat(H5F_t *f, const H5O_token_t *obj_token, size_t token_size, H5S_t *space, unsigned char *buf, size_t *nalloc); H5_DLL herr_t H5R__decode_token_region_compat(H5F_t *f, const unsigned char *buf, size_t *nbytes, H5O_token_t *obj_token, size_t token_size, H5S_t **space_ptr); #endif /* _H5Rpkg_H */ diff --git a/src/H5S.c b/src/H5S.c index ddfd064..7e48076 100644 --- a/src/H5S.c +++ b/src/H5S.c @@ -88,18 +88,18 @@ H5FL_ARR_DEFINE(hsize_t, H5S_MAX_RANK); /* Dataspace ID class */ static const H5I_class_t H5I_DATASPACE_CLS[1] = {{ - H5I_DATASPACE, /* ID class value */ - 0, /* Class flags */ - 2, /* # of reserved IDs for class */ - (H5I_free_t)H5S_close /* Callback routine for closing objects of this class */ + H5I_DATASPACE, /* ID class value */ + 0, /* Class flags */ + 2, /* # of reserved IDs for class */ + (H5I_free_t)H5S_close /* Callback routine for closing objects of this class */ }}; /* Dataspace selection iterator ID class */ static const H5I_class_t H5I_SPACE_SEL_ITER_CLS[1] = {{ - H5I_SPACE_SEL_ITER, /* ID class value */ - 0, /* Class flags */ - 0, /* # of reserved IDs for class */ - (H5I_free_t)H5S_sel_iter_close /* Callback routine for closing objects of this class */ + H5I_SPACE_SEL_ITER, /* ID class value */ + 0, /* Class flags */ + 0, /* # of reserved IDs for class */ + (H5I_free_t)H5S_sel_iter_close /* Callback routine for closing objects of this class */ }}; @@ -107,7 +107,7 @@ static const H5I_class_t H5I_SPACE_SEL_ITER_CLS[1] = {{ static hbool_t H5S_top_package_initialize_s = FALSE; - + /*-------------------------------------------------------------------------- NAME H5S__init_package -- Initialize interface-specific information @@ -127,11 +127,11 @@ H5S__init_package(void) /* Initialize the atom group for the dataspace IDs */ if(H5I_register_type(H5I_DATASPACE_CLS) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize dataspace ID class") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize dataspace ID class") /* Initialize the atom group for the dataspace selction iterator IDs */ if(H5I_register_type(H5I_SPACE_SEL_ITER_CLS) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize dataspace selection iterator ID class") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize dataspace selection iterator ID class") /* Mark "top" of interface as initialized, too */ H5S_top_package_initialize_s = TRUE; @@ -140,7 +140,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__init_package() */ - + /*-------------------------------------------------------------------------- NAME H5S_top_term_package @@ -162,22 +162,22 @@ done: int H5S_top_term_package(void) { - int n = 0; + int n = 0; FUNC_ENTER_NOAPI_NOINIT_NOERR if(H5S_top_package_initialize_s) { - if(H5I_nmembers(H5I_DATASPACE) > 0) { - (void)H5I_clear_type(H5I_DATASPACE, FALSE, FALSE); + if(H5I_nmembers(H5I_DATASPACE) > 0) { + (void)H5I_clear_type(H5I_DATASPACE, FALSE, FALSE); n++; /*H5I*/ - } /* end if */ + } /* end if */ - if(H5I_nmembers(H5I_SPACE_SEL_ITER) > 0) { - (void)H5I_clear_type(H5I_SPACE_SEL_ITER, FALSE, FALSE); + if(H5I_nmembers(H5I_SPACE_SEL_ITER) > 0) { + (void)H5I_clear_type(H5I_SPACE_SEL_ITER, FALSE, FALSE); n++; /*H5I*/ - } /* end if */ + } /* end if */ - /* Mark "top" of interface as closed */ + /* Mark "top" of interface as closed */ if(0 == n) H5S_top_package_initialize_s = FALSE; } /* end if */ @@ -185,7 +185,7 @@ H5S_top_term_package(void) FUNC_LEAVE_NOAPI(n) } /* end H5S_top_term_package() */ - + /*-------------------------------------------------------------------------- NAME H5S_term_package @@ -209,7 +209,7 @@ H5S_top_term_package(void) int H5S_term_package(void) { - int n = 0; + int n = 0; FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -225,7 +225,7 @@ H5S_term_package(void) /* Destroy the dataspace selection iterator object id group */ n += (H5I_dec_type_ref(H5I_SPACE_SEL_ITER) > 0); - /* Mark interface as closed */ + /* Mark interface as closed */ if(0 == n) H5_PKG_INIT_VAR = FALSE; } /* end if */ @@ -234,7 +234,7 @@ H5S_term_package(void) } /* end H5S_term_package() */ - + /*-------------------------------------------------------------------------- NAME H5S_get_validiated_dataspace @@ -278,13 +278,13 @@ H5S_get_validated_dataspace(hid_t space_id, const H5S_t **space) /* Check for valid selection */ if(H5S_SELECT_VALID(*space) != TRUE) HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "selection + offset not within extent") - } /* end else */ + } done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_get_validated_dataspace() */ - + /*-------------------------------------------------------------------------- NAME H5S_create @@ -362,7 +362,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_create() */ - + /*-------------------------------------------------------------------------- NAME H5Screate @@ -409,16 +409,16 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Screate() */ - + /*------------------------------------------------------------------------- * Function: H5S__extent_release * - * Purpose: Releases all memory associated with a dataspace extent. + * Purpose: Releases all memory associated with a dataspace extent. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, July 23, 1998 + * Programmer: Quincey Koziol + * Thursday, July 23, 1998 * *------------------------------------------------------------------------- */ @@ -437,19 +437,22 @@ H5S__extent_release(H5S_extent_t *extent) extent->max = H5FL_ARR_FREE(hsize_t, extent->max); } /* end if */ + extent->rank = 0; + extent->nelem = 0; + FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5S__extent_release() */ - + /*------------------------------------------------------------------------- * Function: H5S_close * - * Purpose: Releases all memory associated with a dataspace. + * Purpose: Releases all memory associated with a dataspace. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Tuesday, December 9, 1997 + * Programmer: Robb Matzke + * Tuesday, December 9, 1997 * *------------------------------------------------------------------------- */ @@ -481,16 +484,16 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_close() */ - + /*------------------------------------------------------------------------- * Function: H5Sclose * - * Purpose: Release access to a dataspace object. + * Purpose: Release access to a dataspace object. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Tuesday, December 9, 1997 + * Programmer: Robb Matzke + * Tuesday, December 9, 1997 * *------------------------------------------------------------------------- */ @@ -514,69 +517,70 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Sclose() */ - + /*------------------------------------------------------------------------- * Function: H5Scopy * - * Purpose: Copies a dataspace. + * Purpose: Copies a dataspace. + * + * Return: Success: ID of the new dataspace * - * Return: Success: ID of the new dataspace - * Failure: Negative + * Failure: H5I_INVALID_HID * - * Programmer: Robb Matzke - * Friday, January 30, 1998 + * Programmer: Robb Matzke + * Friday, January 30, 1998 * *------------------------------------------------------------------------- */ hid_t H5Scopy(hid_t space_id) { - H5S_t *src; - H5S_t *dst = NULL; - hid_t ret_value; + H5S_t *src = NULL; + H5S_t *dst = NULL; + hid_t ret_value = H5I_INVALID_HID; - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", space_id); /* Check args */ if(NULL == (src = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a dataspace") /* Copy */ if(NULL == (dst = H5S_copy(src, FALSE, TRUE))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to copy dataspace") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, H5I_INVALID_HID, "unable to copy dataspace") /* Atomize */ if((ret_value = H5I_register (H5I_DATASPACE, dst, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace atom") + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataspace atom") done: if(ret_value < 0) if(dst && H5S_close(dst) < 0) - HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace") + HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, H5I_INVALID_HID, "unable to release dataspace") FUNC_LEAVE_API(ret_value) } /* end H5Scopy() */ - + /*------------------------------------------------------------------------- * Function: H5Sextent_copy * - * Purpose: Copies a dataspace extent. + * Purpose: Copies a dataspace extent. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, July 23, 1998 + * Programmer: Quincey Koziol + * Thursday, July 23, 1998 * *------------------------------------------------------------------------- */ herr_t H5Sextent_copy(hid_t dst_id,hid_t src_id) { - H5S_t *src; - H5S_t *dst; - herr_t ret_value = SUCCEED; + H5S_t *src; + H5S_t *dst; + herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) H5TRACE2("e", "ii", dst_id, src_id); @@ -595,7 +599,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Sextent_copy() */ - + /*------------------------------------------------------------------------- * Function: H5S_extent_copy * @@ -632,16 +636,16 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_extent_copy() */ - + /*------------------------------------------------------------------------- * Function: H5S__extent_copy_real * - * Purpose: Copies a dataspace extent + * Purpose: Copies a dataspace extent * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Wednesday, June 3, 1998 + * Programmer: Quincey Koziol + * Wednesday, June 3, 1998 * *------------------------------------------------------------------------- */ @@ -701,29 +705,30 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__extent_copy_real() */ - + /*------------------------------------------------------------------------- * Function: H5S_copy * - * Purpose: Copies a dataspace, by copying the extent and selection through - * H5S_extent_copy and H5S_select_copy. If the SHARE_SELECTION flag - * is set, then the selection can be shared between the source and - * destination dataspaces. (This should only occur in situations - * where the destination dataspace will immediately change to a new - * selection) + * Purpose: Copies a dataspace, by copying the extent and selection through + * H5S_extent_copy and H5S_select_copy. If the SHARE_SELECTION flag + * is set, then the selection can be shared between the source and + * destination dataspaces. (This should only occur in situations + * where the destination dataspace will immediately change to a new + * selection) + * + * Return: Success: A pointer to a new copy of SRC * - * Return: Success: A pointer to a new copy of SRC - * Failure: NULL + * Failure: NULL * - * Programmer: Robb Matzke - * Thursday, December 4, 1997 + * Programmer: Robb Matzke + * Thursday, December 4, 1997 * *------------------------------------------------------------------------- */ H5S_t * H5S_copy(const H5S_t *src, hbool_t share_selection, hbool_t copy_max) { - H5S_t *dst = NULL; + H5S_t *dst = NULL; H5S_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -750,17 +755,18 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_copy() */ - + /*------------------------------------------------------------------------- * Function: H5S_get_simple_extent_npoints * - * Purpose: Determines how many data points a dataset extent has. + * Purpose: Determines how many data points a dataset extent has. * - * Return: Success: Number of data points in the dataset extent. - * Failure: negative + * Return: Success: Number of data points in the dataset extent. * - * Programmer: Robb Matzke - * Tuesday, December 9, 1997 + * Failure: Negative + * + * Programmer: Robb Matzke + * Tuesday, December 9, 1997 * * Note: This routine participates in the "Inlining C function pointers" * pattern, don't call it directly, use the appropriate macro @@ -785,17 +791,17 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_get_simple_extent_npoints() */ - + /*------------------------------------------------------------------------- * Function: H5Sget_simple_extent_npoints * - * Purpose: Determines how many data points a dataset extent has. + * Purpose: Determines how many data points a dataset extent has. * - * Return: Success: Number of data points in the dataset. - * Failure: negative + * Return: Success: Number of data points in the dataset. + * Failure: Negative * - * Programmer: Robb Matzke - * Tuesday, December 9, 1997 + * Programmer: Robb Matzke + * Tuesday, December 9, 1997 * *------------------------------------------------------------------------- */ @@ -803,7 +809,7 @@ hssize_t H5Sget_simple_extent_npoints(hid_t space_id) { H5S_t *ds; - hssize_t ret_value; + hssize_t ret_value; FUNC_ENTER_API(FAIL) H5TRACE1("Hs", "i", space_id); @@ -818,22 +824,22 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Sget_simple_extent_npoints() */ - + /*------------------------------------------------------------------------- * Function: H5S_get_npoints_max * - * Purpose: Determines the maximum number of data points a dataspace may - * have. If the `max' array is null then the maximum number of - * data points is the same as the current number of data points - * without regard to the hyperslab. If any element of the `max' - * array is zero then the maximum possible size is returned. + * Purpose: Determines the maximum number of data points a dataspace may + * have. If the `max' array is null then the maximum number of + * data points is the same as the current number of data points + * without regard to the hyperslab. If any element of the `max' + * array is zero then the maximum possible size is returned. * - * Return: Success: Maximum number of data points the dataspace - * may have. - * Failure: 0 + * Return: Success: Maximum number of data points the dataspace + * may have. + * Failure: 0 * - * Programmer: Robb Matzke - * Tuesday, December 9, 1997 + * Programmer: Robb Matzke + * Tuesday, December 9, 1997 * *------------------------------------------------------------------------- */ @@ -841,7 +847,7 @@ hsize_t H5S_get_npoints_max(const H5S_t *ds) { unsigned u; - hsize_t ret_value = 0; /* Return value */ + hsize_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI(0) @@ -863,11 +869,11 @@ H5S_get_npoints_max(const H5S_t *ds) if(H5S_UNLIMITED == ds->extent.max[u]) { ret_value = HSIZET_MAX; break; - } /* end if */ + } else ret_value *= ds->extent.max[u]; - } /* end for */ - } /* end if */ + } + } else for(ret_value = 1, u = 0; u < ds->extent.rank; u++) ret_value *= ds->extent.size[u]; @@ -877,38 +883,38 @@ H5S_get_npoints_max(const H5S_t *ds) default: HDassert("unknown dataspace class" && 0); HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, 0, "internal error (unknown dataspace class)") - } /* end switch */ + } done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_get_npoints_max() */ - + /*------------------------------------------------------------------------- * Function: H5Sget_simple_extent_ndims * - * Purpose: Determines the dimensionality of a dataspace. + * Purpose: Determines the dimensionality of a dataspace. * - * Return: Success: The number of dimensions in a dataspace. - * Failure: Negative + * Return: Success: The number of dimensions in a dataspace. + * Failure: Negative * - * Programmer: Robb Matzke - * Thursday, December 11, 1997 + * Programmer: Robb Matzke + * Thursday, December 11, 1997 * *------------------------------------------------------------------------- */ int H5Sget_simple_extent_ndims(hid_t space_id) { - H5S_t *ds; - int ret_value; /* Return value */ + H5S_t *ds; + int ret_value = -1; - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API((-1)) H5TRACE1("Is", "i", space_id); /* Check args */ if(NULL == (ds = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a dataspace") ret_value = (int)H5S_GET_EXTENT_NDIMS(ds); @@ -916,18 +922,19 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Sget_simple_extent_ndims() */ - + /*------------------------------------------------------------------------- * Function: H5S_get_simple_extent_ndims * - * Purpose: Returns the number of dimensions in a dataspace. + * Purpose: Returns the number of dimensions in a dataspace. + * + * Return: Success: Non-negative number of dimensions. + * Zero implies a scalar. * - * Return: Success: Non-negative number of dimensions. Zero - * implies a scalar. - * Failure: Negative + * Failure: Negative * - * Programmer: Robb Matzke - * Thursday, December 11, 1997 + * Programmer: Robb Matzke + * hursday, December 11, 1997 * * Note: This routine participates in the "Inlining C function pointers" * pattern, don't call it directly, use the appropriate macro @@ -938,7 +945,7 @@ done: int H5S_get_simple_extent_ndims(const H5S_t *ds) { - int ret_value = -1; /* Return value */ + int ret_value = -1; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -962,35 +969,35 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_get_simple_extent_ndims() */ - + /*------------------------------------------------------------------------- * Function: H5Sget_simple_extent_dims * - * Purpose: Returns the size and maximum sizes in each dimension of - * a dataspace DS through the DIMS and MAXDIMS arguments. + * Purpose: Returns the size and maximum sizes in each dimension of + * a dataspace DS through the DIMS and MAXDIMS arguments. * - * Return: Success: Number of dimensions, the same value as - * returned by H5Sget_simple_extent_ndims(). - * Failure: Negative + * Return: Success: Number of dimensions, the same value as + * returned by H5Sget_simple_extent_ndims(). * - * Programmer: Robb Matzke - * Thursday, December 11, 1997 + * Failure: Negative + * + * Programmer: Robb Matzke + * Thursday, December 11, 1997 * *------------------------------------------------------------------------- */ int -H5Sget_simple_extent_dims(hid_t space_id, hsize_t dims[]/*out*/, - hsize_t maxdims[]/*out*/) +H5Sget_simple_extent_dims(hid_t space_id, hsize_t dims[]/*out*/, hsize_t maxdims[]/*out*/) { - H5S_t *ds; - int ret_value; /* Return value */ + H5S_t *ds; + int ret_value = -1; - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API((-1)) H5TRACE3("Is", "ixx", space_id, dims, maxdims); /* Check args */ if(NULL == (ds = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a dataspace") ret_value = H5S_get_simple_extent_dims(ds, dims, maxdims); @@ -998,26 +1005,26 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Sget_simple_extent_dims() */ - + /*------------------------------------------------------------------------- * Function: H5S_extent_get_dims * - * Purpose: Returns the size in each dimension of a dataspace. This - * function may not be meaningful for all types of dataspaces. + * Purpose: Returns the size in each dimension of a dataspace. This + * function may not be meaningful for all types of dataspaces. * - * Return: Success: Number of dimensions. Zero implies scalar. - * Failure: Negative + * Return: Success: Number of dimensions. Zero implies scalar. + * Failure: Negative * - * Programmer: Quincey Koziol - * Tuesday, June 30, 2009 + * Programmer: Quincey Koziol + * Tuesday, June 30, 2009 * *------------------------------------------------------------------------- */ int H5S_extent_get_dims(const H5S_extent_t *ext, hsize_t dims[], hsize_t max_dims[]) { - int i; /* Local index variable */ - int ret_value = -1; /* Return value */ + int i; /* Local index variable */ + int ret_value = -1; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1054,25 +1061,25 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_extent_get_dims() */ - + /*------------------------------------------------------------------------- * Function: H5S_get_simple_extent_dims * - * Purpose: Returns the size in each dimension of a dataspace. This - * function may not be meaningful for all types of dataspaces. + * Purpose: Returns the size in each dimension of a dataspace. This + * function may not be meaningful for all types of dataspaces. * - * Return: Success: Number of dimensions. Zero implies scalar. - * Failure: Negative + * Return: Success: Number of dimensions. Zero implies scalar. + * Failure: Negative * - * Programmer: Robb Matzke - * Thursday, December 11, 1997 + * Programmer: Robb Matzke + * Thursday, December 11, 1997 * *------------------------------------------------------------------------- */ int H5S_get_simple_extent_dims(const H5S_t *ds, hsize_t dims[], hsize_t max_dims[]) { - int ret_value = -1; /* Return value */ + int ret_value = -1; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1087,17 +1094,17 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_get_simple_extent_dims() */ - + /*------------------------------------------------------------------------- * Function: H5S_write * - * Purpose: Updates a dataspace by writing a message to an object - * header. + * Purpose: Updates a dataspace by writing a message to an object + * header. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Tuesday, December 9, 1997 + * Programmer: Robb Matzke + * Tuesday, December 9, 1997 * *------------------------------------------------------------------------- */ @@ -1121,17 +1128,16 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_write() */ - + /*------------------------------------------------------------------------- * Function: H5S_append * - * Purpose: Updates a dataspace by adding a message to an object - * header. + * Purpose: Updates a dataspace by adding a message to an object header. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Tuesday, December 31, 2002 + * Programmer: Quincey Koziol + * Tuesday, December 31, 2002 * *------------------------------------------------------------------------- */ @@ -1155,24 +1161,25 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_append() */ - + /*------------------------------------------------------------------------- * Function: H5S_read * - * Purpose: Reads the dataspace from an object header. + * Purpose: Reads the dataspace from an object header. + * + * Return: Success: Pointer to a new dataspace. * - * Return: Success: Pointer to a new dataspace. - * Failure: NULL + * Failure: NULL * - * Programmer: Robb Matzke - * Tuesday, December 9, 1997 + * Programmer: Robb Matzke + * Tuesday, December 9, 1997 * *------------------------------------------------------------------------- */ H5S_t * H5S_read(const H5O_loc_t *loc) { - H5S_t *ds = NULL; /* Dataspace to return */ + H5S_t *ds = NULL; /* Dataspace to return */ H5S_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -1201,7 +1208,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_read() */ - + /*-------------------------------------------------------------------------- NAME H5S__is_simple @@ -1233,7 +1240,7 @@ H5S__is_simple(const H5S_t *sdim) FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__is_simple() */ - + /*-------------------------------------------------------------------------- NAME H5Sis_simple @@ -1241,7 +1248,7 @@ H5S__is_simple(const H5S_t *sdim) Check if a dataspace is simple USAGE htri_t H5Sis_simple(space_id) - hid_t space_id; IN: ID of dataspace object to query + hid_t space_id; IN: ID of dataspace object to query RETURNS TRUE/FALSE/FAIL DESCRIPTION @@ -1251,15 +1258,15 @@ H5S__is_simple(const H5S_t *sdim) htri_t H5Sis_simple(hid_t space_id) { - H5S_t *space; /* Dataspace to check */ - htri_t ret_value; /* Return value */ + H5S_t *space; /* Dataspace to check */ + htri_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("t", "i", space_id); /* Check args and all the boring stuff. */ if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "not a dataspace") ret_value = H5S__is_simple(space); @@ -1267,7 +1274,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Sis_simple() */ - + /*-------------------------------------------------------------------------- NAME H5Sset_extent_simple @@ -1275,11 +1282,11 @@ done: Sets the size of a simple dataspace USAGE herr_t H5Sset_extent_simple(space_id, rank, dims, max) - hid_t space_id; IN: Dataspace object to query - int rank; IN: # of dimensions for the dataspace - const size_t *dims; IN: Size of each dimension for the dataspace - const size_t *max; IN: Maximum size of each dimension for the - dataspace + hid_t space_id; IN: Dataspace object to query + int rank; IN: # of dimensions for the dataspace + const size_t *dims; IN: Size of each dimension for the dataspace + const size_t *max; IN: Maximum size of each dimension for the + dataspace RETURNS Non-negative on success/Negative on failure DESCRIPTION @@ -1298,8 +1305,8 @@ herr_t H5Sset_extent_simple(hid_t space_id, int rank, const hsize_t dims[/*rank*/], const hsize_t max[/*rank*/]) { - H5S_t *space; /* Dataspace to modify */ - int u; /* Local counting variable */ + H5S_t *space; /* Dataspace to modify */ + int u; /* Local counting variable */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1322,26 +1329,25 @@ H5Sset_extent_simple(hid_t space_id, int rank, const hsize_t dims[/*rank*/], for(u = 0; u < rank; u++) if(max[u] != H5S_UNLIMITED && max[u] < dims[u]) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid maximum dimension size") - } /* end if */ + } /* Do it */ if(H5S_set_extent_simple(space, (unsigned)rank, dims, max) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to set simple extent") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to set simple extent") done: FUNC_LEAVE_API(ret_value) } /* end H5Sset_extent_simple() */ - + /*------------------------------------------------------------------------- * Function: H5S_set_extent_simple * - * Purpose: This is where the real work happens for - * H5Sset_extent_simple(). + * Purpose: This is where the real work happens for H5Sset_extent_simple(). * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, July 8, 1998 * *------------------------------------------------------------------------- @@ -1362,10 +1368,10 @@ H5S_set_extent_simple(H5S_t *space, unsigned rank, const hsize_t *dims, if(H5S__extent_release(&space->extent) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "failed to release previous dataspace extent") - if(rank == 0) { /* scalar variable */ + if(rank == 0) { /* scalar variable */ space->extent.type = H5S_SCALAR; space->extent.nelem = 1; - space->extent.rank = 0; /* set to scalar rank */ + space->extent.rank = 0; /* set to scalar rank */ } /* end if */ else { hsize_t nelem; /* Number of elements in extent */ @@ -1408,91 +1414,90 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_set_extent_simple() */ - + /*------------------------------------------------------------------------- * Function: H5Screate_simple * - * Purpose: Creates a new simple dataspace object and opens it for - * access. The DIMS argument is the size of the simple dataset - * and the MAXDIMS argument is the upper limit on the size of - * the dataset. MAXDIMS may be the null pointer in which case - * the upper limit is the same as DIMS. If an element of - * MAXDIMS is H5S_UNLIMITED then the corresponding dimension is - * unlimited, otherwise no element of MAXDIMS should be smaller - * than the corresponding element of DIMS. + * Purpose: Creates a new simple dataspace object and opens it for + * access. The DIMS argument is the size of the simple dataset + * and the MAXDIMS argument is the upper limit on the size of + * the dataset. MAXDIMS may be the null pointer in which case + * the upper limit is the same as DIMS. If an element of + * MAXDIMS is H5S_UNLIMITED then the corresponding dimension is + * unlimited, otherwise no element of MAXDIMS should be smaller + * than the corresponding element of DIMS. + * + * Return: Success: The ID for the new simple dataspace object. * - * Return: Success: The ID for the new simple dataspace object. - * Failure: Negative + * Failure: H5I_INVALID_HID * - * Programmer: Quincey Koziol - * Tuesday, January 27, 1998 + * Programmer: Quincey Koziol + * Tuesday, January 27, 1998 * *------------------------------------------------------------------------- */ hid_t -H5Screate_simple(int rank, const hsize_t dims[/*rank*/], - const hsize_t maxdims[/*rank*/]) +H5Screate_simple(int rank, const hsize_t dims[/*rank*/], const hsize_t maxdims[/*rank*/]) { - H5S_t *space = NULL; - int i; - hid_t ret_value; /* Return value */ + H5S_t *space = NULL; + int i; + hid_t ret_value = H5I_INVALID_HID; - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE3("i", "Is*[a0]h*[a0]h", rank, dims, maxdims); /* Check arguments */ if(rank < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dimensionality cannot be negative") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "dimensionality cannot be negative") if(rank > H5S_MAX_RANK) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dimensionality is too large") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "dimensionality is too large") /* We allow users to use this function to create scalar or null dataspace. * Check DIMS isn't set when the RANK is 0. */ if(!dims && rank != 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid dataspace information") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid dataspace information") /* Check whether the current dimensions are valid */ for(i = 0; i < rank; i++) { if(H5S_UNLIMITED == dims[i]) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "current dimension must have a specific size, not H5S_UNLIMITED") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "current dimension must have a specific size, not H5S_UNLIMITED") if(maxdims && H5S_UNLIMITED != maxdims[i] && maxdims[i]extent))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, NULL, "can't copy object") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, NULL, "can't copy object") if(H5S__extent_release(extent) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTDELETE, NULL, "can't release previous dataspace") extent = H5FL_FREE(H5S_extent_t, extent); @@ -1754,17 +1755,18 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_decode() */ - + /*------------------------------------------------------------------------- * Function: H5S_get_simple_extent_type * - * Purpose: Internal function for retrieving the type of extent for a dataspace object + * Purpose: Internal function for retrieving the type of extent for a dataspace object + * + * Return: Success: The class of the dataspace object * - * Return: Success: The class of the dataspace object - * Failure: N5S_NO_CLASS + * Failure: N5S_NO_CLASS * - * Programmer: Quincey Koziol - * Thursday, September 28, 2000 + * Programmer: Quincey Koziol + * Thursday, September 28, 2000 * * Note: This routine participates in the "Inlining C function pointers" * pattern, don't call it directly, use the appropriate macro @@ -1775,7 +1777,7 @@ done: H5S_class_t H5S_get_simple_extent_type(const H5S_t *space) { - H5S_class_t ret_value = H5S_NO_CLASS; /* Return value */ + H5S_class_t ret_value = H5S_NO_CLASS; /* Return value */ FUNC_ENTER_NOAPI(H5S_NO_CLASS) @@ -1787,25 +1789,26 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_get_simple_extent_type() */ - + /*------------------------------------------------------------------------- * Function: H5Sget_simple_extent_type * - * Purpose: Retrieves the type of extent for a dataspace object + * Purpose: Retrieves the type of extent for a dataspace object * - * Return: Success: The class of the dataspace object - * Failure: N5S_NO_CLASS + * Return: Success: The class of the dataspace object * - * Programmer: Quincey Koziol - * Thursday, July 23, 1998 + * Failure: N5S_NO_CLASS + * + * Programmer: Quincey Koziol + * Thursday, July 23, 1998 * *------------------------------------------------------------------------- */ H5S_class_t H5Sget_simple_extent_type(hid_t sid) { - H5S_t *space; - H5S_class_t ret_value; /* Return value */ + H5S_t *space; + H5S_class_t ret_value; /* Return value */ FUNC_ENTER_API(H5S_NO_CLASS) H5TRACE1("Sc", "i", sid); @@ -1820,7 +1823,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Sget_simple_extent_type() */ - + /*-------------------------------------------------------------------------- NAME H5Sset_extent_none @@ -1828,18 +1831,18 @@ done: Resets the extent of a dataspace back to "none" USAGE herr_t H5Sset_extent_none(space_id) - hid_t space_id; IN: Dataspace object to reset + hid_t space_id; IN: Dataspace object to reset RETURNS Non-negative on success/Negative on failure DESCRIPTION - This function resets the type of a dataspace back to "none" with no + This function resets the type of a dataspace to H5S_NULL with no extent information stored for the dataspace. --------------------------------------------------------------------------*/ herr_t H5Sset_extent_none(hid_t space_id) { - H5S_t *space; /* Dataspace to modify */ - herr_t ret_value = SUCCEED; /* Return value */ + H5S_t *space; /* Dataspace to modify */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", space_id); @@ -1852,22 +1855,21 @@ H5Sset_extent_none(hid_t space_id) if(H5S__extent_release(&space->extent) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTDELETE, FAIL, "can't release previous dataspace") - space->extent.type = H5S_NO_CLASS; + space->extent.type = H5S_NULL; done: FUNC_LEAVE_API(ret_value) } /* end H5Sset_extent_none() */ - + /*------------------------------------------------------------------------- * Function: H5S_set_extent * * Purpose: Modify the dimensions of a dataspace. * - * Return: Success: Non-negative - * Failure: Negative + * Return: TRUE/FALSE/FAIL * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * March 13, 2002 * *------------------------------------------------------------------------- @@ -1905,7 +1907,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_set_extent() */ - + /*------------------------------------------------------------------------- * Function: H5S_has_extent * @@ -1938,7 +1940,7 @@ H5S_has_extent(const H5S_t *ds) FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_has_extent() */ - + /*------------------------------------------------------------------------- * Function: H5S_set_extent_real * @@ -1947,7 +1949,7 @@ H5S_has_extent(const H5S_t *ds) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * March 13, 2002 * *------------------------------------------------------------------------- @@ -1985,25 +1987,27 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_set_extent_real() */ - + /*------------------------------------------------------------------------- * Function: H5Sextent_equal * - * Purpose: Determines if two dataspace extents are equal. + * Purpose: Determines if two dataspace extents are equal. + * + * Return: Success: TRUE if equal, FALSE if unequal * - * Return: Success: TRUE if equal, FALSE if unequal - * Failure: Negative + * Failure: FAIL * - * Programmer: Quincey Koziol - * Monday, October 24, 2005 + * Programmer: Quincey Koziol + * Monday, October 24, 2005 * *------------------------------------------------------------------------- */ htri_t H5Sextent_equal(hid_t space1_id, hid_t space2_id) { - const H5S_t *ds1, *ds2; /* Dataspaces to compare */ - htri_t ret_value; /* Return value */ + const H5S_t *ds1; /* Dataspaces to compare */ + const H5S_t *ds2; + htri_t ret_value; FUNC_ENTER_API(FAIL) H5TRACE2("t", "ii", space1_id, space2_id); @@ -2011,17 +2015,17 @@ H5Sextent_equal(hid_t space1_id, hid_t space2_id) /* check args */ if(NULL == (ds1 = (const H5S_t *)H5I_object_verify(space1_id, H5I_DATASPACE)) || NULL == (ds2 = (const H5S_t *)H5I_object_verify(space2_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") /* Check dataspaces for extent's equality */ if((ret_value = H5S_extent_equal(ds1, ds2)) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOMPARE, FAIL, "dataspace comparison failed") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOMPARE, FAIL, "dataspace comparison failed") done: FUNC_LEAVE_API(ret_value) } /* end H5Sextent_equal() */ - + /*-------------------------------------------------------------------------- NAME H5S_extent_equal @@ -2082,17 +2086,17 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_extent_equal() */ - + /*------------------------------------------------------------------------- * Function: H5S_extent_nelem * - * Purpose: Determines how many elements a dataset extent describes. + * Purpose: Determines how many elements a dataset extent describes. * - * Return: Success: Number of data points in the dataset extent. - * Failure: negative + * Return: Success: Number of data points in the dataset extent. + * Failure: Negative * - * Programmer: Quincey Koziol - * Thursday, November 30, 2006 + * Programmer: Quincey Koziol + * Thursday, November 30, 2006 * *------------------------------------------------------------------------- */ @@ -2108,7 +2112,7 @@ H5S_extent_nelem(const H5S_extent_t *ext) FUNC_LEAVE_NOAPI(ext->nelem) } /* end H5S_extent_nelem() */ - + /*------------------------------------------------------------------------- * Function: H5S_set_version * diff --git a/src/H5SL.c b/src/H5SL.c index ff8edb8..4716dc4 100644 --- a/src/H5SL.c +++ b/src/H5SL.c @@ -568,10 +568,10 @@ struct H5SL_t { }; /* Static functions */ -static H5SL_node_t * H5SL_new_node(void *item, const void *key, uint32_t hashval); -static H5SL_node_t *H5SL_insert_common(H5SL_t *slist, void *item, const void *key); -static herr_t H5SL_release_common(H5SL_t *slist, H5SL_operator_t op, void *op_data); -static herr_t H5SL_close_common(H5SL_t *slist, H5SL_operator_t op, void *op_data); +static H5SL_node_t *H5SL__new_node(void *item, const void *key, uint32_t hashval); +static H5SL_node_t *H5SL__insert_common(H5SL_t *slist, void *item, const void *key); +static herr_t H5SL__release_common(H5SL_t *slist, H5SL_operator_t op, void *op_data); +static herr_t H5SL__close_common(H5SL_t *slist, H5SL_operator_t op, void *op_data); /* Package initialization variable */ hbool_t H5_PKG_INIT_VAR = FALSE; @@ -642,7 +642,8 @@ H5SL__init_package(void) EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -int H5SL_term_package(void) +int +H5SL_term_package(void) { int n = 0; @@ -682,11 +683,11 @@ int H5SL_term_package(void) /*-------------------------------------------------------------------------- NAME - H5SL_new_node + H5SL__new_node PURPOSE Create a new skip list node of level 0 USAGE - H5SL_node_t *H5SL_new_node(item,key,hasval) + H5SL_node_t *H5SL__new_node(item,key,hasval) void *item; IN: Pointer to item info for node void *key; IN: Pointer to key info for node uint32_t hashval; IN: Hash value for node @@ -703,11 +704,11 @@ int H5SL_term_package(void) REVISION LOG --------------------------------------------------------------------------*/ static H5SL_node_t * -H5SL_new_node(void *item, const void *key, uint32_t hashval) +H5SL__new_node(void *item, const void *key, uint32_t hashval) { H5SL_node_t *ret_value = NULL; /* New skip list node */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Allocate the node */ if(NULL == (ret_value = (H5SL_node_t *)H5FL_MALLOC(H5SL_node_t))) @@ -727,16 +728,16 @@ H5SL_new_node(void *item, const void *key, uint32_t hashval) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5SL_new_node() */ +} /* end H5SL__new_node() */ /*-------------------------------------------------------------------------- NAME - H5SL_insert_common + H5SL__insert_common PURPOSE Common code for inserting an object into a skip list USAGE - H5SL_node_t *H5SL_insert_common(slist,item,key) + H5SL_node_t *H5SL__insert_common(slist,item,key) H5SL_t *slist; IN/OUT: Pointer to skip list void *item; IN: Item to insert void *key; IN: Key for item to insert @@ -752,14 +753,14 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static H5SL_node_t * -H5SL_insert_common(H5SL_t *slist, void *item, const void *key) +H5SL__insert_common(H5SL_t *slist, void *item, const void *key) { H5SL_node_t *x; /* Current node to examine */ H5SL_node_t *prev; /* Node before the new node */ uint32_t hashval = 0; /* Hash value for key */ H5SL_node_t *ret_value; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check args */ HDassert(slist); @@ -822,7 +823,7 @@ H5SL_insert_common(H5SL_t *slist, void *item, const void *key) slist->curr_level = 0; /* Create new node of level 0 */ - if(NULL == (x = H5SL_new_node(item, key, hashval))) + if(NULL == (x = H5SL__new_node(item, key, hashval))) HGOTO_ERROR(H5E_SLIST ,H5E_NOSPACE, NULL, "can't create new skip list node") /* Update the links */ @@ -844,16 +845,16 @@ H5SL_insert_common(H5SL_t *slist, void *item, const void *key) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5SL_insert_common() */ +} /* end H5SL__insert_common() */ /*-------------------------------------------------------------------------- NAME - H5SL_release_common + H5SL__release_common PURPOSE Release all nodes from a skip list, optionally calling a 'free' operator USAGE - herr_t H5SL_release_common(slist,op,opdata) + herr_t H5SL__release_common(slist,op,opdata) H5SL_t *slist; IN/OUT: Pointer to skip list to release nodes H5SL_operator_t op; IN: Callback function to free item & key void *op_data; IN/OUT: Pointer to application data for callback @@ -872,12 +873,12 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5SL_release_common(H5SL_t *slist, H5SL_operator_t op, void *op_data) +H5SL__release_common(H5SL_t *slist, H5SL_operator_t op, void *op_data) { H5SL_node_t *node, *next_node; /* Pointers to skip list nodes */ herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check args */ HDassert(slist); @@ -917,16 +918,16 @@ H5SL_release_common(H5SL_t *slist, H5SL_operator_t op, void *op_data) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5SL_release_common() */ +} /* end H5SL__release_common() */ /*-------------------------------------------------------------------------- NAME - H5SL_close_common + H5SL__close_common PURPOSE Close a skip list, deallocating it and potentially freeing all its nodes. USAGE - herr_t H5SL_close_common(slist,op,opdata) + herr_t H5SL__close_common(slist,op,opdata) H5SL_t *slist; IN/OUT: Pointer to skip list to close H5SL_operator_t op; IN: Callback function to free item & key void *op_data; IN/OUT: Pointer to application data for callback @@ -944,11 +945,11 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5SL_close_common(H5SL_t *slist, H5SL_operator_t op, void *op_data) +H5SL__close_common(H5SL_t *slist, H5SL_operator_t op, void *op_data) { herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check args */ HDassert(slist); @@ -957,7 +958,7 @@ H5SL_close_common(H5SL_t *slist, H5SL_operator_t op, void *op_data) /* (Pre-condition) */ /* Free skip list nodes */ - if(H5SL_release_common(slist, op, op_data) < 0) + if(H5SL__release_common(slist, op, op_data) < 0) HGOTO_ERROR(H5E_SLIST, H5E_CANTFREE, FAIL, "can't release skip list nodes") /* Release header node */ @@ -969,7 +970,7 @@ H5SL_close_common(H5SL_t *slist, H5SL_operator_t op, void *op_data) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5SL_close_common() */ +} /* end H5SL__close_common() */ /*-------------------------------------------------------------------------- @@ -1016,7 +1017,7 @@ H5SL_create(H5SL_type_t type, H5SL_cmp_t cmp) new_slist->safe_iterating = FALSE; /* Allocate the header node */ - if(NULL == (header = H5SL_new_node(NULL, NULL, (uint32_t)ULONG_MAX))) + if(NULL == (header = H5SL__new_node(NULL, NULL, (uint32_t)ULONG_MAX))) HGOTO_ERROR(H5E_SLIST ,H5E_NOSPACE, NULL, "can't create new skip list node") /* Initialize header node's forward pointer */ @@ -1118,8 +1119,8 @@ H5SL_insert(H5SL_t *slist, void *item, const void *key) /* (Pre-condition) */ /* Insert item into skip list */ - if(H5SL_insert_common(slist,item,key)==NULL) - HGOTO_ERROR(H5E_SLIST,H5E_CANTINSERT,FAIL,"can't create new skip list node") + if(NULL == H5SL__insert_common(slist, item, key)) + HGOTO_ERROR(H5E_SLIST, H5E_CANTINSERT, FAIL, "can't create new skip list node") done: FUNC_LEAVE_NOAPI(ret_value) @@ -1168,8 +1169,8 @@ H5SL_add(H5SL_t *slist, void *item, const void *key) /* (Pre-condition) */ /* Insert item into skip list */ - if((ret_value=H5SL_insert_common(slist,item,key))==NULL) - HGOTO_ERROR(H5E_SLIST,H5E_CANTINSERT,NULL,"can't create new skip list node") + if(NULL == (ret_value = H5SL__insert_common(slist, item, key))) + HGOTO_ERROR(H5E_SLIST, H5E_CANTINSERT, NULL, "can't create new skip list node") done: FUNC_LEAVE_NOAPI(ret_value) @@ -2241,7 +2242,9 @@ H5SL_iterate(H5SL_t *slist, H5SL_operator_t op, void *op_data) herr_t H5SL_release(H5SL_t *slist) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) /* Check args */ HDassert(slist); @@ -2253,8 +2256,10 @@ H5SL_release(H5SL_t *slist) /* (Pre-condition) */ /* Free skip list nodes */ - H5SL_release_common(slist,NULL,NULL); /* always succeeds */ + if(H5SL__release_common(slist, NULL, NULL) < 0) + HGOTO_ERROR(H5E_SLIST, H5E_CANTFREE, FAIL, "can't release skip list nodes") +done: FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5SL_release() */ @@ -2290,7 +2295,9 @@ H5SL_release(H5SL_t *slist) herr_t H5SL_free(H5SL_t *slist, H5SL_operator_t op, void *op_data) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) /* Check args */ HDassert(slist); @@ -2302,9 +2309,11 @@ H5SL_free(H5SL_t *slist, H5SL_operator_t op, void *op_data) /* (Pre-condition) */ /* Free skip list nodes */ - H5SL_release_common(slist,op,op_data); /* always succeeds */ + if(H5SL__release_common(slist, op, op_data) < 0) + HGOTO_ERROR(H5E_SLIST, H5E_CANTFREE, FAIL, "can't release skip list nodes") - FUNC_LEAVE_NOAPI(SUCCEED) +done: + FUNC_LEAVE_NOAPI(ret_value) } /* end H5SL_free() */ @@ -2516,9 +2525,9 @@ done: herr_t H5SL_destroy(H5SL_t *slist, H5SL_operator_t op, void *op_data) { - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_NOAPI_NOINIT /* Check args */ HDassert(slist); @@ -2527,8 +2536,10 @@ H5SL_destroy(H5SL_t *slist, H5SL_operator_t op, void *op_data) /* (Pre-condition) */ /* Close skip list */ - (void)H5SL_close_common(slist,op,op_data); /* always succeeds */ + if(H5SL__close_common(slist, op, op_data) < 0) + HGOTO_ERROR(H5E_SLIST, H5E_CANTCLOSEOBJ, FAIL, "can't close skip list") +done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5SL_destroy() */ @@ -2555,7 +2566,9 @@ H5SL_destroy(H5SL_t *slist, H5SL_operator_t op, void *op_data) herr_t H5SL_close(H5SL_t *slist) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT /* Check args */ HDassert(slist); @@ -2564,8 +2577,10 @@ H5SL_close(H5SL_t *slist) /* (Pre-condition) */ /* Close skip list */ - (void)H5SL_close_common(slist,NULL,NULL); /* always succeeds */ + if(H5SL__close_common(slist, NULL, NULL) < 0) + HGOTO_ERROR(H5E_SLIST, H5E_CANTCLOSEOBJ, FAIL, "can't close skip list") - FUNC_LEAVE_NOAPI(SUCCEED) +done: + FUNC_LEAVE_NOAPI(ret_value) } /* end H5SL_close() */ diff --git a/src/H5SLmodule.h b/src/H5SLmodule.h index 34f08a1..335e35b 100644 --- a/src/H5SLmodule.h +++ b/src/H5SLmodule.h @@ -11,7 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, September 12, 2015 * * Purpose: This file contains declarations which define macros for the diff --git a/src/H5SM.c b/src/H5SM.c index 6eea80d..404e08b 100644 --- a/src/H5SM.c +++ b/src/H5SM.c @@ -61,6 +61,7 @@ static herr_t H5SM__find_in_list(const H5SM_list_t *list, const H5SM_mesg_key_t size_t *empty_pos, size_t *list_pos); static herr_t H5SM__convert_list_to_btree(H5F_t * f, H5SM_index_header_t * header, H5SM_list_t **_list, H5HF_t *fheap, H5O_t *open_oh); +static herr_t H5SM__bt2_convert_to_list_op(const void * record, void *op_data); static herr_t H5SM__convert_btree_to_list(H5F_t * f, H5SM_index_header_t * header); static herr_t H5SM__incr_ref(void *record, void *_op_data, hbool_t *changed); static herr_t H5SM__write_mesg(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, @@ -294,7 +295,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5SM_get_index + * Function: H5SM__get_index * * Purpose: Get the index number for a given message type. * @@ -310,13 +311,13 @@ done: *------------------------------------------------------------------------- */ ssize_t -H5SM_get_index(const H5SM_master_table_t *table, unsigned type_id) +H5SM__get_index(const H5SM_master_table_t *table, unsigned type_id) { size_t x; unsigned type_flag; ssize_t ret_value = FAIL; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Translate the H5O type_id into an H5SM type flag */ if(H5SM__type_to_flag(type_id, &type_flag) < 0) @@ -334,7 +335,7 @@ H5SM_get_index(const H5SM_master_table_t *table, unsigned type_id) */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5SM_get_index() */ +} /* end H5SM__get_index() */ /*------------------------------------------------------------------------- @@ -428,7 +429,7 @@ H5SM_get_fheap_addr(H5F_t *f, unsigned type_id, haddr_t *fheap_addr) 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) + if((index_num = H5SM__get_index(table, type_id)) < 0) HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to find correct SOHM index") /* Retrieve heap address for index */ @@ -640,7 +641,7 @@ H5SM__create_list(H5F_t *f, H5SM_index_header_t *header) haddr_t addr = HADDR_UNDEF; /* Address of the list on disk */ haddr_t ret_value = HADDR_UNDEF; /* Return value */ - FUNC_ENTER_STATIC_TAG(H5AC__SOHM_TAG) + FUNC_ENTER_STATIC HDassert(f); HDassert(header); @@ -682,7 +683,7 @@ done: H5MF_xfree(f, H5FD_MEM_SOHM_INDEX, addr, (hsize_t)header->list_size); } /* end if */ - FUNC_LEAVE_NOAPI_TAG(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5SM__create_list */ @@ -801,6 +802,48 @@ done: /*------------------------------------------------------------------------- + * Function: H5SM__bt2_convert_to_list_op + * + * Purpose: An H5B2_remove_t callback function to convert a SOHM + * B-tree index to a list. + * + * Inserts this record into the list passed through op_data. + * + * Return: Non-negative on success + * Negative on failure + * + * Programmer: James Laird + * Monday, November 6, 2006 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5SM__bt2_convert_to_list_op(const void * record, void *op_data) +{ + const H5SM_sohm_t *message = (const H5SM_sohm_t *)record; + const H5SM_list_t *list = (const H5SM_list_t *)op_data; + size_t mesg_idx; /* Index of message to modify */ + + FUNC_ENTER_STATIC_NOERR + + /* Sanity checks */ + HDassert(record); + HDassert(op_data); + + /* Get the message index, and increment the # of messages in list */ + mesg_idx = list->header->num_messages++; + HDassert(list->header->num_messages <= list->header->list_max); + + /* Insert this message at the end of the list */ + HDassert(list->messages[mesg_idx].location == H5SM_NO_LOC); + HDassert(message->location != H5SM_NO_LOC); + H5MM_memcpy(&(list->messages[mesg_idx]), message, sizeof(H5SM_sohm_t)); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5SM__bt2_convert_to_list_op() */ + + +/*------------------------------------------------------------------------- * Function: H5SM__convert_btree_to_list * * Purpose: Given a B-tree index, turns it into a list index. This is @@ -822,7 +865,7 @@ H5SM__convert_btree_to_list(H5F_t * f, H5SM_index_header_t * header) haddr_t btree_addr; herr_t ret_value = SUCCEED; - FUNC_ENTER_STATIC_TAG(H5AC__SOHM_TAG) + FUNC_ENTER_STATIC /* Remember the address of the old B-tree, but change the header over to be * a list.. @@ -847,7 +890,7 @@ H5SM__convert_btree_to_list(H5F_t * f, H5SM_index_header_t * header) /* Delete the B-tree and have messages copy themselves to the * list as they're deleted */ - if(H5B2_delete(f, btree_addr, f, H5SM_bt2_convert_to_list_op, list) < 0) + if(H5B2_delete(f, btree_addr, f, H5SM__bt2_convert_to_list_op, list) < 0) HGOTO_ERROR(H5E_SOHM, H5E_CANTDELETE, FAIL, "unable to delete B-tree") done: @@ -855,12 +898,12 @@ done: if(list && H5AC_unprotect(f, H5AC_SOHM_LIST, header->index_addr, list, H5AC__DIRTIED_FLAG) < 0) HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to unprotect SOHM index") - FUNC_LEAVE_NOAPI_TAG(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5SM__convert_btree_to_list() */ /*------------------------------------------------------------------------- - * Function: H5SM_can_share_common + * Function: H5SM__can_share_common * * Purpose: "trivial" checks for determining if a message can be shared. * @@ -878,11 +921,11 @@ done: *------------------------------------------------------------------------- */ static htri_t -H5SM_can_share_common(const H5F_t *f, unsigned type_id, const void *mesg) +H5SM__can_share_common(const H5F_t *f, unsigned type_id, const void *mesg) { htri_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check whether this message ought to be shared or not */ /* If sharing is disabled in this file, don't share the message */ @@ -901,7 +944,7 @@ H5SM_can_share_common(const H5F_t *f, unsigned type_id, const void *mesg) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5SM_can_share_common() */ +} /* end H5SM__can_share_common() */ /*------------------------------------------------------------------------- @@ -934,7 +977,7 @@ H5SM_can_share(H5F_t *f, H5SM_master_table_t *table, FUNC_ENTER_NOAPI_TAG(H5AC__SOHM_TAG, FAIL) /* "trivial" sharing checks */ - if((tri_ret = H5SM_can_share_common(f, type_id, mesg)) < 0) + if((tri_ret = H5SM__can_share_common(f, type_id, mesg)) < 0) HGOTO_ERROR(H5E_SOHM, H5E_BADTYPE, FAIL, "'trivial' sharing checks returned error") if(tri_ret == FALSE) HGOTO_DONE(FALSE) @@ -956,7 +999,7 @@ H5SM_can_share(H5F_t *f, H5SM_master_table_t *table, /* Find the right index for this message type. If there is no such index * then this type of message isn't shareable */ - if((index_num = H5SM_get_index(my_table, type_id)) < 0) { + if((index_num = H5SM__get_index(my_table, type_id)) < 0) { H5E_clear_stack(NULL); /*ignore error*/ HGOTO_DONE(FALSE) } /* end if */ @@ -1072,7 +1115,7 @@ H5SM_try_share(H5F_t *f, H5O_t *open_oh, unsigned defer_flags, /* "trivial" sharing checks */ if(mesg_flags && (*mesg_flags & H5O_MSG_FLAG_DONTSHARE)) HGOTO_DONE(FALSE) - if((tri_ret = H5SM_can_share_common(f, type_id, mesg)) < 0) + if((tri_ret = H5SM__can_share_common(f, type_id, mesg)) < 0) HGOTO_ERROR(H5E_SOHM, H5E_BADTYPE, FAIL, "'trivial' sharing checks returned error") if(tri_ret == FALSE) HGOTO_DONE(FALSE) @@ -1246,7 +1289,7 @@ H5SM__write_mesg(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, size_t empty_pos = UFAIL; /* Empty entry in list */ herr_t ret_value = SUCCEED; - FUNC_ENTER_STATIC_TAG(H5AC__SOHM_TAG) + FUNC_ENTER_STATIC /* Sanity check */ HDassert(header); @@ -1509,7 +1552,7 @@ done: if(encoding_buf) encoding_buf = H5MM_xfree(encoding_buf); - FUNC_LEAVE_NOAPI_TAG(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5SM__write_mesg() */ @@ -1561,7 +1604,7 @@ H5SM_delete(H5F_t *f, H5O_t *open_oh, H5O_shared_t *sh_mesg) 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) + if((index_num = H5SM__get_index(table, type_id)) < 0) HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "unable to find correct SOHM index") /* If mesg_buf is not NULL, the message's reference count has reached @@ -1675,34 +1718,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5SM_get_hash_fh_cb - * - * Purpose: Callback for fractal heap operator, to make copy of link when - * when lookup up a link by index - * - * Return: SUCCEED/FAIL - * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Nov 7 2006 - * - *------------------------------------------------------------------------- - */ -herr_t -H5SM_get_hash_fh_cb(const void *obj, size_t obj_len, void *_udata) -{ - H5SM_fh_ud_gh_t *udata = (H5SM_fh_ud_gh_t *)_udata; /* User data for fractal heap 'op' callback */ - - FUNC_ENTER_NOAPI_NOINIT_NOERR - - /* Compute hash value on raw message */ - udata->hash = H5_checksum_lookup3(obj, obj_len, udata->type_id); - - FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5SM_get_hash_fh_cb() */ - - -/*------------------------------------------------------------------------- * Function: H5SM__decr_ref * * Purpose: Decrement the reference count for a SOHM message. Doesn't @@ -1781,7 +1796,7 @@ H5SM__delete_from_index(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, unsigned type_id; /* Message type to operate on */ herr_t ret_value = SUCCEED; - FUNC_ENTER_STATIC_TAG(H5AC__SOHM_TAG) + FUNC_ENTER_STATIC /* Sanity check */ HDassert(f); @@ -1946,7 +1961,7 @@ done: *mesg_size = 0; } - FUNC_LEAVE_NOAPI_TAG(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5SM__delete_from_index() */ @@ -2108,7 +2123,7 @@ H5SM_reconstitute(H5O_shared_t *sh_mesg, H5F_t *f, unsigned msg_type_id, /*------------------------------------------------------------------------- - * Function: H5SM_get_refcount_bt2_cb + * Function: H5SM__get_refcount_bt2_cb * * Purpose: v2 B-tree 'find' callback to retrieve the record for a message * @@ -2120,12 +2135,12 @@ H5SM_reconstitute(H5O_shared_t *sh_mesg, H5F_t *f, unsigned msg_type_id, *------------------------------------------------------------------------- */ static herr_t -H5SM_get_refcount_bt2_cb(const void *_record, void *_op_data) +H5SM__get_refcount_bt2_cb(const void *_record, void *_op_data) { const H5SM_sohm_t *record = (const H5SM_sohm_t *)_record; /* v2 B-tree record for message */ H5SM_sohm_t *op_data = (H5SM_sohm_t *)_op_data; /* "op data" from v2 B-tree find */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* * Check arguments. @@ -2137,7 +2152,7 @@ H5SM_get_refcount_bt2_cb(const void *_record, void *_op_data) *op_data = *record; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5SM_get_refcount_bt2_cb() */ +} /* end H5SM__get_refcount_bt2_cb() */ /*------------------------------------------------------------------------- @@ -2184,7 +2199,7 @@ H5SM_get_refcount(H5F_t *f, unsigned type_id, const H5O_shared_t *sh_mesg, 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) + if((index_num = H5SM__get_index(table, type_id)) < 0) HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "unable to find correct SOHM index") header = &(table->indexes[index_num]); @@ -2241,7 +2256,7 @@ H5SM_get_refcount(H5F_t *f, unsigned type_id, const H5O_shared_t *sh_mesg, 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(bt2, &key, H5SM_get_refcount_bt2_cb, &message)) < 0) + if((msg_exists = H5B2_find(bt2, &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") @@ -2387,7 +2402,7 @@ H5SM__read_mesg(H5F_t *f, const H5SM_sohm_t *mesg, H5HF_t *fheap, H5O_t *oh = NULL; /* Object header for message in object header */ herr_t ret_value = SUCCEED; - FUNC_ENTER_STATIC_TAG(H5AC__SOHM_TAG) + FUNC_ENTER_STATIC HDassert(f); HDassert(mesg); @@ -2461,12 +2476,12 @@ done: if(ret_value < 0 && udata.encoding_buf) udata.encoding_buf = H5MM_xfree(udata.encoding_buf); - FUNC_LEAVE_NOAPI_TAG(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5SM__read_mesg */ /*------------------------------------------------------------------------- - * Function: H5SM_table_free + * Function: H5SM__table_free * * Purpose: Frees memory used by the SOHM table. * @@ -2478,9 +2493,9 @@ done: *------------------------------------------------------------------------- */ herr_t -H5SM_table_free(H5SM_master_table_t *table) +H5SM__table_free(H5SM_master_table_t *table) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ HDassert(table); @@ -2491,11 +2506,11 @@ H5SM_table_free(H5SM_master_table_t *table) table = H5FL_FREE(H5SM_master_table_t, table); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5SM_table_free() */ +} /* end H5SM__table_free() */ /*------------------------------------------------------------------------- - * Function: H5SM_list_free + * Function: H5SM__list_free * * Purpose: Frees all memory used by the list. * @@ -2507,9 +2522,9 @@ H5SM_table_free(H5SM_master_table_t *table) *------------------------------------------------------------------------- */ herr_t -H5SM_list_free(H5SM_list_t *list) +H5SM__list_free(H5SM_list_t *list) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR HDassert(list); HDassert(list->messages); @@ -2519,7 +2534,7 @@ H5SM_list_free(H5SM_list_t *list) list = H5FL_FREE(H5SM_list_t, list); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5SM_list_free() */ +} /* end H5SM__list_free() */ /*------------------------------------------------------------------------- diff --git a/src/H5SMbtree2.c b/src/H5SMbtree2.c index 7f6c804..644f3dc 100644 --- a/src/H5SMbtree2.c +++ b/src/H5SMbtree2.c @@ -212,45 +212,3 @@ H5SM__bt2_debug(FILE *stream, int indent, int fwidth, FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5SM__bt2_debug */ - -/*------------------------------------------------------------------------- - * Function: H5SM_bt2_convert_to_list_op - * - * Purpose: An H5B2_remove_t callback function to convert a SOHM - * B-tree index to a list. - * - * Inserts this record into the list passed through op_data. - * - * Return: Non-negative on success - * Negative on failure - * - * Programmer: James Laird - * Monday, November 6, 2006 - * - *------------------------------------------------------------------------- - */ -herr_t -H5SM_bt2_convert_to_list_op(const void * record, void *op_data) -{ - const H5SM_sohm_t *message = (const H5SM_sohm_t *)record; - const H5SM_list_t *list = (const H5SM_list_t *)op_data; - size_t mesg_idx; /* Index of message to modify */ - - FUNC_ENTER_NOAPI_NOINIT_NOERR - - /* Sanity checks */ - HDassert(record); - HDassert(op_data); - - /* Get the message index, and increment the # of messages in list */ - mesg_idx = list->header->num_messages++; - HDassert(list->header->num_messages <= list->header->list_max); - - /* Insert this message at the end of the list */ - HDassert(list->messages[mesg_idx].location == H5SM_NO_LOC); - HDassert(message->location != H5SM_NO_LOC); - H5MM_memcpy(&(list->messages[mesg_idx]), message, sizeof(H5SM_sohm_t)); - - FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5SM_bt2_convert_to_list_op() */ - diff --git a/src/H5SMcache.c b/src/H5SMcache.c index 7f243a6..e7cd29e 100644 --- a/src/H5SMcache.c +++ b/src/H5SMcache.c @@ -15,7 +15,7 @@ * * Created: H5SMcache.c * Nov 13 2006 - * James Laird + * James Laird * * Purpose: Implement shared message metadata cache methods. * @@ -308,7 +308,7 @@ H5SM__cache_table_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED l done: if(!ret_value && table) - if(H5SM_table_free(table) < 0) + if(H5SM__table_free(table) < 0) HDONE_ERROR(H5E_SOHM, H5E_CANTFREE, NULL, "unable to destroy sohm table") FUNC_LEAVE_NOAPI(ret_value) @@ -467,7 +467,7 @@ H5SM__cache_table_free_icr(void *_thing) HDassert(table->cache_info.type == H5AC_SOHM_TABLE); /* Destroy Shared Object Header Message table */ - if(H5SM_table_free(table) < 0) + if(H5SM__table_free(table) < 0) HGOTO_ERROR(H5E_SOHM, H5E_CANTRELEASE, FAIL, "unable to free shared message table") done: @@ -778,7 +778,7 @@ H5SM__cache_list_free_icr(void *_thing) HDassert(list->cache_info.type == H5AC_SOHM_LIST); /* Destroy Shared Object Header Message list */ - if(H5SM_list_free(list) < 0) + if(H5SM__list_free(list) < 0) HGOTO_ERROR(H5E_SOHM, H5E_CANTRELEASE, FAIL, "unable to free shared message list") done: diff --git a/src/H5SMmessage.c b/src/H5SMmessage.c index e085204..1787fbe 100644 --- a/src/H5SMmessage.c +++ b/src/H5SMmessage.c @@ -38,7 +38,7 @@ /* Local Typedefs */ /******************/ -/* Udata struct for calls to H5SM_compare_cb and H5SM_compare_iter_op*/ +/* Udata struct for calls to H5SM__compare_cb and H5SM__compare_iter_op*/ typedef struct H5SM_compare_udata_t { const H5SM_mesg_key_t *key; /* Key; compare this against stored message */ H5O_msg_crt_idx_t idx; /* Index of the message in the OH, if applicable */ @@ -49,8 +49,8 @@ typedef struct H5SM_compare_udata_t { /********************/ /* Local Prototypes */ /********************/ -static herr_t H5SM_compare_cb(const void *obj, size_t obj_len, void *udata); -static herr_t H5SM_compare_iter_op(H5O_t *oh, H5O_mesg_t *mesg, unsigned sequence, +static herr_t H5SM__compare_cb(const void *obj, size_t obj_len, void *udata); +static herr_t H5SM__compare_iter_op(H5O_t *oh, H5O_mesg_t *mesg, unsigned sequence, unsigned *oh_modified, void *udata); @@ -71,7 +71,7 @@ static herr_t H5SM_compare_iter_op(H5O_t *oh, H5O_mesg_t *mesg, unsigned sequenc /*------------------------------------------------------------------------- - * Function: H5SM_compare_cb + * Function: H5SM__compare_cb * * Purpose: Callback for H5HF_op, used in H5SM__message_compare below. * Determines whether the search key passed in in _UDATA is @@ -87,11 +87,11 @@ static herr_t H5SM_compare_iter_op(H5O_t *oh, H5O_mesg_t *mesg, unsigned sequenc *------------------------------------------------------------------------- */ static herr_t -H5SM_compare_cb(const void *obj, size_t obj_len, void *_udata) +H5SM__compare_cb(const void *obj, size_t obj_len, void *_udata) { H5SM_compare_udata_t *udata = (H5SM_compare_udata_t *)_udata; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* If the encoding sizes are different, it's not the same object */ if(udata->key->encoding_size > obj_len) @@ -103,11 +103,11 @@ H5SM_compare_cb(const void *obj, size_t obj_len, void *_udata) udata->ret = HDmemcmp(udata->key->encoding, obj, obj_len); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5SM_compare_cb() */ +} /* end H5SM__compare_cb() */ /*------------------------------------------------------------------------- - * Function: H5SM_compare_iter_op + * Function: H5SM__compare_iter_op * * Purpose: OH iteration callback to compare a key against a message in * an OH @@ -123,13 +123,13 @@ H5SM_compare_cb(const void *obj, size_t obj_len, void *_udata) *------------------------------------------------------------------------- */ static herr_t -H5SM_compare_iter_op(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned sequence, +H5SM__compare_iter_op(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned sequence, unsigned H5_ATTR_UNUSED *oh_modified, void *_udata/*in,out*/) { H5SM_compare_udata_t *udata = (H5SM_compare_udata_t *) _udata; herr_t ret_value = H5_ITER_CONT; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* * Check arguments. @@ -165,7 +165,7 @@ H5SM_compare_iter_op(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned sequence, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5SM_compare_iter_op() */ +} /* end H5SM__compare_iter_op() */ /*------------------------------------------------------------------------- @@ -237,7 +237,7 @@ H5SM__message_compare(const void *rec1, const void *rec2, int *result) */ if(mesg->location == H5SM_IN_HEAP) { /* Call heap op routine with comparison callback */ - if(H5HF_op(key->fheap, &(mesg->u.heap_loc.fheap_id), H5SM_compare_cb, &udata) < 0) + if(H5HF_op(key->fheap, &(mesg->u.heap_loc.fheap_id), H5SM__compare_cb, &udata) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records") } /* end if */ else { @@ -261,7 +261,7 @@ H5SM__message_compare(const void *rec1, const void *rec2, int *result) /* Locate the right message and compare with it */ op.op_type = H5O_MESG_OP_LIB; - op.u.lib_op = H5SM_compare_iter_op; + op.u.lib_op = H5SM__compare_iter_op; if(H5O_msg_iterate(&oloc, mesg->msg_type_id, &op, &udata) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "error iterating over links") } /* end else */ diff --git a/src/H5SMmodule.h b/src/H5SMmodule.h index 656c7dd..ccd7b9f 100644 --- a/src/H5SMmodule.h +++ b/src/H5SMmodule.h @@ -11,7 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, September 12, 2015 * * Purpose: This file contains declarations which define macros for the diff --git a/src/H5SMpkg.h b/src/H5SMpkg.h index bb458a7..59be8b7 100644 --- a/src/H5SMpkg.h +++ b/src/H5SMpkg.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: James Laird + * Programmer: James Laird * Thursday, March 30, 2006 * * Purpose: This file contains declarations which are visible only within @@ -259,22 +259,16 @@ H5_DLLVAR const H5B2_class_t H5SM_INDEX[1]; /****************************/ /* General routines */ -H5_DLL ssize_t H5SM_get_index(const H5SM_master_table_t *table, unsigned type_id); +H5_DLL ssize_t H5SM__get_index(const H5SM_master_table_t *table, unsigned type_id); /* Encode and decode routines, used for B-tree and cache encoding/decoding */ H5_DLL herr_t H5SM__message_compare(const void *rec1, const void *rec2, int *result); H5_DLL herr_t H5SM__message_encode(uint8_t *raw, const void *native, void *ctx); H5_DLL herr_t H5SM__message_decode(const uint8_t *raw, void *native, void *ctx); -/* H5B2_remove_t callback to add messages to a list index */ -H5_DLL herr_t H5SM_bt2_convert_to_list_op(const void * record, void *op_data); - -/* Fractal heap 'op' callback to compute hash value for message "in place" */ -H5_DLL herr_t H5SM_get_hash_fh_cb(const void *obj, size_t obj_len, void *_udata); - /* Routines to release data structures */ -herr_t H5SM_table_free(H5SM_master_table_t *table); -herr_t H5SM_list_free(H5SM_list_t *list); +H5_DLL herr_t H5SM__table_free(H5SM_master_table_t *table); +H5_DLL herr_t H5SM__list_free(H5SM_list_t *list); /* Testing functions */ #ifdef H5SM_TESTING diff --git a/src/H5SMprivate.h b/src/H5SMprivate.h index e6776f3..80d3692 100644 --- a/src/H5SMprivate.h +++ b/src/H5SMprivate.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: James Laird + * Programmer: James Laird * Thursday, March 2, 2006 * * Purpose: This file contains private declarations for the H5SM diff --git a/src/H5SMtest.c b/src/H5SMtest.c index 0a6149d..a4a43e6 100644 --- a/src/H5SMtest.c +++ b/src/H5SMtest.c @@ -99,7 +99,7 @@ H5SM__get_mesg_count_test(H5F_t *f, unsigned type_id, size_t *mesg_count) 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) + if((index_num = H5SM__get_index(table, type_id)) < 0) HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "unable to find correct SOHM index") header = &(table->indexes[index_num]); diff --git a/src/H5ST.c b/src/H5ST.c index 3a1020b..2570f72 100644 --- a/src/H5ST.c +++ b/src/H5ST.c @@ -70,7 +70,7 @@ done: /*-------------------------------------------------------------------------- NAME - H5ST_close_internal + H5ST__close_internal PURPOSE Close a TST, deallocating it. USAGE @@ -87,21 +87,21 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5ST_close_internal(H5ST_ptr_t p) +H5ST__close_internal(H5ST_ptr_t p) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Recursively free TST */ if(p) { - H5ST_close_internal(p->lokid); + H5ST__close_internal(p->lokid); if(p->splitchar) - H5ST_close_internal(p->eqkid); - H5ST_close_internal(p->hikid); + H5ST__close_internal(p->eqkid); + H5ST__close_internal(p->hikid); p = H5FL_FREE(H5ST_node_t, p); } /* end if */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5ST_close_internal() */ +} /* end H5ST__close_internal() */ /*-------------------------------------------------------------------------- @@ -134,7 +134,7 @@ H5ST_close(H5ST_tree_t *tree) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid TST") /* Free the TST itself */ - if(H5ST_close_internal(tree->root) < 0) + if(H5ST__close_internal(tree->root) < 0) HGOTO_ERROR(H5E_TST, H5E_CANTFREE, FAIL, "can't free TST") /* Free root node itself */ @@ -270,7 +270,7 @@ done: /*-------------------------------------------------------------------------- NAME - H5ST_find_internal + H5ST__find_internal PURPOSE Find the node matching a particular key string USAGE @@ -289,11 +289,11 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static H5ST_ptr_t -H5ST_find_internal(H5ST_ptr_t p, const char *s) +H5ST__find_internal(H5ST_ptr_t p, const char *s) { H5ST_ptr_t ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR while (p) { if (*s < p->splitchar) @@ -308,7 +308,7 @@ H5ST_find_internal(H5ST_ptr_t p, const char *s) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5ST_find_internal() */ +} /* end H5ST__find_internal() */ /*-------------------------------------------------------------------------- @@ -338,7 +338,7 @@ H5ST_find(H5ST_tree_t *tree, const char *s) FUNC_ENTER_NOAPI(NULL) - if(NULL == (ret_value = H5ST_find_internal(tree->root, s))) + if(NULL == (ret_value = H5ST__find_internal(tree->root, s))) HGOTO_ERROR(H5E_TST, H5E_NOTFOUND, NULL, "key not found in TST") done: @@ -374,7 +374,7 @@ H5ST_locate(H5ST_tree_t *tree, const char *s) FUNC_ENTER_NOAPI(NULL) /* Locate the node to remove */ - if(NULL == (node = H5ST_find_internal(tree->root, s))) + if(NULL == (node = H5ST__find_internal(tree->root, s))) HGOTO_ERROR(H5E_TST, H5E_NOTFOUND, NULL, "key not found in TST") /* Get the pointer to the object to return */ @@ -387,11 +387,11 @@ done: /*-------------------------------------------------------------------------- NAME - H5ST_findfirst_internal + H5ST__findfirst_internal PURPOSE Find the first node in a TST USAGE - H5ST_ptr_t H5ST_findfirst_internal(p) + H5ST_ptr_t H5ST__findfirst_internal(p) H5ST_ptr_t p; IN: TST to locate first node within RETURNS Success: Non-NULL @@ -404,11 +404,11 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static H5ST_ptr_t -H5ST_findfirst_internal(H5ST_ptr_t p) +H5ST__findfirst_internal(H5ST_ptr_t p) { H5ST_ptr_t ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR while(p) { /* Find least node in current tree */ @@ -428,7 +428,7 @@ H5ST_findfirst_internal(H5ST_ptr_t p) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5ST_findfirst_internal() */ +} /* end H5ST__findfirst_internal() */ /*-------------------------------------------------------------------------- @@ -456,7 +456,7 @@ H5ST_findfirst(H5ST_tree_t *tree) FUNC_ENTER_NOAPI(NULL) - if(NULL == (ret_value = H5ST_findfirst_internal(tree->root))) + if(NULL == (ret_value = H5ST__findfirst_internal(tree->root))) HGOTO_ERROR(H5E_TST,H5E_NOTFOUND,NULL,"no nodes in TST"); done: @@ -466,11 +466,11 @@ done: /*-------------------------------------------------------------------------- NAME - H5ST_getnext + H5ST__getnext PURPOSE Internal routine to find the next node in a given level of a TST USAGE - H5ST_ptr_t H5ST_getnext(p) + H5ST_ptr_t H5ST__getnext(p) H5ST_ptr_t *p; IN: Pointer to node to find next node from RETURNS Success: Non-NULL @@ -483,11 +483,11 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static H5ST_ptr_t -H5ST_getnext(H5ST_ptr_t p) +H5ST__getnext(H5ST_ptr_t p) { H5ST_ptr_t ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* If the node to continue from has higher-valued nodes attached */ if(p->hikid) { @@ -519,7 +519,7 @@ H5ST_getnext(H5ST_ptr_t p) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5ST_getnext() */ +} /* end H5ST__getnext() */ /*-------------------------------------------------------------------------- @@ -550,9 +550,9 @@ H5ST_findnext(H5ST_ptr_t p) /* Find the next node at the current level, or go back up the tree */ do { - q = H5ST_getnext(p); + q = H5ST__getnext(p); if(q) { - HGOTO_DONE(H5ST_findfirst_internal(q->eqkid)); + HGOTO_DONE(H5ST__findfirst_internal(q->eqkid)); } /* end if */ else p = p->up; @@ -565,11 +565,11 @@ done: /*-------------------------------------------------------------------------- NAME - H5ST_delete_internal + H5ST__delete_internal PURPOSE Delete a node from a TST USAGE - herr_t H5ST_delete_internal(root,p) + herr_t H5ST__delete_internal(root,p) H5ST_ptr_t *root; IN/OUT: Root of TST to delete node from H5ST_ptr_t p; IN: Node to delete RETURNS @@ -584,12 +584,12 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5ST_delete_internal(H5ST_ptr_t *root, H5ST_ptr_t p) +H5ST__delete_internal(H5ST_ptr_t *root, H5ST_ptr_t p) { H5ST_ptr_t q, /* Temporary pointer to TST node */ newp; /* Pointer to node which will replace deleted node in tree */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Find node to replace one being deleted */ if(p->lokid) { @@ -628,7 +628,7 @@ H5ST_delete_internal(H5ST_ptr_t *root, H5ST_ptr_t p) /* If we deleted the last node in the TST, delete the upper node also */ if(NULL == newp) - H5ST_delete_internal(root, p->up); + H5ST__delete_internal(root, p->up); } /* end if */ else /* Deleted last node at top level of tree */ *root = newp; @@ -637,7 +637,7 @@ H5ST_delete_internal(H5ST_ptr_t *root, H5ST_ptr_t p) p = H5FL_FREE(H5ST_node_t, p); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5ST_delete_internal() */ +} /* end H5ST__delete_internal() */ /*-------------------------------------------------------------------------- @@ -667,7 +667,7 @@ H5ST_delete(H5ST_tree_t *tree, H5ST_ptr_t p) FUNC_ENTER_NOAPI(FAIL) - if(H5ST_delete_internal(&tree->root, p) < 0) + if(H5ST__delete_internal(&tree->root, p) < 0) HGOTO_ERROR(H5E_TST, H5E_CANTDELETE, FAIL, "can't delete node from TST") done: @@ -703,14 +703,14 @@ H5ST_remove(H5ST_tree_t *tree, const char *s) FUNC_ENTER_NOAPI(NULL) /* Locate the node to remove */ - if(NULL == (node = H5ST_find_internal(tree->root, s))) + if(NULL == (node = H5ST__find_internal(tree->root, s))) HGOTO_ERROR(H5E_TST, H5E_NOTFOUND, NULL, "key not found in TST") /* Get the pointer to the object to return */ ret_value = node->eqkid; /* Remove the node from the TST */ - if(H5ST_delete_internal(&tree->root, node) < 0) + if(H5ST__delete_internal(&tree->root, node) < 0) HGOTO_ERROR(H5E_TST, H5E_CANTDELETE, NULL, "can't delete node from TST") done: diff --git a/src/H5Sall.c b/src/H5Sall.c index 8290ae2..f342279 100644 --- a/src/H5Sall.c +++ b/src/H5Sall.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, June 16, 1998 * * Purpose: "All" selection dataspace I/O functions. @@ -29,7 +29,7 @@ /* Headers */ /***********/ #include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ +#include "H5Eprivate.h" /* Error handling */ #include "H5Iprivate.h" /* ID Functions */ #include "H5Spkg.h" /* Dataspace functions */ #include "H5VMprivate.h" /* Vector functions */ @@ -599,7 +599,7 @@ H5S__all_serial_size(const H5S_t H5_ATTR_UNUSED *space) PURPOSE Serialize the current selection into a user-provided buffer. USAGE - herr_t H5S_all_serialize(space, p) + herr_t H5S__all_serialize(space, p) const H5S_t *space; IN: Dataspace with selection to serialize uint8_t **p; OUT: Pointer to buffer to put serialized selection. Will be advanced to end of @@ -627,8 +627,8 @@ H5S__all_serialize(const H5S_t *space, uint8_t **p) HDassert(pp); /* Store the preamble information */ - UINT32ENCODE(pp, (uint32_t)H5S_GET_SELECT_TYPE(space)); /* Store the type of selection */ - UINT32ENCODE(pp, (uint32_t)H5S_ALL_VERSION_1); /* Store the version number */ + UINT32ENCODE(pp, (uint32_t)H5S_GET_SELECT_TYPE(space)); /* Store the type of selection */ + UINT32ENCODE(pp, (uint32_t)H5S_ALL_VERSION_1); /* Store the version number */ UINT32ENCODE(pp, (uint32_t)0); /* Store the un-used padding */ UINT32ENCODE(pp, (uint32_t)0); /* Store the additional information length */ diff --git a/src/H5Sdbg.c b/src/H5Sdbg.c index 8171191..a870c92 100644 --- a/src/H5Sdbg.c +++ b/src/H5Sdbg.c @@ -13,11 +13,11 @@ /*------------------------------------------------------------------------- * - * Created: H5Sdbg.c - * Jul 24 2007 - * Quincey Koziol + * Created: H5Sdbg.c + * Quincey Koziol + * Jul 24 2007 * - * Purpose: Dump debugging information about a dataspace + * Purpose: Dump debugging information about a dataspace * *------------------------------------------------------------------------- */ @@ -32,9 +32,9 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Spkg.h" /* Dataspaces */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Spkg.h" /* Dataspaces */ /****************/ @@ -74,13 +74,13 @@ /*------------------------------------------------------------------------- - * Function: H5S_debug + * Function: H5S_debug * - * Purpose: Prints debugging information about a dataspace. + * Purpose: Prints debugging information about a dataspace. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, July 21, 1998 * *------------------------------------------------------------------------- @@ -88,7 +88,7 @@ herr_t H5S_debug(H5F_t *f, const void *_mesg, FILE *stream, int indent, int fwidth) { - const H5S_t *mesg = (const H5S_t*)_mesg; + const H5S_t *mesg = (const H5S_t*)_mesg; FUNC_ENTER_NOAPI_NOINIT_NOERR diff --git a/src/H5Sdeprec.c b/src/H5Sdeprec.c index e4ec1b0..e37694c 100644 --- a/src/H5Sdeprec.c +++ b/src/H5Sdeprec.c @@ -87,7 +87,6 @@ * Failure: negative * * Programmer: Raymond Lu - * slu@ncsa.uiuc.edu * July 14, 2004 * *------------------------------------------------------------------------- diff --git a/src/H5Shyper.c b/src/H5Shyper.c index b352374..95bce29 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -12,10 +12,10 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, June 18, 1998 * - * Purpose: Hyperslab selection dataspace I/O functions. + * Purpose: Hyperslab selection dataspace I/O functions. */ /****************/ @@ -30,8 +30,8 @@ /***********/ #include "H5private.h" /* Generic Functions */ #include "H5CXprivate.h" /* API Contexts */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FLprivate.h" /* Free Lists */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FLprivate.h" /* Free Lists */ #include "H5Iprivate.h" /* ID Functions */ #include "H5MMprivate.h" /* Memory management */ #include "H5Spkg.h" /* Dataspace functions */ @@ -304,7 +304,7 @@ H5FL_EXTERN(H5S_sel_iter_t); static uint64_t H5S_hyper_op_gen_g = 1; -/* Uncomment this, to provide the debugging routines for printing selection info */ +/* Uncomment this to provide the debugging routines for printing selection info */ /* #define H5S_HYPER_DEBUG */ #ifdef H5S_HYPER_DEBUG static herr_t @@ -385,7 +385,7 @@ H5S__hyper_print_diminfo(FILE *f, const H5S_t *space) FUNC_LEAVE_NOAPI(SUCCEED) } - + /*-------------------------------------------------------------------------- NAME H5S__hyper_print_spans_dfs @@ -531,7 +531,7 @@ H5S__hyper_print_space_dfs(FILE *f, const H5S_t *space) } /* end H5S__hyper_print_space_dfs() */ #endif /* H5S_HYPER_DEBUG */ - + /*------------------------------------------------------------------------- * Function: H5S__hyper_get_op_gen * @@ -555,15 +555,15 @@ H5S__hyper_get_op_gen(void) FUNC_LEAVE_NOAPI(H5S_hyper_op_gen_g++); } /* end H5S__hyper_op_gen() */ - + /*------------------------------------------------------------------------- * Function: H5S__hyper_iter_init * - * Purpose: Initializes iteration information for hyperslab selection. + * Purpose: Initializes iteration information for hyperslab selection. * - * Return: Non-negative on success, negative on failure. + * Return: Non-negative on success, negative on failure. * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, February 24, 2001 * * Notes: If the 'iter->elmt_size' field is set to zero, the regular @@ -794,16 +794,16 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_iter_init() */ - + /*------------------------------------------------------------------------- * Function: H5S__hyper_iter_coords * - * Purpose: Retrieve the current coordinates of iterator for current + * Purpose: Retrieve the current coordinates of iterator for current * selection * - * Return: Non-negative on success, negative on failure + * Return: Non-negative on success, negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, April 22, 2003 * *------------------------------------------------------------------------- @@ -879,16 +879,16 @@ H5S__hyper_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5S__hyper_iter_coords() */ - + /*------------------------------------------------------------------------- * Function: H5S__hyper_iter_block * - * Purpose: Retrieve the current block of iterator for current + * Purpose: Retrieve the current block of iterator for current * selection * - * Return: Non-negative on success, negative on failure + * Return: Non-negative on success, negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, June 2, 2003 * * Notes: This routine assumes that the iterator is always located at @@ -916,28 +916,28 @@ H5S__hyper_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end) for(u = 0; u < iter->rank; u++) { start[u] = iter->u.hyp.off[u]; end[u] = (start[u] + iter->u.hyp.diminfo[u].block) - 1; - } /* end for */ + } } /* end if */ else { /* Copy the start & end of the block */ for(u = 0; u < iter->rank; u++) { start[u] = iter->u.hyp.span[u]->low; end[u] = iter->u.hyp.span[u]->high; - } /* end for */ + } } /* end else */ FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5S__hyper_iter_block() */ - + /*------------------------------------------------------------------------- * Function: H5S__hyper_iter_nelmts * - * Purpose: Return number of elements left to process in iterator + * Purpose: Return number of elements left to process in iterator * - * Return: Non-negative number of elements on success, zero on failure + * Return: Non-negative number of elements on success, zero on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, June 16, 1998 * *------------------------------------------------------------------------- @@ -953,7 +953,7 @@ H5S__hyper_iter_nelmts(const H5S_sel_iter_t *iter) FUNC_LEAVE_NOAPI(iter->elmt_left) } /* end H5S__hyper_iter_nelmts() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_iter_has_next_block @@ -1009,17 +1009,17 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_iter_has_next_block() */ - + /*------------------------------------------------------------------------- * Function: H5S__hyper_iter_next * - * Purpose: Moves a hyperslab iterator to the beginning of the next sequence - * of elements to read. Handles walking off the end in all dimensions. + * Purpose: Moves a hyperslab iterator to the beginning of the next sequence + * of elements to read. Handles walking off the end in all dimensions. * - * Return: Success: non-negative - * Failure: negative + * Return: Success: non-negative + * Failure: negative * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Friday, September 8, 2000 * *------------------------------------------------------------------------- @@ -1216,17 +1216,17 @@ H5S__hyper_iter_next(H5S_sel_iter_t *iter, size_t nelem) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5S__hyper_iter_next() */ - + /*------------------------------------------------------------------------- * Function: H5S__hyper_iter_next_block * - * Purpose: Moves a hyperslab iterator to the beginning of the next sequence - * of elements to read. Handles walking off the end in all dimensions. + * Purpose: Moves a hyperslab iterator to the beginning of the next sequence + * of elements to read. Handles walking off the end in all dimensions. * - * Return: Success: non-negative - * Failure: negative + * Return: Success: non-negative + * Failure: negative * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, June 3, 2003 * *------------------------------------------------------------------------- @@ -1391,7 +1391,7 @@ H5S__hyper_iter_next_block(H5S_sel_iter_t *iter) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5S__hyper_iter_next_block() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_iter_get_seq_list_gen @@ -1409,7 +1409,7 @@ H5S__hyper_iter_next_block(H5S_sel_iter_t *iter) hsize_t *off; OUT: Array of offsets size_t *len; OUT: Array of lengths RETURNS - Non-negative on success/Negative on failure. + Non-negative on success/Negative on failure DESCRIPTION Use the selection in the dataspace to generate a list of byte offsets and lengths for the region(s) selected. Start/Restart from the position in the @@ -1756,7 +1756,7 @@ H5S__hyper_iter_get_seq_list_gen(H5S_sel_iter_t *iter, size_t maxseq, size_t max /* Work back up through the dimensions */ while(curr_dim >= 0) { /* Reset the current span */ - curr_span = ispan[curr_dim]; + curr_span = ispan[curr_dim]; /* Increment absolute position */ abs_arr[curr_dim]++; @@ -1843,7 +1843,7 @@ H5S__hyper_iter_get_seq_list_gen(H5S_sel_iter_t *iter, size_t maxseq, size_t max FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5S__hyper_iter_get_seq_list_gen() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_iter_get_seq_list_opt @@ -2110,15 +2110,15 @@ H5S__hyper_iter_get_seq_list_opt(H5S_sel_iter_t *iter, size_t maxseq, size_t max /* Read in data until an entire sequence can't be written out any longer */ while(curr_rows > 0) { -#define DUFF_GUTS \ -/* Store the sequence information */ \ -off[curr_seq] = loc; \ -len[curr_seq] = actual_bytes; \ - \ -/* Increment sequence count */ \ -curr_seq++; \ - \ -/* Increment information to reflect block just processed */ \ +#define DUFF_GUTS \ +/* Store the sequence information */ \ +off[curr_seq] = loc; \ +len[curr_seq] = actual_bytes; \ + \ +/* Increment sequence count */ \ +curr_seq++; \ + \ +/* Increment information to reflect block just processed */ \ loc += fast_dim_buf_off; #ifdef NO_DUFFS_DEVICE @@ -2287,7 +2287,7 @@ loc += fast_dim_buf_off; FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5S__hyper_iter_get_seq_list_opt() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_iter_get_seq_list_single @@ -2565,7 +2565,7 @@ H5S__hyper_iter_get_seq_list_single(H5S_sel_iter_t *iter, size_t maxseq, size_t FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5S__hyper_iter_get_seq_list_single() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_iter_get_seq_list @@ -2574,7 +2574,6 @@ H5S__hyper_iter_get_seq_list_single(H5S_sel_iter_t *iter, size_t maxseq, size_t USAGE herr_t H5S__hyper_iter_get_seq_list(iter,maxseq,maxelem,nseq,nelem,off,len) H5S_t *space; IN: Dataspace containing selection to use. - unsigned flags; IN: Flags for extra information about operation H5S_sel_iter_t *iter; IN/OUT: Selection iterator describing last position of interest in selection. size_t maxseq; IN: Maximum number of sequences to generate @@ -2727,7 +2726,7 @@ H5S__hyper_iter_get_seq_list(H5S_sel_iter_t *iter, size_t maxseq, FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_iter_get_seq_list() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_iter_release @@ -2760,7 +2759,7 @@ H5S__hyper_iter_release(H5S_sel_iter_t *iter) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5S__hyper_iter_release() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_new_span @@ -2808,7 +2807,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_new_span() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_new_span_info @@ -2851,7 +2850,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_new_span_info() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_copy_span_helper @@ -2947,7 +2946,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_copy_span_helper() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_copy_span @@ -2992,7 +2991,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_copy_span() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_cmp_spans @@ -3013,8 +3012,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static H5_ATTR_PURE hbool_t -H5S__hyper_cmp_spans(const H5S_hyper_span_info_t *span_info1, - const H5S_hyper_span_info_t *span_info2) +H5S__hyper_cmp_spans(const H5S_hyper_span_info_t *span_info1, const H5S_hyper_span_info_t *span_info2) { hbool_t ret_value = TRUE; /* Return value */ @@ -3088,7 +3086,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_cmp_spans() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_free_span_info @@ -3145,7 +3143,7 @@ H5S__hyper_free_span_info(H5S_hyper_span_info_t *span_info) FUNC_LEAVE_NOAPI_VOID } /* end H5S__hyper_free_span_info() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_free_span @@ -3183,7 +3181,7 @@ H5S__hyper_free_span(H5S_hyper_span_t *span) FUNC_LEAVE_NOAPI_VOID } /* end H5S__hyper_free_span() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_copy @@ -3258,7 +3256,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_copy() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_is_valid @@ -3317,7 +3315,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_is_valid() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_span_nblocks_helper @@ -3385,7 +3383,7 @@ H5S__hyper_span_nblocks_helper(H5S_hyper_span_info_t *spans, unsigned op_info_i, FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_span_nblocks_helper() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_span_nblocks @@ -3426,7 +3424,7 @@ H5S__hyper_span_nblocks(H5S_hyper_span_info_t *spans) FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_span_nblocks() */ - + /*-------------------------------------------------------------------------- NAME H5S__get_select_hyper_nblocks @@ -3463,7 +3461,7 @@ H5S__get_select_hyper_nblocks(const H5S_t *space, hbool_t app_ref) /* Check each dimension */ for(ret_value = 1, u = 0; u < space->extent.rank; u++) ret_value *= (app_ref ? space->select.sel_info.hslab->diminfo.app[u].count : - space->select.sel_info.hslab->diminfo.opt[u].count); + space->select.sel_info.hslab->diminfo.opt[u].count); } /* end if */ else ret_value = H5S__hyper_span_nblocks(space->select.sel_info.hslab->span_lst); @@ -3471,7 +3469,7 @@ H5S__get_select_hyper_nblocks(const H5S_t *space, hbool_t app_ref) FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__get_select_hyper_nblocks() */ - + /*-------------------------------------------------------------------------- NAME H5Sget_select_hyper_nblocks @@ -3512,7 +3510,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Sget_select_hyper_nblocks() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_get_enc_size_real @@ -3707,13 +3705,13 @@ H5S__hyper_get_version_enc_size(const H5S_t *space, hsize_t block_count, uint32_ default: HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "unknown hyperslab selection version") break; - } /* end switch */ + } done: FUNC_LEAVE_NOAPI(ret_value) } /* H5S__hyper_get_version_enc_size() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_serial_size @@ -3738,14 +3736,15 @@ H5S__hyper_serial_size(const H5S_t *space) { hsize_t block_count = 0; /* block counter for regular hyperslabs */ uint32_t version; /* Version number */ - uint8_t enc_size; /* Encoded size of hyerslab selection info */ + uint8_t enc_size; /* Encoded size of hyperslab selection info */ hssize_t ret_value = -1; /* return value */ FUNC_ENTER_STATIC HDassert(space); - if(space->select.sel_info.hslab->unlim_dim < 0) /* ! H5S_UNLIMITED */ + /* Determine the number of blocks */ + if(space->select.sel_info.hslab->unlim_dim < 0) /* ! H5S_UNLIMITED */ block_count = H5S__get_select_hyper_nblocks(space, FALSE); /* Determine the version and the encoded size */ @@ -3787,7 +3786,7 @@ H5S__hyper_serial_size(const H5S_t *space) */ HDassert(enc_size == 8); ret_value = (hssize_t)17 + ((hssize_t)4 * (hssize_t)8 * (hssize_t)space->extent.rank); - } /* end else-if */ + } else { HDassert(version == H5S_HYPER_VERSION_1); HDassert(enc_size == 4); @@ -3807,7 +3806,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_serial_size() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_serialize_helper @@ -3928,14 +3927,14 @@ H5S__hyper_serialize_helper(const H5S_hyper_span_info_t *spans, FUNC_LEAVE_NOAPI_VOID } /* end H5S__hyper_serialize_helper() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_serialize PURPOSE Serialize the current selection into a user-provided buffer. USAGE - herr_t H5S_hyper_serialize(space, p) + herr_t H5S__hyper_serialize(space, p) const H5S_t *space; IN: Dataspace with selection to serialize uint8_t **p; OUT: Pointer to buffer to put serialized selection. Will be advanced to end of @@ -3958,7 +3957,7 @@ H5S__hyper_serialize(const H5S_t *space, uint8_t **p) hsize_t offset[H5S_MAX_RANK]; /* Offset of element in dataspace */ hsize_t start[H5S_MAX_RANK]; /* Location of start of hyperslab */ hsize_t end[H5S_MAX_RANK]; /* Location of end of hyperslab */ - uint8_t *pp; /* Local pointer for decoding */ + uint8_t *pp; /* Local pointer for encoding */ uint8_t *lenp = NULL; /* pointer to length location for later storage */ uint32_t len = 0; /* number of bytes used */ uint32_t version; /* Version number */ @@ -3969,7 +3968,7 @@ H5S__hyper_serialize(const H5S_t *space, uint8_t **p) unsigned u; /* Local counting variable */ hbool_t complete = FALSE; /* Whether we are done with the iteration */ hbool_t is_regular; /* Whether selection is regular */ - uint8_t enc_size; + uint8_t enc_size; /* Encoded size */ herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_STATIC @@ -3984,7 +3983,8 @@ H5S__hyper_serialize(const H5S_t *space, uint8_t **p) ndims = space->extent.rank; diminfo = space->select.sel_info.hslab->diminfo.opt; - if(space->select.sel_info.hslab->unlim_dim < 0) /* ! H5S_UNLIMITED */ + /* Calculate the # of blocks */ + if(space->select.sel_info.hslab->unlim_dim < 0) /* ! H5S_UNLIMITED */ block_count = H5S__get_select_hyper_nblocks(space, FALSE); /* Determine the version and the encoded size */ @@ -4120,7 +4120,7 @@ H5S__hyper_serialize(const H5S_t *space, uint8_t **p) tmp_count[fast_dim]--; } /* end while */ - /* Work on other dimensions if necessary */ + /* Work on other dimensions if necessary */ if(fast_dim > 0) { int temp_dim; /* Temporary rank holder */ @@ -4141,7 +4141,7 @@ H5S__hyper_serialize(const H5S_t *space, uint8_t **p) if(temp_dim == 0) complete = TRUE; - /* Reset the block count in this dimension */ + /* Reset the block count in this dimension */ tmp_count[temp_dim] = diminfo[temp_dim].count; /* Wrapped a dimension, go up to next dimension */ @@ -4204,7 +4204,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_serialize() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_deserialize @@ -4284,7 +4284,7 @@ H5S__hyper_deserialize(H5S_t **space, const uint8_t **p) /* Check for unknown flags */ if(flags & ~H5S_SELECT_FLAG_BITS) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTLOAD, FAIL, "unknown flag for selection") - } /* end if */ + } else { /* Skip over the remainder of the header */ pp += 8; @@ -4300,7 +4300,7 @@ H5S__hyper_deserialize(H5S_t **space, const uint8_t **p) if(!*space) { /* Patch the rank of the allocated dataspace */ - (void)HDmemset(dims, 0, (size_t)rank * sizeof(dims[0])); + HDmemset(dims, 0, (size_t)rank * sizeof(dims[0])); if(H5S_set_extent_simple(tmp_space, rank, dims, NULL) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't set dimensions") } /* end if */ @@ -4315,7 +4315,7 @@ H5S__hyper_deserialize(H5S_t **space, const uint8_t **p) /* Sanity checks */ HDassert(H5S_UNLIMITED == HSIZE_UNDEF); - HDassert(version >= 2); + HDassert(version >= H5S_HYPER_VERSION_2); /* Decode start/stride/block/count */ switch(enc_size) { @@ -4383,7 +4383,7 @@ H5S__hyper_deserialize(H5S_t **space, const uint8_t **p) size_t num_elem; /* Number of elements in selection */ unsigned v; /* Local counting variable */ - /* decode the number of blocks */ + /* Decode the number of blocks */ switch(enc_size) { case H5S_SELECT_INFO_ENC_SIZE_2: UINT16DECODE(pp, num_elem); @@ -4461,7 +4461,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_deserialize() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_span_blocklist @@ -4566,7 +4566,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_span_blocklist() */ - + /*-------------------------------------------------------------------------- NAME H5S__get_select_hyper_blocklist @@ -4748,7 +4748,7 @@ H5S__get_select_hyper_blocklist(H5S_t *space, hsize_t startblock, FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__get_select_hyper_blocklist() */ - + /*-------------------------------------------------------------------------- NAME H5Sget_select_hyper_blocklist @@ -4761,7 +4761,7 @@ H5S__get_select_hyper_blocklist(H5S_t *space, hsize_t startblock, hsize_t numblocks; IN: Number of hyperslab blocks to get hsize_t buf[]; OUT: List of hyperslab blocks selected RETURNS - Non-negative on success/Negative on failure + Non-negative on success, negative on failure DESCRIPTION Puts a list of the hyperslab blocks into the user's buffer. The blocks start with the 'startblock'th block in the list of blocks and put @@ -4809,7 +4809,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Sget_select_hyper_blocklist() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_bounds @@ -4890,7 +4890,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_bounds() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_offset @@ -4999,7 +4999,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_offset() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_unlim_dim @@ -5026,7 +5026,7 @@ H5S__hyper_unlim_dim(const H5S_t *space) FUNC_LEAVE_NOAPI(space->select.sel_info.hslab->unlim_dim); } /* end H5S__hyper_unlim_dim() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_num_elem_non_unlim @@ -5068,7 +5068,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_num_elem_non_unlim() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_is_contiguous @@ -5254,7 +5254,7 @@ H5S__hyper_is_contiguous(const H5S_t *space) FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_is_contiguous() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_is_single @@ -5327,7 +5327,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_is_single() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_is_regular @@ -5372,7 +5372,7 @@ H5S__hyper_is_regular(const H5S_t *space) FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_is_regular() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_spans_shape_same_helper @@ -5405,7 +5405,7 @@ H5S__hyper_spans_shape_same_helper(const H5S_hyper_span_info_t *span_info1, { hbool_t ret_value = TRUE; /* Return value */ - FUNC_ENTER_PACKAGE_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity checks */ HDassert(span_info1); @@ -5724,7 +5724,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_shape_same() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_release @@ -5765,7 +5765,7 @@ H5S__hyper_release(H5S_t *space) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5S__hyper_release() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_coord_to_span @@ -5828,7 +5828,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_coord_to_span() */ - + /*-------------------------------------------------------------------------- NAME H5S__hyper_add_span_element_helper @@ -6494,7 +6494,7 @@ H5S__hyper_adjust_u(H5S_t *space, const hsize_t *offset) if(0 != offset[u]) { non_zero_offset = TRUE; break; - } /* end if */ + } /* Only perform operation if the offset is non-zero */ if(non_zero_offset) { @@ -7017,9 +7017,8 @@ H5S__hyper_adjust_s(H5S_t *space, const hssize_t *offset) { hbool_t non_zero_offset = FALSE; /* Whether any offset is non-zero */ unsigned u; /* Local index variable */ - herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_STATIC_NOERR /* Sanity checks */ HDassert(space); @@ -7060,10 +7059,9 @@ H5S__hyper_adjust_s(H5S_t *space, const hssize_t *offset) * simultaneous operations */ H5S__hyper_adjust_s_helper(space->select.sel_info.hslab->span_lst, space->extent.rank, offset, 0, op_gen); } /* end if */ - } /* end if */ + } -done: - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5S__hyper_adjust_s() */ @@ -9020,7 +9018,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_generate_spans() */ - + /*-------------------------------------------------------------------------- NAME H5S__check_spans_overlap @@ -9404,11 +9402,11 @@ done: /*------------------------------------------------------------------------- * Function: H5S__generate_hyperlab * - * Purpose: Generate hyperslab information from H5S_select_hyperslab() + * Purpose: Generate hyperslab information from H5S_select_hyperslab() * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, September 12, 2000 * *------------------------------------------------------------------------- @@ -9613,7 +9611,7 @@ H5S__hyper_regular_and_single_block(H5S_t *space, const hsize_t start[], unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_STATIC /* Check args */ HDassert(space); @@ -9824,11 +9822,11 @@ done: /*------------------------------------------------------------------------- * Function: H5S_select_hyperslab * - * Purpose: Internal version of H5Sselect_hyperslab(). + * Purpose: Internal version of H5Sselect_hyperslab(). * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Wednesday, January 10, 2001 * *------------------------------------------------------------------------- @@ -10495,9 +10493,9 @@ hid_t H5Scombine_hyperslab(hid_t space_id, H5S_seloper_t op, const hsize_t start[], const hsize_t stride[], const hsize_t count[], const hsize_t block[]) { - H5S_t *space; /* Dataspace to modify selection of */ - H5S_t *new_space = NULL; /* New dataspace created */ - hid_t ret_value; /* Return value */ + H5S_t *space; /* Dataspace to modify selection of */ + H5S_t *new_space = NULL; /* New dataspace created */ + hid_t ret_value; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE6("i", "iSs*h*h*h*h", space_id, op, start, stride, count, block); @@ -10529,11 +10527,11 @@ done: /*------------------------------------------------------------------------- * Function: H5S__combine_select * - * Purpose: Internal version of H5Scombine_select(). + * Purpose: Internal version of H5Scombine_select(). * - * Return: New dataspace on success/NULL on failure + * Return: New dataspace on success/NULL on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, October 30, 2001 * *------------------------------------------------------------------------- @@ -10668,15 +10666,15 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Scombine_select() */ - + /*------------------------------------------------------------------------- * Function: H5S__modify_select * - * Purpose: Internal version of H5Smodify_select(). + * Purpose: Internal version of H5Smodify_select(). * - * Return: New dataspace on success/NULL on failure + * Return: New dataspace on success/NULL on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, October 30, 2001 * *------------------------------------------------------------------------- @@ -12174,7 +12172,7 @@ H5S_hyper_get_first_inc_block(const H5S_t *space, hsize_t clip_size, hbool_t *partial) { H5S_hyper_sel_t *hslab; /* Convenience pointer to hyperslab info */ - H5S_hyper_dim_t *diminfo; /* Convenience pointer to diminfo.opt in unlimited dimension */ + H5S_hyper_dim_t *diminfo; /* Convenience pointer to diminfo in unlimited dimension */ hsize_t ret_value = 0; FUNC_ENTER_NOAPI(0) diff --git a/src/H5Smodule.h b/src/H5Smodule.h index 962f0a2..67ac785 100644 --- a/src/H5Smodule.h +++ b/src/H5Smodule.h @@ -11,7 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, September 12, 2015 * * Purpose: This file contains declarations which define macros for the diff --git a/src/H5Smpio.c b/src/H5Smpio.c index 33dd492..147fd25 100644 --- a/src/H5Smpio.c +++ b/src/H5Smpio.c @@ -14,7 +14,7 @@ /* * Programmer: rky 980813 * - * Purpose: Create MPI data types for HDF5 selections. + * Purpose: Create MPI data types for HDF5 selections. * */ @@ -148,14 +148,14 @@ H5S__mpio_all_type(const H5S_t *space, size_t elmt_size, *new_type = MPI_BYTE; H5_CHECKED_ASSIGN(*count, int, total_bytes, hsize_t); *is_derived_type = FALSE; - } /* end if */ + } else { /* Create a LARGE derived datatype for this transfer */ if(H5_mpio_create_large_type(total_bytes, 0, MPI_BYTE, new_type) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't create a large datatype from the all selection") *count = 1; *is_derived_type = TRUE; - } /* end else */ + } done: FUNC_LEAVE_NOAPI(ret_value) @@ -253,7 +253,7 @@ H5S__mpio_create_point_datatype(size_t elmt_size, hsize_t num_points, /* Commit MPI datatype for later use */ if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(new_type))) HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code) - } /* end if */ + } else { /* use LARGE_DATATYPE:: * We'll create an hindexed_block type for every 2G point count and then combine @@ -295,7 +295,7 @@ H5S__mpio_create_point_datatype(size_t elmt_size, hsize_t num_points, #if MPI_VERSION >= 3 if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed_block((int)bigio_count, 1, &disp[(hsize_t)i*bigio_count], elmt_type, &inner_types[i]))) - HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed_block failed", mpi_code) + HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed_block failed", mpi_code); #else if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed((int)bigio_count, blocks, &disp[i*bigio_count], elmt_type, &inner_types[i]))) @@ -309,7 +309,7 @@ H5S__mpio_create_point_datatype(size_t elmt_size, hsize_t num_points, #if MPI_VERSION >= 3 if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed_block(remaining_points, 1, &disp[(hsize_t)num_big_types*bigio_count], elmt_type, &inner_types[num_big_types]))) - HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed_block failed", mpi_code) + HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed_block failed", mpi_code); #else if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed((int)remaining_points, blocks, &disp[num_big_types*bigio_count], elmt_type, &inner_types[num_big_types]))) @@ -317,11 +317,12 @@ H5S__mpio_create_point_datatype(size_t elmt_size, hsize_t num_points, #endif inner_blocks[num_big_types] = 1; inner_disps[num_big_types] = 0; - } /* end if */ + } if(MPI_SUCCESS != (mpi_code = MPI_Type_create_struct(total_types, inner_blocks, inner_disps, inner_types, new_type))) - HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_struct", mpi_code) + HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_struct", mpi_code); + for(i = 0; i < total_types; i++) MPI_Type_free(&inner_types[i]); @@ -492,7 +493,7 @@ done: * selection and so the memory datatype has to be permuted using the * permutation map created by the file selection. * - * Note: This routine is called from H5_mpio_space_type(), which is + * Note: This routine is called from H5S_mpio_space_type(), which is * called first for the file dataspace and creates * * Return: Non-negative on success, negative on failure. @@ -799,7 +800,7 @@ if(H5DEBUG(S)) { /* Use a single MPI datatype that has a 32 bit size */ if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous((int)elmt_size, MPI_BYTE, &inner_type))) HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code) - } /* end if */ + } else /* Create the compound datatype for this operation (> 2GB) */ if(H5_mpio_create_large_type(elmt_size, 0, MPI_BYTE, &inner_type) < 0) @@ -836,7 +837,7 @@ if(H5DEBUG(S)) MPI_Type_free(&inner_type); if(mpi_code != MPI_SUCCESS) HMPI_GOTO_ERROR(FAIL, "couldn't create MPI vector type", mpi_code) - } /* end if */ + } else { /* Things get a bit more complicated and require LARGE_DATATYPE processing * There are two MPI datatypes that need to be created: @@ -858,7 +859,7 @@ if(H5DEBUG(S)) if(bigio_count < d[i].block) { if(H5_mpio_create_large_type(d[i].block, 0, inner_type, &block_type) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't create a large block datatype in hyper selection") - } /* end if */ + } else if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous((int)d[i].block, inner_type, &block_type))) HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code) @@ -879,7 +880,7 @@ if(H5DEBUG(S)) if(bigio_count < d[i].count) { if(H5_mpio_create_large_type(d[i].count, stride_in_bytes, block_type, &outer_type) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't create a large outer datatype in hyper selection") - } /* end if */ + } /* otherwise a regular create_hvector will do */ else if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hvector((int)d[i].count, /* count */ @@ -891,7 +892,7 @@ if(H5DEBUG(S)) MPI_Type_free(&block_type); MPI_Type_free(&inner_type); - } /* end else */ + } /* end else */ /**************************************** * Then build the dimension type as (start, vector type, xtent). @@ -1004,7 +1005,7 @@ H5S__mpio_span_hyper_type(const H5S_t *space, size_t elmt_size, if(bigio_count >= elmt_size) { if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous((int)elmt_size, MPI_BYTE, &elmt_type))) HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code) - } /* end if */ + } else if(H5_mpio_create_large_type(elmt_size, 0, MPI_BYTE, &elmt_type) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't create a large element datatype in span_hyper selection") @@ -1113,7 +1114,6 @@ H5S__obtain_datatype(H5S_hyper_span_info_t *spans, const hsize_t *down, { H5S_hyper_span_t *span; /* Hyperslab span to iterate with */ hsize_t bigio_count; /* Transition point to create derived type */ - size_t alloc_count = 0; /* Number of span tree nodes allocated at this level */ size_t outercount = 0; /* Number of span tree nodes at this level */ MPI_Datatype *inner_type = NULL; diff --git a/src/H5Snone.c b/src/H5Snone.c index 630d1d5..67c07d0 100644 --- a/src/H5Snone.c +++ b/src/H5Snone.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, November 10, 1998 * * Purpose: "None" selection dataspace I/O functions. @@ -29,7 +29,7 @@ /* Headers */ /***********/ #include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ +#include "H5Eprivate.h" /* Error handling */ #include "H5Iprivate.h" /* ID Functions */ #include "H5Spkg.h" /* Dataspace functions */ #include "H5VMprivate.h" /* Vector functions */ @@ -68,8 +68,7 @@ static htri_t H5S__none_intersect_block(const H5S_t *space, const hsize_t *start static herr_t H5S__none_adjust_u(H5S_t *space, const hsize_t *offset); static herr_t H5S__none_adjust_s(H5S_t *space, const hssize_t *offset); static herr_t H5S__none_project_scalar(const H5S_t *space, hsize_t *offset); -static herr_t H5S__none_project_simple(const H5S_t *space, H5S_t *new_space, - hsize_t *offset); +static herr_t H5S__none_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset); static herr_t H5S__none_iter_init(const H5S_t *space, H5S_sel_iter_t *iter); /* Selection iteration callbacks */ @@ -143,13 +142,13 @@ static const H5S_sel_iter_class_t H5S_sel_iter_none[1] = {{ /*------------------------------------------------------------------------- - * Function: H5S__none_iter_init + * Function: H5S__none_iter_init * - * Purpose: Initializes iteration information for "none" selection. + * Purpose: Initializes iteration information for "none" selection. * - * Return: Non-negative on success, negative on failure. + * Return: Non-negative on success, negative on failure. * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, June 16, 1998 * *------------------------------------------------------------------------- @@ -171,21 +170,20 @@ H5S__none_iter_init(const H5S_t H5_ATTR_UNUSED *space, H5S_sel_iter_t *iter) /*------------------------------------------------------------------------- - * Function: H5S__none_iter_coords + * Function: H5S__none_iter_coords * - * Purpose: Retrieve the current coordinates of iterator for current + * Purpose: Retrieve the current coordinates of iterator for current * selection * - * Return: Non-negative on success, negative on failure + * Return: Non-negative on success, negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, April 22, 2003 * *------------------------------------------------------------------------- */ static herr_t -H5S__none_iter_coords(const H5S_sel_iter_t H5_ATTR_UNUSED *iter, - hsize_t H5_ATTR_UNUSED *coords) +H5S__none_iter_coords(const H5S_sel_iter_t H5_ATTR_UNUSED *iter, hsize_t H5_ATTR_UNUSED *coords) { FUNC_ENTER_STATIC_NOERR @@ -198,21 +196,20 @@ H5S__none_iter_coords(const H5S_sel_iter_t H5_ATTR_UNUSED *iter, /*------------------------------------------------------------------------- - * Function: H5S__none_iter_block + * Function: H5S__none_iter_block * - * Purpose: Retrieve the current block of iterator for current + * Purpose: Retrieve the current block of iterator for current * selection * - * Return: Non-negative on success, negative on failure + * Return: Non-negative on success, negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, June 2, 2003 * *------------------------------------------------------------------------- */ static herr_t -H5S__none_iter_block(const H5S_sel_iter_t H5_ATTR_UNUSED *iter, - hsize_t H5_ATTR_UNUSED *start, hsize_t H5_ATTR_UNUSED *end) +H5S__none_iter_block(const H5S_sel_iter_t H5_ATTR_UNUSED *iter, hsize_t H5_ATTR_UNUSED *start, hsize_t H5_ATTR_UNUSED *end) { FUNC_ENTER_STATIC_NOERR @@ -226,13 +223,13 @@ H5S__none_iter_block(const H5S_sel_iter_t H5_ATTR_UNUSED *iter, /*------------------------------------------------------------------------- - * Function: H5S__none_iter_nelmts + * Function: H5S__none_iter_nelmts * - * Purpose: Return number of elements left to process in iterator + * Purpose: Return number of elements left to process in iterator * - * Return: Non-negative number of elements on success, zero on failure + * Return: Non-negative number of elements on success, zero on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, June 16, 1998 * *------------------------------------------------------------------------- @@ -472,8 +469,7 @@ H5S__none_release(H5S_t H5_ATTR_UNUSED *space) REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S__none_copy(H5S_t *dst, const H5S_t H5_ATTR_UNUSED *src, - hbool_t H5_ATTR_UNUSED share_selection) +H5S__none_copy(H5S_t *dst, const H5S_t H5_ATTR_UNUSED *src, hbool_t H5_ATTR_UNUSED share_selection) { FUNC_ENTER_STATIC_NOERR @@ -586,8 +582,8 @@ H5S__none_serialize(const H5S_t *space, uint8_t **p) HDassert(pp); /* Store the preamble information */ - UINT32ENCODE(pp, (uint32_t)H5S_GET_SELECT_TYPE(space)); /* Store the type of selection */ - UINT32ENCODE(pp, (uint32_t)H5S_NONE_VERSION_1); /* Store the version number */ + UINT32ENCODE(pp, (uint32_t)H5S_GET_SELECT_TYPE(space)); /* Store the type of selection */ + UINT32ENCODE(pp, (uint32_t)H5S_NONE_VERSION_1); /* Store the version number */ UINT32ENCODE(pp, (uint32_t)0); /* Store the un-used padding */ UINT32ENCODE(pp, (uint32_t)0); /* Store the additional information length */ @@ -698,8 +694,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S__none_bounds(const H5S_t H5_ATTR_UNUSED *space, hsize_t H5_ATTR_UNUSED *start, - hsize_t H5_ATTR_UNUSED *end) +H5S__none_bounds(const H5S_t H5_ATTR_UNUSED *space, hsize_t H5_ATTR_UNUSED *start, hsize_t H5_ATTR_UNUSED *end) { FUNC_ENTER_STATIC_NOERR @@ -708,7 +703,7 @@ H5S__none_bounds(const H5S_t H5_ATTR_UNUSED *space, hsize_t H5_ATTR_UNUSED *star HDassert(end); FUNC_LEAVE_NOAPI(FAIL) -} /* end H5Sget_none_bounds() */ +} /* end H5S_none_bounds() */ /*-------------------------------------------------------------------------- @@ -991,11 +986,11 @@ H5S__none_adjust_s(H5S_t H5_ATTR_UNUSED *space, const hssize_t H5_ATTR_UNUSED *o /*------------------------------------------------------------------------- - * Function: H5S__none_project_scalar + * Function: H5S__none_project_scalar * - * Purpose: Projects a 'none' selection into a scalar dataspace + * Purpose: Projects a 'none' selection into a scalar dataspace * - * Return: Non-negative on success, negative on failure. + * Return: Non-negative on success, negative on failure. * * Programmer: Quincey Koziol * Sunday, July 18, 2010 @@ -1016,14 +1011,14 @@ H5S__none_project_scalar(const H5S_t H5_ATTR_UNUSED *space, hsize_t H5_ATTR_UNUS /*------------------------------------------------------------------------- - * Function: H5S__none_project_simple + * Function: H5S__none_project_simple * - * Purpose: Projects an 'none' selection onto/into a simple dataspace + * Purpose: Projects an 'none' selection onto/into a simple dataspace * of a different rank * - * Return: Non-negative on success, negative on failure. + * Return: Non-negative on success, negative on failure. * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Sunday, July 18, 2010 * *------------------------------------------------------------------------- diff --git a/src/H5Spkg.h b/src/H5Spkg.h index da2dd4a..b1a46f2 100644 --- a/src/H5Spkg.h +++ b/src/H5Spkg.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, September 28, 2000 * * Purpose: This file contains declarations which are visible only within @@ -324,11 +324,9 @@ struct H5S_t { /* Selection iteration methods */ /* Method to retrieve the current coordinates of iterator for current selection */ -typedef herr_t (*H5S_sel_iter_coords_func_t)(const H5S_sel_iter_t *iter, - hsize_t *coords); +typedef herr_t (*H5S_sel_iter_coords_func_t)(const H5S_sel_iter_t *iter, hsize_t *coords); /* Method to retrieve the current block of iterator for current selection */ -typedef herr_t (*H5S_sel_iter_block_func_t)(const H5S_sel_iter_t *iter, - hsize_t *start, hsize_t *end); +typedef herr_t (*H5S_sel_iter_block_func_t)(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end); /* Method to determine number of elements left in iterator for current selection */ typedef hsize_t (*H5S_sel_iter_nelmts_func_t)(const H5S_sel_iter_t *iter); /* Method to determine if there are more blocks left in the current selection */ diff --git a/src/H5Spoint.c b/src/H5Spoint.c index 6948125..f53033b 100644 --- a/src/H5Spoint.c +++ b/src/H5Spoint.c @@ -12,10 +12,10 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, June 16, 1998 * - * Purpose: Point selection dataspace I/O functions. + * Purpose: Point selection dataspace I/O functions. */ /****************/ @@ -30,8 +30,8 @@ /***********/ #include "H5private.h" /* Generic Functions */ #include "H5CXprivate.h" /* API Contexts */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FLprivate.h" /* Free Lists */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FLprivate.h" /* Free Lists */ #include "H5Iprivate.h" /* ID Functions */ #include "H5MMprivate.h" /* Memory management */ #include "H5Spkg.h" /* Dataspace functions */ @@ -75,21 +75,17 @@ static htri_t H5S__point_is_contiguous(const H5S_t *space); static htri_t H5S__point_is_single(const H5S_t *space); static htri_t H5S__point_is_regular(const H5S_t *space); static htri_t H5S__point_shape_same(const H5S_t *space1, const H5S_t *space2); -static htri_t H5S__point_intersect_block(const H5S_t *space, const hsize_t *start, - const hsize_t *end); +static htri_t H5S__point_intersect_block(const H5S_t *space, const hsize_t *start, const hsize_t *end); static herr_t H5S__point_adjust_u(H5S_t *space, const hsize_t *offset); static herr_t H5S__point_adjust_s(H5S_t *space, const hssize_t *offset); -static herr_t H5S__point_project_scalar(const H5S_t *spasce, hsize_t *offset); -static herr_t H5S__point_project_simple(const H5S_t *space, H5S_t *new_space, - hsize_t *offset); +static herr_t H5S__point_project_scalar(const H5S_t *space, hsize_t *offset); +static herr_t H5S__point_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset); static herr_t H5S__point_iter_init(const H5S_t *space, H5S_sel_iter_t *iter); -static herr_t H5S__point_get_version_enc_size(const H5S_t *space, - uint32_t *version, uint8_t *enc_size); +static herr_t H5S__point_get_version_enc_size(const H5S_t *space, uint32_t *version, uint8_t *enc_size); /* Selection iteration callbacks */ static herr_t H5S__point_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords); -static herr_t H5S__point_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, - hsize_t *end); +static herr_t H5S__point_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end); static hsize_t H5S__point_iter_nelmts(const H5S_sel_iter_t *iter); static htri_t H5S__point_iter_has_next_block(const H5S_sel_iter_t *iter); static herr_t H5S__point_iter_next(H5S_sel_iter_t *sel_iter, size_t nelem); @@ -169,16 +165,15 @@ H5FL_BARR_DEFINE_STATIC(H5S_pnt_node_t, hcoords_t, H5S_MAX_RANK); /* Declare a free list to manage the H5S_pnt_list_t struct */ H5FL_DEFINE_STATIC(H5S_pnt_list_t); - - + /*------------------------------------------------------------------------- * Function: H5S__point_iter_init * - * Purpose: Initializes iteration information for point selection. + * Purpose: Initializes iteration information for point selection. * - * Return: Non-negative on success, negative on failure. + * Return: Non-negative on success, negative on failure. * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, June 16, 1998 * *------------------------------------------------------------------------- @@ -223,16 +218,16 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__point_iter_init() */ - + /*------------------------------------------------------------------------- * Function: H5S__point_iter_coords * - * Purpose: Retrieve the current coordinates of iterator for current + * Purpose: Retrieve the current coordinates of iterator for current * selection * - * Return: Non-negative on success, negative on failure + * Return: Non-negative on success, negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, April 22, 2003 * *------------------------------------------------------------------------- @@ -252,16 +247,16 @@ H5S__point_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5S__point_iter_coords() */ - + /*------------------------------------------------------------------------- - * Function: H5S__point_iter_block + * Function: H5S_point_iter_block * - * Purpose: Retrieve the current block of iterator for current + * Purpose: Retrieve the current block of iterator for current * selection * - * Return: Non-negative on success, negative on failure + * Return: Non-negative on success, negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, June 2, 2003 * *------------------------------------------------------------------------- @@ -283,15 +278,15 @@ H5S__point_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5S__point_iter_block() */ - + /*------------------------------------------------------------------------- * Function: H5S__point_iter_nelmts * - * Purpose: Return number of elements left to process in iterator + * Purpose: Return number of elements left to process in iterator * - * Return: Non-negative number of elements on success, zero on failure + * Return: Non-negative number of elements on success, zero on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, June 16, 1998 * *------------------------------------------------------------------------- @@ -307,7 +302,7 @@ H5S__point_iter_nelmts(const H5S_sel_iter_t *iter) FUNC_LEAVE_NOAPI(iter->elmt_left) } /* end H5S__point_iter_nelmts() */ - + /*-------------------------------------------------------------------------- NAME H5S__point_iter_has_next_block @@ -343,7 +338,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__point_iter_has_next_block() */ - + /*-------------------------------------------------------------------------- NAME H5S__point_iter_next @@ -380,7 +375,7 @@ H5S__point_iter_next(H5S_sel_iter_t *iter, size_t nelem) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5S__point_iter_next() */ - + /*-------------------------------------------------------------------------- NAME H5S__point_iter_next_block @@ -412,7 +407,7 @@ H5S__point_iter_next_block(H5S_sel_iter_t *iter) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5S__point_iter_next_block() */ - + /*-------------------------------------------------------------------------- NAME H5S__point_iter_get_seq_list @@ -543,7 +538,7 @@ H5S__point_iter_get_seq_list(H5S_sel_iter_t *iter, size_t maxseq, size_t maxelem FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__point_iter_get_seq_list() */ - + /*-------------------------------------------------------------------------- NAME H5S__point_iter_release @@ -577,7 +572,7 @@ H5S__point_iter_release(H5S_sel_iter_t * iter) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5S__point_iter_release() */ - + /*-------------------------------------------------------------------------- NAME H5S__point_add @@ -694,7 +689,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__point_add() */ - + /*-------------------------------------------------------------------------- NAME H5S__point_release @@ -732,7 +727,7 @@ H5S__point_release(H5S_t *space) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5S__point_release() */ - + /*-------------------------------------------------------------------------- NAME H5S_select_elements @@ -789,7 +784,7 @@ H5S_select_elements(H5S_t *space, H5S_seloper_t op, size_t num_elem, /* Set the bound box to the default value */ H5VM_array_fill(space->select.sel_info.pnt_lst->low_bounds, &tmp, sizeof(hsize_t), space->extent.rank); HDmemset(space->select.sel_info.pnt_lst->high_bounds, 0, sizeof(hsize_t) * space->extent.rank); - } /* end if */ + } /* Add points to selection */ if(H5S__point_add(space, op, num_elem, coord) < 0) @@ -802,7 +797,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_select_elements() */ - + /*-------------------------------------------------------------------------- NAME H5S__copy_pnt_list @@ -878,7 +873,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__copy_pnt_list() */ - + /*-------------------------------------------------------------------------- NAME H5S__free_pnt_list @@ -920,7 +915,7 @@ H5S__free_pnt_list(H5S_pnt_list_t *pnt_lst) FUNC_LEAVE_NOAPI_VOID } /* end H5S__free_pnt_list() */ - + /*-------------------------------------------------------------------------- NAME H5S__point_copy @@ -948,7 +943,7 @@ H5S__point_copy(H5S_t *dst, const H5S_t *src, hbool_t H5_ATTR_UNUSED share_selec FUNC_ENTER_STATIC - /* Sanity check */ + /* Sanity checks */ HDassert(src); HDassert(dst); @@ -960,7 +955,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__point_copy() */ - + /*-------------------------------------------------------------------------- NAME H5S__point_is_valid @@ -1004,7 +999,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__point_is_valid() */ - + /*-------------------------------------------------------------------------- NAME H5Sget_select_elem_npoints @@ -1050,7 +1045,7 @@ done: PURPOSE Determine the version and the size (2, 4 or 8 bytes) to encode point selection info USAGE - hssize_t H5S__point_set_enc_size(space, version, enc_size) + hssize_t H5S__point_get_version_enc_size(space, version, enc_size) const H5S_t *space: IN: Dataspace ID of selection to query uint32_t *version: OUT: The version to use for encoding uint8_t *enc_size: OUT: The size to use for encoding @@ -1161,7 +1156,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5S__point_get_version_enc_size() */ - + /*-------------------------------------------------------------------------- NAME H5S__point_serial_size @@ -1194,7 +1189,7 @@ H5S__point_serial_size(const H5S_t *space) /* Determine the version and encoded size for point selection */ if(H5S__point_get_version_enc_size(space, &version, &enc_size) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't determine hyper version") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't determine version and enc_size") /* Basic number of bytes required to serialize point selection: */ if(version >= H5S_POINT_VERSION_2) @@ -1220,7 +1215,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__point_serial_size() */ - + /*-------------------------------------------------------------------------- NAME H5S__point_serialize @@ -1246,7 +1241,7 @@ static herr_t H5S__point_serialize(const H5S_t *space, uint8_t **p) { H5S_pnt_node_t *curr; /* Point information nodes */ - uint8_t *pp; /* Local pointer for decoding */ + uint8_t *pp; /* Local pointer for encoding */ uint8_t *lenp = NULL; /* pointer to length location for later storage */ uint32_t len=0; /* number of bytes used */ unsigned u; /* local counting variable */ @@ -1264,7 +1259,7 @@ H5S__point_serialize(const H5S_t *space, uint8_t **p) /* Determine the version and encoded size for point selection info */ if(H5S__point_get_version_enc_size(space, &version, &enc_size) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't determine hyper version") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't determine version and enc_size") /* Store the preamble information */ UINT32ENCODE(pp, (uint32_t)H5S_GET_SELECT_TYPE(space)); /* Store the type of selection */ @@ -1352,8 +1347,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5S__point_serialize() */ - - + /*-------------------------------------------------------------------------- NAME H5S__point_deserialize @@ -1508,7 +1502,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__point_deserialize() */ - + /*-------------------------------------------------------------------------- NAME H5S__get_select_elem_pointlist @@ -1539,8 +1533,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S__get_select_elem_pointlist(const H5S_t *space, hsize_t startpoint, - hsize_t numpoints, hsize_t *buf) +H5S__get_select_elem_pointlist(const H5S_t *space, hsize_t startpoint, hsize_t numpoints, hsize_t *buf) { H5S_pnt_node_t *node; /* Point node */ unsigned rank; /* Dataspace rank */ @@ -1573,7 +1566,7 @@ H5S__get_select_elem_pointlist(const H5S_t *space, hsize_t startpoint, FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5S__get_select_elem_pointlist() */ - + /*-------------------------------------------------------------------------- NAME H5Sget_select_elem_pointlist @@ -1627,7 +1620,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Sget_select_elem_pointlist() */ - + /*-------------------------------------------------------------------------- NAME H5S__point_bounds @@ -1685,7 +1678,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__point_bounds() */ - + /*-------------------------------------------------------------------------- NAME H5S__point_offset @@ -1749,7 +1742,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__point_offset() */ - + /*-------------------------------------------------------------------------- NAME H5S__point_unlim_dim @@ -1778,7 +1771,7 @@ H5S__point_unlim_dim(const H5S_t H5_ATTR_UNUSED *space) FUNC_LEAVE_NOAPI(-1) } /* end H5S__point_unlim_dim() */ - + /*-------------------------------------------------------------------------- NAME H5S__point_is_contiguous @@ -1818,7 +1811,7 @@ H5S__point_is_contiguous(const H5S_t *space) FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__point_is_contiguous() */ - + /*-------------------------------------------------------------------------- NAME H5S__point_is_single @@ -1855,7 +1848,7 @@ H5S__point_is_single(const H5S_t *space) FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__point_is_single() */ - + /*-------------------------------------------------------------------------- NAME H5S__point_is_regular @@ -1896,7 +1889,7 @@ H5S__point_is_regular(const H5S_t *space) FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__point_is_regular() */ - + /*-------------------------------------------------------------------------- NAME H5S__point_shape_same @@ -2004,7 +1997,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__point_shape_same() */ - + /*-------------------------------------------------------------------------- NAME H5S__point_intersect_block @@ -2061,7 +2054,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__point_intersect_block() */ - + /*-------------------------------------------------------------------------- NAME H5S__point_adjust_u @@ -2098,7 +2091,7 @@ H5S__point_adjust_u(H5S_t *space, const hsize_t *offset) if(0 != offset[u]) { non_zero_offset = TRUE; break; - } /* end if */ + } /* Only perform operation if the offset is non-zero */ if(non_zero_offset) { @@ -2129,7 +2122,7 @@ H5S__point_adjust_u(H5S_t *space, const hsize_t *offset) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5S__point_adjust_u() */ - + /*-------------------------------------------------------------------------- NAME H5S__point_adjust_s @@ -2199,15 +2192,16 @@ H5S__point_adjust_s(H5S_t *space, const hssize_t *offset) } /* end H5S__point_adjust_s() */ + /*------------------------------------------------------------------------- * Function: H5S__point_project_scalar * - * Purpose: Projects a single element point selection into a scalar + * Purpose: Projects a single element point selection into a scalar * dataspace * - * Return: Non-negative on success, negative on failure. + * Return: Non-negative on success, negative on failure. * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Sunday, July 18, 2010 * *------------------------------------------------------------------------- @@ -2238,16 +2232,16 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__point_project_scalar() */ - + /*------------------------------------------------------------------------- - * Function: H5S__point_project_simple + * Function: H5S_point_project_simple * - * Purpose: Projects a point selection onto/into a simple dataspace + * Purpose: Projects a point selection onto/into a simple dataspace * of a different rank * - * Return: Non-negative on success, negative on failure. + * Return: Non-negative on success, negative on failure. * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Sunday, July 18, 2010 * *------------------------------------------------------------------------- @@ -2374,7 +2368,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__point_project_simple() */ - + /*-------------------------------------------------------------------------- NAME H5Sselect_elements diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h index a61c505..5100f1c 100644 --- a/src/H5Sprivate.h +++ b/src/H5Sprivate.h @@ -183,6 +183,7 @@ typedef struct H5S_sel_iter_op_t { #define H5S_SELECT_ITER_GET_SEQ_LIST(ITER,MAXSEQ,MAXBYTES,NSEQ,NBYTES,OFF,LEN) (H5S_select_iter_get_seq_list(ITER,MAXSEQ,MAXBYTES,NSEQ,NBYTES,OFF,LEN)) #define H5S_SELECT_ITER_RELEASE(ITER) (H5S_select_iter_release(ITER)) #endif /* H5S_MODULE */ + /* Handle these callbacks in a special way, since they have prologs that need to be executed */ #define H5S_SELECT_COPY(DST,SRC,SHARE) (H5S_select_copy(DST,SRC,SHARE)) #define H5S_SELECT_SHAPE_SAME(S1,S2) (H5S_select_shape_same(S1,S2)) diff --git a/src/H5Sselect.c b/src/H5Sselect.c index 1072d7d..eb5cf1c 100644 --- a/src/H5Sselect.c +++ b/src/H5Sselect.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol +/* Programmer: Quincey Koziol * Friday, May 29, 1998 * * Purpose: Dataspace selection functions. @@ -32,6 +32,7 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5FLprivate.h" /* Free Lists */ #include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ #include "H5Spkg.h" /* Dataspaces */ #include "H5VMprivate.h" /* Vector and array functions */ @@ -55,9 +56,9 @@ /********************/ #ifdef LATER -static herr_t H5S_select_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end); -static htri_t H5S_select_iter_has_next_block(const H5S_sel_iter_t *iter); -static herr_t H5S_select_iter_next_block(H5S_sel_iter_t *iter); +static herr_t H5S__select_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end); +static htri_t H5S__select_iter_has_next_block(const H5S_sel_iter_t *iter); +static herr_t H5S__select_iter_next_block(H5S_sel_iter_t *iter); #endif /* LATER */ @@ -144,8 +145,8 @@ H5S_select_offset(H5S_t *space, const hssize_t *offset) herr_t H5Soffset_simple(hid_t space_id, const hssize_t *offset) { - H5S_t *space; /* Dataspace to query */ - herr_t ret_value = SUCCEED; /* Return value */ + H5S_t *space; /* Dataspace to modify */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*Hs", space_id, offset); @@ -582,7 +583,7 @@ H5S_select_deserialize(H5S_t **space, const uint8_t **p) default: break; - } /* end switch */ + } if(ret_value < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTLOAD, FAIL, "can't deserialize selection") @@ -1170,7 +1171,7 @@ H5S_select_iter_init(H5S_sel_iter_t *sel_iter, const H5S_t *space, if(sel_iter->rank > 0) { H5MM_memcpy(sel_iter->dims, space->extent.size, sizeof(hsize_t) * space->extent.rank); H5MM_memcpy(sel_iter->sel_off, space->select.offset, sizeof(hsize_t) * space->extent.rank); - } /* end if */ + } /* Save the element size */ sel_iter->elmt_size = elmt_size; @@ -1232,11 +1233,11 @@ H5S_select_iter_coords(const H5S_sel_iter_t *sel_iter, hsize_t *coords) /*-------------------------------------------------------------------------- NAME - H5S_select_iter_block + H5S__select_iter_block PURPOSE Get the block of the current iterator position USAGE - herr_t H5S_select_iter_block(sel_iter,start,end) + herr_t H5S__select_iter_block(sel_iter,start,end) const H5S_sel_iter_t *sel_iter; IN: Selection iterator to query hsize_t *start; OUT: Array to place iterator start block coordinates hsize_t *end; OUT: Array to place iterator end block coordinates @@ -1254,11 +1255,11 @@ H5S_select_iter_coords(const H5S_sel_iter_t *sel_iter, hsize_t *coords) REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_select_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end) +H5S__select_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end) { herr_t ret_value; /* return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check args */ HDassert(iter); @@ -1269,7 +1270,7 @@ H5S_select_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end) ret_value = (*iter->type->iter_block)(iter, start, end); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5S_select_iter_block() */ +} /* end H5S__select_iter_block() */ #endif /* LATER */ @@ -1313,11 +1314,11 @@ H5S_select_iter_nelmts(const H5S_sel_iter_t *sel_iter) /*-------------------------------------------------------------------------- NAME - H5S_select_iter_has_next_block + H5S__select_iter_has_next_block PURPOSE Check if there is another block available in the selection iterator USAGE - htri_t H5S_select_iter_has_next_block(sel_iter) + htri_t H5S__select_iter_has_next_block(sel_iter) const H5S_sel_iter_t *sel_iter; IN: Selection iterator to query RETURNS Non-negative on success, negative on failure. @@ -1333,11 +1334,11 @@ H5S_select_iter_nelmts(const H5S_sel_iter_t *sel_iter) REVISION LOG --------------------------------------------------------------------------*/ static htri_t -H5S_select_iter_has_next_block(const H5S_sel_iter_t *iter) +H5S__select_iter_has_next_block(const H5S_sel_iter_t *iter) { herr_t ret_value; /* return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check args */ HDassert(iter); @@ -1346,7 +1347,7 @@ H5S_select_iter_has_next_block(const H5S_sel_iter_t *iter) ret_value = (*iter->type->iter_has_next_block)(iter); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5S_select_iter_has_next_block() */ +} /* end H5S__select_iter_has_next_block() */ #endif /* LATER */ @@ -1396,11 +1397,11 @@ H5S_select_iter_next(H5S_sel_iter_t *iter, size_t nelem) /*-------------------------------------------------------------------------- NAME - H5S_select_iter_next_block + H5S__select_iter_next_block PURPOSE Advance selection iterator to next block USAGE - herr_t H5S_select_iter_next_block(iter) + herr_t H5S__select_iter_next_block(iter) H5S_sel_iter_t *iter; IN/OUT: Selection iterator to change RETURNS Non-negative on success, negative on failure. @@ -1418,11 +1419,11 @@ H5S_select_iter_next(H5S_sel_iter_t *iter, size_t nelem) REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_select_iter_next_block(H5S_sel_iter_t *iter) +H5S__select_iter_next_block(H5S_sel_iter_t *iter) { herr_t ret_value; /* return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check args */ HDassert(iter); @@ -1431,7 +1432,7 @@ H5S_select_iter_next_block(H5S_sel_iter_t *iter) ret_value = (*iter->type->iter_next_block)(iter); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5S_select_iter_next_block() */ +} /* end H5S__select_iter_next_block() */ #endif /* LATER */ diff --git a/src/H5Stest.c b/src/H5Stest.c index b61b6bf..1bc5b9f 100644 --- a/src/H5Stest.c +++ b/src/H5Stest.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol +/* Programmer: Quincey Koziol * Saturday, May 31, 2003 * * Purpose: Dataspace selection testing functions. diff --git a/src/H5T.c b/src/H5T.c index 47c4e4e..d59aaff 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -1912,12 +1912,6 @@ done: * Programmer: Robb Matzke * Friday, January 9, 1998 * - * Modifications: - * - * Robb Matzke, 1 Jun 1998 - * It is illegal to lock a named datatype since we must allow named - * types to be closed (to release file resources) but locking a type - * prevents that. *------------------------------------------------------------------------- */ herr_t @@ -1990,9 +1984,6 @@ done: * Programmer: Robb Matzke * Monday, December 8, 1997 * - * Modifications: - * Broke out from H5Tget_class - QAK - 6/4/99 - * *------------------------------------------------------------------------- */ H5T_class_t @@ -3029,10 +3020,6 @@ done: * Programmer: Raymond Lu * July 14, 2004 * - * Modification:Raymond Lu - * 17 February 2011 - * I changed the value for the APP_REF parameter of H5I_register - * from FALSE to TRUE. *------------------------------------------------------------------------- */ hid_t @@ -3195,10 +3182,6 @@ done: * Programmer: Robb Matzke * Friday, December 5, 1997 * - * Modifications: - * Raymond Lu - * 19 May 2011 - * We support fixed size or variable-length string now. *------------------------------------------------------------------------- */ H5T_t * @@ -5173,11 +5156,6 @@ H5T_path_noop(const H5T_path_t *p) * Programmer: Raymond Lu * 8 June 2007 * - * Modifications: Neil Fortner - * 19 September 2008 - * Changed return value to H5T_subset_info_t - * (to allow it to return copy_size) - * *------------------------------------------------------------------------- */ H5T_subset_info_t * @@ -5272,16 +5250,21 @@ H5T_convert(H5T_path_t *tpath, hid_t src_id, hid_t dst_id, size_t nelmts, size_t buf_stride, size_t bkg_stride, void *buf, void *bkg) { #ifdef H5T_DEBUG - H5_timer_t timer; + H5_timer_t timer; /* Timer for conversion */ #endif herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) #ifdef H5T_DEBUG - if(H5DEBUG(T)) - H5_timer_begin(&timer); + if(H5DEBUG(T)) { + /* Initialize and start timer */ + H5_timer_init(&timer); + H5_timer_start(&timer); + } /* end if */ #endif + + /* Call the appropriate conversion callback */ tpath->cdata.command = H5T_CONV_CONV; if(tpath->conv.is_app) { if((tpath->conv.u.app_func)(src_id, dst_id, &(tpath->cdata), nelmts, buf_stride, bkg_stride, buf, bkg, H5CX_get_dxpl()) < 0) @@ -5292,10 +5275,16 @@ H5T_convert(H5T_path_t *tpath, hid_t src_id, hid_t dst_id, size_t nelmts, HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "datatype conversion failed") #ifdef H5T_DEBUG if(H5DEBUG(T)) { - H5_timer_end(&(tpath->stats.timer), &timer); + /* Stop timer */ + H5_timer_stop(&timer); + + /* Record elapsed timer info */ + H5_timer_get_times(timer, &tpath->stats.times); + + /* Increment # of calls and # of elements converted */ tpath->stats.ncalls++; tpath->stats.nelmts += nelmts; - } + } /* end if */ #endif done: @@ -5707,9 +5696,9 @@ H5T_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) break; case H5T_VLEN: /* Recurse on the VL information if it's VL, compound or array, then free VL sequence */ - /* Recurse if it's VL, compound, enum or array */ + /* Recurse if it's VL, compound, enum or array (ignore references here so that we can encode them as part of the same blob)*/ /* (If the force_conv flag is _not_ set, the type cannot change in size, so don't recurse) */ - if(dt->shared->parent->shared->force_conv && H5T_IS_COMPLEX(dt->shared->parent->shared->type)) { + if(dt->shared->parent->shared->force_conv && H5T_IS_COMPLEX(dt->shared->parent->shared->type) && (dt->shared->parent->shared->type != H5T_REFERENCE)) { if((changed = H5T_set_loc(dt->shared->parent, file, loc)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location"); if(changed > 0) @@ -5894,7 +5883,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5T_upgrade_version_cb + * Function: H5T__upgrade_version_cb * * Purpose: H5T__visit callback to Upgrade the version of a datatype * (if there's any benefit to doing so) @@ -5911,9 +5900,9 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5T_upgrade_version_cb(H5T_t *dt, void *op_value) +H5T__upgrade_version_cb(H5T_t *dt, void *op_value) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity check */ HDassert(dt); @@ -5948,7 +5937,7 @@ H5T_upgrade_version_cb(H5T_t *dt, void *op_value) } /* end switch */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5T_upgrade_version_cb() */ +} /* end H5T__upgrade_version_cb() */ /*------------------------------------------------------------------------- @@ -5976,7 +5965,7 @@ H5T__upgrade_version(H5T_t *dt, unsigned new_version) HDassert(dt); /* Iterate over entire datatype, upgrading the version of components, if it's useful */ - if(H5T__visit(dt, (H5T_VISIT_SIMPLE | H5T_VISIT_COMPLEX_LAST), H5T_upgrade_version_cb, &new_version) < 0) + if(H5T__visit(dt, (H5T_VISIT_SIMPLE | H5T_VISIT_COMPLEX_LAST), H5T__upgrade_version_cb, &new_version) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_BADITER, FAIL, "iteration to upgrade datatype encoding version failed") done: diff --git a/src/H5TS.c b/src/H5TS.c index 3643ed5..ee3b219 100644 --- a/src/H5TS.c +++ b/src/H5TS.c @@ -678,3 +678,4 @@ H5TS_create_thread(void *(*func)(void *), H5TS_attr_t *attr, void *udata) } /* H5TS_create_thread */ #endif /* H5_HAVE_THREADSAFE */ + diff --git a/src/H5TSprivate.h b/src/H5TSprivate.h index 887f001..effda55 100644 --- a/src/H5TSprivate.h +++ b/src/H5TSprivate.h @@ -19,8 +19,6 @@ * * Purpose: Private non-prototype header. * - * Modifications: - * *------------------------------------------------------------------------- */ #ifndef H5TSprivate_H_ diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c index bb660c2..789f20c 100644 --- a/src/H5Tcommit.c +++ b/src/H5Tcommit.c @@ -95,7 +95,10 @@ H5FL_EXTERN(H5VL_object_t); * Purpose: Save a transient datatype to a file and turn the type handle * into a "named", immutable type. * - * Return: SUCCEED/FAIL + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * April 5, 2007 * *------------------------------------------------------------------------- */ @@ -263,7 +266,10 @@ done: * Note: The datatype access property list is unused currently, but * is checked for sanity anyway. * - * Return: SUCCEED/FAIL + * Return: Non-negative on success/Negative on failure + * + * Programmer: Peter Cao + * May 17, 2005 * *------------------------------------------------------------------------- */ @@ -495,7 +501,10 @@ done: * * Purpose: Determines if a datatype is committed or not. * - * Return: TRUE/FALSE/FAIL + * Return: TRUE/FALSE/Negative + * + * Programmer: Robb Matzke + * Thursday, June 4, 1998 * *------------------------------------------------------------------------- */ @@ -527,7 +536,7 @@ done: * ADJUST to the link count. * * Return: Success: New link count - * Failure: Negative + * Failure: -1 * * Programmer: Quincey Koziol * Friday, September 26, 2003 @@ -563,6 +572,9 @@ done: * * Failure: H5I_INVALID_HID * + * Programmer: James Laird + * Thursday July 27, 2006 + * *------------------------------------------------------------------------- */ hid_t @@ -626,6 +638,9 @@ done: * * Failure: H5I_INVALID_HID * + * Programmer: Quincey Koziol + * Tuesday, November 28, 2006 + * *------------------------------------------------------------------------- */ hid_t diff --git a/src/H5Tcompound.c b/src/H5Tcompound.c index f4a9e04..5d2d872 100644 --- a/src/H5Tcompound.c +++ b/src/H5Tcompound.c @@ -93,8 +93,6 @@ static H5T_t *H5T__reopen_member_type(const H5T_t *dt, unsigned membno); * Programmer: Robb Matzke * Wednesday, January 7, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ size_t @@ -163,8 +161,6 @@ H5T_get_member_offset(const H5T_t *dt, unsigned membno) * Programmer: Quincey Koziol * Thursday, November 9, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ H5T_class_t @@ -246,7 +242,7 @@ done: /*------------------------------------------------------------------------- * Function: H5T_get_member_type * - * Purpose: Returns a copy of the data type of the specified member. + * Purpose: Returns a copy of the data type of the specified member. * * Return: Success: A copy of the member datatype; * modifying the returned datatype does not @@ -272,7 +268,7 @@ H5T_get_member_type(const H5T_t *dt, unsigned membno) /* Copy datatype */ if(NULL == (ret_value = H5T_copy(dt->shared->u.compnd.memb[membno].type, H5T_COPY_TRANSIENT))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "unable to copy member datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "unable to copy member datatype") done: FUNC_LEAVE_NOAPI(ret_value) @@ -309,7 +305,7 @@ H5T__reopen_member_type(const H5T_t *dt, unsigned membno) /* Copy datatype, possibly re-opening it */ if(NULL == (ret_value = H5T_copy_reopen(dt->shared->u.compnd.memb[membno].type))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "unable to reopen member datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "unable to reopen member datatype") done: FUNC_LEAVE_NOAPI(ret_value) @@ -361,8 +357,6 @@ H5T__get_member_size(const H5T_t *dt, unsigned membno) * Programmer: Robb Matzke * Monday, December 8, 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -407,8 +401,6 @@ done: * Programmer: Robb Matzke * Wednesday, January 7, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -590,7 +582,7 @@ H5T__pack(const H5T_t *dt) for(i = 0, offset = 0; i < dt->shared->u.compnd.nmembs; i++) { dt->shared->u.compnd.memb[i].offset = offset; offset += dt->shared->u.compnd.memb[i].size; - } /* end for */ + } /* Change total size */ dt->shared->size = MAX(1, offset); @@ -616,8 +608,6 @@ done: * Programmer: Quincey Koziol * Thursday, September 11, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ static htri_t @@ -654,8 +644,6 @@ H5T__is_packed(const H5T_t *dt) * Programmer: Neil Fortner * Monday, October 19, 2009 * - * Modifications: - * *------------------------------------------------------------------------- */ void diff --git a/src/H5Tconv.c b/src/H5Tconv.c index 06eb44e..f644b21 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -990,7 +990,7 @@ typedef struct H5T_conv_hw_t { /* Local Prototypes */ /********************/ -static herr_t H5T_reverse_order(uint8_t *rev, uint8_t *s, size_t size, H5T_order_t order); +static herr_t H5T__reverse_order(uint8_t *rev, uint8_t *s, size_t size, H5T_order_t order); /*********************/ @@ -1725,7 +1725,7 @@ H5T__conv_b_b(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, if(src->shared->u.atomic.prec > dst->shared->u.atomic.prec) { /*overflow*/ if(cb_struct.func) { /*If user's exception handler is present, use it*/ - H5T_reverse_order(src_rev, s, src->shared->size, src->shared->u.atomic.order); /*reverse order first*/ + H5T__reverse_order(src_rev, s, src->shared->size, src->shared->u.atomic.order); /*reverse order first*/ except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_RANGE_HI, src_id, dst_id, src_rev, d, cb_struct.user_data); } /* end if */ @@ -1824,7 +1824,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5T_conv_struct_free + * Function: H5T__conv_struct_free * * Purpose: Free the private data structure used by the compound * conversion functions. @@ -1837,14 +1837,14 @@ done: *------------------------------------------------------------------------- */ static H5T_conv_struct_t * -H5T_conv_struct_free(H5T_conv_struct_t *priv) +H5T__conv_struct_free(H5T_conv_struct_t *priv) { int *src2dst = priv->src2dst; hid_t *src_memb_id = priv->src_memb_id, *dst_memb_id = priv->dst_memb_id; unsigned i; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR for(i = 0; i < priv->src_nmembs; i++) if(src2dst[i] >= 0) { @@ -1862,11 +1862,11 @@ H5T_conv_struct_free(H5T_conv_struct_t *priv) H5MM_xfree(priv->memb_path); FUNC_LEAVE_NOAPI((H5T_conv_struct_t *)H5MM_xfree(priv)) -} /* end H5T_conv_struct_free() */ +} /* end H5T__conv_struct_free() */ /*------------------------------------------------------------------------- - * Function: H5T_conv_struct_init + * Function: H5T__conv_struct_init * * Purpose: Initialize the `priv' field of `cdata' with conversion * information that is relatively constant. If `priv' is @@ -1912,7 +1912,7 @@ H5T_conv_struct_free(H5T_conv_struct_t *priv) *------------------------------------------------------------------------- */ static herr_t -H5T_conv_struct_init(H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata) +H5T__conv_struct_init(H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata) { H5T_conv_struct_t *priv = (H5T_conv_struct_t*)(cdata->priv); int *src2dst = NULL; @@ -1920,7 +1920,7 @@ H5T_conv_struct_init(H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata) unsigned i, j; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC src_nmembs = src->shared->u.compnd.nmembs; dst_nmembs = dst->shared->u.compnd.nmembs; @@ -2000,7 +2000,7 @@ H5T_conv_struct_init(H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata) H5T_path_t *tpath = H5T_path_find(src->shared->u.compnd.memb[i].type, dst->shared->u.compnd.memb[src2dst[i]].type); if(NULL == (priv->memb_path[i] = tpath)) { - cdata->priv = H5T_conv_struct_free(priv); + cdata->priv = H5T__conv_struct_free(priv); HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unable to convert member datatype") } /* end if */ } /* end if */ @@ -2053,7 +2053,7 @@ H5T_conv_struct_init(H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5T_conv_struct_init() */ +} /* end H5T__conv_struct_init() */ /*------------------------------------------------------------------------- @@ -2160,7 +2160,7 @@ H5T__conv_struct(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, if(H5T_COMPOUND != dst->shared->type) HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a H5T_COMPOUND datatype") - if(H5T_conv_struct_init(src, dst, cdata) < 0) + if(H5T__conv_struct_init(src, dst, cdata) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to initialize conversion data") break; @@ -2168,7 +2168,7 @@ H5T__conv_struct(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, /* * Free the private conversion data. */ - cdata->priv = H5T_conv_struct_free(priv); + cdata->priv = H5T__conv_struct_free(priv); break; case H5T_CONV_CONV: @@ -2180,7 +2180,7 @@ H5T__conv_struct(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, HDassert(priv); HDassert(bkg && cdata->need_bkg); - if(cdata->recalc && H5T_conv_struct_init(src, dst, cdata) < 0) + if(cdata->recalc && H5T__conv_struct_init(src, dst, cdata) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to initialize conversion data") /* @@ -2389,7 +2389,7 @@ H5T__conv_struct_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a H5T_COMPOUND datatype") /* Initialize data which is relatively constant */ - if(H5T_conv_struct_init(src, dst, cdata) < 0) + if(H5T__conv_struct_init(src, dst, cdata) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to initialize conversion data") priv = (H5T_conv_struct_t *)(cdata->priv); src2dst = priv->src2dst; @@ -2422,7 +2422,7 @@ H5T__conv_struct_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, if(dst_memb->size > src_memb->size) { offset -= src_memb->size; if(dst_memb->size > src->shared->size-offset) { - cdata->priv = H5T_conv_struct_free(priv); + cdata->priv = H5T__conv_struct_free(priv); HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "conversion is unsupported by this function") } /* end if */ } /* end if */ @@ -2434,7 +2434,7 @@ H5T__conv_struct_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, /* * Free the private conversion data. */ - cdata->priv = H5T_conv_struct_free((H5T_conv_struct_t *)(cdata->priv)); + cdata->priv = H5T__conv_struct_free((H5T_conv_struct_t *)(cdata->priv)); break; case H5T_CONV_CONV: @@ -2445,7 +2445,7 @@ H5T__conv_struct_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") /* Update cached data if necessary */ - if(cdata->recalc && H5T_conv_struct_init(src, dst, cdata) < 0) + if(cdata->recalc && H5T__conv_struct_init(src, dst, cdata) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to initialize conversion data") priv = (H5T_conv_struct_t *)(cdata->priv); HDassert(priv); @@ -2579,7 +2579,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5T_conv_enum_init + * Function: H5T__conv_enum_init * * Purpose: Initialize information for H5T__conv_enum(). * @@ -2593,7 +2593,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5T_conv_enum_init(H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata) +H5T__conv_enum_init(H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata) { H5T_enum_struct_t *priv = NULL; /*private conversion data */ int n; /*src value cast as native int */ @@ -2603,7 +2603,7 @@ H5T_conv_enum_init(H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata) unsigned i, j; /*counters */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC cdata->need_bkg = H5T_BKG_NO; if(NULL == (priv = (H5T_enum_struct_t *)(cdata->priv = H5MM_calloc(sizeof(*priv))))) @@ -2766,7 +2766,7 @@ H5T__conv_enum(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, if(H5T_ENUM != dst->shared->type) HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a H5T_ENUM datatype") - if(H5T_conv_enum_init(src, dst, cdata) < 0) + if(H5T__conv_enum_init(src, dst, cdata) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to initialize private data") break; @@ -2794,7 +2794,7 @@ H5T__conv_enum(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a H5T_ENUM datatype") /* priv->src2dst map was computed for certain sort keys. Make sure those same - * sort keys are used here during conversion. See H5T_conv_enum_init(). But + * sort keys are used here during conversion. See H5T__conv_enum_init(). But * we actually don't care about the source type's order when doing the O(1) * conversion algorithm, which is turned on by non-zero priv->length */ H5T__sort_name(dst, NULL); @@ -2831,7 +2831,7 @@ H5T__conv_enum(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, /* (The casting won't work when the byte orders are different. i.g. if the source value * is big-endian 0x0000000f, the direct casting "n = *((int*)s);" will make it a big * number 0x0f000000 on little-endian machine. But we won't fix it because it's an - * optimization code. Please also see the comment in the H5T_conv_enum_init() function. + * optimization code. Please also see the comment in the H5T__conv_enum_init() function. * SLU - 2011/5/24) */ if(1 == src->shared->size) @@ -3110,8 +3110,24 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, if(NULL == (tpath = H5T_path_find(src->shared->parent, dst->shared->parent))) HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dest datatypes") else if(!H5T_path_noop(tpath)) { - if((tsrc_id = H5I_register(H5I_DATATYPE, H5T_copy(src->shared->parent, H5T_COPY_ALL), FALSE)) < 0 || - (tdst_id = H5I_register(H5I_DATATYPE, H5T_copy(dst->shared->parent, H5T_COPY_ALL), FALSE)) < 0) + H5T_t *tsrc_cpy = NULL, *tdst_cpy = NULL; + + if(NULL == (tsrc_cpy = H5T_copy(src->shared->parent, H5T_COPY_ALL))) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, FAIL, "unable to copy src type for conversion") + /* References need to know about the src file */ + if(tsrc_cpy->shared->type == H5T_REFERENCE) + if(H5T_set_loc(tsrc_cpy, src->shared->u.vlen.file, H5T_LOC_MEMORY) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set datatype location"); + + if(NULL == (tdst_cpy = H5T_copy(dst->shared->parent, H5T_COPY_ALL))) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, FAIL, "unable to copy dst type for conversion") + /* References need to know about the dst file */ + if(tdst_cpy->shared->type == H5T_REFERENCE) + if(H5T_set_loc(tdst_cpy, dst->shared->u.vlen.file, H5T_LOC_MEMORY) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set datatype location"); + + if(((tsrc_id = H5I_register(H5I_DATATYPE, tsrc_cpy, FALSE)) < 0) + || ((tdst_id = H5I_register(H5I_DATATYPE, tdst_cpy, FALSE)) < 0)) HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register types for conversion") } /* end else-if */ else @@ -3625,7 +3641,7 @@ H5T__conv_ref(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, if(0 == (buf_size = src->shared->u.atomic.u.r.cls->getsize( src->shared->u.atomic.u.r.file, s, src->shared->size, dst->shared->u.atomic.u.r.file, &dst_copy))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "incorrect size") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unable to obtain size of reference") /* Check if conversion buffer is large enough, resize if necessary. */ if(conv_buf_size < buf_size) { @@ -3853,7 +3869,7 @@ H5T__conv_i_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, } else if (first>=dst->shared->u.atomic.prec) { /*overflow*/ if(cb_struct.func) { /*If user's exception handler is present, use it*/ - H5T_reverse_order(src_rev, s, src->shared->size, src->shared->u.atomic.order); /*reverse order first*/ + H5T__reverse_order(src_rev, s, src->shared->size, src->shared->u.atomic.order); /*reverse order first*/ except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_RANGE_HI, src_id, dst_id, src_rev, d, cb_struct.user_data); } @@ -3882,7 +3898,7 @@ H5T__conv_i_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, if (first+1 == src->shared->u.atomic.prec) { /*overflow - source is negative*/ if(cb_struct.func) { /*If user's exception handler is present, use it*/ - H5T_reverse_order(src_rev, s, src->shared->size, src->shared->u.atomic.order); /*reverse order first*/ + H5T__reverse_order(src_rev, s, src->shared->size, src->shared->u.atomic.order); /*reverse order first*/ except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_RANGE_LOW, src_id, dst_id, src_rev, d, cb_struct.user_data); } @@ -3902,7 +3918,7 @@ H5T__conv_i_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, } else if (first>=dst->shared->u.atomic.prec) { /*overflow - source is positive*/ if(cb_struct.func) { /*If user's exception handler is present, use it*/ - H5T_reverse_order(src_rev, s, src->shared->size, src->shared->u.atomic.order); /*reverse order first*/ + H5T__reverse_order(src_rev, s, src->shared->size, src->shared->u.atomic.order); /*reverse order first*/ except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_RANGE_HI, src_id, dst_id, src_rev, d, cb_struct.user_data); } @@ -3929,7 +3945,7 @@ H5T__conv_i_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, if (first+1 >= dst->shared->u.atomic.prec) { /*overflow*/ if(cb_struct.func) { /*If user's exception handler is present, use it*/ - H5T_reverse_order(src_rev, s, src->shared->size, src->shared->u.atomic.order); /*reverse order first*/ + H5T__reverse_order(src_rev, s, src->shared->size, src->shared->u.atomic.order); /*reverse order first*/ except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_RANGE_HI, src_id, dst_id, src_rev, d, cb_struct.user_data); } @@ -3966,7 +3982,7 @@ H5T__conv_i_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, if (sfz>=0 && fz+1>=dst->shared->u.atomic.prec) { /*overflow*/ if(cb_struct.func) { /*If user's exception handler is present, use it*/ - H5T_reverse_order(src_rev, s, src->shared->size, src->shared->u.atomic.order); /*reverse order first*/ + H5T__reverse_order(src_rev, s, src->shared->size, src->shared->u.atomic.order); /*reverse order first*/ except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_RANGE_LOW, src_id, dst_id, src_rev, d, cb_struct.user_data); } @@ -3996,7 +4012,7 @@ H5T__conv_i_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, if (first+1>=dst->shared->u.atomic.prec) { /*overflow*/ if(cb_struct.func) { /*If user's exception handler is present, use it*/ - H5T_reverse_order(src_rev, s, src->shared->size, src->shared->u.atomic.order); /*reverse order first*/ + H5T__reverse_order(src_rev, s, src->shared->size, src->shared->u.atomic.order); /*reverse order first*/ except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_RANGE_HI, src_id, dst_id, src_rev, d, cb_struct.user_data); } @@ -4277,7 +4293,7 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, /* +Inf or -Inf */ if(cb_struct.func) { /*If user's exception handler is present, use it*/ /*reverse order first*/ - H5T_reverse_order(src_rev, s, src_p->shared->size, src_p->shared->u.atomic.order); + H5T__reverse_order(src_rev, s, src_p->shared->size, src_p->shared->u.atomic.order); if(sign) except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_NINF, src_id, dst_id, src_rev, d, cb_struct.user_data); @@ -4316,7 +4332,7 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, /* +Inf or -Inf */ if(cb_struct.func) { /*If user's exception handler is present, use it*/ /*reverse order first*/ - H5T_reverse_order(src_rev, s, src_p->shared->size, src_p->shared->u.atomic.order); + H5T__reverse_order(src_rev, s, src_p->shared->size, src_p->shared->u.atomic.order); if(sign) except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_NINF, src_id, dst_id, src_rev, d, cb_struct.user_data); @@ -4355,7 +4371,7 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, /* NaN */ if(cb_struct.func) { /*If user's exception handler is present, use it*/ /*reverse order first*/ - H5T_reverse_order(src_rev, s, src_p->shared->size, src_p->shared->u.atomic.order); + H5T__reverse_order(src_rev, s, src_p->shared->size, src_p->shared->u.atomic.order); except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_NAN, src_id, dst_id, src_rev, d, cb_struct.user_data); } @@ -4474,7 +4490,7 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, */ if(cb_struct.func) { /*If user's exception handler is present, use it*/ /*reverse order first*/ - H5T_reverse_order(src_rev, s, src_p->shared->size, src_p->shared->u.atomic.order); + H5T__reverse_order(src_rev, s, src_p->shared->size, src_p->shared->u.atomic.order); except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_RANGE_HI, src_id, dst_id, src_rev, d, cb_struct.user_data); } @@ -4567,7 +4583,7 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, */ if(cb_struct.func) { /*If user's exception handler is present, use it*/ /*reverse order first*/ - H5T_reverse_order(src_rev, s, src_p->shared->size, src_p->shared->u.atomic.order); + H5T__reverse_order(src_rev, s, src_p->shared->size, src_p->shared->u.atomic.order); except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_RANGE_HI, src_id, dst_id, src_rev, d, cb_struct.user_data); } @@ -8680,7 +8696,7 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, if(sign) { /* -Infinity */ if(cb_struct.func) { /*If user's exception handler is present, use it*/ /*reverse order first*/ - H5T_reverse_order(src_rev, s, src_p->shared->size, src_p->shared->u.atomic.order); + H5T__reverse_order(src_rev, s, src_p->shared->size, src_p->shared->u.atomic.order); except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_NINF, src_id, dst_id, src_rev, d, cb_struct.user_data); } @@ -8697,7 +8713,7 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, } else { /* +Infinity */ if(cb_struct.func) { /*If user's exception handler is present, use it*/ /*reverse order first*/ - H5T_reverse_order(src_rev, s, src_p->shared->size, src_p->shared->u.atomic.order); + H5T__reverse_order(src_rev, s, src_p->shared->size, src_p->shared->u.atomic.order); except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_PINF, src_id, dst_id, src_rev, d, cb_struct.user_data); } @@ -8726,7 +8742,7 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, if(sign) { /* -Infinity */ if(cb_struct.func) { /*If user's exception handler is present, use it*/ /*reverse order first*/ - H5T_reverse_order(src_rev, s, src_p->shared->size, src_p->shared->u.atomic.order); + H5T__reverse_order(src_rev, s, src_p->shared->size, src_p->shared->u.atomic.order); except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_NINF, src_id, dst_id, src_rev, d, cb_struct.user_data); } @@ -8743,7 +8759,7 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, } else { /* +Infinity */ if(cb_struct.func) { /*If user's exception handler is present, use it*/ /*reverse order first*/ - H5T_reverse_order(src_rev, s, src_p->shared->size, src_p->shared->u.atomic.order); + H5T__reverse_order(src_rev, s, src_p->shared->size, src_p->shared->u.atomic.order); except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_PINF, src_id, dst_id, src_rev, d, cb_struct.user_data); } @@ -8766,7 +8782,7 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, /* NaN */ if(cb_struct.func) { /*If user's exception handler is present, use it*/ /*reverse order first*/ - H5T_reverse_order(src_rev, s, src_p->shared->size, src_p->shared->u.atomic.order); + H5T__reverse_order(src_rev, s, src_p->shared->size, src_p->shared->u.atomic.order); except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_NAN, src_id, dst_id, src_rev, d, cb_struct.user_data); } @@ -8862,7 +8878,7 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, if(sign) { /*source is negative*/ if(cb_struct.func) { /*If user's exception handler is present, use it*/ /*reverse order first*/ - H5T_reverse_order(src_rev, s, src_p->shared->size, src_p->shared->u.atomic.order); + H5T__reverse_order(src_rev, s, src_p->shared->size, src_p->shared->u.atomic.order); except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_RANGE_LOW, src_id, dst_id, src_rev, d, cb_struct.user_data); if(except_ret == H5T_CONV_ABORT) @@ -8878,7 +8894,7 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, /*overflow*/ if(cb_struct.func) { /*If user's exception handler is present, use it*/ /*reverse order first*/ - H5T_reverse_order(src_rev, s, src_p->shared->size, src_p->shared->u.atomic.order); + H5T__reverse_order(src_rev, s, src_p->shared->size, src_p->shared->u.atomic.order); except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_RANGE_HI, src_id, dst_id, src_rev, d, cb_struct.user_data); } @@ -8894,7 +8910,7 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, } else if (first shared->size, src_p->shared->u.atomic.order); + H5T__reverse_order(src_rev, s, src_p->shared->size, src_p->shared->u.atomic.order); except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_TRUNCATE, src_id, dst_id, src_rev, d, cb_struct.user_data); } @@ -8915,7 +8931,7 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, if(first < dst.prec-1) { if(truncated && cb_struct.func) { /*If user's exception handler is present, use it*/ /*reverse order first*/ - H5T_reverse_order(src_rev, s, src_p->shared->size, src_p->shared->u.atomic.order); + H5T__reverse_order(src_rev, s, src_p->shared->size, src_p->shared->u.atomic.order); except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_TRUNCATE, src_id, dst_id, src_rev, d, cb_struct.user_data); } @@ -8941,7 +8957,7 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, */ if(cb_struct.func) { /*If user's exception handler is present, use it*/ /*reverse order first*/ - H5T_reverse_order(src_rev, s, src_p->shared->size, src_p->shared->u.atomic.order); + H5T__reverse_order(src_rev, s, src_p->shared->size, src_p->shared->u.atomic.order); except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_RANGE_LOW, src_id, dst_id, src_rev, d, cb_struct.user_data); } @@ -8961,7 +8977,7 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, /*overflow*/ if(cb_struct.func) { /*If user's exception handler is present, use it*/ /*reverse order first*/ - H5T_reverse_order(src_rev, s, src_p->shared->size, src_p->shared->u.atomic.order); + H5T__reverse_order(src_rev, s, src_p->shared->size, src_p->shared->u.atomic.order); except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_RANGE_HI, src_id, dst_id, src_rev, d, cb_struct.user_data); } @@ -8978,7 +8994,7 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, } else if(first < dst.prec-1) { if(truncated && cb_struct.func) { /*If user's exception handler is present, use it*/ /*reverse order first*/ - H5T_reverse_order(src_rev, s, src_p->shared->size, src_p->shared->u.atomic.order); + H5T__reverse_order(src_rev, s, src_p->shared->size, src_p->shared->u.atomic.order); except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_TRUNCATE, src_id, dst_id, src_rev, d, cb_struct.user_data); } @@ -9300,7 +9316,7 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, * precision loss. Let user's handler deal with the case if it's present */ if(cb_struct.func) { - H5T_reverse_order(src_rev, s, src_p->shared->size, src_p->shared->u.atomic.order); /*reverse order first*/ + H5T__reverse_order(src_rev, s, src_p->shared->size, src_p->shared->u.atomic.order); /*reverse order first*/ except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_PRECISION, src_id, dst_id, src_rev, d, cb_struct.user_data); } @@ -9368,7 +9384,7 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, if(expo > expo_max) { /*overflows*/ if(cb_struct.func) { /*user's exception handler. Reverse back source order*/ - H5T_reverse_order(src_rev, s, src_p->shared->size, src_p->shared->u.atomic.order); /*reverse order first*/ + H5T__reverse_order(src_rev, s, src_p->shared->size, src_p->shared->u.atomic.order); /*reverse order first*/ except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_RANGE_HI, src_id, dst_id, src_rev, d, cb_struct.user_data); @@ -9470,7 +9486,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5T_reverse_order + * Function: H5T__reverse_order * * Purpose: Internal assisting function to reverse the order of * a sequence of byte when it's big endian or VAX order. @@ -9486,11 +9502,11 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5T_reverse_order(uint8_t *rev, uint8_t *s, size_t size, H5T_order_t order) +H5T__reverse_order(uint8_t *rev, uint8_t *s, size_t size, H5T_order_t order) { size_t i; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(s); HDassert(size); @@ -9579,13 +9595,13 @@ H5T_reclaim_cb(void *elem, const H5T_t *dt, unsigned H5_ATTR_UNUSED ndim, HDassert(dt); if(dt->shared->type == H5T_REFERENCE) { - if(H5T_ref_reclaim(elem, dt) < 0) + if(H5T__ref_reclaim(elem, dt) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFREE, FAIL, "can't reclaim ref elements") } else { HDassert(op_data); /* Allow vlen reclaim to recurse into that routine */ - if(H5T_vlen_reclaim(elem, dt, (H5T_vlen_alloc_info_t *)op_data) < 0) + if(H5T__vlen_reclaim(elem, dt, (H5T_vlen_alloc_info_t *)op_data) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFREE, FAIL, "can't reclaim vlen elements") } diff --git a/src/H5Tcset.c b/src/H5Tcset.c index 186e598..5ac2a62 100644 --- a/src/H5Tcset.c +++ b/src/H5Tcset.c @@ -39,10 +39,6 @@ * Programmer: Robb Matzke * Friday, January 9, 1998 * - * Modifications: - * Robb Matzke, 22 Dec 1998 - * Also works for derived data types. - * *------------------------------------------------------------------------- */ H5T_cset_t @@ -85,10 +81,6 @@ done: * Programmer: Robb Matzke * Friday, January 9, 1998 * - * Modifications: - * Robb Matzke, 22 Dec 1998 - * Also works with derived data types. - * *------------------------------------------------------------------------- */ herr_t diff --git a/src/H5Tdbg.c b/src/H5Tdbg.c index 605310a..6188138 100644 --- a/src/H5Tdbg.c +++ b/src/H5Tdbg.c @@ -13,11 +13,11 @@ /*------------------------------------------------------------------------- * - * Created: H5Tdbg.c - * Jul 19 2007 - * Quincey Koziol + * Created: H5Tdbg.c + * Jul 19 2007 + * Quincey Koziol * - * Purpose: Dump debugging information about a datatype + * Purpose: Dump debugging information about a datatype * *------------------------------------------------------------------------- */ @@ -95,25 +95,24 @@ herr_t H5T__print_stats(H5T_path_t H5_ATTR_UNUSED * path, int H5_ATTR_UNUSED * nprint/*in,out*/) { -#ifdef H5T_DEBUG - hsize_t nbytes; - char bandwidth[32]; -#endif - FUNC_ENTER_PACKAGE_NOERR #ifdef H5T_DEBUG - if (H5DEBUG(T) && path->stats.ncalls > 0) { - if (nprint && 0 == (*nprint)++) { - HDfprintf(H5DEBUG(T), "H5T: type conversion statistics:\n"); - HDfprintf(H5DEBUG(T), " %-16s %10s %10s %8s %8s %8s %10s\n", - "Conversion", "Elmts", "Calls", "User", - "System", "Elapsed", "Bandwidth"); - HDfprintf(H5DEBUG(T), " %-16s %10s %10s %8s %8s %8s %10s\n", - "----------", "-----", "-----", "----", - "------", "-------", "---------"); - } - if (path->src && path->dst) + if(H5DEBUG(T) && path->stats.ncalls > 0) { + hsize_t nbytes; + char bandwidth[32]; + + if(nprint && 0 == (*nprint)++) { + HDfprintf(H5DEBUG(T), "H5T: type conversion statistics:\n"); + HDfprintf(H5DEBUG(T), " %-16s %10s %10s %8s %8s %8s %10s\n", + "Conversion", "Elmts", "Calls", "User", + "System", "Elapsed", "Bandwidth"); + HDfprintf(H5DEBUG(T), " %-16s %10s %10s %8s %8s %8s %10s\n", + "----------", "-----", "-----", "----", + "------", "-------", "---------"); + } /* end if */ + + if(path->src && path->dst) nbytes = MAX(H5T_get_size(path->src), H5T_get_size(path->dst)); else if (path->src) nbytes = H5T_get_size(path->src); @@ -121,18 +120,20 @@ H5T__print_stats(H5T_path_t H5_ATTR_UNUSED * path, int H5_ATTR_UNUSED * nprint/* nbytes = H5T_get_size(path->dst); else nbytes = 0; - nbytes *= path->stats.nelmts; - H5_bandwidth(bandwidth, (double)nbytes, path->stats.timer.etime); - HDfprintf(H5DEBUG(T), " %-16s %10Hd %10d %8.2f %8.2f %8.2f %10s\n", - path->name, - path->stats.nelmts, - path->stats.ncalls, - path->stats.timer.utime, - path->stats.timer.stime, - path->stats.timer.etime, - bandwidth); - } + + nbytes *= path->stats.nelmts; + H5_bandwidth(bandwidth, (double)nbytes, path->stats.times.elapsed); + HDfprintf(H5DEBUG(T), " %-16s %10Hd %10d %8T %8T %8T %10s\n", + path->name, + path->stats.nelmts, + path->stats.ncalls, + path->stats.times.user, + path->stats.times.system, + path->stats.times.elapsed, + bandwidth); + } /* end if */ #endif + FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5T__print_stats() */ @@ -405,18 +406,18 @@ H5T_debug(const H5T_t *dt, FILE *stream) } /* end else */ } else if (H5T_ENUM == dt->shared->type) { - size_t base_size; + size_t base_size; /* Enumeration data type */ HDfprintf(stream, " "); H5T_debug(dt->shared->parent, stream); base_size = dt->shared->parent->shared->size; for (i = 0; i < dt->shared->u.enumer.nmembs; i++) { - size_t k; + size_t k; HDfprintf(stream, "\n\"%s\" = 0x", dt->shared->u.enumer.name[i]); for (k = 0; k < base_size; k++) - HDfprintf(stream, "%02lx", (unsigned long)((uint8_t *)dt->shared->u.enumer.value + (i * base_size) + k)); + HDfprintf(stream, "%02p", ((uint8_t *)dt->shared->u.enumer.value + (i * base_size) + k)); } /* end for */ HDfprintf(stream, "\n"); } diff --git a/src/H5Tdeprec.c b/src/H5Tdeprec.c index 2c98dc0..3823e47 100644 --- a/src/H5Tdeprec.c +++ b/src/H5Tdeprec.c @@ -15,7 +15,7 @@ * * Created: H5Tdeprec.c * April 5 2007 - * Quincey Koziol + * Quincey Koziol * * Purpose: Deprecated functions from the H5T interface. These * functions are here for compatibility purposes and may be diff --git a/src/H5Tenum.c b/src/H5Tenum.c index 6daa497..e1d8246 100644 --- a/src/H5Tenum.c +++ b/src/H5Tenum.c @@ -26,9 +26,9 @@ #include "H5Tpkg.h" /*data-type functions */ /* Static local functions */ -static char *H5T_enum_nameof(const H5T_t *dt, const void *value, char *name/*out*/, +static char *H5T__enum_nameof(const H5T_t *dt, const void *value, char *name/*out*/, size_t size); -static herr_t H5T_enum_valueof(const H5T_t *dt, const char *name, +static herr_t H5T__enum_valueof(const H5T_t *dt, const char *name, void *value/*out*/); @@ -89,8 +89,6 @@ done: * Programmer: Raymond Lu * October 9, 2002 * - * Modifications: - * *------------------------------------------------------------------------- */ H5T_t * @@ -132,8 +130,6 @@ done: * Programmer: Robb Matzke * Wednesday, December 23, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -179,8 +175,6 @@ done: * Programmer: Robb Matzke * Wednesday, December 23, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -197,17 +191,17 @@ H5T__enum_insert(const H5T_t *dt, const char *name, const void *value) /* The name and value had better not already exist */ for(i = 0; i < dt->shared->u.enumer.nmembs; i++) { - if(!HDstrcmp(dt->shared->u.enumer.name[i], name)) + if(!HDstrcmp(dt->shared->u.enumer.name[i], name)) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "name redefinition") - if(!HDmemcmp((uint8_t *)dt->shared->u.enumer.value + (i * dt->shared->size), value, dt->shared->size)) + if(!HDmemcmp((uint8_t *)dt->shared->u.enumer.value + (i * dt->shared->size), value, dt->shared->size)) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "value redefinition") - } /* end for */ + } /* Increase table sizes */ if(dt->shared->u.enumer.nmembs >= dt->shared->u.enumer.nalloc) { char **names; uint8_t *values; - unsigned n = MAX(32, 2*dt->shared->u.enumer.nalloc); + unsigned n = MAX(32, 2*dt->shared->u.enumer.nalloc); if(NULL == (names = (char **)H5MM_realloc(dt->shared->u.enumer.name, n * sizeof(char *)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") @@ -217,7 +211,7 @@ H5T__enum_insert(const H5T_t *dt, const char *name, const void *value) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") dt->shared->u.enumer.value = values; dt->shared->u.enumer.nalloc = n; - } /* end for */ + } /* Insert new member at end of member arrays */ dt->shared->u.enumer.sorted = H5T_SORT_NONE; @@ -243,8 +237,6 @@ done: * Programmer: Robb Matzke * Wednesday, December 23, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -286,8 +278,6 @@ done: * Programmer: Raymond Lu * October 9, 2002 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -323,8 +313,6 @@ H5T__get_member_value(const H5T_t *dt, unsigned membno, void *value/*out*/) * Programmer: Robb Matzke * Monday, January 4, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -346,7 +334,7 @@ H5Tenum_nameof(hid_t type, const void *value, char *name/*out*/, size_t size) if (!name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name buffer supplied") - if (NULL==H5T_enum_nameof(dt, value, name, size)) + if (NULL==H5T__enum_nameof(dt, value, name, size)) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "nameof query failed") done: @@ -355,7 +343,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5T_enum_nameof + * Function: H5T__enum_nameof * * Purpose: Finds the symbol name that corresponds the the specified * VALUE of an enumeration data type DT. At most SIZE characters @@ -375,15 +363,10 @@ done: * Programmer: Robb Matzke * Monday, January 4, 1999 * - * Modifications: - * Raymond Lu - * Wednesday, Febuary 9, 2005 - * Made a copy of original datatype and do sorting and search - * on that copy, to protect the original order of members. *------------------------------------------------------------------------- */ static char * -H5T_enum_nameof(const H5T_t *dt, const void *value, char *name/*out*/, size_t size) +H5T__enum_nameof(const H5T_t *dt, const void *value, char *name/*out*/, size_t size) { H5T_t *copied_dt = NULL; /* Do sorting in copied datatype */ unsigned lt, md = 0, rt; /* Indices for binary search */ @@ -391,7 +374,7 @@ H5T_enum_nameof(const H5T_t *dt, const void *value, char *name/*out*/, size_t si hbool_t alloc_name = FALSE; /* Whether name has been allocated */ char *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check args */ HDassert(dt && H5T_ENUM == dt->shared->type); @@ -431,8 +414,7 @@ H5T_enum_nameof(const H5T_t *dt, const void *value, char *name/*out*/, size_t si /* Save result name */ if(!name) { - if(NULL == (name = (char *)H5MM_malloc( - HDstrlen(copied_dt->shared->u.enumer.name[md]) + 1))) + if(NULL == (name = (char *)H5MM_malloc(HDstrlen(copied_dt->shared->u.enumer.name[md]) + 1))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); alloc_name = TRUE; } /* end if */ @@ -451,7 +433,7 @@ done: H5MM_free(name); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5T_enum_nameof() */ +} /* end H5T__enum_nameof() */ /*------------------------------------------------------------------------- @@ -469,11 +451,6 @@ done: * Programmer: Robb Matzke * Monday, January 4, 1999 * - * Modifications: - * Raymond Lu - * Wednesday, Febuary 9, 2005 - * Made a copy of original datatype and do sorting and search - * on that copy, to protect the original order of members. *------------------------------------------------------------------------- */ herr_t @@ -495,7 +472,7 @@ H5Tenum_valueof(hid_t type, const char *name, void *value/*out*/) if(!value) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no value buffer") - if(H5T_enum_valueof(dt, name, value) < 0) + if(H5T__enum_valueof(dt, name, value) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "valueof query failed") done: @@ -504,7 +481,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5T_enum_valueof + * Function: H5T__enum_valueof * * Purpose: Finds the value that corresponds the the specified symbol * NAME of an enumeration data type DT and copy it to the VALUE @@ -518,22 +495,17 @@ done: * Programmer: Robb Matzke * Monday, January 4, 1999 * - * Modifications: - * Raymond Lu - * Wednesday, Febuary 9, 2005 - * Made a copy of original datatype and do sorting and search - * on that copy, to protect the original order of members. *------------------------------------------------------------------------- */ static herr_t -H5T_enum_valueof(const H5T_t *dt, const char *name, void *value/*out*/) +H5T__enum_valueof(const H5T_t *dt, const char *name, void *value/*out*/) { unsigned lt, md=0, rt; /*indices for binary search */ int cmp=(-1); /*comparison result */ H5T_t *copied_dt = NULL; /*do sorting in copied datatype */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check args */ HDassert(dt && H5T_ENUM==dt->shared->type); diff --git a/src/H5Tfields.c b/src/H5Tfields.c index be0b5f2..8f5e202 100644 --- a/src/H5Tfields.c +++ b/src/H5Tfields.c @@ -41,9 +41,6 @@ * Programmer: Robb Matzke * Monday, December 8, 1997 * - * Modifications: - * Robb Matzke, 22 Dec 1998 - * Also works with enumeration datatypes. *------------------------------------------------------------------------- */ int @@ -83,8 +80,6 @@ done: * Programmer: Raymond Lu * October 8, 2002 * - * Modifications: - * *------------------------------------------------------------------------- */ int @@ -124,9 +119,6 @@ done: * Programmer: Robb Matzke * Wednesday, January 7, 1998 * - * Modifications: - * Robb Matzke, 22 Dec 1998 - * Also works with enumeration datatypes. *------------------------------------------------------------------------- */ char * @@ -166,7 +158,6 @@ done: * Programmer: Raymond Lu * October 9, 2002 * - * Modifications: *------------------------------------------------------------------------- */ char * @@ -225,8 +216,6 @@ done: * Programmer: Raymond Lu * Thursday, April 4, 2002 * - * Modifications: - * *------------------------------------------------------------------------- */ int @@ -394,8 +383,6 @@ H5T__sort_value(const H5T_t *dt, int *map) * Programmer: Robb Matzke * Monday, January 4, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t diff --git a/src/H5Tfixed.c b/src/H5Tfixed.c index bc1d84d..5270a9a 100644 --- a/src/H5Tfixed.c +++ b/src/H5Tfixed.c @@ -37,9 +37,6 @@ * Programmer: Robb Matzke * Wednesday, January 7, 1998 * - * Modifications: - * Robb Matzke, 22 Dec 1998 - * Also works with derived datatypes. *------------------------------------------------------------------------- */ H5T_sign_t @@ -75,8 +72,6 @@ done: * Programmer: Raymond Lu * October 8, 2002 * - * Modifications: - * *------------------------------------------------------------------------- */ H5T_sign_t @@ -115,10 +110,6 @@ done: * Programmer: Robb Matzke * Wednesday, January 7, 1998 * - * Modifications: - * Robb Matzke, 22 Dec 1998 - * Also works with derived datatypes. - * *------------------------------------------------------------------------- */ herr_t diff --git a/src/H5Tfloat.c b/src/H5Tfloat.c index 85e8f30..0d224db 100644 --- a/src/H5Tfloat.c +++ b/src/H5Tfloat.c @@ -194,10 +194,6 @@ done: * Programmer: Robb Matzke * Wednesday, January 7, 1998 * - * Modifications: - * Robb Matzke, 22 Dec 1998 - * Also works with derived datatypes. - * *------------------------------------------------------------------------- */ herr_t diff --git a/src/H5Tmodule.h b/src/H5Tmodule.h index d2ab08c..f8f57ac 100644 --- a/src/H5Tmodule.h +++ b/src/H5Tmodule.h @@ -11,7 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, September 12, 2015 * * Purpose: This file contains declarations which define macros for the diff --git a/src/H5Toffset.c b/src/H5Toffset.c index c0e94fc..38c7e53 100644 --- a/src/H5Toffset.c +++ b/src/H5Toffset.c @@ -25,7 +25,7 @@ #include "H5Tpkg.h" /* Datatypes */ /* Static local functions */ -static herr_t H5T_set_offset(const H5T_t *dt, size_t offset); +static herr_t H5T__set_offset(const H5T_t *dt, size_t offset); @@ -163,10 +163,6 @@ done: * Programmer: Robb Matzke * Wednesday, January 7, 1998 * - * Modifications: - * Robb Matzke, 22 Dec 1998 - * Moved real work to a private function. - * *------------------------------------------------------------------------- */ herr_t @@ -191,7 +187,7 @@ H5Tset_offset(hid_t type_id, size_t offset) HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "operation not defined for this datatype") /* Do the real work */ - if (H5T_set_offset(dt, offset)<0) + if (H5T__set_offset(dt, offset)<0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to set offset") done: @@ -200,7 +196,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5T_set_offset + * Function: H5T__set_offset * * Purpose: Sets the bit offset of the first significant bit. The * significant bits of an atomic datum can be offset from the @@ -232,18 +228,14 @@ done: * Programmer: Robb Matzke * Wednesday, January 7, 1998 * - * Modifications: - * Robb Matzke, 22 Dec 1998 - * Also works for derived data types. - * *------------------------------------------------------------------------- */ static herr_t -H5T_set_offset(const H5T_t *dt, size_t offset) +H5T__set_offset(const H5T_t *dt, size_t offset) { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_STATIC /* Check args */ HDassert(dt); @@ -254,7 +246,7 @@ H5T_set_offset(const H5T_t *dt, size_t offset) HDassert(!(H5T_ENUM==dt->shared->type && 0==dt->shared->u.enumer.nmembs)); if (dt->shared->parent) { - if (H5T_set_offset(dt->shared->parent, offset)<0) + if (H5T__set_offset(dt->shared->parent, offset)<0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to set offset for base type") /* Adjust size of datatype appropriately */ diff --git a/src/H5Topaque.c b/src/H5Topaque.c index 4e8f1d4..f7ce977 100644 --- a/src/H5Topaque.c +++ b/src/H5Topaque.c @@ -37,8 +37,6 @@ * Programmer: Robb Matzke * Thursday, May 20, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -84,8 +82,6 @@ done: * Programmer: Robb Matzke * Thursday, May 20, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ char * diff --git a/src/H5Torder.c b/src/H5Torder.c index b4babfa..7784c1d 100644 --- a/src/H5Torder.c +++ b/src/H5Torder.c @@ -50,7 +50,7 @@ /********************/ /* Local Prototypes */ /********************/ -static herr_t H5T_set_order(H5T_t *dtype, H5T_order_t order); +static herr_t H5T__set_order(H5T_t *dtype, H5T_order_t order); /*********************/ @@ -216,7 +216,7 @@ H5Tset_order(hid_t type_id, H5T_order_t order) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype is read-only") /* Call internal routine to set the order */ - if(H5T_set_order(dt, order) < 0) + if(H5T__set_order(dt, order) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "can't set order") done: @@ -225,7 +225,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5T_set_order + * Function: H5T__set_order * * Purpose: Private function to set the byte order for a datatype. * @@ -237,11 +237,11 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5T_set_order(H5T_t *dtype, H5T_order_t order) +H5T__set_order(H5T_t *dtype, H5T_order_t order) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_STATIC if(H5T_ENUM == dtype->shared->type && dtype->shared->u.enumer.nmembs > 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "operation not allowed after enum members are defined") @@ -274,12 +274,12 @@ H5T_set_order(H5T_t *dtype, H5T_order_t order) /* Loop through all fields of compound type, setting the order */ for(i = 0; i < nmemb; i++) - if(H5T_set_order(dtype->shared->u.compnd.memb[i].type, order) < 0) + if(H5T__set_order(dtype->shared->u.compnd.memb[i].type, order) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set order for compound member") } /* end if */ } /* end else */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5T_set_order() */ +} /* end H5T__set_order() */ diff --git a/src/H5Tpad.c b/src/H5Tpad.c index c96f42a..450c567 100644 --- a/src/H5Tpad.c +++ b/src/H5Tpad.c @@ -38,10 +38,6 @@ * Programmer: Robb Matzke * Friday, January 9, 1998 * - * Modifications: - * Robb Matzke, 22 Dec 1998 - * Also works with derived data types. - * *------------------------------------------------------------------------- */ herr_t @@ -82,10 +78,6 @@ done: * Programmer: Robb Matzke * Friday, January 9, 1998 * - * Modifications: - * Robb Matzke, 22 Dec 1998 - * Also works with derived data types. - * *------------------------------------------------------------------------- */ herr_t diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h index 39bff15..1766c3f 100644 --- a/src/H5Tpkg.h +++ b/src/H5Tpkg.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, December 8, 1997 * * Purpose: This file contains declarations which are visible only within @@ -49,7 +49,7 @@ #define H5T_NAMELEN 32 /* Macro to ease detecting "complex" datatypes (i.e. those with base types or fields) */ -#define H5T_IS_COMPLEX(t) ((t) == H5T_COMPOUND || (t) == H5T_ENUM || (t) == H5T_VLEN || (t) == H5T_ARRAY) +#define H5T_IS_COMPLEX(t) ((t) == H5T_COMPOUND || (t) == H5T_ENUM || (t) == H5T_VLEN || (t) == H5T_ARRAY || (t) == H5T_REFERENCE) /* Macro to ease detecting fixed "string" datatypes */ #define H5T_IS_FIXED_STRING(dt) (H5T_STRING == (dt)->type) @@ -152,7 +152,7 @@ struct H5T_stats_t { unsigned ncalls; /*num calls to conversion function */ hsize_t nelmts; /*total data points converted */ - H5_timer_t timer; /*total time for conversion */ + H5_timevals_t times; /*total time for conversion */ }; /* Library internal datatype conversion functions are... */ @@ -1179,6 +1179,7 @@ H5_DLL void H5T__bit_neg(uint8_t *buf, size_t start, size_t size); /* VL functions */ H5_DLL H5T_t * H5T__vlen_create(const H5T_t *base); +H5_DLL herr_t H5T__vlen_reclaim(void *elem, const H5T_t *dt, H5T_vlen_alloc_info_t *alloc_info); H5_DLL htri_t H5T__vlen_set_loc(const H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc); /* Array functions */ @@ -1187,6 +1188,7 @@ H5_DLL int H5T__get_array_ndims(const H5T_t *dt); H5_DLL int H5T__get_array_dims(const H5T_t *dt, hsize_t dims[]); /* Reference functions */ +H5_DLL herr_t H5T__ref_reclaim(void *elem, const H5T_t *dt); H5_DLL htri_t H5T__ref_set_loc(const H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc); /* Compound functions */ diff --git a/src/H5Tprecis.c b/src/H5Tprecis.c index bd28fc2..fae2c69 100644 --- a/src/H5Tprecis.c +++ b/src/H5Tprecis.c @@ -25,7 +25,7 @@ #include "H5Tpkg.h" /* Datatypes */ /* Static local functions */ -static herr_t H5T_set_precision(const H5T_t *dt, size_t prec); +static herr_t H5T__set_precision(const H5T_t *dt, size_t prec); @@ -45,10 +45,6 @@ static herr_t H5T_set_precision(const H5T_t *dt, size_t prec); * Programmer: Robb Matzke * Wednesday, January 7, 1998 * - * Modifications: - * Robb Matzke, 22 Dec 1998 - * Also works for derived datatypes. - * *------------------------------------------------------------------------- */ size_t @@ -101,7 +97,7 @@ H5T_get_precision(const H5T_t *dt) while(dt->shared->parent) dt = dt->shared->parent; if(!H5T_IS_ATOMIC(dt->shared)) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, 0, "operation not defined for specified datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, 0, "operation not defined for specified datatype") /* Precision */ ret_value = dt->shared->u.atomic.prec; @@ -134,10 +130,6 @@ done: * Programmer: Robb Matzke * Wednesday, January 7, 1998 * - * Modifications: - * Robb Matzke, 22 Dec 1998 - * Moved real work to a private function. - * *------------------------------------------------------------------------- */ herr_t @@ -166,7 +158,7 @@ H5Tset_precision(hid_t type_id, size_t prec) HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "operation not defined for specified datatype") /* Do the work */ - if (H5T_set_precision(dt, prec)<0) + if (H5T__set_precision(dt, prec)<0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "unable to set precision") done: @@ -175,7 +167,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5T_set_precision + * Function: H5T__set_precision * * Purpose: Sets the precision of a datatype. The precision is * the number of significant bits which, unless padding is @@ -197,19 +189,15 @@ done: * Programmer: Robb Matzke * Wednesday, January 7, 1998 * - * Modifications: - * Robb Matzke, 22 Dec 1998 - * Also works for derived datatypes. - * *------------------------------------------------------------------------- */ static herr_t -H5T_set_precision(const H5T_t *dt, size_t prec) +H5T__set_precision(const H5T_t *dt, size_t prec) { size_t offset, size; herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_STATIC /* Check args */ HDassert(dt); @@ -220,8 +208,8 @@ H5T_set_precision(const H5T_t *dt, size_t prec) HDassert(!(H5T_ENUM==dt->shared->type && 0==dt->shared->u.enumer.nmembs)); if (dt->shared->parent) { - if (H5T_set_precision(dt->shared->parent, prec)<0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "unable to set precision for base type") + if (H5T__set_precision(dt->shared->parent, prec)<0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "unable to set precision for base type") /* Adjust size of datatype appropriately */ if(dt->shared->type==H5T_ARRAY) @@ -230,18 +218,18 @@ H5T_set_precision(const H5T_t *dt, size_t prec) dt->shared->size = dt->shared->parent->shared->size; } else { if (H5T_IS_ATOMIC(dt->shared)) { - /* Adjust the offset and size */ - offset = dt->shared->u.atomic.offset; - size = dt->shared->size; - if (prec > 8*size) + /* Adjust the offset and size */ + offset = dt->shared->u.atomic.offset; + size = dt->shared->size; + if (prec > 8*size) offset = 0; - else if (offset+prec > 8 * size) + else if (offset+prec > 8 * size) offset = 8 * size - prec; - if (prec > 8*size) + if (prec > 8*size) size = (prec+7) / 8; - /* Check that things are still kosher */ - switch (dt->shared->type) { + /* Check that things are still kosher */ + switch (dt->shared->type) { case H5T_INTEGER: case H5T_TIME: case H5T_BITFIELD: @@ -273,11 +261,11 @@ H5T_set_precision(const H5T_t *dt, size_t prec) HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "operation not defined for datatype class") } /* end switch */ - /* Commit */ - dt->shared->size = size; + /* Commit */ + dt->shared->size = size; dt->shared->u.atomic.offset = offset; dt->shared->u.atomic.prec = prec; - } /* end if */ + } /* end if */ else HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not defined for specified datatype") } /* end else */ diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h index e05bb4e..0d6be6d 100644 --- a/src/H5Tprivate.h +++ b/src/H5Tprivate.h @@ -58,7 +58,7 @@ struct H5S_t; /* How to copy a datatype */ typedef enum H5T_copy_t { H5T_COPY_TRANSIENT, - H5T_COPY_ALL, + H5T_COPY_ALL } H5T_copy_t; /* Location of datatype information */ @@ -135,8 +135,6 @@ H5_DLL herr_t H5T_convert(H5T_path_t *tpath, hid_t src_id, hid_t dst_id, size_t nelmts, size_t buf_stride, size_t bkg_stride, void *buf, void *bkg); H5_DLL herr_t H5T_reclaim(hid_t type_id, struct H5S_t *space, void *buf); H5_DLL herr_t H5T_reclaim_cb(void *elem, const H5T_t *dt, unsigned ndim, const hsize_t *point, void *op_data); -H5_DLL herr_t H5T_ref_reclaim(void *elem, const H5T_t *dt); -H5_DLL herr_t H5T_vlen_reclaim(void *elem, const H5T_t *dt, H5T_vlen_alloc_info_t *alloc_info); H5_DLL herr_t H5T_vlen_reclaim_elmt(void *elem, H5T_t *dt); H5_DLL htri_t H5T_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc); H5_DLL htri_t H5T_is_sensible(const H5T_t *dt); diff --git a/src/H5Tref.c b/src/H5Tref.c index b357baa..44f61c0 100644 --- a/src/H5Tref.c +++ b/src/H5Tref.c @@ -40,6 +40,19 @@ #define H5T_REF_OBJ_DISK_SIZE(f) (H5F_SIZEOF_ADDR(f)) #define H5T_REF_DSETREG_DISK_SIZE(f) (H5HG_HEAP_ID_SIZE(f)) +/* Debug */ +// #define H5T_REF_DEBUG +#ifdef H5T_REF_DEBUG +#define H5T_REF_LOG_DEBUG(...) do { \ + HDfprintf(stdout, " # %s(): ", __func__); \ + HDfprintf(stdout, __VA_ARGS__); \ + HDfprintf(stdout, "\n"); \ + HDfflush(stdout); \ + } while (0) +#else +#define H5T_REF_LOG_DEBUG(...) do { } while (0) +#endif + /******************/ /* Local Typedefs */ /******************/ @@ -133,6 +146,7 @@ H5T__ref_set_loc(const H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) htri_t ret_value = FALSE; /* Indicate success, but no location change */ FUNC_ENTER_PACKAGE + H5T_REF_LOG_DEBUG("loc=%d", (int)loc); HDassert(dt); /* f is NULL when loc == H5T_LOC_MEMORY */ @@ -144,7 +158,9 @@ H5T__ref_set_loc(const H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) switch(loc) { case H5T_LOC_MEMORY: /* Memory based reference datatype */ - HDassert(NULL == file); + + /* NB. We allow for the file to be non-NULL when doing + * memory-to-memory conversion */ /* Mark this type as being stored in memory */ dt->shared->u.atomic.u.r.loc = H5T_LOC_MEMORY; @@ -317,6 +333,7 @@ H5T__ref_mem_isnull(const H5VL_object_t H5_ATTR_UNUSED *src_file, herr_t ret_value = SUCCEED; FUNC_ENTER_STATIC_NOERR + H5T_REF_LOG_DEBUG(""); /* Check parameters */ HDassert(src_buf); @@ -344,6 +361,7 @@ H5T__ref_mem_setnull(H5VL_object_t H5_ATTR_UNUSED *dst_file, void *dst_buf, herr_t ret_value = SUCCEED; FUNC_ENTER_STATIC_NOERR + H5T_REF_LOG_DEBUG(""); HDmemset(dst_buf, 0, H5T_REF_MEM_SIZE); @@ -364,27 +382,31 @@ static size_t H5T__ref_mem_getsize(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf, size_t H5_ATTR_UNUSED src_size, H5VL_object_t *dst_file, hbool_t *dst_copy) { - H5VL_object_t *vol_obj; /* VOL object for src ref's location */ + H5VL_object_t *vol_obj = NULL; /* VOL object for src ref's location */ const H5R_ref_priv_t *src_ref = (const H5R_ref_priv_t *)src_buf; - hbool_t files_equal = FALSE; /* Whether src & dst references are in same file */ char *file_name_buf_dyn = NULL; /* Pointer to dynamically allocated buffer for file name, if static buffer is too small */ unsigned flags = 0; /* References flags */ size_t ret_value = 0; /* Return value */ FUNC_ENTER_STATIC + H5T_REF_LOG_DEBUG(""); /* Sanity check */ HDassert(src_buf); HDassert(src_size == H5T_REF_MEM_SIZE); - /* Retrieve VOL object */ - if(NULL == (vol_obj = H5VL_vol_object(src_ref->loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid location identifier") + if(NULL != dst_file) { + hbool_t files_equal = TRUE; /* Whether src & dst references are in same file */ - /* Set external flag if referenced file is not destination file */ - if(H5VL_file_is_same(vol_obj, dst_file, &files_equal) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOMPARE, 0, "can't check if files are equal") - flags |= !files_equal ? H5R_IS_EXTERNAL : 0; + /* Retrieve VOL object */ + if(NULL == (vol_obj = H5VL_vol_object(src_ref->loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid location identifier") + + /* Set external flag if referenced file is not destination file */ + if(H5VL_file_is_same(vol_obj, dst_file, &files_equal) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOMPARE, 0, "can't check if files are equal") + flags |= !files_equal ? H5R_IS_EXTERNAL : 0; + } /* Force re-calculating encoding size if any flags are set */ if(flags || !src_ref->encode_size) { @@ -458,22 +480,28 @@ H5T__ref_mem_read(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf, { H5VL_object_t *vol_obj; /* VOL object for src ref's location */ const H5R_ref_priv_t *src_ref = (const H5R_ref_priv_t *)src_buf; - hbool_t files_equal = FALSE; /* Whether src & dst references are in same file */ - char file_name_buf_static[256]; /* File name */ + hbool_t files_equal = TRUE; /* Whether src & dst references are in same file */ + char file_name_buf_static[256] = {'\0'}; /* File name */ char *file_name_buf_dyn = NULL; /* Pointer to dynamically allocated buffer for file name, if static buffer is too small */ ssize_t file_name_len; /* Size of file name buffer */ unsigned flags = 0; /* References flags */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC + H5T_REF_LOG_DEBUG(""); /* Sanity check */ HDassert(src_buf); HDassert(src_size == H5T_REF_MEM_SIZE); - HDassert(dst_file); HDassert(dst_buf); HDassert(dst_size); + /* Memory-to-memory conversion to support vlen conversion */ + if(NULL == dst_file) { + HDmemcpy(dst_buf, src_buf, dst_size); + HGOTO_DONE(ret_value); + } + /* Retrieve VOL object */ if(NULL == (vol_obj = H5VL_vol_object(src_ref->loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid location identifier") @@ -504,14 +532,16 @@ H5T__ref_mem_read(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf, H5CX_set_libver_bounds(NULL); } /* end if */ - /* Get file name */ - if(H5VL_file_get(vol_obj, H5VL_FILE_GET_NAME, H5P_DATASET_XFER_DEFAULT, NULL, H5I_FILE, sizeof(file_name_buf_static), file_name_buf_static, &file_name_len) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, 0, "can't get file name") - if(file_name_len >= (ssize_t)sizeof(file_name_buf_static)) { - if(NULL == (file_name_buf_dyn = (char *)H5MM_malloc((size_t)file_name_len + 1))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, 0, "can't allocate space for file name") - if(H5VL_file_get(vol_obj, H5VL_FILE_GET_NAME, H5P_DATASET_XFER_DEFAULT, NULL, H5I_FILE, (size_t)file_name_len + 1, file_name_buf_dyn, &file_name_len) < 0) + /* Get file name (if external reference) */ + if(flags) { + if(H5VL_file_get(vol_obj, H5VL_FILE_GET_NAME, H5P_DATASET_XFER_DEFAULT, NULL, H5I_FILE, sizeof(file_name_buf_static), file_name_buf_static, &file_name_len) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, 0, "can't get file name") + if(file_name_len >= (ssize_t)sizeof(file_name_buf_static)) { + if(NULL == (file_name_buf_dyn = (char *)H5MM_malloc((size_t)file_name_len + 1))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, 0, "can't allocate space for file name") + if(H5VL_file_get(vol_obj, H5VL_FILE_GET_NAME, H5P_DATASET_XFER_DEFAULT, NULL, H5I_FILE, (size_t)file_name_len + 1, file_name_buf_dyn, &file_name_len) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, 0, "can't get file name") + } /* end if */ } /* end if */ /* Encode reference */ @@ -539,22 +569,28 @@ H5T__ref_mem_write(H5VL_object_t *src_file, const void *src_buf, size_t src_size H5R_type_t src_type, H5VL_object_t H5_ATTR_UNUSED *dst_file, void *dst_buf, size_t dst_size, void H5_ATTR_UNUSED *bg_buf) { - H5F_t *src_f; + H5F_t *src_f = NULL; hid_t file_id = H5I_INVALID_HID; H5R_ref_priv_t *dst_ref = (H5R_ref_priv_t *)dst_buf; herr_t ret_value = SUCCEED; FUNC_ENTER_STATIC + H5T_REF_LOG_DEBUG(""); /* Sanity check */ - HDassert(src_file); HDassert(src_buf); HDassert(src_size); HDassert(dst_buf); HDassert(dst_size == H5T_REF_MEM_SIZE); + /* Memory-to-memory conversion to support vlen conversion */ + if(NULL == src_file) { + HDmemcpy(dst_buf, src_buf, src_size); + HGOTO_DONE(ret_value); + } + #ifndef NDEBUG - { + if((src_type == H5R_OBJECT1) || (src_type == H5R_DATASET_REGION1)) { hbool_t is_native = FALSE; /* Whether the src file is using the native VOL connector */ /* Check if using native VOL connector */ @@ -653,6 +689,7 @@ H5T__ref_disk_isnull(const H5VL_object_t *src_file, const void *src_buf, herr_t ret_value = SUCCEED; FUNC_ENTER_STATIC + H5T_REF_LOG_DEBUG(""); /* Check parameters */ HDassert(src_file); @@ -695,6 +732,7 @@ H5T__ref_disk_setnull(H5VL_object_t *dst_file, void *dst_buf, void *bg_buf) herr_t ret_value = SUCCEED; FUNC_ENTER_STATIC + H5T_REF_LOG_DEBUG(""); HDassert(dst_file); HDassert(dst_buf); @@ -744,6 +782,7 @@ H5T__ref_disk_getsize(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_bu size_t ret_value = 0; FUNC_ENTER_STATIC + H5T_REF_LOG_DEBUG(""); HDassert(src_buf); @@ -793,6 +832,7 @@ H5T__ref_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t H5_ATTR_ herr_t ret_value = SUCCEED; FUNC_ENTER_STATIC + H5T_REF_LOG_DEBUG(""); HDassert(src_file); HDassert(src_buf); @@ -839,6 +879,7 @@ H5T__ref_disk_write(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf, herr_t ret_value = SUCCEED; FUNC_ENTER_STATIC + H5T_REF_LOG_DEBUG(""); HDassert(src_buf); HDassert(src_size); @@ -898,6 +939,7 @@ static herr_t H5T__ref_obj_disk_isnull(const H5VL_object_t *src_file, herr_t ret_value = SUCCEED; FUNC_ENTER_STATIC + H5T_REF_LOG_DEBUG(""); /* Check parameters */ HDassert(src_file); @@ -950,6 +992,7 @@ H5T__ref_obj_disk_getsize(H5VL_object_t *src_file, const void H5_ATTR_UNUSED *sr size_t ret_value = 0; FUNC_ENTER_STATIC + H5T_REF_LOG_DEBUG(""); HDassert(src_file); HDassert(src_buf); @@ -997,6 +1040,7 @@ H5T__ref_obj_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t src_ herr_t ret_value = SUCCEED; FUNC_ENTER_STATIC + H5T_REF_LOG_DEBUG(""); HDassert(src_file); HDassert(src_buf); @@ -1051,6 +1095,7 @@ H5T__ref_dsetreg_disk_isnull(const H5VL_object_t *src_file, const void *src_buf, herr_t ret_value = SUCCEED; FUNC_ENTER_STATIC + H5T_REF_LOG_DEBUG(""); /* Check parameters */ HDassert(src_file); @@ -1106,6 +1151,7 @@ H5T__ref_dsetreg_disk_getsize(H5VL_object_t H5_ATTR_UNUSED *src_file, #else FUNC_ENTER_STATIC_NOERR #endif + H5T_REF_LOG_DEBUG(""); HDassert(src_buf); @@ -1154,6 +1200,7 @@ H5T__ref_dsetreg_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t herr_t ret_value = SUCCEED; FUNC_ENTER_STATIC + H5T_REF_LOG_DEBUG(""); HDassert(src_file); HDassert(src_buf); @@ -1190,7 +1237,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5T_ref_reclaim + * Function: H5T__ref_reclaim * * Purpose: Internal routine to free reference datatypes * @@ -1199,11 +1246,12 @@ done: *------------------------------------------------------------------------- */ herr_t -H5T_ref_reclaim(void *elem, const H5T_t *dt) +H5T__ref_reclaim(void *elem, const H5T_t *dt) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE + H5T_REF_LOG_DEBUG(""); /* Sanity checks */ HDassert(elem); @@ -1214,5 +1262,5 @@ H5T_ref_reclaim(void *elem, const H5T_t *dt) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5T_ref_reclaim() */ +} /* end H5T__ref_reclaim() */ diff --git a/src/H5Tstrpad.c b/src/H5Tstrpad.c index fa084f1..35de30b 100644 --- a/src/H5Tstrpad.c +++ b/src/H5Tstrpad.c @@ -41,10 +41,6 @@ * Programmer: Robb Matzke * Friday, January 9, 1998 * - * Modifications: - * Robb Matzke, 22 Dec 1998 - * Also works for derived datatypes. - * *------------------------------------------------------------------------- */ H5T_str_t @@ -98,10 +94,6 @@ done: * Programmer: Robb Matzke * Friday, January 9, 1998 * - * Modifications: - * Robb Matzke, 22 Dec 1998 - * Also works for derived datatypes. - * *------------------------------------------------------------------------- */ herr_t diff --git a/src/H5Tvisit.c b/src/H5Tvisit.c index c706dee..00c7d8f 100644 --- a/src/H5Tvisit.c +++ b/src/H5Tvisit.c @@ -22,7 +22,7 @@ * * Created: H5Tvisit.c * Jul 19 2007 - * Quincey Koziol + * Quincey Koziol * * Purpose: Visit all the components of a datatype * diff --git a/src/H5Tvlen.c b/src/H5Tvlen.c index 9d098c6..f280069 100644 --- a/src/H5Tvlen.c +++ b/src/H5Tvlen.c @@ -1037,7 +1037,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5T_vlen_reclaim + * Function: H5T__vlen_reclaim * * Purpose: Internal recursive routine to free VL datatypes * @@ -1049,7 +1049,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5T_vlen_reclaim(void *elem, const H5T_t *dt, H5T_vlen_alloc_info_t *alloc_info) +H5T__vlen_reclaim(void *elem, const H5T_t *dt, H5T_vlen_alloc_info_t *alloc_info) { unsigned u; /* Local index variable */ H5MM_free_t free_func; /* Free function */ @@ -1156,7 +1156,7 @@ H5T_vlen_reclaim(void *elem, const H5T_t *dt, H5T_vlen_alloc_info_t *alloc_info) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5T_vlen_reclaim() */ +} /* end H5T__vlen_reclaim() */ /*------------------------------------------------------------------------- @@ -1191,9 +1191,10 @@ H5T_vlen_reclaim_elmt(void *elem, H5T_t *dt) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to retrieve VL allocation info") /* Recurse on buffer to free dynamic fields */ - if(H5T_vlen_reclaim(elem, dt, &vl_alloc_info) < 0) + if(H5T__vlen_reclaim(elem, dt, &vl_alloc_info) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFREE, FAIL, "can't reclaim vlen elements") done: FUNC_LEAVE_NOAPI(ret_value) } /* H5T_vlen_reclaim_elmt() */ + diff --git a/src/H5VLint.c b/src/H5VLint.c index 861629f..98785f8 100644 --- a/src/H5VLint.c +++ b/src/H5VLint.c @@ -2363,23 +2363,25 @@ H5VL_wrap_register(H5I_type_t type, void *obj, hbool_t app_ref) /* Sanity check */ HDassert(obj); + /* Retrieve the VOL object wrapping context */ + if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL object wrap context") + if(NULL == vol_wrap_ctx || NULL == vol_wrap_ctx->connector) + HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, H5I_INVALID_HID, "VOL object wrap context or its connector is NULL???") + /* If the datatype is already VOL-managed, the datatype's vol_obj * field will get clobbered later, so disallow this. */ - if(type == H5I_DATATYPE) - if(TRUE == H5T_already_vol_managed((const H5T_t *)obj)) - HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, H5I_INVALID_HID, "can't wrap an uncommitted datatype") + if(type == H5I_DATATYPE) { + if(vol_wrap_ctx->connector->id == H5VL_NATIVE) + if(TRUE == H5T_already_vol_managed((const H5T_t *)obj)) + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, H5I_INVALID_HID, "can't wrap an uncommitted datatype") + } /* Wrap the object with VOL connector info */ if(NULL == (new_obj = H5VL__wrap_obj(obj, type))) HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, H5I_INVALID_HID, "can't wrap library object") - /* Retrieve the VOL object wrapping context */ - if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL object wrap context") - if(NULL == vol_wrap_ctx || NULL == vol_wrap_ctx->connector) - HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, H5I_INVALID_HID, "VOL object wrap context or its connector is NULL???") - /* Get an ID for the object */ if((ret_value = H5VL_register_using_vol_id(type, new_obj, vol_wrap_ctx->connector->id, app_ref)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to get an ID for the object") diff --git a/src/H5VLnative_link.c b/src/H5VLnative_link.c index ceb8d61..48bd2d8 100644 --- a/src/H5VLnative_link.c +++ b/src/H5VLnative_link.c @@ -75,7 +75,7 @@ H5VL__native_link_create(H5VL_link_create_type_t create_type, void *obj, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "source and destination should be in the same file.") /* Create the link */ - if((ret_value = H5L_create_hard(cur_loc_p, cur_params->loc_data.loc_by_name.name, + if((ret_value = H5L__create_hard(cur_loc_p, cur_params->loc_data.loc_by_name.name, link_loc_p, loc_params->loc_data.loc_by_name.name, lcpl_id)) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") } /* end if */ @@ -96,7 +96,7 @@ H5VL__native_link_create(H5VL_link_create_type_t create_type, void *obj, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") /* Create the link */ - if((ret_value = H5L_create_soft(target_name, &link_loc, loc_params->loc_data.loc_by_name.name, lcpl_id)) < 0) + if((ret_value = H5L__create_soft(target_name, &link_loc, loc_params->loc_data.loc_by_name.name, lcpl_id)) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") break; } @@ -161,7 +161,7 @@ H5VL__native_link_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, dst_loc_p = src_loc_p; /* Copy the link */ - if(H5L_move(src_loc_p, loc_params1->loc_data.loc_by_name.name, + if(H5L__move(src_loc_p, loc_params1->loc_data.loc_by_name.name, dst_loc_p, loc_params2->loc_data.loc_by_name.name, TRUE, lcpl_id) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to copy link") @@ -206,7 +206,7 @@ H5VL__native_link_move(void *src_obj, const H5VL_loc_params_t *loc_params1, dst_loc_p = src_loc_p; /* Move the link */ - if(H5L_move(src_loc_p, loc_params1->loc_data.loc_by_name.name, + if(H5L__move(src_loc_p, loc_params1->loc_data.loc_by_name.name, dst_loc_p, loc_params2->loc_data.loc_by_name.name, FALSE, lcpl_id) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to move link") @@ -249,7 +249,7 @@ H5VL__native_link_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_ HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link info") } /* end if */ else if(loc_params->type == H5VL_OBJECT_BY_IDX) { /* H5Lget_info_by_idx */ - if(H5L_get_info_by_idx(&loc, loc_params->loc_data.loc_by_idx.name, loc_params->loc_data.loc_by_idx.idx_type, + if(H5L__get_info_by_idx(&loc, loc_params->loc_data.loc_by_idx.name, loc_params->loc_data.loc_by_idx.idx_type, loc_params->loc_data.loc_by_idx.order, loc_params->loc_data.loc_by_idx.n, linfo2) < 0) HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link info") } /* end else-if */ @@ -267,7 +267,7 @@ H5VL__native_link_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_ ssize_t *ret = HDva_arg(arguments, ssize_t *); /* Get the link name */ - if((*ret = H5L_get_name_by_idx(&loc, loc_params->loc_data.loc_by_idx.name, loc_params->loc_data.loc_by_idx.idx_type, + if((*ret = H5L__get_name_by_idx(&loc, loc_params->loc_data.loc_by_idx.name, loc_params->loc_data.loc_by_idx.idx_type, loc_params->loc_data.loc_by_idx.order, loc_params->loc_data.loc_by_idx.n, name, size)) < 0) HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link info") @@ -282,12 +282,12 @@ H5VL__native_link_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_ /* Get the link information */ if(loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Lget_val */ - if(H5L_get_val(&loc, loc_params->loc_data.loc_by_name.name, buf, size) < 0) + if(H5L__get_val(&loc, loc_params->loc_data.loc_by_name.name, buf, size) < 0) HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link value") } else if(loc_params->type == H5VL_OBJECT_BY_IDX) { /* H5Lget_val_by_idx */ - if(H5L_get_val_by_idx(&loc, loc_params->loc_data.loc_by_idx.name, loc_params->loc_data.loc_by_idx.idx_type, + if(H5L__get_val_by_idx(&loc, loc_params->loc_data.loc_by_idx.name, loc_params->loc_data.loc_by_idx.idx_type, loc_params->loc_data.loc_by_idx.order, loc_params->loc_data.loc_by_idx.n, buf, size) < 0) HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link val") } @@ -333,7 +333,7 @@ H5VL__native_link_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") /* Check for the existence of the link */ - if((*ret = H5L_exists(&loc, loc_params->loc_data.loc_by_name.name)) < 0) + if((*ret = H5L__exists(&loc, loc_params->loc_data.loc_by_name.name)) < 0) HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to specific link info") break; } @@ -392,11 +392,11 @@ H5VL__native_link_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_ /* Unlink */ if(loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Ldelete */ - if(H5L_delete(&loc, loc_params->loc_data.loc_by_name.name) < 0) + if(H5L__delete(&loc, loc_params->loc_data.loc_by_name.name) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link") } /* end if */ else if(loc_params->type == H5VL_OBJECT_BY_IDX) { /* H5Ldelete_by_idx */ - if(H5L_delete_by_idx(&loc, loc_params->loc_data.loc_by_idx.name, loc_params->loc_data.loc_by_idx.idx_type, + if(H5L__delete_by_idx(&loc, loc_params->loc_data.loc_by_idx.name, loc_params->loc_data.loc_by_idx.idx_type, loc_params->loc_data.loc_by_idx.order, loc_params->loc_data.loc_by_idx.n) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link") } /* end else-if */ diff --git a/src/H5VLnative_object.c b/src/H5VLnative_object.c index 8f60ac4..bfbbee0 100644 --- a/src/H5VLnative_object.c +++ b/src/H5VLnative_object.c @@ -64,7 +64,7 @@ H5VL__native_object_open(void *obj, const H5VL_loc_params_t *loc_params, H5I_typ case H5VL_OBJECT_BY_IDX: { /* Open the object */ - if(NULL == (ret_value = H5O_open_by_idx(&loc, loc_params->loc_data.loc_by_idx.name, loc_params->loc_data.loc_by_idx.idx_type, + if(NULL == (ret_value = H5O__open_by_idx(&loc, loc_params->loc_data.loc_by_idx.name, loc_params->loc_data.loc_by_idx.idx_type, loc_params->loc_data.loc_by_idx.order, loc_params->loc_data.loc_by_idx.n, opened_type))) HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open object by index") break; @@ -80,7 +80,7 @@ H5VL__native_object_open(void *obj, const H5VL_loc_params_t *loc_params, H5I_typ HGOTO_ERROR(H5E_OHDR, H5E_CANTUNSERIALIZE, NULL, "can't deserialize object token into address") /* Open the object */ - if(NULL == (ret_value = H5O_open_by_addr(&loc, addr, opened_type))) + if(NULL == (ret_value = H5O__open_by_addr(&loc, addr, opened_type))) HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open object by address") break; } @@ -122,8 +122,8 @@ H5VL__native_object_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, co HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") /* Copy the object */ - if((ret_value = H5O_copy(&src_loc, src_name, &dst_loc, dst_name, ocpypl_id, lcpl_id)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, FAIL, "unable to copy object") + if((ret_value = H5O__copy(&src_loc, src_name, &dst_loc, dst_name, ocpypl_id, lcpl_id)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object") done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5VM.c b/src/H5VM.c index d12bea6..7be8eab 100644 --- a/src/H5VM.c +++ b/src/H5VM.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, October 10, 1997 */ @@ -34,21 +34,21 @@ typedef struct H5VM_memcpy_ud_t { /* Local prototypes */ static void -H5VM_stride_optimize1(unsigned *np/*in,out*/, hsize_t *elmt_size/*in,out*/, +H5VM__stride_optimize1(unsigned *np/*in,out*/, hsize_t *elmt_size/*in,out*/, const hsize_t *size, hsize_t *stride1); static void -H5VM_stride_optimize2(unsigned *np/*in,out*/, hsize_t *elmt_size/*in,out*/, +H5VM__stride_optimize2(unsigned *np/*in,out*/, hsize_t *elmt_size/*in,out*/, const hsize_t *size, hsize_t *stride1, hsize_t *stride2); #ifdef LATER static void -H5VM_stride_copy2(hsize_t nelmts, hsize_t elmt_size, +H5VM__stride_copy2(hsize_t nelmts, hsize_t elmt_size, unsigned dst_n, const hsize_t *dst_size, const ssize_t *dst_stride, void *_dst, unsigned src_n, const hsize_t *src_size, const ssize_t *src_stride, const void *_src); #endif /* LATER */ /*------------------------------------------------------------------------- - * Function: H5VM_stride_optimize1 + * Function: H5VM__stride_optimize1 * * Purpose: Given a stride vector which references elements of the * specified size, optimize the dimensionality, the stride @@ -63,15 +63,13 @@ H5VM_stride_copy2(hsize_t nelmts, hsize_t elmt_size, * Programmer: Robb Matzke * Saturday, October 11, 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ static void -H5VM_stride_optimize1(unsigned *np/*in,out*/, hsize_t *elmt_size/*in,out*/, +H5VM__stride_optimize1(unsigned *np/*in,out*/, hsize_t *elmt_size/*in,out*/, const hsize_t *size, hsize_t *stride1) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* * This has to be true because if we optimize the dimensionality down to @@ -94,7 +92,7 @@ H5VM_stride_optimize1(unsigned *np/*in,out*/, hsize_t *elmt_size/*in,out*/, /*------------------------------------------------------------------------- - * Function: H5VM_stride_optimize2 + * Function: H5VM__stride_optimize2 * * Purpose: Given two stride vectors which reference elements of the * specified size, optimize the dimensionality, the stride @@ -109,18 +107,13 @@ H5VM_stride_optimize1(unsigned *np/*in,out*/, hsize_t *elmt_size/*in,out*/, * Programmer: Robb Matzke * Saturday, October 11, 1997 * - * Modifications: - * Unrolled loops for common cases - * Quincey Koziol - * ?, ? ?, 2001? - * *------------------------------------------------------------------------- */ static void -H5VM_stride_optimize2(unsigned *np/*in,out*/, hsize_t *elmt_size/*in,out*/, +H5VM__stride_optimize2(unsigned *np/*in,out*/, hsize_t *elmt_size/*in,out*/, const hsize_t *size, hsize_t *stride1, hsize_t *stride2) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* * This has to be true because if we optimize the dimensionality down to @@ -247,11 +240,6 @@ H5VM_stride_optimize2(unsigned *np/*in,out*/, hsize_t *elmt_size/*in,out*/, * Programmer: Robb Matzke * Saturday, October 11, 1997 * - * Modifications: - * Unrolled loops for common cases - * Quincey Koziol - * ?, ? ?, 2001? - * *------------------------------------------------------------------------- */ hsize_t @@ -350,8 +338,6 @@ H5VM_hyper_stride(unsigned n, const hsize_t *size, * Programmer: Robb Matzke * Friday, October 17, 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ htri_t @@ -401,8 +387,6 @@ done: * Programmer: Robb Matzke * Friday, October 10, 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -439,7 +423,7 @@ H5VM_hyper_fill(unsigned n, const hsize_t *_size, /* Compute an optimal destination stride vector */ dst_start = H5VM_hyper_stride(n, size, total_size, offset, dst_stride); - H5VM_stride_optimize1(&n, &elmt_size, size, dst_stride); + H5VM__stride_optimize1(&n, &elmt_size, size, dst_stride); /* Copy */ ret_value = H5VM_stride_fill(n, elmt_size, size, dst_stride, dst+dst_start, @@ -476,11 +460,6 @@ H5VM_hyper_fill(unsigned n, const hsize_t *_size, * Programmer: Robb Matzke * Friday, October 10, 1997 * - * Modifications: - * Unrolled loops for common cases - * Quincey Koziol - * ?, ? ?, 2001? - * *------------------------------------------------------------------------- */ herr_t @@ -624,7 +603,7 @@ H5VM_hyper_copy(unsigned n, const hsize_t *_size, #endif /* NO_INLINED_CODE */ /* Optimize the strides as a pair */ - H5VM_stride_optimize2(&n, &elmt_size, size, dst_stride, src_stride); + H5VM__stride_optimize2(&n, &elmt_size, size, dst_stride, src_stride); /* Perform the copy in terms of stride */ ret_value = H5VM_stride_copy(n, elmt_size, size, @@ -645,8 +624,6 @@ H5VM_hyper_copy(unsigned n, const hsize_t *_size, * Programmer: Robb Matzke * Saturday, October 11, 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -705,8 +682,6 @@ H5VM_stride_fill(unsigned n, hsize_t elmt_size, const hsize_t *size, * Programmer: Robb Matzke * Saturday, October 11, 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -774,8 +749,6 @@ H5VM_stride_copy(unsigned n, hsize_t elmt_size, const hsize_t *size, * Programmer: Robb Matzke * Saturday, October 11, 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -828,7 +801,7 @@ H5VM_stride_copy_s(unsigned n, hsize_t elmt_size, const hsize_t *size, #ifdef LATER /*------------------------------------------------------------------------- - * Function: H5VM_stride_copy2 + * Function: H5VM__stride_copy2 * * Purpose: Similar to H5VM_stride_copy() except the source and * destination each have their own dimensionality and size and @@ -840,12 +813,10 @@ H5VM_stride_copy_s(unsigned n, hsize_t elmt_size, const hsize_t *size, * Programmer: Robb Matzke * Saturday, October 11, 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ static void -H5VM_stride_copy2(hsize_t nelmts, hsize_t elmt_size, +H5VM__stride_copy2(hsize_t nelmts, hsize_t elmt_size, /* destination */ unsigned dst_n, const hsize_t *dst_size, @@ -865,7 +836,7 @@ H5VM_stride_copy2(hsize_t nelmts, hsize_t elmt_size, int j; /* Local index variable */ hbool_t carry; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(elmt_size < SIZET_MAX); HDassert(dst_n>0); @@ -918,8 +889,6 @@ H5VM_stride_copy2(hsize_t nelmts, hsize_t elmt_size, * Programmer: Quincey Koziol * Thursday, June 18, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -975,8 +944,6 @@ H5VM_array_fill(void *_dst, const void *src, size_t size, size_t count) * Programmer: Quincey Koziol * Monday, April 28, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -1056,8 +1023,6 @@ H5VM_array_offset_pre(unsigned n, const hsize_t *acc, const hsize_t *offset) * Programmer: Quincey Koziol * Tuesday, June 22, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ hsize_t @@ -1140,8 +1105,6 @@ H5VM_array_calc_pre(hsize_t offset, unsigned n, const hsize_t *down, * Programmer: Quincey Koziol * Wednesday, April 16, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t diff --git a/src/H5VMprivate.h b/src/H5VMprivate.h index 26f59e2..5c975f6 100644 --- a/src/H5VMprivate.h +++ b/src/H5VMprivate.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, October 10, 1997 */ #ifndef H5VMprivate_H @@ -28,16 +28,16 @@ typedef herr_t (*H5VM_opvv_func_t)(hsize_t dst_off, hsize_t src_off, size_t len, void *udata); /* Vector comparison functions like Fortran66 comparison operators */ -#define H5VM_vector_eq_s(N,V1,V2) (H5VM_vector_cmp_s (N, V1, V2)==0) -#define H5VM_vector_lt_s(N,V1,V2) (H5VM_vector_cmp_s (N, V1, V2)<0) -#define H5VM_vector_gt_s(N,V1,V2) (H5VM_vector_cmp_s (N, V1, V2)>0) -#define H5VM_vector_le_s(N,V1,V2) (H5VM_vector_cmp_s (N, V1, V2)<=0) -#define H5VM_vector_ge_s(N,V1,V2) (H5VM_vector_cmp_s (N, V1, V2)>=0) -#define H5VM_vector_eq_u(N,V1,V2) (H5VM_vector_cmp_u (N, V1, V2)==0) -#define H5VM_vector_lt_u(N,V1,V2) (H5VM_vector_cmp_u (N, V1, V2)<0) -#define H5VM_vector_gt_u(N,V1,V2) (H5VM_vector_cmp_u (N, V1, V2)>0) -#define H5VM_vector_le_u(N,V1,V2) (H5VM_vector_cmp_u (N, V1, V2)<=0) -#define H5VM_vector_ge_u(N,V1,V2) (H5VM_vector_cmp_u (N, V1, V2)>=0) +#define H5VM_vector_eq_s(N,V1,V2) (H5VM_vector_cmp_s(N, V1, V2) == 0) +#define H5VM_vector_lt_s(N,V1,V2) (H5VM_vector_cmp_s(N, V1, V2) < 0) +#define H5VM_vector_gt_s(N,V1,V2) (H5VM_vector_cmp_s(N, V1, V2) > 0) +#define H5VM_vector_le_s(N,V1,V2) (H5VM_vector_cmp_s(N, V1, V2) <= 0) +#define H5VM_vector_ge_s(N,V1,V2) (H5VM_vector_cmp_s(N, V1, V2) >= 0) +#define H5VM_vector_eq_u(N,V1,V2) (H5VM_vector_cmp_u(N, V1, V2) == 0) +#define H5VM_vector_lt_u(N,V1,V2) (H5VM_vector_cmp_u(N, V1, V2) < 0) +#define H5VM_vector_gt_u(N,V1,V2) (H5VM_vector_cmp_u(N, V1, V2) > 0) +#define H5VM_vector_le_u(N,V1,V2) (H5VM_vector_cmp_u(N, V1, V2) <= 0) +#define H5VM_vector_ge_u(N,V1,V2) (H5VM_vector_cmp_u(N, V1, V2) >= 0) /* Other functions */ #define H5VM_vector_cpy(N,DST,SRC) { \ @@ -146,6 +146,10 @@ H5_DLL ssize_t H5VM_memcpyvv(void *_dst, * elements in an array and array dimensions are always of type * size_t. * + * Note: Although this routine is 'static' in this file, that's intended + * only as an optimization and the naming (with a single underscore) + * reflects its inclusion in a "private" header file. + * * Return: Success: Product of elements * * Failure: 1 if N is zero @@ -153,8 +157,6 @@ H5_DLL ssize_t H5VM_memcpyvv(void *_dst, * Programmer: Robb Matzke * Friday, October 10, 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ static H5_INLINE hsize_t H5_ATTR_UNUSED @@ -177,6 +179,10 @@ done: * * Purpose: Determines if all elements of a vector are zero. * + * Note: Although this routine is 'static' in this file, that's intended + * only as an optimization and the naming (with a single underscore) + * reflects its inclusion in a "private" header file. + * * Return: Success: TRUE if all elements are zero, * FALSE otherwise * @@ -185,8 +191,6 @@ done: * Programmer: Robb Matzke * Friday, October 10, 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ static H5_INLINE htri_t H5_ATTR_UNUSED @@ -212,6 +216,10 @@ done: * * Purpose: Determines if all elements of a vector are zero. * + * Note: Although this routine is 'static' in this file, that's intended + * only as an optimization and the naming (with a single underscore) + * reflects its inclusion in a "private" header file. + * * Return: Success: TRUE if all elements are zero, * FALSE otherwise * @@ -220,8 +228,6 @@ done: * Programmer: Robb Matzke * Friday, October 10, 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ static H5_INLINE htri_t H5_ATTR_UNUSED @@ -248,6 +254,10 @@ done: * Purpose: Compares two vectors of the same size and determines if V1 is * lexicographically less than, equal, or greater than V2. * + * Note: Although this routine is 'static' in this file, that's intended + * only as an optimization and the naming (with a single underscore) + * reflects its inclusion in a "private" header file. + * * Return: Success: -1 if V1 is less than V2 * 0 if they are equal * 1 if V1 is greater than V2 @@ -257,12 +267,10 @@ done: * Programmer: Robb Matzke * Friday, October 10, 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ static H5_INLINE int H5_ATTR_UNUSED -H5VM_vector_cmp_u (unsigned n, const hsize_t *v1, const hsize_t *v2) +H5VM_vector_cmp_u(unsigned n, const hsize_t *v1, const hsize_t *v2) { int ret_value=0; /* Return value */ @@ -290,6 +298,10 @@ done: * Purpose: Compares two vectors of the same size and determines if V1 is * lexicographically less than, equal, or greater than V2. * + * Note: Although this routine is 'static' in this file, that's intended + * only as an optimization and the naming (with a single underscore) + * reflects its inclusion in a "private" header file. + * * Return: Success: -1 if V1 is less than V2 * 0 if they are equal * 1 if V1 is greater than V2 @@ -299,12 +311,10 @@ done: * Programmer: Robb Matzke * Wednesday, April 8, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ static H5_INLINE int H5_ATTR_UNUSED -H5VM_vector_cmp_s (unsigned n, const hssize_t *v1, const hssize_t *v2) +H5VM_vector_cmp_s(unsigned n, const hssize_t *v1, const hssize_t *v2) { int ret_value=0; /* Return value */ @@ -331,13 +341,15 @@ done: * * Purpose: Increments V1 by V2 * + * Note: Although this routine is 'static' in this file, that's intended + * only as an optimization and the naming (with a single underscore) + * reflects its inclusion in a "private" header file. + * * Return: void * * Programmer: Robb Matzke * Monday, October 13, 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ static H5_INLINE void H5_ATTR_UNUSED @@ -380,6 +392,10 @@ static const unsigned char LogTable256[] = * The version on the web-site is for 32-bit quantities and this * version has been extended for 64-bit quantities. * + * Note: Although this routine is 'static' in this file, that's intended + * only as an optimization and the naming (with a single underscore) + * reflects its inclusion in a "private" header file. + * * Return: log2(n) (always - no failure condition) * * Programmer: Quincey Koziol @@ -428,6 +444,10 @@ static const unsigned MultiplyDeBruijnBitPosition[32] = * This is from the "Bit Twiddling Hacks" at: * http://graphics.stanford.edu/~seander/bithacks.html#IntegerLogDeBruijn * + * Note: Although this routine is 'static' in this file, that's intended + * only as an optimization and the naming (with a single underscore) + * reflects its inclusion in a "private" header file. + * * Return: log2(n) (always - no failure condition) * * Programmer: Quincey Koziol @@ -450,6 +470,10 @@ H5VM_log2_of2(uint32_t n) * * Purpose: Round up a number to the next power of 2 * + * Note: Although this routine is 'static' in this file, that's intended + * only as an optimization and the naming (with a single underscore) + * reflects its inclusion in a "private" header file. + * * Return: Return the number which is a power of 2 * * Programmer: Vailin Choi; Nov 2014 @@ -478,6 +502,10 @@ H5VM_power2up(hsize_t n) * Purpose: Determine the # of bytes needed to encode values within a * range from 0 to a given limit * + * Note: Although this routine is 'static' in this file, that's intended + * only as an optimization and the naming (with a single underscore) + * reflects its inclusion in a "private" header file. + * * Return: Number of bytes needed * * Programmer: Quincey Koziol @@ -507,6 +535,10 @@ static const unsigned char H5VM_bit_clear_g[8] = {0x7F, 0xBF, 0xDF, 0xEF, 0xF7, * to bit offset 7 in the first byte's low-bit position, then to * bit offset 8 in the second byte's high-bit position, etc. * + * Note: Although this routine is 'static' in this file, that's intended + * only as an optimization and the naming (with a single underscore) + * reflects its inclusion in a "private" header file. + * * Return: TRUE/FALSE * * Programmer: Quincey Koziol @@ -534,6 +566,10 @@ H5VM_bit_get(const unsigned char *buf, size_t offset) * to bit offset 7 in the first byte's low-bit position, then to * bit offset 8 in the second byte's high-bit position, etc. * + * Note: Although this routine is 'static' in this file, that's intended + * only as an optimization and the naming (with a single underscore) + * reflects its inclusion in a "private" header file. + * * Return: None * * Programmer: Quincey Koziol diff --git a/src/H5WB.c b/src/H5WB.c index 8a85a3a..abeaf63 100644 --- a/src/H5WB.c +++ b/src/H5WB.c @@ -15,7 +15,7 @@ * * Created: H5WB.c * Jun 26 2007 - * Quincey Koziol + * Quincey Koziol * * Purpose: Implements the "wrapped buffer" code for wrapping * an existing [staticly sized] buffer, in order to @@ -97,7 +97,6 @@ H5FL_BLK_DEFINE_STATIC(extra_buf); * NULL on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jun 26 2007 * *------------------------------------------------------------------------- @@ -151,7 +150,6 @@ done: * NULL on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jun 26 2007 * *------------------------------------------------------------------------- @@ -219,7 +217,6 @@ done: * NULL on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jun 26 2007 * *------------------------------------------------------------------------- @@ -257,7 +254,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jun 26 2007 * *------------------------------------------------------------------------- diff --git a/src/H5WBprivate.h b/src/H5WBprivate.h index 4460808..3ec9261 100644 --- a/src/H5WBprivate.h +++ b/src/H5WBprivate.h @@ -15,7 +15,7 @@ * * Created: H5WBprivate.h * Jun 26 2007 - * Quincey Koziol + * Quincey Koziol * * Purpose: Private header for library accessible wrapped buffer routines. * diff --git a/src/H5Z.c b/src/H5Z.c index 2f477a3..5c1cfd6 100644 --- a/src/H5Z.c +++ b/src/H5Z.c @@ -35,10 +35,10 @@ #ifdef H5Z_DEBUG typedef struct H5Z_stats_t { struct { - hsize_t total; /* total number of bytes processed */ - hsize_t errors; /* bytes of total attributable to errors */ - H5_timer_t timer; /* execution time including errors */ - } stats[2]; /* 0=output, 1=input */ + hsize_t total; /* total number of bytes processed */ + hsize_t errors; /* bytes of total attributable to errors */ + H5_timevals_t times; /* execution time including errors */ + } stats[2]; /* 0 = output, 1 = input */ } H5Z_stats_t; #endif /* H5Z_DEBUG */ @@ -68,7 +68,7 @@ static H5Z_stats_t *H5Z_stat_table_g = NULL; #endif /* H5Z_DEBUG */ /* Local functions */ -static int H5Z_find_idx(H5Z_filter_t id); +static int H5Z__find_idx(H5Z_filter_t id); static int H5Z__check_unregister_dset_cb(void *obj_ptr, hid_t obj_id, void *key); static int H5Z__check_unregister_group_cb(void *obj_ptr, hid_t obj_id, void *key); static int H5Z__flush_file_cb(void *obj_ptr, hid_t obj_id, void *key); @@ -132,9 +132,9 @@ H5Z_term_package(void) if(H5_PKG_INIT_VAR) { #ifdef H5Z_DEBUG - char comment[16], bandwidth[32]; - int dir, nprint = 0; - size_t i; + char comment[16], bandwidth[32]; + int dir, nprint = 0; + size_t i; if(H5DEBUG(Z)) { for(i = 0; i < H5Z_table_used_g; i++) { @@ -167,25 +167,26 @@ H5Z_term_package(void) */ H5_bandwidth(bandwidth, (double)(H5Z_stat_table_g[i].stats[dir].total), - H5Z_stat_table_g[i].stats[dir].timer.etime); + H5Z_stat_table_g[i].stats[dir].times.elapsed); /* Print the statistics */ - HDfprintf(H5DEBUG(Z), - " %s%-15s %10Hd %10Hd %8.2f %8.2f %8.2f " - "%10s\n", dir?"<":">", comment, + HDfprintf(H5DEBUG(Z), " %s%-15s %10Hd %10Hd %8T %8T %8T %10s\n", + (dir ? "<" : ">"), comment, H5Z_stat_table_g[i].stats[dir].total, H5Z_stat_table_g[i].stats[dir].errors, - H5Z_stat_table_g[i].stats[dir].timer.utime, - H5Z_stat_table_g[i].stats[dir].timer.stime, - H5Z_stat_table_g[i].stats[dir].timer.etime, + H5Z_stat_table_g[i].stats[dir].times.user, + H5Z_stat_table_g[i].stats[dir].times.system, + H5Z_stat_table_g[i].stats[dir].times.elapsed, bandwidth); } /* end for */ } /* end for */ } /* end if */ #endif /* H5Z_DEBUG */ + /* Free the table of filters */ - if (H5Z_table_g) { + if(H5Z_table_g) { H5Z_table_g = (H5Z_class2_t *)H5MM_xfree(H5Z_table_g); + #ifdef H5Z_DEBUG H5Z_stat_table_g = (H5Z_stats_t *)H5MM_xfree(H5Z_stat_table_g); #endif /* H5Z_DEBUG */ @@ -345,8 +346,8 @@ done: * * Purpose: This function unregisters a filter. * - * Return: SUCCEED/FAIL - * + * Return: Non-negative on success + * Negative on failure *------------------------------------------------------------------------- */ herr_t @@ -712,7 +713,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5Z_prelude_callback + * Function: H5Z__prelude_callback * * Purpose: Makes a dataset creation "prelude" callback for the "can_apply" * or "set_local" routines. @@ -725,14 +726,14 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5Z_prelude_callback(const H5O_pline_t *pline, hid_t dcpl_id, hid_t type_id, +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 */ htri_t ret_value = TRUE; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(pline->nused > 0); @@ -790,11 +791,11 @@ H5Z_prelude_callback(const H5O_pline_t *pline, hid_t dcpl_id, hid_t type_id, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5Z_prelude_callback() */ +} /* end H5Z__prelude_callback() */ /*------------------------------------------------------------------------- - * Function: H5Z_prepare_prelude_callback_dcpl + * Function: H5Z__prepare_prelude_callback_dcpl * * Purpose: Prepares to make a dataset creation "prelude" callback * for the "can_apply" or "set_local" routines. @@ -807,13 +808,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5Z_prepare_prelude_callback_dcpl(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 */ H5O_layout_t *dcpl_layout = NULL; /* Dataset's layout information */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(H5I_GENPROP_LST == H5I_get_type(dcpl_id)); HDassert(H5I_DATATYPE == H5I_get_type(type_id)); @@ -861,7 +862,7 @@ H5Z_prepare_prelude_callback_dcpl(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type } /* Make the callbacks */ - if (H5Z_prelude_callback(&dcpl_pline, dcpl_id, type_id, space_id, prelude_type) < 0) + 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") } } @@ -875,7 +876,7 @@ done: dcpl_layout = (H5O_layout_t *)H5MM_xfree(dcpl_layout); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5Z_prepare_prelude_callback_dcpl() */ +} /* end H5Z__prepare_prelude_callback_dcpl() */ /*------------------------------------------------------------------------- @@ -901,7 +902,7 @@ H5Z_can_apply(hid_t dcpl_id, hid_t type_id) FUNC_ENTER_NOAPI(FAIL) /* Make "can apply" callbacks for filters in pipeline */ - if (H5Z_prepare_prelude_callback_dcpl(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: @@ -932,7 +933,7 @@ H5Z_set_local(hid_t dcpl_id, hid_t type_id) FUNC_ENTER_NOAPI(FAIL) /* Make "set local" callbacks for filters in pipeline */ - if (H5Z_prepare_prelude_callback_dcpl(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: @@ -961,7 +962,7 @@ H5Z_can_apply_direct(const H5O_pline_t *pline) HDassert(pline->nused > 0); /* Make "can apply" callbacks for filters in pipeline */ - if (H5Z_prelude_callback(pline, (hid_t)-1, (hid_t)-1, (hid_t)-1, H5Z_PRELUDE_CAN_APPLY) < 0) + if (H5Z__prelude_callback(pline, (hid_t)-1, (hid_t)-1, (hid_t)-1, H5Z_PRELUDE_CAN_APPLY) < 0) HGOTO_ERROR(H5E_PLINE, H5E_CANAPPLY, FAIL, "unable to apply filter") done: @@ -994,7 +995,7 @@ H5Z_set_local_direct(const H5O_pline_t *pline) HDassert(pline->nused > 0); /* Make "set local" callbacks for filters in pipeline */ - if (H5Z_prelude_callback(pline, (hid_t)-1, (hid_t)-1, (hid_t)-1, H5Z_PRELUDE_SET_LOCAL) < 0) + if (H5Z__prelude_callback(pline, (hid_t)-1, (hid_t)-1, (hid_t)-1, H5Z_PRELUDE_SET_LOCAL) < 0) HGOTO_ERROR(H5E_PLINE, H5E_SETLOCAL, FAIL, "local filter parameters not set") done: @@ -1003,6 +1004,73 @@ done: /*------------------------------------------------------------------------- + * Function: H5Z_ignore_filters + * + * Purpose: Determine whether filters can be ignored. + * + * Description: + * When the filters are optional (i.e., H5Z_FLAG_OPTIONAL is provided,) + * if any of the following conditions is met, the filters will be ignored: + * - dataspace is either H5S_NULL or H5S_SCALAR + * - datatype is variable-length (string or non-string) + * However, if any of these conditions exists and a filter is not + * optional, the function will produce an error. + * + * Return: Non-negative(TRUE/FALSE) on success + * Negative on failure + * + *------------------------------------------------------------------------- + */ +htri_t +H5Z_ignore_filters(hid_t dcpl_id, const H5T_t *type, const H5S_t *space) +{ + H5P_genplist_t *dc_plist; /* Dataset creation property list object */ + H5O_pline_t pline; /* Object's I/O pipeline information */ + H5S_class_t space_class; /* To check class of space */ + H5T_class_t type_class; /* To check if type is VL */ + bool bad_for_filters = FALSE;/* Suitable to have filters */ + htri_t ret_value = FALSE; /* TRUE for ignoring filters */ + + FUNC_ENTER_NOAPI(FAIL) + + if (NULL == (dc_plist = (H5P_genplist_t *)H5I_object(dcpl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get dataset creation property list") + + /* Get pipeline information */ + if (H5P_peek(dc_plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) + HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "can't retrieve pipeline filter") + + /* Get datatype and dataspace classes for quick access */ + space_class = H5S_GET_EXTENT_TYPE(space); + type_class = H5T_get_class(type, FALSE); + + /* These conditions are not suitable for filters */ + bad_for_filters = (H5S_NULL == space_class || H5S_SCALAR == space_class + || H5T_VLEN == type_class + || (H5T_STRING == type_class && TRUE == H5T_is_variable_str(type))); + + /* When these conditions occur, if there are required filters in pline, + then report a failure, otherwise, set flag that they can be ignored */ + if (bad_for_filters) { + size_t ii; + if (pline.nused > 0) { + for (ii = 0; ii < pline.nused; ii++) + { + if (!(pline.filter[ii].flags & H5Z_FLAG_OPTIONAL)) + HGOTO_ERROR(H5E_PLINE, H5E_CANTFILTER, FAIL, "not suitable for filters") + } + + /* All filters are optional, we can ignore them */ + ret_value = TRUE; + } + } /* bad for filters */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5Z_ignore_filters() */ + + +/*------------------------------------------------------------------------- * Function: H5Z_modify * * Purpose: Modify filter parameters for specified pipeline. @@ -1167,7 +1235,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5Z_find_idx + * Function: H5Z__find_idx * * Purpose: Given a filter ID return the offset in the global array * that holds all the registered filters. @@ -1177,20 +1245,20 @@ done: *------------------------------------------------------------------------- */ static int -H5Z_find_idx(H5Z_filter_t id) +H5Z__find_idx(H5Z_filter_t id) { size_t i; /* Local index variable */ int ret_value = FAIL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR - for (i = 0; i < H5Z_table_used_g; i++) - if (H5Z_table_g[i].id == id) + for(i = 0; i < H5Z_table_used_g; i++) + if(H5Z_table_g[i].id == id) HGOTO_DONE((int)i) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5Z_find_idx() */ +} /* end H5Z__find_idx() */ /*------------------------------------------------------------------------- @@ -1212,7 +1280,7 @@ H5Z_find(H5Z_filter_t id) FUNC_ENTER_NOAPI(NULL) /* Get the index in the global table */ - if ((idx = H5Z_find_idx(id)) < 0) + if ((idx = H5Z__find_idx(id)) < 0) HGOTO_ERROR(H5E_PLINE, H5E_NOTFOUND, NULL, "required filter %d is not registered", id) /* Set return value */ @@ -1248,20 +1316,22 @@ done: */ herr_t H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, - unsigned *filter_mask/*in,out*/, H5Z_EDC_t edc_read, - H5Z_cb_t cb_struct, size_t *nbytes/*in,out*/, - size_t *buf_size/*in,out*/, void **buf/*in,out*/) + unsigned *filter_mask/*in,out*/, H5Z_EDC_t edc_read, H5Z_cb_t cb_struct, + size_t *nbytes/*in,out*/, size_t *buf_size/*in,out*/, void **buf/*in,out*/) { - size_t i, idx, new_nbytes; - int fclass_idx; /* Index of filter class in global table */ - H5Z_class2_t *fclass=NULL; /* Filter class pointer */ + size_t idx; + size_t new_nbytes; + int fclass_idx; /* Index of filter class in global table */ + H5Z_class2_t *fclass = NULL; /* Filter class pointer */ #ifdef H5Z_DEBUG - H5Z_stats_t *fstats=NULL; /* Filter stats pointer */ - H5_timer_t timer; + H5Z_stats_t *fstats = NULL; /* Filter stats pointer */ + H5_timer_t timer; /* Timer for filter operations */ + H5_timevals_t times; /* Elapsed time for each operation */ #endif - unsigned failed = 0; - unsigned tmp_flags; - herr_t ret_value = SUCCEED; /* Return value */ + unsigned failed = 0; + unsigned tmp_flags; + size_t i; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1272,11 +1342,13 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, HDassert(buf && *buf); HDassert(!pline || pline->nused < H5Z_MAX_NFILTERS); - if (pline && (flags & H5Z_FLAG_REVERSE)) { /* Read */ - for (i = pline->nused; i > 0; --i) { - idx = i-1; - - if (*filter_mask & ((unsigned)1 << idx)) { +#ifdef H5Z_DEBUG + H5_timer_init(&timer); +#endif + if(pline && (flags & H5Z_FLAG_REVERSE)) { /* Read */ + for(i = pline->nused; i > 0; --i) { + idx = i - 1; + if(*filter_mask & ((unsigned)1 << idx)) { failed |= (unsigned)1 << idx; continue; /* filter excluded */ } @@ -1285,10 +1357,10 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, * indicate no plugin through HDF5_PRELOAD_PLUG (using the symbol "::"), * try to load it dynamically and register it. Otherwise, return failure */ - if ((fclass_idx = H5Z_find_idx(pline->filter[idx].id)) < 0) { - hbool_t issue_error = FALSE; + if ((fclass_idx = H5Z__find_idx(pline->filter[idx].id)) < 0) { H5PL_key_t key; const H5Z_class2_t *filter_info; + hbool_t issue_error = FALSE; /* Try loading the filter */ key.id = (int)(pline->filter[idx].id); @@ -1298,7 +1370,7 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register filter") /* Search in the table of registered filters again to find the dynamic filter just loaded and registered */ - if ((fclass_idx = H5Z_find_idx(pline->filter[idx].id)) < 0) + if((fclass_idx = H5Z__find_idx(pline->filter[idx].id)) < 0) issue_error = TRUE; } else @@ -1316,76 +1388,96 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, } /* end if */ fclass = &H5Z_table_g[fclass_idx]; + #ifdef H5Z_DEBUG fstats = &H5Z_stat_table_g[fclass_idx]; - H5_timer_begin (&timer); + H5_timer_start(&timer); #endif + tmp_flags = flags | (pline->filter[idx].flags); - tmp_flags |= (edc_read== H5Z_DISABLE_EDC) ? H5Z_FLAG_SKIP_EDC : 0; - new_nbytes = (fclass->filter)(tmp_flags, pline->filter[idx].cd_nelmts, - pline->filter[idx].cd_values, *nbytes, buf_size, buf); + tmp_flags |= (edc_read == H5Z_DISABLE_EDC) ? H5Z_FLAG_SKIP_EDC : 0; + new_nbytes = (fclass->filter)(tmp_flags, + pline->filter[idx].cd_nelmts, pline->filter[idx].cd_values, + *nbytes, buf_size, buf); #ifdef H5Z_DEBUG - H5_timer_end (&(fstats->stats[1].timer), &timer); + H5_timer_stop(&timer); + H5_timer_get_times(timer, ×); + fstats->stats[1].times.elapsed += times.elapsed; + fstats->stats[1].times.system += times.system; + fstats->stats[1].times.user += times.user; + fstats->stats[1].total += MAX(*nbytes, new_nbytes); - if (0 == new_nbytes) + if(0 == new_nbytes) fstats->stats[1].errors += *nbytes; #endif - if (0 == new_nbytes) { - if ((cb_struct.func && (H5Z_CB_FAIL == cb_struct.func(pline->filter[idx].id, *buf, *buf_size, cb_struct.op_data))) || !cb_struct.func) + if(0 == new_nbytes) { + if((cb_struct.func + && (H5Z_CB_FAIL == cb_struct.func(pline->filter[idx].id, *buf, *buf_size, cb_struct.op_data))) + || !cb_struct.func) HGOTO_ERROR(H5E_PLINE, H5E_READERROR, FAIL, "filter returned failure during read") *nbytes = *buf_size; failed |= (unsigned)1 << idx; - H5E_clear_stack (NULL); + H5E_clear_stack(NULL); } else *nbytes = new_nbytes; } } - else if (pline) { /* Write */ - for (idx = 0; idx < pline->nused; idx++) { - if (*filter_mask & ((unsigned)1 << idx)) { + else if(pline) { /* Write */ + for(idx = 0; idx < pline->nused; idx++) { + if(*filter_mask & ((unsigned)1 << idx)) { failed |= (unsigned)1 << idx; - continue; /*filter excluded*/ + continue; /* filter excluded */ } - if ((fclass_idx = H5Z_find_idx(pline->filter[idx].id)) < 0) { + if((fclass_idx = H5Z__find_idx(pline->filter[idx].id)) < 0) { /* Check if filter is optional -- If it isn't, then error */ - if ((pline->filter[idx].flags & H5Z_FLAG_OPTIONAL) == 0) + if((pline->filter[idx].flags & H5Z_FLAG_OPTIONAL) == 0) HGOTO_ERROR(H5E_PLINE, H5E_WRITEERROR, FAIL, "required filter is not registered") - failed |= (unsigned)1 << idx; - H5E_clear_stack (NULL); - continue; /*filter excluded*/ - } + H5E_clear_stack(NULL); + continue; /* filter excluded */ + } /* end if */ + fclass = &H5Z_table_g[fclass_idx]; + #ifdef H5Z_DEBUG fstats = &H5Z_stat_table_g[fclass_idx]; - H5_timer_begin (&timer); + H5_timer_start(&timer); #endif - new_nbytes = (fclass->filter)(flags | (pline->filter[idx].flags), pline->filter[idx].cd_nelmts, - pline->filter[idx].cd_values, *nbytes, buf_size, buf); + + new_nbytes = (fclass->filter)(flags | (pline->filter[idx].flags), + pline->filter[idx].cd_nelmts, pline->filter[idx].cd_values, + *nbytes, buf_size, buf); + #ifdef H5Z_DEBUG - H5_timer_end (&(fstats->stats[0].timer), &timer); + H5_timer_stop(&timer); + H5_timer_get_times(timer, ×); + fstats->stats[0].times.elapsed += times.elapsed; + fstats->stats[0].times.system += times.system; + fstats->stats[0].times.user += times.user; + fstats->stats[0].total += MAX(*nbytes, new_nbytes); - if (0 == new_nbytes) + if(0 == new_nbytes) fstats->stats[0].errors += *nbytes; #endif - if (0 == new_nbytes) { - if (0 == (pline->filter[idx].flags & H5Z_FLAG_OPTIONAL)) { - if ((cb_struct.func && (H5Z_CB_FAIL == cb_struct.func (pline->filter[idx].id, *buf, *nbytes, cb_struct.op_data))) || !cb_struct.func) + + if(0 == new_nbytes) { + if(0 == (pline->filter[idx].flags & H5Z_FLAG_OPTIONAL)) { + if((cb_struct.func && (H5Z_CB_FAIL == cb_struct.func(pline->filter[idx].id, *buf, *nbytes, cb_struct.op_data))) + || !cb_struct.func) HGOTO_ERROR(H5E_PLINE, H5E_WRITEERROR, FAIL, "filter returned failure") *nbytes = *buf_size; } - failed |= (unsigned)1 << idx; - H5E_clear_stack (NULL); + H5E_clear_stack(NULL); } else *nbytes = new_nbytes; - } + } /* end for */ } *filter_mask = failed; diff --git a/src/H5Zdeflate.c b/src/H5Zdeflate.c index 6d7b87e..d46108f 100644 --- a/src/H5Zdeflate.c +++ b/src/H5Zdeflate.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, August 27, 1999 */ @@ -34,26 +34,26 @@ #endif /* Local function prototypes */ -static size_t H5Z_filter_deflate (unsigned flags, size_t cd_nelmts, +static size_t H5Z__filter_deflate (unsigned flags, size_t cd_nelmts, const unsigned cd_values[], size_t nbytes, size_t *buf_size, void **buf); /* This message derives from H5Z */ const H5Z_class2_t H5Z_DEFLATE[1] = {{ - H5Z_CLASS_T_VERS, /* H5Z_class_t version */ + H5Z_CLASS_T_VERS, /* H5Z_class_t version */ H5Z_FILTER_DEFLATE, /* Filter id number */ - 1, /* encoder_present flag (set to true) */ - 1, /* decoder_present flag (set to true) */ - "deflate", /* Filter name for debugging */ + 1, /* encoder_present flag (set to true) */ + 1, /* decoder_present flag (set to true) */ + "deflate", /* Filter name for debugging */ NULL, /* The "can apply" callback */ NULL, /* The "set local" callback */ - H5Z_filter_deflate, /* The actual filter function */ + H5Z__filter_deflate, /* The actual filter function */ }}; #define H5Z_DEFLATE_SIZE_ADJUST(s) (HDceil(((double)(s)) * (double)1.001f) + 12) /*------------------------------------------------------------------------- - * Function: H5Z_filter_deflate + * Function: H5Z__filter_deflate * * Purpose: Implement an I/O filter around the 'deflate' algorithm in * libz @@ -64,12 +64,10 @@ const H5Z_class2_t H5Z_DEFLATE[1] = {{ * Programmer: Robb Matzke * Thursday, April 16, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ static size_t -H5Z_filter_deflate (unsigned flags, size_t cd_nelmts, +H5Z__filter_deflate(unsigned flags, size_t cd_nelmts, const unsigned cd_values[], size_t nbytes, size_t *buf_size, void **buf) { @@ -77,7 +75,7 @@ H5Z_filter_deflate (unsigned flags, size_t cd_nelmts, int status; /* Status from zlib operation */ size_t ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI(0) + FUNC_ENTER_STATIC /* Sanity check */ HDassert(*buf_size > 0); diff --git a/src/H5Zfletcher32.c b/src/H5Zfletcher32.c index 4d75d14..07e2f79 100644 --- a/src/H5Zfletcher32.c +++ b/src/H5Zfletcher32.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Jan 3, 2003 */ @@ -26,26 +26,26 @@ #include "H5Zpkg.h" /* Data filters */ /* Local function prototypes */ -static size_t H5Z_filter_fletcher32 (unsigned flags, size_t cd_nelmts, +static size_t H5Z__filter_fletcher32(unsigned flags, size_t cd_nelmts, const unsigned cd_values[], size_t nbytes, size_t *buf_size, void **buf); /* This message derives from H5Z */ const H5Z_class2_t H5Z_FLETCHER32[1] = {{ - H5Z_CLASS_T_VERS, /* H5Z_class_t version */ + H5Z_CLASS_T_VERS, /* H5Z_class_t version */ H5Z_FILTER_FLETCHER32, /* Filter id number */ - 1, /* encoder_present flag (set to true) */ - 1, /* decoder_present flag (set to true) */ + 1, /* encoder_present flag (set to true) */ + 1, /* decoder_present flag (set to true) */ "fletcher32", /* Filter name for debugging */ NULL, /* The "can apply" callback */ NULL, /* The "set local" callback */ - H5Z_filter_fletcher32, /* The actual filter function */ + H5Z__filter_fletcher32, /* The actual filter function */ }}; #define FLETCHER_LEN 4 /*------------------------------------------------------------------------- - * Function: H5Z_filter_fletcher32 + * Function: H5Z__filter_fletcher32 * * Purpose: Implement an I/O filter of Fletcher32 Checksum * @@ -55,21 +55,10 @@ const H5Z_class2_t H5Z_FLETCHER32[1] = {{ * Programmer: Raymond Lu * Jan 3, 2003 * - * Modifications: - * Raymond Lu - * July 8, 2005 - * There was a bug in the calculating code of the Fletcher32 - * checksum in the library before v1.6.3. The checksum - * value wasn't consistent between big-endian and little-endian - * systems. This bug was fixed in Release 1.6.3. However, - * after fixing the bug, the checksum value is no longer the - * same as before on little-endian system. We'll check both - * the correct checksum and the wrong checksum to be consistent - * with Release 1.6.2 and before. *------------------------------------------------------------------------- */ static size_t -H5Z_filter_fletcher32 (unsigned flags, size_t H5_ATTR_UNUSED cd_nelmts, const unsigned H5_ATTR_UNUSED cd_values[], +H5Z__filter_fletcher32(unsigned flags, size_t H5_ATTR_UNUSED cd_nelmts, const unsigned H5_ATTR_UNUSED cd_values[], size_t nbytes, size_t *buf_size, void **buf) { void *outbuf = NULL; /* Pointer to new buffer */ @@ -80,7 +69,7 @@ H5Z_filter_fletcher32 (unsigned flags, size_t H5_ATTR_UNUSED cd_nelmts, const un uint8_t tmp; size_t ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI(0) + FUNC_ENTER_STATIC HDassert(sizeof(uint32_t)>=4); diff --git a/src/H5Zmodule.h b/src/H5Zmodule.h index 97e158c..e4fd90c 100644 --- a/src/H5Zmodule.h +++ b/src/H5Zmodule.h @@ -11,7 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, September 12, 2015 * * Purpose: This file contains declarations which define macros for the diff --git a/src/H5Znbit.c b/src/H5Znbit.c index 8c0e876..d29343b 100644 --- a/src/H5Znbit.c +++ b/src/H5Znbit.c @@ -34,34 +34,34 @@ typedef struct { } parms_atomic; /* Local function prototypes */ -static htri_t H5Z_can_apply_nbit(hid_t dcpl_id, hid_t type_id, hid_t space_id); -static herr_t H5Z_set_local_nbit(hid_t dcpl_id, hid_t type_id, hid_t space_id); -static size_t H5Z_filter_nbit(unsigned flags, size_t cd_nelmts, const unsigned cd_values[], +static htri_t H5Z__can_apply_nbit(hid_t dcpl_id, hid_t type_id, hid_t space_id); +static herr_t H5Z__set_local_nbit(hid_t dcpl_id, hid_t type_id, hid_t space_id); +static size_t H5Z__filter_nbit(unsigned flags, size_t cd_nelmts, const unsigned cd_values[], size_t nbytes, size_t *buf_size, void **buf); -static void H5Z_calc_parms_nooptype(size_t *cd_values_actual_nparms); -static void H5Z_calc_parms_atomic(size_t *cd_values_actual_nparms); -static herr_t H5Z_calc_parms_array(const H5T_t *type, size_t *cd_values_actual_nparms); -static herr_t H5Z_calc_parms_compound(const H5T_t *type, size_t *cd_values_actual_nparms); +static void H5Z__calc_parms_nooptype(size_t *cd_values_actual_nparms); +static void H5Z__calc_parms_atomic(size_t *cd_values_actual_nparms); +static herr_t H5Z__calc_parms_array(const H5T_t *type, size_t *cd_values_actual_nparms); +static herr_t H5Z__calc_parms_compound(const H5T_t *type, size_t *cd_values_actual_nparms); -static herr_t H5Z_set_parms_nooptype(const H5T_t *type, unsigned *cd_values_index, +static herr_t H5Z__set_parms_nooptype(const H5T_t *type, unsigned *cd_values_index, unsigned cd_values[]); -static herr_t H5Z_set_parms_atomic(const H5T_t *type, unsigned *cd_values_index, +static herr_t H5Z__set_parms_atomic(const H5T_t *type, unsigned *cd_values_index, unsigned cd_values[], hbool_t *need_not_compress); -static herr_t H5Z_set_parms_array(const H5T_t *type, unsigned *cd_values_index, +static herr_t H5Z__set_parms_array(const H5T_t *type, unsigned *cd_values_index, unsigned cd_values[], hbool_t *need_not_compress); -static herr_t H5Z_set_parms_compound(const H5T_t *type, unsigned *cd_values_index, +static herr_t H5Z__set_parms_compound(const H5T_t *type, unsigned *cd_values_index, unsigned cd_values[], hbool_t *need_not_compress); -static void H5Z_nbit_next_byte(size_t *j, size_t *buf_len); -static void H5Z_nbit_decompress_one_byte(unsigned char *data, size_t data_offset, +static void H5Z__nbit_next_byte(size_t *j, size_t *buf_len); +static void H5Z__nbit_decompress_one_byte(unsigned char *data, size_t data_offset, unsigned k, unsigned begin_i, unsigned end_i, unsigned char *buffer, size_t *j, size_t *buf_len, const parms_atomic *p, size_t datatype_len); -static void H5Z_nbit_compress_one_byte(unsigned char *data, size_t data_offset, unsigned k, unsigned begin_i, +static void H5Z__nbit_compress_one_byte(unsigned char *data, size_t data_offset, unsigned k, unsigned begin_i, unsigned end_i, unsigned char *buffer, size_t *j, size_t *buf_len, const parms_atomic *p, size_t datatype_len); -static void H5Z_nbit_decompress_one_nooptype(unsigned char *data, size_t data_offset, +static void H5Z__nbit_decompress_one_nooptype(unsigned char *data, size_t data_offset, unsigned char *buffer, size_t *j, size_t *buf_len, unsigned size); -static void H5Z_nbit_decompress_one_atomic(unsigned char *data, size_t data_offset, +static void H5Z__nbit_decompress_one_atomic(unsigned char *data, size_t data_offset, unsigned char *buffer, size_t *j, size_t *buf_len, const parms_atomic *p); static herr_t H5Z__nbit_decompress_one_array(unsigned char *data, size_t data_offset, unsigned char *buffer, size_t *j, size_t *buf_len, const unsigned parms[], @@ -71,29 +71,27 @@ static herr_t H5Z__nbit_decompress_one_compound(unsigned char *data, size_t data unsigned *parms_index); static herr_t H5Z__nbit_decompress(unsigned char *data, unsigned d_nelmts, unsigned char *buffer, const unsigned parms[]); -static void H5Z_nbit_compress_one_nooptype(unsigned char *data, size_t data_offset, +static void H5Z__nbit_compress_one_nooptype(unsigned char *data, size_t data_offset, unsigned char *buffer, size_t *j, size_t *buf_len, unsigned size); -static void H5Z_nbit_compress_one_atomic(unsigned char *data, size_t data_offset, - unsigned char *buffer, size_t *j, size_t *buf_len, const parms_atomic *p); -static void H5Z_nbit_compress_one_array(unsigned char *data, size_t data_offset, +static void H5Z__nbit_compress_one_array(unsigned char *data, size_t data_offset, unsigned char *buffer, size_t *j, size_t *buf_len, const unsigned parms[], unsigned *parms_index); -static void H5Z_nbit_compress_one_compound(unsigned char *data, size_t data_offset, +static void H5Z__nbit_compress_one_compound(unsigned char *data, size_t data_offset, unsigned char *buffer, size_t *j, size_t *buf_len, const unsigned parms[], unsigned *parms_index); -static void H5Z_nbit_compress(unsigned char *data, unsigned d_nelmts, unsigned char *buffer, +static void H5Z__nbit_compress(unsigned char *data, unsigned d_nelmts, unsigned char *buffer, size_t *buffer_size, const unsigned parms[]); /* This message derives from H5Z */ H5Z_class2_t H5Z_NBIT[1] = {{ - H5Z_CLASS_T_VERS, /* H5Z_class_t version */ + H5Z_CLASS_T_VERS, /* H5Z_class_t version */ H5Z_FILTER_NBIT, /* Filter id number */ - 1, /* Assume encoder present: check before registering */ - 1, /* decoder_present flag (set to true) */ - "nbit", /* Filter name for debugging */ - H5Z_can_apply_nbit, /* The "can apply" callback */ - H5Z_set_local_nbit, /* The "set local" callback */ - H5Z_filter_nbit, /* The actual filter function */ + 1, /* Assume encoder present: check before registering */ + 1, /* decoder_present flag (set to true) */ + "nbit", /* Filter name for debugging */ + H5Z__can_apply_nbit, /* The "can apply" callback */ + H5Z__set_local_nbit, /* The "set local" callback */ + H5Z__filter_nbit, /* The actual filter function */ }}; /* Local macros */ @@ -109,7 +107,7 @@ H5Z_class2_t H5Z_NBIT[1] = {{ /*------------------------------------------------------------------------- - * Function: H5Z_can_apply_nbit + * Function: H5Z__can_apply_nbit * * Purpose: Check the parameters for nbit compression for validity and * whether they fit a particular dataset. @@ -120,17 +118,15 @@ H5Z_class2_t H5Z_NBIT[1] = {{ * Programmer: Xiaowen Wu * Tuesday, December 21, 2004 * - * Modifications: - * *------------------------------------------------------------------------- */ static htri_t -H5Z_can_apply_nbit(hid_t H5_ATTR_UNUSED dcpl_id, hid_t type_id, hid_t H5_ATTR_UNUSED space_id) +H5Z__can_apply_nbit(hid_t H5_ATTR_UNUSED dcpl_id, hid_t type_id, hid_t H5_ATTR_UNUSED space_id) { const H5T_t *type; /* Datatype */ htri_t ret_value = TRUE; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Get datatype */ if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) @@ -146,11 +142,11 @@ H5Z_can_apply_nbit(hid_t H5_ATTR_UNUSED dcpl_id, hid_t type_id, hid_t H5_ATTR_UN done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5Z_can_apply_nbit() */ +} /* end H5Z__can_apply_nbit() */ /*------------------------------------------------------------------------- - * Function: H5Z_calc_parms_nooptype + * Function: H5Z__calc_parms_nooptype * * Purpose: Calculate the number of parameters of array cd_values[] * of datatype that is not integer, nor floating-point, nor @@ -159,12 +155,10 @@ done: * Programmer: Xiaowen Wu * Thursday, March 3, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static void -H5Z_calc_parms_nooptype(size_t *cd_values_actual_nparms) +H5Z__calc_parms_nooptype(size_t *cd_values_actual_nparms) { /* Store datatype class code */ *cd_values_actual_nparms += 1; @@ -175,7 +169,7 @@ H5Z_calc_parms_nooptype(size_t *cd_values_actual_nparms) /*------------------------------------------------------------------------- - * Function: H5Z_calc_parms_atomic + * Function: H5Z__calc_parms_atomic * * Purpose: Calculate the number of parameters of array cd_values[] * of atomic datatype whose datatype class is integer @@ -184,12 +178,10 @@ H5Z_calc_parms_nooptype(size_t *cd_values_actual_nparms) * Programmer: Xiaowen Wu * Saturday, January 29, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static void -H5Z_calc_parms_atomic(size_t *cd_values_actual_nparms) +H5Z__calc_parms_atomic(size_t *cd_values_actual_nparms) { /* Store datatype class code */ *cd_values_actual_nparms += 1; @@ -209,7 +201,7 @@ H5Z_calc_parms_atomic(size_t *cd_values_actual_nparms) /*------------------------------------------------------------------------- - * Function: H5Z_calc_parms_array + * Function: H5Z__calc_parms_array * * Purpose: Calculate the number of parameters of array cd_values[] * for a given datatype identifier type_id @@ -221,18 +213,16 @@ H5Z_calc_parms_atomic(size_t *cd_values_actual_nparms) * Programmer: Xiaowen Wu * Wednesday, January 19, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5Z_calc_parms_array(const H5T_t *type, size_t *cd_values_actual_nparms) +H5Z__calc_parms_array(const H5T_t *type, size_t *cd_values_actual_nparms) { H5T_t *dtype_base = NULL; /* Array datatype's base datatype */ H5T_class_t dtype_base_class; /* Array datatype's base datatype's class */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Store datatype class code */ *cd_values_actual_nparms += 1; @@ -252,16 +242,16 @@ H5Z_calc_parms_array(const H5T_t *type, size_t *cd_values_actual_nparms) switch(dtype_base_class) { case H5T_INTEGER: case H5T_FLOAT: - H5Z_calc_parms_atomic(cd_values_actual_nparms); + H5Z__calc_parms_atomic(cd_values_actual_nparms); break; case H5T_ARRAY: - if(H5Z_calc_parms_array(dtype_base, cd_values_actual_nparms) == FAIL) + if(H5Z__calc_parms_array(dtype_base, cd_values_actual_nparms) == FAIL) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot compute parameters for datatype") break; case H5T_COMPOUND: - if(H5Z_calc_parms_compound(dtype_base, cd_values_actual_nparms) == FAIL) + if(H5Z__calc_parms_compound(dtype_base, cd_values_actual_nparms) == FAIL) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot compute parameters for datatype") break; @@ -273,7 +263,7 @@ H5Z_calc_parms_array(const H5T_t *type, size_t *cd_values_actual_nparms) case H5T_ENUM: case H5T_VLEN: /* Other datatype classes: nbit does no compression */ - H5Z_calc_parms_nooptype(cd_values_actual_nparms); + H5Z__calc_parms_nooptype(cd_values_actual_nparms); break; case H5T_NO_CLASS: @@ -290,11 +280,11 @@ done: HDONE_ERROR(H5E_PLINE, H5E_CLOSEERROR, FAIL, "Unable to close base datatype") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5Z_calc_parms_array() */ +} /* end H5Z__calc_parms_array() */ /*------------------------------------------------------------------------- - * Function: H5Z_calc_parms_compound + * Function: H5Z__calc_parms_compound * * Purpose: Calculate the number of parameters of array cd_values[] * for a given datatype identifier type_id @@ -306,19 +296,17 @@ done: * Programmer: Xiaowen Wu * Wednesday, January 19, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5Z_calc_parms_compound(const H5T_t *type, size_t *cd_values_actual_nparms) +H5Z__calc_parms_compound(const H5T_t *type, size_t *cd_values_actual_nparms) { int nmembers; /* Compound datatype's number of members */ H5T_t *dtype_member = NULL; /* Compound datatype's member datatype */ unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Store compound datatype class code */ *cd_values_actual_nparms += 1; @@ -352,16 +340,16 @@ H5Z_calc_parms_compound(const H5T_t *type, size_t *cd_values_actual_nparms) switch(dtype_member_class) { case H5T_INTEGER: case H5T_FLOAT: - H5Z_calc_parms_atomic(cd_values_actual_nparms); + H5Z__calc_parms_atomic(cd_values_actual_nparms); break; case H5T_ARRAY: - if(H5Z_calc_parms_array(dtype_member, cd_values_actual_nparms) == FAIL) + if(H5Z__calc_parms_array(dtype_member, cd_values_actual_nparms) == FAIL) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot compute parameters for datatype") break; case H5T_COMPOUND: - if(H5Z_calc_parms_compound(dtype_member, cd_values_actual_nparms) == FAIL) + if(H5Z__calc_parms_compound(dtype_member, cd_values_actual_nparms) == FAIL) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot compute parameters for datatype") break; @@ -373,7 +361,7 @@ H5Z_calc_parms_compound(const H5T_t *type, size_t *cd_values_actual_nparms) case H5T_ENUM: case H5T_VLEN: /* Other datatype classes: nbit does no compression */ - H5Z_calc_parms_nooptype(cd_values_actual_nparms); + H5Z__calc_parms_nooptype(cd_values_actual_nparms); break; case H5T_NO_CLASS: @@ -400,7 +388,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5Z_set_parms_nooptype + * Function: H5Z__set_parms_nooptype * * Purpose: Set the array cd_values[] for a given datatype identifier * type_id if its datatype class is not integer, nor @@ -413,17 +401,15 @@ done: * Programmer: Xiaowen Wu * Tuesday, April 5, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5Z_set_parms_nooptype(const H5T_t *type, unsigned *cd_values_index, unsigned cd_values[]) +H5Z__set_parms_nooptype(const H5T_t *type, unsigned *cd_values_index, unsigned cd_values[]) { size_t dtype_size; /* No-op datatype's size (in bytes) */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Set datatype class code */ cd_values[(*cd_values_index)++] = H5Z_NBIT_NOOPTYPE; @@ -438,11 +424,11 @@ H5Z_set_parms_nooptype(const H5T_t *type, unsigned *cd_values_index, unsigned cd done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5Z_set_parms_nooptype() */ +} /* end H5Z__set_parms_nooptype() */ /*------------------------------------------------------------------------- - * Function: H5Z_set_parms_atomic + * Function: H5Z__set_parms_atomic * * Purpose: Set the array cd_values[] for a given datatype identifier * type_id if its datatype class is integer or floating point @@ -453,12 +439,10 @@ done: * Programmer: Xiaowen Wu * Tuesday, January 11, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5Z_set_parms_atomic(const H5T_t *type, unsigned *cd_values_index, +H5Z__set_parms_atomic(const H5T_t *type, unsigned *cd_values_index, unsigned cd_values[], hbool_t *need_not_compress) { H5T_order_t dtype_order; /* Atomic datatype's endianness order */ @@ -468,7 +452,7 @@ H5Z_set_parms_atomic(const H5T_t *type, unsigned *cd_values_index, unsigned dtype_offset; /* Atomic datatype's offset (in bits) */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Set datatype class code */ cd_values[(*cd_values_index)++] = H5Z_NBIT_ATOMIC; @@ -532,11 +516,11 @@ H5Z_set_parms_atomic(const H5T_t *type, unsigned *cd_values_index, *need_not_compress = FALSE; done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5Z_set_parms_atomic() */ +} /* end H5Z__set_parms_atomic() */ /*------------------------------------------------------------------------- - * Function: H5Z_set_parms_array + * Function: H5Z__set_parms_array * * Purpose: Set the array cd_values[] for a given datatype identifier * type_id if its datatype class is array datatype @@ -547,12 +531,10 @@ done: * Programmer: Xiaowen Wu * Tuesday, April 5, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5Z_set_parms_array(const H5T_t *type, unsigned *cd_values_index, +H5Z__set_parms_array(const H5T_t *type, unsigned *cd_values_index, unsigned cd_values[], hbool_t *need_not_compress) { H5T_t *dtype_base = NULL; /* Array datatype's base datatype */ @@ -561,7 +543,7 @@ H5Z_set_parms_array(const H5T_t *type, unsigned *cd_values_index, htri_t is_vlstring; /* flag indicating if datatype is variable-length string */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Set datatype class code */ cd_values[(*cd_values_index)++] = H5Z_NBIT_ARRAY; @@ -586,17 +568,17 @@ H5Z_set_parms_array(const H5T_t *type, unsigned *cd_values_index, switch(dtype_base_class) { case H5T_INTEGER: case H5T_FLOAT: - if(H5Z_set_parms_atomic(dtype_base, cd_values_index, cd_values, need_not_compress) < 0) + if(H5Z__set_parms_atomic(dtype_base, cd_values_index, cd_values, need_not_compress) < 0) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype") break; case H5T_ARRAY: - if(H5Z_set_parms_array(dtype_base, cd_values_index, cd_values, need_not_compress) < 0) + if(H5Z__set_parms_array(dtype_base, cd_values_index, cd_values, need_not_compress) < 0) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype") break; case H5T_COMPOUND: - if(H5Z_set_parms_compound(dtype_base, cd_values_index, cd_values, need_not_compress) < 0) + if(H5Z__set_parms_compound(dtype_base, cd_values_index, cd_values, need_not_compress) < 0) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype") break; @@ -609,7 +591,7 @@ H5Z_set_parms_array(const H5T_t *type, unsigned *cd_values_index, if(dtype_base_class == H5T_VLEN || is_vlstring) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "datatype not supported by nbit") - if(H5Z_set_parms_nooptype(dtype_base, cd_values_index, cd_values) < 0) + if(H5Z__set_parms_nooptype(dtype_base, cd_values_index, cd_values) < 0) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype") break; @@ -619,7 +601,7 @@ H5Z_set_parms_array(const H5T_t *type, unsigned *cd_values_index, case H5T_OPAQUE: case H5T_REFERENCE: case H5T_ENUM: - if(H5Z_set_parms_nooptype(dtype_base, cd_values_index, cd_values) < 0) + if(H5Z__set_parms_nooptype(dtype_base, cd_values_index, cd_values) < 0) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype") break; @@ -637,11 +619,11 @@ done: HDONE_ERROR(H5E_PLINE, H5E_CLOSEERROR, FAIL, "Unable to close base datatype") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5Z_set_parms_array() */ +} /* end H5Z__set_parms_array() */ /*------------------------------------------------------------------------- - * Function: H5Z_set_parms_compound + * Function: H5Z__set_parms_compound * * Purpose: Set the array cd_values[] for a given datatype identifier * type_id if its datatype class is compound datatype @@ -652,12 +634,10 @@ done: * Programmer: Xiaowen Wu * Tuesday, April 5, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5Z_set_parms_compound(const H5T_t *type, unsigned *cd_values_index, +H5Z__set_parms_compound(const H5T_t *type, unsigned *cd_values_index, unsigned cd_values[], hbool_t *need_not_compress) { int snmembers; /* Compound datatype's number of members */ @@ -671,7 +651,7 @@ H5Z_set_parms_compound(const H5T_t *type, unsigned *cd_values_index, unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Set "local" parameter for compound datatype class code */ cd_values[(*cd_values_index)++] = H5Z_NBIT_COMPOUND; @@ -713,17 +693,17 @@ H5Z_set_parms_compound(const H5T_t *type, unsigned *cd_values_index, switch(dtype_member_class) { case H5T_INTEGER: case H5T_FLOAT: - if(H5Z_set_parms_atomic(dtype_member, cd_values_index, cd_values, need_not_compress) < 0) + if(H5Z__set_parms_atomic(dtype_member, cd_values_index, cd_values, need_not_compress) < 0) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype") break; case H5T_ARRAY: - if(H5Z_set_parms_array(dtype_member, cd_values_index, cd_values, need_not_compress) < 0) + if(H5Z__set_parms_array(dtype_member, cd_values_index, cd_values, need_not_compress) < 0) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype") break; case H5T_COMPOUND: - if(H5Z_set_parms_compound(dtype_member, cd_values_index, cd_values, need_not_compress) < 0) + if(H5Z__set_parms_compound(dtype_member, cd_values_index, cd_values, need_not_compress) < 0) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype") break; @@ -761,7 +741,7 @@ H5Z_set_parms_compound(const H5T_t *type, unsigned *cd_values_index, case H5T_REFERENCE: case H5T_ENUM: /* other datatype that nbit does no compression */ - if(H5Z_set_parms_nooptype(dtype_member, cd_values_index, cd_values) < 0) + if(H5Z__set_parms_nooptype(dtype_member, cd_values_index, cd_values) < 0) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype") break; @@ -789,7 +769,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5Z_set_local_nbit + * Function: H5Z__set_local_nbit * * Purpose: Set the "local" dataset parameters for nbit compression. * @@ -799,12 +779,10 @@ done: * Programmer: Xiaowen Wu * Tuesday, January 11, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5Z_set_local_nbit(hid_t dcpl_id, hid_t type_id, hid_t space_id) +H5Z__set_local_nbit(hid_t dcpl_id, hid_t type_id, hid_t space_id) { H5P_genplist_t *dcpl_plist; /* Property list pointer */ const H5T_t *type; /* Datatype */ @@ -819,7 +797,7 @@ H5Z_set_local_nbit(hid_t dcpl_id, hid_t type_id, hid_t space_id) hbool_t need_not_compress; /* Flag if TRUE indicating no need to do nbit compression */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Get datatype */ if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) @@ -839,16 +817,16 @@ H5Z_set_local_nbit(hid_t dcpl_id, hid_t type_id, hid_t space_id) switch(dtype_class) { case H5T_INTEGER: case H5T_FLOAT: - H5Z_calc_parms_atomic(&cd_values_actual_nparms); + H5Z__calc_parms_atomic(&cd_values_actual_nparms); break; case H5T_ARRAY: - if(H5Z_calc_parms_array(type, &cd_values_actual_nparms) < 0) + if(H5Z__calc_parms_array(type, &cd_values_actual_nparms) < 0) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot compute parameters for datatype") break; case H5T_COMPOUND: - if(H5Z_calc_parms_compound(type, &cd_values_actual_nparms) < 0) + if(H5Z__calc_parms_compound(type, &cd_values_actual_nparms) < 0) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot compute parameters for datatype") break; @@ -909,17 +887,17 @@ H5Z_set_local_nbit(hid_t dcpl_id, hid_t type_id, hid_t space_id) switch(dtype_class) { case H5T_INTEGER: case H5T_FLOAT: - if(H5Z_set_parms_atomic(type, &cd_values_index, cd_values, &need_not_compress) < 0) + if(H5Z__set_parms_atomic(type, &cd_values_index, cd_values, &need_not_compress) < 0) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype") break; case H5T_ARRAY: - if(H5Z_set_parms_array(type, &cd_values_index, cd_values, &need_not_compress) < 0) + if(H5Z__set_parms_array(type, &cd_values_index, cd_values, &need_not_compress) < 0) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype") break; case H5T_COMPOUND: - if(H5Z_set_parms_compound(type, &cd_values_index, cd_values, &need_not_compress) < 0) + if(H5Z__set_parms_compound(type, &cd_values_index, cd_values, &need_not_compress) < 0) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype") break; @@ -958,11 +936,11 @@ done: H5MM_xfree(cd_values); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5Z_set_local_nbit() */ +} /* end H5Z__set_local_nbit() */ /*------------------------------------------------------------------------- - * Function: H5Z_filter_nbit + * Function: H5Z__filter_nbit * * Purpose: Implement an I/O filter for storing packed nbit data * @@ -975,7 +953,7 @@ done: *------------------------------------------------------------------------- */ static size_t -H5Z_filter_nbit(unsigned flags, size_t cd_nelmts, const unsigned cd_values[], +H5Z__filter_nbit(unsigned flags, size_t cd_nelmts, const unsigned cd_values[], size_t nbytes, size_t *buf_size, void **buf) { unsigned char *outbuf; /* pointer to new output buffer */ @@ -983,7 +961,7 @@ H5Z_filter_nbit(unsigned flags, size_t cd_nelmts, const unsigned cd_values[], unsigned d_nelmts = 0; /* number of elements in the chunk */ size_t ret_value = 0; /* return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check arguments * cd_values[0] stores actual number of parameters in cd_values[] @@ -1023,7 +1001,7 @@ H5Z_filter_nbit(unsigned flags, size_t cd_nelmts, const unsigned cd_values[], HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed for nbit compression") /* compress the buffer, size_out will be changed */ - H5Z_nbit_compress((unsigned char *)*buf, d_nelmts, outbuf, &size_out, cd_values); + H5Z__nbit_compress((unsigned char *)*buf, d_nelmts, outbuf, &size_out, cd_values); } /* end else */ /* free the input buffer */ @@ -1036,7 +1014,7 @@ H5Z_filter_nbit(unsigned flags, size_t cd_nelmts, const unsigned cd_values[], done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5Z_filter_nbit() */ +} /* end H5Z__filter_nbit() */ /* ======== Nbit Algorithm =============================================== * assume one byte has 8 bit @@ -1047,14 +1025,14 @@ done: */ static void -H5Z_nbit_next_byte(size_t *j, size_t *buf_len) +H5Z__nbit_next_byte(size_t *j, size_t *buf_len) { ++(*j); *buf_len = 8 * sizeof(unsigned char); } static void -H5Z_nbit_decompress_one_byte(unsigned char *data, size_t data_offset, unsigned k, +H5Z__nbit_decompress_one_byte(unsigned char *data, size_t data_offset, unsigned k, unsigned begin_i, unsigned end_i, unsigned char *buffer, size_t *j, size_t *buf_len, const parms_atomic *p, size_t datatype_len) { @@ -1088,7 +1066,7 @@ H5Z_nbit_decompress_one_byte(unsigned char *data, size_t data_offset, unsigned k data[data_offset + k] = (unsigned char)( ((val & ~((unsigned)(~0) << *buf_len)) << (dat_len - *buf_len)) << dat_offset); dat_len -= *buf_len; - H5Z_nbit_next_byte(j, buf_len); + H5Z__nbit_next_byte(j, buf_len); if(dat_len == 0) return; @@ -1100,7 +1078,7 @@ H5Z_nbit_decompress_one_byte(unsigned char *data, size_t data_offset, unsigned k } static void -H5Z_nbit_decompress_one_nooptype(unsigned char *data, size_t data_offset, +H5Z__nbit_decompress_one_nooptype(unsigned char *data, size_t data_offset, unsigned char *buffer, size_t *j, size_t *buf_len, unsigned size) { unsigned i; /* index */ @@ -1114,7 +1092,7 @@ H5Z_nbit_decompress_one_nooptype(unsigned char *data, size_t data_offset, data[data_offset + i] = (unsigned char)(((val & ~((unsigned)(~0) << *buf_len)) << (dat_len - *buf_len))); dat_len -= *buf_len; - H5Z_nbit_next_byte(j, buf_len); + H5Z__nbit_next_byte(j, buf_len); if(dat_len == 0) continue; @@ -1125,7 +1103,7 @@ H5Z_nbit_decompress_one_nooptype(unsigned char *data, size_t data_offset, } static void -H5Z_nbit_decompress_one_atomic(unsigned char *data, size_t data_offset, +H5Z__nbit_decompress_one_atomic(unsigned char *data, size_t data_offset, unsigned char *buffer, size_t *j, size_t *buf_len, const parms_atomic *p) { /* begin_i: the index of byte having first significant bit @@ -1145,7 +1123,7 @@ H5Z_nbit_decompress_one_atomic(unsigned char *data, size_t data_offset, end_i = p->offset / 8; for(k = (int)begin_i; k >= (int)end_i; k--) - H5Z_nbit_decompress_one_byte(data, data_offset, (unsigned)k, begin_i, end_i, + H5Z__nbit_decompress_one_byte(data, data_offset, (unsigned)k, begin_i, end_i, buffer, j, buf_len, p, datatype_len); } else { /* big endian */ @@ -1160,7 +1138,7 @@ H5Z_nbit_decompress_one_atomic(unsigned char *data, size_t data_offset, end_i = ((unsigned)datatype_len - p->offset) / 8 - 1; for(k = (int)begin_i; k <= (int)end_i; k++) - H5Z_nbit_decompress_one_byte(data, data_offset, (unsigned)k, begin_i, end_i, + H5Z__nbit_decompress_one_byte(data, data_offset, (unsigned)k, begin_i, end_i, buffer, j, buf_len, p, datatype_len); } } @@ -1192,7 +1170,7 @@ H5Z__nbit_decompress_one_array(unsigned char *data, size_t data_offset, n = total_size / p.size; for(i = 0; i < n; i++) - H5Z_nbit_decompress_one_atomic(data, data_offset + i * p.size, + H5Z__nbit_decompress_one_atomic(data, data_offset + i * p.size, buffer, j, buf_len, &p); break; @@ -1222,7 +1200,7 @@ H5Z__nbit_decompress_one_array(unsigned char *data, size_t data_offset, case H5Z_NBIT_NOOPTYPE: (*parms_index)++; /* skip size of no-op type */ - H5Z_nbit_decompress_one_nooptype(data, data_offset, buffer, j, buf_len, total_size); + H5Z__nbit_decompress_one_nooptype(data, data_offset, buffer, j, buf_len, total_size); break; default: @@ -1269,7 +1247,7 @@ H5Z__nbit_decompress_one_compound(unsigned char *data, size_t data_offset, if(p.precision > p.size * 8 || (p.precision + p.offset) > p.size * 8) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "invalid datatype precision/offset") - H5Z_nbit_decompress_one_atomic(data, data_offset + member_offset, + H5Z__nbit_decompress_one_atomic(data, data_offset + member_offset, buffer, j, buf_len, &p); break; @@ -1288,7 +1266,7 @@ H5Z__nbit_decompress_one_compound(unsigned char *data, size_t data_offset, case H5Z_NBIT_NOOPTYPE: /* Advance past member size */ (*parms_index)++; - H5Z_nbit_decompress_one_nooptype(data, data_offset+member_offset, + H5Z__nbit_decompress_one_nooptype(data, data_offset+member_offset, buffer, j, buf_len, member_size); break; @@ -1335,7 +1313,7 @@ H5Z__nbit_decompress(unsigned char *data, unsigned d_nelmts, unsigned char *buff HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "invalid datatype precision/offset") for(i = 0; i < d_nelmts; i++) - H5Z_nbit_decompress_one_atomic(data, i * p.size, buffer, &j, &buf_len, &p); + H5Z__nbit_decompress_one_atomic(data, i * p.size, buffer, &j, &buf_len, &p); break; case H5Z_NBIT_ARRAY: @@ -1367,7 +1345,7 @@ done: } static void -H5Z_nbit_compress_one_byte(unsigned char *data, size_t data_offset, unsigned k, +H5Z__nbit_compress_one_byte(unsigned char *data, size_t data_offset, unsigned k, unsigned begin_i, unsigned end_i, unsigned char *buffer, size_t *j, size_t *buf_len, const parms_atomic *p, size_t datatype_len) { @@ -1396,7 +1374,7 @@ H5Z_nbit_compress_one_byte(unsigned char *data, size_t data_offset, unsigned k, } else { buffer[*j] |= (unsigned char)((unsigned)(val >> (dat_len - *buf_len)) & ~((unsigned)(~0) << *buf_len)); dat_len -= *buf_len; - H5Z_nbit_next_byte(j, buf_len); + H5Z__nbit_next_byte(j, buf_len); if(dat_len == 0) return; @@ -1406,7 +1384,7 @@ H5Z_nbit_compress_one_byte(unsigned char *data, size_t data_offset, unsigned k, } static void -H5Z_nbit_compress_one_nooptype(unsigned char *data, size_t data_offset, +H5Z__nbit_compress_one_nooptype(unsigned char *data, size_t data_offset, unsigned char *buffer, size_t *j, size_t *buf_len, unsigned size) { unsigned i; /* index */ @@ -1420,7 +1398,7 @@ H5Z_nbit_compress_one_nooptype(unsigned char *data, size_t data_offset, buffer[*j] |= (unsigned char)((unsigned)(val >> (dat_len - *buf_len)) & ~((unsigned)(~0) << *buf_len)); dat_len -= *buf_len; - H5Z_nbit_next_byte(j, buf_len); + H5Z__nbit_next_byte(j, buf_len); if(dat_len == 0) continue; @@ -1430,7 +1408,7 @@ H5Z_nbit_compress_one_nooptype(unsigned char *data, size_t data_offset, } static void -H5Z_nbit_compress_one_atomic(unsigned char *data, size_t data_offset, +H5Z__nbit_compress_one_atomic(unsigned char *data, size_t data_offset, unsigned char *buffer, size_t *j, size_t *buf_len, const parms_atomic *p) { /* begin_i: the index of byte having first significant bit @@ -1450,7 +1428,7 @@ H5Z_nbit_compress_one_atomic(unsigned char *data, size_t data_offset, end_i = p->offset / 8; for(k = (int)begin_i; k >= (int)end_i; k--) - H5Z_nbit_compress_one_byte(data, data_offset, (unsigned)k, begin_i, end_i, + H5Z__nbit_compress_one_byte(data, data_offset, (unsigned)k, begin_i, end_i, buffer, j, buf_len, p, datatype_len); } else { /* big endian */ @@ -1465,13 +1443,13 @@ H5Z_nbit_compress_one_atomic(unsigned char *data, size_t data_offset, end_i = ((unsigned)datatype_len - p->offset) / 8 - 1; for(k = (int)begin_i; k <= (int)end_i; k++) - H5Z_nbit_compress_one_byte(data, data_offset, (unsigned)k, begin_i, end_i, + H5Z__nbit_compress_one_byte(data, data_offset, (unsigned)k, begin_i, end_i, buffer, j, buf_len, p, datatype_len); } } static void -H5Z_nbit_compress_one_array(unsigned char *data, size_t data_offset, +H5Z__nbit_compress_one_array(unsigned char *data, size_t data_offset, unsigned char *buffer, size_t *j, size_t *buf_len, const unsigned parms[], unsigned *parms_index) { @@ -1489,7 +1467,7 @@ H5Z_nbit_compress_one_array(unsigned char *data, size_t data_offset, p.offset = parms[(*parms_index)++]; n = total_size / p.size; for(i = 0; i < n; i++) - H5Z_nbit_compress_one_atomic(data, data_offset + i * p.size, + H5Z__nbit_compress_one_atomic(data, data_offset + i * p.size, buffer, j, buf_len, &p); break; @@ -1498,7 +1476,7 @@ H5Z_nbit_compress_one_array(unsigned char *data, size_t data_offset, n = total_size / base_size; /* number of base_type elements inside the array datatype */ begin_index = *parms_index; for(i = 0; i < n; i++) { - H5Z_nbit_compress_one_array(data, data_offset + i * base_size, + H5Z__nbit_compress_one_array(data, data_offset + i * base_size, buffer, j, buf_len, parms, parms_index); *parms_index = begin_index; } @@ -1509,7 +1487,7 @@ H5Z_nbit_compress_one_array(unsigned char *data, size_t data_offset, n = total_size / base_size; /* number of base_type elements inside the array datatype */ begin_index = *parms_index; for(i = 0; i < n; i++) { - H5Z_nbit_compress_one_compound(data, data_offset + i * base_size, + H5Z__nbit_compress_one_compound(data, data_offset + i * base_size, buffer, j, buf_len, parms, parms_index); *parms_index = begin_index; } @@ -1517,7 +1495,7 @@ H5Z_nbit_compress_one_array(unsigned char *data, size_t data_offset, case H5Z_NBIT_NOOPTYPE: (*parms_index)++; /* skip size of no-op type */ - H5Z_nbit_compress_one_nooptype(data, data_offset, buffer, j, buf_len, total_size); + H5Z__nbit_compress_one_nooptype(data, data_offset, buffer, j, buf_len, total_size); break; default: @@ -1526,7 +1504,7 @@ H5Z_nbit_compress_one_array(unsigned char *data, size_t data_offset, } static void -H5Z_nbit_compress_one_compound(unsigned char *data, size_t data_offset, +H5Z__nbit_compress_one_compound(unsigned char *data, size_t data_offset, unsigned char *buffer, size_t *j, size_t *buf_len, const unsigned parms[], unsigned *parms_index) { @@ -1546,23 +1524,23 @@ H5Z_nbit_compress_one_compound(unsigned char *data, size_t data_offset, p.order = parms[(*parms_index)++]; p.precision = parms[(*parms_index)++]; p.offset = parms[(*parms_index)++]; - H5Z_nbit_compress_one_atomic(data, data_offset + member_offset, + H5Z__nbit_compress_one_atomic(data, data_offset + member_offset, buffer, j, buf_len, &p); break; case H5Z_NBIT_ARRAY: - H5Z_nbit_compress_one_array(data, data_offset + member_offset, + H5Z__nbit_compress_one_array(data, data_offset + member_offset, buffer, j, buf_len, parms, parms_index); break; case H5Z_NBIT_COMPOUND: - H5Z_nbit_compress_one_compound(data, data_offset+member_offset, + H5Z__nbit_compress_one_compound(data, data_offset+member_offset, buffer, j, buf_len, parms, parms_index); break; case H5Z_NBIT_NOOPTYPE: size = parms[(*parms_index)++]; - H5Z_nbit_compress_one_nooptype(data, data_offset+member_offset, + H5Z__nbit_compress_one_nooptype(data, data_offset+member_offset, buffer, j, buf_len, size); break; @@ -1573,7 +1551,7 @@ H5Z_nbit_compress_one_compound(unsigned char *data, size_t data_offset, } static void -H5Z_nbit_compress(unsigned char *data, unsigned d_nelmts, unsigned char *buffer, +H5Z__nbit_compress(unsigned char *data, unsigned d_nelmts, unsigned char *buffer, size_t *buffer_size, const unsigned parms[]) { /* i: index of data, new_size: index of buffer, @@ -1599,14 +1577,14 @@ H5Z_nbit_compress(unsigned char *data, unsigned d_nelmts, unsigned char *buffer, p.offset = parms[7]; for(i = 0; i < d_nelmts; i++) - H5Z_nbit_compress_one_atomic(data, i * p.size, buffer, &new_size, &buf_len, &p); + H5Z__nbit_compress_one_atomic(data, i * p.size, buffer, &new_size, &buf_len, &p); break; case H5Z_NBIT_ARRAY: size = parms[4]; parms_index = 4; for(i = 0; i < d_nelmts; i++) { - H5Z_nbit_compress_one_array(data, i * size, buffer, &new_size, &buf_len, parms, &parms_index); + H5Z__nbit_compress_one_array(data, i * size, buffer, &new_size, &buf_len, parms, &parms_index); parms_index = 4; } break; @@ -1615,7 +1593,7 @@ H5Z_nbit_compress(unsigned char *data, unsigned d_nelmts, unsigned char *buffer, size = parms[4]; parms_index = 4; for(i = 0; i < d_nelmts; i++) { - H5Z_nbit_compress_one_compound(data, i * size, buffer, &new_size, &buf_len, parms, &parms_index); + H5Z__nbit_compress_one_compound(data, i * size, buffer, &new_size, &buf_len, parms, &parms_index); parms_index = 4; } break; diff --git a/src/H5Zprivate.h b/src/H5Zprivate.h index fbc6fc4..186c168 100644 --- a/src/H5Zprivate.h +++ b/src/H5Zprivate.h @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Robb Matzke +/* Programmer: Robb Matzke * Thursday, April 16, 1998 */ @@ -25,7 +25,8 @@ typedef struct H5Z_filter_info_t H5Z_filter_info_t; #include "H5Zpublic.h" /* Private headers needed by this file */ -#include "H5Tprivate.h" /* Datatypes */ +#include "H5Tprivate.h" /* Datatypes */ +#include "H5Sprivate.h" /* Dataspace */ /**************************/ /* Library Private Macros */ @@ -89,6 +90,7 @@ 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 htri_t H5Z_ignore_filters(hid_t dcpl_id, const H5T_t *type, const H5S_t *space); H5_DLL H5Z_filter_info_t *H5Z_filter_info(const struct H5O_pline_t *pline, H5Z_filter_t filter); H5_DLL htri_t H5Z_filter_in_pline(const struct H5O_pline_t *pline, H5Z_filter_t filter); diff --git a/src/H5Zpublic.h b/src/H5Zpublic.h index a2a44fa..b37dcf3 100644 --- a/src/H5Zpublic.h +++ b/src/H5Zpublic.h @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Robb Matzke +/* Programmer: Robb Matzke * Thursday, April 16, 1998 */ diff --git a/src/H5Zscaleoffset.c b/src/H5Zscaleoffset.c index 7bdc283..83f170e 100644 --- a/src/H5Zscaleoffset.c +++ b/src/H5Zscaleoffset.c @@ -36,55 +36,55 @@ enum H5Z_scaleoffset_t {t_bad=0, t_uchar=1, t_ushort, t_uint, t_ulong, t_ulong_l t_float, t_double}; /* Local function prototypes */ -static htri_t H5Z_can_apply_scaleoffset(hid_t dcpl_id, hid_t type_id, hid_t space_id); -static enum H5Z_scaleoffset_t H5Z_scaleoffset_get_type(unsigned dtype_class, +static htri_t H5Z__can_apply_scaleoffset(hid_t dcpl_id, hid_t type_id, hid_t space_id); +static enum H5Z_scaleoffset_t H5Z__scaleoffset_get_type(unsigned dtype_class, unsigned dtype_size, unsigned dtype_sign); -static herr_t H5Z_scaleoffset_set_parms_fillval(H5P_genplist_t *dcpl_plist, +static herr_t H5Z__scaleoffset_set_parms_fillval(H5P_genplist_t *dcpl_plist, H5T_t *type, enum H5Z_scaleoffset_t scale_type, unsigned cd_values[], int need_convert); -static herr_t H5Z_set_local_scaleoffset(hid_t dcpl_id, hid_t type_id, hid_t space_id); -static size_t H5Z_filter_scaleoffset(unsigned flags, size_t cd_nelmts, +static herr_t H5Z__set_local_scaleoffset(hid_t dcpl_id, hid_t type_id, hid_t space_id); +static size_t H5Z__filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_values[], size_t nbytes, size_t *buf_size, void **buf); -static void H5Z_scaleoffset_convert(void *buf, unsigned d_nelmts, unsigned dtype_size); -static H5_ATTR_CONST unsigned H5Z_scaleoffset_log2(unsigned long long num); -static void H5Z_scaleoffset_precompress_i(void *data, unsigned d_nelmts, +static void H5Z__scaleoffset_convert(void *buf, unsigned d_nelmts, unsigned dtype_size); +static H5_ATTR_CONST unsigned H5Z__scaleoffset_log2(unsigned long long num); +static void H5Z__scaleoffset_precompress_i(void *data, unsigned d_nelmts, enum H5Z_scaleoffset_t type, unsigned filavail, const unsigned cd_values[], uint32_t *minbits, unsigned long long *minval); -static void H5Z_scaleoffset_postdecompress_i(void *data, unsigned d_nelmts, +static void H5Z__scaleoffset_postdecompress_i(void *data, unsigned d_nelmts, enum H5Z_scaleoffset_t type, unsigned filavail, const unsigned cd_values[], uint32_t minbits, unsigned long long minval); -static herr_t H5Z_scaleoffset_precompress_fd(void *data, unsigned d_nelmts, +static herr_t H5Z__scaleoffset_precompress_fd(void *data, unsigned d_nelmts, enum H5Z_scaleoffset_t type, unsigned filavail, const unsigned cd_values[], uint32_t *minbits, unsigned long long *minval, double D_val); -static herr_t H5Z_scaleoffset_postdecompress_fd(void *data, unsigned d_nelmts, +static herr_t H5Z__scaleoffset_postdecompress_fd(void *data, unsigned d_nelmts, enum H5Z_scaleoffset_t type, unsigned filavail, const unsigned cd_values[], uint32_t minbits, unsigned long long minval, double D_val); -static void H5Z_scaleoffset_next_byte(size_t *j, unsigned *buf_len); -static void H5Z_scaleoffset_decompress_one_byte(unsigned char *data, size_t data_offset, +static void H5Z__scaleoffset_next_byte(size_t *j, unsigned *buf_len); +static void H5Z__scaleoffset_decompress_one_byte(unsigned char *data, size_t data_offset, unsigned k, unsigned begin_i, unsigned char *buffer, size_t *j, unsigned *buf_len, parms_atomic p, unsigned dtype_len); -static void H5Z_scaleoffset_compress_one_byte(unsigned char *data, size_t data_offset, +static void H5Z__scaleoffset_compress_one_byte(unsigned char *data, size_t data_offset, unsigned k, unsigned begin_i, unsigned char *buffer, size_t *j, unsigned *buf_len, parms_atomic p, unsigned dtype_len); -static void H5Z_scaleoffset_decompress_one_atomic(unsigned char *data, size_t data_offset, +static void H5Z__scaleoffset_decompress_one_atomic(unsigned char *data, size_t data_offset, unsigned char *buffer, size_t *j, unsigned *buf_len, parms_atomic p); -static void H5Z_scaleoffset_compress_one_atomic(unsigned char *data, size_t data_offset, +static void H5Z__scaleoffset_compress_one_atomic(unsigned char *data, size_t data_offset, unsigned char *buffer, size_t *j, unsigned *buf_len, parms_atomic p); -static void H5Z_scaleoffset_decompress(unsigned char *data, unsigned d_nelmts, +static void H5Z__scaleoffset_decompress(unsigned char *data, unsigned d_nelmts, unsigned char *buffer, parms_atomic p); -static void H5Z_scaleoffset_compress(unsigned char *data, unsigned d_nelmts, unsigned char *buffer, +static void H5Z__scaleoffset_compress(unsigned char *data, unsigned d_nelmts, unsigned char *buffer, size_t buffer_size, parms_atomic p); /* This message derives from H5Z */ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ - H5Z_CLASS_T_VERS, /* H5Z_class_t version */ - H5Z_FILTER_SCALEOFFSET, /* Filter id number */ - 1, /* Assume encoder present: check before registering */ - 1, /* decoder_present flag (set to true) */ - "scaleoffset", /* Filter name for debugging */ - H5Z_can_apply_scaleoffset, /* The "can apply" callback */ - H5Z_set_local_scaleoffset, /* The "set local" callback */ - H5Z_filter_scaleoffset, /* The actual filter function */ + H5Z_CLASS_T_VERS, /* H5Z_class_t version */ + H5Z_FILTER_SCALEOFFSET, /* Filter id number */ + 1, /* Assume encoder present: check before registering */ + 1, /* decoder_present flag (set to true) */ + "scaleoffset", /* Filter name for debugging */ + H5Z__can_apply_scaleoffset, /* The "can apply" callback */ + H5Z__set_local_scaleoffset, /* The "set local" callback */ + H5Z__filter_scaleoffset, /* The actual filter function */ }}; /* Local macros */ @@ -192,7 +192,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "unable to get fill value") \ \ if(need_convert) \ - H5Z_scaleoffset_convert(&fill_val, 1, sizeof(type)); \ + H5Z__scaleoffset_convert(&fill_val, 1, sizeof(type)); \ \ H5Z_scaleoffset_save_filval(type, cd_values, fill_val) \ } @@ -207,7 +207,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "unable to get fill value") \ \ if(need_convert) \ - H5Z_scaleoffset_convert(&fill_val, 1, sizeof(type)); \ + H5Z__scaleoffset_convert(&fill_val, 1, sizeof(type)); \ \ H5Z_scaleoffset_save_filval(unsigned type, cd_values, fill_val) \ } @@ -235,7 +235,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "unable to get fill value") \ \ if(need_convert) \ - H5Z_scaleoffset_convert(&fill_val, 1, sizeof(type)); \ + H5Z__scaleoffset_convert(&fill_val, 1, sizeof(type)); \ \ H5Z_scaleoffset_save_filval(type, cd_values, fill_val) \ } @@ -422,7 +422,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ H5Z_scaleoffset_max_min_1(i, d_nelmts, buf, filval, max, min) \ H5Z_scaleoffset_check_1(type, max, min, minbits) \ span = (type)(max - min + 1); \ - *minbits = H5Z_scaleoffset_log2((unsigned long long)(span+1)); \ + *minbits = H5Z__scaleoffset_log2((unsigned long long)(span+1)); \ } else /* minbits already set, only calculate min */ \ H5Z_scaleoffset_min_1(i, d_nelmts, buf, filval, min) \ if(*minbits != sizeof(type)*8) /* change values if minbits != full precision */ \ @@ -433,7 +433,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ H5Z_scaleoffset_max_min_2(i, d_nelmts, buf, max, min) \ H5Z_scaleoffset_check_1(type, max, min, minbits) \ span = (type)(max - min + 1); \ - *minbits = H5Z_scaleoffset_log2((unsigned long long)span); \ + *minbits = H5Z__scaleoffset_log2((unsigned long long)span); \ } else /* minbits already set, only calculate min */ \ H5Z_scaleoffset_min_2(i, d_nelmts, buf, min) \ if(*minbits != sizeof(type)*8) /* change values if minbits != full precision */ \ @@ -455,7 +455,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ H5Z_scaleoffset_max_min_1(i, d_nelmts, buf, filval, max, min) \ H5Z_scaleoffset_check_2(type, max, min, minbits) \ span = (unsigned type)(max - min + 1); \ - *minbits = H5Z_scaleoffset_log2((unsigned long long)(span + 1)); \ + *minbits = H5Z__scaleoffset_log2((unsigned long long)(span + 1)); \ } else /* minbits already set, only calculate min */ \ H5Z_scaleoffset_min_1(i, d_nelmts, buf, filval, min) \ if(*minbits != sizeof(type) * 8) /* change values if minbits != full precision */ \ @@ -466,7 +466,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ H5Z_scaleoffset_max_min_2(i, d_nelmts, buf, max, min) \ H5Z_scaleoffset_check_2(type, max, min, minbits) \ span = (unsigned type)(max - min + 1); \ - *minbits = H5Z_scaleoffset_log2((unsigned long long)span); \ + *minbits = H5Z__scaleoffset_log2((unsigned long long)span); \ } else /* minbits already set, only calculate min */ \ H5Z_scaleoffset_min_2(i, d_nelmts, buf, min) \ if(*minbits != sizeof(type) * 8) /* change values if minbits != full precision */ \ @@ -553,14 +553,14 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ H5Z_scaleoffset_max_min_3(i, d_nelmts, buf, filval, max, min, D_val) \ H5Z_scaleoffset_check_3(i, type, pow_fun, round_fun, max, min, minbits, D_val) \ span = (unsigned long long)(llround_fun(max * pow_fun(10.0f, (type)D_val) - min * pow_fun(10.0f, (type)D_val)) + 1); \ - *minbits = H5Z_scaleoffset_log2(span + 1); \ + *minbits = H5Z__scaleoffset_log2(span + 1); \ if(*minbits != sizeof(type) * 8) /* change values if minbits != full precision */ \ H5Z_scaleoffset_modify_1(i, type, pow_fun, abs_fun, lround_fun, llround_fun, buf, d_nelmts, filval, minbits, min, D_val) \ } else { /* fill value undefined */ \ H5Z_scaleoffset_max_min_2(i, d_nelmts, buf, max, min) \ H5Z_scaleoffset_check_3(i, type, pow_fun, round_fun, max, min, minbits, D_val) \ span = (unsigned long long)(llround_fun(max * pow_fun(10.0f, (type)D_val) - min * pow_fun(10.0f, (type)D_val)) + 1); \ - *minbits = H5Z_scaleoffset_log2(span); \ + *minbits = H5Z__scaleoffset_log2(span); \ if(*minbits != sizeof(type) * 8) /* change values if minbits != full precision */ \ H5Z_scaleoffset_modify_2(i, type, pow_fun, lround_fun, llround_fun, buf, d_nelmts, min, D_val) \ } \ @@ -667,7 +667,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ /*------------------------------------------------------------------------- - * Function: H5Z_can_apply_scaleoffset + * Function: H5Z__can_apply_scaleoffset * * Purpose: Check the parameters for scaleoffset compression for * validity and whether they fit a particular dataset. @@ -678,19 +678,17 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ * Programmer: Xiaowen Wu * Friday, February 4, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static htri_t -H5Z_can_apply_scaleoffset(hid_t H5_ATTR_UNUSED dcpl_id, hid_t type_id, hid_t H5_ATTR_UNUSED space_id) +H5Z__can_apply_scaleoffset(hid_t H5_ATTR_UNUSED dcpl_id, hid_t type_id, hid_t H5_ATTR_UNUSED space_id) { const H5T_t *type; /* Datatype */ H5T_class_t dtype_class; /* Datatype's class */ H5T_order_t dtype_order; /* Datatype's endianness order */ htri_t ret_value = TRUE; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Get datatype */ if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) @@ -717,11 +715,11 @@ H5Z_can_apply_scaleoffset(hid_t H5_ATTR_UNUSED dcpl_id, hid_t type_id, hid_t H5_ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5Z_can_apply_scaleoffset() */ +} /* end H5Z__can_apply_scaleoffset() */ /*------------------------------------------------------------------------- - * Function: H5Z_scaleoffset_get_type + * Function: H5Z__scaleoffset_get_type * * Purpose: Get the specific integer type based on datatype size and sign * or floating-point type based on size @@ -732,17 +730,15 @@ done: * Programmer: Xiaowen Wu * Wednesday, April 13, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static enum H5Z_scaleoffset_t -H5Z_scaleoffset_get_type(unsigned dtype_class, unsigned dtype_size, unsigned dtype_sign) +H5Z__scaleoffset_get_type(unsigned dtype_class, unsigned dtype_size, unsigned dtype_sign) { enum H5Z_scaleoffset_t type = t_bad; /* integer type */ enum H5Z_scaleoffset_t ret_value = t_bad; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(dtype_class==H5Z_SCALEOFFSET_CLS_INTEGER) { if(dtype_sign==H5Z_SCALEOFFSET_SGN_NONE) { /* unsigned integer */ @@ -786,7 +782,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5Z_scaleoffset_set_parms_fillval + * Function: H5Z__scaleoffset_set_parms_fillval * * Purpose: Get the fill value of the dataset and store in cd_values[] * @@ -799,13 +795,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5Z_scaleoffset_set_parms_fillval(H5P_genplist_t *dcpl_plist, +H5Z__scaleoffset_set_parms_fillval(H5P_genplist_t *dcpl_plist, H5T_t *type, enum H5Z_scaleoffset_t scale_type, unsigned cd_values[], int need_convert) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(scale_type == t_uchar) H5Z_scaleoffset_set_filval_3(unsigned char, dcpl_plist, type, cd_values, need_convert) @@ -834,11 +830,11 @@ H5Z_scaleoffset_set_parms_fillval(H5P_genplist_t *dcpl_plist, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5Z_scaleoffset_set_parms_fillval() */ +} /* end H5Z__scaleoffset_set_parms_fillval() */ /*------------------------------------------------------------------------- - * Function: H5Z_set_local_scaleoffset + * Function: H5Z__set_local_scaleoffset * * Purpose: Set the "local" dataset parameters for scaleoffset * compression. @@ -849,12 +845,10 @@ done: * Programmer: Xiaowen Wu * Friday, February 4, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5Z_set_local_scaleoffset(hid_t dcpl_id, hid_t type_id, hid_t space_id) +H5Z__set_local_scaleoffset(hid_t dcpl_id, hid_t type_id, hid_t space_id) { H5P_genplist_t *dcpl_plist; /* Property list pointer */ H5T_t *type; /* Datatype */ @@ -871,7 +865,7 @@ H5Z_set_local_scaleoffset(hid_t dcpl_id, hid_t type_id, hid_t space_id) H5D_fill_value_t status; /* Status of fill value in property list */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Get the plist structure */ if(NULL == (dcpl_plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE))) @@ -997,12 +991,12 @@ H5Z_set_local_scaleoffset(hid_t dcpl_id, hid_t type_id, hid_t space_id) need_convert = TRUE; /* Before getting fill value, get its type */ - if((scale_type = H5Z_scaleoffset_get_type(cd_values[H5Z_SCALEOFFSET_PARM_CLASS], + if((scale_type = H5Z__scaleoffset_get_type(cd_values[H5Z_SCALEOFFSET_PARM_CLASS], cd_values[H5Z_SCALEOFFSET_PARM_SIZE], cd_values[H5Z_SCALEOFFSET_PARM_SIGN])) == 0) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot use C integer datatype for cast") /* Get dataset fill value and store in cd_values[] */ - if(H5Z_scaleoffset_set_parms_fillval(dcpl_plist, type, scale_type, cd_values, need_convert) < 0) + if(H5Z__scaleoffset_set_parms_fillval(dcpl_plist, type, scale_type, cd_values, need_convert) < 0) HGOTO_ERROR(H5E_PLINE, H5E_CANTSET, FAIL, "unable to set fill value") } /* end else */ @@ -1012,11 +1006,11 @@ H5Z_set_local_scaleoffset(hid_t dcpl_id, hid_t type_id, hid_t space_id) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5Z_set_local_scaleoffset() */ +} /* end H5Z__set_local_scaleoffset() */ /*------------------------------------------------------------------------- - * Function: H5Z_filter_scaleoffset + * Function: H5Z__filter_scaleoffset * * Purpose: Implement an I/O filter for storing packed integer * data using scale and offset method. @@ -1027,12 +1021,10 @@ done: * Programmer: Xiaowen Wu * Monday, February 7, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static size_t -H5Z_filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_values[], +H5Z__filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_values[], size_t nbytes, size_t *buf_size, void **buf) { size_t ret_value = 0; /* return value */ @@ -1053,7 +1045,7 @@ H5Z_filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_value unsigned i; /* index */ parms_atomic p; /* parameters needed for compress/decompress functions */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check arguments */ if(cd_nelmts != H5Z_SCALEOFFSET_TOTAL_NPARMS) @@ -1179,7 +1171,7 @@ H5Z_filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_value /* convert to dataset datatype endianness order if needed */ if(need_convert) - H5Z_scaleoffset_convert(outbuf, d_nelmts, p.size); + H5Z__scaleoffset_convert(outbuf, d_nelmts, p.size); *buf = outbuf; outbuf = NULL; @@ -1190,31 +1182,31 @@ H5Z_filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_value /* decompress the buffer if minbits not equal to zero */ if(minbits != 0) - H5Z_scaleoffset_decompress(outbuf, d_nelmts, (unsigned char*)(*buf)+buf_offset, p); + H5Z__scaleoffset_decompress(outbuf, d_nelmts, (unsigned char*)(*buf)+buf_offset, p); else { /* fill value is not defined and all data elements have the same value */ for(i = 0; i < size_out; i++) outbuf[i] = 0; } /* before postprocess, get memory type */ - if((type = H5Z_scaleoffset_get_type(dtype_class, p.size, dtype_sign)) == 0) + if((type = H5Z__scaleoffset_get_type(dtype_class, p.size, dtype_sign)) == 0) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, 0, "cannot use C integer datatype for cast") /* postprocess after decompression */ if(dtype_class==H5Z_SCALEOFFSET_CLS_INTEGER) - H5Z_scaleoffset_postdecompress_i(outbuf, d_nelmts, type, filavail, + H5Z__scaleoffset_postdecompress_i(outbuf, d_nelmts, type, filavail, cd_values, minbits, minval); if(dtype_class==H5Z_SCALEOFFSET_CLS_FLOAT) if(scale_type==0) { /* variable-minimum-bits method */ - if(H5Z_scaleoffset_postdecompress_fd(outbuf, d_nelmts, type, filavail, + if(H5Z__scaleoffset_postdecompress_fd(outbuf, d_nelmts, type, filavail, cd_values, minbits, minval, D_val)==FAIL) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, 0, "post-decompression failed") } /* after postprocess, convert to dataset datatype endianness order if needed */ if(need_convert) - H5Z_scaleoffset_convert(outbuf, d_nelmts, p.size); + H5Z__scaleoffset_convert(outbuf, d_nelmts, p.size); } /* output; compress */ else { @@ -1222,20 +1214,20 @@ H5Z_filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_value /* before preprocess, convert to memory endianness order if needed */ if(need_convert) - H5Z_scaleoffset_convert(*buf, d_nelmts, p.size); + H5Z__scaleoffset_convert(*buf, d_nelmts, p.size); /* before preprocess, get memory type */ - if((type = H5Z_scaleoffset_get_type(dtype_class, p.size, dtype_sign))==0) + if((type = H5Z__scaleoffset_get_type(dtype_class, p.size, dtype_sign))==0) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, 0, "cannot use C integer datatype for cast") /* preprocess before compression */ if(dtype_class==H5Z_SCALEOFFSET_CLS_INTEGER) - H5Z_scaleoffset_precompress_i(*buf, d_nelmts, type, filavail, + H5Z__scaleoffset_precompress_i(*buf, d_nelmts, type, filavail, cd_values, &minbits, &minval); if(dtype_class==H5Z_SCALEOFFSET_CLS_FLOAT) if(scale_type==0) { /* variable-minimum-bits method */ - if(H5Z_scaleoffset_precompress_fd(*buf, d_nelmts, type, filavail, + if(H5Z__scaleoffset_precompress_fd(*buf, d_nelmts, type, filavail, cd_values, &minbits, &minval, D_val)==FAIL) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, 0, "pre-compression failed") } @@ -1289,7 +1281,7 @@ H5Z_filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_value * all data elements have the same value */ if(minbits != 0) - H5Z_scaleoffset_compress((unsigned char *)*buf, d_nelmts, outbuf + buf_offset, size_out - buf_offset, p); + H5Z__scaleoffset_compress((unsigned char *)*buf, d_nelmts, outbuf + buf_offset, size_out - buf_offset, p); } /* free the input buffer */ @@ -1320,7 +1312,7 @@ done: * or from big-endian to little-endian 2/21/2005 */ static void -H5Z_scaleoffset_convert(void *buf, unsigned d_nelmts, unsigned dtype_size) +H5Z__scaleoffset_convert(void *buf, unsigned d_nelmts, unsigned dtype_size) { if(dtype_size > 1) { size_t i, j; @@ -1335,13 +1327,13 @@ H5Z_scaleoffset_convert(void *buf, unsigned d_nelmts, unsigned dtype_size) buffer[i + dtype_size - 1 - j] = temp; } /* end for */ } /* end if */ -} /* end H5Z_scaleoffset_convert() */ +} /* end H5Z__scaleoffset_convert() */ /* return ceiling of floating-point log2 function * receive unsigned integer as argument 3/10/2005 */ static unsigned -H5Z_scaleoffset_log2(unsigned long long num) +H5Z__scaleoffset_log2(unsigned long long num) { unsigned v = 0; unsigned long long lower_bound = 1; /* is power of 2, largest value <= num */ @@ -1360,7 +1352,7 @@ H5Z_scaleoffset_log2(unsigned long long num) /* precompress for integer type */ static void -H5Z_scaleoffset_precompress_i(void *data, unsigned d_nelmts, enum H5Z_scaleoffset_t type, +H5Z__scaleoffset_precompress_i(void *data, unsigned d_nelmts, enum H5Z_scaleoffset_t type, unsigned filavail, const unsigned cd_values[], uint32_t *minbits, unsigned long long *minval) { if(type == t_uchar) @@ -1392,7 +1384,7 @@ H5Z_scaleoffset_precompress_i(void *data, unsigned d_nelmts, enum H5Z_scaleoffse return; } span = (unsigned char)(max - min + 1); - *minbits = H5Z_scaleoffset_log2((unsigned long long)(span+1)); + *minbits = H5Z__scaleoffset_log2((unsigned long long)(span+1)); } else /* minbits already set, only calculate min */ H5Z_scaleoffset_min_1(i, d_nelmts, buf, filval, min) if(*minbits != sizeof(signed char)*8) /* change values if minbits != full precision */ @@ -1407,7 +1399,7 @@ H5Z_scaleoffset_precompress_i(void *data, unsigned d_nelmts, enum H5Z_scaleoffse return; } span = (unsigned char)(max - min + 1); - *minbits = H5Z_scaleoffset_log2((unsigned long long)span); + *minbits = H5Z__scaleoffset_log2((unsigned long long)span); } else /* minbits already set, only calculate min */ H5Z_scaleoffset_min_2(i, d_nelmts, buf, min) if(*minbits != sizeof(signed char) * 8) /* change values if minbits != full precision */ @@ -1432,7 +1424,7 @@ H5Z_scaleoffset_precompress_i(void *data, unsigned d_nelmts, enum H5Z_scaleoffse /* postdecompress for integer type */ static void -H5Z_scaleoffset_postdecompress_i(void *data, unsigned d_nelmts, enum H5Z_scaleoffset_t type, +H5Z__scaleoffset_postdecompress_i(void *data, unsigned d_nelmts, enum H5Z_scaleoffset_t type, unsigned filavail, const unsigned cd_values[], uint32_t minbits, unsigned long long minval) { long long sminval = *(long long*)&minval; /* for signed integer types */ @@ -1481,13 +1473,13 @@ H5Z_scaleoffset_postdecompress_i(void *data, unsigned d_nelmts, enum H5Z_scaleof /* precompress for floating-point type, variable-minimum-bits method success: non-negative, failure: negative 4/15/05 */ static herr_t -H5Z_scaleoffset_precompress_fd(void *data, unsigned d_nelmts, enum H5Z_scaleoffset_t type, +H5Z__scaleoffset_precompress_fd(void *data, unsigned d_nelmts, enum H5Z_scaleoffset_t type, unsigned filavail, const unsigned cd_values[], uint32_t *minbits, unsigned long long *minval, double D_val) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(type == t_float) H5Z_scaleoffset_precompress_3(float, HDpowf, HDfabsf, HDroundf, HDlroundf, HDllroundf, data, d_nelmts, @@ -1503,14 +1495,14 @@ done: /* postdecompress for floating-point type, variable-minimum-bits method success: non-negative, failure: negative 4/15/05 */ static herr_t -H5Z_scaleoffset_postdecompress_fd(void *data, unsigned d_nelmts, enum H5Z_scaleoffset_t type, +H5Z__scaleoffset_postdecompress_fd(void *data, unsigned d_nelmts, enum H5Z_scaleoffset_t type, unsigned filavail, const unsigned cd_values[], uint32_t minbits, unsigned long long minval, double D_val) { long long sminval = (long long)minval; /* for signed integer types */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(type == t_float) H5Z_scaleoffset_postdecompress_3(float, HDpowf, data, d_nelmts, filavail, @@ -1524,14 +1516,14 @@ done: } static void -H5Z_scaleoffset_next_byte(size_t *j, unsigned *buf_len) +H5Z__scaleoffset_next_byte(size_t *j, unsigned *buf_len) { ++(*j); *buf_len = 8 * sizeof(unsigned char); } static void -H5Z_scaleoffset_decompress_one_byte(unsigned char *data, size_t data_offset, +H5Z__scaleoffset_decompress_one_byte(unsigned char *data, size_t data_offset, unsigned k, unsigned begin_i, unsigned char *buffer, size_t *j, unsigned *buf_len, parms_atomic p, unsigned dtype_len) { @@ -1552,7 +1544,7 @@ H5Z_scaleoffset_decompress_one_byte(unsigned char *data, size_t data_offset, else { data[data_offset + k] = (unsigned char)((val & ~((unsigned)(~0) << *buf_len)) << (dat_len - *buf_len)); dat_len -= *buf_len; - H5Z_scaleoffset_next_byte(j, buf_len); + H5Z__scaleoffset_next_byte(j, buf_len); if(dat_len == 0) return; @@ -1563,7 +1555,7 @@ H5Z_scaleoffset_decompress_one_byte(unsigned char *data, size_t data_offset, } static void -H5Z_scaleoffset_decompress_one_atomic(unsigned char *data, size_t data_offset, +H5Z__scaleoffset_decompress_one_atomic(unsigned char *data, size_t data_offset, unsigned char *buffer, size_t *j, unsigned *buf_len, parms_atomic p) { /* begin_i: the index of byte having first significant bit */ @@ -1579,7 +1571,7 @@ H5Z_scaleoffset_decompress_one_atomic(unsigned char *data, size_t data_offset, begin_i = p.size - 1 - (dtype_len - p.minbits) / 8; for(k = (int)begin_i; k >= 0; k--) - H5Z_scaleoffset_decompress_one_byte(data, data_offset, (unsigned)k, begin_i, + H5Z__scaleoffset_decompress_one_byte(data, data_offset, (unsigned)k, begin_i, buffer, j, buf_len, p, dtype_len); } else { /* big endian */ @@ -1588,13 +1580,13 @@ H5Z_scaleoffset_decompress_one_atomic(unsigned char *data, size_t data_offset, begin_i = (dtype_len - p.minbits) / 8; for(k = (int)begin_i; k <= (int)(p.size - 1); k++) - H5Z_scaleoffset_decompress_one_byte(data, data_offset, (unsigned)k, begin_i, + H5Z__scaleoffset_decompress_one_byte(data, data_offset, (unsigned)k, begin_i, buffer, j, buf_len, p, dtype_len); } } static void -H5Z_scaleoffset_decompress(unsigned char *data, unsigned d_nelmts, +H5Z__scaleoffset_decompress(unsigned char *data, unsigned d_nelmts, unsigned char *buffer, parms_atomic p) { /* i: index of data, j: index of buffer, @@ -1612,11 +1604,11 @@ H5Z_scaleoffset_decompress(unsigned char *data, unsigned d_nelmts, /* decompress */ for(i = 0; i < d_nelmts; i++) - H5Z_scaleoffset_decompress_one_atomic(data, i * p.size, buffer, &j, &buf_len, p); + H5Z__scaleoffset_decompress_one_atomic(data, i * p.size, buffer, &j, &buf_len, p); } static void -H5Z_scaleoffset_compress_one_byte(unsigned char *data, size_t data_offset, +H5Z__scaleoffset_compress_one_byte(unsigned char *data, size_t data_offset, unsigned k, unsigned begin_i, unsigned char *buffer, size_t *j, unsigned *buf_len, parms_atomic p, unsigned dtype_len) { @@ -1636,7 +1628,7 @@ H5Z_scaleoffset_compress_one_byte(unsigned char *data, size_t data_offset, } else { buffer[*j] |= (unsigned char)((unsigned)(val >> (dat_len - *buf_len)) & ~((unsigned)(~0) << *buf_len)); dat_len -= *buf_len; - H5Z_scaleoffset_next_byte(j, buf_len); + H5Z__scaleoffset_next_byte(j, buf_len); if(dat_len == 0) return; @@ -1646,7 +1638,7 @@ H5Z_scaleoffset_compress_one_byte(unsigned char *data, size_t data_offset, } static void -H5Z_scaleoffset_compress_one_atomic(unsigned char *data, size_t data_offset, +H5Z__scaleoffset_compress_one_atomic(unsigned char *data, size_t data_offset, unsigned char *buffer, size_t *j, unsigned *buf_len, parms_atomic p) { /* begin_i: the index of byte having first significant bit */ @@ -1662,7 +1654,7 @@ H5Z_scaleoffset_compress_one_atomic(unsigned char *data, size_t data_offset, begin_i = p.size - 1 - (dtype_len - p.minbits) / 8; for(k = (int)begin_i; k >= 0; k--) - H5Z_scaleoffset_compress_one_byte(data, data_offset, (unsigned)k, begin_i, + H5Z__scaleoffset_compress_one_byte(data, data_offset, (unsigned)k, begin_i, buffer, j, buf_len, p, dtype_len); } else { /* big endian */ @@ -1670,13 +1662,13 @@ H5Z_scaleoffset_compress_one_atomic(unsigned char *data, size_t data_offset, begin_i = (dtype_len - p.minbits) / 8; for(k = (int)begin_i; k <= (int)(p.size - 1); k++) - H5Z_scaleoffset_compress_one_byte(data, data_offset, (unsigned)k, begin_i, + H5Z__scaleoffset_compress_one_byte(data, data_offset, (unsigned)k, begin_i, buffer, j, buf_len, p, dtype_len); } } static void -H5Z_scaleoffset_compress(unsigned char *data, unsigned d_nelmts, +H5Z__scaleoffset_compress(unsigned char *data, unsigned d_nelmts, unsigned char *buffer, size_t buffer_size, parms_atomic p) { /* i: index of data, j: index of buffer, @@ -1694,6 +1686,6 @@ H5Z_scaleoffset_compress(unsigned char *data, unsigned d_nelmts, /* compress */ for(i = 0; i < d_nelmts; i++) - H5Z_scaleoffset_compress_one_atomic(data, i * p.size, buffer, &j, &buf_len, p); + H5Z__scaleoffset_compress_one_atomic(data, i * p.size, buffer, &j, &buf_len, p); } diff --git a/src/H5Zshuffle.c b/src/H5Zshuffle.c index b1d0722..224c78e 100644 --- a/src/H5Zshuffle.c +++ b/src/H5Zshuffle.c @@ -23,20 +23,20 @@ #include "H5Zpkg.h" /* Data filters */ /* Local function prototypes */ -static herr_t H5Z_set_local_shuffle(hid_t dcpl_id, hid_t type_id, hid_t space_id); -static size_t H5Z_filter_shuffle(unsigned flags, size_t cd_nelmts, +static herr_t H5Z__set_local_shuffle(hid_t dcpl_id, hid_t type_id, hid_t space_id); +static size_t H5Z__filter_shuffle(unsigned flags, size_t cd_nelmts, const unsigned cd_values[], size_t nbytes, size_t *buf_size, void **buf); /* This message derives from H5Z */ const H5Z_class2_t H5Z_SHUFFLE[1] = {{ - H5Z_CLASS_T_VERS, /* H5Z_class_t version */ + H5Z_CLASS_T_VERS, /* H5Z_class_t version */ H5Z_FILTER_SHUFFLE, /* Filter id number */ - 1, /* encoder_present flag (set to true) */ - 1, /* decoder_present flag (set to true) */ + 1, /* encoder_present flag (set to true) */ + 1, /* decoder_present flag (set to true) */ "shuffle", /* Filter name for debugging */ NULL, /* The "can apply" callback */ - H5Z_set_local_shuffle, /* The "set local" callback */ - H5Z_filter_shuffle, /* The actual filter function */ + H5Z__set_local_shuffle, /* The "set local" callback */ + H5Z__filter_shuffle, /* The actual filter function */ }}; /* Local macros */ @@ -44,7 +44,7 @@ const H5Z_class2_t H5Z_SHUFFLE[1] = {{ /*------------------------------------------------------------------------- - * Function: H5Z_set_local_shuffle + * Function: H5Z__set_local_shuffle * * Purpose: Set the "local" dataset parameter for data shuffling to be * the size of the datatype. @@ -55,12 +55,10 @@ const H5Z_class2_t H5Z_SHUFFLE[1] = {{ * Programmer: Quincey Koziol * Monday, April 7, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5Z_set_local_shuffle(hid_t dcpl_id, hid_t type_id, hid_t H5_ATTR_UNUSED space_id) +H5Z__set_local_shuffle(hid_t dcpl_id, hid_t type_id, hid_t H5_ATTR_UNUSED space_id) { H5P_genplist_t *dcpl_plist; /* Property list pointer */ const H5T_t *type; /* Datatype */ @@ -69,7 +67,7 @@ H5Z_set_local_shuffle(hid_t dcpl_id, hid_t type_id, hid_t H5_ATTR_UNUSED space_i unsigned cd_values[H5Z_SHUFFLE_TOTAL_NPARMS]; /* Filter parameters */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_STATIC /* Get the plist structure */ if(NULL == (dcpl_plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE))) @@ -93,11 +91,11 @@ H5Z_set_local_shuffle(hid_t dcpl_id, hid_t type_id, hid_t H5_ATTR_UNUSED space_i done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5Z_set_local_shuffle() */ +} /* end H5Z__set_local_shuffle() */ /*------------------------------------------------------------------------- - * Function: H5Z_filter_shuffle + * Function: H5Z__filter_shuffle * * Purpose: Implement an I/O filter which "de-interlaces" a block of data * by putting all the bytes in a byte-position for each element @@ -112,14 +110,10 @@ done: * Programmer: Kent Yang * Wednesday, November 13, 2002 * - * Modifications: - * Quincey Koziol, November 13, 2002 - * Cleaned up code. - * *------------------------------------------------------------------------- */ static size_t -H5Z_filter_shuffle(unsigned flags, size_t cd_nelmts, const unsigned cd_values[], +H5Z__filter_shuffle(unsigned flags, size_t cd_nelmts, const unsigned cd_values[], size_t nbytes, size_t *buf_size, void **buf) { void *dest = NULL; /* Buffer to deposit [un]shuffled bytes into */ @@ -134,7 +128,7 @@ H5Z_filter_shuffle(unsigned flags, size_t cd_nelmts, const unsigned cd_values[], size_t leftover; /* Extra bytes at end of buffer */ size_t ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI(0) + FUNC_ENTER_STATIC /* Check arguments */ if (cd_nelmts!=H5Z_SHUFFLE_TOTAL_NPARMS || cd_values[H5Z_SHUFFLE_PARM_SIZE]==0) diff --git a/src/H5Zszip.c b/src/H5Zszip.c index 8ed173e..c72c499 100644 --- a/src/H5Zszip.c +++ b/src/H5Zszip.c @@ -32,27 +32,27 @@ #endif /* Local function prototypes */ -static htri_t H5Z_can_apply_szip(hid_t dcpl_id, hid_t type_id, hid_t space_id); -static herr_t H5Z_set_local_szip(hid_t dcpl_id, hid_t type_id, hid_t space_id); -static size_t H5Z_filter_szip (unsigned flags, size_t cd_nelmts, +static htri_t H5Z__can_apply_szip(hid_t dcpl_id, hid_t type_id, hid_t space_id); +static herr_t H5Z__set_local_szip(hid_t dcpl_id, hid_t type_id, hid_t space_id); +static size_t H5Z__filter_szip(unsigned flags, size_t cd_nelmts, const unsigned cd_values[], size_t nbytes, size_t *buf_size, void **buf); /* This message derives from H5Z */ H5Z_class2_t H5Z_SZIP[1] = {{ - H5Z_CLASS_T_VERS, /* H5Z_class_t version */ + H5Z_CLASS_T_VERS, /* H5Z_class_t version */ H5Z_FILTER_SZIP, /* Filter id number */ - 1, /* Assume encoder present: check before registering */ - 1, /* decoder_present flag (set to true) */ - "szip", /* Filter name for debugging */ - H5Z_can_apply_szip, /* The "can apply" callback */ - H5Z_set_local_szip, /* The "set local" callback */ - H5Z_filter_szip, /* The actual filter function */ + 1, /* Assume encoder present: check before registering */ + 1, /* decoder_present flag (set to true) */ + "szip", /* Filter name for debugging */ + H5Z__can_apply_szip, /* The "can apply" callback */ + H5Z__set_local_szip, /* The "set local" callback */ + H5Z__filter_szip, /* The actual filter function */ }}; /*------------------------------------------------------------------------- - * Function: H5Z_can_apply_szip + * Function: H5Z__can_apply_szip * * Purpose: Check the parameters for szip compression for validity and * whether they fit a particular dataset. @@ -73,14 +73,14 @@ H5Z_class2_t H5Z_SZIP[1] = {{ *------------------------------------------------------------------------- */ static htri_t -H5Z_can_apply_szip(hid_t H5_ATTR_UNUSED dcpl_id, hid_t type_id, hid_t H5_ATTR_UNUSED space_id) +H5Z__can_apply_szip(hid_t H5_ATTR_UNUSED dcpl_id, hid_t type_id, hid_t H5_ATTR_UNUSED space_id) { const H5T_t *type; /* Datatype */ unsigned dtype_size; /* Datatype's size (in bits) */ H5T_order_t dtype_order; /* Datatype's endianness order */ htri_t ret_value = TRUE; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_STATIC /* Get datatype */ if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) @@ -105,11 +105,11 @@ H5Z_can_apply_szip(hid_t H5_ATTR_UNUSED dcpl_id, hid_t type_id, hid_t H5_ATTR_UN done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5Z_can_apply_szip() */ +} /* end H5Z__can_apply_szip() */ /*------------------------------------------------------------------------- - * Function: H5Z_set_local_szip + * Function: H5Z__set_local_szip * * Purpose: Set the "local" dataset parameters for szip compression. * @@ -119,18 +119,10 @@ done: * Programmer: Quincey Koziol * Monday, April 7, 2003 * - * Modifications: Used new logic to set the size of the scanline parameter. - * Now SZIP compression can be applied to the chunk - * of any shape and size with only one restriction: the number - * of elements in the chunk has to be not less than number - * of elements (pixels) in the block (cd_values[H5Z_SZIP_PARM_PPB] - * parameter). - * Elena Pourmal, July 20, 2004 - * *------------------------------------------------------------------------- */ static herr_t -H5Z_set_local_szip(hid_t dcpl_id, hid_t type_id, hid_t space_id) +H5Z__set_local_szip(hid_t dcpl_id, hid_t type_id, hid_t space_id) { H5P_genplist_t *dcpl_plist; /* Property list pointer */ const H5T_t *type; /* Datatype */ @@ -147,7 +139,7 @@ H5Z_set_local_szip(hid_t dcpl_id, hid_t type_id, hid_t space_id) hsize_t scanline; /* Size of dataspace's fastest changing dimension */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_STATIC /* Get the plist structure */ if(NULL == (dcpl_plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE))) @@ -253,11 +245,11 @@ H5Z_set_local_szip(hid_t dcpl_id, hid_t type_id, hid_t space_id) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5Z_set_local_szip() */ +} /* end H5Z__set_local_szip() */ /*------------------------------------------------------------------------- - * Function: H5Z_filter_szip + * Function: H5Z__filter_szip * * Purpose: Implement an I/O filter around the 'rice' algorithm in * libsz @@ -271,7 +263,7 @@ done: *------------------------------------------------------------------------- */ static size_t -H5Z_filter_szip (unsigned flags, size_t cd_nelmts, const unsigned cd_values[], +H5Z__filter_szip(unsigned flags, size_t cd_nelmts, const unsigned cd_values[], size_t nbytes, size_t *buf_size, void **buf) { size_t ret_value = 0; /* Return value */ @@ -280,7 +272,7 @@ H5Z_filter_szip (unsigned flags, size_t cd_nelmts, const unsigned cd_values[], unsigned char *newbuf = NULL; /* Pointer to input buffer */ SZ_com_t sz_param; /* szip parameter block */ - FUNC_ENTER_NOAPI(0) + FUNC_ENTER_STATIC /* Sanity check to make certain that we haven't drifted out of date with * the mask options from the szlib.h header */ diff --git a/src/H5Ztrans.c b/src/H5Ztrans.c index dfc984a..83e9c38 100644 --- a/src/H5Ztrans.c +++ b/src/H5Ztrans.c @@ -86,24 +86,20 @@ typedef struct { } H5Z_token; /* Local function prototypes */ -static H5Z_token *H5Z_get_token(H5Z_token *current); -static H5Z_node *H5Z_parse_expression(H5Z_token *current, H5Z_datval_ptrs* dat_val_pointers); -static H5Z_node *H5Z_parse_term(H5Z_token *current, H5Z_datval_ptrs* dat_val_pointers); -static H5Z_node *H5Z_parse_factor(H5Z_token *current, H5Z_datval_ptrs* dat_val_pointers); -static H5Z_node *H5Z_new_node(H5Z_token_type type); -static void H5Z_do_op(H5Z_node* tree); -static hbool_t H5Z_op_is_numbs(H5Z_node* _tree); -static hbool_t H5Z_op_is_numbs2(H5Z_node* _tree); -static hid_t H5Z_xform_find_type(const H5T_t* type); -static herr_t H5Z_xform_eval_full(H5Z_node *tree, const size_t array_size, const hid_t array_type, H5Z_result* res); -static void H5Z_xform_destroy_parse_tree(H5Z_node *tree); -static void* H5Z_xform_parse(const char *expression, H5Z_datval_ptrs* dat_val_pointers); -static void* H5Z_xform_copy_tree(H5Z_node* tree, H5Z_datval_ptrs* dat_val_pointers, H5Z_datval_ptrs* new_dat_val_pointers); -static void H5Z_xform_reduce_tree(H5Z_node* tree); -#ifdef H5Z_XFORM_DEBUG -static void H5Z_XFORM_DEBUG(H5Z_node *tree); -static void H5Z_print(H5Z_node *tree, FILE *stream); -#endif /* H5Z_XFORM_DEBUG */ +static H5Z_token *H5Z__get_token(H5Z_token *current); +static H5Z_node *H5Z__parse_expression(H5Z_token *current, H5Z_datval_ptrs* dat_val_pointers); +static H5Z_node *H5Z__parse_term(H5Z_token *current, H5Z_datval_ptrs* dat_val_pointers); +static H5Z_node *H5Z__parse_factor(H5Z_token *current, H5Z_datval_ptrs* dat_val_pointers); +static H5Z_node *H5Z__new_node(H5Z_token_type type); +static void H5Z__do_op(H5Z_node* tree); +static hbool_t H5Z__op_is_numbs(H5Z_node* _tree); +static hbool_t H5Z__op_is_numbs2(H5Z_node* _tree); +static hid_t H5Z__xform_find_type(const H5T_t* type); +static herr_t H5Z__xform_eval_full(H5Z_node *tree, const size_t array_size, const hid_t array_type, H5Z_result* res); +static void H5Z__xform_destroy_parse_tree(H5Z_node *tree); +static void* H5Z__xform_parse(const char *expression, H5Z_datval_ptrs* dat_val_pointers); +static void* H5Z__xform_copy_tree(H5Z_node* tree, H5Z_datval_ptrs* dat_val_pointers, H5Z_datval_ptrs* new_dat_val_pointers); +static void H5Z__xform_reduce_tree(H5Z_node* tree); /* PGCC (11.8-0) has trouble with the command *p++ = *p OP tree_val. It increments P first before * doing the operation. So I break down the command into two lines: @@ -312,11 +308,11 @@ static void H5Z_print(H5Z_node *tree, FILE *stream); { \ ret_value->type = (TYPE); \ if(tree->lchild) \ - ret_value->lchild = (H5Z_node*) H5Z_xform_copy_tree(tree->lchild, dat_val_pointers, new_dat_val_pointers); \ + ret_value->lchild = (H5Z_node*) H5Z__xform_copy_tree(tree->lchild, dat_val_pointers, new_dat_val_pointers); \ else \ ret_value->lchild = NULL; \ if(tree->rchild) \ - ret_value->rchild = (H5Z_node*) H5Z_xform_copy_tree(tree->rchild, dat_val_pointers, new_dat_val_pointers); \ + ret_value->rchild = (H5Z_node*) H5Z__xform_copy_tree(tree->rchild, dat_val_pointers, new_dat_val_pointers); \ else \ ret_value->rchild = NULL; \ } \ @@ -329,7 +325,7 @@ static void H5Z_print(H5Z_node *tree, FILE *stream); } /* The difference of this macro from H5Z_XFORM_DO_OP3 is that it handles the operations when the left operand is empty, like -x or +x. - * The reason that it's separated from H5Z_XFORM_DO_OP3 is because compilers don't accept operations like *x or /x. So in H5Z_do_op, + * The reason that it's separated from H5Z_XFORM_DO_OP3 is because compilers don't accept operations like *x or /x. So in H5Z__do_op, * these two macros are called in different ways. (SLU 2012/3/20) */ #define H5Z_XFORM_DO_OP6(OP) \ @@ -371,7 +367,7 @@ static void H5Z_print(H5Z_node *tree, FILE *stream); } /* - * Programmer: Bill Wendling + * Programmer: Bill Wendling * 25. August 2003 */ @@ -393,22 +389,23 @@ static void H5Z_print(H5Z_node *tree, FILE *stream); /*------------------------------------------------------------------------- - * Function: H5Z_unget_token + * Function: H5Z__unget_token + * * Purpose: Rollback the H5Z_token to the previous H5Z_token retrieved. There * should only need to be one level of rollback necessary * for our grammar. + * * Return: Always succeeds. + * * Programmer: Bill Wendling * 26. August 2003 - * Modifications: - * Leon Arber: Added FUNC_ENTER / FUNC_LEAVE pairs -* + * *------------------------------------------------------------------------- */ static void -H5Z_unget_token(H5Z_token *current) +H5Z__unget_token(H5Z_token *current) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* check args */ HDassert(current); @@ -422,7 +419,7 @@ H5Z_unget_token(H5Z_token *current) /*------------------------------------------------------------------------- - * Function: H5Z_get_token + * Function: H5Z__get_token * * Purpose: Determine what the next valid H5Z_token is in the expression * string. The current position within the H5Z_token string is @@ -440,11 +437,11 @@ H5Z_unget_token(H5Z_token *current) *------------------------------------------------------------------------- */ static H5Z_token * -H5Z_get_token(H5Z_token *current) +H5Z__get_token(H5Z_token *current) { H5Z_token *ret_value = current; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(current); @@ -560,27 +557,24 @@ done: /*------------------------------------------------------------------------- - * Function: H5Z_xform_destroy_parse_tree + * Function: H5Z__xform_destroy_parse_tree * Purpose: Recursively destroys the expression tree. * Return: Nothing * Programmer: Bill Wendling * 25. August 2003 - * Modifications: - * Leon Arber: Added FUNC_ENTER / FUNC_LEAVE pairs * *------------------------------------------------------------------------- */ static void -H5Z_xform_destroy_parse_tree(H5Z_node *tree) +H5Z__xform_destroy_parse_tree(H5Z_node *tree) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR - if (tree) - { - H5Z_xform_destroy_parse_tree(tree->lchild); - H5Z_xform_destroy_parse_tree(tree->rchild); - H5MM_xfree(tree); - tree = NULL; + if(tree) { + H5Z__xform_destroy_parse_tree(tree->lchild); + H5Z__xform_destroy_parse_tree(tree->rchild); + H5MM_xfree(tree); + tree = NULL; } FUNC_LEAVE_NOAPI_VOID @@ -593,7 +587,7 @@ H5Z_xform_destroy_parse_tree(H5Z_node *tree) * Purpose: Entry function for parsing the expression string. * * Return: Success: Valid H5Z_node ptr to an expression tree. - * NULLure: NULL + * Failure: NULL * * Programmer: Bill Wendling * 26. August 2003 @@ -601,12 +595,12 @@ H5Z_xform_destroy_parse_tree(H5Z_node *tree) *------------------------------------------------------------------------- */ static void * -H5Z_xform_parse(const char *expression, H5Z_datval_ptrs* dat_val_pointers) +H5Z__xform_parse(const char *expression, H5Z_datval_ptrs* dat_val_pointers) { H5Z_token tok; void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI(NULL) + FUNC_ENTER_STATIC if(!expression) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "No expression provided?") @@ -614,9 +608,9 @@ H5Z_xform_parse(const char *expression, H5Z_datval_ptrs* dat_val_pointers) /* Set up the initial H5Z_token for parsing */ tok.tok_expr = tok.tok_begin = tok.tok_end = expression; - ret_value = (void*)H5Z_parse_expression(&tok, dat_val_pointers); + ret_value = (void*)H5Z__parse_expression(&tok, dat_val_pointers); - H5Z_xform_reduce_tree((H5Z_node*)ret_value); + H5Z__xform_reduce_tree((H5Z_node*)ret_value); done: FUNC_LEAVE_NOAPI(ret_value) @@ -624,50 +618,49 @@ done: /*------------------------------------------------------------------------- - * Function: H5Z_parse_expression + * Function: H5Z__parse_expression * Purpose: Beginning of the recursive descent parser to parse the * expression. An expression is: * * expr := term | term '+' term | term '-' term * * Return: Success: Valid H5Z_node ptr to expression tree - * NULLure: NULL + * Failure: NULL + * * Programmer: Bill Wendling * 26. August 2003 - * Modifications: - * Leon Arber: Added FUNC_ENTER / FUNC_LEAVE pairs * *------------------------------------------------------------------------- */ static H5Z_node * -H5Z_parse_expression(H5Z_token *current, H5Z_datval_ptrs* dat_val_pointers) +H5Z__parse_expression(H5Z_token *current, H5Z_datval_ptrs* dat_val_pointers) { H5Z_node *expr; H5Z_node *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC - expr = H5Z_parse_term(current, dat_val_pointers); + expr = H5Z__parse_term(current, dat_val_pointers); for (;;) { H5Z_node *new_node; - current = H5Z_get_token(current); + current = H5Z__get_token(current); switch(current->tok_type) { case H5Z_XFORM_PLUS: - new_node = H5Z_new_node(H5Z_XFORM_PLUS); + new_node = H5Z__new_node(H5Z_XFORM_PLUS); if (!new_node) { - H5Z_xform_destroy_parse_tree(expr); + H5Z__xform_destroy_parse_tree(expr); HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Unable to allocate new node") } new_node->lchild = expr; - new_node->rchild = H5Z_parse_term(current, dat_val_pointers); + new_node->rchild = H5Z__parse_term(current, dat_val_pointers); if (!new_node->rchild) { - H5Z_xform_destroy_parse_tree(new_node); + H5Z__xform_destroy_parse_tree(new_node); HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression") } @@ -675,18 +668,18 @@ H5Z_parse_expression(H5Z_token *current, H5Z_datval_ptrs* dat_val_pointers) break; case H5Z_XFORM_MINUS: - new_node = H5Z_new_node(H5Z_XFORM_MINUS); + new_node = H5Z__new_node(H5Z_XFORM_MINUS); if (!new_node) { - H5Z_xform_destroy_parse_tree(expr); + H5Z__xform_destroy_parse_tree(expr); HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Unable to allocate new node") } new_node->lchild = expr; - new_node->rchild = H5Z_parse_term(current, dat_val_pointers); + new_node->rchild = H5Z__parse_term(current, dat_val_pointers); if (!new_node->rchild) { - H5Z_xform_destroy_parse_tree(new_node); + H5Z__xform_destroy_parse_tree(new_node); HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression") } @@ -694,7 +687,7 @@ H5Z_parse_expression(H5Z_token *current, H5Z_datval_ptrs* dat_val_pointers) break; case H5Z_XFORM_RPAREN: - H5Z_unget_token(current); + H5Z__unget_token(current); HGOTO_DONE(expr) case H5Z_XFORM_END: @@ -708,7 +701,7 @@ H5Z_parse_expression(H5Z_token *current, H5Z_datval_ptrs* dat_val_pointers) case H5Z_XFORM_DIVIDE: case H5Z_XFORM_LPAREN: default: - H5Z_xform_destroy_parse_tree(expr); + H5Z__xform_destroy_parse_tree(expr); HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression") } } @@ -719,49 +712,48 @@ done: /*------------------------------------------------------------------------- - * Function: H5Z_parse_term + * Function: H5Z__parse_term * Purpose: Parses a term in our expression language. A term is: * * term := factor | factor '*' factor | factor '/' factor * * Return: Success: Valid H5Z_node ptr to expression tree - * NULLure: NULL + * Failure: NULL + * * Programmer: Bill Wendling * 26. August 2003 - * Modifications: - * Leon Arber: Added FUNC_ENTER / FUNC_LEAVE pairs -* + * *------------------------------------------------------------------------- */ static H5Z_node * -H5Z_parse_term(H5Z_token *current, H5Z_datval_ptrs* dat_val_pointers) +H5Z__parse_term(H5Z_token *current, H5Z_datval_ptrs* dat_val_pointers) { H5Z_node *term = NULL; H5Z_node *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC - term = H5Z_parse_factor(current, dat_val_pointers); + term = H5Z__parse_factor(current, dat_val_pointers); for (;;) { H5Z_node *new_node; - current = H5Z_get_token(current); + current = H5Z__get_token(current); switch (current->tok_type) { case H5Z_XFORM_MULT: - new_node = H5Z_new_node(H5Z_XFORM_MULT); + new_node = H5Z__new_node(H5Z_XFORM_MULT); if (!new_node) { - H5Z_xform_destroy_parse_tree(term); + H5Z__xform_destroy_parse_tree(term); HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Unable to allocate new node") } new_node->lchild = term; - new_node->rchild = H5Z_parse_factor(current, dat_val_pointers); + new_node->rchild = H5Z__parse_factor(current, dat_val_pointers); if (!new_node->rchild) { - H5Z_xform_destroy_parse_tree(new_node); + H5Z__xform_destroy_parse_tree(new_node); HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression") } @@ -769,25 +761,25 @@ H5Z_parse_term(H5Z_token *current, H5Z_datval_ptrs* dat_val_pointers) break; case H5Z_XFORM_DIVIDE: - new_node = H5Z_new_node(H5Z_XFORM_DIVIDE); + new_node = H5Z__new_node(H5Z_XFORM_DIVIDE); if (!new_node) { - H5Z_xform_destroy_parse_tree(term); + H5Z__xform_destroy_parse_tree(term); HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Unable to allocate new node") } new_node->lchild = term; - new_node->rchild = H5Z_parse_factor(current, dat_val_pointers); + new_node->rchild = H5Z__parse_factor(current, dat_val_pointers); term = new_node; if (!new_node->rchild) { - H5Z_xform_destroy_parse_tree(new_node); + H5Z__xform_destroy_parse_tree(new_node); HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression") } break; case H5Z_XFORM_RPAREN: - H5Z_unget_token(current); + H5Z__unget_token(current); HGOTO_DONE(term) case H5Z_XFORM_END: @@ -799,12 +791,12 @@ H5Z_parse_term(H5Z_token *current, H5Z_datval_ptrs* dat_val_pointers) case H5Z_XFORM_PLUS: case H5Z_XFORM_MINUS: case H5Z_XFORM_LPAREN: - H5Z_unget_token(current); + H5Z__unget_token(current); HGOTO_DONE(term) case H5Z_XFORM_ERROR: default: - H5Z_xform_destroy_parse_tree(term); + H5Z__xform_destroy_parse_tree(term); HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "bad transform type passed to data transform expression") } /* end switch */ } /* end for */ @@ -815,7 +807,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5Z_parse_factor + * Function: H5Z__parse_factor * Purpose: Parses a factor in our expression language. A factor is: * * factor := number | // C long or double @@ -825,28 +817,27 @@ done: * '(' expr ')' * * Return: Success: Valid H5Z_node ptr to expression tree - * NULLure: NULL + * Failure: NULL + * * Programmer: Bill Wendling * 26. August 2003 - * Modifications: - * Leon Arber: Added FUNC_ENTER / FUNC_LEAVE pairs * *------------------------------------------------------------------------- */ static H5Z_node * -H5Z_parse_factor(H5Z_token *current, H5Z_datval_ptrs* dat_val_pointers) +H5Z__parse_factor(H5Z_token *current, H5Z_datval_ptrs* dat_val_pointers) { H5Z_node *factor=NULL; H5Z_node *new_node; H5Z_node *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC - current = H5Z_get_token(current); + current = H5Z__get_token(current); switch (current->tok_type) { case H5Z_XFORM_INTEGER: - factor = H5Z_new_node(H5Z_XFORM_INTEGER); + factor = H5Z__new_node(H5Z_XFORM_INTEGER); if (!factor) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Unable to allocate new node") @@ -854,7 +845,7 @@ H5Z_parse_factor(H5Z_token *current, H5Z_datval_ptrs* dat_val_pointers) break; case H5Z_XFORM_FLOAT: - factor = H5Z_new_node(H5Z_XFORM_FLOAT); + factor = H5Z__new_node(H5Z_XFORM_FLOAT); if (!factor) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Unable to allocate new node") @@ -862,7 +853,7 @@ H5Z_parse_factor(H5Z_token *current, H5Z_datval_ptrs* dat_val_pointers) break; case H5Z_XFORM_SYMBOL: - factor = H5Z_new_node(H5Z_XFORM_SYMBOL); + factor = H5Z__new_node(H5Z_XFORM_SYMBOL); if (!factor) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Unable to allocate new node") @@ -872,76 +863,76 @@ H5Z_parse_factor(H5Z_token *current, H5Z_datval_ptrs* dat_val_pointers) break; case H5Z_XFORM_LPAREN: - factor = H5Z_parse_expression(current, dat_val_pointers); + factor = H5Z__parse_expression(current, dat_val_pointers); if (!factor) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Unable to allocate new node") - current = H5Z_get_token(current); + current = H5Z__get_token(current); if (current->tok_type != H5Z_XFORM_RPAREN) { - H5Z_xform_destroy_parse_tree(factor); + H5Z__xform_destroy_parse_tree(factor); HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Syntax error in data transform expression") } break; case H5Z_XFORM_RPAREN: /* We shouldn't see a ) right now */ - H5Z_xform_destroy_parse_tree(factor); + H5Z__xform_destroy_parse_tree(factor); HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Syntax error: unexpected ')' ") case H5Z_XFORM_PLUS: /* unary + */ - new_node = H5Z_parse_factor(current, dat_val_pointers); + new_node = H5Z__parse_factor(current, dat_val_pointers); if (new_node) { if (new_node->type != H5Z_XFORM_INTEGER && new_node->type != H5Z_XFORM_FLOAT && new_node->type != H5Z_XFORM_SYMBOL) { - H5Z_xform_destroy_parse_tree(new_node); - H5Z_xform_destroy_parse_tree(factor); + H5Z__xform_destroy_parse_tree(new_node); + H5Z__xform_destroy_parse_tree(factor); HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression") } factor = new_node; - new_node = H5Z_new_node(H5Z_XFORM_PLUS); + new_node = H5Z__new_node(H5Z_XFORM_PLUS); if (!new_node) { - H5Z_xform_destroy_parse_tree(factor); + H5Z__xform_destroy_parse_tree(factor); HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression") } new_node->rchild = factor; factor = new_node; } else { - H5Z_xform_destroy_parse_tree(factor); + H5Z__xform_destroy_parse_tree(factor); HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression") } break; case H5Z_XFORM_MINUS: /* unary - */ - new_node = H5Z_parse_factor(current, dat_val_pointers); + new_node = H5Z__parse_factor(current, dat_val_pointers); if (new_node) { if (new_node->type != H5Z_XFORM_INTEGER && new_node->type != H5Z_XFORM_FLOAT && new_node->type != H5Z_XFORM_SYMBOL) { - H5Z_xform_destroy_parse_tree(new_node); - H5Z_xform_destroy_parse_tree(factor); + H5Z__xform_destroy_parse_tree(new_node); + H5Z__xform_destroy_parse_tree(factor); HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression") } factor = new_node; - new_node = H5Z_new_node(H5Z_XFORM_MINUS); + new_node = H5Z__new_node(H5Z_XFORM_MINUS); if (!new_node) { - H5Z_xform_destroy_parse_tree(factor); + H5Z__xform_destroy_parse_tree(factor); HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression") } new_node->rchild = factor; factor = new_node; } else { - H5Z_xform_destroy_parse_tree(factor); + H5Z__xform_destroy_parse_tree(factor); HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression") } break; @@ -966,23 +957,24 @@ done: /*------------------------------------------------------------------------- - * Function: H5Z_new_node + * Function: H5Z__new_node + * * Purpose: Create and initialize a new H5Z_node structure. + * * Return: Success: Valid H5Z_node ptr - * NULLure: NULL + * Failure: NULL + * * Programmer: Bill Wendling * 26. August 2003 - * Modifications: - * Leon Arber: Added FUNC_ENTER / FUNC_LEAVE pairs * *------------------------------------------------------------------------- */ static H5Z_node * -H5Z_new_node(H5Z_token_type type) +H5Z__new_node(H5Z_token_type type) { H5Z_node *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(NULL == (ret_value = (H5Z_node *)H5MM_calloc(sizeof(H5Z_node)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Ran out of memory trying to allocate space for nodes in the parse tree") @@ -997,12 +989,11 @@ done: /*------------------------------------------------------------------------- * Function: H5Z_xform_eval * Purpose: If the transform is trivial, this function applies it. - * Otherwise, it calls H5Z_xform_eval_full to do the full + * Otherwise, it calls H5Z__xform_eval_full to do the full * transform. * Return: SUCCEED if transform applied successfully, FAIL otherwise * Programmer: Leon Arber * 5/1/04 - * Modifications: * *------------------------------------------------------------------------- */ @@ -1022,7 +1013,7 @@ H5Z_xform_eval(H5Z_data_xform_t *data_xform_prop, void* array, size_t array_size tree = data_xform_prop->parse_root; /* Get the datatype ID for the buffer's type */ - if((array_type = H5Z_xform_find_type(buf_type)) < 0) + if((array_type = H5Z__xform_find_type(buf_type)) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Cannot perform data transform on this type.") /* After this point, we're assured that the type of the array is handled by the eval code, @@ -1082,7 +1073,7 @@ H5Z_xform_eval(H5Z_data_xform_t *data_xform_prop, void* array, size_t array_size } /* end for */ } /* end else */ - if(H5Z_xform_eval_full(tree, array_size, array_type, &res) < 0) + if(H5Z__xform_eval_full(tree, array_size, array_type, &res) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "error while performing data transform") if(data_xform_prop->dat_val_pointers->num_ptrs > 1) @@ -1109,27 +1100,30 @@ done: /*------------------------------------------------------------------------- - * Function: H5Z_xform_eval_full + * Function: H5Z__xform_eval_full + * * Purpose: Does a full evaluation of the parse tree contained in tree * and applies this transform to array. + * + * Notes: In the case of a polynomial data transform (ie, the left and right + * subtree are both of type H5Z_XFORM_SYMBOL), the convention is + * that the left hand side will accumulate changes and, at the end, + * the new data will be copied from the lhs. + * * Return: Nothing + * * Programmer: Leon Arber * 5/1/04 - * Modifications: - * * - * Notes: In the case of a polynomial data transform (ie, the left and right subtree - * are both of type H5Z_XFORM_SYMBOL), the convention is that the left hand side - * will accumulate changes and, at the end, the new data will be copied from the lhs. *------------------------------------------------------------------------- */ static herr_t -H5Z_xform_eval_full(H5Z_node *tree, const size_t array_size, const hid_t array_type, H5Z_result *res) +H5Z__xform_eval_full(H5Z_node *tree, const size_t array_size, const hid_t array_type, H5Z_result *res) { H5Z_result resl, resr; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(tree); @@ -1154,9 +1148,9 @@ H5Z_xform_eval_full(H5Z_node *tree, const size_t array_size, const hid_t array_ res->value.dat_val = *((void**)(tree->value.dat_val)); } /* end if */ else { - if(tree->lchild && H5Z_xform_eval_full(tree->lchild, array_size, array_type, &resl) < 0) + if(tree->lchild && H5Z__xform_eval_full(tree->lchild, array_size, array_type, &resl) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "error while performing data transform") - if(H5Z_xform_eval_full(tree->rchild, array_size, array_type, &resr) < 0) + if(H5Z__xform_eval_full(tree->rchild, array_size, array_type, &resr) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "error while performing data transform") res->type = H5Z_XFORM_SYMBOL; @@ -1206,25 +1200,25 @@ H5Z_xform_eval_full(H5Z_node *tree, const size_t array_size, const hid_t array_ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5Z_xform_eval_full() */ +} /* end H5Z__xform_eval_full() */ /*------------------------------------------------------------------------- * Function: H5Z_find_type + * * Return: Native type of datatype that is passed in - * Programmer: Leon Arber, 4/20/04 - * Modifications: * + * Programmer: Leon Arber, 4/20/04 * *------------------------------------------------------------------------- */ static hid_t -H5Z_xform_find_type(const H5T_t* type) +H5Z__xform_find_type(const H5T_t* type) { H5T_t *tmp; /* Temporary datatype */ hid_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(type); @@ -1291,26 +1285,28 @@ H5Z_xform_find_type(const H5T_t* type) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5Z_xform_find_type() */ +} /* end H5Z__xform_find_type() */ /*------------------------------------------------------------------------- - * Function: H5Z_xform_copy_tree + * Function: H5Z__xform_copy_tree + * * Purpose: Makes a copy of the parse tree passed in. + * * Return: A pointer to a root for a new parse tree which is a copy * of the one passed in. + * * Programmer: Leon Arber * April 1, 2004. - * Modifications: * *------------------------------------------------------------------------- */ static void * -H5Z_xform_copy_tree(H5Z_node* tree, H5Z_datval_ptrs* dat_val_pointers, H5Z_datval_ptrs* new_dat_val_pointers) +H5Z__xform_copy_tree(H5Z_node* tree, H5Z_datval_ptrs* dat_val_pointers, H5Z_datval_ptrs* new_dat_val_pointers) { H5Z_node* ret_value=NULL; - FUNC_ENTER_NOAPI(NULL) + FUNC_ENTER_STATIC HDassert(tree); @@ -1369,22 +1365,24 @@ done: /*------------------------------------------------------------------------- - * Function: H5Z_op_is_numbs + * Function: H5Z__op_is_numbs + * * Purpose: Internal function to facilitate the condition check in - * H5Z_xform_reduce_tree to reduce the bulkiness of the code. + * H5Z__xform_reduce_tree to reduce the bulkiness of the code. + * * Return: TRUE or FALSE + * * Programmer: Raymond Lu * 15 March 2012 - * Modifications: * *------------------------------------------------------------------------- */ static hbool_t -H5Z_op_is_numbs(H5Z_node* _tree) +H5Z__op_is_numbs(H5Z_node* _tree) { hbool_t ret_value = FALSE; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(_tree); @@ -1396,24 +1394,26 @@ H5Z_op_is_numbs(H5Z_node* _tree) /*------------------------------------------------------------------------- - * Function: H5Z_op_is_numbs2 + * Function: H5Z__op_is_numbs2 + * * Purpose: Internal function to facilitate the condition check in - * H5Z_xform_reduce_tree to reduce the bulkiness of the code. - * The difference from H5Z_op_is_numbs is that the left child + * H5Z__xform_reduce_tree to reduce the bulkiness of the code. + * The difference from H5Z__op_is_numbs is that the left child * can be empty, like -x or +x. + * * Return: TRUE or FALSE + * * Programmer: Raymond Lu * 15 March 2012 - * Modifications: * *------------------------------------------------------------------------- */ static hbool_t -H5Z_op_is_numbs2(H5Z_node* _tree) +H5Z__op_is_numbs2(H5Z_node* _tree) { hbool_t ret_value = FALSE; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(_tree); @@ -1426,50 +1426,51 @@ H5Z_op_is_numbs2(H5Z_node* _tree) /*------------------------------------------------------------------------- - * Function: H5Z_xform_reduce_tree + * Function: H5Z__xform_reduce_tree + * * Purpose: Simplifies parse tree passed in by performing any obvious * and trivial arithemtic calculations. * * Return: None. + * * Programmer: Leon Arber * April 1, 2004. - * Modifications: * *------------------------------------------------------------------------- */ static void -H5Z_xform_reduce_tree(H5Z_node* tree) +H5Z__xform_reduce_tree(H5Z_node* tree) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR if(tree) { if((tree->type == H5Z_XFORM_DIVIDE) || (tree->type == H5Z_XFORM_MULT)) { - if(H5Z_op_is_numbs(tree)) - H5Z_do_op(tree); + if(H5Z__op_is_numbs(tree)) + H5Z__do_op(tree); else { - H5Z_xform_reduce_tree(tree->lchild); - if(H5Z_op_is_numbs(tree)) - H5Z_do_op(tree); + H5Z__xform_reduce_tree(tree->lchild); + if(H5Z__op_is_numbs(tree)) + H5Z__do_op(tree); else { - H5Z_xform_reduce_tree(tree->rchild); - if(H5Z_op_is_numbs(tree)) - H5Z_do_op(tree); + H5Z__xform_reduce_tree(tree->rchild); + if(H5Z__op_is_numbs(tree)) + H5Z__do_op(tree); } } } else if((tree->type == H5Z_XFORM_PLUS) || (tree->type == H5Z_XFORM_MINUS)) { - if(H5Z_op_is_numbs2(tree)) - H5Z_do_op(tree); + if(H5Z__op_is_numbs2(tree)) + H5Z__do_op(tree); else { - H5Z_xform_reduce_tree(tree->lchild); - if(H5Z_op_is_numbs2(tree)) - H5Z_do_op(tree); + H5Z__xform_reduce_tree(tree->lchild); + if(H5Z__op_is_numbs2(tree)) + H5Z__do_op(tree); else { - H5Z_xform_reduce_tree(tree->rchild); - if(H5Z_op_is_numbs2(tree)) - H5Z_do_op(tree); + H5Z__xform_reduce_tree(tree->rchild); + if(H5Z__op_is_numbs2(tree)) + H5Z__do_op(tree); } } } @@ -1481,27 +1482,25 @@ H5Z_xform_reduce_tree(H5Z_node* tree) /*------------------------------------------------------------------------- - * Function: H5Z_do_op + * Function: H5Z__do_op + * * Purpose: If the root of the tree passed in points to a simple * arithmetic operation and the left and right subtrees are both * integer or floating point values, this function does that * operation, free the left and right subtrees, and replaces * the root with the result of the operation. + * * Return: None. + * * Programmer: Leon Arber * April 1, 2004. - * Modifications: - * Raymond Lu - * 15 March 2012 - * I added a new macro H5Z_XFORM_DO_OP6 to handle the special - * operations like -x or +x when the left operand is empty. * *------------------------------------------------------------------------- */ static void -H5Z_do_op(H5Z_node* tree) +H5Z__do_op(H5Z_node* tree) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR if(tree->type == H5Z_XFORM_DIVIDE) H5Z_XFORM_DO_OP3(/) @@ -1517,7 +1516,7 @@ H5Z_do_op(H5Z_node* tree) /*------------------------------------------------------------------------- - * Function: H5D_xform_create + * Function: H5Z_xform_create * * Purpose: Create a new data transform object from a string. * @@ -1525,14 +1524,10 @@ H5Z_do_op(H5Z_node* tree) * Success: SUCCEED * Failure: FAIL * - * Programmer: Quincey Koziol, koziol@ncsa.uiuc.edu + * Programmer: Quincey Koziol * * Date: May 4, 2004 * - * Comments: - * - * Modifications: - * *------------------------------------------------------------------------- */ H5Z_data_xform_t * @@ -1575,7 +1570,7 @@ H5Z_xform_create(const char *expr) data_xform_prop->dat_val_pointers->num_ptrs = 0; /* we generate the parse tree right here and store a pointer to its root in the property. */ - if((data_xform_prop->parse_root = (H5Z_node *)H5Z_xform_parse(expr, data_xform_prop->dat_val_pointers))==NULL) + if((data_xform_prop->parse_root = (H5Z_node *)H5Z__xform_parse(expr, data_xform_prop->dat_val_pointers))==NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to generate parse tree from expression") /* Sanity check @@ -1592,7 +1587,7 @@ done: if(ret_value==NULL) { if(data_xform_prop) { if(data_xform_prop->parse_root) - H5Z_xform_destroy_parse_tree(data_xform_prop->parse_root); + H5Z__xform_destroy_parse_tree(data_xform_prop->parse_root); if(data_xform_prop->xform_exp) H5MM_xfree(data_xform_prop->xform_exp); if(count > 0 && data_xform_prop->dat_val_pointers->ptr_dat_val) @@ -1616,14 +1611,10 @@ done: * Success: SUCCEED * Failure: FAIL * - * Programmer: Quincey Koziol, koziol@ncsa.uiuc.edu + * Programmer: Quincey Koziol * * Date: May 4, 2004 * - * Comments: - * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -1633,7 +1624,7 @@ H5Z_xform_destroy(H5Z_data_xform_t *data_xform_prop) if(data_xform_prop) { /* Destroy the parse tree */ - H5Z_xform_destroy_parse_tree(data_xform_prop->parse_root); + H5Z__xform_destroy_parse_tree(data_xform_prop->parse_root); /* Free the expression */ H5MM_xfree(data_xform_prop->xform_exp); @@ -1662,7 +1653,7 @@ H5Z_xform_destroy(H5Z_data_xform_t *data_xform_prop) * Success: SUCCEED * Failure: FAIL * - * Programmer: Quincey Koziol, koziol@ncsa.uiuc.edu + * Programmer: Quincey Koziol * * Date: May 4, 2004 * @@ -1707,7 +1698,7 @@ H5Z_xform_copy(H5Z_data_xform_t **data_xform_prop) new_data_xform_prop->dat_val_pointers->num_ptrs = 0; /* Copy parse tree */ - if((new_data_xform_prop->parse_root = (H5Z_node*)H5Z_xform_copy_tree((*data_xform_prop)->parse_root, (*data_xform_prop)->dat_val_pointers, new_data_xform_prop->dat_val_pointers)) == NULL) + if((new_data_xform_prop->parse_root = (H5Z_node*)H5Z__xform_copy_tree((*data_xform_prop)->parse_root, (*data_xform_prop)->dat_val_pointers, new_data_xform_prop->dat_val_pointers)) == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "error copying the parse tree") /* Sanity check @@ -1724,7 +1715,7 @@ done: if(ret_value<0) { if(new_data_xform_prop) { if(new_data_xform_prop->parse_root) - H5Z_xform_destroy_parse_tree(new_data_xform_prop->parse_root); + H5Z__xform_destroy_parse_tree(new_data_xform_prop->parse_root); if(new_data_xform_prop->xform_exp) H5MM_xfree(new_data_xform_prop->xform_exp); H5MM_xfree(new_data_xform_prop); @@ -1742,14 +1733,12 @@ done: * * Return: TRUE for no data transform, FALSE for a data transform * - * Programmer: Quincey Koziol, koziol@ncsa.uiuc.edu + * Programmer: Quincey Koziol * * Date: May 4, 2004 * * Comments: Can't fail * - * Modifications: - * *------------------------------------------------------------------------- */ hbool_t @@ -1773,12 +1762,10 @@ H5Z_xform_noop(const H5Z_data_xform_t *data_xform_prop) * Return: * Pointer to a copy of the string in the data_xform property. * - * Programmer: Leon Arber, larber@ncsa.uiuc.edu + * Programmer: Leon Arber * * Date: Sept. 4, 2004 * - * Modifications: - * *------------------------------------------------------------------------- */ const char * diff --git a/src/H5checksum.c b/src/H5checksum.c index 4e98976..a9d2b4e 100644 --- a/src/H5checksum.c +++ b/src/H5checksum.c @@ -15,7 +15,7 @@ * * Created: H5checksum.c * Aug 21 2006 - * Quincey Koziol + * Quincey Koziol * * Purpose: Internal code for computing fletcher32 checksums * @@ -152,7 +152,7 @@ H5_checksum_fletcher32(const void *_data, size_t _len) /*------------------------------------------------------------------------- - * Function: H5_checksum_crc_make_table + * Function: H5__checksum_crc_make_table * * Purpose: Compute the CRC table for the CRC checksum algorithm * @@ -164,12 +164,12 @@ H5_checksum_fletcher32(const void *_data, size_t _len) *------------------------------------------------------------------------- */ static void -H5_checksum_crc_make_table(void) +H5__checksum_crc_make_table(void) { uint32_t c; /* Checksum for each byte value */ unsigned n, k; /* Local index variables */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Compute the checksum for each possible byte value */ for(n = 0; n < 256; n++) { @@ -184,11 +184,11 @@ H5_checksum_crc_make_table(void) H5_crc_table_computed = TRUE; FUNC_LEAVE_NOAPI_VOID -} /* end H5_checksum_crc_make_table() */ +} /* end H5__checksum_crc_make_table() */ /*------------------------------------------------------------------------- - * Function: H5_checksum_crc_make_table + * Function: H5__checksum_crc_update * * Purpose: Update a running CRC with the bytes buf[0..len-1]--the CRC * should be initialized to all 1's, and the transmitted value @@ -203,22 +203,22 @@ H5_checksum_crc_make_table(void) *------------------------------------------------------------------------- */ static uint32_t -H5_checksum_crc_update(uint32_t crc, const uint8_t *buf, size_t len) +H5__checksum_crc_update(uint32_t crc, const uint8_t *buf, size_t len) { size_t n; /* Local index variable */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Initialize the CRC table if necessary */ if(!H5_crc_table_computed) - H5_checksum_crc_make_table(); + H5__checksum_crc_make_table(); /* Update the CRC with the results from this buffer */ for(n = 0; n < len; n++) crc = H5_crc_table[(crc ^ buf[n]) & 0xff] ^ (crc >> 8); FUNC_LEAVE_NOAPI(crc) -} /* end H5_checksum_crc_update() */ +} /* end H5__checksum_crc_update() */ /*------------------------------------------------------------------------- @@ -247,7 +247,7 @@ H5_checksum_crc(const void *_data, size_t len) HDassert(_data); HDassert(len > 0); - FUNC_LEAVE_NOAPI(H5_checksum_crc_update((uint32_t)0xffffffffL, (const uint8_t *)_data, len) ^ 0xffffffffL) + FUNC_LEAVE_NOAPI(H5__checksum_crc_update((uint32_t)0xffffffffL, (const uint8_t *)_data, len) ^ 0xffffffffL) } /* end H5_checksum_crc() */ /* diff --git a/src/H5dbg.c b/src/H5dbg.c index 4939bca..819653d 100644 --- a/src/H5dbg.c +++ b/src/H5dbg.c @@ -13,11 +13,11 @@ /*------------------------------------------------------------------------- * - * Created: H5dbg.c - * Mar 4 2006 - * Quincey Koziol + * Created: H5dbg.c + * Mar 4 2006 + * Quincey Koziol * - * Purpose: Generic debugging routines + * Purpose: Generic debugging routines * *------------------------------------------------------------------------- */ @@ -29,7 +29,7 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ +#include "H5private.h" /* Generic Functions */ /****************/ /* Local Macros */ @@ -63,15 +63,14 @@ /*------------------------------------------------------------------------- - * Function: H5_buffer_dump + * Function: H5_buffer_dump * - * Purpose: Dumps a buffer of memory in an octal dump form + * Purpose: Dumps a buffer of memory in an octal dump form * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * Mar 4 2006 + * Programmer: Quincey Koziol + * Mar 4 2006 * *------------------------------------------------------------------------- */ @@ -79,7 +78,7 @@ herr_t H5_buffer_dump(FILE *stream, int indent, const uint8_t *buf, const uint8_t *marker, size_t buf_offset, size_t buf_size) { - size_t u, v; /* Local index variable */ + size_t u, v; /* Local index variable */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -96,47 +95,50 @@ H5_buffer_dump(FILE *stream, int indent, const uint8_t *buf, * Print the buffer in a VMS-style octal dump. */ HDfprintf(stream, "%*sData follows (`__' indicates free region)...\n", - indent, ""); + indent, ""); for(u = 0; u < buf_size; u += 16) { - uint8_t c; + uint8_t c; - HDfprintf(stream, "%*s %8d: ", indent, "", u + buf_offset); + HDfprintf(stream, "%*s %8d: ", indent, "", u + buf_offset); /* Print the hex values */ - for(v = 0; v < 16; v++) { - if(u + v < buf_size) { - if(marker[u + v]) - HDfprintf(stream, "__ "); - else { - c = buf[buf_offset + u + v]; - HDfprintf(stream, "%02x ", c); - } /* end else */ - } /* end if */ + for(v = 0; v < 16; v++) { + if(u + v < buf_size) { + if(marker[u + v]) + HDfprintf(stream, "__ "); + else { + c = buf[buf_offset + u + v]; + HDfprintf(stream, "%02x ", c); + } /* end else */ + } /* end if */ else - HDfprintf(stream, " "); - if(7 == v) - HDfputc(' ', stream); - } /* end for */ + HDfprintf(stream, " "); + + if(7 == v) + HDfputc(' ', stream); + } /* end for */ HDfputc(' ', stream); /* Print the character values */ - for(v = 0; v < 16; v++) { - if(u + v < buf_size) { - if(marker[u + v]) - HDfputc(' ', stream); - else { - c = buf[buf_offset + u + v]; - if(HDisprint(c)) - HDfputc(c, stream); - else - HDfputc('.', stream); - } /* end else */ - } /* end if */ - if(7 == v) - HDfputc(' ', stream); - } /* end for */ - - HDfputc('\n', stream); + for(v = 0; v < 16; v++) { + if(u + v < buf_size) { + if(marker[u + v]) + HDfputc(' ', stream); + else { + c = buf[buf_offset + u + v]; + + if(HDisprint(c)) + HDfputc(c, stream); + else + HDfputc('.', stream); + } /* end else */ + } /* end if */ + + if(7 == v) + HDfputc(' ', stream); + } /* end for */ + + HDfputc('\n', stream); } /* end for */ FUNC_LEAVE_NOAPI(SUCCEED) diff --git a/src/H5detect.c b/src/H5detect.c index 655b05c..ac416aa 100644 --- a/src/H5detect.c +++ b/src/H5detect.c @@ -43,6 +43,9 @@ static const char *FileHeader = "\n\ */ #undef NDEBUG #include "H5private.h" +/* Do NOT use HDfprintf in this file as it is not linked with the library, + * which contains the H5system.c file in which the function is defined. + */ #include "H5Tpublic.h" #include "H5Rpublic.h" @@ -221,25 +224,6 @@ precision (detected_t *d) * * Return: void * - * Modifications: - * - * Robb Matzke, 4 Nov 1996 - * The INFO.perm now contains `-1' for bytes that aren't used and - * are always zero. This happens on the Cray for `short' where - * sizeof(short) is 8, but only the low-order 4 bytes are ever used. - * - * Robb Matzke, 4 Nov 1996 - * Added a `padding' field to indicate how many zero bytes appear to - * the left (N) or right (-N) of the value. - * - * Robb Matzke, 5 Nov 1996 - * Removed HFILE and CFILE arguments. - * - * Neil Fortner, 6 Sep 2013 - * Split macro into DETECT_I and DETECT_BYTE macros, extracted - * common code into DETECT_I_BYTE_CORE. This was done to remove - * "will never be executed" warnings. - * *------------------------------------------------------------------------- */ #define DETECT_I_BYTE_CORE(TYPE,VAR,INFO,DETECT_TYPE) { \ @@ -1617,12 +1601,6 @@ static int verify_signal_handlers(int signum, void (*handler)(int)) * * Return: Success: EXIT_SUCCESS * - * Modifications: - * Some compilers, e.g., Intel C v7.0, took a long time to compile - * with optimization when a module routine contains many code lines. - * Divide up all those types detections macros into subroutines, both - * to avoid the compiler optimization error and cleaner codes. - * *------------------------------------------------------------------------- */ int HDF_NO_UBSAN diff --git a/src/H5err.txt b/src/H5err.txt index 9fec521..24ac2ac 100644 --- a/src/H5err.txt +++ b/src/H5err.txt @@ -136,6 +136,8 @@ MINOR, FILEACC, H5E_BADFILE, Bad file ID accessed MINOR, FILEACC, H5E_TRUNCATED, File has been truncated MINOR, FILEACC, H5E_MOUNT, File mount error MINOR, FILEACC, H5E_CANTDELETEFILE, Unable to delete file +MINOR, FILEACC, H5E_CANTLOCKFILE, Unable to lock file +MINOR, FILEACC, H5E_CANTUNLOCKFILE, Unable to unlock file # Generic low-level file I/O errors MINOR, FILE, H5E_SEEKERROR, Seek failed diff --git a/src/H5private.h b/src/H5private.h index 2236ee6..9c5b450 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Robb Matzke +/* Programmer: Robb Matzke * Friday, October 30, 1998 * * Purpose: This file is included by all HDF5 library source files to @@ -614,21 +614,37 @@ #define LOCK_UN 0x08 #endif /* H5_HAVE_FLOCK */ -/* - * Data types and functions for timing certain parts of the library. +/* Typedefs and functions for timing certain parts of the library. */ + +/* A set of elapsed/user/system times emitted as a time point by the + * platform-independent timers. */ typedef struct { - double utime; /*user time */ - double stime; /*system time */ - double etime; /*elapsed wall-clock time */ + double user; /* User time in seconds */ + double system; /* System time in seconds */ + double elapsed; /* Elapsed (wall clock) time in seconds */ +} H5_timevals_t; + +/* Timer structure for platform-independent timers */ +typedef struct { + H5_timevals_t initial; /* Current interval start time */ + H5_timevals_t final_interval; /* Last interval elapsed time */ + H5_timevals_t total; /* Total elapsed time for all intervals */ + hbool_t is_running; /* Whether timer is running */ } H5_timer_t; -H5_DLL void H5_timer_reset (H5_timer_t *timer); -H5_DLL void H5_timer_begin (H5_timer_t *timer); -H5_DLL void H5_timer_end (H5_timer_t *sum/*in,out*/, - H5_timer_t *timer/*in,out*/); +/* Returns library bandwidth as a pretty string */ H5_DLL void H5_bandwidth(char *buf/*out*/, double nbytes, double nseconds); + +/* Timer functionality */ H5_DLL time_t H5_now(void); +H5_DLL uint64_t H5_now_usec(void); +H5_DLL herr_t H5_timer_init(H5_timer_t *timer /*in,out*/); +H5_DLL herr_t H5_timer_start(H5_timer_t *timer /*in,out*/); +H5_DLL herr_t H5_timer_stop(H5_timer_t *timer /*in,out*/); +H5_DLL herr_t H5_timer_get_times(H5_timer_t timer, H5_timevals_t *times /*in,out*/); +H5_DLL herr_t H5_timer_get_total_times(H5_timer_t timer, H5_timevals_t *times /*in,out*/); +H5_DLL char *H5_timer_get_time_string(double seconds); /* Depth of object copy */ typedef enum { @@ -750,6 +766,9 @@ typedef struct { #ifndef HDclock #define HDclock() clock() #endif /* HDclock */ +#ifndef HDclock_gettime + #define HDclock_gettime(CID, TS) clock_gettime(CID, TS) +#endif /* HDclock_gettime */ #ifndef HDclose #define HDclose(F) close(F) #endif /* HDclose */ @@ -869,8 +888,8 @@ H5_DLL H5_ATTR_CONST int Nflock(int fd, int operation); #ifndef HDflock /* NOTE: flock(2) is not present on all POSIX systems. * If it is not present, we try a flock() equivalent based on - * fcntl(2), then fall back to a function that always fails if - * it is not present at all (Windows uses a separate Wflock() + * fcntl(2), then fall back to a function that always succeeds + * if it is not present at all (Windows uses a separate Wflock() * function). */ #if defined(H5_HAVE_FLOCK) @@ -959,7 +978,7 @@ typedef off_t h5_stat_size_t; #define H5_SIZEOF_H5_STAT_SIZE_T H5_SIZEOF_OFF_T #ifndef HDftell - #define HDftell(F) ftello(F) + #define HDftell(F) ftell(F) #endif /* HDftell */ #ifndef HDftruncate #define HDftruncate(F,L) ftruncate(F,L) @@ -1496,6 +1515,9 @@ typedef off_t h5_stat_size_t; #ifndef HDstrtoull #define HDstrtoull(S,R,N) strtoull(S,R,N) #endif /* HDstrtoul */ +#ifndef HDstrtoumax + #define HDstrtoumax(S,R,N) strtoumax(S,R,N) +#endif /* HDstrtoumax */ #ifndef HDstrxfrm #define HDstrxfrm(X,Y,Z) strxfrm(X,Y,Z) #endif /* HDstrxfrm */ @@ -2145,8 +2167,9 @@ H5_DLL herr_t H5CX_pop(void); } /* end if */ \ \ /* Initialize the package, if appropriate */ \ - H5_PACKAGE_INIT(H5_MY_PKG_INIT, err) \ - \ + H5_PACKAGE_INIT(H5_MY_PKG_INIT, err) + +#define FUNC_ENTER_API_PUSH(err) \ /* Push the name of this function on the function stack */ \ H5_PUSH_FUNC \ \ @@ -2160,6 +2183,7 @@ H5_DLL herr_t H5CX_pop(void); #define FUNC_ENTER_API(err) {{ \ FUNC_ENTER_API_COMMON \ FUNC_ENTER_API_INIT(err); \ + FUNC_ENTER_API_PUSH(err); \ /* Clear thread error stack entering public functions */ \ H5E_clear_stack(NULL); \ { @@ -2171,6 +2195,7 @@ H5_DLL herr_t H5CX_pop(void); #define FUNC_ENTER_API_NOCLEAR(err) {{ \ FUNC_ENTER_API_COMMON \ FUNC_ENTER_API_INIT(err); \ + FUNC_ENTER_API_PUSH(err); \ { /* @@ -2200,6 +2225,18 @@ H5_DLL herr_t H5CX_pop(void); BEGIN_MPE_LOG \ { +/* + * Use this macro for API functions that should only perform initialization + * of the library or an interface, but not push any state (API context, + * function name, start MPE logging, etc) examples are: H5open. + * + */ +#define FUNC_ENTER_API_NOPUSH(err) {{{{{ \ + FUNC_ENTER_COMMON(H5_IS_API(FUNC)); \ + FUNC_ENTER_API_THREADSAFE; \ + FUNC_ENTER_API_INIT(err); \ + { + /* Note: this macro only works when there's _no_ interface initialization routine for the module */ #define FUNC_ENTER_NOAPI_INIT(err) \ /* Initialize the package, if appropriate */ \ @@ -2389,6 +2426,16 @@ H5_DLL herr_t H5CX_pop(void); return(ret_value); \ }}}} /*end scope from beginning of FUNC_ENTER*/ +/* Use this macro to match the FUNC_ENTER_API_NOPUSH macro */ +#define FUNC_LEAVE_API_NOPUSH(ret_value) \ + ; \ + } /*end scope from end of FUNC_ENTER*/ \ + if(err_occurred) \ + (void)H5E_dump_api_stack(TRUE); \ + FUNC_LEAVE_API_THREADSAFE \ + return(ret_value); \ +}}}}} /*end scope from beginning of FUNC_ENTER*/ + #define FUNC_LEAVE_NOAPI(ret_value) \ ; \ } /*end scope from end of FUNC_ENTER*/ \ diff --git a/src/H5public.h b/src/H5public.h index 0fd9f3b..ba2505a 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -26,70 +26,32 @@ * it via H5public.h. The #ifndef _H5public_H guard above would * prevent repeated include. */ -#include "H5pubconf.h" /*from configure */ +#include "H5pubconf.h" /* From configure */ /* API Version macro wrapper definitions */ #include "H5version.h" #ifdef H5_HAVE_FEATURES_H -#include /*for setting POSIX, BSD, etc. compatibility */ +#include /* For setting POSIX, BSD, etc. compatibility */ #endif #ifdef H5_HAVE_SYS_TYPES_H #include #endif #ifdef H5_STDC_HEADERS -# include /*for H5T_NATIVE_CHAR defn in H5Tpublic.h */ -# include /*for variadic functions in H5VLpublic.h */ +# include /* For H5T_NATIVE_CHAR defn in H5Tpublic.h */ +# include /* For variadic functions in H5VLpublic.h */ #endif #ifndef __cplusplus # ifdef H5_HAVE_STDINT_H -# include /*for C9x types */ +# include /* For C9x types */ # endif #else # ifdef H5_HAVE_STDINT_H_CXX -# include /*for C9x types when include from C++ */ +# include /* For C9x types (when included from C++) */ # endif #endif #ifdef H5_HAVE_INTTYPES_H # include /* C99/POSIX.1 header for uint64_t, PRIu64 */ -#else /* H5_HAVE_INTTYPES_H */ -/* The following definitions should be suitable for 64-bit Windows, which is - * LLP64, and for 32-bit Windows, which is ILP32. Those are the only - * platforms where is likely to be missing. VS2015 and later - * *may* provide these definitions. - */ -#ifdef _WIN64 -# define PRIdPTR "lld" -# define PRIoPTR "llo" -# define PRIuPTR "llu" -# define PRIxPTR "llx" -#else /* _WIN64 */ -# define PRIdPTR "ld" -# define PRIoPTR "lo" -# define PRIuPTR "lu" -# define PRIxPTR "lx" -#endif /* _WIN64 */ - -# define PRId8 "d" -# define PRIo8 "o" -# define PRIu8 "u" -# define PRIx8 "x" -# define PRId16 "d" -# define PRIo16 "o" -# define PRIu16 "u" -# define PRIx16 "x" -# define PRId32 "d" -# define PRIo32 "o" -# define PRIu32 "u" -# define PRIx32 "x" -# define PRId64 "lld" -# define PRIo64 "llo" -# define PRIu64 "llu" -# define PRIx64 "llx" -# define PRIdMAX "lld" -# define PRIoMAX "llo" -# define PRIuMAX "llu" -# define PRIxMAX "llx" #endif #ifdef H5_HAVE_STDDEF_H # include @@ -99,7 +61,7 @@ # define MPICH_SKIP_MPICXX 1 # define OMPI_SKIP_MPICXX 1 # include -#ifndef MPI_FILE_NULL /*MPIO may be defined in mpi.h already */ +#ifndef MPI_FILE_NULL /* MPIO may be defined in mpi.h already */ # include #endif #endif @@ -132,15 +94,15 @@ extern "C" { #endif /* Version numbers */ -#define H5_VERS_MAJOR 1 /* For major interface/format changes */ -#define H5_VERS_MINOR 13 /* For minor interface/format changes */ -#define H5_VERS_RELEASE 0 /* For tweaks, bug-fixes, or development */ -#define H5_VERS_SUBRELEASE "" /* For pre-releases like snap0 */ - /* Empty string for real releases. */ +#define H5_VERS_MAJOR 1 /* For major interface/format changes */ +#define H5_VERS_MINOR 13 /* For minor interface/format changes */ +#define H5_VERS_RELEASE 0 /* For tweaks, bug-fixes, or development */ +#define H5_VERS_SUBRELEASE "" /* For pre-releases like snap0 */ + /* Empty string for real releases. */ #define H5_VERS_INFO "HDF5 library version: 1.13.0" /* Full version string */ -#define H5check() H5check_version(H5_VERS_MAJOR,H5_VERS_MINOR, \ - H5_VERS_RELEASE) +#define H5check() H5check_version(H5_VERS_MAJOR,H5_VERS_MINOR, \ + H5_VERS_RELEASE) /* macros for comparing the version */ #define H5_VERSION_GE(Maj,Min,Rel) \ @@ -160,8 +122,8 @@ extern "C" { * The negative failure value is most commonly -1, but don't bet on it. The * proper way to detect failure is something like: * - * if((dset = H5Dopen2(file, name)) < 0) - * fprintf(stderr, "unable to open the requested dataset\n"); + * if((dset = H5Dopen2(file, name)) < 0) + * fprintf(stderr, "unable to open the requested dataset\n"); */ typedef int herr_t; @@ -173,13 +135,13 @@ typedef int herr_t; * (false), positive (true), or negative (failure). The proper way to test * for truth from a htri_t function is: * - * if ((retval = H5Tcommitted(type))>0) { - * printf("data type is committed\n"); - * } else if (!retval) { - * printf("data type is not committed\n"); - * } else { - * printf("error determining whether data type is committed\n"); - * } + * if ((retval = H5Tcommitted(type)) > 0) { + * printf("data type is committed\n"); + * } else if (!retval) { + * printf("data type is not committed\n"); + * } else { + * printf("error determining whether data type is committed\n"); + * } */ #ifdef H5_HAVE_STDBOOL_H #include @@ -221,8 +183,8 @@ typedef long long ssize_t; */ #if H5_SIZEOF_LONG_LONG >= 8 H5_GCC_DIAG_OFF(long-long) -typedef unsigned long long hsize_t; -typedef signed long long hssize_t; +typedef unsigned long long hsize_t; +typedef signed long long hssize_t; H5_GCC_DIAG_ON(long-long) # define H5_SIZEOF_HSIZE_T H5_SIZEOF_LONG_LONG # define H5_SIZEOF_HSSIZE_T H5_SIZEOF_LONG_LONG @@ -267,7 +229,7 @@ H5_GCC_DIAG_ON(long-long) #else # error "nothing appropriate for H5_PRINTF_HADDR_FMT" #endif -#define HADDR_MAX (HADDR_UNDEF-1) +#define HADDR_MAX (HADDR_UNDEF-1) /* uint32_t type is used for creation order field for messages. It may be * defined in Posix.1g, otherwise it is defined here. @@ -335,7 +297,7 @@ typedef enum { H5_ITER_INC, /* Increasing order */ H5_ITER_DEC, /* Decreasing order */ H5_ITER_NATIVE, /* No particular order, whatever is fastest */ - H5_ITER_N /* Number of iteration orders */ + H5_ITER_N /* Number of iteration orders */ } H5_iter_order_t; /* Iteration callback values */ @@ -352,10 +314,10 @@ typedef enum { * links in groups/attributes on objects. */ typedef enum H5_index_t { - H5_INDEX_UNKNOWN = -1, /* Unknown index type */ - H5_INDEX_NAME, /* Index on names */ - H5_INDEX_CRT_ORDER, /* Index on creation order */ - H5_INDEX_N /* Number of indices defined */ + H5_INDEX_UNKNOWN = -1, /* Unknown index type */ + H5_INDEX_NAME, /* Index on names */ + H5_INDEX_CRT_ORDER, /* Index on creation order */ + H5_INDEX_N /* Number of indices defined */ } H5_index_t; /* @@ -403,9 +365,9 @@ H5_DLL herr_t H5get_free_list_sizes(size_t *reg_size, size_t *arr_size, size_t *blk_size, size_t *fac_size); H5_DLL herr_t H5get_alloc_stats(H5_alloc_stats_t *stats); H5_DLL herr_t H5get_libversion(unsigned *majnum, unsigned *minnum, - unsigned *relnum); + unsigned *relnum); H5_DLL herr_t H5check_version(unsigned majnum, unsigned minnum, - unsigned relnum); + unsigned relnum); H5_DLL herr_t H5is_library_threadsafe(hbool_t *is_ts); H5_DLL herr_t H5free_memory(void *mem); H5_DLL void *H5allocate_memory(size_t size, hbool_t clear); diff --git a/src/H5system.c b/src/H5system.c index ca0c6bf..c5fea9f 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -13,11 +13,11 @@ /*------------------------------------------------------------------------- * - * Created: H5system.c - * Aug 21 2006 - * Quincey Koziol + * Created: H5system.c + * Aug 21 2006 + * Quincey Koziol * - * Purpose: System call wrapper implementations. + * Purpose: System call wrapper implementations. * *------------------------------------------------------------------------- */ @@ -30,10 +30,10 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fprivate.h" /* File access */ -#include "H5MMprivate.h" /* Memory management */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* File access */ +#include "H5MMprivate.h" /* Memory management */ /****************/ @@ -379,7 +379,7 @@ HDfprintf(FILE *stream, const char *fmt, ...) if(fwidth) len += HDsnprintf(format_templ + len, (sizeof(format_templ) - (size_t)(len + 1)), "%d", fwidth); HDstrncat(format_templ, "s", (sizeof(format_templ) - (size_t)(len + 1))); - fprintf(stream, format_templ, "UNDEF"); + n = fprintf(stream, format_templ, "UNDEF"); } } break; @@ -409,11 +409,25 @@ HDfprintf(FILE *stream, const char *fmt, ...) htri_t tri_var = HDva_arg(ap, htri_t); if(tri_var > 0) - fprintf(stream, "TRUE"); + n = fprintf(stream, "TRUE"); else if(!tri_var) - fprintf(stream, "FALSE"); + n = fprintf(stream, "FALSE"); else - fprintf(stream, "FAIL(%d)", (int)tri_var); + n = fprintf(stream, "FAIL(%d)", (int)tri_var); + } + break; + + case 'T': /* Elapsed time, in seconds */ + { + double seconds = HDva_arg(ap, double); + char *time_string = H5_timer_get_time_string(seconds); + + if(time_string) { + n = fprintf(stream, format_templ, time_string); + HDfree(time_string); + } /* end if */ + else + n = fprintf(stream, format_templ, "(error)"); } break; @@ -502,8 +516,6 @@ H5_GCC_DIAG_ON(format-nonliteral) * Programmer: Robb Matzke * Thursday, April 9, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ #ifndef HDstrtoll @@ -675,14 +687,14 @@ Pflock(int fd, int operation) { * Purpose: Wrapper function for systems where no file locking is * available. * - * Return: Failure: -1 (always fails) + * Return: 0 (success) * *------------------------------------------------------------------------- */ int H5_ATTR_CONST Nflock(int H5_ATTR_UNUSED fd, int H5_ATTR_UNUSED operation) { - /* just fail */ - return -1; + /* just succeed */ + return 0; } /* end Nflock() */ @@ -861,11 +873,88 @@ Wsetenv(const char *name, const char *value, int overwrite) #pragma comment(lib, "advapi32.lib") #endif + +/*------------------------------------------------------------------------- + * Function: H5_get_win32_times + * + * Purpose: Gets the elapsed, system and user times on Windows platforms. + * All time values are in seconds. + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Dana Robinson + * May 2011 + * + *------------------------------------------------------------------------- + */ +#ifdef H5_HAVE_WIN32_API +int +H5_get_win32_times(H5_timevals_t *tvs /*in,out*/) +{ + static HANDLE process_handle; + ULARGE_INTEGER kernel_start; + ULARGE_INTEGER user_start; + FILETIME KernelTime; + FILETIME UserTime; + FILETIME CreationTime; + FILETIME ExitTime; + LARGE_INTEGER counts_start; + static LARGE_INTEGER counts_freq; + static hbool_t is_initialized = FALSE; + BOOL err; + + HDassert(tvs); + + if(!is_initialized) { + /* NOTE: This is just a pseudo handle and does not need to be closed. */ + process_handle = GetCurrentProcess(); + err = QueryPerformanceFrequency(&counts_freq); + if(0 == err) + return -1; + is_initialized = TRUE; + } /* end if */ + + /************************* + * System and user times * + *************************/ + + err = GetProcessTimes(process_handle, &CreationTime, &ExitTime, &KernelTime, + &UserTime); + if(0 == err) + return -1; + + /* The 1.0E7 factor seems strange but it's due to the clock + * ticking in 100 ns increments. + */ + kernel_start.HighPart = KernelTime.dwHighDateTime; + kernel_start.LowPart = KernelTime.dwLowDateTime; + tvs->system = (double)(kernel_start.QuadPart / 1.0E7F); + + user_start.HighPart = UserTime.dwHighDateTime; + user_start.LowPart = UserTime.dwLowDateTime; + tvs->user = (double)(user_start.QuadPart / 1.0E7F); + + /**************** + * Elapsed time * + ****************/ + + err = QueryPerformanceCounter(&counts_start); + if(0 == err) + return -1; + + tvs->elapsed = (double)(counts_start.QuadPart) / (double)counts_freq.QuadPart; + + return 0; +} /* end H5_get_win32_times() */ +#endif + #define WloginBuffer_count 256 static char Wlogin_buffer[WloginBuffer_count]; + char* -Wgetlogin() +Wgetlogin(void) { #ifdef H5_HAVE_WINSOCK2_H @@ -1370,38 +1459,6 @@ H5_nanosleep(uint64_t nanosec) FUNC_LEAVE_NOAPI_VOID } /* end H5_nanosleep() */ - -/*-------------------------------------------------------------------------- - * Function: H5_get_time - * - * Purpose: Get the current time, as the time of seconds after the UNIX epoch - * - * Return: SUCCEED/FAIL - * - * Programmer: Quincey Koziol - * October 05, 2016 - *-------------------------------------------------------------------------- - */ -double -H5_get_time(void) -{ -#ifdef H5_HAVE_GETTIMEOFDAY - struct timeval curr_time; -#endif /* H5_HAVE_GETTIMEOFDAY */ - double ret_value = (double)0.0f; - - FUNC_ENTER_NOAPI_NOINIT_NOERR - -#ifdef H5_HAVE_GETTIMEOFDAY - HDgettimeofday(&curr_time, NULL); - - ret_value = (double)curr_time.tv_sec + ((double)curr_time.tv_usec / (double)1000000.0f); -#endif /* H5_HAVE_GETTIMEOFDAY */ - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5_get_time() */ - - #ifdef H5_HAVE_WIN32_API #define H5_WIN32_ENV_VAR_BUFFER_SIZE 32767 diff --git a/src/H5timer.c b/src/H5timer.c index 4b1ec06..61d6f0f 100644 --- a/src/H5timer.c +++ b/src/H5timer.c @@ -12,12 +12,11 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /*------------------------------------------------------------------------- - * * Created: H5timer.c * Aug 21 2006 - * Quincey Koziol + * Quincey Koziol * - * Purpose: Internal 'timer' routines & support routines. + * Purpose: Internal, platform-independent 'timer' support routines. * *------------------------------------------------------------------------- */ @@ -32,20 +31,22 @@ /***********/ #include "H5private.h" /* Generic Functions */ -/* We need this for the struct rusage declaration */ -#if defined(H5_HAVE_GETRUSAGE) && defined(H5_HAVE_SYS_RESOURCE_H) -# include -#endif - -#if defined(H5_HAVE_GETTIMEOFDAY) && defined(H5_HAVE_SYS_TIME_H) -#include -#endif - /****************/ /* Local Macros */ /****************/ +/* Size of a generated time string. + * Most time strings should be < 20 or so characters (max!) so this should be a + * safe size. Dynamically allocating the correct size would be painful. + */ +#define H5TIMER_TIME_STRING_LEN 1536 + +/* Conversion factors */ +#define H5_SEC_PER_DAY (double)(24.0F * 60.0F * 60.0F) +#define H5_SEC_PER_HOUR (double)(60.0F * 60.0F) +#define H5_SEC_PER_MIN (double)(60.0F) + /******************/ /* Local Typedefs */ @@ -76,104 +77,6 @@ /* Local Variables */ /*******************/ - -/*------------------------------------------------------------------------- - * Function: H5_timer_reset - * - * Purpose: Resets the timer struct to zero. Use this to reset a timer - * that's being used as an accumulator for summing times. - * - * Return: void - * - * Programmer: Robb Matzke - * Thursday, April 16, 1998 - * - *------------------------------------------------------------------------- - */ -void -H5_timer_reset (H5_timer_t *timer) -{ - HDassert(timer); - HDmemset(timer, 0, sizeof *timer); -} /* end H5_timer_reset() */ - - -/*------------------------------------------------------------------------- - * Function: H5_timer_begin - * - * Purpose: Initialize a timer to time something. - * - * Return: void - * - * Programmer: Robb Matzke - * Thursday, April 16, 1998 - * - *------------------------------------------------------------------------- - */ -void -H5_timer_begin (H5_timer_t *timer) -{ -#ifdef H5_HAVE_GETRUSAGE - struct rusage rusage; -#endif -#ifdef H5_HAVE_GETTIMEOFDAY - struct timeval etime; -#endif - - HDassert(timer); - -#ifdef H5_HAVE_GETRUSAGE - HDgetrusage (RUSAGE_SELF, &rusage); - timer->utime = (double)rusage.ru_utime.tv_sec + - ((double)rusage.ru_utime.tv_usec / (double)1e6F); - timer->stime = (double)rusage.ru_stime.tv_sec + - ((double)rusage.ru_stime.tv_usec / (double)1e6F); -#else - timer->utime = 0.0F; - timer->stime = 0.0F; -#endif -#ifdef H5_HAVE_GETTIMEOFDAY - HDgettimeofday (&etime, NULL); - timer->etime = (double)etime.tv_sec + ((double)etime.tv_usec / (double)1e6F); -#else - timer->etime = 0.0F; -#endif -} /* end H5_timer_begin() */ - - -/*------------------------------------------------------------------------- - * Function: H5_timer_end - * - * Purpose: This function should be called at the end of a timed region. - * The SUM is an optional pointer which will accumulate times. - * TMS is the same struct that was passed to H5_timer_start(). - * On return, TMS will contain total times for the timed region. - * - * Return: void - * - * Programmer: Robb Matzke - * Thursday, April 16, 1998 - * - *------------------------------------------------------------------------- - */ -void -H5_timer_end (H5_timer_t *sum/*in,out*/, H5_timer_t *timer/*in,out*/) -{ - H5_timer_t now; - - HDassert(timer); - H5_timer_begin(&now); - - timer->utime = MAX((double)0.0F, now.utime - timer->utime); - timer->stime = MAX((double)0.0F, now.stime - timer->stime); - timer->etime = MAX((double)0.0F, now.etime - timer->etime); - - if (sum) { - sum->utime += timer->utime; - sum->stime += timer->stime; - sum->etime += timer->etime; - } -} /* end H5_timer_end() */ /*------------------------------------------------------------------------- @@ -209,32 +112,35 @@ H5_bandwidth(char *buf/*out*/, double nbytes, double nseconds) if(nseconds <= (double)0.0F) HDstrcpy(buf, " NaN"); else { - bw = nbytes/nseconds; + bw = nbytes / nseconds; if(H5_DBL_ABS_EQUAL(bw, (double)0.0F)) HDstrcpy(buf, "0.000 B/s"); else if(bw < (double)1.0F) HDsprintf(buf, "%10.4e", bw); else if(bw < (double)H5_KB) { HDsprintf(buf, "%05.4f", bw); - HDstrcpy(buf+5, " B/s"); + HDstrcpy(buf + 5, " B/s"); } else if(bw < (double)H5_MB) { HDsprintf(buf, "%05.4f", bw / (double)H5_KB); - HDstrcpy(buf+5, " kB/s"); + HDstrcpy(buf + 5, " kB/s"); } else if(bw < (double)H5_GB) { HDsprintf(buf, "%05.4f", bw / (double)H5_MB); - HDstrcpy(buf+5, " MB/s"); + HDstrcpy(buf + 5, " MB/s"); } else if(bw < (double)H5_TB) { HDsprintf(buf, "%05.4f", bw / (double)H5_GB); - HDstrcpy(buf+5, " GB/s"); + HDstrcpy(buf + 5, " GB/s"); } else if(bw < (double)H5_PB) { HDsprintf(buf, "%05.4f", bw / (double)H5_TB); - HDstrcpy(buf+5, " TB/s"); + HDstrcpy(buf + 5, " TB/s"); + } else if(bw < (double)H5_EB) { + HDsprintf(buf, "%05.4f", bw / (double)H5_PB); + HDstrcpy(buf + 5, " PB/s"); } else { HDsprintf(buf, "%10.4e", bw); if(HDstrlen(buf) > 10) HDsprintf(buf, "%10.3e", bw); - } - } + } /* end else-if */ + } /* end else */ } /* end H5_bandwidth() */ @@ -269,3 +175,488 @@ H5_now(void) return(now); } /* end H5_now() */ + +/*------------------------------------------------------------------------- + * Function: H5_now_usec + * + * Purpose: Retrieves the current time, as microseconds after the UNIX epoch. + * + * Return: # of microseconds from the epoch (can't fail) + * + * Programmer: Quincey Koziol + * Tuesday, November 28, 2006 + * + *------------------------------------------------------------------------- + */ +uint64_t +H5_now_usec(void) +{ + uint64_t now; /* Current time, in microseconds */ + +#if defined(H5_HAVE_CLOCK_GETTIME) + { + struct timespec ts; + + HDclock_gettime(CLOCK_MONOTONIC, &ts); + now = (uint64_t)(ts.tv_sec * (1000 * 1000)) + (uint64_t)(ts.tv_nsec / 1000); + } +#elif defined(H5_HAVE_GETTIMEOFDAY) + { + struct timeval now_tv; + + HDgettimeofday(&now_tv, NULL); + now = (uint64_t)(now_tv.tv_sec * (1000 * 1000)) + (uint64_t)now_tv.tv_usec; + } +#else /* H5_HAVE_GETTIMEOFDAY */ + now = (uint64_t)(HDtime(NULL) * (1000 * 1000)); +#endif /* H5_HAVE_GETTIMEOFDAY */ + + return(now); +} /* end H5_now_usec() */ + + +/*-------------------------------------------------------------------------- + * Function: H5_get_time + * + * Purpose: Get the current time, as the time of seconds after the UNIX epoch + * + * Return: Success: A non-negative time value + * Failure: -1.0 (in theory, can't currently fail) + * + * Programmer: Quincey Koziol + * October 05, 2016 + *-------------------------------------------------------------------------- + */ +double +H5_get_time(void) +{ + double ret_value = (double)0.0f; + + FUNC_ENTER_NOAPI_NOINIT_NOERR + +#if defined(H5_HAVE_CLOCK_GETTIME) + { + struct timespec ts; + + HDclock_gettime(CLOCK_MONOTONIC, &ts); + ret_value = (double)ts.tv_sec + ((double)ts.tv_nsec / (double)1000000000.0f); + } +#elif defined(H5_HAVE_GETTIMEOFDAY) + { + struct timeval now_tv; + + HDgettimeofday(&now_tv, NULL); + ret_value = (double)now_tv.tv_sec + ((double)now_tv.tv_usec / (double)1000000.0f); + } +#else + ret_value = (double)HDtime(NULL); +#endif + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5_get_time() */ + + + +/*------------------------------------------------------------------------- + * Function: H5__timer_get_timevals + * + * Purpose: Internal platform-specific function to get time system, + * user and elapsed time values. + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Dana Robinson + * May 2011 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5__timer_get_timevals(H5_timevals_t *times /*in,out*/) +{ + /* Sanity check */ + HDassert(times); + + /* Windows call handles both system/user and elapsed times */ +#ifdef H5_HAVE_WIN32_API + if(H5_get_win32_times(times) < 0) { + times->elapsed = -1.0; + times->system = -1.0; + times->user = -1.0; + + return -1; + } /* end if */ +#else /* H5_HAVE_WIN32_API */ + + /************************* + * System and user times * + *************************/ +#if defined(H5_HAVE_GETRUSAGE) +{ + struct rusage res; + + if(HDgetrusage(RUSAGE_SELF, &res) < 0) + return -1; + times->system = (double)res.ru_stime.tv_sec + ((double)res.ru_stime.tv_usec / (double)1.0E6F); + times->user = (double)res.ru_utime.tv_sec + ((double)res.ru_utime.tv_usec / (double)1.0E6F); +} +#else + /* No suitable way to get system/user times */ + /* This is not an error condition, they just won't be available */ + times->system = -1.0; + times->user = -1.0; +#endif + + /**************** + * Elapsed time * + ****************/ + + times->elapsed = H5_get_time(); + +#endif /* H5_HAVE_WIN32_API */ + + return 0; +} /* end H5__timer_get_timevals() */ + + +/*------------------------------------------------------------------------- + * Function: H5_timer_init + * + * Purpose: Initialize a platform-independent timer. + * + * Timer usage is as follows: + * + * 1) Call H5_timer_init(), passing in a timer struct, to set + * up the timer. + * + * 2) Wrap any code you'd like to time with calls to + * H5_timer_start/stop(). For accurate timing, place these + * calls as close to the code of interest as possible. You + * can call start/stop multiple times on the same timer - + * when you do this, H5_timer_get_times() will return time + * values for the current/last session and + * H5_timer_get_total_times() will return the summed times + * of all sessions (see #3 and #4, below). + * + * 3) Use H5_timer_get_times() to get the current system, user + * and elapsed times from a running timer. If called on a + * stopped timer, this will return the time recorded at the + * stop point. + * + * 4) Call H5_timer_get_total_times() to get the total system, + * user and elapsed times recorded across multiple start/stop + * sessions. If called on a running timer, it will return the + * time recorded up to that point. On a stopped timer, it + * will return the time recorded at the stop point. + * + * NOTE: Obtaining a time point is not free! Keep in mind that + * the time functions make system calls and can have + * non-trivial overhead. If you call one of the get_time + * functions on a running timer, that overhead will be + * added to the reported times. + * + * 5) All times recorded will be in seconds. These can be + * converted into human-readable strings with the + * H5_timer_get_time_string() function. + * + * 6) A timer can be reset using by calling H5_timer_init() on + * it. This will set its state to 'stopped' and reset all + * accumulated times to zero. + * + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Dana Robinson + * May 2011 + * + *------------------------------------------------------------------------- + */ +herr_t +H5_timer_init(H5_timer_t *timer /*in,out*/) +{ + /* Sanity check */ + HDassert(timer); + + /* Initialize everything */ + HDmemset(timer, 0, sizeof(H5_timer_t)); + + return 0; +} /* end H5_timer_init() */ + + +/*------------------------------------------------------------------------- + * Function: H5_timer_start + * + * Purpose: Start tracking time in a platform-independent timer. + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Dana Robinson + * May 2011 + * + *------------------------------------------------------------------------- + */ +herr_t +H5_timer_start(H5_timer_t *timer /*in,out*/) +{ + /* Sanity check */ + HDassert(timer); + + /* Start the timer + * This sets the "initial" times to the system-defined start times. + */ + if(H5__timer_get_timevals(&(timer->initial)) < 0) + return -1; + + timer->is_running = TRUE; + + return 0; +} /* end H5_timer_start() */ + + +/*------------------------------------------------------------------------- + * Function: H5_timer_stop + * + * Purpose: Stop tracking time in a platform-independent timer. + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Dana Robinson + * May 2011 + * + *------------------------------------------------------------------------- + */ +herr_t +H5_timer_stop(H5_timer_t *timer /*in,out*/) +{ + /* Sanity check */ + HDassert(timer); + + /* Stop the timer */ + if(H5__timer_get_timevals(&(timer->final_interval)) < 0) + return -1; + + /* The "final" times are stored as intervals (final - initial) + * for more useful reporting to the user. + */ + timer->final_interval.elapsed = timer->final_interval.elapsed - timer->initial.elapsed; + timer->final_interval.system = timer->final_interval.system - timer->initial.system; + timer->final_interval.user = timer->final_interval.user - timer->initial.user; + + /* Add the intervals to the elapsed time */ + timer->total.elapsed += timer->final_interval.elapsed; + timer->total.system += timer->final_interval.system; + timer->total.user += timer->final_interval.user; + + timer->is_running = FALSE; + + return 0; +} /* end H5_timer_stop() */ + + +/*------------------------------------------------------------------------- + * Function: H5_timer_get_times + * + * Purpose: Get the system, user and elapsed times from a timer. These + * are the times since the timer was last started and will be + * 0.0 in a timer that has not been started since it was + * initialized. + * + * This function can be called either before or after + * H5_timer_stop() has been called. If it is called before the + * stop function, the timer will continue to run. + * + * The system and user times will be -1.0 if those times cannot + * be computed on a particular platform. The elapsed time will + * always be present. + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Dana Robinson + * May 2011 + * + *------------------------------------------------------------------------- + */ +herr_t +H5_timer_get_times(H5_timer_t timer, H5_timevals_t *times /*in,out*/) +{ + /* Sanity check */ + HDassert(times); + + if(timer.is_running) { + H5_timevals_t now; + + /* Get the current times and report the current intervals without + * stopping the timer. + */ + if(H5__timer_get_timevals(&now) < 0) + return -1; + + times->elapsed = now.elapsed - timer.initial.elapsed; + times->system = now.system - timer.initial.system; + times->user = now.user - timer.initial.user; + } /* end if */ + else { + times->elapsed = timer.final_interval.elapsed; + times->system = timer.final_interval.system; + times->user = timer.final_interval.user; + } /* end else */ + + return 0; +} /* end H5_timer_get_times() */ + + +/*------------------------------------------------------------------------- + * Function: H5_timer_get_total_times + * + * Purpose: Get the TOTAL system, user and elapsed times recorded by + * the timer since its initialization. This is the sum of all + * times recorded while the timer was running. + * + * These will be 0.0 in a timer that has not been started + * since it was initialized. Calling H5_timer_init() on a + * timer will reset these values to 0.0. + * + * This function can be called either before or after + * H5_timer_stop() has been called. If it is called before the + * stop function, the timer will continue to run. + * + * The system and user times will be -1.0 if those times cannot + * be computed on a particular platform. The elapsed time will + * always be present. + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Dana Robinson + * May 2011 + * + *------------------------------------------------------------------------- + */ +herr_t +H5_timer_get_total_times(H5_timer_t timer, H5_timevals_t *times /*in,out*/) +{ + /* Sanity check */ + HDassert(times); + + if(timer.is_running) { + H5_timevals_t now; + + /* Get the current times and report the current totals without + * stopping the timer. + */ + if(H5__timer_get_timevals(&now) < 0) + return -1; + + times->elapsed = timer.total.elapsed + (now.elapsed - timer.initial.elapsed); + times->system = timer.total.system + (now.system - timer.initial.system); + times->user = timer.total.user + (now.user - timer.initial.user); + } /* end if */ + else { + times->elapsed = timer.total.elapsed; + times->system = timer.total.system; + times->user = timer.total.user; + } /* end else */ + + return 0; +} /* end H5_timer_get_total_times() */ + + +/*------------------------------------------------------------------------- + * Function: H5_timer_get_time_string + * + * Purpose: Converts a time (in seconds) into a human-readable string + * suitable for log messages. + * + * Return: Success: The time string. + * + * The general format of the time string is: + * + * "N/A" time < 0 (invalid time) + * "%.f ns" time < 1 microsecond + * "%.1f us" time < 1 millisecond + * "%.1f ms" time < 1 second + * "%.2f s" time < 1 minute + * "%.f m %.f s" time < 1 hour + * "%.f h %.f m %.f s" longer times + * + * Failure: NULL + * + * Programmer: Dana Robinson + * May 2011 + * + *------------------------------------------------------------------------- + */ +char * +H5_timer_get_time_string(double seconds) +{ + char *s; /* output string */ + + /* Used when the time is greater than 59 seconds */ + double days; + double hours; + double minutes; + double remainder_sec; + + /* Extract larger time units from count of seconds */ + if(seconds > (double)60.0F) { + /* Set initial # of seconds */ + remainder_sec = seconds; + + /* Extract days */ + days = HDfloor(remainder_sec / H5_SEC_PER_DAY); + remainder_sec -= (days * H5_SEC_PER_DAY); + + /* Extract hours */ + hours = HDfloor(remainder_sec / H5_SEC_PER_HOUR); + remainder_sec -= (hours * H5_SEC_PER_HOUR); + + /* Extract minutes */ + minutes = HDfloor(remainder_sec / H5_SEC_PER_MIN); + remainder_sec -= (minutes * H5_SEC_PER_MIN); + + /* The # of seconds left is in remainder_sec */ + } /* end if */ + + /* Allocate */ + if(NULL == (s = (char *)HDcalloc(H5TIMER_TIME_STRING_LEN, sizeof(char)))) + return NULL; + + /* Do we need a format string? Some people might like a certain + * number of milliseconds or s before spilling to the next highest + * time unit. Perhaps this could be passed as an integer. + * (name? round_up_size? ?) + */ + if(seconds < (double)0.0F) + HDsprintf(s, "N/A"); + else if(H5_DBL_ABS_EQUAL((double)0.0F, seconds)) + HDsprintf(s, "0.0 s"); + else if(seconds < (double)1.0E-6F) + /* t < 1 us, Print time in ns */ + HDsprintf(s, "%.f ns", seconds * (double)1.0E9F); + else if(seconds < (double)1.0E-3F) + /* t < 1 ms, Print time in us */ + HDsprintf(s, "%.1f us", seconds * (double)1.0E6F); + else if(seconds < (double)1.0F) + /* t < 1 s, Print time in ms */ + HDsprintf(s, "%.1f ms", seconds * (double)1.0E3F); + else if(seconds < H5_SEC_PER_MIN) + /* t < 1 m, Print time in s */ + HDsprintf(s, "%.2f s", seconds); + else if(seconds < H5_SEC_PER_HOUR) + /* t < 1 h, Print time in m and s */ + HDsprintf(s, "%.f m %.f s", minutes, remainder_sec); + else if(seconds < H5_SEC_PER_DAY) + /* t < 1 d, Print time in h, m and s */ + HDsprintf(s, "%.f h %.f m %.f s", hours, minutes, remainder_sec); + else + /* Print time in d, h, m and s */ + HDsprintf(s, "%.f d %.f h %.f m %.f s", days, hours, minutes, remainder_sec); + + return s; +} /* end H5_timer_get_time_string() */ + diff --git a/src/H5trace.c b/src/H5trace.c index f9f96e2..40967ee 100644 --- a/src/H5trace.c +++ b/src/H5trace.c @@ -15,7 +15,7 @@ * * Created: H5trace.c * Aug 21 2006 - * Quincey Koziol + * Quincey Koziol * * Purpose: Internal code for tracing API calls * @@ -127,8 +127,11 @@ H5_trace(const double *returning, const char *func, const char *type, ...) hssize_t i; void *vp = NULL; FILE *out = H5_debug_g.trace; - H5_timer_t event_time; - static H5_timer_t first_time = {0.0F, 0.0F, 0.0F}; + static hbool_t is_first_invocation = TRUE; + H5_timer_t function_timer; + H5_timevals_t function_times; + static H5_timer_t running_timer; + H5_timevals_t running_times; static int current_depth = 0; static int last_call_depth = 0; @@ -154,13 +157,18 @@ H5_trace(const double *returning, const char *func, const char *type, ...) } /* end else */ } /* end if */ - /* Get time for event */ - if(H5_DBL_ABS_EQUAL(first_time.etime, (double)0.0f)) - H5_timer_begin(&first_time); - if(H5_debug_g.ttimes) - H5_timer_begin(&event_time); - else - HDmemset(&event_time, 0, sizeof event_time); + /* Get time for event if the trace times flag is set */ + if(is_first_invocation && H5_debug_g.ttimes) { + /* start the library-wide timer */ + is_first_invocation = FALSE; + H5_timer_init(&running_timer); + H5_timer_start(&running_timer); + } /* end if */ + if(H5_debug_g.ttimes) { + /* start the timer for this function */ + H5_timer_init(&function_timer); + H5_timer_start(&function_timer); + } /* end if */ /* Print the first part of the line. This is the indication of the * nesting depth followed by the function name and either start of @@ -176,7 +184,9 @@ H5_trace(const double *returning, const char *func, const char *type, ...) if(H5_debug_g.ttimes) { char tmp[320]; - HDsprintf(tmp, "%.6f", event_time.etime-first_time.etime); + H5_timer_get_times(function_timer, &function_times); + H5_timer_get_times(running_timer, &running_times); + HDsprintf(tmp, "%.6f", (function_times.elapsed - running_times.elapsed)); HDfprintf(out, " %*s ", (int)HDstrlen(tmp), ""); } /* end if */ for(i = 0; i < current_depth; i++) @@ -191,8 +201,11 @@ H5_trace(const double *returning, const char *func, const char *type, ...) else { if(current_depth>last_call_depth) HDfputs(" = \n", out); - if(H5_debug_g.ttimes) - HDfprintf(out, "@%.6f ", event_time.etime - first_time.etime); + if(H5_debug_g.ttimes) { + H5_timer_get_times(function_timer, &function_times); + H5_timer_get_times(running_timer, &running_times); + HDfprintf(out, "@%.6f ", (function_times.elapsed - running_times.elapsed)); + } /* end if */ for(i = 0; i < current_depth; i++) HDfputc('+', out); HDfprintf(out, "%*s%s(", 2*current_depth, "", func); @@ -298,7 +311,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'a': if(ptr) { if(vp) - HDfprintf (out, "0x%p", vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -751,7 +764,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) break; default: - HDfprintf (out, "BADTYPE(D%c)", type[1]); + HDfprintf(out, "BADTYPE(D%c)", type[1]); goto error; } /* end switch */ break; @@ -1136,7 +1149,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 's': if(ptr) { if(vp) - HDfprintf (out, "0x%p", vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -1213,7 +1226,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) break; default: - HDfprintf (out, "BADTYPE(H%c)", type[1]); + HDfprintf(out, "BADTYPE(H%c)", type[1]); goto error; } /* end switch */ break; @@ -1401,7 +1414,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) break; case H5I_NTYPES: - HDfprintf (out, "%ld (ntypes - error)", (long)obj); + HDfprintf(out, "%ld (ntypes - error)", (long)obj); break; default: @@ -1505,7 +1518,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) else { int is = HDva_arg(ap, int); - HDfprintf (out, "%d", is); + HDfprintf(out, "%d", is); asize[argno] = is; } /* end else */ break; @@ -1625,7 +1638,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) break; default: - HDfprintf (out, "BADTYPE(I%c)", type[1]); + HDfprintf(out, "BADTYPE(I%c)", type[1]); goto error; } /* end switch */ break; @@ -1651,7 +1664,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'l': if(ptr) { if(vp) - HDfprintf (out, "0x%p", vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -1795,7 +1808,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) else { off_t offset = HDva_arg(ap, off_t); - HDfprintf (out, "%ld", (long)offset); + HDfprintf(out, "%ld", (long)offset); } /* end else */ break; @@ -2504,7 +2517,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) break; default: - HDfprintf (out, "BADTYPE(T%c)", type[1]); + HDfprintf(out, "BADTYPE(T%c)", type[1]); goto error; } /* end switch */ break; @@ -2520,9 +2533,9 @@ H5_trace(const double *returning, const char *func, const char *type, ...) htri_t tri_var = HDva_arg (ap, htri_t); if(tri_var>0) - HDfprintf (out, "TRUE"); + HDfprintf(out, "TRUE"); else if(!tri_var) - HDfprintf (out, "FALSE"); + HDfprintf(out, "FALSE"); else HDfprintf(out, "FAIL(%d)", (int)tri_var); } /* end else */ @@ -2579,7 +2592,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) break; default: - HDfprintf (out, "BADTYPE(U%c)", type[1]); + HDfprintf(out, "BADTYPE(U%c)", type[1]); goto error; } /* end switch */ break; @@ -2589,7 +2602,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'a': if(ptr) { if(vp) - HDfprintf (out, "0x%p", vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -2625,7 +2638,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'A': if(ptr) { if(vp) - HDfprintf (out, "0x%p", vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -2643,7 +2656,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'b': if(ptr) { if(vp) - HDfprintf (out, "0x%p", vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -2673,7 +2686,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'B': if(ptr) { if(vp) - HDfprintf (out, "0x%p", vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -2703,7 +2716,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'C': if(ptr) { if(vp) - HDfprintf (out, "0x%p", vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -2720,7 +2733,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'c': if(ptr) { if(vp) - HDfprintf (out, "0x%p", vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -2756,7 +2769,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'd': if(ptr) { if(vp) - HDfprintf (out, "0x%p", vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -2783,7 +2796,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'e': if(ptr) { if(vp) - HDfprintf (out, "0x%p", vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -2807,7 +2820,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'f': if(ptr) { if(vp) - HDfprintf (out, "0x%p", vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -2831,7 +2844,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'g': if(ptr) { if(vp) - HDfprintf (out, "0x%p", vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -2873,7 +2886,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'h': if(ptr) { if(vp) - HDfprintf (out, "0x%p", vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -2912,7 +2925,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'i': if(ptr) { if(vp) - HDfprintf (out, "0x%p", vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -2936,7 +2949,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'j': if(ptr) { if(vp) - HDfprintf (out, "0x%p", vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -2960,7 +2973,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'k': if(ptr) { if(vp) - HDfprintf (out, "0x%p", vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -2987,7 +3000,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'l': if(ptr) { if(vp) - HDfprintf (out, "0x%p", vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -3014,7 +3027,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'L': if(ptr) { if(vp) - HDfprintf (out, "0x%p", vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -3038,7 +3051,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'm': if(ptr) { if(vp) - HDfprintf (out, "0x%p", vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -3065,7 +3078,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'n': if(ptr) { if(vp) - HDfprintf (out, "0x%p", vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -3095,7 +3108,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'o': if(ptr) { if(vp) - HDfprintf (out, "0x%p", vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -3131,7 +3144,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'r': if(ptr) { if(vp) - HDfprintf (out, "0x%p", vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -3158,7 +3171,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 's': if(ptr) { if(vp) - HDfprintf (out, "0x%p", vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -3181,7 +3194,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'S': if(ptr) { if(vp) - HDfprintf (out, "0x%p", vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -3238,7 +3251,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 't': if(ptr) { if(vp) - HDfprintf (out, "0x%p", vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -3286,7 +3299,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'u': if(ptr) { if(vp) - HDfprintf (out, "0x%p", vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -3304,7 +3317,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'v': if(ptr) { if(vp) - HDfprintf (out, "0x%p", vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -3409,7 +3422,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'w': if(ptr) { if(vp) - HDfprintf (out, "0x%p", vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -3435,7 +3448,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'x': if(ptr) { if(vp) - HDfprintf (out, "0x%p", vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -3453,7 +3466,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'y': if(ptr) { if(vp) - HDfprintf (out, "0x%p", vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -3489,7 +3502,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'z': if(ptr) { if(vp) - HDfprintf (out, "0x%p", vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -3686,9 +3699,12 @@ H5_trace(const double *returning, const char *func, const char *type, ...) } /* end for */ /* Display event time for return */ - if(returning && H5_debug_g.ttimes) - HDfprintf(out, " @%.6f [dt=%.6f]", (event_time.etime - first_time.etime), - (event_time.etime - *returning)); + if(returning && H5_debug_g.ttimes) { + H5_timer_get_times(function_timer, &function_times); + H5_timer_get_times(running_timer, &running_times); + HDfprintf(out, " @%.6f [dt=%.6f]", (function_times.elapsed - running_times.elapsed), + (function_times.elapsed - *returning)); + } /* end if */ error: HDva_end(ap); @@ -3696,10 +3712,13 @@ error: HDfprintf(out, ";\n"); else { last_call_depth = current_depth++; - HDfprintf (out, ")"); + HDfprintf(out, ")"); } /* end else */ HDfflush(out); - return event_time.etime; + if(H5_debug_g.ttimes) + return function_times.elapsed; + else + return 0.0F; } /* end H5_trace() */ diff --git a/src/H5win32defs.h b/src/H5win32defs.h index 00df56d..71162eb 100644 --- a/src/H5win32defs.h +++ b/src/H5win32defs.h @@ -20,6 +20,45 @@ * inside H5private.h * */ +#ifndef H5_HAVE_INTTYPES_H +/* The following definitions should be suitable for 64-bit Windows, which is + * LLP64, and for 32-bit Windows, which is ILP32. Those are the only + * platforms where is likely to be missing. VS2015 and later + * *may* provide these definitions. + */ +#ifdef _WIN64 +# define PRIdPTR "lld" +# define PRIoPTR "llo" +# define PRIuPTR "llu" +# define PRIxPTR "llx" +#else /* _WIN64 */ +# define PRIdPTR "ld" +# define PRIoPTR "lo" +# define PRIuPTR "lu" +# define PRIxPTR "lx" +#endif /* _WIN64 */ + +# define PRId8 "d" +# define PRIo8 "o" +# define PRIu8 "u" +# define PRIx8 "x" +# define PRId16 "d" +# define PRIo16 "o" +# define PRIu16 "u" +# define PRIx16 "x" +# define PRId32 "d" +# define PRIo32 "o" +# define PRIu32 "u" +# define PRIx32 "x" +# define PRId64 "lld" +# define PRIo64 "llo" +# define PRIu64 "llu" +# define PRIx64 "llx" +# define PRIdMAX "lld" +# define PRIoMAX "llo" +# define PRIuMAX "llu" +# define PRIxMAX "llx" +#endif /* * _MSC_VER = 1900 VS2015 @@ -41,11 +80,6 @@ typedef __int64 h5_stat_size_t; #define HDfstat(F,B) _fstati64(F,B) #define HDisatty(F) _isatty(F) -/* The isnan function needs underscore in VS2012 and earlier */ -#if (_MSC_VER <= 1700) - #define HDisnan(X) _isnan(X) -#endif /* MSC_VER < 1700 */ - #define HDgetcwd(S,Z) _getcwd(S,Z) #define HDgetdcwd(D,S,Z) _getdcwd(D,S,Z) #define HDgetdrive() _getdrive() @@ -111,8 +145,10 @@ struct timespec }; #endif /* MSC_VER < 1900 */ -/* The round functions do not exist in VS2012 and earlier */ #if (_MSC_VER <= 1700) +/* The isnan function needs underscore in VS2012 and earlier */ +#define HDisnan(X) _isnan(X) +/* The round functions do not exist in VS2012 and earlier */ #define HDllround(V) Wllround(V) #define HDllroundf(V) Wllroundf(V) #define HDlround(V) Wlround(V) diff --git a/src/Makefile.am b/src/Makefile.am index 04907a0..e1d8591 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -143,8 +143,8 @@ include_HEADERS = hdf5.h H5api_adpt.h H5overflow.h H5pubconf.h H5public.h H5vers H5Cpublic.h H5Dpublic.h \ H5Epubgen.h H5Epublic.h H5ESpublic.h H5Fpublic.h \ H5FDpublic.h H5FDcore.h H5FDdirect.h H5FDfamily.h H5FDhdfs.h \ - H5FDlog.h H5FDmirror.h H5FDmpi.h H5FDmpio.h H5FDmulti.h H5FDros3.h \ - H5FDsec2.h H5FDsplitter.h H5FDstdio.h H5FDsubfiling.h H5FDwindows.h \ + H5FDlog.h H5FDmirror.h H5FDmpi.h H5FDmpio.h H5FDmulti.h H5FDros3.h \ + H5FDsec2.h H5FDsplitter.h H5FDstdio.h H5FDwindows.h H5FDsubfiling.h \ H5Gpublic.h H5Ipublic.h H5Lpublic.h \ H5Mpublic.h H5MMpublic.h H5Opublic.h H5Ppublic.h \ H5PLextern.h H5PLpublic.h \ diff --git a/src/hdf5.lnt b/src/hdf5.lnt index 995e3f6..7b0f384 100644 --- a/src/hdf5.lnt +++ b/src/hdf5.lnt @@ -2,7 +2,7 @@ // Turn off warnings about not using the inlined H5V* functions: -esym(528, H5VM_vector_reduce_product, H5VM_vector_inc) --esym(528, H5VM_vector_cmp, H5VM_vector_cmp_s, H5VM_vector_cmp_u) +-esym(528, H5VM_vector_cmp_s) -esym(528, H5VM_vector_zerop_s, H5VM_vector_zerop_u) // Suppress message about using 'goto' in a few functions diff --git a/src/libhdf5.settings.in b/src/libhdf5.settings.in index fb9deec..98390b8 100644 --- a/src/libhdf5.settings.in +++ b/src/libhdf5.settings.in @@ -89,5 +89,6 @@ Parallel Filtered Dataset Writes: @PARALLEL_FILTERED_WRITES@ Using memory checker: @USINGMEMCHECKER@ Memory allocation sanity checks: @MEMORYALLOCSANITYCHECK@ Function stack tracing: @CODESTACK@ + Use file locking: @DESIRED_FILE_LOCKING@ Strict file format checks: @STRICT_FORMAT_CHECKS@ Optimization instrumentation: @INSTRUMENT_LIBRARY@ diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index e3bfeb3..311d753 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -222,6 +222,7 @@ set (ttsafe_SOURCES ${HDF5_TEST_SOURCE_DIR}/ttsafe_error.c ${HDF5_TEST_SOURCE_DIR}/ttsafe_cancel.c ${HDF5_TEST_SOURCE_DIR}/ttsafe_acreate.c + ${HDF5_TEST_SOURCE_DIR}/ttsafe_attr_vlen.c ) set (H5_TESTS @@ -295,6 +296,7 @@ set (H5_TESTS swmr thread_id # special link vol + timer ) macro (ADD_H5_EXE file) diff --git a/test/H5srcdir.h b/test/H5srcdir.h index b02d432..019cfda 100644 --- a/test/H5srcdir.h +++ b/test/H5srcdir.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Wednesday, March 17, 2010 * * Purpose: srcdir querying support. @@ -20,8 +20,6 @@ #ifndef _H5SRCDIR_H #define _H5SRCDIR_H -/* Include the header file with the correct relative path for the srcdir string */ - #ifdef __cplusplus extern "C" { #endif diff --git a/test/Makefile.am b/test/Makefile.am index 805b482..7ebeae7 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -65,7 +65,7 @@ TEST_PROG= testhdf5 \ flush1 flush2 app_ref enum set_extent ttsafe enc_dec_plist \ enc_dec_plist_cross_platform getname vfd ros3 s3comms hdfs ntypes \ dangle dtransform reserved cross_read freespace mf vds file_image \ - unregister cache_logging cork swmr thread_id vol + unregister cache_logging cork swmr thread_id vol timer # List programs to be built when testing here. # error_test and err_compat are built at the same time as the other tests, but executed by testerror.sh. @@ -146,7 +146,7 @@ LDADD=libh5test.la $(LIBHDF5) # List the source files for tests that have more than one ttsafe_SOURCES=ttsafe.c ttsafe_dcreate.c ttsafe_error.c ttsafe_cancel.c \ - ttsafe_acreate.c + ttsafe_acreate.c ttsafe_attr_vlen.c cache_image_SOURCES=cache_image.c genall5.c mirror_vfd_SOURCES=mirror_vfd.c genall5.c diff --git a/test/SWMR_UseCase_UG.txt b/test/SWMR_UseCase_UG.txt index 18d4927..1e3d1e6 100644 --- a/test/SWMR_UseCase_UG.txt +++ b/test/SWMR_UseCase_UG.txt @@ -6,8 +6,8 @@ case program and explain how to run them. 2.1. Author and Dates: - Version 2: By Albert Cheng (acheng@hdfgroup.org), 2013/06/18. - Version 1: By Albert Cheng (acheng@hdfgroup.org), 2013/06/01. + Version 2: By Albert Cheng, 2013/06/18. + Version 1: By Albert Cheng, 2013/06/01. %%%%Use Case 1.7%%%% diff --git a/test/accum.c b/test/accum.c index 548a04d..3947aff 100644 --- a/test/accum.c +++ b/test/accum.c @@ -1708,10 +1708,10 @@ test_random_write(H5F_t *f) /* Choose random # seed */ seed = (unsigned)HDtime(NULL); -#ifdef QAK +#if 0 /* seed = (unsigned)1155438845; */ HDfprintf(stderr, "Random # seed was: %u\n", seed); -#endif /* QAK */ +#endif HDsrandom(seed); /* Allocate space for the segment length buffer */ diff --git a/test/app_ref.c b/test/app_ref.c index a4853fa..c1735fa 100644 --- a/test/app_ref.c +++ b/test/app_ref.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Neil Fortner + * Programmer: Neil Fortner * Thursday, August 14, 2008 * * Purpose: Tests closing the library after reference counts have been diff --git a/test/big.c b/test/big.c index a2f07af..fee7813 100644 --- a/test/big.c +++ b/test/big.c @@ -12,9 +12,9 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, April 8, 1998 - * Modified: Albert Cheng + * Modified: Albert Cheng * September 11, 2010 */ /* @@ -803,10 +803,10 @@ main (int ac, char **av) /* Choose random # seed */ seed = (unsigned long)HDtime(NULL); -#ifdef QAK +#if 0 /* seed = (unsigned long)1155438845; */ HDfprintf(stderr, "Random # seed was: %lu\n", seed); -#endif /* QAK */ +#endif HDsrandom((unsigned)seed); /* run VFD-specific test */ diff --git a/test/bittests.c b/test/bittests.c index 046528a..6f236d6 100644 --- a/test/bittests.c +++ b/test/bittests.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, June 16, 1998 * * Purpose: Tests functions in H5Tbit.c diff --git a/test/btree2.c b/test/btree2.c index c4c5530..b85f033 100644 --- a/test/btree2.c +++ b/test/btree2.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol +/* Programmer: Quincey Koziol * Tuesday, February 1, 2005 */ #include "h5test.h" @@ -2982,10 +2982,10 @@ test_insert_lots(hid_t fapl, const H5B2_create_t *cparam, /* Initialize random number seed */ curr_time=HDtime(NULL); -#ifdef QAK +#if 0 curr_time=1109170019; HDfprintf(stderr,"curr_time=%lu\n",(unsigned long)curr_time); -#endif /* QAK */ +#endif HDsrandom((unsigned)curr_time); /* @@ -4975,10 +4975,10 @@ test_update_lots(hid_t fapl, const H5B2_create_t *cparam, /* Initialize random number seed */ curr_time = HDtime(NULL); -#ifdef QAK +#if 0 curr_time = 1451342093; HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time); -#endif /* QAK */ +#endif HDsrandom((unsigned)curr_time); /* @@ -8652,10 +8652,10 @@ test_remove_lots(const char *env_h5_drvr, hid_t fapl, const H5B2_create_t *cpara /* Initialize random number seed */ curr_time = HDtime(NULL); -#ifdef QAK +#if 0 curr_time = 1163537969; HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time); -#endif /* QAK */ +#endif HDsrandom((unsigned)curr_time); /* diff --git a/test/cache.c b/test/cache.c index bb18728..46d8481 100644 --- a/test/cache.c +++ b/test/cache.c @@ -2933,21 +2933,25 @@ express_test, unsigned paged) /*------------------------------------------------------------------------- * Function: check_insert_entry() * - * Purpose: Verify that H5C_insert_entry behaves as expected. - * Test the behaviour with different flags. + * Purpose: Verify that H5C_insert_entry behaves as expected. + * Test the behaviour with different flags. * - * This test was added primarily to test basic insert - * pinned entry functionallity, but I through in explicit - * tests for other functionallity that is tested implicitly - * elsewhere. + * This test was added primarily to test basic insert + * pinned entry functionallity, but I through in explicit + * tests for other functionallity that is tested implicitly + * elsewhere. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 8/10/06 * * Modifications: * + * Updated tests to accommodate the case in which the + * slist is disabled. + * JRM -- 5/14/20 + * *------------------------------------------------------------------------- */ @@ -3063,15 +3067,15 @@ check_insert_entry(unsigned paged) /* Verify that the flush marker got set correctly */ if((i == 1) || (i == 3)) { - if(!((entry_ptr->header).flush_marker)) { + if(!((entry_ptr->header).flush_marker)) { pass = FALSE; failure_mssg = "Unexpected insert results 5."; - } + } } else if((entry_ptr->header).flush_marker) { - pass = FALSE; - failure_mssg = "Unexpected insert results 6."; + pass = FALSE; + failure_mssg = "Unexpected insert results 6."; } } @@ -3154,52 +3158,59 @@ check_insert_entry(unsigned paged) if(pass) { - if((cache_ptr->index_len != 4) || - (cache_ptr->index_size != 4 * entry_sizes[entry_type]) || - (cache_ptr->slist_len != 4) || - (cache_ptr->slist_size != 4 * entry_sizes[entry_type]) || - (cache_ptr->pl_len != 0) || - (cache_ptr->pl_size != (size_t)0) || - (cache_ptr->pel_len != 2) || - (cache_ptr->pel_size != 2 * entry_sizes[entry_type]) || - (cache_ptr->LRU_list_len != 2) || - (cache_ptr->LRU_list_size != 2 * entry_sizes[entry_type]) + if ( ( cache_ptr->index_len != 4 ) || + ( cache_ptr->index_size != 4 * entry_sizes[entry_type] ) || + ( ( cache_ptr->slist_enabled ) && + ( ( cache_ptr->slist_len != 4 ) || + ( cache_ptr->slist_size != 4 * entry_sizes[entry_type] ) + ) + ) || + ( cache_ptr->pl_len != 0 ) || + ( cache_ptr->pl_size != (size_t)0 ) || + ( cache_ptr->pel_len != 2 ) || + ( cache_ptr->pel_size != 2 * entry_sizes[entry_type] ) || + ( cache_ptr->LRU_list_len != 2 ) || + ( cache_ptr->LRU_list_size != 2 * entry_sizes[entry_type] ) #if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS - || (cache_ptr->dLRU_list_len != 2) || - (cache_ptr->dLRU_list_size != 2 * entry_sizes[entry_type]) || - (cache_ptr->cLRU_list_len != 0) || - (cache_ptr->cLRU_list_size != (size_t)0) + || + ( cache_ptr->dLRU_list_len != 2 ) || + ( cache_ptr->dLRU_list_size != 2 * entry_sizes[entry_type] ) || + ( cache_ptr->cLRU_list_len != 0 ) || + ( cache_ptr->cLRU_list_size != (size_t)0 ) #endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ - ) { + ) { - pass = FALSE; - failure_mssg = "Unexpected insert results 10."; - } + pass = FALSE; + failure_mssg = "Unexpected insert results 10."; + } } /* Finally, if stats collection is enabled, verify that the expected * stats are collected. */ #if H5C_COLLECT_CACHE_STATS - if(pass) { - - if((cache_ptr->insertions[entry_type] != 4) || - (cache_ptr->pinned_insertions[entry_type] != 2) || - (cache_ptr->pins[entry_type] != 2) || - (cache_ptr->unpins[entry_type] != 0) || - (cache_ptr->dirty_pins[entry_type] != 0) || - (cache_ptr->max_index_len != 4) || - (cache_ptr->max_index_size != 4 * entry_sizes[entry_type]) || - (cache_ptr->max_slist_len != 4) || - (cache_ptr->max_slist_size != 4 * entry_sizes[entry_type]) || - (cache_ptr->max_pl_len != 0) || - (cache_ptr->max_pl_size != (size_t)0) || - (cache_ptr->max_pel_len != 2) || - (cache_ptr->max_pel_size != 2 * entry_sizes[entry_type])) { - - pass = FALSE; - failure_mssg = "Unexpected insert results 11."; - } + if ( pass ) { + + if ( ( cache_ptr->insertions[entry_type] != 4 ) || + ( cache_ptr->pinned_insertions[entry_type] != 2 ) || + ( cache_ptr->pins[entry_type] != 2 ) || + ( cache_ptr->unpins[entry_type] != 0 ) || + ( cache_ptr->dirty_pins[entry_type] != 0 ) || + ( cache_ptr->max_index_len != 4 ) || + ( cache_ptr->max_index_size != 4 * entry_sizes[entry_type] ) || + ( ( cache_ptr->slist_enabled ) && + ( ( cache_ptr->slist_len != 4 ) || + ( cache_ptr->slist_size != 4 * entry_sizes[entry_type] ) + ) + ) || + ( cache_ptr->max_pl_len != 0 ) || + ( cache_ptr->max_pl_size != (size_t)0 ) || + ( cache_ptr->max_pel_len != 2 ) || + ( cache_ptr->max_pel_size != 2 * entry_sizes[entry_type] ) ) { + + pass = FALSE; + failure_mssg = "Unexpected insert results 11."; + } } #endif /* H5C_COLLECT_CACHE_STATS */ @@ -3208,7 +3219,7 @@ check_insert_entry(unsigned paged) if(pass) { unpin_entry(entry_type, 2); - unpin_entry(entry_type, 3); + unpin_entry(entry_type, 3); } if(pass) { @@ -3316,18 +3327,25 @@ check_flush_cache(unsigned paged) /*------------------------------------------------------------------------- + * * Function: check_flush_cache__empty_cache() * - * Purpose: Verify that flush_cache behaves as expected with an empty + * Purpose : Verify that flush_cache behaves as expected with an empty * cache. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 1/12/05 * * Modifications: * + * Added code to setup and take down the skip list before + * and after calls to H5C_flush_cache(). Do this via the + * H5C_FLUSH_CACHE macro. + * + * JRM -- 5/14/20 + * *------------------------------------------------------------------------- */ @@ -3335,7 +3353,6 @@ static void check_flush_cache__empty_cache(H5F_t * file_ptr) { H5C_t * cache_ptr = file_ptr->shared->cache; - herr_t result; if(cache_ptr == NULL) { @@ -3352,53 +3369,37 @@ check_flush_cache__empty_cache(H5F_t * file_ptr) /* Test behaviour on an empty cache. Can't do much sanity * checking in this case, so simply check the return values. + * + * Check of return values is done in the H5C_FLUSH_CACHE() macro. */ - if(pass) { - - result = H5C_flush_cache(file_ptr, H5C__NO_FLAGS_SET); + if ( pass ) { - if(result < 0) { - - pass = FALSE; - failure_mssg = "flush with flags = 0x00 failed on empty cache.\n"; - } + H5C_FLUSH_CACHE(file_ptr, H5C__NO_FLAGS_SET, \ + "flush with flags = 0x00 failed on empty cache.\n") } - if(pass) { - - result = H5C_flush_cache(file_ptr, H5C__FLUSH_INVALIDATE_FLAG); + if ( pass ) { - if(result < 0) { - - pass = FALSE; - failure_mssg = "flush with flags = 0x04 failed on empty cache.\n"; - } + H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_INVALIDATE_FLAG, \ + "flush with flags = 0x04 failed on empty cache.\n") } - if(pass) { - - result = H5C_flush_cache(file_ptr, H5C__FLUSH_CLEAR_ONLY_FLAG); - - if(result < 0) { + if ( pass ) { - pass = FALSE; - failure_mssg = "flush with flags = 0x08 failed on empty cache.\n"; - } + H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_CLEAR_ONLY_FLAG, \ + "flush with flags = 0x08 failed on empty cache.\n") } - if(pass) { - - result = H5C_flush_cache(file_ptr, H5C__FLUSH_MARKED_ENTRIES_FLAG); + if ( pass ) { - if(result < 0) { - - pass = FALSE; - failure_mssg = "flush with flags = 0x10 failed on empty cache.\n"; - } + H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_MARKED_ENTRIES_FLAG, \ + "flush with flags = 0x10 failed on empty cache.\n") } + return; + } /* check_flush_cache__empty_cache() */ @@ -4959,15 +4960,21 @@ check_flush_cache__multi_entry(H5F_t * file_ptr) /*------------------------------------------------------------------------- * Function: check_flush_cache__multi_entry_test() * - * Purpose: Run a multi entry flush cache test. + * Purpose : Run a multi entry flush cache test. * - * Return: void - * - * Programmer: John Mainzer + * Return: void + * + * Programmer: John Mainzer * 1/13/05 * * Modifications: * + * Added code to setup and take down the skip list before + * and after calls to H5C_flush_cache(). Do this via the + * H5C_FLUSH_CACHE macro. + * + * JRM -- 5/14/20 + * *------------------------------------------------------------------------- */ @@ -4980,7 +4987,6 @@ check_flush_cache__multi_entry_test(H5F_t * file_ptr, { H5C_t * cache_ptr = file_ptr->shared->cache; static char msg[128]; - herr_t result; unsigned u; size_t total_entry_size = 0; test_entry_t * base_addr; @@ -4989,8 +4995,8 @@ check_flush_cache__multi_entry_test(H5F_t * file_ptr, #if 0 /* JRM */ /* This gets used a lot, so lets leave it in. */ - HDfprintf(stdout, "check_flush_cache__multi_entry_test: test %d\n", - test_num); + HDfprintf(stdout, "check_flush_cache__multi_entry_test: test %d\n", + test_num); #endif /* JRM */ if(cache_ptr == NULL) { @@ -5001,8 +5007,8 @@ check_flush_cache__multi_entry_test(H5F_t * file_ptr, test_num); failure_mssg = msg; } - else if((cache_ptr->index_len != 0) || - (cache_ptr->index_size != 0)) { + else if ( ( cache_ptr->index_len != 0 ) || + ( cache_ptr->index_size != 0 ) ) { pass = FALSE; @@ -5021,13 +5027,13 @@ check_flush_cache__multi_entry_test(H5F_t * file_ptr, } u = 0; - while(pass && (u < spec_size)) - { - if(((unsigned)spec[u].entry_num != u) || - (spec[u].entry_type < 0) || - (spec[u].entry_type >= NUMBER_OF_ENTRY_TYPES) || - (spec[u].entry_index < 0) || - (spec[u].entry_index > max_indices[spec[u].entry_type])) { + while ( pass && ( u < spec_size ) ) { + + if ( ( (unsigned)spec[u].entry_num != u ) || + ( spec[u].entry_type < 0 ) || + ( spec[u].entry_type >= NUMBER_OF_ENTRY_TYPES ) || + ( spec[u].entry_index < 0 ) || + ( spec[u].entry_index > max_indices[spec[u].entry_type] ) ) { pass = FALSE; HDsnprintf(msg, (size_t)128, @@ -5039,8 +5045,8 @@ check_flush_cache__multi_entry_test(H5F_t * file_ptr, } u = 0; - while(pass && (u < spec_size)) - { + while ( pass && (u < spec_size) ) { + if(spec[u].insert_flag) { insert_entry(file_ptr, spec[u].entry_type, spec[u].entry_index, @@ -5061,11 +5067,10 @@ check_flush_cache__multi_entry_test(H5F_t * file_ptr, if(pass) { - result = H5C_flush_cache(file_ptr, flush_flags); + H5C_FLUSH_CACHE(file_ptr, flush_flags, "dummy failure message.\n") - if(result < 0) { + if ( ! pass ) { - pass = FALSE; HDsnprintf(msg, (size_t)128, "flush with flags 0x%x failed in multi entry test #%d.", flush_flags, test_num); @@ -5107,22 +5112,22 @@ check_flush_cache__multi_entry_test(H5F_t * file_ptr, if(pass) { - if((((flush_flags & H5C__FLUSH_INVALIDATE_FLAG) == 0) + if ( ( ( (flush_flags & H5C__FLUSH_INVALIDATE_FLAG) == 0) && - ((cache_ptr->index_len != spec_size) + ( ( cache_ptr->index_len != spec_size ) || - (cache_ptr->index_size != total_entry_size) - ) - ) + ( cache_ptr->index_size != total_entry_size ) + ) + ) || - (((flush_flags & H5C__FLUSH_INVALIDATE_FLAG) != 0) + ( ( (flush_flags & H5C__FLUSH_INVALIDATE_FLAG) != 0) && - ((cache_ptr->index_len != 0) + ( ( cache_ptr->index_len != 0 ) || - (cache_ptr->index_size != 0) - ) - ) - ) { + ( cache_ptr->index_size != 0 ) + ) + ) + ) { pass = FALSE; HDsnprintf(msg, (size_t)128, @@ -5135,9 +5140,9 @@ check_flush_cache__multi_entry_test(H5F_t * file_ptr, /* clean up the cache to prep for the next test */ if(pass) { - result = H5C_flush_cache(file_ptr, H5C__FLUSH_INVALIDATE_FLAG); + H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_INVALIDATE_FLAG, "dummy mssg.\n") - if(result < 0) { + if ( ! pass ) { pass = FALSE; HDsnprintf(msg, (size_t)128, @@ -5145,8 +5150,8 @@ check_flush_cache__multi_entry_test(H5F_t * file_ptr, test_num); failure_mssg = msg; } - else if((cache_ptr->index_len != 0) || - (cache_ptr->index_size != 0)) { + else if ( ( cache_ptr->index_len != 0 ) || + ( cache_ptr->index_size != 0 ) ) { pass = FALSE; HDsnprintf(msg, (size_t)128, @@ -5158,8 +5163,8 @@ check_flush_cache__multi_entry_test(H5F_t * file_ptr, } u = 0; - while(pass && (u < spec_size)) - { + while ( pass && ( u < spec_size ) ) { + base_addr = entries[spec[u].entry_type]; entry_ptr = &(base_addr[spec[u].entry_index]); @@ -5176,17 +5181,24 @@ check_flush_cache__multi_entry_test(H5F_t * file_ptr, /*------------------------------------------------------------------------- + * * Function: check_flush_cache__pe_multi_entry_test() * - * Purpose: Run a multi entry flush cache test. + * Purpose: Run a multi entry flush cache test. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 4/5/06 * * Modifications: * + * Added code to setup and take down the skip list before + * and after calls to H5C_flush_cache(). Do this via the + * H5C_FLUSH_CACHE macro. + * + * JRM -- 5/16/20 + * *------------------------------------------------------------------------- */ @@ -5199,7 +5211,6 @@ check_flush_cache__pe_multi_entry_test(H5F_t * file_ptr, { H5C_t *cache_ptr = file_ptr->shared->cache; static char msg[128]; - herr_t result; unsigned u; int j; size_t total_entry_size = 0; @@ -5221,8 +5232,8 @@ check_flush_cache__pe_multi_entry_test(H5F_t * file_ptr, test_num); failure_mssg = msg; } - else if((cache_ptr->index_len != 0) || - (cache_ptr->index_size != 0)) { + else if ( ( cache_ptr->index_len != 0 ) || + ( cache_ptr->index_size != 0 ) ) { pass = FALSE; @@ -5241,15 +5252,15 @@ check_flush_cache__pe_multi_entry_test(H5F_t * file_ptr, } u = 0; - while(pass && (u < spec_size)) - { - if(((unsigned)spec[u].entry_num != u) || - (spec[u].entry_type < 0) || - (spec[u].entry_type >= NUMBER_OF_ENTRY_TYPES) || - (spec[u].entry_index < 0) || - (spec[u].entry_index > max_indices[spec[u].entry_type]) || - (spec[u].num_pins < 0) || - (spec[u].num_pins > MAX_PINS)) { + while ( pass && ( u < spec_size ) ) { + + if ( ( (unsigned)spec[u].entry_num != u ) || + ( spec[u].entry_type < 0 ) || + ( spec[u].entry_type >= NUMBER_OF_ENTRY_TYPES ) || + ( spec[u].entry_index < 0 ) || + ( spec[u].entry_index > max_indices[spec[u].entry_type] ) || + ( spec[u].num_pins < 0 ) || + ( spec[u].num_pins > MAX_PINS ) ) { pass = FALSE; HDsnprintf(msg, (size_t)128, @@ -5278,25 +5289,24 @@ check_flush_cache__pe_multi_entry_test(H5F_t * file_ptr, total_entry_size += entry_sizes[spec[u].entry_type]; - for (j = 0; j < spec[u].num_pins; j++) - { + for (j = 0; j < spec[u].num_pins; j++) { + create_pinned_entry_dependency(file_ptr, - spec[u].entry_type, - spec[u].entry_index, - spec[u].pin_type[j], - spec[u].pin_idx[j]); - } + spec[u].entry_type, + spec[u].entry_index, + spec[u].pin_type[j], + spec[u].pin_idx[j]); + } u++; } if(pass) { - result = H5C_flush_cache(file_ptr, flush_flags); + H5C_FLUSH_CACHE(file_ptr, flush_flags, "dummy failure message.\n") - if(result < 0) { + if ( ! pass ) { - pass = FALSE; HDsnprintf(msg, (size_t)128, "flush with flags 0x%x failed in pe multi entry test #%d.", flush_flags, test_num); @@ -5305,14 +5315,14 @@ check_flush_cache__pe_multi_entry_test(H5F_t * file_ptr, } u = 0; - while(pass && (u < spec_size)) - { + while ( pass && ( u < spec_size ) ) { + base_addr = entries[spec[u].entry_type]; entry_ptr = &(base_addr[spec[u].entry_index]); - if((entry_ptr->deserialized != spec[u].expected_deserialized) || - (entry_ptr->serialized != spec[u].expected_serialized) || - (entry_ptr->destroyed != spec[u].expected_destroyed)) { + if ( ( entry_ptr->deserialized != spec[u].expected_deserialized ) || + ( entry_ptr->serialized != spec[u].expected_serialized ) || + ( entry_ptr->destroyed != spec[u].expected_destroyed ) ) { #if 0 /* This is useful debugging code. Lets keep it around. */ @@ -5338,22 +5348,22 @@ check_flush_cache__pe_multi_entry_test(H5F_t * file_ptr, if(pass) { - if((((flush_flags & H5C__FLUSH_INVALIDATE_FLAG) == 0) + if ( ( ( (flush_flags & H5C__FLUSH_INVALIDATE_FLAG) == 0) && - ((cache_ptr->index_len != spec_size) + ( ( cache_ptr->index_len != spec_size ) || - (cache_ptr->index_size != total_entry_size) - ) - ) + ( cache_ptr->index_size != total_entry_size ) + ) + ) || - (((flush_flags & H5C__FLUSH_INVALIDATE_FLAG) != 0) + ( ( (flush_flags & H5C__FLUSH_INVALIDATE_FLAG) != 0 ) && - ((cache_ptr->index_len != 0) + ( ( cache_ptr->index_len != 0 ) || - (cache_ptr->index_size != 0) - ) - ) - ) { + ( cache_ptr->index_size != 0 ) + ) + ) + ) { pass = FALSE; HDsnprintf(msg, (size_t)128, @@ -5364,11 +5374,11 @@ check_flush_cache__pe_multi_entry_test(H5F_t * file_ptr, } /* clean up the cache to prep for the next test */ - if(pass) { + if ( pass ) { - result = H5C_flush_cache(file_ptr, H5C__FLUSH_INVALIDATE_FLAG); + H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_INVALIDATE_FLAG, "dummy mssg.\n") - if(result < 0) { + if ( ! pass ) { pass = FALSE; HDsnprintf(msg, (size_t)128, @@ -5376,8 +5386,8 @@ check_flush_cache__pe_multi_entry_test(H5F_t * file_ptr, test_num); failure_mssg = msg; } - else if((cache_ptr->index_len != 0) || - (cache_ptr->index_size != 0)) { + else if ( ( cache_ptr->index_len != 0 ) || + ( cache_ptr->index_size != 0 ) ) { pass = FALSE; HDsnprintf(msg, (size_t)128, @@ -5389,8 +5399,8 @@ check_flush_cache__pe_multi_entry_test(H5F_t * file_ptr, } u = 0; - while(pass && (u < spec_size)) - { + while ( pass && ( u < spec_size ) ) { + base_addr = entries[spec[u].entry_type]; entry_ptr = &(base_addr[spec[u].entry_index]); @@ -9181,16 +9191,22 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) /*------------------------------------------------------------------------- * Function: check_flush_cache__flush_op_test() * - * Purpose: Run a flush op flush cache test. Of the nature of - * flush operations, this is a multi-entry test. + * Purpose: Run a flush op flush cache test. Of the nature of + * flush operations, this is a multi-entry test. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 9/3/06 * * Modifications: * + * Added code to setup and take down the skip list before + * and after calls to H5C_flush_cache(). Do this via the + * H5C_FLUSH_CACHE macro. + * + * JRM -- 5/16/20 + * *------------------------------------------------------------------------- */ @@ -9200,16 +9216,15 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr, unsigned int flush_flags, int spec_size, const struct fo_flush_cache_test_spec spec[], - unsigned init_expected_index_len, - size_t init_expected_index_size, - unsigned expected_index_len, - size_t expected_index_size, - int check_size, - struct fo_flush_entry_check check[]) + unsigned init_expected_index_len, + size_t init_expected_index_size, + unsigned expected_index_len, + size_t expected_index_size, + int check_size, + struct fo_flush_entry_check check[]) { H5C_t * cache_ptr = file_ptr->shared->cache; static char msg[128]; - herr_t result; int i; int j; test_entry_t * base_addr; @@ -9228,8 +9243,8 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr, test_num); failure_mssg = msg; } - else if((cache_ptr->index_len != 0) || - (cache_ptr->index_size != 0)) { + else if ( ( cache_ptr->index_len != 0 ) || + ( cache_ptr->index_size != 0 ) ) { pass = FALSE; @@ -9248,17 +9263,17 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr, } i = 0; - while(pass && (i < spec_size)) - { - if((spec[i].entry_num != i) || - (spec[i].entry_type < 0) || - (spec[i].entry_type >= NUMBER_OF_ENTRY_TYPES) || - (spec[i].entry_index < 0) || - (spec[i].entry_index > max_indices[spec[i].entry_type]) || - (spec[i].num_pins < 0) || - (spec[i].num_pins > MAX_PINS) || - (spec[i].num_flush_ops < 0) || - (spec[i].num_flush_ops > MAX_FLUSH_OPS)) { + while ( pass && ( i < spec_size ) ) { + + if ( ( spec[i].entry_num != i ) || + ( spec[i].entry_type < 0 ) || + ( spec[i].entry_type >= NUMBER_OF_ENTRY_TYPES ) || + ( spec[i].entry_index < 0 ) || + ( spec[i].entry_index > max_indices[spec[i].entry_type] ) || + ( spec[i].num_pins < 0 ) || + ( spec[i].num_pins > MAX_PINS ) || + ( spec[i].num_flush_ops < 0 ) || + ( spec[i].num_flush_ops > MAX_FLUSH_OPS ) ) { pass = FALSE; HDsnprintf(msg, (size_t)128, @@ -9270,36 +9285,36 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr, } i = 0; - while(pass && (i < check_size)) - { - if((check[i].entry_num != i) || - (check[i].entry_type < 0) || - (check[i].entry_type >= NUMBER_OF_ENTRY_TYPES) || - (check[i].entry_index < 0) || - (check[i].entry_index > max_indices[check[i].entry_type]) || + while ( pass && ( i < check_size ) ) { + + if ( ( check[i].entry_num != i) || + ( check[i].entry_type < 0) || + ( check[i].entry_type >= NUMBER_OF_ENTRY_TYPES) || + ( check[i].entry_index < 0) || + ( check[i].entry_index > max_indices[check[i].entry_type]) || #ifndef H5_HAVE_STDBOOL_H /* Check for nonsense values if hbool_t is an integral * type instead of a real Boolean. */ - ((check[i].in_cache != TRUE) && - (check[i].in_cache != FALSE)) || - ((check[i].at_main_addr != TRUE) && - (check[i].at_main_addr != FALSE)) || - ((check[i].is_dirty != TRUE) && - (check[i].is_dirty != FALSE)) || - ((check[i].is_protected != TRUE) && - (check[i].is_protected != FALSE)) || - ((check[i].is_pinned != TRUE) && - (check[i].is_pinned != FALSE)) || - ((check[i].expected_deserialized != TRUE) && - (check[i].expected_deserialized != FALSE)) || - ((check[i].expected_serialized != TRUE) && - (check[i].expected_serialized != FALSE)) || - ((check[i].expected_destroyed != TRUE) && - (check[i].expected_destroyed != FALSE)) || + ( ( check[i].in_cache != TRUE ) && + ( check[i].in_cache != FALSE ) ) || + ( ( check[i].at_main_addr != TRUE ) && + ( check[i].at_main_addr != FALSE ) ) || + ( ( check[i].is_dirty != TRUE ) && + ( check[i].is_dirty != FALSE ) ) || + ( ( check[i].is_protected != TRUE ) && + ( check[i].is_protected != FALSE ) ) || + ( ( check[i].is_pinned != TRUE ) && + ( check[i].is_pinned != FALSE ) ) || + ( ( check[i].expected_deserialized != TRUE ) && + ( check[i].expected_deserialized != FALSE ) ) || + ( ( check[i].expected_serialized != TRUE ) && + ( check[i].expected_serialized != FALSE ) ) || + ( ( check[i].expected_destroyed != TRUE ) && + ( check[i].expected_destroyed != FALSE ) ) || #endif /* H5_HAVE_STDBOOL_H */ - (check[i].expected_size <= (size_t)0) - ) { + ( check[i].expected_size <= (size_t)0 ) + ) { pass = FALSE; HDsnprintf(msg, (size_t)128, @@ -9311,8 +9326,8 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr, } i = 0; - while(pass && (i < spec_size)) - { + while ( pass && ( i < spec_size ) ) { + if(spec[i].insert_flag) { insert_entry(file_ptr, spec[i].entry_type, spec[i].entry_index, @@ -9330,34 +9345,34 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr, spec[i].flags); } - for (j = 0; j < spec[i].num_pins; j++) - { + for (j = 0; j < spec[i].num_pins; j++) + { create_pinned_entry_dependency(file_ptr, spec[i].entry_type, spec[i].entry_index, spec[i].pin_type[j], spec[i].pin_idx[j]); - } + } - for (j = 0; j < spec[i].num_flush_ops; j++) - { - add_flush_op(spec[i].entry_type, - spec[i].entry_index, - spec[i].flush_ops[j].op_code, - spec[i].flush_ops[j].type, - spec[i].flush_ops[j].idx, - spec[i].flush_ops[j].flag, - spec[i].flush_ops[j].size, + for (j = 0; j < spec[i].num_flush_ops; j++) { + + add_flush_op(spec[i].entry_type, + spec[i].entry_index, + spec[i].flush_ops[j].op_code, + spec[i].flush_ops[j].type, + spec[i].flush_ops[j].idx, + spec[i].flush_ops[j].flag, + spec[i].flush_ops[j].size, spec[i].flush_ops[j].order_ptr); - } + } i++; } - if(pass) { + if ( pass ) { - if((cache_ptr->index_len != init_expected_index_len) || - (cache_ptr->index_size != init_expected_index_size)) { + if ( ( cache_ptr->index_len != init_expected_index_len ) || + ( cache_ptr->index_size != init_expected_index_size ) ) { pass = FALSE; HDsnprintf(msg, (size_t)128, @@ -9369,9 +9384,9 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr, if(pass) { - result = H5C_flush_cache(file_ptr, flush_flags); + H5C_FLUSH_CACHE(file_ptr, flush_flags, "dummy failure message") - if(result < 0) { + if ( ! pass ) { pass = FALSE; HDsnprintf(msg, (size_t)128, @@ -9383,14 +9398,14 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr, i = 0; - while(pass && (i < spec_size)) - { + while ( pass && ( i < spec_size ) ) { + base_addr = entries[spec[i].entry_type]; entry_ptr = &(base_addr[spec[i].entry_index]); - if((entry_ptr->deserialized != spec[i].expected_deserialized) || - (entry_ptr->serialized != spec[i].expected_serialized) || - (entry_ptr->destroyed != spec[i].expected_destroyed)) { + if ( ( entry_ptr->deserialized != spec[i].expected_deserialized ) || + ( entry_ptr->serialized != spec[i].expected_serialized ) || + ( entry_ptr->destroyed != spec[i].expected_destroyed ) ) { #if 0 /* This is useful debugging code. Lets keep it around. */ @@ -9419,136 +9434,166 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr, if(pass) { i = 0; - while(pass && (i < check_size)) - { - if(check[i].in_cache != entry_in_cache(cache_ptr, - check[i].entry_type, - check[i].entry_index)) { + while ( pass && (i < check_size ) ) { + + if ( check[i].in_cache != entry_in_cache(cache_ptr, + check[i].entry_type, + check[i].entry_index) ) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Check1 failed on entry %d after flush op test #%d.", i, test_num); failure_mssg = msg; - } + } base_addr = entries[check[i].entry_type]; entry_ptr = &(base_addr[check[i].entry_index]); - if((entry_ptr->size != check[i].expected_size) || - ((!entry_ptr->header.destroy_in_progress) && - (check[i].in_cache) && - (entry_ptr->header.size != check[i].expected_size)) || - (entry_ptr->at_main_addr != check[i].at_main_addr) || - (entry_ptr->is_dirty != check[i].is_dirty) || - (entry_ptr->header.is_dirty != check[i].is_dirty) || - (entry_ptr->is_protected != check[i].is_protected) || - (entry_ptr->header.is_protected != check[i].is_protected) || - (entry_ptr->is_pinned != check[i].is_pinned) || - (entry_ptr->header.is_pinned != check[i].is_pinned) || - (entry_ptr->deserialized != check[i].expected_deserialized) || - (entry_ptr->serialized != check[i].expected_serialized) || - (entry_ptr->destroyed != check[i].expected_destroyed)) { + if ( ( entry_ptr->size != check[i].expected_size) || + ( ( !entry_ptr->header.destroy_in_progress) && + ( check[i].in_cache ) && + ( entry_ptr->header.size != check[i].expected_size ) ) || + ( entry_ptr->at_main_addr != check[i].at_main_addr ) || + ( entry_ptr->is_dirty != check[i].is_dirty ) || + ( entry_ptr->header.is_dirty != check[i].is_dirty ) || + ( entry_ptr->is_protected != check[i].is_protected ) || + ( entry_ptr->header.is_protected != check[i].is_protected ) || + ( entry_ptr->is_pinned != check[i].is_pinned ) || + ( entry_ptr->header.is_pinned != check[i].is_pinned ) || + ( entry_ptr->deserialized != check[i].expected_deserialized ) || + ( entry_ptr->serialized != check[i].expected_serialized ) || + ( entry_ptr->destroyed != check[i].expected_destroyed ) ) { #if 0 /* This is useful debugging code. Lets keep it around for a while. */ - if(entry_ptr->size != check[i].expected_size) { - HDfprintf(stdout, "entry_ptr->size (expected) = %d (%d).\n", - (int)(entry_ptr->size), - (int)(check[i].expected_size)); - } - if((!entry_ptr->header.destroy_in_progress) && - (check[i].in_cache) && - (entry_ptr->header.size != check[i].expected_size)) { - HDfprintf(stdout, + if ( entry_ptr->size != check[i].expected_size ) { + + HDfprintf(stdout, "entry_ptr->size (expected) = %d (%d).\n", + (int)(entry_ptr->size), + (int)(check[i].expected_size)); + } + + if ( ( ! entry_ptr->header.destroy_in_progress ) && + ( check[i].in_cache ) && + ( entry_ptr->header.size != check[i].expected_size ) ) { + + HDfprintf(stdout, "(!destroy in progress and in cache and size (expected) = %d (%d).\n", (int)(entry_ptr->header.size), - (int)(check[i].expected_size)); - } - if(entry_ptr->at_main_addr != check[i].at_main_addr) { - HDfprintf(stdout, "(%d,%d) at main addr (expected) = %d (%d).\n", - (int)(check[i].entry_type), - (int)(check[i].entry_index), + (int)(check[i].expected_size)); + } + + if ( entry_ptr->at_main_addr != check[i].at_main_addr ) { + + HDfprintf(stdout, + "(%d,%d) at main addr (expected) = %d (%d).\n", + (int)(check[i].entry_type), + (int)(check[i].entry_index), (int)(entry_ptr->at_main_addr), - (int)(check[i].at_main_addr)); + (int)(check[i].at_main_addr)); + } + + if ( entry_ptr->is_dirty != check[i].is_dirty ) { + + HDfprintf(stdout, + "entry_ptr->is_dirty (expected) = %d (%d).\n", + (int)(entry_ptr->is_dirty), + (int)(check[i].is_dirty)); + } + + if ( entry_ptr->header.is_dirty != check[i].is_dirty ) { + + HDfprintf(stdout, + "entry_ptr->header.is_dirty (expected) = %d (%d).\n", + (int)(entry_ptr->header.is_dirty), + (int)(check[i].is_dirty)); + } + + if ( entry_ptr->is_protected != check[i].is_protected ) { + + HDfprintf(stdout, + "entry_ptr->is_protected (expected) = %d (%d).\n", + (int)(entry_ptr->is_protected), + (int)(check[i].is_protected)); + } + + if ( entry_ptr->header.is_protected != check[i].is_protected ) { + + HDfprintf(stdout, + "entry_ptr->header.is_protected (expected) = %d (%d).\n", + (int)(entry_ptr->is_protected), + (int)(check[i].is_protected)); + } + + if ( entry_ptr->is_pinned != check[i].is_pinned ) { + + HDfprintf(stdout, + "entry_ptr->is_pinned (expected) = %d (%d).\n", + (int)(entry_ptr->is_pinned), + (int)(check[i].is_pinned)); + } + + if ( entry_ptr->header.is_pinned != check[i].is_pinned ) { + + HDfprintf(stdout, + "entry_ptr->header.is_pinned (expected) = %d (%d).\n", + (int)(entry_ptr->header.is_pinned), + (int)(check[i].is_pinned)); + } + + if ( entry_ptr->deserialized != check[i].expected_deserialized ) { + + HDfprintf(stdout, + "entry_ptr->deserialized (expected) = %d (%d).\n", + (int)(entry_ptr->deserialized), + (int)(check[i].expected_deserialized)); + } + + if ( entry_ptr->serialized != check[i].expected_serialized ) { + + HDfprintf(stdout, + "entry_ptr->serialized (expected) = %d (%d).\n", + (int)(entry_ptr->serialized), + (int)(check[i].expected_serialized)); + } + + if ( entry_ptr->destroyed != check[i].expected_destroyed ) { + + HDfprintf(stdout, \ + "entry_ptr->destroyed (expected) = %d (%d).\n", + (int)(entry_ptr->destroyed), + (int)(check[i].expected_destroyed)); } - if(entry_ptr->is_dirty != check[i].is_dirty) { - HDfprintf(stdout, "entry_ptr->is_dirty (expected) = %d (%d).\n", - (int)(entry_ptr->is_dirty), - (int)(check[i].is_dirty)); - } - if(entry_ptr->header.is_dirty != check[i].is_dirty) { - HDfprintf(stdout, "entry_ptr->header.is_dirty (expected) = %d (%d).\n", - (int)(entry_ptr->header.is_dirty), - (int)(check[i].is_dirty)); - } - if(entry_ptr->is_protected != check[i].is_protected) { - HDfprintf(stdout, "entry_ptr->is_protected (expected) = %d (%d).\n", - (int)(entry_ptr->is_protected), - (int)(check[i].is_protected)); - } - if(entry_ptr->header.is_protected != check[i].is_protected) { - HDfprintf(stdout, "entry_ptr->header.is_protected (expected) = %d (%d).\n", - (int)(entry_ptr->is_protected), - (int)(check[i].is_protected)); - } - if(entry_ptr->is_pinned != check[i].is_pinned) { - HDfprintf(stdout, "entry_ptr->is_pinned (expected) = %d (%d).\n", - (int)(entry_ptr->is_pinned), - (int)(check[i].is_pinned)); - } - if(entry_ptr->header.is_pinned != check[i].is_pinned) { - HDfprintf(stdout, "entry_ptr->header.is_pinned (expected) = %d (%d).\n", - (int)(entry_ptr->header.is_pinned), - (int)(check[i].is_pinned)); - } - if(entry_ptr->deserialized != - check[i].expected_deserialized) { - HDfprintf(stdout, - "entry_ptr->deserialized (expected) = %d (%d).\n", - (int)(entry_ptr->deserialized), - (int)(check[i].expected_deserialized)); - } - if(entry_ptr->serialized != check[i].expected_serialized) { - HDfprintf(stdout, - "entry_ptr->serialized (expected) = %d (%d).\n", - (int)(entry_ptr->serialized), - (int)(check[i].expected_serialized)); - } - if(entry_ptr->destroyed != check[i].expected_destroyed) { - HDfprintf(stdout, "entry_ptr->destroyed (expected) = %d (%d).\n", - (int)(entry_ptr->destroyed), - (int)(check[i].expected_destroyed)); - } #endif pass = FALSE; HDsnprintf(msg, (size_t)128, "Check2 failed on entry %d after flush op test #%d.", i, test_num); failure_mssg = msg; - } - i++; + } + i++; } } - if(pass) { + if ( pass ) { - if((((flush_flags & H5C__FLUSH_INVALIDATE_FLAG) == 0) + if ( ( ( (flush_flags & H5C__FLUSH_INVALIDATE_FLAG) == 0 ) && - ((cache_ptr->index_len != expected_index_len) + ( ( cache_ptr->index_len != expected_index_len ) || - (cache_ptr->index_size != expected_index_size) - ) - ) + ( cache_ptr->index_size != expected_index_size ) + ) + ) || - (((flush_flags & H5C__FLUSH_INVALIDATE_FLAG) != 0) + ( ( (flush_flags & H5C__FLUSH_INVALIDATE_FLAG) != 0 ) && - ((cache_ptr->index_len != 0) + ( ( cache_ptr->index_len != 0 ) || - (cache_ptr->index_size != 0) - ) - ) - ) { + ( cache_ptr->index_size != 0 ) + ) + ) + ) { pass = FALSE; HDsnprintf(msg, (size_t)128, @@ -9561,20 +9606,19 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr, /* clean up the cache to prep for the next test */ if(pass) { - result = H5C_flush_cache(file_ptr, H5C__FLUSH_INVALIDATE_FLAG); + H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_INVALIDATE_FLAG, "dummy mssg.") - if(result < 0) { + if ( ! pass ) { - pass = FALSE; HDsnprintf(msg, (size_t)128, "Flush failed on cleanup in flush op test #%d.", test_num); failure_mssg = msg; } - else if((cache_ptr->index_len != 0) || - (cache_ptr->index_size != 0) || - (cache_ptr->clean_index_size != 0) || - (cache_ptr->dirty_index_size != 0)) { + else if ( ( cache_ptr->index_len != 0 ) || + ( cache_ptr->index_size != 0 ) || + ( cache_ptr->clean_index_size != 0 ) || + ( cache_ptr->dirty_index_size != 0 ) ) { pass = FALSE; HDsnprintf(msg, (size_t)128, @@ -9586,12 +9630,12 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr, } i = 0; - while(pass && (i < spec_size)) - { - base_addr = entries[spec[i].entry_type]; - entry_ptr = &(base_addr[spec[i].entry_index]); + while ( pass && ( i < spec_size ) ) { + + base_addr = entries[spec[i].entry_type]; + entry_ptr = &(base_addr[spec[i].entry_index]); - entry_ptr->size = entry_sizes[spec[i].entry_type]; + entry_ptr->size = entry_sizes[spec[i].entry_type]; entry_ptr->deserialized = FALSE; entry_ptr->serialized = FALSE; @@ -9601,12 +9645,12 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr, } i = 0; - while(pass && (i < check_size)) - { - base_addr = entries[check[i].entry_type]; - entry_ptr = &(base_addr[check[i].entry_index]); + while ( pass && ( i < check_size ) ) { + + base_addr = entries[check[i].entry_type]; + entry_ptr = &(base_addr[check[i].entry_index]); - entry_ptr->size = entry_sizes[check[i].entry_type]; + entry_ptr->size = entry_sizes[check[i].entry_type]; entry_ptr->deserialized = FALSE; entry_ptr->serialized = FALSE; @@ -9623,22 +9667,28 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr, /*------------------------------------------------------------------------- * Function: check_flush_cache__flush_op_eviction_test() * - * Purpose: Verify that flush operations work as expected when an + * Purpose: Verify that flush operations work as expected when an * entry is evicted. * * Do nothing if pass is FALSE on entry. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 10/3/06 * * Modifications: * - * Updated test for minor changes in the behaviour - * of H5C__flush_single_entry(). + * Updated test for minor changes in the behaviour + * of H5C__flush_single_entry(). + * + * JRM -- 2/16/15 + * + * Added code to setup and take down the skip list before + * and after calls to H5C_flush_cache(). Do this via the + * H5C_FLUSH_CACHE macro. * - * JRM -- 2/16/15 + * JRM -- 5/16/20 * *------------------------------------------------------------------------- */ @@ -9651,7 +9701,6 @@ check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr) int num_variable_entries = 10; int num_monster_entries = 31; int num_large_entries = 0; - herr_t result; test_entry_t * entry_ptr; test_entry_t * base_addr; struct expected_entry_status expected[10 + 31 + 14] = @@ -10840,15 +10889,12 @@ check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr) if(pass) { - result = H5C_flush_cache(file_ptr, H5C__FLUSH_INVALIDATE_FLAG); + H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_INVALIDATE_FLAG, \ + "Cache flush invalidate failed after flush op eviction test") - if(result < 0) { - - pass = FALSE; - failure_mssg = "Cache flush invalidate failed after flush op eviction test"; - } - else if((cache_ptr->index_len != 0) || - (cache_ptr->index_size != 0)) { + if ( ( pass ) && + ( ( cache_ptr->index_len != 0 ) || + ( cache_ptr->index_size != 0 ) ) ) { pass = FALSE; failure_mssg = "Unexpected cache len/size after cleanup of flush op eviction test"; @@ -12493,15 +12539,21 @@ check_flush_cache__single_entry(H5F_t * file_ptr) /*------------------------------------------------------------------------- * Function: check_flush_cache__single_entry_test() * - * Purpose: Run a single entry flush cache test. + * Purpose: Run a single entry flush cache test. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 1/12/05 * * Modifications: * + * Added code to setup and take down the skip list before + * and after calls to H5C_flush_cache(). Do this via the + * H5C_FLUSH_CACHE macro. + * + * JRM -- 5/14/20 + * *------------------------------------------------------------------------- */ @@ -12519,7 +12571,6 @@ check_flush_cache__single_entry_test(H5F_t * file_ptr, { H5C_t * cache_ptr = file_ptr->shared->cache; static char msg[128]; - herr_t result; test_entry_t * base_addr; test_entry_t * entry_ptr = NULL; @@ -12531,8 +12582,8 @@ check_flush_cache__single_entry_test(H5F_t * file_ptr, test_num); failure_mssg = msg; } - else if((cache_ptr->index_len != 0) || - (cache_ptr->index_size != 0)) { + else if ( ( cache_ptr->index_len != 0 ) || + ( cache_ptr->index_size != 0 ) ) { pass = FALSE; HDsnprintf(msg, (size_t)128, @@ -12540,8 +12591,10 @@ check_flush_cache__single_entry_test(H5F_t * file_ptr, test_num); failure_mssg = msg; } - else if((entry_type < 0) || (entry_type >= NUMBER_OF_ENTRY_TYPES) || - (entry_idx < 0) || (entry_idx > max_indices[entry_type])) { + else if ( ( entry_type < 0 ) || + ( entry_type >= NUMBER_OF_ENTRY_TYPES ) || + ( entry_idx < 0 ) || + ( entry_idx > max_indices[entry_type] ) ) { pass = FALSE; HDsnprintf(msg, (size_t)128, @@ -12569,19 +12622,20 @@ check_flush_cache__single_entry_test(H5F_t * file_ptr, if(pass) { - result = H5C_flush_cache(file_ptr, flush_flags); + H5C_FLUSH_CACHE(file_ptr, flush_flags, "dummy failure mssg.") - if(result < 0) { + if ( ! pass ) { /* construct and set actual failure message */ - pass = FALSE; HDsnprintf(msg, (size_t)128, "flush with flags 0x%x failed in single entry test #%d.", flush_flags, test_num); + failure_mssg = msg; } - else if((entry_ptr->deserialized != expected_deserialized) || - (entry_ptr->serialized != expected_serialized) || - (entry_ptr->destroyed != expected_destroyed)) { + else if ( ( entry_ptr->deserialized != expected_deserialized ) || + ( entry_ptr->serialized != expected_serialized ) || + ( entry_ptr->destroyed != expected_destroyed ) ) { + #if 0 /* This is useful debugging code -- lets keep it for a while */ HDfprintf(stdout, @@ -12599,22 +12653,22 @@ check_flush_cache__single_entry_test(H5F_t * file_ptr, test_num); failure_mssg = msg; } - else if((((flush_flags & H5C__FLUSH_INVALIDATE_FLAG) == 0) + else if ( ( ( (flush_flags & H5C__FLUSH_INVALIDATE_FLAG) == 0) && - ((cache_ptr->index_len != 1) + ( ( cache_ptr->index_len != 1 ) || - (cache_ptr->index_size != entry_sizes[entry_type]) - ) - ) + ( cache_ptr->index_size != entry_sizes[entry_type] ) + ) + ) || - (((flush_flags & H5C__FLUSH_INVALIDATE_FLAG) != 0) + ( ( (flush_flags & H5C__FLUSH_INVALIDATE_FLAG) != 0) && - ((cache_ptr->index_len != 0) + ( ( cache_ptr->index_len != 0 ) || - (cache_ptr->index_size != 0) - ) - ) - ) { + ( cache_ptr->index_size != 0 ) + ) + ) + ) { pass = FALSE; HDsnprintf(msg, (size_t)128, @@ -12628,18 +12682,18 @@ check_flush_cache__single_entry_test(H5F_t * file_ptr, /* clean up the cache to prep for the next test */ if(pass) { - result = H5C_flush_cache(file_ptr, H5C__FLUSH_INVALIDATE_FLAG); + H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_INVALIDATE_FLAG, \ + "dummy failure mssg.") - if(result < 0) { + if ( ! pass ) { /* construct and set actual failure message */ - pass = FALSE; HDsnprintf(msg, (size_t)128, "Flush failed on cleanup in single entry test #%d.", test_num); failure_mssg = msg; } - else if((cache_ptr->index_len != 0) || - (cache_ptr->index_size != 0)) { + else if ( ( cache_ptr->index_len != 0 ) || + ( cache_ptr->index_size != 0 ) ) { pass = FALSE; HDsnprintf(msg, (size_t)128, @@ -12663,22 +12717,27 @@ check_flush_cache__single_entry_test(H5F_t * file_ptr, /*------------------------------------------------------------------------- * Function: check_flush_cache__pinned_single_entry_test() * - * Purpose: Run a pinned single entry flush cache test. + * Purpose: Run a pinned single entry flush cache test. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 3/28/06 * * Modifications: * - * JRM -- 5/17/06 - * Added the pop_mark_dirty_prot and pop_mark_dirty_pinned - * flags and supporting code to allow us to test the - * H5C_mark_entry_dirty() call. Use the - * call to mark the entry dirty while the entry is protected - * if pop_mark_dirty_prot is TRUE, and to mark the entry - * dirty while it is pinned if pop_mark_dirty_pinned is TRUE. + * JRM -- 5/17/06 + * Added the pop_mark_dirty_prot and pop_mark_dirty_pinned + * flags and supporting code to allow us to test the + * H5C_mark_entry_dirty() call. Use the + * call to mark the entry dirty while the entry is protected + * if pop_mark_dirty_prot is TRUE, and to mark the entry + * dirty while it is pinned if pop_mark_dirty_pinned is TRUE. + * + * JRM -- 5/14/20 + * Added code to setup and take down the skip list before + * and after calls to H5C_flush_cache(). Do this via the + * H5C_FLUSH_CACHE macro. * *------------------------------------------------------------------------- */ @@ -12689,10 +12748,10 @@ check_flush_cache__pinned_single_entry_test(H5F_t * file_ptr, int entry_type, int entry_idx, hbool_t unprot_dirty_flag, - hbool_t mark_dirty, - hbool_t pop_mark_dirty_prot, - hbool_t pop_mark_dirty_pinned, - hbool_t unprotect_unpin, + hbool_t mark_dirty, + hbool_t pop_mark_dirty_prot, + hbool_t pop_mark_dirty_pinned, + hbool_t unprotect_unpin, unsigned int flags, unsigned int flush_flags, hbool_t expected_serialized, @@ -12701,7 +12760,6 @@ check_flush_cache__pinned_single_entry_test(H5F_t * file_ptr, H5C_t * cache_ptr = file_ptr->shared->cache; static char msg[128]; hbool_t expected_deserialized = TRUE; - herr_t result; test_entry_t * base_addr; test_entry_t * entry_ptr = NULL; @@ -12713,8 +12771,8 @@ check_flush_cache__pinned_single_entry_test(H5F_t * file_ptr, test_num); failure_mssg = msg; } - else if((cache_ptr->index_len != 0) || - (cache_ptr->index_size != 0)) { + else if ( ( cache_ptr->index_len != 0 ) || + ( cache_ptr->index_size != 0 ) ) { pass = FALSE; HDsnprintf(msg, (size_t)128, @@ -12722,7 +12780,7 @@ check_flush_cache__pinned_single_entry_test(H5F_t * file_ptr, test_num); failure_mssg = msg; } - else if((entry_type < 0) || (entry_type >= NUMBER_OF_ENTRY_TYPES) || + else if ( (entry_type < 0) || (entry_type >= NUMBER_OF_ENTRY_TYPES) || (entry_idx < 0) || (entry_idx > max_indices[entry_type])) { pass = FALSE; @@ -12739,41 +12797,41 @@ check_flush_cache__pinned_single_entry_test(H5F_t * file_ptr, protect_entry(file_ptr, entry_type, entry_idx); - if(pop_mark_dirty_prot) { + if(pop_mark_dirty_prot) { - mark_entry_dirty(entry_type, entry_idx); - } + mark_entry_dirty(entry_type, entry_idx); + } unprotect_entry(file_ptr, entry_type, entry_idx, (unprot_dirty_flag ? H5C__DIRTIED_FLAG : H5C__NO_FLAGS_SET) | (flags | H5C__PIN_ENTRY_FLAG)); - if(mark_dirty) { + if(mark_dirty) { mark_entry_dirty(entry_type, entry_idx); - } + } - if(pop_mark_dirty_pinned) { + if(pop_mark_dirty_pinned) { - mark_entry_dirty(entry_type, entry_idx); - } + mark_entry_dirty(entry_type, entry_idx); + } } if(pass) { - result = H5C_flush_cache(file_ptr, flush_flags); + H5C_FLUSH_CACHE(file_ptr, flush_flags, "dummy failure message\n") - if(result < 0) { + if ( ! pass ) { /* construct and set the correct failure message */ - pass = FALSE; HDsnprintf(msg, (size_t)128, "flush with flags 0x%x failed in pinned single entry test #%d.", - flush_flags, test_num); + flush_flags, test_num); failure_mssg = msg; } - else if((entry_ptr->deserialized != expected_deserialized) || - (entry_ptr->serialized != expected_serialized) || - (entry_ptr->destroyed != expected_destroyed)) { + else if ( ( entry_ptr->deserialized != expected_deserialized ) || + ( entry_ptr->serialized != expected_serialized ) || + ( entry_ptr->destroyed != expected_destroyed ) ) { + #if 0 /* this is useful debugging code -- keep it around */ HDfprintf(stdout, "desrlzd = %d(%d), srlzd = %d(%d), dest = %d(%d)\n", @@ -12790,22 +12848,22 @@ check_flush_cache__pinned_single_entry_test(H5F_t * file_ptr, test_num); failure_mssg = msg; } - else if((((flush_flags & H5C__FLUSH_INVALIDATE_FLAG) == 0) + else if ( ( ( ( flush_flags & H5C__FLUSH_INVALIDATE_FLAG) == 0 ) && - ((cache_ptr->index_len != 1) + ( ( cache_ptr->index_len != 1 ) || - (cache_ptr->index_size != entry_sizes[entry_type]) - ) - ) + ( cache_ptr->index_size != entry_sizes[entry_type] ) + ) + ) || - (((flush_flags & H5C__FLUSH_INVALIDATE_FLAG) != 0) + ( ( ( flush_flags & H5C__FLUSH_INVALIDATE_FLAG) != 0 ) && - ((cache_ptr->index_len != 0) + ( ( cache_ptr->index_len != 0 ) || - (cache_ptr->index_size != 0) - ) - ) - ) { + ( cache_ptr->index_size != 0 ) + ) + ) + ) { pass = FALSE; HDsnprintf(msg, (size_t)128, @@ -12836,18 +12894,17 @@ check_flush_cache__pinned_single_entry_test(H5F_t * file_ptr, if(pass) { - result = H5C_flush_cache(file_ptr, H5C__FLUSH_INVALIDATE_FLAG); + H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_INVALIDATE_FLAG, "dummy mssg\n") - if(result < 0) { + if ( ! pass ) { - pass = FALSE; HDsnprintf(msg, (size_t)128, "Flush failed on cleanup in pinned single entry test #%d.", test_num); failure_mssg = msg; } - else if((cache_ptr->index_len != 0) || - (cache_ptr->index_size != 0)) { + else if ( ( cache_ptr->index_len != 0 ) || + ( cache_ptr->index_size != 0 ) ) { pass = FALSE; HDsnprintf(msg, (size_t)128, @@ -14233,14 +14290,20 @@ check_pin_protected_entry(unsigned paged) /*------------------------------------------------------------------------- * Function: check_resize_entry() * - * Purpose: Verify that H5C_resize_entry() and H5C_unprotect() resize - * entries as expected. - * - * Return: void + * Purpose: Verify that H5C_resize_entry() and H5C_unprotect() resize + * entries as expected. + * + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 7/7/06 * + * Modifications: + * + * Updated function to allow for disabling of the slist. + * + * JRM -- 5/18/20 + * *------------------------------------------------------------------------- */ @@ -14421,16 +14484,16 @@ check_resize_entry(unsigned paged) if(pass) { - if((cache_ptr->index_len != 1) || - (cache_ptr->index_size != (LARGE_ENTRY_SIZE / 2)) || - (cache_ptr->slist_len != 1) || - (cache_ptr->slist_size != (LARGE_ENTRY_SIZE / 2))) { + if ( ( cache_ptr->index_len != 1 ) || + ( cache_ptr->index_size != (LARGE_ENTRY_SIZE / 2) ) || + ( ( cache_ptr->slist_enabled ) && + ( ( cache_ptr->slist_len != 1 ) || + ( cache_ptr->slist_size != (LARGE_ENTRY_SIZE / 2) ) ) ) ) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected cache status 3."); failure_mssg = msg; - - } + } } if(pass) { @@ -14506,16 +14569,16 @@ check_resize_entry(unsigned paged) if(pass) { - if((cache_ptr->index_len != 1) || - (cache_ptr->index_size != LARGE_ENTRY_SIZE) || - (cache_ptr->slist_len != 1) || - (cache_ptr->slist_size != LARGE_ENTRY_SIZE)) { + if ( ( cache_ptr->index_len != 1 ) || + ( cache_ptr->index_size != LARGE_ENTRY_SIZE ) || + ( ( cache_ptr->slist_enabled ) && + ( ( cache_ptr->slist_len != 1 ) || + ( cache_ptr->slist_size != LARGE_ENTRY_SIZE ) ) ) ) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected cache status 4."); failure_mssg = msg; - - } + } } if(pass) { @@ -14574,16 +14637,17 @@ check_resize_entry(unsigned paged) if(pass) { - if((cache_ptr->index_len != 1) || - (cache_ptr->index_size != (LARGE_ENTRY_SIZE / 4)) || - (cache_ptr->slist_len != 1) || - (cache_ptr->slist_size != (LARGE_ENTRY_SIZE / 4))) { + if ( ( cache_ptr->index_len != 1 ) || + ( cache_ptr->index_size != (LARGE_ENTRY_SIZE / 4) ) || + ( ( cache_ptr->slist_enabled ) && + ( ( cache_ptr->slist_len != 1 ) || + ( cache_ptr->slist_size != (LARGE_ENTRY_SIZE / 4) ) ) ) ) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected cache status 5."); failure_mssg = msg; - } + } } if(pass) { @@ -14634,16 +14698,17 @@ check_resize_entry(unsigned paged) if(pass) { - if((cache_ptr->index_len != 1) || - (cache_ptr->index_size != LARGE_ENTRY_SIZE) || - (cache_ptr->slist_len != 1) || - (cache_ptr->slist_size != LARGE_ENTRY_SIZE)) { + if ( ( cache_ptr->index_len != 1 ) || + ( cache_ptr->index_size != LARGE_ENTRY_SIZE ) || + ( ( cache_ptr->slist_enabled ) && + ( ( cache_ptr->slist_len != 1 ) || + ( cache_ptr->slist_size != LARGE_ENTRY_SIZE) ) ) ) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected cache status 6."); failure_mssg = msg; - } + } } if(pass) { @@ -14719,16 +14784,16 @@ check_resize_entry(unsigned paged) if(pass) { - if((cache_ptr->index_len != 0) || - (cache_ptr->index_size != 0) || - (cache_ptr->slist_len != 0) || - (cache_ptr->slist_size != 0)) { + if ( ( cache_ptr->index_len != 0 ) || + ( cache_ptr->index_size != 0 ) || + ( ( cache_ptr->slist_enabled ) && + ( ( cache_ptr->slist_len != 0 ) || + ( cache_ptr->slist_size != 0) ) ) ) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected cache status 7."); failure_mssg = msg; - - } + } } @@ -14736,19 +14801,20 @@ check_resize_entry(unsigned paged) if(pass) { - if((cache_ptr->index_len != 0) || - (cache_ptr->index_size != 0) || - (cache_ptr->slist_len != 0) || - (cache_ptr->slist_size != 0)) { + if ( ( cache_ptr->index_len != 0 ) || + ( cache_ptr->index_size != 0 ) || + ( ( cache_ptr->slist_enabled ) && + ( ( cache_ptr->slist_len != 0 ) || + ( cache_ptr->slist_size != 0) ) ) ) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected cache status 8."); failure_mssg = msg; + } - } base_addr = entries[LARGE_ENTRY_TYPE]; entry_ptr = &(base_addr[3]); - entry_size = LARGE_ENTRY_SIZE; + entry_size = LARGE_ENTRY_SIZE; } if(pass) { @@ -14766,17 +14832,17 @@ check_resize_entry(unsigned paged) if(pass) { - if((cache_ptr->index_len != 3) || - (cache_ptr->index_size != 3 * LARGE_ENTRY_SIZE) || - (cache_ptr->slist_len != 1) || - (cache_ptr->slist_size != LARGE_ENTRY_SIZE)) { - + if ( ( cache_ptr->index_len != 3 ) || + ( cache_ptr->index_size != 3 * LARGE_ENTRY_SIZE ) || + ( ( cache_ptr->slist_enabled ) && + ( ( cache_ptr->slist_len != 1 ) || + ( cache_ptr->slist_size != LARGE_ENTRY_SIZE) ) ) ) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected cache status 9."); failure_mssg = msg; - } + } } if(pass) { @@ -14787,10 +14853,11 @@ check_resize_entry(unsigned paged) if(pass) { - if((cache_ptr->index_len != 4) || - (cache_ptr->index_size != 4 * LARGE_ENTRY_SIZE) || - (cache_ptr->slist_len != 1) || - (cache_ptr->slist_size != LARGE_ENTRY_SIZE)) { + if ( ( cache_ptr->index_len != 4 ) || + ( cache_ptr->index_size != 4 * LARGE_ENTRY_SIZE ) || + ( ( cache_ptr->slist_enabled ) && + ( ( cache_ptr->slist_len != 1) || + ( cache_ptr->slist_size != LARGE_ENTRY_SIZE) ) ) ) { pass = FALSE; @@ -14866,18 +14933,18 @@ check_resize_entry(unsigned paged) if(pass) { - if((cache_ptr->index_len != 4) || - (cache_ptr->index_size != - ((3 * LARGE_ENTRY_SIZE) + (LARGE_ENTRY_SIZE / 2))) || - (cache_ptr->slist_len != 2) || - (cache_ptr->slist_size != - (LARGE_ENTRY_SIZE + (LARGE_ENTRY_SIZE / 2)))) { + if ( ( cache_ptr->index_len != 4 ) || + ( cache_ptr->index_size != + ((3 * LARGE_ENTRY_SIZE) + (LARGE_ENTRY_SIZE / 2)) ) || + ( ( cache_ptr->slist_enabled ) && + ( ( cache_ptr->slist_len != 2 ) || + ( cache_ptr->slist_size != + (LARGE_ENTRY_SIZE + (LARGE_ENTRY_SIZE / 2)) ) ) ) ) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected cache status 11."); failure_mssg = msg; - - } + } } if(pass) { @@ -14953,16 +15020,16 @@ check_resize_entry(unsigned paged) if(pass) { - if((cache_ptr->index_len != 4) || - (cache_ptr->index_size != 4 * LARGE_ENTRY_SIZE) || - (cache_ptr->slist_len != 2) || - (cache_ptr->slist_size != 2 * LARGE_ENTRY_SIZE)) { + if ( ( cache_ptr->index_len != 4 ) || + ( cache_ptr->index_size != 4 * LARGE_ENTRY_SIZE ) || + ( ( cache_ptr->slist_enabled ) && + ( ( cache_ptr->slist_len != 2 ) || + ( cache_ptr->slist_size != 2 * LARGE_ENTRY_SIZE ) ) ) ) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected cache status 12."); failure_mssg = msg; - - } + } } if(pass) { @@ -15021,18 +15088,18 @@ check_resize_entry(unsigned paged) if(pass) { - if((cache_ptr->index_len != 4) || - (cache_ptr->index_size != - ((3 * LARGE_ENTRY_SIZE) + (LARGE_ENTRY_SIZE / 4))) || - (cache_ptr->slist_len != 2) || - (cache_ptr->slist_size != - (LARGE_ENTRY_SIZE + (LARGE_ENTRY_SIZE / 4)))) { + if ( ( cache_ptr->index_len != 4 ) || + ( cache_ptr->index_size != + ((3 * LARGE_ENTRY_SIZE) + (LARGE_ENTRY_SIZE / 4)) ) || + ( ( cache_ptr->slist_enabled ) && + ( ( cache_ptr->slist_len != 2 ) || + ( cache_ptr->slist_size != + (LARGE_ENTRY_SIZE + (LARGE_ENTRY_SIZE / 4)) ) ) ) ) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected cache status 13."); failure_mssg = msg; - - } + } } if(pass) { @@ -15083,16 +15150,16 @@ check_resize_entry(unsigned paged) if(pass) { - if((cache_ptr->index_len != 4) || - (cache_ptr->index_size != (4 * LARGE_ENTRY_SIZE)) || - (cache_ptr->slist_len != 2) || - (cache_ptr->slist_size != (2 * LARGE_ENTRY_SIZE))) { + if ( ( cache_ptr->index_len != 4 ) || + ( cache_ptr->index_size != (4 * LARGE_ENTRY_SIZE) ) || + ( ( cache_ptr->slist_enabled ) && + ( ( cache_ptr->slist_len != 2 ) || + ( cache_ptr->slist_size != (2 * LARGE_ENTRY_SIZE)) ) ) ) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected cache status 14."); failure_mssg = msg; - - } + } } if(pass) { @@ -15168,16 +15235,16 @@ check_resize_entry(unsigned paged) if(pass) { - if((cache_ptr->index_len != 3) || - (cache_ptr->index_size != (3 * LARGE_ENTRY_SIZE)) || - (cache_ptr->slist_len != 1) || - (cache_ptr->slist_size != LARGE_ENTRY_SIZE)) { + if ( ( cache_ptr->index_len != 3 ) || + ( cache_ptr->index_size != (3 * LARGE_ENTRY_SIZE) ) || + ( ( cache_ptr->slist_enabled ) && + ( ( cache_ptr->slist_len != 1 ) || + ( cache_ptr->slist_size != LARGE_ENTRY_SIZE) ) ) ) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected cache status 15."); failure_mssg = msg; - - } + } } if(pass) { @@ -15195,16 +15262,16 @@ check_resize_entry(unsigned paged) if(pass) { - if((cache_ptr->index_len != 0) || - (cache_ptr->index_size != 0) || - (cache_ptr->slist_len != 0) || - (cache_ptr->slist_size != 0)) { + if ( ( cache_ptr->index_len != 0 ) || + ( cache_ptr->index_size != 0 ) || + ( ( cache_ptr->slist_enabled ) && + ( ( cache_ptr->slist_len != 0 ) || + ( cache_ptr->slist_size != 0 ) ) ) ) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected cache status 16."); failure_mssg = msg; - - } + } } if(pass) { @@ -15228,16 +15295,19 @@ check_resize_entry(unsigned paged) /*------------------------------------------------------------------------- * Function: check_evictions_enabled() * - * Purpose: Verify that H5C_get_evictions_enabled() and - * H5C_set_evictions_enabled() functions perform as expected. + * Purpose: Verify that H5C_get_evictions_enabled() and + * H5C_set_evictions_enabled() functions perform as expected. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 8/2/07 * * Modifications: * + * Updated function to allow for disabling of the slist. + * + * JRM -- 5/18/20 * *------------------------------------------------------------------------- */ @@ -15331,17 +15401,17 @@ check_evictions_enabled(unsigned paged) /* verify that it is empty */ if(pass) { - if((cache_ptr->index_len != 0) || - (cache_ptr->index_size != 0) || - (cache_ptr->slist_len != 0) || - (cache_ptr->slist_size != 0) || - (cache_ptr->evictions_enabled != TRUE)) { + if ( ( cache_ptr->index_len != 0 ) || + ( cache_ptr->index_size != 0 ) || + ( ( cache_ptr->slist_enabled ) && + ( ( cache_ptr->slist_len != 0 ) || + ( cache_ptr->slist_size != 0 ) ) ) || + ( cache_ptr->evictions_enabled != TRUE ) ) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected cache status 1."); failure_mssg = msg; - - } + } } if(show_progress) /* 3 */ @@ -15383,18 +15453,17 @@ check_evictions_enabled(unsigned paged) /* verify that the cache is full */ if(pass) { - if((cache_ptr->index_len != 16) || - (cache_ptr->index_size != 16 * MONSTER_ENTRY_SIZE) || - (cache_ptr->slist_len != 0) || - (cache_ptr->slist_size != 0) || - (cache_ptr->evictions_enabled != TRUE)) { - + if ( ( cache_ptr->index_len != 16 ) || + ( cache_ptr->index_size != 16 * MONSTER_ENTRY_SIZE ) || + ( ( cache_ptr->slist_enabled ) && + ( ( cache_ptr->slist_len != 0 ) || + ( cache_ptr->slist_size != 0 ) ) ) || + ( cache_ptr->evictions_enabled != TRUE ) ) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected cache status 2."); failure_mssg = msg; - - } + } } if(show_progress) /* 6 */ @@ -15416,17 +15485,17 @@ check_evictions_enabled(unsigned paged) /* verify that an entry has been evicted */ if(pass) { - if((cache_ptr->index_len != 16) || - (cache_ptr->index_size != 16 * MONSTER_ENTRY_SIZE) || - (cache_ptr->slist_len != 0) || - (cache_ptr->slist_size != 0) || - (cache_ptr->evictions_enabled != TRUE)) { + if ( ( cache_ptr->index_len != 16 ) || + ( cache_ptr->index_size != 16 * MONSTER_ENTRY_SIZE ) || + ( ( cache_ptr->slist_enabled ) && + ( ( cache_ptr->slist_len != 0 ) || + ( cache_ptr->slist_size != 0 ) ) ) || + ( cache_ptr->evictions_enabled != TRUE ) ) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected cache status 3."); failure_mssg = msg; - - } + } } if(show_progress) /* 8 */ @@ -15483,17 +15552,17 @@ check_evictions_enabled(unsigned paged) /* verify that another entry has been evicted */ if(pass) { - if((cache_ptr->index_len != 16) || - (cache_ptr->index_size != 16 * MONSTER_ENTRY_SIZE) || - (cache_ptr->slist_len != 1) || - (cache_ptr->slist_size != MONSTER_ENTRY_SIZE) || - (cache_ptr->evictions_enabled != TRUE)) { + if ( ( cache_ptr->index_len != 16 ) || + ( cache_ptr->index_size != 16 * MONSTER_ENTRY_SIZE ) || + ( ( cache_ptr->slist_enabled ) && + ( ( cache_ptr->slist_len != 1 ) || + ( cache_ptr->slist_size != MONSTER_ENTRY_SIZE ) ) ) || + ( cache_ptr->evictions_enabled != TRUE ) ) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected cache status 4."); failure_mssg = msg; - - } + } } if(show_progress) /* 11 */ @@ -15555,17 +15624,17 @@ check_evictions_enabled(unsigned paged) /* verify that evictions are disabled */ if(pass) { - if((cache_ptr->index_len != 16) || - (cache_ptr->index_size != 16 * MONSTER_ENTRY_SIZE) || - (cache_ptr->slist_len != 1) || - (cache_ptr->slist_size != MONSTER_ENTRY_SIZE) || - (cache_ptr->evictions_enabled != FALSE)) { + if ( ( cache_ptr->index_len != 16 ) || + ( cache_ptr->index_size != 16 * MONSTER_ENTRY_SIZE ) || + ( ( cache_ptr->slist_enabled ) && + ( ( cache_ptr->slist_len != 1 ) || + ( cache_ptr->slist_size != MONSTER_ENTRY_SIZE ) ) ) || + ( cache_ptr->evictions_enabled != FALSE ) ) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected cache status 5."); failure_mssg = msg; - - } + } } if(show_progress) /* 14 */ @@ -15587,17 +15656,17 @@ check_evictions_enabled(unsigned paged) /* verify that no entry has been evicted */ if(pass) { - if((cache_ptr->index_len != 17) || - (cache_ptr->index_size != 17 * MONSTER_ENTRY_SIZE) || - (cache_ptr->slist_len != 1) || - (cache_ptr->slist_size != MONSTER_ENTRY_SIZE) || - (cache_ptr->evictions_enabled != FALSE)) { + if ( ( cache_ptr->index_len != 17 ) || + ( cache_ptr->index_size != 17 * MONSTER_ENTRY_SIZE ) || + ( ( cache_ptr->slist_enabled ) && + ( ( cache_ptr->slist_len != 1 ) || + ( cache_ptr->slist_size != MONSTER_ENTRY_SIZE ) ) ) || + ( cache_ptr->evictions_enabled != FALSE ) ) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected cache status 6."); failure_mssg = msg; - - } + } } if(show_progress) /* 16 */ @@ -15618,17 +15687,17 @@ check_evictions_enabled(unsigned paged) /* verify that no entry has been evicted */ if(pass) { - if((cache_ptr->index_len != 18) || - (cache_ptr->index_size != 18 * MONSTER_ENTRY_SIZE) || - (cache_ptr->slist_len != 2) || - (cache_ptr->slist_size != 2 * MONSTER_ENTRY_SIZE) || - (cache_ptr->evictions_enabled != FALSE)) { + if ( ( cache_ptr->index_len != 18 ) || + ( cache_ptr->index_size != 18 * MONSTER_ENTRY_SIZE ) || + ( ( cache_ptr->slist_enabled ) && + ( ( cache_ptr->slist_len != 2 ) || + ( cache_ptr->slist_size != 2 * MONSTER_ENTRY_SIZE ) ) ) || + ( cache_ptr->evictions_enabled != FALSE ) ) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected cache status 7."); failure_mssg = msg; - - } + } } if(show_progress) /* 18 */ @@ -15667,17 +15736,17 @@ check_evictions_enabled(unsigned paged) /* verify that no entries have been evicted */ if(pass) { - if((cache_ptr->index_len != 18) || - (cache_ptr->index_size != 18 * MONSTER_ENTRY_SIZE) || - (cache_ptr->slist_len != 2) || - (cache_ptr->slist_size != 2 * MONSTER_ENTRY_SIZE) || - (cache_ptr->evictions_enabled != TRUE)) { + if ( ( cache_ptr->index_len != 18 ) || + ( cache_ptr->index_size != 18 * MONSTER_ENTRY_SIZE ) || + ( ( cache_ptr->slist_enabled ) && + ( ( cache_ptr->slist_len != 2 ) || + ( cache_ptr->slist_size != 2 * MONSTER_ENTRY_SIZE ) ) ) || + ( cache_ptr->evictions_enabled != TRUE ) ) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected cache status 8."); failure_mssg = msg; - - } + } } if(show_progress) /* 21 */ @@ -15702,17 +15771,17 @@ check_evictions_enabled(unsigned paged) if(pass) { - if((cache_ptr->index_len != 16) || - (cache_ptr->index_size != 16 * MONSTER_ENTRY_SIZE) || - (cache_ptr->slist_len != 2) || - (cache_ptr->slist_size != 2 * MONSTER_ENTRY_SIZE) || - (cache_ptr->evictions_enabled != TRUE)) { + if ( ( cache_ptr->index_len != 16 ) || + ( cache_ptr->index_size != 16 * MONSTER_ENTRY_SIZE ) || + ( ( cache_ptr->slist_enabled ) && + ( ( cache_ptr->slist_len != 2 ) || + ( cache_ptr->slist_size != 2 * MONSTER_ENTRY_SIZE ) ) ) || + ( cache_ptr->evictions_enabled != TRUE ) ) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected cache status 9."); failure_mssg = msg; - - } + } } if(show_progress) /* 23 */ @@ -15823,17 +15892,17 @@ check_evictions_enabled(unsigned paged) /* verify that the cache has grown */ if(pass) { - if((cache_ptr->index_len != 17) || - (cache_ptr->index_size != 17 * MONSTER_ENTRY_SIZE) || - (cache_ptr->slist_len != 2) || - (cache_ptr->slist_size != 2 * MONSTER_ENTRY_SIZE) || - (cache_ptr->evictions_enabled != FALSE)) { + if ( ( cache_ptr->index_len != 17 ) || + ( cache_ptr->index_size != 17 * MONSTER_ENTRY_SIZE ) || + ( ( cache_ptr->slist_enabled ) && + ( ( cache_ptr->slist_len != 2 ) || + ( cache_ptr->slist_size != 2 * MONSTER_ENTRY_SIZE ) ) ) || + ( cache_ptr->evictions_enabled != FALSE ) ) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected cache status 10."); failure_mssg = msg; - - } + } } if(show_progress) /* 28 */ @@ -15871,17 +15940,17 @@ check_evictions_enabled(unsigned paged) /* verify that the cache has returned to its maximum size */ if(pass) { - if((cache_ptr->index_len != 16) || - (cache_ptr->index_size != 16 * MONSTER_ENTRY_SIZE) || - (cache_ptr->slist_len != 3) || - (cache_ptr->slist_size != 3 * MONSTER_ENTRY_SIZE) || - (cache_ptr->evictions_enabled != TRUE)) { + if ( ( cache_ptr->index_len != 16 ) || + ( cache_ptr->index_size != 16 * MONSTER_ENTRY_SIZE ) || + ( ( cache_ptr->slist_enabled ) && + ( ( cache_ptr->slist_len != 3 ) || + ( cache_ptr->slist_size != 3 * MONSTER_ENTRY_SIZE ) ) ) || + ( cache_ptr->evictions_enabled != TRUE ) ) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected cache status 11."); failure_mssg = msg; - - } + } } if(show_progress) /* 31 */ @@ -15964,17 +16033,22 @@ check_evictions_enabled(unsigned paged) /*------------------------------------------------------------------------- * Function: check_flush_protected_err() + * + * Purpose: Verify that an attempt to flush the cache when it contains + * a protected entry will generate an error. * - * Purpose: Verify that an attempt to flush the cache when it contains - * a protected entry will generate an error. - * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 6/24/04 * * Modifications: * + * Added code to setup and take down the skip list before + * and after calls to H5C_flush_cache(). + * + * JRM -- 5/14/20 + * *------------------------------------------------------------------------- */ @@ -15982,6 +16056,7 @@ static unsigned check_flush_protected_err(unsigned paged) { H5F_t * file_ptr = NULL; + H5C_t * cache_ptr = NULL; if(paged) TESTING("flush cache with protected entry error (paged aggregation)") @@ -16001,27 +16076,45 @@ check_flush_protected_err(unsigned paged) file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged); + if ( pass ) { + + cache_ptr = file_ptr->shared->cache; + } + protect_entry(file_ptr, 0, 0); - if(H5C_flush_cache(file_ptr, H5C__NO_FLAGS_SET) >= 0) { + /* enable slist prior to flush */ + if ( ( pass ) && + ( H5C_set_slist_enabled(cache_ptr, TRUE, FALSE) < 0 ) ) { pass = FALSE; - failure_mssg = "flush succeeded on cache with protected entry.\n"; + failure_mssg = "unable to enable slist prior to flush.\n"; + } - } else { + if ( ( pass ) && + ( H5C_flush_cache(file_ptr, H5C__NO_FLAGS_SET) >= 0 ) ) { - unprotect_entry(file_ptr, 0, 0, H5C__DIRTIED_FLAG); + pass = FALSE; + failure_mssg = "flush succeeded on cache with protected entry.\n"; + } - if(H5C_flush_cache(file_ptr, H5C__NO_FLAGS_SET) < 0) { + /* disable the slist after the flush */ + if ( ( pass ) && + ( H5C_set_slist_enabled(cache_ptr, FALSE, FALSE) < 0 ) ) { - pass = FALSE; - failure_mssg = "flush failed after unprotect.\n"; + pass = FALSE; + failure_mssg = "unable to disable slist after flush.\n"; + } - } else { + unprotect_entry(file_ptr, 0, 0, H5C__DIRTIED_FLAG); - takedown_cache(file_ptr, FALSE, FALSE); - } + if ( pass ) { + + H5C_FLUSH_CACHE(file_ptr, H5C__NO_FLAGS_SET, \ + "flush failed after unprotect.\n") } + + takedown_cache(file_ptr, FALSE, FALSE); } if(pass) { PASSED(); } else { H5_FAILED(); } @@ -17075,12 +17168,12 @@ check_move_entry_errs(unsigned paged) /*------------------------------------------------------------------------- * Function: check_resize_entry_errs() * - * Purpose: Verify that invalid calls to H5C_resize_entry() - * generates errors as expected. + * Purpose: Verify that invalid calls to H5C_resize_entry() + * generates errors as expected. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 7/7/06 * *------------------------------------------------------------------------- @@ -17135,9 +17228,9 @@ check_resize_entry_errs(unsigned paged) } else { - unprotect_entry(file_ptr, 0, 0, H5C__PIN_ENTRY_FLAG); + unprotect_entry(file_ptr, 0, 0, H5C__PIN_ENTRY_FLAG); - } + } } if(pass) { @@ -17152,9 +17245,9 @@ check_resize_entry_errs(unsigned paged) } else { - unpin_entry(0, 0); + unpin_entry(0, 0); - } + } } if(pass) { @@ -28146,7 +28239,6 @@ check_auto_cache_resize_aux_fcns(unsigned paged) * Return: void * * Programmer: Mike McGreevy - * * 12/16/08 * * Modifications: @@ -30952,13 +31044,21 @@ done: /*------------------------------------------------------------------------- * Function: check_flush_deps_order() * - * Purpose: Verify that the order that entries with flush dependencies + * Purpose: Verify that the order that entries with flush dependencies * is correct * - * Return: 0 on success, non-zero on failure + * Return: 0 on success, non-zero on failure + * + * Programmer: Quincey Koziol + * 3/17/09 * - * Programmer: Quincey Koziol - * 3/17/09 + * Modifications: + * + * Added code to setup and take down the skip list before + * and after calls to H5C_flush_cache(). Do this via the + * H5C_FLUSH_CACHE macro. + * + * JRM -- 5/14/20 * *------------------------------------------------------------------------- */ @@ -31049,8 +31149,6 @@ check_flush_deps_order(unsigned paged) /* Flush the cache and verify that the entries were flushed in correct order */ { - herr_t result; /* Generic return value */ - add_flush_op(entry_type, 0, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order); add_flush_op(entry_type, 1, FLUSH_OP__ORDER, @@ -31065,8 +31163,8 @@ check_flush_deps_order(unsigned paged) /* Reset index for tracking flush order */ flush_order = 0; - result = H5C_flush_cache(file_ptr, H5C__NO_FLAGS_SET); - if(result < 0) CACHE_ERROR("flushing entries with flush dependendices") + H5C_FLUSH_CACHE(file_ptr, H5C__NO_FLAGS_SET, "dummy mssg") + if(!pass) CACHE_ERROR("flushing entries with flush dependendices") /* Change expected values, and verify the status of the entries * after destroy flush dependency @@ -31144,8 +31242,6 @@ check_flush_deps_order(unsigned paged) /* Flush the cache and verify that the entries were flushed in correct order */ { - herr_t result; /* Generic return value */ - add_flush_op(entry_type, 0, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order); add_flush_op(entry_type, 1, FLUSH_OP__ORDER, @@ -31171,8 +31267,8 @@ check_flush_deps_order(unsigned paged) /* Reset index for tracking flush order */ flush_order = 0; - result = H5C_flush_cache(file_ptr, H5C__NO_FLAGS_SET); - if(result < 0) CACHE_ERROR("flushing entries with flush dependendices") + H5C_FLUSH_CACHE(file_ptr, H5C__NO_FLAGS_SET, "dummy mssg") + if(!pass) CACHE_ERROR("flushing entries with flush dependendices") /* Change expected values, and verify the status of the entries * after destroy flush dependency @@ -31251,8 +31347,6 @@ check_flush_deps_order(unsigned paged) /* Flush the cache and verify that the entries were flushed in correct order */ { - herr_t result; /* Generic return value */ - add_flush_op(entry_type, 0, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order); add_flush_op(entry_type, 1, FLUSH_OP__ORDER, @@ -31283,8 +31377,8 @@ check_flush_deps_order(unsigned paged) /* Reset index for tracking flush order */ flush_order = 0; - result = H5C_flush_cache(file_ptr, H5C__NO_FLAGS_SET); - if(result < 0) CACHE_ERROR("flushing entries with flush dependendices") + H5C_FLUSH_CACHE(file_ptr, H5C__NO_FLAGS_SET, "dummy mssg") + if(!pass) CACHE_ERROR("flushing entries with flush dependendices") /* Change expected values, and verify the status of the entries * after destroy flush dependency @@ -31370,8 +31464,6 @@ check_flush_deps_order(unsigned paged) /* Flush the cache and verify that the entries were flushed in correct order */ { - herr_t result; /* Generic return value */ - add_flush_op(entry_type, 0, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order); add_flush_op(entry_type, 1, FLUSH_OP__ORDER, @@ -31402,8 +31494,8 @@ check_flush_deps_order(unsigned paged) /* Reset index for tracking flush order */ flush_order = 0; - result = H5C_flush_cache(file_ptr, H5C__NO_FLAGS_SET); - if(result < 0) CACHE_ERROR("flushing entries with flush dependendices") + H5C_FLUSH_CACHE(file_ptr, H5C__NO_FLAGS_SET, "dummy mssg") + if(!pass) CACHE_ERROR("flushing entries with flush dependendices") /* Change expected values, and verify the status of the entries * after destroy flush dependency @@ -31529,8 +31621,6 @@ check_flush_deps_order(unsigned paged) /* Flush the cache and verify that the entries were flushed in correct order */ { - herr_t result; /* Generic return value */ - add_flush_op(entry_type, 0, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order); add_flush_op(entry_type, 1, FLUSH_OP__ORDER, @@ -31578,8 +31668,8 @@ check_flush_deps_order(unsigned paged) /* Reset index for tracking flush order */ flush_order = 0; - result = H5C_flush_cache(file_ptr, H5C__NO_FLAGS_SET); - if(result < 0) CACHE_ERROR("flushing entries with flush dependendices") + H5C_FLUSH_CACHE(file_ptr, H5C__NO_FLAGS_SET, "dummy mssg") + if(!pass) CACHE_ERROR("flushing entries with flush dependendices") /* Change expected values, and verify the status of the entries * after destroy flush dependency @@ -31739,8 +31829,6 @@ check_flush_deps_order(unsigned paged) /* Flush the cache and verify that the entries were flushed in correct order */ { - herr_t result; /* Generic return value */ - add_flush_op(entry_type, 0, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order); add_flush_op(entry_type, 1, FLUSH_OP__ORDER, @@ -31788,8 +31876,8 @@ check_flush_deps_order(unsigned paged) /* Reset index for tracking flush order */ flush_order = 0; - result = H5C_flush_cache(file_ptr, H5C__NO_FLAGS_SET); - if(result < 0) CACHE_ERROR("flushing entries with flush dependendices") + H5C_FLUSH_CACHE(file_ptr, H5C__NO_FLAGS_SET, "dummy mssg") + if(!pass) CACHE_ERROR("flushing entries with flush dependendices") /* Change expected values, and verify the status of the entries * after destroy flush dependency @@ -31904,8 +31992,6 @@ check_flush_deps_order(unsigned paged) /* Flush the cache and verify that the entries were flushed in correct order */ { - herr_t result; /* Generic return value */ - add_flush_op(entry_type, 0, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order); add_flush_op(entry_type, 1, FLUSH_OP__ORDER, @@ -31946,8 +32032,8 @@ check_flush_deps_order(unsigned paged) /* Reset index for tracking flush order */ flush_order = 0; - result = H5C_flush_cache(file_ptr, H5C__NO_FLAGS_SET); - if(result < 0) CACHE_ERROR("flushing entries with flush dependendices") + H5C_FLUSH_CACHE(file_ptr, H5C__NO_FLAGS_SET, "dummy mssg") + if(!pass) CACHE_ERROR("flushing entries with flush dependendices") /* Change expected values, and verify the status of the entries * after destroy flush dependency @@ -32038,8 +32124,6 @@ check_flush_deps_order(unsigned paged) /* Flush the cache and verify that the entries were flushed in correct order */ { - herr_t result; /* Generic return value */ - add_flush_op(entry_type, 0, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order); add_flush_op(entry_type, 1, FLUSH_OP__ORDER, @@ -32080,8 +32164,8 @@ check_flush_deps_order(unsigned paged) /* Reset index for tracking flush order */ flush_order = 0; - result = H5C_flush_cache(file_ptr, H5C__NO_FLAGS_SET); - if(result < 0) CACHE_ERROR("flushing entries with flush dependendices") + H5C_FLUSH_CACHE(file_ptr, H5C__NO_FLAGS_SET, "dummy mssg") + if(!pass) CACHE_ERROR("flushing entries with flush dependendices") /* Change expected values, and verify the status of the entries * after destroy flush dependency @@ -32221,8 +32305,6 @@ check_flush_deps_order(unsigned paged) /* Flush the cache and verify that the entries were flushed in correct order */ { - herr_t result; /* Generic return value */ - add_flush_op(entry_type, 0, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order); add_flush_op(entry_type, 1, FLUSH_OP__ORDER, @@ -32273,8 +32355,8 @@ check_flush_deps_order(unsigned paged) /* Reset index for tracking flush order */ flush_order = 0; - result = H5C_flush_cache(file_ptr, H5C__NO_FLAGS_SET); - if(result < 0) CACHE_ERROR("flushing entries with flush dependendices") + H5C_FLUSH_CACHE(file_ptr, H5C__NO_FLAGS_SET, "dummy mssg") + if(!pass) CACHE_ERROR("flushing entries with flush dependendices") /* Change expected values, and verify the status of the entries * after destroy flush dependency @@ -32458,8 +32540,6 @@ check_flush_deps_order(unsigned paged) /* Flush the cache and verify that the entries were flushed in correct order */ { - herr_t result; /* Generic return value */ - add_flush_op(entry_type, 0, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order); add_flush_op(entry_type, 1, FLUSH_OP__ORDER, @@ -32512,8 +32592,8 @@ check_flush_deps_order(unsigned paged) /* Reset index for tracking flush order */ flush_order = 0; - result = H5C_flush_cache(file_ptr, H5C__NO_FLAGS_SET); - if(result < 0) CACHE_ERROR("flushing entries with flush dependendices") + H5C_FLUSH_CACHE(file_ptr, H5C__NO_FLAGS_SET, "dummy mssg") + if(!pass) CACHE_ERROR("flushing entries with flush dependendices") /* Change expected values, and verify the status of the entries * after destroy flush dependency @@ -32715,8 +32795,6 @@ check_flush_deps_order(unsigned paged) /* Flush the cache and verify that the entries were flushed in correct order */ { - herr_t result; /* Generic return value */ - add_flush_op(entry_type, 0, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order); add_flush_op(entry_type, 1, FLUSH_OP__ORDER, @@ -32769,8 +32847,8 @@ check_flush_deps_order(unsigned paged) /* Reset index for tracking flush order */ flush_order = 0; - result = H5C_flush_cache(file_ptr, H5C__NO_FLAGS_SET); - if(result < 0) CACHE_ERROR("flushing entries with flush dependendices") + H5C_FLUSH_CACHE(file_ptr, H5C__NO_FLAGS_SET, "dummy mssg") + if(!pass) CACHE_ERROR("flushing entries with flush dependendices") /* Change expected values, and verify the status of the entries * after destroy flush dependency @@ -33007,8 +33085,6 @@ check_flush_deps_order(unsigned paged) /* Flush the cache and verify that the entries were flushed in correct order */ { - herr_t result; /* Generic return value */ - add_flush_op(entry_type, 0, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order); add_flush_op(entry_type, 1, FLUSH_OP__ORDER, @@ -33056,8 +33132,8 @@ check_flush_deps_order(unsigned paged) /* Reset index for tracking flush order */ flush_order = 0; - result = H5C_flush_cache(file_ptr, H5C__NO_FLAGS_SET); - if(result < 0) CACHE_ERROR("flushing entries with flush dependendices") + H5C_FLUSH_CACHE(file_ptr, H5C__NO_FLAGS_SET, "dummy mssg") + if(!pass) CACHE_ERROR("flushing entries with flush dependendices") /* Change expected values, and verify the status of the entries * after destroy flush dependency @@ -33323,8 +33399,6 @@ check_flush_deps_order(unsigned paged) /* Flush the cache and verify that the entries were flushed in correct order */ { - herr_t result; /* Generic return value */ - add_flush_op(entry_type, 0, FLUSH_OP__ORDER, entry_type, 0, FALSE, (size_t)0, &flush_order); add_flush_op(entry_type, 1, FLUSH_OP__ORDER, @@ -33372,8 +33446,8 @@ check_flush_deps_order(unsigned paged) /* Reset index for tracking flush order */ flush_order = 0; - result = H5C_flush_cache(file_ptr, H5C__NO_FLAGS_SET); - if(result < 0) CACHE_ERROR("flushing entries with flush dependendices") + H5C_FLUSH_CACHE(file_ptr, H5C__NO_FLAGS_SET, "dummy mssg") + if(!pass) CACHE_ERROR("flushing entries with flush dependendices") /* Change expected values, and verify the status of the entries * after destroy flush dependency @@ -34551,30 +34625,35 @@ check_entry_deletions_during_scans(unsigned paged) /*------------------------------------------------------------------------- + * * Function: cedds__expunge_dirty_entry_in_flush_test() * - * Purpose: Verify that H5C_flush_cache() can handle the removal of - * a dirty entry from the cache during its scan of the - * skip list. + * Purpose: Verify that H5C_flush_cache() can handle the removal of + * a dirty entry from the cache during its scan of the + * skip list. * - * Do this by setting up a full cache, with the last entry - * on the LRU being both dirty and having a flush operation - * that deletes the second to last entry on the LRU. Then - * flush the cache, triggering the flush of the last - * item, and thereby the deletion of the second to last item. + * Do this by setting up a full cache, with the last entry + * on the LRU being both dirty and having a flush operation + * that deletes the second to last entry on the LRU. Then + * flush the cache, triggering the flush of the last + * item, and thereby the deletion of the second to last item. * - * H5C_flush_cache() should handle this deletion gracefully. + * H5C_flush_cache() should handle this deletion gracefully. * * Do nothing if pass is FALSE on entry. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 4/4/15 * * Modifications: * - * None. + * Added code to setup and take down the skip list before + * and after calls to H5C_flush_cache(). Do this via the + * H5C_FLUSH_CACHE macro. + * + * JRM -- 5/14/20 * *------------------------------------------------------------------------- */ @@ -34584,7 +34663,6 @@ cedds__expunge_dirty_entry_in_flush_test(H5F_t * file_ptr) { H5C_t * cache_ptr = file_ptr->shared->cache; int i; - herr_t result; struct expected_entry_status expected[36] = { /* the expected array is used to maintain a table of the expected status of every @@ -34681,44 +34759,41 @@ cedds__expunge_dirty_entry_in_flush_test(H5F_t * file_ptr) } - if(pass) { + if ( pass ) { - /* to summarize, at present the following entries - * are in cache with the following characteristics: - * - * in - * entry: cache? size: dirty? pinned? pins: flush operations: - * - * (HET, 0) Y 16 KB Y N - expunge (HET 1) - * - * (HET, 1) Y 16 KB Y N - - + /* to summarize, at present the following entries + * are in cache with the following characteristics: * - * (HET, 2) Y 16 KB Y N - - + * in + * entry: cache? size: dirty? pinned? pins: flush operations: * - * (HET, 3) Y 16 KB Y N - - - * - * Recall that in this test bed, flush operations are excuted the - * first time the associated entry is flushed, and are then - * deleted. - */ + * (HET, 0) Y 16 KB Y N - expunge (HET 1) + * + * (HET, 1) Y 16 KB Y N - - + * + * (HET, 2) Y 16 KB Y N - - + * + * (HET, 3) Y 16 KB Y N - - + * + * Recall that in this test bed, flush operations are excuted the + * first time the associated entry is flushed, and are then + * deleted. + */ - /* verify the expected status of all entries we have loaded to date: */ - verify_entry_status(cache_ptr, 0, 4, expected); + /* verify the expected status of all entries we have loaded to date: */ + verify_entry_status(cache_ptr, 0, 4, expected); } /* flush the cache to run the test. In the process, clean up after test. */ - if(pass) { - - result = H5C_flush_cache(file_ptr, H5C__FLUSH_INVALIDATE_FLAG); + if ( pass ) { - if(result < 0) { + H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_INVALIDATE_FLAG, \ + "Cache flush inval failed in cedds expunge dirty entry in flush test") - pass = FALSE; - failure_mssg = "Cache flush invalidate failed in cedds expunge dirty entry in flush test"; - } - else if((cache_ptr->index_len != 0) || - (cache_ptr->index_size != 0)) { + if ( ( pass ) && + ( ( cache_ptr->index_len != 0 ) || + ( cache_ptr->index_size != 0 ) ) ) { pass = FALSE; failure_mssg = "Unexpected cache len/size after cedds expunge dirty entry in flush test"; @@ -34730,7 +34805,7 @@ cedds__expunge_dirty_entry_in_flush_test(H5F_t * file_ptr) /* If we are collecting stats, check to see if we get the expected * values. */ - if(pass) + if(pass) if((cache_ptr->insertions[HUGE_ENTRY_TYPE] != 0) || (cache_ptr->pinned_insertions[HUGE_ENTRY_TYPE] != 0) || (cache_ptr->clears[HUGE_ENTRY_TYPE] != 1) || @@ -34778,30 +34853,34 @@ cedds__expunge_dirty_entry_in_flush_test(H5F_t * file_ptr) /*------------------------------------------------------------------------- * Function: cedds__H5C_make_space_in_cache() * - * Purpose: Verify that H5C__make_space_in_cache() can handle the - * removal from the cache of the next item in its reverse scan - * of the LRU list. + * Purpose: Verify that H5C__make_space_in_cache() can handle the + * removal from the cache of the next item in its reverse scan + * of the LRU list. * - * Do this by setting up a full cache, with the last entry - * on the LRU being both dirty and having a flush operation - * that deleted the second to last entry on the LRU. Then - * load an additional entry, triggering the flush of the last - * item, and thereby the deletion of the second to last item. + * Do this by setting up a full cache, with the last entry + * on the LRU being both dirty and having a flush operation + * that deleted the second to last entry on the LRU. Then + * load an additional entry, triggering the flush of the last + * item, and thereby the deletion of the second to last item. * - * H5C__make_space_in_cache() should detect this deletion, and - * restart its scan of the LRU from the tail, instead of - * examining the now deleted next item up on the LRU. + * H5C__make_space_in_cache() should detect this deletion, and + * restart its scan of the LRU from the tail, instead of + * examining the now deleted next item up on the LRU. * * Do nothing if pass is FALSE on entry. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 4/4/15 * * Modifications: * - * None. + * Added code to setup and take down the skip list before + * and after calls to H5C_flush_cache(). Do this via the + * H5C_FLUSH_CACHE macro. + * + * JRM -- 5/14/20 * *------------------------------------------------------------------------- */ @@ -34813,7 +34892,6 @@ cedds__H5C_make_space_in_cache(H5F_t * file_ptr) int i; const int num_huge_entries = 4; const int num_monster_entries = 32; - herr_t result; struct expected_entry_status expected[36] = { /* the expected array is used to maintain a table of the expected status of every @@ -35060,17 +35138,14 @@ cedds__H5C_make_space_in_cache(H5F_t * file_ptr) /* flush the cache and end the test. */ - if(pass) { - - result = H5C_flush_cache(file_ptr, H5C__FLUSH_INVALIDATE_FLAG); + if ( pass ) { - if(result < 0) { + H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_INVALIDATE_FLAG, \ + "Cache flush invalidate failed after flush op eviction test") - pass = FALSE; - failure_mssg = "Cache flush invalidate failed after flush op eviction test"; - } - else if((cache_ptr->index_len != 0) || - (cache_ptr->index_size != 0)) { + if ( ( pass ) && + ( ( cache_ptr->index_len != 0 ) || + ( cache_ptr->index_size != 0 ) ) ) { pass = FALSE; failure_mssg = "Unexpected cache len/size after cleanup of flush op eviction test"; @@ -35159,30 +35234,34 @@ cedds__H5C_make_space_in_cache(H5F_t * file_ptr) /*------------------------------------------------------------------------- * Function: cedds__H5C__autoadjust__ageout__evict_aged_out_entries() * - * Purpose: Verify that H5C__autoadjust__ageout__evict_aged_out_entries() - * can handle the removal from the cache of the next item in - * its reverse scan of the LRU list. + * Purpose: Verify that H5C__autoadjust__ageout__evict_aged_out_entries() + * can handle the removal from the cache of the next item in + * its reverse scan of the LRU list. * - * Do this by setting up a full cache, with the last entry - * on the LRU being both dirty and having a flush operation - * that deletes the second to last entry on the LRU. Then - * access the first item in the LRU repeatedly until the - * item, and thereby the deletion of the second to last item. + * Do this by setting up a full cache, with the last entry + * on the LRU being both dirty and having a flush operation + * that deletes the second to last entry on the LRU. Then + * access the first item in the LRU repeatedly until the + * item, and thereby the deletion of the second to last item. * - * H5C__make_space_in_cache() should detect this deletion, and - * restart its scan of the LRU from the tail, instead of - * examining the now deleted next item up on the LRU. + * H5C__make_space_in_cache() should detect this deletion, and + * restart its scan of the LRU from the tail, instead of + * examining the now deleted next item up on the LRU. * * Do nothing if pass is FALSE on entry. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 4/4/15 * * Modifications: * - * None. + * Added code to setup and take down the skip list before + * and after calls to H5C_flush_cache(). Do this via the + * H5C_FLUSH_CACHE macro. + * + * JRM -- 5/14/20 * *------------------------------------------------------------------------- */ @@ -35496,17 +35575,14 @@ cedds__H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t * file_ptr) /* flush the cache and end the test. */ - if(pass) { - - result = H5C_flush_cache(file_ptr, H5C__FLUSH_INVALIDATE_FLAG); + if ( pass ) { - if(result < 0) { + H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_INVALIDATE_FLAG, \ + "Cache flush invalidate failed after flush op eviction test") - pass = FALSE; - failure_mssg = "Cache flush invalidate failed after flush op eviction test"; - } - else if((cache_ptr->index_len != 0) || - (cache_ptr->index_size != 0)) { + if ( ( pass ) && + ( ( cache_ptr->index_len != 0 ) || + ( cache_ptr->index_size != 0 ) ) ) { pass = FALSE; failure_mssg = "Unexpected cache len/size after cleanup of flush op eviction test"; @@ -35569,91 +35645,95 @@ cedds__H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t * file_ptr) /*------------------------------------------------------------------------- * Function: cedds__H5C_flush_invalidate_cache__bucket_scan() * - * Purpose: Note: We now use the index list when we scan the - * contents of the metadata cache, so in principal, - * this test is obsolete. However, even using the - * index list, restarts are possible, and must be - * handled gracefully. - * - * As it turns out, this test triggers index list - * scan restarts, and thus with minor changes is - * still a useful test. - * - * For this reason, with the exception of changing - * to check the index_scan_restart stat instead of - * hash bucket restarts, I'm leaving the test - * alone. If and when it starts to fail due to - * other changes, we can re-work it to test - * index list scan restarts explicitly. - * - * JRM -- 11/2/16 - * - * Verify that H5C_flush_invalidate_cache() can handle - * the removal from the cache of the next item in - * its scans of hash buckets. - * - * !!!!!!!!!!WARNING !!!!!!!!!! - * - * This test may fail to function correctly if the hash - * table size or hash function is altered. - * - * To setup the test, this function depends on the fact that - * H5C_flush_invalidate_cache() does alternating scans of the - * slist and the index. If this changes, the test will likely - * also cease to function correctly. - * - * The test relies on a known hash function and hash table - * size to select a set of test entries that will all hash - * to the same hash bucket -- call it the test hash bucket. - * It also relies on known behavior of the cache to place - * the entries in the test bucket in a known order. - * - * To avoid pre-mature flushes of the entries in the - * test hash bucket, all entries are initially clean, - * with the exception of the first entry which is dirty. - * It avoids premature flushing by being the parent in - * a flush dependency. The first entry in the test bucket - * also has a flush op which expunges the second entry -- - * setting up the failure. - * - * An additional dirty entry is added (which must hash - * to a different bucket, and must have a higher address - * than at least the first entry in the test hash bucket. - * This entry is the child in a flush dependency with the - * first entry in the above hash bucket, and contains - * a flush op to destroy this flush dependency. - * - * Since the first entry in the test hash bucket has a lower - * address that the other dirty entry, the scan of the - * slist encounters it first, and passes over it because - * it has a flush dependency height of 1. - * - * The scan then encounters the second dirty entry and flushes - * it -- causing it to destroy the flush dependency and thus - * reducing the flush dependency height of the first entry in - * the test hash bucket to zero. - * - * After completing a scan of the slist, - * H5C_flush_invalidate_cache() then scans the index, - * flushing all entries of flush dependency height zero. - * - * This sets up the potential error when the first entry - * in the test hash bucket is flushed -- expunging the - * second entry as a side effect. If - * H5C_flush_invalidate_cache() fails to detect this, - * it will attempt to continue its scan of the bucket with - * an entry that has been deleted from the cache. + * Purpose: Note: We now use the index list when we scan the + * contents of the metadata cache, so in principal, + * this test is obsolete. However, even using the + * index list, restarts are possible, and must be + * handled gracefully. + * + * As it turns out, this test triggers index list + * scan restarts, and thus with minor changes is + * still a useful test. + * + * For this reason, with the exception of changing + * to check the index_scan_restart stat instead of + * hash bucket restarts, I'm leaving the test + * alone. If and when it starts to fail due to + * other changes, we can re-work it to test + * index list scan restarts explicitly. + * + * JRM -- 11/2/16 + * + * Verify that H5C_flush_invalidate_cache() can handle + * the removal from the cache of the next item in + * its scans of hash buckets. + * + * !!!!!!!!!!WARNING !!!!!!!!!! + * + * This test may fail to function correctly if the hash + * table size or hash function is altered. + * + * To setup the test, this function depends on the fact that + * H5C_flush_invalidate_cache() does alternating scans of the + * slist and the index. If this changes, the test will likely + * also cease to function correctly. + * + * The test relies on a known hash function and hash table + * size to select a set of test entries that will all hash + * to the same hash bucket -- call it the test hash bucket. + * It also relies on known behavior of the cache to place + * the entries in the test bucket in a known order. + * + * To avoid pre-mature flushes of the entries in the + * test hash bucket, all entries are initially clean, + * with the exception of the first entry which is dirty. + * It avoids premature flushing by being the parent in + * a flush dependency. The first entry in the test bucket + * also has a flush op which expunges the second entry -- + * setting up the failure. + * + * An additional dirty entry is added (which must hash + * to a different bucket, and must have a higher address + * than at least the first entry in the test hash bucket. + * This entry is the child in a flush dependency with the + * first entry in the above hash bucket, and contains + * a flush op to destroy this flush dependency. + * + * Since the first entry in the test hash bucket has a lower + * address that the other dirty entry, the scan of the + * slist encounters it first, and passes over it because + * it has a flush dependency height of 1. + * + * The scan then encounters the second dirty entry and flushes + * it -- causing it to destroy the flush dependency and thus + * reducing the flush dependency height of the first entry in + * the test hash bucket to zero. + * + * After completing a scan of the slist, + * H5C_flush_invalidate_cache() then scans the index, + * flushing all entries of flush dependency height zero. + * + * This sets up the potential error when the first entry + * in the test hash bucket is flushed -- expunging the + * second entry as a side effect. If + * H5C_flush_invalidate_cache() fails to detect this, + * it will attempt to continue its scan of the bucket with + * an entry that has been deleted from the cache. * * Do nothing if pass is FALSE on entry. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 4/9/15 * * Modifications: * - * None. + * Added code to setup and take down the skip list before + * and after calls to H5C_flush_cache(). Do this via the + * H5C_FLUSH_CACHE macro. + * + * JRM -- 5/14/20 * *------------------------------------------------------------------------- */ @@ -35664,7 +35744,6 @@ cedds__H5C_flush_invalidate_cache__bucket_scan(H5F_t * file_ptr) H5C_t * cache_ptr = file_ptr->shared->cache; int i; int expected_hash_bucket = 0; - herr_t result; haddr_t entry_addr; test_entry_t * entry_ptr; test_entry_t * base_addr = NULL; @@ -35883,17 +35962,14 @@ cedds__H5C_flush_invalidate_cache__bucket_scan(H5F_t * file_ptr) /* test setup complete -- flush the cache to run and end the test. */ - if(pass) { - - result = H5C_flush_cache(file_ptr, H5C__FLUSH_INVALIDATE_FLAG); + if ( pass ) { - if(result < 0) { + H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_INVALIDATE_FLAG, \ + "Cache flush invalidate failed after flush op eviction test") - pass = FALSE; - failure_mssg = "Cache flush invalidate failed after flush op eviction test"; - } - else if((cache_ptr->index_len != 0) || - (cache_ptr->index_size != 0)) { + if ( ( pass ) && + ( ( cache_ptr->index_len != 0 ) || + ( cache_ptr->index_size != 0 ) ) ) { pass = FALSE; failure_mssg = "Unexpected cache len/size after cleanup of flush op eviction test"; @@ -36036,26 +36112,34 @@ check_stats(unsigned paged) /*------------------------------------------------------------------------- * Function: check_stats__smoke_check_1() * - * Purpose: Test to see if the statistics collection code is working - * more or less as expected. Do this by performing a number - * of operations in the cache, and checking to verify that - * they result in the expected statistics. + * Purpose: Test to see if the statistics collection code is working + * more or less as expected. Do this by performing a number + * of operations in the cache, and checking to verify that + * they result in the expected statistics. * - * Note that this function is not intended to be a full test - * of the statistics collection facility -- only a cursory - * check that will serve as a place holder until more complete - * tests are implemented. + * Note that this function is not intended to be a full test + * of the statistics collection facility -- only a cursory + * check that will serve as a place holder until more complete + * tests are implemented. * * Do nothing if pass is FALSE on entry. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 4/22/15 * * Modifications: * - * None. + * Modified slist stats checks to allow for the case that + * the slist is disabled. + * + * Also added code to setup and take down the skip list before + * and after calls to H5C_flush_cache(). Do this via the + * H5C_FLUSH_CACHE macro. + * + * JRM -- 5/14/20 + * * *------------------------------------------------------------------------- */ @@ -36063,9 +36147,8 @@ check_stats(unsigned paged) static void check_stats__smoke_check_1(H5F_t * file_ptr) { - H5C_t * cache_ptr = file_ptr->shared->cache; + H5C_t * cache_ptr = file_ptr->shared->cache; int i; - herr_t result; if(pass) { if(cache_ptr == NULL) { @@ -36129,36 +36212,39 @@ check_stats__smoke_check_1(H5F_t * file_ptr) failure_mssg = "Unexpected monster size entry stats in check_stats__smoke_check_1(1)."; } /* end if */ - if(pass) - if((cache_ptr->total_ht_insertions != 32) || - (cache_ptr->total_ht_deletions != 0) || - (cache_ptr->successful_ht_searches != 0) || - (cache_ptr->total_successful_ht_search_depth != 0) || - (cache_ptr->failed_ht_searches != 32) || - (cache_ptr->total_failed_ht_search_depth != 48) || - (cache_ptr->max_index_len != 32) || - (cache_ptr->max_index_size != 2 * 1024 * 1024) || - (cache_ptr->max_clean_index_size != 0) || - (cache_ptr->max_dirty_index_size != 2 * 1024 * 1024) || - (cache_ptr->max_slist_len != 32) || - (cache_ptr->max_slist_size != 2 * 1024 * 1024) || - (cache_ptr->max_pl_len != 0) || - (cache_ptr->max_pl_size != 0) || - (cache_ptr->max_pel_len != 0) || - (cache_ptr->max_pel_size != 0) || - (cache_ptr->calls_to_msic != 0) || - (cache_ptr->total_entries_skipped_in_msic != 0) || - (cache_ptr->total_entries_scanned_in_msic != 0) || - (cache_ptr->max_entries_skipped_in_msic != 0) || - (cache_ptr->max_entries_scanned_in_msic != 0) || - (cache_ptr->entries_scanned_to_make_space != 0) || - (cache_ptr->slist_scan_restarts != 0) || - (cache_ptr->LRU_scan_restarts != 0) || - (cache_ptr->index_scan_restarts != 0)) { + if ( pass ) { + + if ( ( cache_ptr->total_ht_insertions != 32 ) || + ( cache_ptr->total_ht_deletions != 0 ) || + ( cache_ptr->successful_ht_searches != 0 ) || + ( cache_ptr->total_successful_ht_search_depth != 0 ) || + ( cache_ptr->failed_ht_searches != 32 ) || + ( cache_ptr->total_failed_ht_search_depth != 48 ) || + ( cache_ptr->max_index_len != 32 ) || + ( cache_ptr->max_index_size != 2 * 1024 * 1024 ) || + ( cache_ptr->max_clean_index_size != 0 ) || + ( cache_ptr->max_dirty_index_size != 2 * 1024 * 1024 ) || + ( ( cache_ptr->slist_enabled ) && + ( ( cache_ptr->max_slist_len != 32 ) || + ( cache_ptr->max_slist_size != 2 * 1024 * 1024 ) ) ) || + ( cache_ptr->max_pl_len != 0 ) || + ( cache_ptr->max_pl_size != 0 ) || + ( cache_ptr->max_pel_len != 0 ) || + ( cache_ptr->max_pel_size != 0 ) || + ( cache_ptr->calls_to_msic != 0 ) || + ( cache_ptr->total_entries_skipped_in_msic != 0 ) || + ( cache_ptr->total_entries_scanned_in_msic != 0 ) || + ( cache_ptr->max_entries_skipped_in_msic != 0 ) || + ( cache_ptr->max_entries_scanned_in_msic != 0 ) || + ( cache_ptr->entries_scanned_to_make_space != 0 ) || + ( cache_ptr->slist_scan_restarts != 0 ) || + ( cache_ptr->LRU_scan_restarts != 0 ) || + ( cache_ptr->index_scan_restarts != 0 ) ) { pass = FALSE; failure_mssg = "Unexpected cache stats in check_stats__smoke_check_1(1)."; } /* end if */ + } #if H5C_COLLECT_CACHE_ENTRY_STATS if(pass) @@ -36214,36 +36300,39 @@ check_stats__smoke_check_1(H5F_t * file_ptr) failure_mssg = "Unexpected monster size entry stats in check_stats__smoke_check_1(2)."; } /* end if */ - if(pass) - if((cache_ptr->total_ht_insertions != 32) || - (cache_ptr->total_ht_deletions != 0) || - (cache_ptr->successful_ht_searches != 32) || - (cache_ptr->total_successful_ht_search_depth != 96) || - (cache_ptr->failed_ht_searches != 32) || - (cache_ptr->total_failed_ht_search_depth != 48) || - (cache_ptr->max_index_len != 32) || - (cache_ptr->max_index_size != 2 * 1024 * 1024) || - (cache_ptr->max_clean_index_size != 0) || - (cache_ptr->max_dirty_index_size != 2 * 1024 * 1024) || - (cache_ptr->max_slist_len != 32) || - (cache_ptr->max_slist_size != 2 * 1024 * 1024) || - (cache_ptr->max_pl_len != 1) || - (cache_ptr->max_pl_size != 64 * 1024) || - (cache_ptr->max_pel_len != 0) || - (cache_ptr->max_pel_size != 0) || - (cache_ptr->calls_to_msic != 0) || - (cache_ptr->total_entries_skipped_in_msic != 0) || - (cache_ptr->total_entries_scanned_in_msic != 0) || - (cache_ptr->max_entries_skipped_in_msic != 0) || - (cache_ptr->max_entries_scanned_in_msic != 0) || - (cache_ptr->entries_scanned_to_make_space != 0) || - (cache_ptr->slist_scan_restarts != 0) || - (cache_ptr->LRU_scan_restarts != 0) || - (cache_ptr->index_scan_restarts != 0)) { + if ( pass ) { + + if ( ( cache_ptr->total_ht_insertions != 32 ) || + ( cache_ptr->total_ht_deletions != 0 ) || + ( cache_ptr->successful_ht_searches != 32 ) || + ( cache_ptr->total_successful_ht_search_depth != 96 ) || + ( cache_ptr->failed_ht_searches != 32 ) || + ( cache_ptr->total_failed_ht_search_depth != 48 ) || + ( cache_ptr->max_index_len != 32 ) || + ( cache_ptr->max_index_size != 2 * 1024 * 1024 ) || + ( cache_ptr->max_clean_index_size != 0 ) || + ( cache_ptr->max_dirty_index_size != 2 * 1024 * 1024 ) || + ( ( cache_ptr->slist_enabled ) && + ( ( cache_ptr->max_slist_len != 32 ) || + ( cache_ptr->max_slist_size != 2 * 1024 * 1024 ) ) ) || + ( cache_ptr->max_pl_len != 1 ) || + ( cache_ptr->max_pl_size != 64 * 1024 ) || + ( cache_ptr->max_pel_len != 0 ) || + ( cache_ptr->max_pel_size != 0 ) || + ( cache_ptr->calls_to_msic != 0 ) || + ( cache_ptr->total_entries_skipped_in_msic != 0 ) || + ( cache_ptr->total_entries_scanned_in_msic != 0 ) || + ( cache_ptr->max_entries_skipped_in_msic != 0 ) || + ( cache_ptr->max_entries_scanned_in_msic != 0 ) || + ( cache_ptr->entries_scanned_to_make_space != 0 ) || + ( cache_ptr->slist_scan_restarts != 0 ) || + ( cache_ptr->LRU_scan_restarts != 0 ) || + ( cache_ptr->index_scan_restarts != 0 ) ) { pass = FALSE; failure_mssg = "Unexpected cache stats in check_stats__smoke_check_1(2)."; } /* end if */ + } #if H5C_COLLECT_CACHE_ENTRY_STATS if(pass) @@ -36299,36 +36388,39 @@ check_stats__smoke_check_1(H5F_t * file_ptr) failure_mssg = "Unexpected monster size entry stats in check_stats__smoke_check_1(3)."; } /* end if */ - if(pass) - if((cache_ptr->total_ht_insertions != 33) || - (cache_ptr->total_ht_deletions != 1) || - (cache_ptr->successful_ht_searches != 32) || - (cache_ptr->total_successful_ht_search_depth != 96) || - (cache_ptr->failed_ht_searches != 33) || - (cache_ptr->total_failed_ht_search_depth != 52) || - (cache_ptr->max_index_len != 32) || - (cache_ptr->max_index_size != 2 * 1024 * 1024) || - (cache_ptr->max_clean_index_size != 2 * 1024 * 1024) || - (cache_ptr->max_dirty_index_size != 2 * 1024 * 1024) || - (cache_ptr->max_slist_len != 32) || - (cache_ptr->max_slist_size != 2 * 1024 * 1024) || - (cache_ptr->max_pl_len != 1) || - (cache_ptr->max_pl_size != 64 * 1024) || - (cache_ptr->max_pel_len != 0) || - (cache_ptr->max_pel_size != 0) || - (cache_ptr->calls_to_msic != 1) || - (cache_ptr->total_entries_skipped_in_msic != 0) || - (cache_ptr->total_entries_scanned_in_msic != 33) || - (cache_ptr->max_entries_skipped_in_msic != 0) || - (cache_ptr->max_entries_scanned_in_msic != 33) || - (cache_ptr->entries_scanned_to_make_space != 33) || - (cache_ptr->slist_scan_restarts != 0) || - (cache_ptr->LRU_scan_restarts != 0) || - (cache_ptr->index_scan_restarts != 0)) { + if ( pass ) { + + if ( ( cache_ptr->total_ht_insertions != 33 ) || + ( cache_ptr->total_ht_deletions != 1 ) || + ( cache_ptr->successful_ht_searches != 32 ) || + ( cache_ptr->total_successful_ht_search_depth != 96 ) || + ( cache_ptr->failed_ht_searches != 33 ) || + ( cache_ptr->total_failed_ht_search_depth != 52 ) || + ( cache_ptr->max_index_len != 32 ) || + ( cache_ptr->max_index_size != 2 * 1024 * 1024 ) || + ( cache_ptr->max_clean_index_size != 2 * 1024 * 1024 ) || + ( cache_ptr->max_dirty_index_size != 2 * 1024 * 1024 ) || + ( ( cache_ptr->slist_enabled ) && + ( ( cache_ptr->max_slist_len != 32 ) || + ( cache_ptr->max_slist_size != 2 * 1024 * 1024 ) ) ) || + ( cache_ptr->max_pl_len != 1 ) || + ( cache_ptr->max_pl_size != 64 * 1024 ) || + ( cache_ptr->max_pel_len != 0 ) || + ( cache_ptr->max_pel_size != 0 ) || + ( cache_ptr->calls_to_msic != 1 ) || + ( cache_ptr->total_entries_skipped_in_msic != 0 ) || + ( cache_ptr->total_entries_scanned_in_msic != 33 ) || + ( cache_ptr->max_entries_skipped_in_msic != 0 ) || + ( cache_ptr->max_entries_scanned_in_msic != 33 ) || + ( cache_ptr->entries_scanned_to_make_space != 33 ) || + ( cache_ptr->slist_scan_restarts != 0 ) || + ( cache_ptr->LRU_scan_restarts != 0 ) || + ( cache_ptr->index_scan_restarts != 0 ) ) { pass = FALSE; failure_mssg = "Unexpected cache stats in check_stats__smoke_check_1(3)."; } /* end if */ + } #if H5C_COLLECT_CACHE_ENTRY_STATS if(pass) @@ -36356,17 +36448,14 @@ check_stats__smoke_check_1(H5F_t * file_ptr) /* flush the cache to end the test and collect all entry stats */ - if(pass) { - - result = H5C_flush_cache(file_ptr, H5C__FLUSH_INVALIDATE_FLAG); + if ( pass ) { - if(result < 0) { + H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_INVALIDATE_FLAG, \ + "Cache flush invalidate failed in check_stats__smoke_check_1()") - pass = FALSE; - failure_mssg = "Cache flush invalidate failed in check_stats__smoke_check_1()"; - } /* end if */ - else if((cache_ptr->index_len != 0) || - (cache_ptr->index_size != 0)) { + if ( ( pass ) && + ( ( cache_ptr->index_len != 0 ) || + ( cache_ptr->index_size != 0 ) ) ) { pass = FALSE; failure_mssg = "Unexpected cache len/size after check_stats__smoke_check_1()"; @@ -36403,36 +36492,39 @@ check_stats__smoke_check_1(H5F_t * file_ptr) failure_mssg = "Unexpected monster size entry stats in check_stats__smoke_check_1(4)."; } /* end if */ - if(pass) - if((cache_ptr->total_ht_insertions != 33) || - (cache_ptr->total_ht_deletions != 33) || - (cache_ptr->successful_ht_searches != 33) || - (cache_ptr->total_successful_ht_search_depth != 99) || - (cache_ptr->failed_ht_searches != 33) || - (cache_ptr->total_failed_ht_search_depth != 52) || - (cache_ptr->max_index_len != 32) || - (cache_ptr->max_index_size != 2 * 1024 * 1024) || - (cache_ptr->max_clean_index_size != 2 * 1024 * 1024) || - (cache_ptr->max_dirty_index_size != 2 * 1024 * 1024) || - (cache_ptr->max_slist_len != 32) || - (cache_ptr->max_slist_size != 2 * 1024 * 1024) || - (cache_ptr->max_pl_len != 1) || - (cache_ptr->max_pl_size != 64 * 1024) || - (cache_ptr->max_pel_len != 0) || - (cache_ptr->max_pel_size != 0) || - (cache_ptr->calls_to_msic != 1) || - (cache_ptr->total_entries_skipped_in_msic != 0) || - (cache_ptr->total_entries_scanned_in_msic != 33) || - (cache_ptr->max_entries_skipped_in_msic != 0) || - (cache_ptr->max_entries_scanned_in_msic != 33) || - (cache_ptr->entries_scanned_to_make_space != 33) || - (cache_ptr->slist_scan_restarts != 0) || - (cache_ptr->LRU_scan_restarts != 0) || - (cache_ptr->index_scan_restarts != 0)) { + if ( pass ) { + + if ( ( cache_ptr->total_ht_insertions != 33 ) || + ( cache_ptr->total_ht_deletions != 33 ) || + ( cache_ptr->successful_ht_searches != 33 ) || + ( cache_ptr->total_successful_ht_search_depth != 99 ) || + ( cache_ptr->failed_ht_searches != 33 ) || + ( cache_ptr->total_failed_ht_search_depth != 52 ) || + ( cache_ptr->max_index_len != 32 ) || + ( cache_ptr->max_index_size != 2 * 1024 * 1024 ) || + ( cache_ptr->max_clean_index_size != 2 * 1024 * 1024 ) || + ( cache_ptr->max_dirty_index_size != 2 * 1024 * 1024 ) || + ( ( cache_ptr->slist_enabled ) && + ( ( cache_ptr->max_slist_len != 32 ) || + ( cache_ptr->max_slist_size != 2 * 1024 * 1024 ) ) ) || + ( cache_ptr->max_pl_len != 1 ) || + ( cache_ptr->max_pl_size != 64 * 1024 ) || + ( cache_ptr->max_pel_len != 0 ) || + ( cache_ptr->max_pel_size != 0 ) || + ( cache_ptr->calls_to_msic != 1 ) || + ( cache_ptr->total_entries_skipped_in_msic != 0 ) || + ( cache_ptr->total_entries_scanned_in_msic != 33 ) || + ( cache_ptr->max_entries_skipped_in_msic != 0 ) || + ( cache_ptr->max_entries_scanned_in_msic != 33 ) || + ( cache_ptr->entries_scanned_to_make_space != 33 ) || + ( cache_ptr->slist_scan_restarts != 0 ) || + ( cache_ptr->LRU_scan_restarts != 0 ) || + ( cache_ptr->index_scan_restarts != 0 ) ) { pass = FALSE; failure_mssg = "Unexpected cache stats in check_stats__smoke_check_1(4)."; } /* end if */ + } #if H5C_COLLECT_CACHE_ENTRY_STATS if(pass) diff --git a/test/cache_common.c b/test/cache_common.c index 1dc13a1..52ff33e 100644 --- a/test/cache_common.c +++ b/test/cache_common.c @@ -3111,12 +3111,25 @@ expunge_entry(H5F_t * file_ptr, * Function: flush_cache() * * Purpose: Flush the specified cache, destroying all entries if - requested. If requested, dump stats first. + * requested. If requested, dump stats first. * * Return: void * * Programmer: John Mainzer - * 6/23/04 + * 6/23/04 + * + * Changes: Added code to setup and take down the skip list before + * and after calls to H5C_flush_cache(). Do this via calls + * to the H5C_FLUSH_CACHE macro. + * + * This is necessary, as H5C_flush() is called repeatedly + * during file flush. If we setup and took down the + * skip list on H5C_flush_cache(), we would find ourselves + * doing this repeatedly -- which is contrary to the + * objective of the exercise (avoiding as many skip list + * operations as possible). + * + * JRM -- 5/14/20 * *------------------------------------------------------------------------- */ @@ -3139,25 +3152,30 @@ flush_cache(H5F_t * file_ptr, cache_ptr = file_ptr->shared->cache; - if(destroy_entries) - result = H5C_flush_cache(file_ptr, H5C__FLUSH_INVALIDATE_FLAG); + if ( destroy_entries ) { - else - result = H5C_flush_cache(file_ptr, H5C__NO_FLAGS_SET); + H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_INVALIDATE_FLAG, \ + "error in H5C_flush_cache().") - if(dump_stats) - H5C_stats(cache_ptr, "test cache", dump_detailed_stats); + } else { - if(result < 0) { - pass = FALSE; - failure_mssg = "error in H5C_flush_cache()."; + H5C_FLUSH_CACHE(file_ptr, H5C__NO_FLAGS_SET, \ + "error in H5C_flush_cache().") + } + + if ( dump_stats ) { + + H5C_stats(cache_ptr, "test cache", dump_detailed_stats); } - else if((destroy_entries) && ((cache_ptr->index_len != 0) - || (cache_ptr->index_size != 0) - || (cache_ptr->clean_index_size != 0) - || (cache_ptr->dirty_index_size != 0))) { - if(verbose) { + if ( ( pass ) && ( destroy_entries ) && + ( ( cache_ptr->index_len != 0 ) || + ( cache_ptr->index_size != 0 ) || + ( cache_ptr->clean_index_size != 0 ) || + ( cache_ptr->dirty_index_size != 0 ) ) ) { + + if ( verbose ) { + HDfprintf(stdout, "%s: unexpected il/is/cis/dis = %lld/%lld/%lld/%lld.\n", FUNC, @@ -3961,14 +3979,19 @@ unprotect_entry(H5F_t * file_ptr, * Function: row_major_scan_forward() * * Purpose: Do a sequence of inserts, protects, unprotects, moves, - * destroys while scanning through the set of entries. If - * pass is false on entry, do nothing. + * destroys while scanning through the set of entries. If + * pass is false on entry, do nothing. * * Return: void * * Programmer: John Mainzer * 6/12/04 * + * Changes: Updated slist size == dirty index size checks to + * bypass the test if cache_ptr->slist_enabled is FALSE. + * + * JRM -- 5/8/20 + * *------------------------------------------------------------------------- */ void @@ -3983,7 +4006,7 @@ row_major_scan_forward(H5F_t * file_ptr, hbool_t do_moves, hbool_t move_to_main_addr, hbool_t do_destroys, - hbool_t do_mult_ro_protects, + hbool_t do_mult_ro_protects, int dirty_destroys, int dirty_unprotects) { @@ -4022,7 +4045,10 @@ row_major_scan_forward(H5F_t * file_ptr, HDfprintf(stdout, "1(i, %d, %d) ", type, tmp_idx); insert_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET); - HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); + + HDassert( ( ! cache_ptr->slist_enabled ) || \ + ( cache_ptr->slist_size == \ + cache_ptr->dirty_index_size ) ); } /* end if */ tmp_idx--; @@ -4033,7 +4059,10 @@ row_major_scan_forward(H5F_t * file_ptr, HDfprintf(stdout, "2(p, %d, %d) ", type, tmp_idx); protect_entry(file_ptr, type, tmp_idx); - HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); + + HDassert( ( ! cache_ptr->slist_enabled ) || \ + ( cache_ptr->slist_size == \ + cache_ptr->dirty_index_size ) ); } /* end if */ tmp_idx--; @@ -4044,7 +4073,10 @@ row_major_scan_forward(H5F_t * file_ptr, HDfprintf(stdout, "3(u, %d, %d) ", type, tmp_idx); unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET); - HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); + + HDassert( ( ! cache_ptr->slist_enabled ) || \ + ( cache_ptr->slist_size == \ + cache_ptr->dirty_index_size ) ); } /* end if */ /* (don't decrement tmp_idx) */ @@ -4055,7 +4087,10 @@ row_major_scan_forward(H5F_t * file_ptr, HDfprintf(stdout, "4(r, %d, %d, %d) ", type, tmp_idx, (int)move_to_main_addr); move_entry(cache_ptr, type, tmp_idx, move_to_main_addr); - HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); + + HDassert( ( ! cache_ptr->slist_enabled ) || \ + ( cache_ptr->slist_size == \ + cache_ptr->dirty_index_size ) ); } /* end if */ tmp_idx--; @@ -4066,7 +4101,10 @@ row_major_scan_forward(H5F_t * file_ptr, HDfprintf(stdout, "5(p, %d, %d) ", type, tmp_idx); protect_entry(file_ptr, type, tmp_idx); - HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); + + HDassert( ( ! cache_ptr->slist_enabled ) || \ + ( cache_ptr->slist_size == \ + cache_ptr->dirty_index_size ) ); } /* end if */ tmp_idx -= 2; @@ -4077,7 +4115,10 @@ row_major_scan_forward(H5F_t * file_ptr, HDfprintf(stdout, "6(u, %d, %d) ", type, tmp_idx); unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET); - HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); + + HDassert( ( ! cache_ptr->slist_enabled ) || \ + ( cache_ptr->slist_size == \ + cache_ptr->dirty_index_size ) ); } /* end if */ if(do_mult_ro_protects) { @@ -4089,7 +4130,10 @@ row_major_scan_forward(H5F_t * file_ptr, HDfprintf(stdout, "7(p-ro, %d, %d) ", type, tmp_idx); protect_entry_ro(file_ptr, type, tmp_idx); - HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); + + HDassert( ( ! cache_ptr->slist_enabled ) || \ + ( cache_ptr->slist_size == \ + cache_ptr->dirty_index_size ) ); } /* end if */ tmp_idx--; @@ -4100,7 +4144,10 @@ row_major_scan_forward(H5F_t * file_ptr, HDfprintf(stdout, "8(p-ro, %d, %d) ", type, tmp_idx); protect_entry_ro(file_ptr, type, tmp_idx); - HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); + + HDassert( ( ! cache_ptr->slist_enabled ) || \ + ( cache_ptr->slist_size == \ + cache_ptr->dirty_index_size ) ); } /* end if */ tmp_idx--; @@ -4111,7 +4158,10 @@ row_major_scan_forward(H5F_t * file_ptr, HDfprintf(stdout, "9(p-ro, %d, %d) ", type, tmp_idx); protect_entry_ro(file_ptr, type, tmp_idx); - HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); + + HDassert( ( ! cache_ptr->slist_enabled ) || \ + ( cache_ptr->slist_size == \ + cache_ptr->dirty_index_size ) ); } /* end if */ /* (don't decrement tmp_idx) */ @@ -4122,7 +4172,10 @@ row_major_scan_forward(H5F_t * file_ptr, HDfprintf(stdout, "10(u-ro, %d, %d) ", type, tmp_idx); unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET); - HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); + + HDassert( ( ! cache_ptr->slist_enabled ) || \ + ( cache_ptr->slist_size == \ + cache_ptr->dirty_index_size ) ); } /* end if */ tmp_idx--; @@ -4133,7 +4186,10 @@ row_major_scan_forward(H5F_t * file_ptr, HDfprintf(stdout, "11(u-ro, %d, %d) ", type, tmp_idx); unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET); - HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); + + HDassert( ( ! cache_ptr->slist_enabled ) || \ + ( cache_ptr->slist_size == \ + cache_ptr->dirty_index_size ) ); } /* end if */ tmp_idx--; @@ -4144,7 +4200,10 @@ row_major_scan_forward(H5F_t * file_ptr, HDfprintf(stdout, "12(u-ro, %d, %d) ", type, tmp_idx); unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET); - HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); + + HDassert( ( ! cache_ptr->slist_enabled ) || \ + ( cache_ptr->slist_size == \ + cache_ptr->dirty_index_size ) ); } /* end if */ } /* if ( do_mult_ro_protects ) */ @@ -4153,7 +4212,10 @@ row_major_scan_forward(H5F_t * file_ptr, HDfprintf(stdout, "13(p, %d, %d) ", type, idx); protect_entry(file_ptr, type, idx); - HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); + + HDassert( ( ! cache_ptr->slist_enabled ) || \ + ( cache_ptr->slist_size == \ + cache_ptr->dirty_index_size ) ); } /* end if */ tmp_idx = idx - lag + 2; @@ -4164,7 +4226,10 @@ row_major_scan_forward(H5F_t * file_ptr, HDfprintf(stdout, "14(u, %d, %d) ", type, tmp_idx); unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET); - HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); + + HDassert( ( ! cache_ptr->slist_enabled ) || \ + ( cache_ptr->slist_size == \ + cache_ptr->dirty_index_size ) ); } /* end if */ tmp_idx--; @@ -4175,7 +4240,10 @@ row_major_scan_forward(H5F_t * file_ptr, HDfprintf(stdout, "15(p, %d, %d) ", type, tmp_idx); protect_entry(file_ptr, type, tmp_idx); - HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); + + HDassert( ( ! cache_ptr->slist_enabled ) || \ + ( cache_ptr->slist_size == \ + cache_ptr->dirty_index_size ) ); } /* end if */ if(do_destroys) { @@ -4187,7 +4255,10 @@ row_major_scan_forward(H5F_t * file_ptr, HDfprintf(stdout, "16(u, %d, %d) ", type, tmp_idx); unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET); - HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); + + HDassert( ( ! cache_ptr->slist_enabled ) || \ + ( cache_ptr->slist_size == \ + cache_ptr->dirty_index_size ) ); break; case 1: @@ -4196,14 +4267,20 @@ row_major_scan_forward(H5F_t * file_ptr, HDfprintf(stdout, "17(u, %d, %d) ", type, tmp_idx); unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET); - HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); + + HDassert( ( ! cache_ptr->slist_enabled ) || \ + ( cache_ptr->slist_size == \ + cache_ptr->dirty_index_size ) ); } /* end if */ else { if(verbose) HDfprintf(stdout, "18(u, %d, %d) ", type, tmp_idx); unprotect_entry(file_ptr, type, tmp_idx, (dirty_unprotects ? H5C__DIRTIED_FLAG : H5C__NO_FLAGS_SET)); - HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); + + HDassert( ( ! cache_ptr->slist_enabled ) || \ + ( cache_ptr->slist_size == \ + cache_ptr->dirty_index_size ) ); } /* end else */ break; @@ -4212,7 +4289,10 @@ row_major_scan_forward(H5F_t * file_ptr, HDfprintf(stdout, "19(u-del, %d, %d) ", type, tmp_idx); unprotect_entry(file_ptr, type, tmp_idx, H5C__DELETED_FLAG); - HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); + + HDassert( ( ! cache_ptr->slist_enabled ) || \ + ( cache_ptr->slist_size == \ + cache_ptr->dirty_index_size ) ); break; case 3: @@ -4221,14 +4301,20 @@ row_major_scan_forward(H5F_t * file_ptr, HDfprintf(stdout, "20(u-del, %d, %d) ", type, tmp_idx); unprotect_entry(file_ptr, type, tmp_idx, H5C__DELETED_FLAG); - HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); + + HDassert( ( ! cache_ptr->slist_enabled ) || \ + ( cache_ptr->slist_size == \ + cache_ptr->dirty_index_size ) ); } /* end if */ else { if(verbose) HDfprintf(stdout, "21(u-del, %d, %d) ", type, tmp_idx); unprotect_entry(file_ptr, type, tmp_idx, (dirty_destroys ? H5C__DIRTIED_FLAG : H5C__NO_FLAGS_SET) | H5C__DELETED_FLAG); - HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); + + HDassert( ( ! cache_ptr->slist_enabled ) || \ + ( cache_ptr->slist_size == \ + cache_ptr->dirty_index_size ) ); } /* end else */ break; @@ -4245,7 +4331,10 @@ row_major_scan_forward(H5F_t * file_ptr, HDfprintf(stdout, "22(u, %d, %d) ", type, tmp_idx); unprotect_entry(file_ptr, type, tmp_idx, (dirty_unprotects ? H5C__DIRTIED_FLAG : H5C__NO_FLAGS_SET)); - HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); + + HDassert( ( ! cache_ptr->slist_enabled ) || \ + ( cache_ptr->slist_size == \ + cache_ptr->dirty_index_size ) ); } /* end if */ } /* end elsef */ diff --git a/test/cache_common.h b/test/cache_common.h index 785dc21..807ba35 100644 --- a/test/cache_common.h +++ b/test/cache_common.h @@ -134,6 +134,65 @@ (NOTIFY_ENTRY_SIZE * NUM_NOTIFY_ENTRIES)) #define ADDR_SPACE_SIZE (haddr_t)(MAX_ADDR - BASE_ADDR) + +/*********************************************************************** + * + * Macro: H5C_FLUSH_CACHE + * + * Purpose: Wrap a call to H5C_flush_cache() in calls to + * H5C_set_slist_enabled() to setup and take down the slist. + * + * This is necessary, as H5C_flush_cache() needs the + * slist to be active. Further, since it is called + * repeatedly during file flush, it would be inefficient + * for it to setup the slist on entry, and take it down + * on exit. + * + * Note that the slist need not be empty if the flags + * indicate a partial flush (i.e. + * H5C__FLUSH_MARKED_ENTRIES_FLAG). Compute clear_slist + * and pass it into H5C_set_slist_enabled as appropriate. + * + * On error, set pass to FALSE, and set failure_mssg + * to the supplied error message. + * + * Return: N/A + * + * Programmer: John Mainzer + * 5/14/20 + * + * Changes: None. + * + ***********************************************************************/ + +#define H5C_FLUSH_CACHE(file, flags, fail_mssg) \ +{ \ + hbool_t clear_slist; \ + herr_t rslt; \ + \ + clear_slist = ( (flags & H5C__FLUSH_MARKED_ENTRIES_FLAG) != 0 ); \ + \ + rslt = H5C_set_slist_enabled((file)->shared->cache, TRUE, FALSE); \ + \ + if ( rslt >= 0 ) { \ + \ + rslt = H5C_flush_cache((file), (flags)); \ + } \ + \ + if ( rslt >= 0 ) { \ + \ + rslt = H5C_set_slist_enabled((file)->shared->cache, FALSE, \ + clear_slist); \ + } \ + \ + if( rslt < 0 ) { \ + \ + pass = FALSE; \ + failure_mssg = (fail_mssg); \ + } \ +} /* H5C_FLUSH_CACHE */ + + #define MAX_PINS 8 /* Maximum number of entries that can be * directly pinned by a single entry. */ diff --git a/test/cache_image.c b/test/cache_image.c index 59689a9..9f8c4c5 100644 --- a/test/cache_image.c +++ b/test/cache_image.c @@ -15,7 +15,7 @@ * 7/13/15 * * This file contains tests specific to the cache image - * feature implemented in H5C.c + * feature implemented in H5C.c */ #include "cache_common.h" #include "genall5.h" diff --git a/test/cache_tagging.c b/test/cache_tagging.c index cf0cd8d..e1187fb 100644 --- a/test/cache_tagging.c +++ b/test/cache_tagging.c @@ -30,16 +30,16 @@ /* Test Defines */ /* ============ */ -#define FILENAME "tagging_test.h5" -#define FILENAME2 "tagging_ext_test.h5" -#define GROUPNAME "Group" +#define FILENAME "tagging_test.h5" +#define FILENAME2 "tagging_ext_test.h5" +#define GROUPNAME "Group" #define GROUPNAMEPATH "/Group" #define GROUPNAMECOPY "GroupCopy" -#define ATTRNAME "Attribute 1" -#define ATTRNAME3 "Attribute 3" -#define DATASETNAME "Dataset" -#define DATASETNAME2 "Dataset2" -#define LINKNAME "Link" +#define ATTRNAME "Attribute 1" +#define ATTRNAME3 "Attribute 3" +#define DATASETNAME "Dataset" +#define DATASETNAME2 "Dataset2" +#define LINKNAME "Link" #define RANK 2 #define DIMS 32 @@ -348,11 +348,20 @@ evict_entries(hid_t fid) /* Mark all entries investigated */ mark_all_entries_investigated(fid); + /* setup the skip list prior to calling H5C_flush_cache() */ + if ( H5C_set_slist_enabled(f->shared->cache, TRUE, FALSE) < 0 ) + TEST_ERROR; + /* Evict all we can from the cache to examine full tag creation tree */ - /* This function will likely return failure since the root group - * is still protected. Thus, don't check its return value. */ + /* This function will likely return failure since the root group + * is still protected. Thus, don't check its return value. + */ H5C_flush_cache(f, H5C__FLUSH_INVALIDATE_FLAG); + /* shutdown the slist -- allow it to be non-empty */ + if ( H5C_set_slist_enabled(f->shared->cache, FALSE, TRUE) < 0 ) + TEST_ERROR; + return 0; error: diff --git a/test/chunk_info.c b/test/chunk_info.c index 0afff66..3ed1d56 100644 --- a/test/chunk_info.c +++ b/test/chunk_info.c @@ -685,7 +685,7 @@ test_get_chunk_info_highest_v18(hid_t fapl) /* Verify that the number of chunks is NUM_CHUNKS */ if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR - VERIFY(nchunks, NUM_CHUNKS, "H5Dget_num_chunks, number of chunks"); + if(nchunks != NUM_CHUNKS) TEST_ERROR /* Attempt to get info of a chunk from an empty dataset, verify the returned address and size in the case of H5D_ALLOC_TIME_EARLY */ @@ -693,11 +693,12 @@ test_get_chunk_info_highest_v18(hid_t fapl) reinit_vars(&read_flt_msk, &addr, &size); ret = H5Dget_chunk_info(dset, dspace, chk_index, out_offset, &read_flt_msk, &addr, &size); if(ret < 0) TEST_ERROR + /* Because of H5D_ALLOC_TIME_EARLY, addr cannot be HADDR_UNDEF and size not 0 */ if(addr == HADDR_UNDEF) - FAIL_PUTS_ERROR(MSG_CHK_ADDR); + TEST_ERROR if(size == EMPTY_CHK_SIZE) - FAIL_PUTS_ERROR(MSG_CHK_SIZE); + TEST_ERROR chk_index = 10; reinit_vars(&read_flt_msk, &addr, &size); @@ -705,9 +706,9 @@ test_get_chunk_info_highest_v18(hid_t fapl) if(ret < 0) TEST_ERROR /* Because of H5D_ALLOC_TIME_EARLY, addr cannot be HADDR_UNDEF and size not 0 */ if(addr == HADDR_UNDEF) - FAIL_PUTS_ERROR(MSG_CHK_ADDR); + TEST_ERROR if(size == EMPTY_CHK_SIZE) - FAIL_PUTS_ERROR(MSG_CHK_SIZE); + TEST_ERROR /* Attempt to get info of a chunk given its coords from an empty dataset, verify the returned address and size */ @@ -717,9 +718,9 @@ test_get_chunk_info_highest_v18(hid_t fapl) TEST_ERROR /* Because of H5D_ALLOC_TIME_EARLY, addr cannot be HADDR_UNDEF and size not 0 */ if(addr == HADDR_UNDEF) - FAIL_PUTS_ERROR(MSG_CHK_ADDR); + TEST_ERROR if(size == 0) - FAIL_PUTS_ERROR(MSG_CHK_SIZE); + TEST_ERROR if(H5Dclose(dset) < 0) TEST_ERROR @@ -819,7 +820,7 @@ test_chunk_info_single_chunk(const char *filename, hid_t fapl) /* Get the number of chunks and verify that no chunk has been written */ if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR - VERIFY(nchunks, NO_CHUNK_WRITTEN, "H5Dget_num_chunks, number of chunks"); + if(nchunks != NO_CHUNK_WRITTEN) TEST_ERROR /* Initialize the array of chunk data for the single chunk */ for(ii = 0; ii < NX; ii++) @@ -832,7 +833,7 @@ test_chunk_info_single_chunk(const char *filename, hid_t fapl) /* Get and verify that one chunk had been written */ if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR - VERIFY(nchunks, ONE_CHUNK_WRITTEN, "H5Dget_num_chunks, number of chunks"); + if(nchunks != ONE_CHUNK_WRITTEN) TEST_ERROR /* Offset of the only chunk */ offset[0] = 0; @@ -1937,8 +1938,7 @@ error: * * Purpose: Tests functions related to chunk information * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: EXIT_SUCCESS/EXIT_FAILURE * * Programmer: Binh-Minh Ribler * November 5, 2018 @@ -1969,19 +1969,19 @@ main(void) nerrors += test_flt_msk_with_skip_compress(fapl) < 0 ? 1 : 0; if(nerrors) - TEST_ERROR + goto error; HDprintf("All chunk query tests passed.\n"); h5_cleanup(FILENAME, fapl); - return SUCCEED; + return EXIT_SUCCESS; error: nerrors = MAX(1, nerrors); HDprintf("***** %d QUERY CHUNK INFO TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S"); - return FAIL; + return EXIT_FAILURE; } /**************************************************************************** diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c index ff3767c..c8ef1e4 100644 --- a/test/cmpd_dset.c +++ b/test/cmpd_dset.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, January 23, 1998 */ diff --git a/test/cross_read.c b/test/cross_read.c index c16ddbc..dabd3ab 100644 --- a/test/cross_read.c +++ b/test/cross_read.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Thursday, March 23, 2006 * * Purpose: Check if floating-point data created on big-endian and diff --git a/test/dangle.c b/test/dangle.c index 9f30f10..8300792 100644 --- a/test/dangle.c +++ b/test/dangle.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, May 13, 2003 * * Purpose: Test dangling IDs diff --git a/test/dsets.c b/test/dsets.c index 4ab3efa..ae917cc 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, December 9, 1997 * * Purpose: Tests the dataset interface (H5D) @@ -112,6 +112,8 @@ const char *FILENAME[] = { #define DSET_FLETCHER32_NAME_3 "fletcher32_3" #define DSET_SHUF_DEF_FLET_NAME "shuffle+deflate+fletcher32" #define DSET_SHUF_DEF_FLET_NAME_2 "shuffle+deflate+fletcher32_2" +#define DSET_OPTIONAL_SCALAR "dataset_with_scalar_space" +#define DSET_OPTIONAL_VLEN "dataset_with_vlen_type" #ifdef H5_HAVE_FILTER_SZIP #define DSET_SZIP_NAME "szip" #define DSET_SHUF_SZIP_FLET_NAME "shuffle+szip+fletcher32" @@ -1888,7 +1890,7 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, if(H5Pset_filter_callback(write_dxpl, filter_cb_fail, NULL) < 0) TEST_ERROR; /* (Use the "write" DXPL in order to make certain corruption is seen) */ H5E_BEGIN_TRY { - status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data); + status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data); } H5E_END_TRY; if(status>=0) TEST_ERROR; } @@ -1934,7 +1936,7 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, /* Default behavior is failure when data is corrupted. */ /* (Use the "write" DXPL in order to make certain corruption is seen) */ H5E_BEGIN_TRY { - status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data); + status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data); } H5E_END_TRY; if(status>=0) TEST_ERROR; @@ -1947,7 +1949,7 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, if(H5Pset_filter_callback(write_dxpl, filter_cb_fail, NULL) < 0) TEST_ERROR; /* (Use the "write" DXPL in order to make certain corruption is seen) */ H5E_BEGIN_TRY { - status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data); + status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data); } H5E_END_TRY; if(status>=0) TEST_ERROR; } @@ -2048,7 +2050,7 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, /* Default behavior is failure when data is corrupted. */ /* (Use the "write" DXPL in order to make certain corruption is seen) */ H5E_BEGIN_TRY { - status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data); + status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data); } H5E_END_TRY; if(status>=0) TEST_ERROR; @@ -2061,12 +2063,12 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, if(H5Pset_filter_callback(write_dxpl, filter_cb_fail, NULL) < 0) TEST_ERROR; /* (Use the "write" DXPL in order to make certain corruption is seen) */ H5E_BEGIN_TRY { - status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data); + status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data); } H5E_END_TRY; if(status>=0) TEST_ERROR; } else { - if(H5Dread (dataset, H5T_NATIVE_INT, sid, sid, dxpl, check_data) < 0) + if(H5Dread(dataset, H5T_NATIVE_INT, sid, sid, dxpl, check_data) < 0) TEST_ERROR; /* Check that the values read are the same as the values written */ @@ -5770,6 +5772,101 @@ error: } /* end test_can_apply2() */ +/*------------------------------------------------------------------------- + * Function: test_optional_filters + * + * Purpose: Tests that H5Dcreate2 will not fail when a combination of + * type, space, etc... doesn't work for a filter and filter is + * optional. + * + * Return: Success: SUCCEED + * Failure: FAIL + * + * Programmer: Binh-Minh Ribler + * 24 July 2020 + * + *------------------------------------------------------------------------- + */ +static herr_t +test_optional_filters(hid_t file) +{ + unsigned int level = 9; + unsigned int cd_values[1] = {level}; + size_t cd_nelmts = 1; + hsize_t dim1d[1]; /* Dataspace dimensions */ + hid_t dsid = H5I_INVALID_HID; /* Dataset ID */ + hid_t sid = H5I_INVALID_HID; /* Dataspace ID */ + hid_t strtid = H5I_INVALID_HID; /* Datatype ID for string */ + hid_t vlentid = H5I_INVALID_HID; /* Datatype ID for vlen */ + hid_t dcplid = H5I_INVALID_HID; /* Dataspace creation property list ID */ + + TESTING("dataset with optional filters"); + + /* Create dcpl with special filter */ + if((dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR; + + /* Create the datatype */ + if((strtid = H5Tcreate(H5T_STRING, H5T_VARIABLE)) < 0) TEST_ERROR; + + /* Create the data space */ + if((sid = H5Screate(H5S_SCALAR)) < 0) TEST_ERROR; + + /* The filter is optional. */ + if(H5Pset_filter(dcplid, H5Z_FILTER_DEFLATE, H5Z_FLAG_OPTIONAL, cd_nelmts, cd_values) < 0) + TEST_ERROR; + + /* Create dataset with optional filter */ + if((dsid = H5Dcreate2(file, DSET_OPTIONAL_SCALAR, strtid, sid, H5P_DEFAULT, dcplid, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* Close dataset */ + if(H5Dclose(dsid) < 0) TEST_ERROR; + + /* Close dataspace */ + if(H5Sclose(sid) < 0) TEST_ERROR; + + /* Close datatype */ + if(H5Tclose(strtid) < 0) TEST_ERROR; + + /* Set dataspace dimensions */ + dim1d[0]=DIM1; + + /* Create a non-scalar dataspace */ + if((sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR; + + /* Create a vlen datatype */ + if((vlentid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR; + + /* Create dataset with optional filter */ + if((dsid = H5Dcreate2(file, DSET_OPTIONAL_VLEN, vlentid, sid, H5P_DEFAULT, dcplid, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* Close dataset */ + if(H5Dclose(dsid) < 0) TEST_ERROR; + + /* Close dataspace */ + if(H5Sclose(sid) < 0) TEST_ERROR; + + /* Close datatype */ + if(H5Tclose(vlentid) < 0) TEST_ERROR; + + /* Close dataset creation property list */ + if(H5Pclose(dcplid) < 0) TEST_ERROR; + + PASSED(); + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Dclose(dsid); + H5Sclose(sid); + H5Pclose(dcplid); + H5Tclose(strtid); + H5Tclose(vlentid); + } H5E_END_TRY; + return FAIL; +} /* end test_optional_filters() */ + /*------------------------------------------------------------------------- * Function: test_can_apply_szip @@ -11237,6 +11334,9 @@ test_bt2_hdr_fd(const char *env_h5_driver, hid_t fapl) TESTING("Version 2 B-tree chunk index header flush dependencies handled correctly"); + /* Initialize struct */ + HDmemset(&info, 0, sizeof(info)); + /* Skip this test if SWMR I/O is not supported for the VFD specified * by the environment variable. */ @@ -13366,7 +13466,7 @@ test_versionbounds(void) return FAIL; } /* end test_versionbounds() */ - + /*----------------------------------------------------------------------------- * Function: test_object_header_minimization_dcpl * @@ -13862,6 +13962,7 @@ main(void) nerrors += (test_missing_filter(file) < 0 ? 1 : 0); nerrors += (test_can_apply(file) < 0 ? 1 : 0); nerrors += (test_can_apply2(file) < 0 ? 1 : 0); + nerrors += (test_optional_filters(file) < 0 ? 1 : 0); nerrors += (test_set_local(my_fapl) < 0 ? 1 : 0); nerrors += (test_can_apply_szip(file) < 0 ? 1 : 0); nerrors += (test_compare_dcpl(file) < 0 ? 1 : 0); diff --git a/test/dt_arith.c b/test/dt_arith.c index 8d04770..9b89225 100644 --- a/test/dt_arith.c +++ b/test/dt_arith.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, December 9, 1997 * * Purpose: Tests the data type interface (H5T) @@ -770,7 +770,7 @@ static int test_particular_fp_integer(void) /* Print errors */ if(dst_c != SCHAR_MAX) { - double x = 0.; + double x = 0.0; signed char y; if(0 == fails_this_test++) @@ -814,7 +814,7 @@ static int test_particular_fp_integer(void) /* Print errors */ if(dst_i != fill_value) { - float x = 0.; + float x = 0.0; int y; if(0 == fails_this_test++) @@ -2723,16 +2723,16 @@ my_isnan(dtype_t type, void *val) char s[256]; if (FLT_FLOAT==type) { - float x = 0.; + float x = 0.0; HDmemcpy(&x, val, sizeof(float)); retval = (x!=x); } else if (FLT_DOUBLE==type) { - double x = 0.; + double x = 0.0; HDmemcpy(&x, val, sizeof(double)); retval = (x!=x); #if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE!=0 } else if (FLT_LDOUBLE==type) { - long double x = 0.; + long double x = 0.0; HDmemcpy(&x, val, sizeof(long double)); retval = (x!=x); #endif @@ -2746,18 +2746,18 @@ my_isnan(dtype_t type, void *val) */ if (!retval) { if (FLT_FLOAT==type) { - float x = 0.; + float x = 0.0; HDmemcpy(&x, val, sizeof(float)); HDsnprintf(s, sizeof(s), "%g", (double)x); } else if (FLT_DOUBLE==type) { - double x = 0.; + double x = 0.0; HDmemcpy(&x, val, sizeof(double)); HDsnprintf(s, sizeof(s), "%g", x); #if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE!=0 } else if (FLT_LDOUBLE==type) { - long double x = 0.; + long double x = 0.0; HDmemcpy(&x, val, sizeof(long double)); HDsnprintf(s, sizeof(s), "%Lg", x); @@ -3197,7 +3197,7 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst) int check_expo[2]; if (FLT_FLOAT==dst_type) { - float x = 0.; + float x = 0.0; HDmemcpy(&x, &buf[j*dst_size], sizeof(float)); if (underflow && HDfabsf(x) <= FLT_MIN && HDfabsf(hw_f) <= FLT_MIN) @@ -3208,7 +3208,7 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst) check_mant[0] = HDfrexpf(x, check_expo+0); check_mant[1] = HDfrexpf(hw_f, check_expo+1); } else if (FLT_DOUBLE==dst_type) { - double x = 0.; + double x = 0.0; HDmemcpy(&x, &buf[j*dst_size], sizeof(double)); if (underflow && HDfabs(x) <= DBL_MIN && HDfabs(hw_d) <= DBL_MIN) @@ -3220,7 +3220,7 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst) check_mant[1] = HDfrexp(hw_d, check_expo+1); #if H5_SIZEOF_LONG_DOUBLE !=0 && (H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE) } else { - long double x = 0.; + long double x = 0.0; HDmemcpy(&x, &buf[j*dst_size], sizeof(long double)); /* dst is largest float, no need to check underflow. */ check_mant[0] = (double)HDfrexpl(x, check_expo+0); @@ -3265,16 +3265,16 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst) HDprintf(" %02x", saved[j*src_size+ENDIAN(src_size,k,sendian)]); HDprintf("%*s", (int)(3*MAX(0, (ssize_t)dst_size-(ssize_t)src_size)), ""); if (FLT_FLOAT==src_type) { - float x = 0.; + float x = 0.0; HDmemcpy(&x, &saved[j*src_size], sizeof(float)); HDprintf(" %29.20e\n", (double)x); } else if (FLT_DOUBLE==src_type) { - double x = 0.; + double x = 0.0; HDmemcpy(&x, &saved[j*src_size], sizeof(double)); HDprintf(" %29.20e\n", x); #if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE } else { - long double x = 0.; + long double x = 0.0; HDmemcpy(&x, &saved[j*src_size], sizeof(long double)); HDfprintf(stdout," %29.20Le\n", x); #endif @@ -3285,16 +3285,16 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst) HDprintf(" %02x", buf[j*dst_size+ENDIAN(dst_size,k,dendian)]); HDprintf("%*s", (int)(3*MAX(0, (ssize_t)src_size-(ssize_t)dst_size)), ""); if (FLT_FLOAT==dst_type) { - float x = 0.; + float x = 0.0; HDmemcpy(&x, &buf[j*dst_size], sizeof(float)); HDprintf(" %29.20e\n", (double)x); } else if (FLT_DOUBLE==dst_type) { - double x = 0.; + double x = 0.0; HDmemcpy(&x, &buf[j*dst_size], sizeof(double)); HDprintf(" %29.20e\n", x); #if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE } else { - long double x = 0.; + long double x = 0.0; HDmemcpy(&x, &buf[j*dst_size], sizeof(long double)); HDfprintf(stdout," %29.20Le\n", x); #endif diff --git a/test/dtypes.c b/test/dtypes.c index 0f95830..e96e826 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, December 9, 1997 * * Purpose: Tests the datatype interface (H5T) @@ -134,10 +134,8 @@ typedef enum { static int num_opaque_conversions_g = 0; static int opaque_check(int tag_it); -static herr_t convert_opaque(hid_t st, hid_t dt, - H5T_cdata_t *cdata, - size_t nelmts, size_t buf_stride, - size_t bkg_stride, void *_buf, +static herr_t convert_opaque(hid_t st, hid_t dt, H5T_cdata_t *cdata, + size_t nelmts, size_t buf_stride, size_t bkg_stride, void *_buf, void *bkg, hid_t dset_xfer_plid); static int opaque_long(void); static int opaque_funcs(void); @@ -146,16 +144,13 @@ static int opaque_funcs(void); /*------------------------------------------------------------------------- * Function: reset_hdf5 * - * Purpose: Reset the hdf5 library. This causes statistics to be printed - * and counters to be reset. + * Purpose: Reset the hdf5 library. This causes statistics to be printed + * and counters to be reset. * - * Return: void + * Return: void * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, November 16, 1998 - * - * Modifications: - * *------------------------------------------------------------------------- */ static void @@ -189,14 +184,10 @@ reset_hdf5(void) * Purpose: Test type classes * * Return: Success: 0 - * * Failure: number of errors * * Programmer: Robb Matzke * Tuesday, December 9, 1997 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -290,20 +281,16 @@ test_classes(void) * Purpose: Are we able to copy a datatype? * * Return: Success: 0 - * * Failure: number of errors * * Programmer: Robb Matzke * Tuesday, December 9, 1997 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int test_copy(void) { - hid_t a_copy; + hid_t a_copy; herr_t status; TESTING("H5Tcopy()"); @@ -313,12 +300,12 @@ test_copy(void) /* We should not be able to close a built-in byte */ H5E_BEGIN_TRY { - status = H5Tclose (H5T_NATIVE_SCHAR); + status = H5Tclose (H5T_NATIVE_SCHAR); } H5E_END_TRY; if (status>=0) { - H5_FAILED(); - HDputs (" Should not be able to close a predefined type!"); - goto error; + H5_FAILED(); + HDputs (" Should not be able to close a predefined type!"); + goto error; } PASSED(); @@ -336,7 +323,6 @@ test_copy(void) * in nested types) * * Return: Success: 0 - * * Failure: number of errors * * Programmer: Quincey Koziol @@ -512,14 +498,10 @@ error: * Purpose: Tests various things about compound datatypes. * * Return: Success: 0 - * * Failure: number of errors * * Programmer: Robb Matzke * Wednesday, January 7, 1998 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -673,38 +655,34 @@ error: /*------------------------------------------------------------------------- * Function: test_compound_2 * - * Purpose: Tests a compound type conversion where the source and - * destination are the same except for the order of the - * elements. - * - * Return: Success: 0 + * Purpose: Tests a compound type conversion where the source and + * destination are the same except for the order of the + * elements. * - * Failure: number of errors + * Return: Success: 0 + * Failure: number of errors * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, June 17, 1999 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int test_compound_2(void) { struct st { - int a, b, c[4], d, e; + int a, b, c[4], d, e; } *s_ptr; struct dt { - int e, d, c[4], b, a; + int e, d, c[4], b, a; } *d_ptr; const size_t nelmts = NTESTELEM; - const hsize_t four = 4; - unsigned char *buf=NULL, *orig=NULL, *bkg=NULL; - hid_t st=-1, dt=-1; - hid_t array_dt; - int64_t nmembs; - int i; + const hsize_t four = 4; + unsigned char *buf=NULL, *orig=NULL, *bkg=NULL; + hid_t st=-1, dt=-1; + hid_t array_dt; + int64_t nmembs; + int i; TESTING("compound element reordering"); @@ -716,15 +694,15 @@ test_compound_2(void) bkg = (unsigned char*)HDmalloc(nelmts * sizeof(struct dt)); orig = (unsigned char*)HDmalloc(nelmts * sizeof(struct st)); for (i=0; i<(int)nelmts; i++) { - s_ptr = ((struct st*)((void *)orig)) + i; - s_ptr->a = i*8+0; - s_ptr->b = i*8+1; - s_ptr->c[0] = i*8+2; - s_ptr->c[1] = i*8+3; - s_ptr->c[2] = i*8+4; - s_ptr->c[3] = i*8+5; - s_ptr->d = i*8+6; - s_ptr->e = i*8+7; + s_ptr = ((struct st*)((void *)orig)) + i; + s_ptr->a = i*8+0; + s_ptr->b = i*8+1; + s_ptr->c[0] = i*8+2; + s_ptr->c[1] = i*8+3; + s_ptr->c[2] = i*8+4; + s_ptr->c[3] = i*8+5; + s_ptr->d = i*8+6; + s_ptr->e = i*8+7; } HDmemcpy(buf, orig, nelmts*sizeof(struct st)); @@ -754,26 +732,26 @@ test_compound_2(void) /* Compare results */ for (i=0; i<(int)nelmts; i++) { - s_ptr = ((struct st*)((void *)orig)) + i; - d_ptr = ((struct dt*)((void *)buf)) + i; - if (s_ptr->a != d_ptr->a || - s_ptr->b != d_ptr->b || - s_ptr->c[0] != d_ptr->c[0] || - s_ptr->c[1] != d_ptr->c[1] || - s_ptr->c[2] != d_ptr->c[2] || - s_ptr->c[3] != d_ptr->c[3] || - s_ptr->d != d_ptr->d || - s_ptr->e != d_ptr->e) { - H5_FAILED(); - HDprintf(" i=%d\n", i); - HDprintf(" src={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n", - s_ptr->a, s_ptr->b, s_ptr->c[0], s_ptr->c[1], s_ptr->c[2], - s_ptr->c[3], s_ptr->d, s_ptr->e); - HDprintf(" dst={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n", - d_ptr->a, d_ptr->b, d_ptr->c[0], d_ptr->c[1], d_ptr->c[2], - d_ptr->c[3], d_ptr->d, d_ptr->e); - goto error; - } + s_ptr = ((struct st*)((void *)orig)) + i; + d_ptr = ((struct dt*)((void *)buf)) + i; + if (s_ptr->a != d_ptr->a || + s_ptr->b != d_ptr->b || + s_ptr->c[0] != d_ptr->c[0] || + s_ptr->c[1] != d_ptr->c[1] || + s_ptr->c[2] != d_ptr->c[2] || + s_ptr->c[3] != d_ptr->c[3] || + s_ptr->d != d_ptr->d || + s_ptr->e != d_ptr->e) { + H5_FAILED(); + HDprintf(" i=%d\n", i); + HDprintf(" src={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n", + s_ptr->a, s_ptr->b, s_ptr->c[0], s_ptr->c[1], s_ptr->c[2], + s_ptr->c[3], s_ptr->d, s_ptr->e); + HDprintf(" dst={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n", + d_ptr->a, d_ptr->b, d_ptr->c[0], d_ptr->c[1], d_ptr->c[2], + d_ptr->c[3], d_ptr->d, d_ptr->e); + goto error; + } } /* Release resources */ @@ -804,29 +782,25 @@ error: /*------------------------------------------------------------------------- * Function: test_compound_3 * - * Purpose: Tests compound conversions where the source and destination - * are the same except the destination is missing a couple - * members which appear in the source. + * Purpose: Tests compound conversions where the source and destination + * are the same except the destination is missing a couple + * members which appear in the source. * - * Return: Success: 0 - * - * Failure: number of errors + * Return: Success: 0 + * Failure: number of errors * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, June 17, 1999 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int test_compound_3(void) { struct st { - int a, b, c[4], d, e; + int a, b, c[4], d, e; } *s_ptr; - struct dt { - int a, c[4], e; + struct dt { + int a, c[4], e; } *d_ptr; const size_t nelmts = NTESTELEM; @@ -884,24 +858,24 @@ test_compound_3(void) /* Compare results */ for (i=0; i<(int)nelmts; i++) { - s_ptr = ((struct st*)((void *)orig)) + i; - d_ptr = ((struct dt*)((void *)buf)) + i; - if (s_ptr->a != d_ptr->a || - s_ptr->c[0] != d_ptr->c[0] || - s_ptr->c[1] != d_ptr->c[1] || - s_ptr->c[2] != d_ptr->c[2] || - s_ptr->c[3] != d_ptr->c[3] || - s_ptr->e != d_ptr->e) { - H5_FAILED(); - HDprintf(" i=%d\n", i); - HDprintf(" src={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n", - s_ptr->a, s_ptr->b, s_ptr->c[0], s_ptr->c[1], s_ptr->c[2], - s_ptr->c[3], s_ptr->d, s_ptr->e); - HDprintf(" dst={a=%d, c=[%d,%d,%d,%d], e=%d\n", - d_ptr->a, d_ptr->c[0], d_ptr->c[1], d_ptr->c[2], - d_ptr->c[3], d_ptr->e); - goto error; - } + s_ptr = ((struct st*)((void *)orig)) + i; + d_ptr = ((struct dt*)((void *)buf)) + i; + if (s_ptr->a != d_ptr->a || + s_ptr->c[0] != d_ptr->c[0] || + s_ptr->c[1] != d_ptr->c[1] || + s_ptr->c[2] != d_ptr->c[2] || + s_ptr->c[3] != d_ptr->c[3] || + s_ptr->e != d_ptr->e) { + H5_FAILED(); + HDprintf(" i=%d\n", i); + HDprintf(" src={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n", + s_ptr->a, s_ptr->b, s_ptr->c[0], s_ptr->c[1], s_ptr->c[2], + s_ptr->c[3], s_ptr->d, s_ptr->e); + HDprintf(" dst={a=%d, c=[%d,%d,%d,%d], e=%d\n", + d_ptr->a, d_ptr->c[0], d_ptr->c[1], d_ptr->c[2], + d_ptr->c[3], d_ptr->e); + goto error; + } } /* Release resources */ @@ -931,19 +905,15 @@ error: /*------------------------------------------------------------------------- * Function: test_compound_4 * - * Purpose: Tests compound conversions when the destination has the same - * fields as the source but one or more of the fields are - * smaller. + * Purpose: Tests compound conversions when the destination has the same + * fields as the source but one or more of the fields are + * smaller. * - * Return: Success: 0 - * - * Failure: number of errors + * Return: Success: 0 + * Failure: number of errors * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, June 17, 1999 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -951,13 +921,13 @@ test_compound_4(void) { struct st { - int a, b, c[4], d, e; + int a, b, c[4], d, e; } *s_ptr; struct dt { - short b; - int a, c[4]; - short d; - int e; + short b; + int a, c[4]; + short d; + int e; } *d_ptr; const size_t nelmts = NTESTELEM; @@ -1017,26 +987,26 @@ test_compound_4(void) /* Compare results */ for (i=0; i<(int)nelmts; i++) { - s_ptr = ((struct st*)((void *)orig)) + i; - d_ptr = ((struct dt*)((void *)buf)) + i; - if (s_ptr->a != d_ptr->a || - s_ptr->b != d_ptr->b || - s_ptr->c[0] != d_ptr->c[0] || - s_ptr->c[1] != d_ptr->c[1] || - s_ptr->c[2] != d_ptr->c[2] || - s_ptr->c[3] != d_ptr->c[3] || - s_ptr->d != d_ptr->d || - s_ptr->e != d_ptr->e) { - H5_FAILED(); - HDprintf(" i=%d\n", i); - HDprintf(" src={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n", - s_ptr->a, s_ptr->b, s_ptr->c[0], s_ptr->c[1], s_ptr->c[2], - s_ptr->c[3], s_ptr->d, s_ptr->e); - HDprintf(" dst={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n", - d_ptr->a, d_ptr->b, d_ptr->c[0], d_ptr->c[1], d_ptr->c[2], - d_ptr->c[3], d_ptr->d, d_ptr->e); - goto error; - } + s_ptr = ((struct st*)((void *)orig)) + i; + d_ptr = ((struct dt*)((void *)buf)) + i; + if (s_ptr->a != d_ptr->a || + s_ptr->b != d_ptr->b || + s_ptr->c[0] != d_ptr->c[0] || + s_ptr->c[1] != d_ptr->c[1] || + s_ptr->c[2] != d_ptr->c[2] || + s_ptr->c[3] != d_ptr->c[3] || + s_ptr->d != d_ptr->d || + s_ptr->e != d_ptr->e) { + H5_FAILED(); + HDprintf(" i=%d\n", i); + HDprintf(" src={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n", + s_ptr->a, s_ptr->b, s_ptr->c[0], s_ptr->c[1], s_ptr->c[2], + s_ptr->c[3], s_ptr->d, s_ptr->e); + HDprintf(" dst={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n", + d_ptr->a, d_ptr->b, d_ptr->c[0], d_ptr->c[1], d_ptr->c[2], + d_ptr->c[3], d_ptr->d, d_ptr->e); + goto error; + } } /* Release resources */ @@ -1066,20 +1036,16 @@ error: /*------------------------------------------------------------------------- * Function: test_compound_5 * - * Purpose: Many versions of HDF5 have a bug in the optimized compound + * Purpose: Many versions of HDF5 have a bug in the optimized compound * datatype conversion function, H5T_conv_struct_opt(), which * is triggered when the top-level type contains a struct * which must undergo a conversion. * - * Return: Success: 0 - * - * Failure: number of errors + * Return: Success: 0 + * Failure: number of errors * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, June 17, 1999 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -1156,7 +1122,8 @@ test_compound_5(void) src[1].coll_ids[2]!=dst[1].coll_ids[2] || src[1].coll_ids[3]!=dst[1].coll_ids[3]) { H5_FAILED(); - } else { + } + else { PASSED(); retval = 0; } @@ -1171,19 +1138,15 @@ test_compound_5(void) /*------------------------------------------------------------------------- * Function: test_compound_6 * - * Purpose: Tests compound conversions when the destination has the same - * fields as the source but one or more of the fields are - * larger. + * Purpose: Tests compound conversions when the destination has the same + * fields as the source but one or more of the fields are + * larger. * - * Return: Success: 0 - * - * Failure: number of errors + * Return: Success: 0 + * Failure: number of errors * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Wednesday, December 13, 2000 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -1244,18 +1207,18 @@ test_compound_6(void) /* Compare results */ for (i=0; i<(int)nelmts; i++) { - s_ptr = ((struct st*)((void *)orig)) + i; - d_ptr = ((struct dt*)((void *)buf)) + i; - if (s_ptr->b != d_ptr->b || - s_ptr->d != d_ptr->d) { - H5_FAILED(); - HDprintf(" i=%d\n", i); - HDprintf(" src={b=%d, d=%d\n", - (int)s_ptr->b, (int)s_ptr->d); - HDprintf(" dst={b=%ld, d=%ld\n", - d_ptr->b, d_ptr->d); - goto error; - } + s_ptr = ((struct st*)((void *)orig)) + i; + d_ptr = ((struct dt*)((void *)buf)) + i; + if (s_ptr->b != d_ptr->b || + s_ptr->d != d_ptr->d) { + H5_FAILED(); + HDprintf(" i=%d\n", i); + HDprintf(" src={b=%d, d=%d\n", + (int)s_ptr->b, (int)s_ptr->d); + HDprintf(" dst={b=%ld, d=%ld\n", + d_ptr->b, d_ptr->d); + goto error; + } } /* Release resources */ @@ -1284,15 +1247,14 @@ error: /*------------------------------------------------------------------------- * Function: test_compound_7 * - * Purpose: Tests inserting fields into compound datatypes when the field + * Purpose: Tests inserting fields into compound datatypes when the field * overlaps the end of the compound datatype. Also, tests * increasing compound type size. * - * Return: Success: 0 - * - * Failure: number of errors + * Return: Success: 0 + * Failure: number of errors * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, December 18, 2001 * * Modifications: @@ -1686,9 +1648,6 @@ test_compound_8(void) * * Programmer: Raymond Lu * Wednesday, June 9, 2004 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -4758,17 +4717,13 @@ test_conv_enum_2(void) /*------------------------------------------------------------------------- * Function: test_conv_bitfield * - * Purpose: Test bitfield conversions. - * - * Return: Success: 0 + * Purpose: Test bitfield conversions. * - * Failure: number of errors + * Return: Success: 0 + * Failure: number of errors * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, May 20, 1999 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -4790,10 +4745,9 @@ test_conv_bitfield(void) buf[2] = buf[3] = 0x55; /*irrelevant*/ if (H5Tconvert(st, dt, (size_t)1, buf, NULL, H5P_DEFAULT) < 0) goto error; if (buf[0]!=0xAA || buf[1]!=0xAA || buf[2]!=0 || buf[3]!=0) { - H5_FAILED(); - printf(" s=0xaaaa, d=0x%02x%02x%02x%02x (test 1)\n", - buf[3], buf[2], buf[1], buf[0]); - goto error; + H5_FAILED(); + HDprintf(" s=0xaaaa, d=0x%02x%02x%02x%02x (test 1)\n", buf[3], buf[2], buf[1], buf[0]); + goto error; } /* @@ -4809,10 +4763,9 @@ test_conv_bitfield(void) buf[0] = 0xA8; buf[1] = 0x2A; buf[2] = buf[3] = 0; if (H5Tconvert(st, dt, (size_t)1, buf, NULL, H5P_DEFAULT) < 0) goto error; if (buf[0]!=0 || buf[1]!=0xA8 || buf[2]!=0x2A || buf[3]!=0) { - H5_FAILED(); - printf(" s=0x2AA8 d=0x%02x%02x%02x%02x (test 2)\n", - buf[3], buf[2], buf[1], buf[0]); - goto error; + H5_FAILED(); + HDprintf(" s=0x2AA8 d=0x%02x%02x%02x%02x (test 2)\n", buf[3], buf[2], buf[1], buf[0]); + goto error; } /* @@ -4823,10 +4776,9 @@ test_conv_bitfield(void) buf[0] = 0xA8; buf[1] = 0x2A; buf[2] = buf[3] = 0; if (H5Tconvert(st, dt, (size_t)1, buf, NULL, H5P_DEFAULT) < 0) goto error; if (buf[0]!=0xff || buf[1]!=0xAB || buf[2]!=0xEA || buf[3]!=0xff) { - H5_FAILED(); - printf(" s=0x2AA8 d=0x%02x%02x%02x%02x (test 3)\n", - buf[3], buf[2], buf[1], buf[0]); - goto error; + H5_FAILED(); + HDprintf(" s=0x2AA8 d=0x%02x%02x%02x%02x (test 3)\n", buf[3], buf[2], buf[1], buf[0]); + goto error; } H5Tclose(st); @@ -4855,18 +4807,14 @@ error: /*------------------------------------------------------------------------- * Function: test_bitfield_funcs * - * Purpose: Test some datatype functions that are and aren't supposed + * Purpose: Test some datatype functions that are and aren't supposed * work for bitfield type. * - * Return: Success: 0 - * - * Failure: number of errors + * Return: Success: 0 + * Failure: number of errors * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Wednesday, April 5, 2006 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -4984,17 +4932,13 @@ error: /*------------------------------------------------------------------------- * Function: convert_opaque * - * Purpose: A fake opaque conversion functions - * - * Return: Success: 0 + * Purpose: A fake opaque conversion functions * - * Failure: -1 + * Return: Success: 0 + * Failure: -1 * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, June 4, 1999 - * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -5003,7 +4947,8 @@ convert_opaque(hid_t H5_ATTR_UNUSED st, hid_t H5_ATTR_UNUSED dt, H5T_cdata_t *cd size_t H5_ATTR_UNUSED bkg_stride, void H5_ATTR_UNUSED *_buf, void H5_ATTR_UNUSED *bkg, hid_t H5_ATTR_UNUSED dset_xfer_plid) { - if (H5T_CONV_CONV==cdata->command) num_opaque_conversions_g++; + if (H5T_CONV_CONV==cdata->command) + num_opaque_conversions_g++; return 0; } @@ -5011,17 +4956,13 @@ convert_opaque(hid_t H5_ATTR_UNUSED st, hid_t H5_ATTR_UNUSED dt, H5T_cdata_t *cd /*------------------------------------------------------------------------- * Function: test_opaque * - * Purpose: Driver function to test opaque datatypes - * - * Return: Success: 0 + * Purpose: Driver function to test opaque datatypes * - * Failure: number of errors + * Return: Success: 0 + * Failure: number of errors * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * June 2, 2004 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -5054,25 +4995,23 @@ test_opaque(void) /*------------------------------------------------------------------------- * Function: opaque_check * - * Purpose: Test opaque datatypes - * - * Return: Success: 0 + * Purpose: Test opaque datatypes * - * Failure: number of errors + * Return: Success: 0 + * Failure: number of errors * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, May 20, 1999 - * *------------------------------------------------------------------------- */ static int opaque_check(int tag_it) { #define OPAQUE_NELMTS 1000 - hid_t st=-1, dt=-1; + hid_t st=-1, dt=-1; herr_t status; - char buf[1]; /*not really used*/ - int saved; + char buf[1]; /*not really used*/ + int saved; saved = num_opaque_conversions_g = 0; @@ -5088,29 +5027,29 @@ opaque_check(int tag_it) /* Make sure that we can't convert between the types yet */ H5E_BEGIN_TRY { - status = H5Tconvert(st, dt, (size_t)OPAQUE_NELMTS, buf, NULL, H5P_DEFAULT); + status = H5Tconvert(st, dt, (size_t)OPAQUE_NELMTS, buf, NULL, H5P_DEFAULT); } H5E_END_TRY; if (status>=0) { - H5_FAILED(); - printf(" opaque conversion should have failed but succeeded\n"); - goto error; + H5_FAILED(); + HDprintf(" opaque conversion should have failed but succeeded\n"); + goto error; } /* Register a conversion function */ if (H5Tregister(H5T_PERS_HARD, "o_test", st, dt, convert_opaque) < 0) - goto error; + goto error; /* Try the conversion again, this time it should work */ if (H5Tconvert(st, dt, (size_t)OPAQUE_NELMTS, buf, NULL, H5P_DEFAULT) < 0) goto error; if (saved+1 != num_opaque_conversions_g) { - H5_FAILED(); - printf(" unexpected number of opaque conversions\n"); - goto error; + H5_FAILED(); + HDprintf(" unexpected number of opaque conversions\n"); + goto error; } /* Unregister conversion function */ if (H5Tunregister(H5T_PERS_HARD, "o_test", st, dt, convert_opaque) < 0) - goto error; + goto error; H5Tclose(st); H5Tclose(dt); @@ -5127,12 +5066,12 @@ opaque_check(int tag_it) /*------------------------------------------------------------------------- * Function: opaque_long * - * Purpose: Test named (committed) opaque datatypes w/very long tags + * Purpose: Test named (committed) opaque datatypes w/very long tags * - * Return: Success: 0 - * Failure: number of errors + * Return: Success: 0 + * Failure: number of errors * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, June 14, 2005 * *------------------------------------------------------------------------- @@ -5142,7 +5081,7 @@ opaque_long(void) { char *long_tag = NULL; hid_t dt = -1; - herr_t ret; + herr_t ret; /* Build opaque type */ if((dt=H5Tcreate(H5T_OPAQUE, (size_t)4)) < 0) TEST_ERROR @@ -5154,7 +5093,7 @@ opaque_long(void) /* Set opaque type's tag */ H5E_BEGIN_TRY { - ret = H5Tset_tag(dt, long_tag); + ret = H5Tset_tag(dt, long_tag); } H5E_END_TRY; if(ret != FAIL) TEST_ERROR @@ -5179,24 +5118,20 @@ error: /*------------------------------------------------------------------------- * Function: opaque_funcs * - * Purpose: Test some type functions that are and aren't supposed to + * Purpose: Test some type functions that are and aren't supposed to * work with opaque type. * - * Return: Success: 0 - * - * Failure: number of errors + * Return: Success: 0 + * Failure: number of errors * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Wednesday, April 5, 2006 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int opaque_funcs(void) { - hid_t type = -1, super=-1; + hid_t type = -1, super=-1; size_t size; H5T_pad_t inpad; H5T_cset_t cset; @@ -5803,7 +5738,7 @@ test_encode(void) } H5E_BEGIN_TRY { - ret = H5Tclose(decoded_tid3); + ret = H5Tclose(decoded_tid3); } H5E_END_TRY; if(ret!=FAIL) { H5_FAILED(); @@ -6102,14 +6037,13 @@ static int test_int_float_except(void) { #if H5_SIZEOF_INT==4 && H5_SIZEOF_FLOAT==4 - float buf[CONVERT_SIZE] = {(float)INT_MIN - 172.0f, (float)INT_MAX - 32.0f, - (float)INT_MAX - 68.0f, (float)4.5f}; - int buf_int[CONVERT_SIZE] = {INT_MIN, INT_MAX, INT_MAX-127, 4}; + float buf[CONVERT_SIZE] = {(float)INT_MIN - 172.0f, (float)INT_MAX - 32.0f, (float)INT_MAX - 68.0f, (float)4.5f}; + int buf_int[CONVERT_SIZE] = {INT_MIN, INT_MAX, INT_MAX-127, 4}; float buf_float[CONVERT_SIZE] = {(float)INT_MIN, (float)INT_MAX + 1.0f, (float)INT_MAX - 127.0f, 4}; - int *intp; /* Pointer to buffer, as integers */ - int buf2[CONVERT_SIZE] = {INT_MIN, INT_MAX, INT_MAX - 72, 0}; + int *intp; /* Pointer to buffer, as integers */ + int buf2[CONVERT_SIZE] = {INT_MIN, INT_MAX, INT_MAX - 72, 0}; float buf2_float[CONVERT_SIZE] = {(float)INT_MIN, (float)INT_MAX, (float)INT_MAX - 127.0f, (float)0.0f}; - int buf2_int[CONVERT_SIZE] = {INT_MIN, INT_MAX, INT_MAX - 127, 0}; + int buf2_int[CONVERT_SIZE] = {INT_MIN, INT_MAX, INT_MAX - 127, 0}; float *floatp; /* Pointer to buffer #2, as floats */ hid_t dxpl; /* Dataset transfer property list */ except_info_t e; /* Exception information */ @@ -6165,8 +6099,8 @@ test_int_float_except(void) /* Convert second buffer */ HDmemset(&e, 0, sizeof(except_info_t)); - if(H5Tconvert(H5T_NATIVE_INT, H5T_NATIVE_FLOAT, (size_t)CONVERT_SIZE, - buf2, NULL, dxpl) < 0) TEST_ERROR + if(H5Tconvert(H5T_NATIVE_INT, H5T_NATIVE_FLOAT, (size_t)CONVERT_SIZE, buf2, NULL, dxpl) < 0) + TEST_ERROR /* Check the buffer after conversion, as floats */ for(u = 0; u < CONVERT_SIZE; u++) { @@ -6183,8 +6117,8 @@ test_int_float_except(void) /* Convert buffer */ HDmemset(&e, 0, sizeof(except_info_t)); - if(H5Tconvert(H5T_NATIVE_FLOAT, H5T_NATIVE_INT, (size_t)CONVERT_SIZE, - buf2, NULL, dxpl) < 0) TEST_ERROR + if(H5Tconvert(H5T_NATIVE_FLOAT, H5T_NATIVE_INT, (size_t)CONVERT_SIZE, buf2, NULL, dxpl) < 0) + TEST_ERROR /* Check the buffer after conversion, as integers */ for(u = 0; u < CONVERT_SIZE; u++) { @@ -6415,7 +6349,7 @@ test_set_order_compound(hid_t fapl) hid_t cmpd = -1, memb_cmpd = -1, memb_array1 = -1, memb_array2 = -1, cmpd_array = -1; hid_t vl_id = -1; hsize_t dims[2] = {3, 4}; /* Array dimenstions */ - char filename[1024]; + char filename[1024]; herr_t ret; /* Generic return value */ TESTING("H5Tset/get_order for compound type"); @@ -6521,18 +6455,14 @@ error: /*------------------------------------------------------------------------- * Function: test_named_indirect_reopen * - * Purpose: Tests that open named datatypes can be reopened indirectly + * Purpose: Tests that open named datatypes can be reopened indirectly * through H5Dget_type without causing problems. * - * Return: Success: 0 - * - * Failure: number of errors + * Return: Success: 0 + * Failure: number of errors * - * Programmer: Neil Fortner + * Programmer: Neil Fortner * Thursday, June 4, 2009 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -6540,11 +6470,11 @@ test_named_indirect_reopen(hid_t fapl) { hid_t file=-1, type=-1, reopened_type=-1, strtype=-1, dset=-1, space=-1; static hsize_t dims[1] = {3}; - size_t dt_size; - int enum_value; - const char *tag = "opaque_tag"; - char *tag_ret = NULL; - char filename[1024]; + size_t dt_size; + int enum_value; + const char *tag = "opaque_tag"; + char *tag_ret = NULL; + char filename[1024]; TESTING("indirectly reopening committed datatypes"); @@ -6708,11 +6638,11 @@ test_named_indirect_reopen(hid_t fapl) error: H5E_BEGIN_TRY { - H5Tclose(type); - H5Tclose(strtype); - H5Tclose(reopened_type); - H5Sclose(space); - H5Dclose(dset); + H5Tclose(type); + H5Tclose(strtype); + H5Tclose(reopened_type); + H5Sclose(space); + H5Dclose(dset); H5Fclose(file); } H5E_END_TRY; if(tag_ret) @@ -6912,12 +6842,12 @@ test_delete_obj_named(hid_t fapl) error: H5E_BEGIN_TRY { - H5Tclose(attr); - H5Dclose(dset); - H5Pclose(fapl2); - H5Fclose(filea1); - H5Fclose(filea2); - H5Fclose(fileb); + H5Tclose(attr); + H5Dclose(dset); + H5Pclose(fapl2); + H5Fclose(filea1); + H5Fclose(filea2); + H5Fclose(fileb); } H5E_END_TRY; return 1; } /* end test_delete_obj_named() */ @@ -7075,15 +7005,15 @@ test_delete_obj_named_fileid(hid_t fapl) error: H5E_BEGIN_TRY { - H5Aclose(attr); - H5Tclose(type); - H5Dclose(dset); - H5Pclose(fapl2); - H5Fclose(filea1); - H5Fclose(filea2); - H5Fclose(fileb); - H5Fclose(attr_fid); - H5Fclose(type_fid); + H5Aclose(attr); + H5Tclose(type); + H5Dclose(dset); + H5Pclose(fapl2); + H5Fclose(filea1); + H5Fclose(filea2); + H5Fclose(fileb); + H5Fclose(attr_fid); + H5Fclose(type_fid); } H5E_END_TRY; return 1; } /* end test_delete_obj_named_fileid() */ @@ -7092,12 +7022,12 @@ error: /*------------------------------------------------------------------------- * Function: test_deprec * - * Purpose: Tests deprecated API routines for datatypes. + * Purpose: Tests deprecated API routines for datatypes. * - * Return: Success: 0 - * Failure: number of errors + * Return: Success: 0 + * Failure: number of errors * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, September 27, 2007 * *------------------------------------------------------------------------- @@ -7167,31 +7097,31 @@ test_deprec(hid_t fapl) /* Predefined types cannot be committed */ H5E_BEGIN_TRY { - status = H5Tcommit1(file, "test_named_1 (should not exist)", H5T_NATIVE_INT); + status = H5Tcommit1(file, "test_named_1 (should not exist)", H5T_NATIVE_INT); } H5E_END_TRY; if(status >= 0) - FAIL_PUTS_ERROR(" Predefined types should not be committable!") + FAIL_PUTS_ERROR(" Predefined types should not be committable!") /* Copy a predefined datatype and commit the copy */ if((type = H5Tcopy(H5T_NATIVE_INT)) < 0) FAIL_STACK_ERROR if(H5Tcommit1(file, "native-int", type) < 0) FAIL_STACK_ERROR if((status = H5Tcommitted(type)) < 0) FAIL_STACK_ERROR if(0 == status) - FAIL_PUTS_ERROR(" H5Tcommitted() returned false!") + FAIL_PUTS_ERROR(" H5Tcommitted() returned false!") /* We should not be able to modify a type after it has been committed. */ H5E_BEGIN_TRY { - status = H5Tset_precision(type, (size_t)256); + status = H5Tset_precision(type, (size_t)256); } H5E_END_TRY; if(status >= 0) - FAIL_PUTS_ERROR(" Committed type is not constant!") + FAIL_PUTS_ERROR(" Committed type is not constant!") /* We should not be able to re-commit a committed type */ H5E_BEGIN_TRY { - status = H5Tcommit1(file, "test_named_2 (should not exist)", type); + status = H5Tcommit1(file, "test_named_2 (should not exist)", type); } H5E_END_TRY; if(status >= 0) - FAIL_PUTS_ERROR(" Committed types should not be recommitted!") + FAIL_PUTS_ERROR(" Committed types should not be recommitted!") /* * Close the committed type and reopen it. It should return a named type. @@ -7200,7 +7130,7 @@ test_deprec(hid_t fapl) if((type = H5Topen1(file, "native-int")) < 0) FAIL_STACK_ERROR if((status = H5Tcommitted(type)) < 0) FAIL_STACK_ERROR if(!status) - FAIL_PUTS_ERROR(" Opened named types should be named types!") + FAIL_PUTS_ERROR(" Opened named types should be named types!") /* Close */ if(H5Tclose(type) < 0) FAIL_STACK_ERROR @@ -7230,8 +7160,8 @@ test_deprec(hid_t fapl) error: H5E_BEGIN_TRY { - H5Tclose(type); - H5Fclose(file); + H5Tclose(type); + H5Fclose(file); } H5E_END_TRY; return 1; } /* end test_deprec() */ @@ -7241,13 +7171,13 @@ error: /*------------------------------------------------------------------------- * Function: test_utf_ascii_conv * - * Purpose: Make sure the library doesn't conversion strings between + * Purpose: Make sure the library doesn't conversion strings between * ASCII and UTF8. * - * Return: Success: 0 - * Failure: number of errors + * Return: Success: 0 + * Failure: number of errors * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * 10 November 2011 *------------------------------------------------------------------------- */ @@ -7437,13 +7367,13 @@ test_utf_ascii_conv(void) error: H5E_BEGIN_TRY { - H5Tclose(utf8_vtid); - H5Tclose(ascii_vtid); - H5Tclose(utf8_tid); - H5Tclose(ascii_tid); - H5Dclose(did); - H5Sclose(sid); - H5Fclose(fid); + H5Tclose(utf8_vtid); + H5Tclose(ascii_vtid); + H5Tclose(utf8_tid); + H5Tclose(ascii_tid); + H5Dclose(did); + H5Sclose(sid); + H5Fclose(fid); } H5E_END_TRY; return 1; } @@ -7827,16 +7757,13 @@ error: * * Programmer: Robb Matzke * Tuesday, December 9, 1997 - * - * Modifications: - * *------------------------------------------------------------------------- */ int main(void) { long nerrors = 0; - hid_t fapl = -1; + hid_t fapl = H5I_INVALID_HID; /* Set the random # seed */ HDsrandom((unsigned)HDtime(NULL)); @@ -7845,7 +7772,7 @@ main(void) fapl = h5_fileaccess(); if(ALIGNMENT) - printf("Testing non-aligned conversions (ALIGNMENT=%d)....\n", ALIGNMENT); + HDprintf("Testing non-aligned conversions (ALIGNMENT=%d)....\n", ALIGNMENT); /* Do the tests */ nerrors += test_classes(); @@ -7900,8 +7827,7 @@ main(void) nerrors += test_versionbounds(); if(nerrors) { - HDprintf("***** %lu FAILURE%s! *****\n", - nerrors, 1==nerrors?"":"S"); + HDprintf("***** %lu FAILURE%s! *****\n", nerrors, 1==nerrors?"":"S"); HDexit(EXIT_FAILURE); } diff --git a/test/earray.c b/test/earray.c index 6597afd..f593212 100644 --- a/test/earray.c +++ b/test/earray.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol +/* Programmer: Quincey Koziol * Tuesday, June 17, 2008 */ #include "h5test.h" @@ -381,10 +381,6 @@ check_stats(const H5EA_t *ea, const earray_state_t *state) TEST_ERROR } /* end if */ #endif /* NOT_YET */ -#ifdef QAK -HDfprintf(stderr, "nelmts = %Hu, total EA size = %Hu\n", earray_stats.stored.nelmts, - (earray_stats.computed.hdr_size + earray_stats.computed.index_blk_size + earray_stats.stored.super_blk_size + earray_stats.stored.data_blk_size)); -#endif /* QAK */ /* All tests passed */ return(0); @@ -560,12 +556,6 @@ finish(hid_t file, hid_t fapl, H5F_t *f, H5EA_t *ea, haddr_t ea_addr) if(H5EA_close(ea) < 0) FAIL_STACK_ERROR -#ifdef QAK -HDfprintf(stderr, "ea_addr = %a\n", ea_addr); -H5Fflush(file, H5F_SCOPE_GLOBAL); -HDsystem("cp earray.h5 earray.h5.save"); -#endif /* QAK */ - /* Delete array */ if(H5EA_delete(f, ea_addr, NULL) < 0) FAIL_STACK_ERROR @@ -1384,19 +1374,8 @@ eiter_fw_state(void *_eiter, const H5EA_create_t *cparam, /* Compute super block index for element index */ /* (same eqn. as in H5EA__dblock_sblk_idx()) */ sblk_idx = H5VM_log2_gen((uint64_t)(((idx - cparam->idx_blk_elmts) / cparam->data_blk_min_elmts) + 1)); -#ifdef QAK -HDfprintf(stderr, "idx = %Hu, tparam->sblk_info[%u] = {%Zu, %Zu, %Hu, %Hu}\n", idx, sblk_idx, tparam->sblk_info[sblk_idx].ndblks, tparam->sblk_info[sblk_idx].dblk_nelmts, tparam->sblk_info[sblk_idx].start_idx, tparam->sblk_info[sblk_idx].start_dblk); -#endif /* QAK */ - state->nelmts = EA_NELMTS(cparam, tparam, idx, sblk_idx); -#ifdef QAK -HDfprintf(stderr, "state->nelmts = %Hu\n", state->nelmts); -#endif /* QAK */ - state->ndata_blks = EA_NDATA_BLKS(cparam, tparam, idx, sblk_idx); -#ifdef QAK -HDfprintf(stderr, "state->ndata_blks = %Hu\n", state->ndata_blks); -#endif /* QAK */ /* Check if we have any super blocks yet */ if(tparam->sblk_info[sblk_idx].ndblks >= cparam->sup_blk_min_data_ptrs) { @@ -1405,9 +1384,6 @@ HDfprintf(stderr, "state->ndata_blks = %Hu\n", state->ndata_blks); eiter->base_sblk_idx = sblk_idx; state->nsuper_blks = (sblk_idx - eiter->base_sblk_idx) + 1; -#ifdef QAK -HDfprintf(stderr, "state->nsuper_blks = %Hu\n", state->nsuper_blks); -#endif /* QAK */ } /* end if */ else state->nsuper_blks = 0; @@ -1619,29 +1595,18 @@ eiter_rv_state(void *_eiter, const H5EA_create_t *cparam, loc_idx = cparam->idx_blk_elmts + tparam->sblk_info[idx_sblk_idx].start_idx - 1; loc_sblk_idx = H5VM_log2_gen((uint64_t)(((loc_idx - cparam->idx_blk_elmts) / cparam->data_blk_min_elmts) + 1)); } /* end else */ -#ifdef QAK -HDfprintf(stderr, "idx = %Hu, loc_idx = %Hu, eiter->max_sblk_idx = %u, idx_sblk_idx = %u, loc_sblk_idx = %u\n", idx, loc_idx, eiter->max_sblk_idx, idx_sblk_idx, loc_sblk_idx); -HDfprintf(stderr, "tparam->sblk_info[%u] = {%Zu, %Zu, %Hu, %Hu}\n", idx_sblk_idx, tparam->sblk_info[idx_sblk_idx].ndblks, tparam->sblk_info[idx_sblk_idx].dblk_nelmts, tparam->sblk_info[idx_sblk_idx].start_idx, tparam->sblk_info[idx_sblk_idx].start_dblk); -HDfprintf(stderr, "tparam->sblk_info[%u] = {%Zu, %Zu, %Hu, %Hu}\n", eiter->max_sblk_idx, tparam->sblk_info[eiter->max_sblk_idx].ndblks, tparam->sblk_info[eiter->max_sblk_idx].dblk_nelmts, tparam->sblk_info[eiter->max_sblk_idx].start_idx, tparam->sblk_info[eiter->max_sblk_idx].start_dblk); -#endif /* QAK */ if(idx < cparam->idx_blk_elmts + cparam->data_blk_min_elmts) idx_nelmts = (hsize_t)cparam->idx_blk_elmts; else idx_nelmts = EA_NELMTS(cparam, tparam, loc_idx, loc_sblk_idx); state->nelmts = (eiter->max_nelmts - idx_nelmts) + cparam->idx_blk_elmts; -#ifdef QAK -HDfprintf(stderr, "eiter->max_nelmts = %Hu, idx_nelmts = %Hu, state->nelmts = %Hu\n", eiter->max_nelmts, idx_nelmts, state->nelmts); -#endif /* QAK */ if(idx < cparam->idx_blk_elmts + cparam->data_blk_min_elmts) idx_ndata_blks = 0; else idx_ndata_blks = EA_NDATA_BLKS(cparam, tparam, loc_idx, loc_sblk_idx); state->ndata_blks = eiter->max_ndata_blks - idx_ndata_blks; -#ifdef QAK -HDfprintf(stderr, "eiter->max_ndata_blks = %Hu, idx_ndata_blks = %Hu, state->ndata_blks = %Hu\n", eiter->max_ndata_blks, idx_ndata_blks, state->ndata_blks); -#endif /* QAK */ /* Check if we have any super blocks yet */ if(tparam->sblk_info[eiter->max_sblk_idx].ndblks >= cparam->sup_blk_min_data_ptrs) { @@ -1649,9 +1614,6 @@ HDfprintf(stderr, "eiter->max_ndata_blks = %Hu, idx_ndata_blks = %Hu, state->nda state->nsuper_blks = (eiter->max_sblk_idx - idx_sblk_idx) + 1; else state->nsuper_blks = (eiter->max_sblk_idx - eiter->idx_blk_nsblks) + 1; -#ifdef QAK -HDfprintf(stderr, "eiter->idx_blk_nsblks = %Hu, state->nsuper_blks = %Hu\n", eiter->idx_blk_nsblks, state->nsuper_blks); -#endif /* QAK */ } /* end if */ } /* end else */ diff --git a/test/enum.c b/test/enum.c index 109f7c3..1933ce1 100644 --- a/test/enum.c +++ b/test/enum.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, December 22, 1998 */ #include "h5test.h" diff --git a/test/extend.c b/test/extend.c index 1e2b5b5..369ad32 100644 --- a/test/extend.c +++ b/test/extend.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, January 30, 1998 * * Purpose: Tests extendible datasets. diff --git a/test/external.c b/test/external.c index d29fb6b..c98c228 100644 --- a/test/external.c +++ b/test/external.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, March 3, 1998 * * Purpose: Tests datasets stored in external raw files. diff --git a/test/external_common.c b/test/external_common.c index a9e600b..85fdfa0 100644 --- a/test/external_common.c +++ b/test/external_common.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Raymond Lu + * Programmer: Raymond Lu * April, 2019 * * Purpose: Private function for external.c and external_env.c diff --git a/test/external_common.h b/test/external_common.h index f02652b..3633ea3 100644 --- a/test/external_common.h +++ b/test/external_common.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Raymond Lu + * Programmer: Raymond Lu * April, 2019 * * Purpose: Private function for external.c and external_env.c diff --git a/test/external_fname.h b/test/external_fname.h index c5111b6..f5aca6d 100644 --- a/test/external_fname.h +++ b/test/external_fname.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * July, 2019 * * Purpose: Private declaration for external.c and external_env.c diff --git a/test/fheap.c b/test/fheap.c index b1a0db0..ed82ce3 100644 --- a/test/fheap.c +++ b/test/fheap.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol +/* Programmer: Quincey Koziol * Friday, February 24, 2006 */ #include "h5test.h" @@ -3195,7 +3195,6 @@ error: return(1); } /* test_reopen_hdr() */ -#ifndef QAK2 /*------------------------------------------------------------------------- * Function: test_man_insert_weird @@ -6237,7 +6236,6 @@ error: } /* test_man_fill_all_4th_recursive_indirect() */ #endif /* ALL_INSERT_TESTS */ -#ifndef QAK /*------------------------------------------------------------------------- * Function: test_man_start_5th_recursive_indirect @@ -6369,9 +6367,7 @@ error: } H5E_END_TRY; return(1); } /* test_man_start_5th_recursive_indirect() */ -#endif /* QAK */ -#ifndef QAK /*------------------------------------------------------------------------- * Function: test_man_remove_bogus @@ -6448,10 +6444,10 @@ test_man_remove_bogus(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpa /* Choose random # seed */ seed = (unsigned long)HDtime(NULL); -#ifdef QAK +#if 0 /* seed = (unsigned long)1155438845; */ HDfprintf(stderr, "Random # seed was: %lu\n", seed); -#endif /* QAK */ +#endif HDsrandom((unsigned)seed); /* Set heap ID to random (non-null) value */ @@ -7270,10 +7266,6 @@ test_man_remove_two_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t TEST_ERROR /* Verify the file is correct size */ -#ifdef QAK -HDfprintf(stderr, "empty_size = %lu\n", (unsigned long)empty_size); -HDfprintf(stderr, "file_size = %lu\n", (unsigned long)file_size); -#endif /* QAK */ if(file_size != empty_size) TEST_ERROR @@ -7573,10 +7565,6 @@ test_man_remove_three_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param TEST_ERROR /* Verify the file is correct size */ -#ifdef QAK -HDfprintf(stderr, "empty_size = %lu\n", (unsigned long)empty_size); -HDfprintf(stderr, "file_size = %lu\n", (unsigned long)file_size); -#endif /* QAK */ if(file_size != empty_size) TEST_ERROR @@ -7720,9 +7708,7 @@ error: return 1; } /* test_man_incr_insert_remove() */ -#endif /* QAK */ -#ifndef QAK /*------------------------------------------------------------------------- * Function: test_man_remove_root_direct @@ -8323,9 +8309,7 @@ error: } H5E_END_TRY; return(1); } /* test_man_remove_3rd_indirect() */ -#endif /* QAK */ -#ifndef QAK /*------------------------------------------------------------------------- * Function: test_man_skip_start_block @@ -9589,9 +9573,6 @@ test_man_fill_2nd_direct_less_one_wrap_start_block_add_skipped(hid_t fapl, H5HF_ * object */ obj_size = (size_t)DBLOCK_SIZE(fh, num_first_indirect_rows - 1) + 1; -#ifdef QAK -HDfprintf(stderr, "obj_size = %Zu\n", obj_size); -#endif /* QAK */ state.man_alloc_size += DBLOCK_SIZE(fh, num_first_indirect_rows); if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids)) TEST_ERROR @@ -9725,9 +9706,6 @@ test_man_fill_direct_skip_2nd_indirect_skip_2nd_block_add_skipped(hid_t fapl, H5 * object */ obj_size = (size_t)DBLOCK_SIZE(fh, num_first_indirect_rows - 1) + 1; -#ifdef QAK -HDfprintf(stderr, "obj_size = %Zu\n", obj_size); -#endif /* QAK */ state.man_alloc_size += DBLOCK_SIZE(fh, num_first_indirect_rows); if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids)) TEST_ERROR @@ -9747,9 +9725,6 @@ HDfprintf(stderr, "obj_size = %Zu\n", obj_size); /* Insert object too large for initial block size in skipped indirect blocks */ obj_size = (size_t)DBLOCK_SIZE(fh, 3) + 1; -#ifdef QAK -HDfprintf(stderr, "obj_size = %Zu\n", obj_size); -#endif /* QAK */ state.man_alloc_size += DBLOCK_SIZE(fh, 4); if(add_obj(fh, (size_t)10, obj_size, &state, &keep_ids)) TEST_ERROR @@ -9760,9 +9735,6 @@ HDfprintf(stderr, "obj_size = %Zu\n", obj_size); /* Insert object to fill space in (medium) block just created */ obj_size = (size_t)DBLOCK_FREE(fh, 4) - obj_size; -#ifdef QAK -HDfprintf(stderr, "obj_size = %Zu\n", obj_size); -#endif /* QAK */ if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids)) TEST_ERROR @@ -10506,9 +10478,6 @@ test_man_fill_2nd_direct_fill_direct_skip_3rd_indirect_start_block_add_skipped(h * object */ obj_size = (size_t)DBLOCK_SIZE(fh, num_first_indirect_rows - 1) + 1; -#ifdef QAK -HDfprintf(stderr, "obj_size = %Zu\n", obj_size); -#endif /* QAK */ state.man_alloc_size += DBLOCK_SIZE(fh, num_first_indirect_rows); if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids)) TEST_ERROR @@ -10627,9 +10596,6 @@ test_man_fill_2nd_direct_fill_direct_skip2_3rd_indirect_start_block_add_skipped( /* Retrieve info about heap */ num_first_indirect_rows = IBLOCK_MAX_DROWS(fh, 1); -#ifdef QAK -HDfprintf(stderr, "num_first_indirect_rows = %u\n", num_first_indirect_rows); -#endif /* QAK */ /* Fill direct blocks in root indirect block */ if(fill_root_direct(fh, fill_size, &state, &keep_ids)) @@ -10660,9 +10626,6 @@ HDfprintf(stderr, "num_first_indirect_rows = %u\n", num_first_indirect_rows); * object */ obj_size = (size_t)DBLOCK_SIZE(fh, num_first_indirect_rows) + 1; -#ifdef QAK -HDfprintf(stderr, "obj_size = %Zu\n", obj_size); -#endif /* QAK */ state.man_alloc_size += DBLOCK_SIZE(fh, num_first_indirect_rows + 1); if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids)) TEST_ERROR @@ -10673,9 +10636,6 @@ HDfprintf(stderr, "obj_size = %Zu\n", obj_size); /* Insert object to fill space in (large) block created */ obj_size = (size_t)DBLOCK_FREE(fh, num_first_indirect_rows + 1) - obj_size; -#ifdef QAK -HDfprintf(stderr, "obj_size = %Zu\n", obj_size); -#endif /* QAK */ if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids)) TEST_ERROR @@ -10829,9 +10789,6 @@ test_man_fill_3rd_direct_less_one_fill_direct_wrap_start_block_add_skipped(hid_t * object */ obj_size = (size_t)DBLOCK_SIZE(fh, num_first_indirect_rows - 1) + 1; -#ifdef QAK -HDfprintf(stderr, "obj_size = %Zu\n", obj_size); -#endif /* QAK */ state.man_alloc_size += DBLOCK_SIZE(fh, num_first_indirect_rows); if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids)) TEST_ERROR @@ -10998,9 +10955,6 @@ test_man_fill_1st_row_3rd_direct_fill_2nd_direct_less_one_wrap_start_block_add_s * object */ obj_size = (size_t)DBLOCK_SIZE(fh, num_first_indirect_rows - 1) + 1; -#ifdef QAK -HDfprintf(stderr, "obj_size = %Zu\n", obj_size); -#endif /* QAK */ state.man_alloc_size += DBLOCK_SIZE(fh, num_first_indirect_rows); if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids)) TEST_ERROR @@ -11155,9 +11109,6 @@ test_man_fill_3rd_direct_fill_direct_skip_start_block_add_skipped(hid_t fapl, H5 * object */ obj_size = (size_t)DBLOCK_SIZE(fh, num_first_indirect_rows - 1) + 1; -#ifdef QAK -HDfprintf(stderr, "obj_size = %Zu\n", obj_size); -#endif /* QAK */ state.man_alloc_size += DBLOCK_SIZE(fh, num_first_indirect_rows); if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids)) TEST_ERROR @@ -11332,9 +11283,6 @@ test_man_fill_3rd_direct_fill_2nd_direct_fill_direct_skip_3rd_indirect_start_blo * object */ obj_size = (size_t)DBLOCK_SIZE(fh, num_first_indirect_rows - 1) + 1; -#ifdef QAK -HDfprintf(stderr, "obj_size = %Zu\n", obj_size); -#endif /* QAK */ state.man_alloc_size += DBLOCK_SIZE(fh, num_first_indirect_rows); if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids)) TEST_ERROR @@ -11544,9 +11492,6 @@ test_man_fill_3rd_direct_fill_2nd_direct_fill_direct_skip_3rd_indirect_two_rows_ * object */ obj_size = (size_t)DBLOCK_SIZE(fh, num_first_indirect_rows - 1) + 1; -#ifdef QAK -HDfprintf(stderr, "obj_size = %Zu\n", obj_size); -#endif /* QAK */ state.man_alloc_size += DBLOCK_SIZE(fh, num_first_indirect_rows); if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids)) TEST_ERROR @@ -11740,9 +11685,6 @@ test_man_fill_3rd_direct_fill_2nd_direct_fill_direct_skip_3rd_indirect_wrap_star * object */ obj_size = (size_t)DBLOCK_SIZE(fh, num_first_indirect_rows - 1) + 1; -#ifdef QAK -HDfprintf(stderr, "obj_size = %Zu\n", obj_size); -#endif /* QAK */ state.man_alloc_size += DBLOCK_SIZE(fh, num_first_indirect_rows); if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids)) TEST_ERROR @@ -11972,9 +11914,6 @@ test_man_fill_4th_direct_less_one_fill_2nd_direct_fill_direct_skip_3rd_indirect_ * object */ obj_size = (size_t)DBLOCK_SIZE(fh, num_first_indirect_rows - 1) + 1; -#ifdef QAK -HDfprintf(stderr, "obj_size = %Zu\n", obj_size); -#endif /* QAK */ state.man_alloc_size += DBLOCK_SIZE(fh, num_first_indirect_rows); if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids)) TEST_ERROR @@ -12043,9 +11982,7 @@ error: } H5E_END_TRY; return(1); } /* test_man_fill_4th_direct_less_one_fill_2nd_direct_fill_direct_skip_3rd_indirect_wrap_start_block_add_skipped() */ -#endif /* QAK */ -#ifndef QAK /*------------------------------------------------------------------------- * Function: test_man_frag_simple @@ -12396,9 +12333,6 @@ test_man_frag_2nd_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t * /* Compute # of bits used in first row */ num_first_indirect_rows = IBLOCK_MAX_DROWS(fh, 1); -#ifdef QAK -HDfprintf(stderr, "num_first_indirect_rows = %u\n", num_first_indirect_rows); -#endif /* QAK */ /* Fill direct blocks in root indirect block */ if(fill_root_direct(fh, fill_size, &state, &keep_ids)) @@ -12576,9 +12510,7 @@ error: } H5E_END_TRY; return(1); } /* test_man_frag_3rd_direct() */ -#endif /* QAK */ -#ifndef QAK /*------------------------------------------------------------------------- * Function: test_huge_insert_one @@ -12699,9 +12631,6 @@ test_huge_insert_one(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar /* Get the size of the file */ if((file_size = h5_get_file_size(filename, fapl)) < 0) TEST_ERROR -#ifdef QAK -HDfprintf(stderr, "file_size = %lu\n", (unsigned long)file_size); -#endif /* QAK */ /* Verify the file is correct size */ if(file_size != empty_size) @@ -12929,9 +12858,6 @@ test_huge_insert_two(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar /* Get the size of the file */ if((file_size = h5_get_file_size(filename, fapl)) < 0) TEST_ERROR -#ifdef QAK -HDfprintf(stderr, "file_size = %lu\n", (unsigned long)file_size); -#endif /* QAK */ /* Verify the file is correct size */ if(file_size != empty_size) @@ -13234,9 +13160,6 @@ test_huge_insert_three(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tp /* Get the size of the file */ if((file_size = h5_get_file_size(filename, fapl)) < 0) TEST_ERROR -#ifdef QAK -HDfprintf(stderr, "file_size = %lu\n", (unsigned long)file_size); -#endif /* QAK */ /* Verify the file is correct size */ if(file_size != empty_size) @@ -13657,9 +13580,6 @@ test_huge_insert_mix(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar /* Get the size of the file */ if((file_size = h5_get_file_size(filename, fapl)) < 0) TEST_ERROR -#ifdef QAK -HDfprintf(stderr, "file_size = %lu\n", (unsigned long)file_size); -#endif /* QAK */ /* Verify the file is correct size */ if(file_size != empty_size) @@ -13879,9 +13799,6 @@ test_filtered_huge(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam /* Get the size of the file */ if((file_size = h5_get_file_size(filename, fapl)) < 0) TEST_ERROR -#ifdef QAK -HDfprintf(stderr, "empty_size = %lu, file_size = %lu\n", (unsigned long)empty_size, (unsigned long)file_size); -#endif /* QAK */ /* Verify the file is correct size */ if(file_size != empty_size) @@ -13911,9 +13828,7 @@ error: } H5E_END_TRY; return(1); } /* test_filtered_huge() */ -#endif /* QAK */ -#ifndef QAK /*------------------------------------------------------------------------- * Function: test_tiny_insert_one @@ -14034,9 +13949,6 @@ test_tiny_insert_one(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar /* Get the size of the file */ if((file_size = h5_get_file_size(filename, fapl)) < 0) TEST_ERROR -#ifdef QAK -HDfprintf(stderr, "file_size = %lu\n", (unsigned long)file_size); -#endif /* QAK */ /* Verify the file is correct size */ if(file_size != empty_size) @@ -14264,9 +14176,6 @@ test_tiny_insert_two(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar /* Get the size of the file */ if((file_size = h5_get_file_size(filename, fapl)) < 0) TEST_ERROR -#ifdef QAK -HDfprintf(stderr, "file_size = %lu\n", (unsigned long)file_size); -#endif /* QAK */ /* Verify the file is correct size */ if(file_size != empty_size) @@ -14864,9 +14773,6 @@ test_tiny_insert_mix(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar /* Get the size of the file */ if((file_size = h5_get_file_size(filename, fapl)) < 0) TEST_ERROR -#ifdef QAK -HDfprintf(stderr, "file_size = %lu\n", (unsigned long)file_size); -#endif /* QAK */ /* Verify the file is correct size */ if(file_size != empty_size) @@ -14907,10 +14813,7 @@ error: } H5E_END_TRY; return(1); } /* test_tiny_insert_mix() */ -#endif /* QAK */ -#endif /* QAK2 */ -#ifndef QAK /*------------------------------------------------------------------------- * Function: test_filtered_man_root_direct @@ -15060,9 +14963,6 @@ test_filtered_man_root_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_para /* Get the size of the file */ if((file_size = h5_get_file_size(filename, fapl)) < 0) TEST_ERROR -#ifdef QAK -HDfprintf(stderr, "empty_size = %lu, file_size = %lu\n", (unsigned long)empty_size, (unsigned long)file_size); -#endif /* QAK */ /* Verify the file is correct size */ if(file_size != empty_size) @@ -15388,9 +15288,6 @@ test_filtered_man_root_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_pa /* Get the size of the file */ if((file_size = h5_get_file_size(filename, fapl)) < 0) TEST_ERROR -#ifdef QAK -HDfprintf(stderr, "empty_size = %lu, file_size = %lu\n", (unsigned long)empty_size, (unsigned long)file_size); -#endif /* QAK */ /* Verify the file is correct size */ if(file_size != empty_size) @@ -15413,9 +15310,7 @@ error: } H5E_END_TRY; return(1); } /* test_filtered_man_root_indirect() */ -#endif /* QAK */ -#ifndef QAK /*------------------------------------------------------------------------- * Function: test_random @@ -15498,10 +15393,10 @@ test_random(hsize_t size_limit, hid_t fapl, H5HF_create_t *cparam, fheap_test_pa /* Choose random # seed */ seed = (unsigned long)HDtime(NULL); -#ifdef QAK +#if 0 /* seed = (unsigned long)1156158635; */ HDfprintf(stderr, "Random # seed was: %lu\n", seed); -#endif /* QAK */ +#endif HDsrandom((unsigned)seed); /* Loop over adding objects to the heap, until the size limit is reached */ @@ -15522,9 +15417,6 @@ HDfprintf(stderr, "Random # seed was: %lu\n", seed); /* Increment the amount of objects added */ total_obj_added += obj_size; } /* end while */ -#ifdef QAK -HDfprintf(stderr, "keep_ids.num_ids = %Zu, total_obj_added = %Hu, size_limit = %Hu\n", keep_ids.num_ids, total_obj_added, size_limit); -#endif /* QAK */ /* Randomize the order of the IDs kept */ for(u = 0; u < keep_ids.num_ids; u++) { @@ -15583,9 +15475,6 @@ HDfprintf(stderr, "keep_ids.num_ids = %Zu, total_obj_added = %Hu, size_limit = % /* Get the size of the file */ if((file_size = h5_get_file_size(filename, fapl)) < 0) TEST_ERROR -#ifdef QAK -HDfprintf(stderr, "file_size = %lu\n", (unsigned long)file_size); -#endif /* QAK */ /* Verify the file is correct size */ if(file_size != empty_size) @@ -15704,10 +15593,10 @@ test_random_pow2(hsize_t size_limit, hid_t fapl, H5HF_create_t *cparam, fheap_te /* Choose random # seed */ seed = (unsigned long)HDtime(NULL); -#ifdef QAK +#if 0 /* seed = (unsigned long)1155181717; */ HDfprintf(stderr, "Random # seed was: %lu\n", seed); -#endif /* QAK */ +#endif HDsrandom((unsigned)seed); /* Loop over adding objects to the heap, until the size limit is reached */ @@ -15740,9 +15629,6 @@ HDfprintf(stderr, "Random # seed was: %lu\n", seed); /* Increment the amount of objects added */ total_obj_added += obj_size; } /* end while */ -#ifdef QAK -HDfprintf(stderr, "keep_ids.num_ids = %Zu, total_obj_added = %Hu, size_limit = %Hu\n", keep_ids.num_ids, total_obj_added, size_limit); -#endif /* QAK */ /* Randomize the order of the IDs kept */ for(u = 0; u < keep_ids.num_ids; u++) { @@ -15801,10 +15687,6 @@ HDfprintf(stderr, "keep_ids.num_ids = %Zu, total_obj_added = %Hu, size_limit = % /* Get the size of the file */ if((file_size = h5_get_file_size(filename, fapl)) < 0) TEST_ERROR -#ifdef QAK -HDfprintf(stderr, "empty_size = %lu\n", (unsigned long)empty_size); -HDfprintf(stderr, "file_size = %lu\n", (unsigned long)file_size); -#endif /* QAK */ /* Verify the file is correct size */ if(file_size != empty_size) @@ -15838,9 +15720,7 @@ error: } H5E_END_TRY; return(1); } /* test_random_pow2() */ -#endif /* QAK */ -#ifndef QAK /*------------------------------------------------------------------------- * Function: test_write @@ -16124,9 +16004,7 @@ error: } H5E_END_TRY; return(1); } /* test_write() */ -#endif /* QAK */ -#ifndef QAK /*------------------------------------------------------------------------- * Function: test_bug1 @@ -16301,7 +16179,6 @@ error: } H5E_END_TRY; return(1); } /* test_bug1() */ -#endif /* QAK */ /*------------------------------------------------------------------------- diff --git a/test/fillval.c b/test/fillval.c index 72b8dcb..3fbbbbb 100644 --- a/test/fillval.c +++ b/test/fillval.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, October 1, 1998 * * Purpose: Tests dataset fill values. diff --git a/test/filter_fail.c b/test/filter_fail.c index e5187be..b3e5c8a 100644 --- a/test/filter_fail.c +++ b/test/filter_fail.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Raymond Lu + * Programmer: Raymond Lu * 7 September 2010 * * Purpose: Make sure dataset, file, and library can close properly when a diff --git a/test/flush1.c b/test/flush1.c index 04f24f7..e01f4a5 100644 --- a/test/flush1.c +++ b/test/flush1.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, October 23, 1998 * * Purpose: This is the first half of a two-part test that makes sure diff --git a/test/flush2.c b/test/flush2.c index 5fc716b..c3103d9 100644 --- a/test/flush2.c +++ b/test/flush2.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, October 23, 1998 * * Purpose: This is the second half of a two-part test that makes sure diff --git a/test/gen_bad_compound.c b/test/gen_bad_compound.c index 292659c..bd857b4 100644 --- a/test/gen_bad_compound.c +++ b/test/gen_bad_compound.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * April 14, 2011 * * Purpose: This program is run to generate an HDF5 data file with objects diff --git a/test/gen_bad_ohdr.c b/test/gen_bad_ohdr.c index 36ba64a..0f85cfe 100644 --- a/test/gen_bad_ohdr.c +++ b/test/gen_bad_ohdr.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Jan 5, 2008 * * Purpose: This program is run to generate an HDF5 data file with a diff --git a/test/gen_bogus.c b/test/gen_bogus.c index 1ab18a4..ab2620f 100644 --- a/test/gen_bogus.c +++ b/test/gen_bogus.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Apr 17, 2007 * * Purpose: This program is run to generate an HDF5 data file with several diff --git a/test/gen_cross.c b/test/gen_cross.c index 105895d..2c1ff4d 100644 --- a/test/gen_cross.c +++ b/test/gen_cross.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Thursday, March 23, 2006 * * This program writes floating-point data to the HDF5 file. It generates diff --git a/test/gen_filters.c b/test/gen_filters.c index 9764830..ace86ba 100644 --- a/test/gen_filters.c +++ b/test/gen_filters.c @@ -38,7 +38,7 @@ static size_t filter_bogus(unsigned int flags, size_t cd_nelmts, * * Failure: -1 * - * Programmer: Pedro Vicente + * Programmer: Pedro Vicente * Thursday, March 25, 2004 * *------------------------------------------------------------------------- diff --git a/test/gen_mergemsg.c b/test/gen_mergemsg.c index f158d57..6633eb0 100644 --- a/test/gen_mergemsg.c +++ b/test/gen_mergemsg.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Friday, June 30, 2006 * * This program creates an object with fragmented object header messages diff --git a/test/gen_new_array.c b/test/gen_new_array.c index 27f162c..041b691 100644 --- a/test/gen_new_array.c +++ b/test/gen_new_array.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, November 09, 2000 * * Purpose: Create a two datasets, one with a compound datatypes with array diff --git a/test/gen_new_fill.c b/test/gen_new_fill.c index 5bdbf73..c012d8b 100644 --- a/test/gen_new_fill.c +++ b/test/gen_new_fill.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Feb 27, 2002 * * Purpose: This program is run to generate a HDF5 data file with fill diff --git a/test/gen_new_group.c b/test/gen_new_group.c index 6924291..42a751f 100644 --- a/test/gen_new_group.c +++ b/test/gen_new_group.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Oct 24, 2005 * * Purpose: This program is run to generate an HDF5 data file with both diff --git a/test/gen_new_mtime.c b/test/gen_new_mtime.c index b44d567..90259c7 100644 --- a/test/gen_new_mtime.c +++ b/test/gen_new_mtime.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Friday, January 3, 2003 * * Purpose: Create a dataset, which should have the newer mtime information diff --git a/test/gen_new_super.c b/test/gen_new_super.c index ed43a39..36f2187 100644 --- a/test/gen_new_super.c +++ b/test/gen_new_super.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, July 15, 2003 * * Purpose: Create a file which will have the newer superblock format. @@ -23,26 +23,22 @@ * put into the 'test' directory in the 1.4+ branch of the library. */ -#include -#include "testhdf5.h" +#include "h5test.h" #define TESTFILE "tsupern.h5" #define ISTORE_IK 64 /*------------------------------------------------------------------------- - * Function: main + * Function: main * - * Purpose: Create a file with a new version (>0) of the superblock + * Purpose: Create a file with a new version (>0) of the superblock * - * Return: Success: - * Failure: + * Return: EXIT_SUCCESS * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, July 15, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ int @@ -54,27 +50,27 @@ main(void) /* Create a file creation property list */ fcpl = H5Pcreate(H5P_FILE_CREATE); - assert(fcpl>=0); + HDassert(fcpl >= 0); - ret=H5Pset_istore_k(fcpl,ISTORE_IK); - assert(ret>=0); + ret = H5Pset_istore_k(fcpl,ISTORE_IK); + HDassert(ret >= 0); /* Creating a file with the non-default file creation property list should * create a version 1 superblock */ /* Create file with custom file creation property list */ - file= H5Fcreate(TESTFILE, H5F_ACC_TRUNC , fcpl, H5P_DEFAULT); - assert(file>=0); + file = H5Fcreate(TESTFILE, H5F_ACC_TRUNC , fcpl, H5P_DEFAULT); + HDassert(file >= 0); /* Close FCPL */ - ret=H5Pclose(fcpl); - assert(ret>=0); + ret = H5Pclose(fcpl); + HDassert(ret >= 0); /* Close file */ - ret=H5Fclose(file); - assert(ret>=0); + ret = H5Fclose(file); + HDassert(ret >= 0); - return 0; + return EXIT_SUCCESS; } diff --git a/test/gen_nullspace.c b/test/gen_nullspace.c index e4e75ac..26df3f1 100644 --- a/test/gen_nullspace.c +++ b/test/gen_nullspace.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, April 17, 2004 * * Purpose: Create a dataset with a null dataspace and an attribute @@ -24,8 +24,7 @@ * put into the 'test' directory in the 1.6.x branch of the library. */ -#include -#include "testhdf5.h" +#include "h5test.h" #define NULLFILE "tnullspace.h5" #define NULLDATASET "null_dataset" @@ -43,44 +42,44 @@ main(void) /* Create the file */ fid = H5Fcreate(NULLFILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - assert(fid>0); + HDassert(fid > 0); sid = H5Screate(H5S_NULL); - assert(sid>0); + HDassert(sid > 0); /* Create dataset */ did = H5Dcreate2(fid, NULLDATASET, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - assert(did>0); + HDassert(did > 0); /* Close the dataset */ ret = H5Dclose(did); - assert(ret>=0); + HDassert(ret >= 0); /* Open the root group */ gid = H5Gopen2(fid, "/", H5P_DEFAULT); - assert(gid > 0); + HDassert(gid > 0); /* Create an attribute for the group */ attr = H5Acreate2(gid, NULLATTR, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT); - assert(attr > 0); + HDassert(attr > 0); /* Close attribute */ ret = H5Aclose(attr); - assert(ret>=0); + HDassert(ret >= 0); /* Close the group */ ret = H5Gclose(gid); - assert(ret>=0); + HDassert(ret >= 0); /* Close the dataspace */ ret = H5Sclose(sid); - assert(ret>=0); + HDassert(ret >= 0); /* Close the file */ ret = H5Fclose(fid); - assert(ret>=0); + HDassert(ret >= 0); - return 0; + return EXIT_SUCCESS; } diff --git a/test/gen_old_array.c b/test/gen_old_array.c index 3fab657..402fd40 100644 --- a/test/gen_old_array.c +++ b/test/gen_old_array.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, November 09, 2000 * * Purpose: Create a two datasets with compound datatypes, one with no array diff --git a/test/gen_old_group.c b/test/gen_old_group.c index d109329..55dbde3 100644 --- a/test/gen_old_group.c +++ b/test/gen_old_group.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Oct 24, 2005 * * Purpose: This program is run to generate an HDF5 data file with an diff --git a/test/gen_old_layout.c b/test/gen_old_layout.c index 56c3e4e..0210786 100644 --- a/test/gen_old_layout.c +++ b/test/gen_old_layout.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, May 27, 2004 * * Purpose: Create two datasets (one for version 1 and one for version 2 of diff --git a/test/gen_old_mtime.c b/test/gen_old_mtime.c index cbe3bdc..e72c9b1 100644 --- a/test/gen_old_mtime.c +++ b/test/gen_old_mtime.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Friday, January 3, 2003 * * Purpose: Create a dataset, which should have the older mtime information diff --git a/test/gen_sizes_lheap.c b/test/gen_sizes_lheap.c index 81742df..0e62019 100644 --- a/test/gen_sizes_lheap.c +++ b/test/gen_sizes_lheap.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Neil Fortner + * Programmer: Neil Fortner * Thursday, July 15, 2010 * * Purpose: Creates a file with non-default sizes of lengths and addresses. diff --git a/test/gen_specmetaread.c b/test/gen_specmetaread.c index fd484d1..ca44f9a 100644 --- a/test/gen_specmetaread.c +++ b/test/gen_specmetaread.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, October 8, 2009 * * Purpose: Create a file with a dataset who's raw data immediately follows @@ -23,9 +23,8 @@ * the library on the trunk as of when this file is checked in. */ -#include -#include "testhdf5.h" +#include "h5test.h" #define FILENAME "specmetaread.h5" #define DIM 10 diff --git a/test/gen_udlinks.c b/test/gen_udlinks.c index e48d0e8..456cb5c 100644 --- a/test/gen_udlinks.c +++ b/test/gen_udlinks.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: James Laird + * Programmer: James Laird * Tuesday, June 6, 2006 * * This program creates HDF5 files with user-defined links. These files diff --git a/test/getname.c b/test/getname.c index a6f2f5a..ef0d5ea 100644 --- a/test/getname.c +++ b/test/getname.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Pedro Vicente + * Programmer: Pedro Vicente * April 12, 2002 * * Purpose: Tests the "ID to name" functionality diff --git a/test/gheap.c b/test/gheap.c index 09ba1cf..077f921 100644 --- a/test/gheap.c +++ b/test/gheap.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, March 31, 1998 * * Purpose: Tests the global heap. The global heap is the set of all diff --git a/test/h5subfiling_vol.c b/test/h5subfiling_vol.c new file mode 100644 index 0000000..25f1292 --- /dev/null +++ b/test/h5subfiling_vol.c @@ -0,0 +1,3641 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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 COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Purpose: This is a "pass through" VOL connector, which forwards each + * VOL callback to an underlying connector. + * + * It is designed as an example VOL connector for developers to + * use when creating new connectors, especially connectors that + * are outside of the HDF5 library. As such, it should _NOT_ + * include _any_ private HDF5 header files. This connector should + * therefore only make public HDF5 API calls and use standard C / + * POSIX calls. + * + * Note that the HDF5 error stack must be preserved on code paths + * that could be invoked when the underlying VOL connector's + * callback can fail. + * + */ + + +/* Header files needed */ +/* Do NOT include private HDF5 files here! */ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* Public HDF5 file */ +#include "hdf5.h" +#include "mpi.h" + +/* This connector's header */ +#include "h5subfiling_vol.h" + +/* For initial testing... */ +#define SEL_ITER_MAX_SEQ 256 +#define HYPERSLAB_MAX_RANK 8 + +/**********/ +/* Macros */ +/**********/ + +/* Whether to display log messge when callback is invoked */ +/* (Uncomment to enable) */ +/* #define ENABLE_EXT_PASSTHRU_LOGGING */ + +/* Hack for missing va_copy() in old Visual Studio editions + * (from H5win2_defs.h - used on VS2012 and earlier) + */ +#if defined(_WIN32) && defined(_MSC_VER) && (_MSC_VER < 1800) +#define va_copy(D,S) ((D) = (S)) +#endif + +#ifndef ADDR_MAX +#define ADDR_MAX 256 +#endif + +/************/ +/* Typedefs */ +/************/ + + +/* Common object and attribute information */ +typedef struct H5VL_subfiling_item_t { + H5I_type_t type; + void *file; +} H5VL_subfiling_item_t; + +/* Common object information */ +typedef struct H5VL_subfiling_obj_t { + H5VL_subfiling_item_t item; /* Must be first */ + char obj_name[ADDR_MAX]; +} H5VL_subfiling_obj_t; + +/* The file struct */ +typedef struct H5VL_subfiling_file_t { + H5VL_subfiling_obj_t obj; /* Must be first */ + uint64_t h5_file_id; /* Posix file inode */ + char *file_name; + hid_t fcpl_id; + hid_t fapl_id; + MPI_Comm comm; + MPI_Info info; + int my_rank; + int num_procs; + int nobjs; + H5_LIST_HEAD(H5VL_subfiling_dset_t) ids; +} H5VL_subfiling_file_t; + +/* The dataset struct */ +typedef struct H5VL_subfiling_dset_t { + H5VL_subfiling_obj_t obj; /* Must be first */ + hid_t type_id; + hid_t space_id; + hid_t dcpl_id; + hid_t dapl_id; + haddr_t f_offset; + hbool_t mapped; + H5_LIST_ENTRY(H5VL_subfiling_dset_t) entry; +} H5VL_subfiling_dset_t; + +/* The pass through VOL info object */ +typedef struct H5VL_subfiling_t { + H5VL_subfiling_obj_t obj; /* Must be first */ + hid_t under_vol_id; /* ID for underlying VOL connector */ + void *under_object; /* Info object for underlying VOL connector */ +} H5VL_subfiling_t; + +/* The pass through VOL wrapper context */ +typedef struct H5VL_subfiling_wrap_ctx_t { + hid_t under_vol_id; /* VOL ID for under VOL */ + void *under_wrap_ctx; /* Object wrapping context for under VOL */ +} H5VL_subfiling_wrap_ctx_t; + + +/********************* */ +/* Function prototypes */ +/********************* */ + +/* Helper routines */ +static herr_t H5VL_subfiling_file_specific_reissue(void *obj, hid_t connector_id, + H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, ...); +static herr_t H5VL_subfiling_request_specific_reissue(void *obj, hid_t connector_id, + H5VL_request_specific_t specific_type, ...); +static herr_t H5VL_subfiling_link_create_reissue(H5VL_link_create_type_t create_type, + void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, + hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req, ...); +static H5VL_subfiling_t *H5VL_subfiling_new_obj(void *under_obj, + hid_t under_vol_id); +static herr_t H5VL_subfiling_free_obj(H5VL_subfiling_t *obj); + +static H5VL_subfiling_dset_t *H5VL__subfiling_dset_init(H5VL_subfiling_item_t *item); + +/* "Management" callbacks */ +static herr_t H5VL_subfiling_init(hid_t vipl_id); +static herr_t H5VL_subfiling_term(void); + +/* VOL info callbacks */ +static void *H5VL_subfiling_info_copy(const void *info); +static herr_t H5VL_subfiling_info_cmp(int *cmp_value, const void *info1, const void *info2); +static herr_t H5VL_subfiling_info_free(void *info); +static herr_t H5VL_subfiling_info_to_str(const void *info, char **str); +static herr_t H5VL_subfiling_str_to_info(const char *str, void **info); + +/* VOL object wrap / retrieval callbacks */ +static void *H5VL_subfiling_get_object(const void *obj); +static herr_t H5VL_subfiling_get_wrap_ctx(const void *obj, void **wrap_ctx); +static void *H5VL_subfiling_wrap_object(void *obj, H5I_type_t obj_type, void *wrap_ctx); +static void *H5VL_subfiling_unwrap_object(void *obj); +static herr_t H5VL_subfiling_free_wrap_ctx(void *obj); + +/* Attribute callbacks */ +static void *H5VL_subfiling_attr_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t type_id, hid_t space_id, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req); +static void *H5VL_subfiling_attr_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t aapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL_subfiling_attr_read(void *attr, hid_t mem_type_id, void *buf, hid_t dxpl_id, void **req); +static herr_t H5VL_subfiling_attr_write(void *attr, hid_t mem_type_id, const void *buf, hid_t dxpl_id, void **req); +static herr_t H5VL_subfiling_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_subfiling_attr_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_subfiling_attr_optional(void *obj, H5VL_attr_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_subfiling_attr_close(void *attr, hid_t dxpl_id, void **req); + +/* Dataset callbacks */ +static void *H5VL_subfiling_dataset_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t lcpl_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req); +static void *H5VL_subfiling_dataset_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL_subfiling_dataset_read(void *dset, hid_t mem_type_id, hid_t mem_space_id, + hid_t file_space_id, hid_t plist_id, void *buf, void **req); +static herr_t H5VL_subfiling_dataset_write(void *dset, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf, void **req); +static herr_t H5VL_subfiling_dataset_get(void *dset, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_subfiling_dataset_specific(void *obj, H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_subfiling_dataset_optional(void *obj, H5VL_dataset_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_subfiling_dataset_close(void *dset, hid_t dxpl_id, void **req); + +/* Datatype callbacks */ +static void *H5VL_subfiling_datatype_commit(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req); +static void *H5VL_subfiling_datatype_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL_subfiling_datatype_get(void *dt, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_subfiling_datatype_specific(void *obj, H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_subfiling_datatype_optional(void *obj, H5VL_datatype_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_subfiling_datatype_close(void *dt, hid_t dxpl_id, void **req); + +/* File callbacks */ +static void *H5VL_subfiling_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req); +static void *H5VL_subfiling_file_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL_subfiling_file_get(void *file, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_subfiling_file_specific(void *file, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_subfiling_file_optional(void *file, H5VL_file_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_subfiling_file_close(void *file, hid_t dxpl_id, void **req); + +/* Group callbacks */ +static void *H5VL_subfiling_group_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t lcpl_id, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req); +static void *H5VL_subfiling_group_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL_subfiling_group_get(void *obj, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_subfiling_group_specific(void *obj, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_subfiling_group_optional(void *obj, H5VL_group_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_subfiling_group_close(void *grp, hid_t dxpl_id, void **req); + +/* Link callbacks */ +static herr_t H5VL_subfiling_link_create(H5VL_link_create_type_t create_type, void *obj, const H5VL_loc_params_t *loc_params, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_subfiling_link_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_obj, const H5VL_loc_params_t *loc_params2, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL_subfiling_link_move(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_obj, const H5VL_loc_params_t *loc_params2, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL_subfiling_link_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_subfiling_link_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_subfiling_link_optional(void *obj, H5VL_link_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments); + +/* Object callbacks */ +static void *H5VL_subfiling_object_open(void *obj, const H5VL_loc_params_t *loc_params, H5I_type_t *opened_type, hid_t dxpl_id, void **req); +static herr_t H5VL_subfiling_object_copy(void *src_obj, const H5VL_loc_params_t *src_loc_params, const char *src_name, void *dst_obj, const H5VL_loc_params_t *dst_loc_params, const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req); +static herr_t H5VL_subfiling_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_subfiling_object_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_subfiling_object_optional(void *obj, H5VL_object_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments); + +/* Container/connector introspection callbacks */ +static herr_t H5VL_subfiling_introspect_get_conn_cls(void *obj, H5VL_get_conn_lvl_t lvl, const H5VL_class_t **conn_cls); +static herr_t H5VL_subfiling_introspect_opt_query(void *obj, H5VL_subclass_t cls, int opt_type, hbool_t *supported); + +/* Async request callbacks */ +static herr_t H5VL_subfiling_request_wait(void *req, uint64_t timeout, H5ES_status_t *status); +static herr_t H5VL_subfiling_request_notify(void *obj, H5VL_request_notify_t cb, void *ctx); +static herr_t H5VL_subfiling_request_cancel(void *req); +static herr_t H5VL_subfiling_request_specific(void *req, H5VL_request_specific_t specific_type, va_list arguments); +static herr_t H5VL_subfiling_request_optional(void *req, H5VL_request_optional_t opt_type, va_list arguments); +static herr_t H5VL_subfiling_request_free(void *req); + +/* Blob callbacks */ +static herr_t H5VL_subfiling_blob_put(void *obj, const void *buf, size_t size, void *blob_id, void *ctx); +static herr_t H5VL_subfiling_blob_get(void *obj, const void *blob_id, void *buf, size_t size, void *ctx); +static herr_t H5VL_subfiling_blob_specific(void *obj, void *blob_id, H5VL_blob_specific_t specific_type, va_list arguments); +static herr_t H5VL_subfiling_blob_optional(void *obj, void *blob_id, H5VL_blob_optional_t opt_type, va_list arguments); + +/* Token callbacks */ +static herr_t H5VL_subfiling_token_cmp(void *obj, const H5O_token_t *token1, const H5O_token_t *token2, int *cmp_value); +static herr_t H5VL_subfiling_token_to_str(void *obj, H5I_type_t obj_type, const H5O_token_t *token, char **token_str); +static herr_t H5VL_subfiling_token_from_str(void *obj, H5I_type_t obj_type, const char *token_str, H5O_token_t *token); + +/* Generic optional callback */ +static herr_t H5VL_subfiling_optional(void *obj, int op_type, hid_t dxpl_id, void **req, va_list arguments); + +/*******************/ +/* Local variables */ +/*******************/ + +/* Pass through VOL connector class struct */ +static const H5VL_class_t H5VL_subfiling_g = { + H5VL_SUBFILING_VERSION, /* version */ + (H5VL_class_value_t)H5VL_SUBFILING_VALUE, /* value */ + H5VL_SUBFILING_NAME, /* name */ + 0, /* capability flags */ + H5VL_subfiling_init, /* initialize */ + H5VL_subfiling_term, /* terminate */ + { /* INFO_CLS */ + sizeof(H5VL_subfiling_info_t), /* size */ + H5VL_subfiling_info_copy, /* copy */ + H5VL_subfiling_info_cmp, /* compare */ + H5VL_subfiling_info_free, /* free */ + H5VL_subfiling_info_to_str, /* to_str */ + H5VL_subfiling_str_to_info /* from_str */ + }, + { /* WRAP_CLS */ + H5VL_subfiling_get_object, /* get_object */ + H5VL_subfiling_get_wrap_ctx, /* get_wrap_ctx */ + H5VL_subfiling_wrap_object, /* wrap_object */ + H5VL_subfiling_unwrap_object, /* unwrap_object */ + H5VL_subfiling_free_wrap_ctx /* free_wrap_ctx */ + }, + { /* ATTRIBUTE_CLS */ + H5VL_subfiling_attr_create, /* create */ + H5VL_subfiling_attr_open, /* open */ + H5VL_subfiling_attr_read, /* read */ + H5VL_subfiling_attr_write, /* write */ + H5VL_subfiling_attr_get, /* get */ + H5VL_subfiling_attr_specific, /* specific */ + H5VL_subfiling_attr_optional, /* optional */ + H5VL_subfiling_attr_close /* close */ + }, + { /* DATASET_CLS */ + H5VL_subfiling_dataset_create, /* create */ + H5VL_subfiling_dataset_open, /* open */ + H5VL_subfiling_dataset_read, /* read */ + H5VL_subfiling_dataset_write, /* write */ + H5VL_subfiling_dataset_get, /* get */ + H5VL_subfiling_dataset_specific, /* specific */ + H5VL_subfiling_dataset_optional, /* optional */ + H5VL_subfiling_dataset_close /* close */ + }, + { /* DATATYPE_CLS */ + H5VL_subfiling_datatype_commit, /* commit */ + H5VL_subfiling_datatype_open, /* open */ + H5VL_subfiling_datatype_get, /* get_size */ + H5VL_subfiling_datatype_specific, /* specific */ + H5VL_subfiling_datatype_optional, /* optional */ + H5VL_subfiling_datatype_close /* close */ + }, + { /* FILE_CLS */ + H5VL_subfiling_file_create, /* create */ + H5VL_subfiling_file_open, /* open */ + H5VL_subfiling_file_get, /* get */ + H5VL_subfiling_file_specific, /* specific */ + H5VL_subfiling_file_optional, /* optional */ + H5VL_subfiling_file_close /* close */ + }, + { /* GROUP_CLS */ + H5VL_subfiling_group_create, /* create */ + H5VL_subfiling_group_open, /* open */ + H5VL_subfiling_group_get, /* get */ + H5VL_subfiling_group_specific, /* specific */ + H5VL_subfiling_group_optional, /* optional */ + H5VL_subfiling_group_close /* close */ + }, + { /* LINK_CLS */ + H5VL_subfiling_link_create, /* create */ + H5VL_subfiling_link_copy, /* copy */ + H5VL_subfiling_link_move, /* move */ + H5VL_subfiling_link_get, /* get */ + H5VL_subfiling_link_specific, /* specific */ + H5VL_subfiling_link_optional /* optional */ + }, + { /* OBJECT_CLS */ + H5VL_subfiling_object_open, /* open */ + H5VL_subfiling_object_copy, /* copy */ + H5VL_subfiling_object_get, /* get */ + H5VL_subfiling_object_specific, /* specific */ + H5VL_subfiling_object_optional /* optional */ + }, + { /* INTROSPECT_CLS */ + H5VL_subfiling_introspect_get_conn_cls, /* get_conn_cls */ + H5VL_subfiling_introspect_opt_query, /* opt_query */ + }, + { /* REQUEST_CLS */ + H5VL_subfiling_request_wait, /* wait */ + H5VL_subfiling_request_notify, /* notify */ + H5VL_subfiling_request_cancel, /* cancel */ + H5VL_subfiling_request_specific, /* specific */ + H5VL_subfiling_request_optional, /* optional */ + H5VL_subfiling_request_free /* free */ + }, + { /* BLOB_CLS */ + H5VL_subfiling_blob_put, /* put */ + H5VL_subfiling_blob_get, /* get */ + H5VL_subfiling_blob_specific, /* specific */ + H5VL_subfiling_blob_optional /* optional */ + }, + { /* TOKEN_CLS */ + H5VL_subfiling_token_cmp, /* cmp */ + H5VL_subfiling_token_to_str, /* to_str */ + H5VL_subfiling_token_from_str /* from_str */ + }, + H5VL_subfiling_optional /* OPTIONAL */ +}; + +/* The connector identification number, initialized at runtime */ +static hid_t H5VL_SUBFILING_g = H5I_INVALID_HID; +H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_VOL;} +const void *H5PLget_plugin_info(void) {return &H5VL_subfiling_g;} + +static int file_create_count = 0; +static int file_open_count = 0; +static int file_close_count = 0; + + +/*------------------------------------------------------------------------- + * Function: H5VL__pass_through_new_obj + * + * Purpose: Create a new pass through object for an underlying object + * + * Return: Success: Pointer to the new pass through object + * Failure: NULL + * + * Programmer: Quincey Koziol + * Monday, December 3, 2018 + * + *------------------------------------------------------------------------- + */ +static H5VL_subfiling_t * +H5VL_subfiling_new_obj(void *under_obj, hid_t under_vol_id) +{ + H5VL_subfiling_t *new_obj; + + new_obj = (H5VL_subfiling_t *)calloc(1, sizeof(H5VL_subfiling_t)); + new_obj->under_object = under_obj; + new_obj->under_vol_id = under_vol_id; + H5Iinc_ref(new_obj->under_vol_id); + + return new_obj; +} /* end H5VL__pass_through_new_obj() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__pass_through_free_obj + * + * Purpose: Release a pass through object + * + * Note: Take care to preserve the current HDF5 error stack + * when calling HDF5 API calls. + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Quincey Koziol + * Monday, December 3, 2018 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_subfiling_free_obj(H5VL_subfiling_t *obj) +{ + hid_t err_id; + + err_id = H5Eget_current_stack(); + + H5Idec_ref(obj->under_vol_id); + + H5Eset_current_stack(err_id); + + free(obj); + + return 0; +} /* end H5VL__pass_through_free_obj() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_subfiling_register + * + * Purpose: Register the pass-through VOL connector and retrieve an ID + * for it. + * + * Return: Success: The ID for the pass-through VOL connector + * Failure: -1 + * + * Programmer: Quincey Koziol + * Wednesday, November 28, 2018 + * + *------------------------------------------------------------------------- + */ +hid_t +H5VL_subfiling_register(void) +{ + /* Singleton register the pass-through VOL connector ID */ + if(H5VL_SUBFILING_g < 0) + H5VL_SUBFILING_g = H5VLregister_connector(&H5VL_subfiling_g, H5P_DEFAULT); + + return H5VL_SUBFILING_g; +} /* end H5VL_subfiling_register() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_subfiling_init + * + * Purpose: Initialize this VOL connector, performing any necessary + * operations for the connector that will apply to all containers + * accessed with the connector. + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_subfiling_init(hid_t vipl_id) +{ + // printf("%s:%d: Subfiling VOL is called.\n", __func__, __LINE__); +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL INIT\n"); +#endif + + /* Shut compiler up about unused parameter */ + vipl_id = vipl_id; + + return 0; +} /* end H5VL_subfiling_init() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VL_subfiling_term + * + * Purpose: Terminate this VOL connector, performing any necessary + * operations for the connector that release connector-wide + * resources (usually created / initialized with the 'init' + * callback). + * + * Return: Success: 0 + * Failure: (Can't fail) + * + *--------------------------------------------------------------------------- + */ +static herr_t +H5VL_subfiling_term(void) +{ +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL TERM\n"); +#endif + + /* Reset VOL ID */ + H5VL_SUBFILING_g = H5I_INVALID_HID; + + return 0; +} /* end H5VL_subfiling_term() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VL_subfiling_info_copy + * + * Purpose: Duplicate the connector's info object. + * + * Returns: Success: New connector info object + * Failure: NULL + * + *--------------------------------------------------------------------------- + */ +static void * +H5VL_subfiling_info_copy(const void *_info) +{ + const H5VL_subfiling_info_t *info = (const H5VL_subfiling_info_t *)_info; + H5VL_subfiling_info_t *new_info; + +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL INFO Copy\n"); +#endif + + /* Allocate new VOL info struct for the pass through connector */ + new_info = (H5VL_subfiling_info_t *)calloc(1, sizeof(H5VL_subfiling_info_t)); + + /* Increment reference count on underlying VOL ID, and copy the VOL info */ + new_info->under_vol_id = info->under_vol_id; + H5Iinc_ref(new_info->under_vol_id); + if(info->under_vol_info) + H5VLcopy_connector_info(new_info->under_vol_id, &(new_info->under_vol_info), info->under_vol_info); + + return new_info; +} /* end H5VL_subfiling_info_copy() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VL_subfiling_info_cmp + * + * Purpose: Compare two of the connector's info objects, setting *cmp_value, + * following the same rules as strcmp(). + * + * Return: Success: 0 + * Failure: -1 + * + *--------------------------------------------------------------------------- + */ +static herr_t +H5VL_subfiling_info_cmp(int *cmp_value, const void *_info1, const void *_info2) +{ + const H5VL_subfiling_info_t *info1 = (const H5VL_subfiling_info_t *)_info1; + const H5VL_subfiling_info_t *info2 = (const H5VL_subfiling_info_t *)_info2; + +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL INFO Compare\n"); +#endif + + /* Sanity checks */ + assert(info1); + assert(info2); + + /* Initialize comparison value */ + *cmp_value = 0; + + /* Compare under VOL connector classes */ + H5VLcmp_connector_cls(cmp_value, info1->under_vol_id, info2->under_vol_id); + if(*cmp_value != 0) + return 0; + + /* Compare under VOL connector info objects */ + H5VLcmp_connector_info(cmp_value, info1->under_vol_id, info1->under_vol_info, info2->under_vol_info); + if(*cmp_value != 0) + return 0; + + return 0; +} /* end H5VL_subfiling_info_cmp() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VL_subfiling_info_free + * + * Purpose: Release an info object for the connector. + * + * Note: Take care to preserve the current HDF5 error stack + * when calling HDF5 API calls. + * + * Return: Success: 0 + * Failure: -1 + * + *--------------------------------------------------------------------------- + */ +static herr_t +H5VL_subfiling_info_free(void *_info) +{ + H5VL_subfiling_info_t *info = (H5VL_subfiling_info_t *)_info; + hid_t err_id; + +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL INFO Free\n"); +#endif + + err_id = H5Eget_current_stack(); + + /* Release underlying VOL ID and info */ + if(info->under_vol_info) + H5VLfree_connector_info(info->under_vol_id, info->under_vol_info); + H5Idec_ref(info->under_vol_id); + + H5Eset_current_stack(err_id); + + /* Free pass through info object itself */ + free(info); + + return 0; +} /* end H5VL_subfiling_info_free() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VL_subfiling_info_to_str + * + * Purpose: Serialize an info object for this connector into a string + * + * Return: Success: 0 + * Failure: -1 + * + *--------------------------------------------------------------------------- + */ +static herr_t +H5VL_subfiling_info_to_str(const void *_info, char **str) +{ + const H5VL_subfiling_info_t *info = (const H5VL_subfiling_info_t *)_info; + H5VL_class_value_t under_value = (H5VL_class_value_t)-1; + char *under_vol_string = NULL; + size_t under_vol_str_len = 0; + +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL INFO To String\n"); +#endif + + /* Get value and string for underlying VOL connector */ + H5VLget_value(info->under_vol_id, &under_value); + H5VLconnector_info_to_str(info->under_vol_info, info->under_vol_id, &under_vol_string); + + /* Determine length of underlying VOL info string */ + if(under_vol_string) + under_vol_str_len = strlen(under_vol_string); + + /* Allocate space for our info */ + *str = (char *)H5allocate_memory(32 + under_vol_str_len, (hbool_t)0); + assert(*str); + + /* Encode our info + * Normally we'd use snprintf() here for a little extra safety, but that + * call had problems on Windows until recently. So, to be as platform-independent + * as we can, we're using sprintf() instead. + */ + sprintf(*str, "under_vol=%u;under_info={%s}", (unsigned)under_value, (under_vol_string ? under_vol_string : "")); + + return 0; +} /* end H5VL_subfiling_info_to_str() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VL_subfiling_str_to_info + * + * Purpose: Deserialize a string into an info object for this connector. + * + * Return: Success: 0 + * Failure: -1 + * + *--------------------------------------------------------------------------- + */ +static herr_t +H5VL_subfiling_str_to_info(const char *str, void **_info) +{ + H5VL_subfiling_info_t *info; + unsigned under_vol_value; + const char *under_vol_info_start, *under_vol_info_end; + hid_t under_vol_id; + void *under_vol_info = NULL; + +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL INFO String To Info\n"); +#endif + + /* Retrieve the underlying VOL connector value and info */ + sscanf(str, "under_vol=%u;", &under_vol_value); + under_vol_id = H5VLregister_connector_by_value((H5VL_class_value_t)under_vol_value, H5P_DEFAULT); + under_vol_info_start = strchr(str, '{'); + under_vol_info_end = strrchr(str, '}'); + assert(under_vol_info_end > under_vol_info_start); + if(under_vol_info_end != (under_vol_info_start + 1)) { + char *under_vol_info_str; + + under_vol_info_str = (char *)malloc((size_t)(under_vol_info_end - under_vol_info_start)); + memcpy(under_vol_info_str, under_vol_info_start + 1, (size_t)((under_vol_info_end - under_vol_info_start) - 1)); + *(under_vol_info_str + (under_vol_info_end - under_vol_info_start)) = '\0'; + + H5VLconnector_str_to_info(under_vol_info_str, under_vol_id, &under_vol_info); + + free(under_vol_info_str); + } /* end else */ + + /* Allocate new pass-through VOL connector info and set its fields */ + info = (H5VL_subfiling_info_t *)calloc(1, sizeof(H5VL_subfiling_info_t)); + info->under_vol_id = under_vol_id; + info->under_vol_info = under_vol_info; + + /* Set return value */ + *_info = info; + + return 0; +} /* end H5VL_subfiling_str_to_info() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VL_subfiling_get_object + * + * Purpose: Retrieve the 'data' for a VOL object. + * + * Return: Success: 0 + * Failure: -1 + * + *--------------------------------------------------------------------------- + */ +static void * +H5VL_subfiling_get_object(const void *obj) +{ + const H5VL_subfiling_t *o = (const H5VL_subfiling_t *)obj; + +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL Get object\n"); +#endif + + return H5VLget_object(o->under_object, o->under_vol_id); +} /* end H5VL_subfiling_get_object() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VL_subfiling_get_wrap_ctx + * + * Purpose: Retrieve a "wrapper context" for an object + * + * Return: Success: 0 + * Failure: -1 + * + *--------------------------------------------------------------------------- + */ +static herr_t +H5VL_subfiling_get_wrap_ctx(const void *obj, void **wrap_ctx) +{ + const H5VL_subfiling_t *o = (const H5VL_subfiling_t *)obj; + H5VL_subfiling_wrap_ctx_t *new_wrap_ctx; + +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL WRAP CTX Get\n"); +#endif + + /* Allocate new VOL object wrapping context for the pass through connector */ + new_wrap_ctx = (H5VL_subfiling_wrap_ctx_t *)calloc(1, sizeof(H5VL_subfiling_wrap_ctx_t)); + + /* Increment reference count on underlying VOL ID, and copy the VOL info */ + new_wrap_ctx->under_vol_id = o->under_vol_id; + H5Iinc_ref(new_wrap_ctx->under_vol_id); + H5VLget_wrap_ctx(o->under_object, o->under_vol_id, &new_wrap_ctx->under_wrap_ctx); + + /* Set wrap context to return */ + *wrap_ctx = new_wrap_ctx; + + return 0; +} /* end H5VL_subfiling_get_wrap_ctx() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VL_subfiling_wrap_object + * + * Purpose: Use a "wrapper context" to wrap a data object + * + * Return: Success: Pointer to wrapped object + * Failure: NULL + * + *--------------------------------------------------------------------------- + */ +static void * +H5VL_subfiling_wrap_object(void *obj, H5I_type_t obj_type, void *_wrap_ctx) +{ + H5VL_subfiling_wrap_ctx_t *wrap_ctx = (H5VL_subfiling_wrap_ctx_t *)_wrap_ctx; + H5VL_subfiling_t *new_obj; + void *under; + +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL WRAP Object\n"); +#endif + + /* Wrap the object with the underlying VOL */ + under = H5VLwrap_object(obj, obj_type, wrap_ctx->under_vol_id, wrap_ctx->under_wrap_ctx); + if(under) + new_obj = H5VL_subfiling_new_obj(under, wrap_ctx->under_vol_id); + else + new_obj = NULL; + + return new_obj; +} /* end H5VL_subfiling_wrap_object() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VL_subfiling_unwrap_object + * + * Purpose: Unwrap a wrapped object, discarding the wrapper, but returning + * underlying object. + * + * Return: Success: Pointer to unwrapped object + * Failure: NULL + * + *--------------------------------------------------------------------------- + */ +static void * +H5VL_subfiling_unwrap_object(void *obj) +{ + H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj; + void *under; + +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL UNWRAP Object\n"); +#endif + + /* Unrap the object with the underlying VOL */ + under = H5VLunwrap_object(o->under_object, o->under_vol_id); + + if(under) + H5VL_subfiling_free_obj(o); + + return under; +} /* end H5VL_subfiling_unwrap_object() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VL_subfiling_free_wrap_ctx + * + * Purpose: Release a "wrapper context" for an object + * + * Note: Take care to preserve the current HDF5 error stack + * when calling HDF5 API calls. + * + * Return: Success: 0 + * Failure: -1 + * + *--------------------------------------------------------------------------- + */ +static herr_t +H5VL_subfiling_free_wrap_ctx(void *_wrap_ctx) +{ + H5VL_subfiling_wrap_ctx_t *wrap_ctx = (H5VL_subfiling_wrap_ctx_t *)_wrap_ctx; + hid_t err_id; + +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL WRAP CTX Free\n"); +#endif + + err_id = H5Eget_current_stack(); + + /* Release underlying VOL ID and wrap context */ + if(wrap_ctx->under_wrap_ctx) + H5VLfree_wrap_ctx(wrap_ctx->under_wrap_ctx, wrap_ctx->under_vol_id); + H5Idec_ref(wrap_ctx->under_vol_id); + + H5Eset_current_stack(err_id); + + /* Free pass through wrap context object itself */ + free(wrap_ctx); + + return 0; +} /* end H5VL_subfiling_free_wrap_ctx() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_subfiling_attr_create + * + * Purpose: Creates an attribute on an object. + * + * Return: Success: Pointer to attribute object + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +static void * +H5VL_subfiling_attr_create(void *obj, const H5VL_loc_params_t *loc_params, + const char *name, hid_t type_id, hid_t space_id, hid_t acpl_id, + hid_t aapl_id, hid_t dxpl_id, void **req) +{ + H5VL_subfiling_t *attr; + H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj; + void *under; + +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL ATTRIBUTE Create\n"); +#endif + + under = H5VLattr_create(o->under_object, loc_params, o->under_vol_id, name, type_id, space_id, acpl_id, aapl_id, dxpl_id, req); + if(under) { + attr = H5VL_subfiling_new_obj(under, o->under_vol_id); + + /* Check for async request */ + if(req && *req) + *req = H5VL_subfiling_new_obj(*req, o->under_vol_id); + } /* end if */ + else + attr = NULL; + + return (void*)attr; +} /* end H5VL_subfiling_attr_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_subfiling_attr_open + * + * Purpose: Opens an attribute on an object. + * + * Return: Success: Pointer to attribute object + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +static void * +H5VL_subfiling_attr_open(void *obj, const H5VL_loc_params_t *loc_params, + const char *name, hid_t aapl_id, hid_t dxpl_id, void **req) +{ + H5VL_subfiling_t *attr; + H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj; + void *under; + +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL ATTRIBUTE Open\n"); +#endif + + under = H5VLattr_open(o->under_object, loc_params, o->under_vol_id, name, aapl_id, dxpl_id, req); + if(under) { + attr = H5VL_subfiling_new_obj(under, o->under_vol_id); + + /* Check for async request */ + if(req && *req) + *req = H5VL_subfiling_new_obj(*req, o->under_vol_id); + } /* end if */ + else + attr = NULL; + + return (void *)attr; +} /* end H5VL_subfiling_attr_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_subfiling_attr_read + * + * Purpose: Reads data from attribute. + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_subfiling_attr_read(void *attr, hid_t mem_type_id, void *buf, + hid_t dxpl_id, void **req) +{ + H5VL_subfiling_t *o = (H5VL_subfiling_t *)attr; + herr_t ret_value; + +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL ATTRIBUTE Read\n"); +#endif + + ret_value = H5VLattr_read(o->under_object, o->under_vol_id, mem_type_id, buf, dxpl_id, req); + + /* Check for async request */ + if(req && *req) + *req = H5VL_subfiling_new_obj(*req, o->under_vol_id); + + return ret_value; +} /* end H5VL_subfiling_attr_read() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_subfiling_attr_write + * + * Purpose: Writes data to attribute. + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_subfiling_attr_write(void *attr, hid_t mem_type_id, const void *buf, + hid_t dxpl_id, void **req) +{ + H5VL_subfiling_t *o = (H5VL_subfiling_t *)attr; + herr_t ret_value; + +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL ATTRIBUTE Write\n"); +#endif + + ret_value = H5VLattr_write(o->under_object, o->under_vol_id, mem_type_id, buf, dxpl_id, req); + + /* Check for async request */ + if(req && *req) + *req = H5VL_subfiling_new_obj(*req, o->under_vol_id); + + return ret_value; +} /* end H5VL_subfiling_attr_write() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_subfiling_attr_get + * + * Purpose: Gets information about an attribute + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_subfiling_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t dxpl_id, + void **req, va_list arguments) +{ + H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL ATTRIBUTE Get\n"); +#endif + + ret_value = H5VLattr_get(o->under_object, o->under_vol_id, get_type, dxpl_id, req, arguments); + + /* Check for async request */ + if(req && *req) + *req = H5VL_subfiling_new_obj(*req, o->under_vol_id); + + return ret_value; +} /* end H5VL_subfiling_attr_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_subfiling_attr_specific + * + * Purpose: Specific operation on attribute + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_subfiling_attr_specific(void *obj, const H5VL_loc_params_t *loc_params, + H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL ATTRIBUTE Specific\n"); +#endif + + ret_value = H5VLattr_specific(o->under_object, loc_params, o->under_vol_id, specific_type, dxpl_id, req, arguments); + + /* Check for async request */ + if(req && *req) + *req = H5VL_subfiling_new_obj(*req, o->under_vol_id); + + return ret_value; +} /* end H5VL_subfiling_attr_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_subfiling_attr_optional + * + * Purpose: Perform a connector-specific operation on an attribute + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_subfiling_attr_optional(void *obj, H5VL_attr_optional_t opt_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL ATTRIBUTE Optional\n"); +#endif + + ret_value = H5VLattr_optional(o->under_object, o->under_vol_id, opt_type, dxpl_id, req, arguments); + + /* Check for async request */ + if(req && *req) + *req = H5VL_subfiling_new_obj(*req, o->under_vol_id); + + return ret_value; +} /* end H5VL_subfiling_attr_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_subfiling_attr_close + * + * Purpose: Closes an attribute. + * + * Return: Success: 0 + * Failure: -1, attr not closed. + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_subfiling_attr_close(void *attr, hid_t dxpl_id, void **req) +{ + H5VL_subfiling_t *o = (H5VL_subfiling_t *)attr; + herr_t ret_value; + +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL ATTRIBUTE Close\n"); +#endif + + ret_value = H5VLattr_close(o->under_object, o->under_vol_id, dxpl_id, req); + + /* Check for async request */ + if(req && *req) + *req = H5VL_subfiling_new_obj(*req, o->under_vol_id); + + /* Release our wrapper, if underlying attribute was closed */ + if(ret_value >= 0) + H5VL_subfiling_free_obj(o); + + return ret_value; +} /* end H5VL_subfiling_attr_close() */ + +static herr_t +dataset_get_offset_helper(H5VL_subfiling_t *dset, ...) +{ + herr_t ret_value; + va_list ap; + va_start(ap, dset); + if ((ret_value = H5VL_subfiling_dataset_optional(dset, H5VL_NATIVE_DATASET_GET_OFFSET, 0, NULL, ap)) < 0) + puts("unable to get file_offset"); + va_end(ap); + return ret_value; +} + +static herr_t +dataset_get_dcpl_helper(H5VL_subfiling_t *dset, ...) +{ + herr_t ret_value; + va_list ap; + va_start(ap, dset); + if ((ret_value = H5VL_subfiling_dataset_get(dset, H5VL_DATASET_GET_DCPL, 0, NULL, ap)) < 0) + puts("unable to get dataset dcpl"); + va_end(ap); + return ret_value; +} + + +/*---------------------------------------------------------------------------*/ +static H5VL_subfiling_dset_t * +H5VL__subfiling_dset_init(H5VL_subfiling_item_t *item) +{ + H5VL_subfiling_dset_t *dset = NULL; + + /* Allocate the dataset object that is returned to the user */ + if(NULL == (dset = malloc(sizeof(H5VL_subfiling_dset_t)))) { + puts("can't allocate subfiling dataset struct"); + return NULL; + } + memset(dset, 0, sizeof(H5VL_subfiling_dset_t)); + + dset->obj.item.type = H5I_DATASET; + dset->obj.item.file = item->file; + dset->mapped = 0; + dset->type_id = -1; + dset->space_id = -1; + dset->dcpl_id = -1; + dset->dapl_id = -1; + + /* Set return value */ + return((void *)dset); + +done: + return NULL; +} /* end H5VL__subfiling_dset_init() */ + +/*------------------------------------------------------------------------- + * Function: H5VL_subfiling_dataset_create + * + * Purpose: Creates a dataset in a container + * + * Return: Success: Pointer to a dataset object + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +static void * +H5VL_subfiling_dataset_create(void *obj, const H5VL_loc_params_t *loc_params, + const char *name, hid_t lcpl_id, hid_t type_id, hid_t space_id, + hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req ) +{ + H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj; + H5VL_subfiling_dset_t *subfiling_dset; + H5VL_subfiling_dset_t *_dset = NULL; + H5VL_subfiling_t *dset = NULL; + haddr_t f_offset; + void *under; + +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL DATASET Create\n"); +#endif + if (NULL == (subfiling_dset = H5VL__subfiling_dset_init(&o->obj.item))) { + perror("dset_init"); + return NULL; + } + else { + subfiling_dset->obj.item.file = o->obj.item.file; + strcpy(subfiling_dset->obj.obj_name, name); + + if((subfiling_dset->type_id = H5Tcopy(type_id)) < 0) { + fprintf(stderr, "failed to copy datatype\n"); + free(subfiling_dset); + goto done; + } + if((subfiling_dset->space_id = H5Scopy(space_id)) < 0) { + fprintf(stderr, "failed to copy dataspace\n"); + free(subfiling_dset); + goto done; + } + if(H5Sselect_all(subfiling_dset->space_id) < 0) { + fprintf(stderr, "can't change selection\n"); + free(subfiling_dset); + goto done; + } + if((subfiling_dset->dcpl_id = H5Pcopy(dcpl_id)) < 0) { + fprintf(stderr, "failed to copy dcpl\n"); + free(subfiling_dset); + goto done; + } + if((subfiling_dset->dapl_id = H5Pcopy(dapl_id)) < 0) { + fprintf(stderr, "failed to copy dapl\n"); + free(subfiling_dset); + goto done; + } + } + + under = H5VLdataset_create(o->under_object, loc_params, o->under_vol_id, + name, lcpl_id, type_id, space_id, dcpl_id, dapl_id, dxpl_id, req); + + if(under) { + dset = H5VL_subfiling_new_obj(under, o->under_vol_id); + dset->obj.item.file = subfiling_dset; + subfiling_dset->f_offset = 0; + if (dataset_get_offset_helper(dset, &f_offset) < 0) + puts("Unable to get file_offset"); + else subfiling_dset->f_offset = f_offset; + + /* Check for async request */ + if(req && *req) + *req = H5VL_subfiling_new_obj(*req, o->under_vol_id); + + } /* end if */ + else + dset = NULL; + +done: + return (void *)dset; +} /* end H5VL_subfiling_dataset_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_subfiling_dataset_open + * + * Purpose: Opens a dataset in a container + * + * Return: Success: Pointer to a dataset object + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +static void * +H5VL_subfiling_dataset_open(void *obj, const H5VL_loc_params_t *loc_params, + const char *name, hid_t dapl_id, hid_t dxpl_id, void **req) +{ + H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj; + H5VL_subfiling_dset_t *subfiling_dset; + H5VL_subfiling_dset_t *_dset = NULL; + H5VL_subfiling_t *dset = NULL; + hid_t dcpl_id; + haddr_t f_offset; + void *under; + + +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL DATASET Open\n"); +#endif + + if (NULL == (subfiling_dset = H5VL__subfiling_dset_init(&o->obj.item))) { + perror("dset_init"); + return NULL; + } + else { + subfiling_dset->obj.item.type = H5I_DATASET; + subfiling_dset->obj.item.file = o->obj.item.file; + strcpy(subfiling_dset->obj.obj_name, name); + + if((subfiling_dset->dapl_id = H5Pcopy(dapl_id)) < 0) { + fprintf(stderr, "failed to copy dapl\n"); + free(subfiling_dset); + goto done; + } + } + + under = H5VLdataset_open(o->under_object, loc_params, o->under_vol_id, name, dapl_id, dxpl_id, req); + if(under) { + dset = H5VL_subfiling_new_obj(under, o->under_vol_id); + dset->obj.item.file = subfiling_dset; + subfiling_dset->f_offset = 0; + if (dataset_get_offset_helper(dset, &f_offset) < 0) + puts("Unable to get file_offset"); + else subfiling_dset->f_offset = f_offset; + if (dataset_get_dcpl_helper(dset, &dcpl_id) < 0) + puts("Unable to get dcpl"); + else if ((subfiling_dset->dcpl_id = H5Pcopy(dcpl_id)) < 1) + puts("Unable to get dcpl_id"); + + /* Check for async request */ + if(req && *req) + *req = H5VL_subfiling_new_obj(*req, o->under_vol_id); + + } /* end if */ + else + dset = NULL; + +done: + return (void *)dset; +} /* end H5VL_subfiling_dataset_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_subfiling_dataset_read + * + * Purpose: Reads data elements from a dataset into a buffer. + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_subfiling_dataset_read(void *dset, hid_t mem_type_id, hid_t mem_space_id, + hid_t file_space_id, hid_t plist_id, void *buf, void **req) +{ + H5VL_subfiling_t *o = (H5VL_subfiling_t *)dset; + H5VL_subfiling_dset_t *subfiling_dset = NULL; + H5VL_subfiling_file_t *subfiling_file = NULL; + H5S_sel_type sel_type; + // H5S_t *mem_space = NULL; + // H5S_t *file_space = NULL; + H5D_layout_t layout_method; + uint64_t h5_file_id; + size_t type_extent = 1; + int is_simple, simple_n_dims; + int ndims, nblocks, my_rank; + hid_t real_file_space_id; + hid_t real_mem_space_id; + hssize_t num_elem_file = -1, num_elem_mem = -1; + haddr_t file_offset; + herr_t ret_value; + + hssize_t n_blocks; + /* For regular hyperslabs */ + haddr_t start[H5S_MAX_RANK]; + hsize_t stride[H5S_MAX_RANK]; + hsize_t count[H5S_MAX_RANK]; + hsize_t blocklen[H5S_MAX_RANK]; + void *addrs[H5S_MAX_RANK]; + + assert(dset); + subfiling_dset = o->obj.item.file; + assert(subfiling_dset); + subfiling_file = subfiling_dset->obj.item.file; + assert(subfiling_file); + + h5_file_id = (uint64_t)subfiling_file->h5_file_id; + +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL DATASET Read\n"); +#endif + + type_extent = H5Tget_size(mem_type_id); + + if((layout_method = H5Pget_layout(subfiling_dset->dcpl_id)) < 0) + puts("can't get layout property"); + + if (layout_method == H5D_CONTIGUOUS) { + ret_value = H5FD__dataset_read_contiguous(h5_file_id, subfiling_dset->f_offset, type_extent, + subfiling_file->my_rank, subfiling_file->num_procs, o->under_object, + mem_type_id, mem_space_id, file_space_id, plist_id, buf); + } + else { + ret_value = H5VLdataset_read(o->under_object, o->under_vol_id, + mem_type_id, mem_space_id, file_space_id, plist_id, buf, req); + } + + /* Check for async request */ + if(req && *req) + *req = H5VL_subfiling_new_obj(*req, o->under_vol_id); + + return ret_value; +} /* end H5VL_subfiling_dataset_read() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_subfiling_dataset_write + * + * Purpose: Writes data elements from a buffer into a dataset. + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_subfiling_dataset_write(void *dset, hid_t mem_type_id, hid_t mem_space_id, + hid_t file_space_id, hid_t plist_id, const void *buf, void **req) +{ + /* + * The incoming dset is a H5VL_subfiling_t and has the following fields:: + * The 'obj' field is VOL specfic and references the vol object that are + * created and are used to manage the underlying 'native' objects. + * Once created, the dataset object can be used to read and write. The + * subfiling_dset_t maintains the subfiling_file_t as a reference for + * use with the actual subfiling VFD componenets. Example: + * the subfile_dset is referenced by o->obj.item.file; + * the subfile_file is referenced by subfile_dset->obj.item.file. + * + * o->obj: (This will contain the specfics of the created dataset, + * e.g. the dataset item and object_name. + * + * o->under_object: (which is actually the native H5D_t *) + * o->under_vol_id: (This is the pass_through vol id which was passed + * into the dataset_create and copied here) + */ + + H5VL_subfiling_t *o = (H5VL_subfiling_t *)dset; + H5VL_subfiling_dset_t *subfiling_dset = NULL; + H5VL_subfiling_file_t *subfiling_file = NULL; + H5S_sel_type sel_type; + H5D_layout_t layout_method; + uint64_t h5_file_id; + size_t type_extent = 1; + int is_simple, simple_n_dims; + int ndims, nblocks, my_rank; + hid_t real_file_space_id; + hid_t real_mem_space_id; + hssize_t num_elem_file = -1, num_elem_mem = -1; + haddr_t file_offset; + herr_t ret_value; + + hssize_t n_blocks; + /* For regular hyperslabs */ + haddr_t start[H5S_MAX_RANK]; + hsize_t stride[H5S_MAX_RANK]; + hsize_t count[H5S_MAX_RANK]; + hsize_t blocklen[H5S_MAX_RANK]; + void *addrs[H5S_MAX_RANK]; + + assert(dset); + subfiling_dset = o->obj.item.file; + assert(subfiling_dset); + subfiling_file = subfiling_dset->obj.item.file; + assert(subfiling_file); + + h5_file_id = (uint64_t)subfiling_file->h5_file_id; + +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL DATASET Write\n"); +#endif + + type_extent = H5Tget_size(mem_type_id); + + if((layout_method = H5Pget_layout(subfiling_dset->dcpl_id)) < 0) + puts("can't get layout property"); + + if (layout_method == H5D_CONTIGUOUS) { + // ret_value = sf_write_vector(h5_file_id, vlen, start, blocklen, addrs); + ret_value = H5FD__dataset_write_contiguous(h5_file_id, subfiling_dset->f_offset, type_extent, + subfiling_file->my_rank, subfiling_file->num_procs, o->under_object, + mem_type_id, mem_space_id, file_space_id, plist_id, buf); + } + else { + ret_value = H5VLdataset_write(o->under_object, o->under_vol_id, + mem_type_id, mem_space_id, file_space_id, plist_id, buf, req); + } + + /* Check for async request */ + if(req && *req) + *req = H5VL_subfiling_new_obj(*req, o->under_vol_id); + + return ret_value; +} /* end H5VL_subfiling_dataset_write() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_subfiling_dataset_get + * + * Purpose: Gets information about a dataset + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_subfiling_dataset_get(void *dset, H5VL_dataset_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_subfiling_t *o = (H5VL_subfiling_t *)dset; + herr_t ret_value; + +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL DATASET Get\n"); +#endif + + ret_value = H5VLdataset_get(o->under_object, o->under_vol_id, get_type, dxpl_id, req, arguments); + + /* Check for async request */ + if(req && *req) + *req = H5VL_subfiling_new_obj(*req, o->under_vol_id); + + return ret_value; +} /* end H5VL_subfiling_dataset_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_subfiling_dataset_specific + * + * Purpose: Specific operation on a dataset + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_subfiling_dataset_specific(void *obj, H5VL_dataset_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj; + hid_t under_vol_id; + herr_t ret_value; + +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL H5Dspecific\n"); +#endif + + // Save copy of underlying VOL connector ID and prov helper, in case of + // refresh destroying the current object + under_vol_id = o->under_vol_id; + + ret_value = H5VLdataset_specific(o->under_object, o->under_vol_id, specific_type, dxpl_id, req, arguments); + + /* Check for async request */ + if(req && *req) + *req = H5VL_subfiling_new_obj(*req, under_vol_id); + + return ret_value; +} /* end H5VL_subfiling_dataset_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_subfiling_dataset_optional + * + * Purpose: Perform a connector-specific operation on a dataset + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_subfiling_dataset_optional(void *obj, H5VL_dataset_optional_t opt_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL DATASET Optional\n"); +#endif + + ret_value = H5VLdataset_optional(o->under_object, o->under_vol_id, opt_type, dxpl_id, req, arguments); + + /* Check for async request */ + if(req && *req) + *req = H5VL_subfiling_new_obj(*req, o->under_vol_id); + + return ret_value; +} /* end H5VL_subfiling_dataset_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_subfiling_dataset_close + * + * Purpose: Closes a dataset. + * + * Return: Success: 0 + * Failure: -1, dataset not closed. + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_subfiling_dataset_close(void *dset, hid_t dxpl_id, void **req) +{ + H5VL_subfiling_t *o = (H5VL_subfiling_t *)dset; + H5VL_subfiling_dset_t *subfiling_dset = NULL; + herr_t ret_value; + +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL DATASET Close\n"); +#endif + assert(dset); + subfiling_dset = o->obj.item.file; + + ret_value = H5VLdataset_close(o->under_object, o->under_vol_id, dxpl_id, req); + + /* Check for async request */ + if(req && *req) + *req = H5VL_subfiling_new_obj(*req, o->under_vol_id); + + /* Release our wrapper, if underlying dataset was closed */ + if(ret_value >= 0) { + if (subfiling_dset) + free(subfiling_dset); + H5VL_subfiling_free_obj(o); + } + return ret_value; +} /* end H5VL_subfiling_dataset_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_subfiling_datatype_commit + * + * Purpose: Commits a datatype inside a container. + * + * Return: Success: Pointer to datatype object + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +static void * +H5VL_subfiling_datatype_commit(void *obj, const H5VL_loc_params_t *loc_params, + const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, + hid_t dxpl_id, void **req) +{ + H5VL_subfiling_t *dt; + H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj; + void *under; + +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL DATATYPE Commit\n"); +#endif + + under = H5VLdatatype_commit(o->under_object, loc_params, o->under_vol_id, name, type_id, lcpl_id, tcpl_id, tapl_id, dxpl_id, req); + if(under) { + dt = H5VL_subfiling_new_obj(under, o->under_vol_id); + + /* Check for async request */ + if(req && *req) + *req = H5VL_subfiling_new_obj(*req, o->under_vol_id); + } /* end if */ + else + dt = NULL; + + return (void *)dt; +} /* end H5VL_subfiling_datatype_commit() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_subfiling_datatype_open + * + * Purpose: Opens a named datatype inside a container. + * + * Return: Success: Pointer to datatype object + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +static void * +H5VL_subfiling_datatype_open(void *obj, const H5VL_loc_params_t *loc_params, + const char *name, hid_t tapl_id, hid_t dxpl_id, void **req) +{ + H5VL_subfiling_t *dt; + H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj; + void *under; + +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL DATATYPE Open\n"); +#endif + + under = H5VLdatatype_open(o->under_object, loc_params, o->under_vol_id, name, tapl_id, dxpl_id, req); + if(under) { + dt = H5VL_subfiling_new_obj(under, o->under_vol_id); + + /* Check for async request */ + if(req && *req) + *req = H5VL_subfiling_new_obj(*req, o->under_vol_id); + } /* end if */ + else + dt = NULL; + + return (void *)dt; +} /* end H5VL_subfiling_datatype_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_subfiling_datatype_get + * + * Purpose: Get information about a datatype + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_subfiling_datatype_get(void *dt, H5VL_datatype_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_subfiling_t *o = (H5VL_subfiling_t *)dt; + herr_t ret_value; + +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL DATATYPE Get\n"); +#endif + + ret_value = H5VLdatatype_get(o->under_object, o->under_vol_id, get_type, dxpl_id, req, arguments); + + /* Check for async request */ + if(req && *req) + *req = H5VL_subfiling_new_obj(*req, o->under_vol_id); + + return ret_value; +} /* end H5VL_subfiling_datatype_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_subfiling_datatype_specific + * + * Purpose: Specific operations for datatypes + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_subfiling_datatype_specific(void *obj, H5VL_datatype_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj; + hid_t under_vol_id; + herr_t ret_value; + +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL DATATYPE Specific\n"); +#endif + + // Save copy of underlying VOL connector ID and prov helper, in case of + // refresh destroying the current object + under_vol_id = o->under_vol_id; + + ret_value = H5VLdatatype_specific(o->under_object, o->under_vol_id, specific_type, dxpl_id, req, arguments); + + /* Check for async request */ + if(req && *req) + *req = H5VL_subfiling_new_obj(*req, under_vol_id); + + return ret_value; +} /* end H5VL_subfiling_datatype_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_subfiling_datatype_optional + * + * Purpose: Perform a connector-specific operation on a datatype + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_subfiling_datatype_optional(void *obj, H5VL_datatype_optional_t opt_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL DATATYPE Optional\n"); +#endif + + ret_value = H5VLdatatype_optional(o->under_object, o->under_vol_id, opt_type, dxpl_id, req, arguments); + + /* Check for async request */ + if(req && *req) + *req = H5VL_subfiling_new_obj(*req, o->under_vol_id); + + return ret_value; +} /* end H5VL_subfiling_datatype_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_subfiling_datatype_close + * + * Purpose: Closes a datatype. + * + * Return: Success: 0 + * Failure: -1, datatype not closed. + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_subfiling_datatype_close(void *dt, hid_t dxpl_id, void **req) +{ + H5VL_subfiling_t *o = (H5VL_subfiling_t *)dt; + herr_t ret_value; + +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL DATATYPE Close\n"); +#endif + + assert(o->under_object); + + ret_value = H5VLdatatype_close(o->under_object, o->under_vol_id, dxpl_id, req); + + /* Check for async request */ + if(req && *req) + *req = H5VL_subfiling_new_obj(*req, o->under_vol_id); + + /* Release our wrapper, if underlying datatype was closed */ + if(ret_value >= 0) + H5VL_subfiling_free_obj(o); + + return ret_value; +} /* end H5VL_subfiling_datatype_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_subfiling_file_create + * + * Purpose: Creates a container using this connector + * + * Return: Success: Pointer to a file object + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +static void * +H5VL_subfiling_file_create(const char *name, unsigned flags, hid_t fcpl_id, + hid_t fapl_id, hid_t dxpl_id, void **req) +{ + H5VL_subfiling_info_t *info; + H5VL_subfiling_t *file; + H5VL_subfiling_file_t *subfiling_file; + hid_t under_fapl_id = -1; + void *ret_value = NULL; + void *under = NULL; + +#if 0 + file_create_count++; + printf("%s: count=%d\n", __func__, file_create_count); + fflush(stdout); +#endif +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL FILE Create\n"); +#endif + + /* Get copy of our VOL info from FAPL */ + H5Pget_vol_info(fapl_id, (void **)&info); + + /* Make sure we have info about the underlying VOL to be used */ + if (!info) + return NULL; + + /* Copy the FAPL */ + under_fapl_id = H5Pcopy(fapl_id); + + /* Set the VOL ID and info for the underlying FAPL */ + H5Pset_vol(under_fapl_id, info->under_vol_id, info->under_vol_info); + + /* Open the file with the underlying VOL connector */ + under = H5VLfile_create(name, flags, fcpl_id, under_fapl_id, dxpl_id, req); + if(under) { + int mpi_enabled = 0; + int open_flags = O_RDWR; + char *dir_path = NULL; + char file_prefix[PATH_MAX]; + uint64_t h5_file_id = (uint64_t)0; + + /* We can't use the HDF5 file flags directly, these + * need to be translated into posix versions + * for the subfiling. + */ + if (flags & H5F_ACC_TRUNC) open_flags |= O_TRUNC; + if (flags & H5F_ACC_CREAT) open_flags |= O_CREAT; + + file = H5VL_subfiling_new_obj(under, info->under_vol_id); + if(NULL == (subfiling_file = (H5VL_subfiling_file_t *)malloc(sizeof(H5VL_subfiling_file_t)))) { + perror("malloc"); + fprintf(stderr, "can't allocate Subfiling file struct"); + ret_value = file; + goto done; + } + memset(subfiling_file, 0, sizeof(H5VL_subfiling_file_t)); + file->obj.item.type = H5I_FILE; + file->obj.item.file = subfiling_file; + + /* Check for async request */ + if(req && *req) + *req = H5VL_subfiling_new_obj(*req, info->under_vol_id); + + if (MPI_Initialized(&mpi_enabled) == MPI_SUCCESS) { + MPI_Comm_size(MPI_COMM_WORLD, &subfiling_file->num_procs); + MPI_Comm_rank(MPI_COMM_WORLD, &subfiling_file->my_rank); + if (subfiling_file->my_rank == 0) { + if (H5FD__get_file_ino(name, &h5_file_id) < 0) + file = NULL; + } + if (MPI_Bcast(&h5_file_id, 1, MPI_UINT64_T, 0, MPI_COMM_WORLD) != MPI_SUCCESS) + file = NULL; + } + + if (file != NULL) { + dir_path = strrchr(name,'/'); + if (dir_path) { + *dir_path = '\0'; + strcpy(file_prefix, name); + *dir_path = '/'; + dir_path = file_prefix; + } + else { + dir_path = getcwd(file_prefix, PATH_MAX); + } + /* Only open subfiling if we've enabled MPI */ + if (mpi_enabled && (sf_open_subfiles(h5_file_id, name, dir_path, open_flags) < 0)) { + file = NULL; + } + else { + subfiling_file->h5_file_id = h5_file_id; + subfiling_file->file_name = strdup(name); + } + } + } /* end if */ + else + file = NULL; + +done: + + ret_value = (void *)file; + + /* Close underlying FAPL */ + H5Pclose(under_fapl_id); + + /* Release copy of our VOL info */ + if (info) + H5VL_subfiling_info_free(info); + + return (void *)file; +} /* end H5VL_subfiling_file_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_subfiling_file_open + * + * Purpose: Opens a container created with this connector + * + * Return: Success: Pointer to a file object + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +static void * +H5VL_subfiling_file_open(const char *name, unsigned flags, hid_t fapl_id, + hid_t dxpl_id, void **req) +{ + H5VL_subfiling_info_t *info; + H5VL_subfiling_file_t *subfiling_file; + H5VL_subfiling_t *file; + hid_t under_fapl_id = -1; + void *ret_value = NULL; + void *under = NULL; + +#if 0 + file_open_count++; + printf("%s: count=%d\n", __func__, file_open_count); + fflush(stdout); +#endif +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL FILE Open\n"); +#endif + + /* Get copy of our VOL info from FAPL */ + H5Pget_vol_info(fapl_id, (void **)&info); + + /* Make sure we have info about the underlying VOL to be used */ + if (!info) + return NULL; + + /* Copy the FAPL */ + under_fapl_id = H5Pcopy(fapl_id); + + /* Set the VOL ID and info for the underlying FAPL */ + H5Pset_vol(under_fapl_id, info->under_vol_id, info->under_vol_info); + + /* Open the file with the underlying VOL connector */ + under = H5VLfile_open(name, flags, under_fapl_id, dxpl_id, req); + if(under) { + int mpi_enabled = 0; + int open_flags = O_RDWR; + char *dir_path = NULL; + char file_prefix[PATH_MAX]; + uint64_t h5_file_id = (uint64_t)-1; + + /* We can't use the HDF5 file flags directly, these + * need to be translated into posix versions + * for the subfiling. + */ + if (flags & H5F_ACC_TRUNC) open_flags |= O_TRUNC; + if (flags & H5F_ACC_CREAT) open_flags |= O_CREAT; + + file = H5VL_subfiling_new_obj(under, info->under_vol_id); + if(NULL == (subfiling_file = (H5VL_subfiling_file_t *)malloc(sizeof(H5VL_subfiling_file_t)))) { + perror("malloc"); + fprintf(stderr, "can't allocate Subfiling file struct"); + ret_value = file; + goto done; + } + memset(subfiling_file, 0, sizeof(H5VL_subfiling_file_t)); + file->obj.item.type = H5I_FILE; + file->obj.item.file = subfiling_file; + /* Check for async request */ + if(req && *req) + *req = H5VL_subfiling_new_obj(*req, info->under_vol_id); + + if (MPI_Initialized(&mpi_enabled) == MPI_SUCCESS) { + MPI_Comm_size(MPI_COMM_WORLD, &subfiling_file->num_procs); + MPI_Comm_rank(MPI_COMM_WORLD, &subfiling_file->my_rank); + if (subfiling_file->my_rank == 0) { + if (H5FD__get_file_ino(name, &h5_file_id) < 0) + file = NULL; + } + if (MPI_Bcast(&h5_file_id, 1, MPI_UINT64_T, 0, MPI_COMM_WORLD) != MPI_SUCCESS) + file = NULL; + } + + if (file != NULL) { + dir_path = strrchr(name,'/'); + if (dir_path) { + *dir_path = '\0'; + strcpy(file_prefix, name); + *dir_path = '/'; + dir_path = file_prefix; + } + else { + dir_path = getcwd(file_prefix, PATH_MAX); + } + + /* Only open subfiling if we've enabled MPI */ + if (mpi_enabled && (sf_open_subfiles(h5_file_id, name, dir_path, open_flags) < 0)) { + file = NULL; + } + else { + subfiling_file->h5_file_id = h5_file_id; + subfiling_file->file_name = strdup(name); + } + } + + } /* end if */ + else + file = NULL; + +done: + + ret_value = (void *)file; + + /* Close underlying FAPL */ + H5Pclose(under_fapl_id); + + /* Release copy of our VOL info */ + if (info) + H5VL_subfiling_info_free(info); + + return (void *)ret_value; + +} /* end H5VL_subfiling_file_open() */ + +/*------------------------------------------------------------------------- + * Function: H5VL_subfiling_file_get + * + * Purpose: Get info about a file + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_subfiling_file_get(void *file, H5VL_file_get_t get_type, hid_t dxpl_id, + void **req, va_list arguments) +{ + H5VL_subfiling_t *o = (H5VL_subfiling_t *)file; + herr_t ret_value; + +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL FILE Get\n"); +#endif + + ret_value = H5VLfile_get(o->under_object, o->under_vol_id, get_type, dxpl_id, req, arguments); + + /* Check for async request */ + if(req && *req) + *req = H5VL_subfiling_new_obj(*req, o->under_vol_id); + + return ret_value; +} /* end H5VL_subfiling_file_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_subfiling_file_specific_reissue + * + * Purpose: Re-wrap vararg arguments into a va_list and reissue the + * file specific callback to the underlying VOL connector. + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_subfiling_file_specific_reissue(void *obj, hid_t connector_id, + H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, ...) +{ + va_list arguments; + herr_t ret_value; + + va_start(arguments, req); + ret_value = H5VLfile_specific(obj, connector_id, specific_type, dxpl_id, req, arguments); + va_end(arguments); + + return ret_value; +} /* end H5VL_subfiling_file_specific_reissue() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_subfiling_file_specific + * + * Purpose: Specific operation on file + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_subfiling_file_specific(void *file, H5VL_file_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_subfiling_t *o = (H5VL_subfiling_t *)file; + hid_t under_vol_id = -1; + herr_t ret_value; + +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL FILE Specific\n"); +#endif + + /* Unpack arguments to get at the child file pointer when mounting a file */ + if(specific_type == H5VL_FILE_MOUNT) { + H5I_type_t loc_type; + const char *name; + H5VL_subfiling_t *child_file; + hid_t plist_id; + + /* Retrieve parameters for 'mount' operation, so we can unwrap the child file */ + loc_type = (H5I_type_t)va_arg(arguments, int); /* enum work-around */ + name = va_arg(arguments, const char *); + child_file = (H5VL_subfiling_t *)va_arg(arguments, void *); + plist_id = va_arg(arguments, hid_t); + + /* Keep the correct underlying VOL ID for possible async request token */ + under_vol_id = o->under_vol_id; + + /* Re-issue 'file specific' call, using the unwrapped pieces */ + ret_value = H5VL_subfiling_file_specific_reissue(o->under_object, o->under_vol_id, specific_type, dxpl_id, req, (int)loc_type, name, child_file->under_object, plist_id); + } /* end if */ + else if(specific_type == H5VL_FILE_IS_ACCESSIBLE || specific_type == H5VL_FILE_DELETE) { + H5VL_subfiling_info_t *info; + hid_t fapl_id, under_fapl_id; + const char *name; + htri_t *ret; + + /* Get the arguments for the 'is accessible' check */ + fapl_id = va_arg(arguments, hid_t); + name = va_arg(arguments, const char *); + ret = va_arg(arguments, htri_t *); + + /* Get copy of our VOL info from FAPL */ + H5Pget_vol_info(fapl_id, (void **)&info); + + /* Make sure we have info about the underlying VOL to be used */ + if (!info) + return (-1); + + /* Copy the FAPL */ + under_fapl_id = H5Pcopy(fapl_id); + + /* Set the VOL ID and info for the underlying FAPL */ + H5Pset_vol(under_fapl_id, info->under_vol_id, info->under_vol_info); + + /* Keep the correct underlying VOL ID for possible async request token */ + under_vol_id = info->under_vol_id; + + /* Re-issue 'file specific' call */ + ret_value = H5VL_subfiling_file_specific_reissue(NULL, info->under_vol_id, specific_type, dxpl_id, req, under_fapl_id, name, ret); + + /* Close underlying FAPL */ + H5Pclose(under_fapl_id); + + /* Release copy of our VOL info */ + H5VL_subfiling_info_free(info); + } /* end else-if */ + else { + va_list my_arguments; + + /* Make a copy of the argument list for later, if reopening */ + if(specific_type == H5VL_FILE_REOPEN) + va_copy(my_arguments, arguments); + + /* Keep the correct underlying VOL ID for possible async request token */ + under_vol_id = o->under_vol_id; + + ret_value = H5VLfile_specific(o->under_object, o->under_vol_id, specific_type, dxpl_id, req, arguments); + + /* Wrap file struct pointer, if we reopened one */ + if(specific_type == H5VL_FILE_REOPEN) { + if(ret_value >= 0) { + void **ret = va_arg(my_arguments, void **); + + if(ret && *ret) + *ret = H5VL_subfiling_new_obj(*ret, o->under_vol_id); + } /* end if */ + + /* Finish use of copied vararg list */ + va_end(my_arguments); + } /* end if */ + } /* end else */ + + /* Check for async request */ + if(req && *req) + *req = H5VL_subfiling_new_obj(*req, under_vol_id); + + return ret_value; +} /* end H5VL_subfiling_file_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_subfiling_file_optional + * + * Purpose: Perform a connector-specific operation on a file + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_subfiling_file_optional(void *file, H5VL_file_optional_t opt_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_subfiling_t *o = (H5VL_subfiling_t *)file; + herr_t ret_value; + +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL File Optional\n"); +#endif + + ret_value = H5VLfile_optional(o->under_object, o->under_vol_id, opt_type, dxpl_id, req, arguments); + + /* Check for async request */ + if(req && *req) + *req = H5VL_subfiling_new_obj(*req, o->under_vol_id); + + return ret_value; +} /* end H5VL_subfiling_file_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_subfiling_file_close + * + * Purpose: Closes a file. + * + * Return: Success: 0 + * Failure: -1, file not closed. + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_subfiling_file_close(void *_file, hid_t dxpl_id, void **req) +{ + H5VL_subfiling_t *o = (H5VL_subfiling_t *)_file; + H5VL_subfiling_file_t *subfiling_file = (H5VL_subfiling_file_t *)o->obj.item.file; + int mpi_enabled = 0; + herr_t ret_value; +#if 0 + file_close_count++; + printf("%s: count=%d\n", __func__, file_close_count); + fflush(stdout); +#endif + if (file_create_count > 0) { + if (file_create_count != file_close_count) + puts("mismatched file_create_count and file_close_count"); + file_create_count = 0; + } + if (file_open_count > 0) { + if (file_open_count != file_close_count) + puts("mismatched file_open_count and file_close_count"); + file_open_count = 0; + } + + file_close_count = 0; + +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL FILE Close\n"); +#endif + assert(subfiling_file != NULL); + ret_value = H5VLfile_close(o->under_object, o->under_vol_id, dxpl_id, req); + + if (MPI_Initialized(&mpi_enabled) == MPI_SUCCESS) { + uint64_t h5_file_id = (uint64_t)subfiling_file->h5_file_id; + if (mpi_enabled && (sf_close_subfiles(h5_file_id) < 0)) { + printf("Unable to close subfiles\n"); + ret_value = -1; + } + else { + if (subfiling_file->file_name) + free(subfiling_file->file_name); + free(subfiling_file); + } + } + + /* Check for async request */ + if(req && *req) + *req = H5VL_subfiling_new_obj(*req, o->under_vol_id); + + /* Release our wrapper, if underlying file was closed */ + if(ret_value >= 0) + H5VL_subfiling_free_obj(o); + + return ret_value; +} /* end H5VL_subfiling_file_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_subfiling_group_create + * + * Purpose: Creates a group inside a container + * + * Return: Success: Pointer to a group object + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +static void * +H5VL_subfiling_group_create(void *obj, const H5VL_loc_params_t *loc_params, + const char *name, hid_t lcpl_id, hid_t gcpl_id, hid_t gapl_id, + hid_t dxpl_id, void **req) +{ + H5VL_subfiling_t *group; + H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj; + void *under; + +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL GROUP Create\n"); +#endif + + under = H5VLgroup_create(o->under_object, loc_params, o->under_vol_id, name, lcpl_id, gcpl_id, gapl_id, dxpl_id, req); + if(under) { + group = H5VL_subfiling_new_obj(under, o->under_vol_id); + + /* Check for async request */ + if(req && *req) + *req = H5VL_subfiling_new_obj(*req, o->under_vol_id); + } /* end if */ + else + group = NULL; + + return (void *)group; +} /* end H5VL_subfiling_group_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_subfiling_group_open + * + * Purpose: Opens a group inside a container + * + * Return: Success: Pointer to a group object + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +static void * +H5VL_subfiling_group_open(void *obj, const H5VL_loc_params_t *loc_params, + const char *name, hid_t gapl_id, hid_t dxpl_id, void **req) +{ + H5VL_subfiling_t *group; + H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj; + void *under; + +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL GROUP Open\n"); +#endif + + under = H5VLgroup_open(o->under_object, loc_params, o->under_vol_id, name, gapl_id, dxpl_id, req); + if(under) { + group = H5VL_subfiling_new_obj(under, o->under_vol_id); + + /* Check for async request */ + if(req && *req) + *req = H5VL_subfiling_new_obj(*req, o->under_vol_id); + } /* end if */ + else + group = NULL; + + return (void *)group; +} /* end H5VL_subfiling_group_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_subfiling_group_get + * + * Purpose: Get info about a group + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_subfiling_group_get(void *obj, H5VL_group_get_t get_type, hid_t dxpl_id, + void **req, va_list arguments) +{ + H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL GROUP Get\n"); +#endif + + ret_value = H5VLgroup_get(o->under_object, o->under_vol_id, get_type, dxpl_id, req, arguments); + + /* Check for async request */ + if(req && *req) + *req = H5VL_subfiling_new_obj(*req, o->under_vol_id); + + return ret_value; +} /* end H5VL_subfiling_group_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_subfiling_group_specific + * + * Purpose: Specific operation on a group + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_subfiling_group_specific(void *obj, H5VL_group_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj; + hid_t under_vol_id; + herr_t ret_value; + +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL GROUP Specific\n"); +#endif + + // Save copy of underlying VOL connector ID and prov helper, in case of + // refresh destroying the current object + under_vol_id = o->under_vol_id; + + ret_value = H5VLgroup_specific(o->under_object, o->under_vol_id, specific_type, dxpl_id, req, arguments); + + /* Check for async request */ + if(req && *req) + *req = H5VL_subfiling_new_obj(*req, under_vol_id); + + return ret_value; +} /* end H5VL_subfiling_group_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_subfiling_group_optional + * + * Purpose: Perform a connector-specific operation on a group + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_subfiling_group_optional(void *obj, H5VL_group_optional_t opt_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL GROUP Optional\n"); +#endif + + ret_value = H5VLgroup_optional(o->under_object, o->under_vol_id, opt_type, dxpl_id, req, arguments); + + /* Check for async request */ + if(req && *req) + *req = H5VL_subfiling_new_obj(*req, o->under_vol_id); + + return ret_value; +} /* end H5VL_subfiling_group_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_subfiling_group_close + * + * Purpose: Closes a group. + * + * Return: Success: 0 + * Failure: -1, group not closed. + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_subfiling_group_close(void *grp, hid_t dxpl_id, void **req) +{ + H5VL_subfiling_t *o = (H5VL_subfiling_t *)grp; + herr_t ret_value; + +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL H5Gclose\n"); +#endif + + ret_value = H5VLgroup_close(o->under_object, o->under_vol_id, dxpl_id, req); + + /* Check for async request */ + if(req && *req) + *req = H5VL_subfiling_new_obj(*req, o->under_vol_id); + + /* Release our wrapper, if underlying file was closed */ + if(ret_value >= 0) + H5VL_subfiling_free_obj(o); + + return ret_value; +} /* end H5VL_subfiling_group_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_subfiling_link_create_reissue + * + * Purpose: Re-wrap vararg arguments into a va_list and reissue the + * link create callback to the underlying VOL connector. + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_subfiling_link_create_reissue(H5VL_link_create_type_t create_type, + void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, + hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req, ...) +{ + va_list arguments; + herr_t ret_value; + + va_start(arguments, req); + ret_value = H5VLlink_create(create_type, obj, loc_params, connector_id, lcpl_id, lapl_id, dxpl_id, req, arguments); + va_end(arguments); + + return ret_value; +} /* end H5VL_subfiling_link_create_reissue() */ + +/*------------------------------------------------------------------------- + * Function: H5VL_subfiling_link_create + * + * Purpose: Creates a hard / soft / UD / external link. + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_subfiling_link_create(H5VL_link_create_type_t create_type, void *obj, + const H5VL_loc_params_t *loc_params, hid_t lcpl_id, hid_t lapl_id, + hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj; + hid_t under_vol_id = -1; + herr_t ret_value; + +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL LINK Create\n"); +#endif + + /* Try to retrieve the "under" VOL id */ + if(o) + under_vol_id = o->under_vol_id; + + /* Fix up the link target object for hard link creation */ + if(H5VL_LINK_CREATE_HARD == create_type) { + void *cur_obj; + H5VL_loc_params_t *cur_params; + + /* Retrieve the object & loc params for the link target */ + cur_obj = va_arg(arguments, void *); + cur_params = va_arg(arguments, H5VL_loc_params_t *); + + /* If it's a non-NULL pointer, find the 'under object' and re-set the property */ + if(cur_obj) { + /* Check if we still need the "under" VOL ID */ + if(under_vol_id < 0) + under_vol_id = ((H5VL_subfiling_t *)cur_obj)->under_vol_id; + + /* Set the object for the link target */ + cur_obj = ((H5VL_subfiling_t *)cur_obj)->under_object; + } /* end if */ + + /* Re-issue 'link create' call, using the unwrapped pieces */ + ret_value = H5VL_subfiling_link_create_reissue(create_type, (o ? o->under_object : NULL), loc_params, under_vol_id, lcpl_id, lapl_id, dxpl_id, req, cur_obj, cur_params); + } /* end if */ + else + ret_value = H5VLlink_create(create_type, (o ? o->under_object : NULL), loc_params, under_vol_id, lcpl_id, lapl_id, dxpl_id, req, arguments); + + /* Check for async request */ + if(req && *req) + *req = H5VL_subfiling_new_obj(*req, under_vol_id); + + return ret_value; +} /* end H5VL_subfiling_link_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_subfiling_link_copy + * + * Purpose: Renames an object within an HDF5 container and copies it to a new + * group. The original name SRC is unlinked from the group graph + * and then inserted with the new name DST (which can specify a + * new path for the object) as an atomic operation. The names + * are interpreted relative to SRC_LOC_ID and + * DST_LOC_ID, which are either file IDs or group ID. + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_subfiling_link_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, + void *dst_obj, const H5VL_loc_params_t *loc_params2, hid_t lcpl_id, + hid_t lapl_id, hid_t dxpl_id, void **req) +{ + H5VL_subfiling_t *o_src = (H5VL_subfiling_t *)src_obj; + H5VL_subfiling_t *o_dst = (H5VL_subfiling_t *)dst_obj; + hid_t under_vol_id = -1; + herr_t ret_value; + +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL LINK Copy\n"); +#endif + + /* Retrieve the "under" VOL id */ + if(o_src) + under_vol_id = o_src->under_vol_id; + else if(o_dst) + under_vol_id = o_dst->under_vol_id; + assert(under_vol_id > 0); + + ret_value = H5VLlink_copy((o_src ? o_src->under_object : NULL), loc_params1, (o_dst ? o_dst->under_object : NULL), loc_params2, under_vol_id, lcpl_id, lapl_id, dxpl_id, req); + + /* Check for async request */ + if(req && *req) + *req = H5VL_subfiling_new_obj(*req, under_vol_id); + + return ret_value; +} /* end H5VL_subfiling_link_copy() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_subfiling_link_move + * + * Purpose: Moves a link within an HDF5 file to a new group. The original + * name SRC is unlinked from the group graph + * and then inserted with the new name DST (which can specify a + * new path for the object) as an atomic operation. The names + * are interpreted relative to SRC_LOC_ID and + * DST_LOC_ID, which are either file IDs or group ID. + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_subfiling_link_move(void *src_obj, const H5VL_loc_params_t *loc_params1, + void *dst_obj, const H5VL_loc_params_t *loc_params2, hid_t lcpl_id, + hid_t lapl_id, hid_t dxpl_id, void **req) +{ + H5VL_subfiling_t *o_src = (H5VL_subfiling_t *)src_obj; + H5VL_subfiling_t *o_dst = (H5VL_subfiling_t *)dst_obj; + hid_t under_vol_id = -1; + herr_t ret_value; + +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL LINK Move\n"); +#endif + + /* Retrieve the "under" VOL id */ + if(o_src) + under_vol_id = o_src->under_vol_id; + else if(o_dst) + under_vol_id = o_dst->under_vol_id; + assert(under_vol_id > 0); + + ret_value = H5VLlink_move((o_src ? o_src->under_object : NULL), loc_params1, (o_dst ? o_dst->under_object : NULL), loc_params2, under_vol_id, lcpl_id, lapl_id, dxpl_id, req); + + /* Check for async request */ + if(req && *req) + *req = H5VL_subfiling_new_obj(*req, under_vol_id); + + return ret_value; +} /* end H5VL_subfiling_link_move() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_subfiling_link_get + * + * Purpose: Get info about a link + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_subfiling_link_get(void *obj, const H5VL_loc_params_t *loc_params, + H5VL_link_get_t get_type, hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL LINK Get\n"); +#endif + + ret_value = H5VLlink_get(o->under_object, loc_params, o->under_vol_id, get_type, dxpl_id, req, arguments); + + /* Check for async request */ + if(req && *req) + *req = H5VL_subfiling_new_obj(*req, o->under_vol_id); + + return ret_value; +} /* end H5VL_subfiling_link_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_subfiling_link_specific + * + * Purpose: Specific operation on a link + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_subfiling_link_specific(void *obj, const H5VL_loc_params_t *loc_params, + H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL LINK Specific\n"); +#endif + + ret_value = H5VLlink_specific(o->under_object, loc_params, o->under_vol_id, specific_type, dxpl_id, req, arguments); + + /* Check for async request */ + if(req && *req) + *req = H5VL_subfiling_new_obj(*req, o->under_vol_id); + + return ret_value; +} /* end H5VL_subfiling_link_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_subfiling_link_optional + * + * Purpose: Perform a connector-specific operation on a link + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_subfiling_link_optional(void *obj, H5VL_link_optional_t opt_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL LINK Optional\n"); +#endif + + ret_value = H5VLlink_optional(o->under_object, o->under_vol_id, opt_type, dxpl_id, req, arguments); + + /* Check for async request */ + if(req && *req) + *req = H5VL_subfiling_new_obj(*req, o->under_vol_id); + + return ret_value; +} /* end H5VL_subfiling_link_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_subfiling_object_open + * + * Purpose: Opens an object inside a container. + * + * Return: Success: Pointer to object + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +static void * +H5VL_subfiling_object_open(void *obj, const H5VL_loc_params_t *loc_params, + H5I_type_t *opened_type, hid_t dxpl_id, void **req) +{ + H5VL_subfiling_t *new_obj; + H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj; + void *under; + +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL OBJECT Open\n"); +#endif + + under = H5VLobject_open(o->under_object, loc_params, o->under_vol_id, opened_type, dxpl_id, req); + if(under) { + new_obj = H5VL_subfiling_new_obj(under, o->under_vol_id); + + /* Check for async request */ + if(req && *req) + *req = H5VL_subfiling_new_obj(*req, o->under_vol_id); + } /* end if */ + else + new_obj = NULL; + + return (void *)new_obj; +} /* end H5VL_subfiling_object_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_subfiling_object_copy + * + * Purpose: Copies an object inside a container. + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_subfiling_object_copy(void *src_obj, const H5VL_loc_params_t *src_loc_params, + const char *src_name, void *dst_obj, const H5VL_loc_params_t *dst_loc_params, + const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, + void **req) +{ + H5VL_subfiling_t *o_src = (H5VL_subfiling_t *)src_obj; + H5VL_subfiling_t *o_dst = (H5VL_subfiling_t *)dst_obj; + herr_t ret_value; + +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL OBJECT Copy\n"); +#endif + + ret_value = H5VLobject_copy(o_src->under_object, src_loc_params, src_name, o_dst->under_object, dst_loc_params, dst_name, o_src->under_vol_id, ocpypl_id, lcpl_id, dxpl_id, req); + + /* Check for async request */ + if(req && *req) + *req = H5VL_subfiling_new_obj(*req, o_src->under_vol_id); + + return ret_value; +} /* end H5VL_subfiling_object_copy() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_subfiling_object_get + * + * Purpose: Get info about an object + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_subfiling_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL OBJECT Get\n"); +#endif + + ret_value = H5VLobject_get(o->under_object, loc_params, o->under_vol_id, get_type, dxpl_id, req, arguments); + + /* Check for async request */ + if(req && *req) + *req = H5VL_subfiling_new_obj(*req, o->under_vol_id); + + return ret_value; +} /* end H5VL_subfiling_object_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_subfiling_object_specific + * + * Purpose: Specific operation on an object + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_subfiling_object_specific(void *obj, const H5VL_loc_params_t *loc_params, + H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, + va_list arguments) +{ + H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj; + hid_t under_vol_id; + herr_t ret_value; + +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL OBJECT Specific\n"); +#endif + + // Save copy of underlying VOL connector ID and prov helper, in case of + // refresh destroying the current object + under_vol_id = o->under_vol_id; + + ret_value = H5VLobject_specific(o->under_object, loc_params, o->under_vol_id, specific_type, dxpl_id, req, arguments); + + /* Check for async request */ + if(req && *req) + *req = H5VL_subfiling_new_obj(*req, under_vol_id); + + return ret_value; +} /* end H5VL_subfiling_object_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_subfiling_object_optional + * + * Purpose: Perform a connector-specific operation for an object + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_subfiling_object_optional(void *obj, H5VL_object_optional_t opt_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL OBJECT Optional\n"); +#endif + + ret_value = H5VLobject_optional(o->under_object, o->under_vol_id, opt_type, dxpl_id, req, arguments); + + /* Check for async request */ + if(req && *req) + *req = H5VL_subfiling_new_obj(*req, o->under_vol_id); + + return ret_value; +} /* end H5VL_subfiling_object_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_subfiling_introspect_get_conn_clss + * + * Purpose: Query the connector class. + * + * Return: SUCCEED / FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_subfiling_introspect_get_conn_cls(void *obj, H5VL_get_conn_lvl_t lvl, + const H5VL_class_t **conn_cls) +{ + H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL INTROSPECT GetConnCls\n"); +#endif + + /* Check for querying this connector's class */ + if(H5VL_GET_CONN_LVL_CURR == lvl) { + *conn_cls = &H5VL_subfiling_g; + ret_value = 0; + } /* end if */ + else + ret_value = H5VLintrospect_get_conn_cls(o->under_object, o->under_vol_id, + lvl, conn_cls); + + return ret_value; +} /* end H5VL_subfiling_introspect_get_conn_cls() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_subfiling_introspect_opt_query + * + * Purpose: Query if an optional operation is supported by this connector + * + * Return: SUCCEED / FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_subfiling_introspect_opt_query(void *obj, H5VL_subclass_t cls, + int opt_type, hbool_t *supported) +{ + H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL INTROSPECT OptQuery\n"); +#endif + + ret_value = H5VLintrospect_opt_query(o->under_object, o->under_vol_id, cls, + opt_type, supported); + + return ret_value; +} /* end H5VL_subfiling_introspect_opt_query() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_subfiling_request_wait + * + * Purpose: Wait (with a timeout) for an async operation to complete + * + * Note: Releases the request if the operation has completed and the + * connector callback succeeds + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_subfiling_request_wait(void *obj, uint64_t timeout, + H5ES_status_t *status) +{ + H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL REQUEST Wait\n"); +#endif + + ret_value = H5VLrequest_wait(o->under_object, o->under_vol_id, timeout, status); + + if(ret_value >= 0 && *status != H5ES_STATUS_IN_PROGRESS) + H5VL_subfiling_free_obj(o); + + return ret_value; +} /* end H5VL_subfiling_request_wait() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_subfiling_request_notify + * + * Purpose: Registers a user callback to be invoked when an asynchronous + * operation completes + * + * Note: Releases the request, if connector callback succeeds + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_subfiling_request_notify(void *obj, H5VL_request_notify_t cb, void *ctx) +{ + H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL REQUEST Notify\n"); +#endif + + ret_value = H5VLrequest_notify(o->under_object, o->under_vol_id, cb, ctx); + + if(ret_value >= 0) + H5VL_subfiling_free_obj(o); + + return ret_value; +} /* end H5VL_subfiling_request_notify() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_subfiling_request_cancel + * + * Purpose: Cancels an asynchronous operation + * + * Note: Releases the request, if connector callback succeeds + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_subfiling_request_cancel(void *obj) +{ + H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL REQUEST Cancel\n"); +#endif + + ret_value = H5VLrequest_cancel(o->under_object, o->under_vol_id); + + if(ret_value >= 0) + H5VL_subfiling_free_obj(o); + + return ret_value; +} /* end H5VL_subfiling_request_cancel() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_subfiling_request_specific_reissue + * + * Purpose: Re-wrap vararg arguments into a va_list and reissue the + * request specific callback to the underlying VOL connector. + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_subfiling_request_specific_reissue(void *obj, hid_t connector_id, + H5VL_request_specific_t specific_type, ...) +{ + va_list arguments; + herr_t ret_value; + + va_start(arguments, specific_type); + ret_value = H5VLrequest_specific(obj, connector_id, specific_type, arguments); + va_end(arguments); + + return ret_value; +} /* end H5VL_subfiling_request_specific_reissue() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_subfiling_request_specific + * + * Purpose: Specific operation on a request + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_subfiling_request_specific(void *obj, H5VL_request_specific_t specific_type, + va_list arguments) +{ + herr_t ret_value = -1; + +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL REQUEST Specific\n"); +#endif + + if(H5VL_REQUEST_WAITANY == specific_type || + H5VL_REQUEST_WAITSOME == specific_type || + H5VL_REQUEST_WAITALL == specific_type) { + va_list tmp_arguments; + size_t req_count; + + /* Sanity check */ + assert(obj == NULL); + + /* Get enough info to call the underlying connector */ + va_copy(tmp_arguments, arguments); + req_count = va_arg(tmp_arguments, size_t); + + /* Can only use a request to invoke the underlying VOL connector when there's >0 requests */ + if(req_count > 0) { + void **req_array; + void **under_req_array; + uint64_t timeout; + H5VL_subfiling_t *o; + size_t u; /* Local index variable */ + + /* Get the request array */ + req_array = va_arg(tmp_arguments, void **); + + /* Get a request to use for determining the underlying VOL connector */ + o = (H5VL_subfiling_t *)req_array[0]; + + /* Create array of underlying VOL requests */ + under_req_array = (void **)malloc(req_count * sizeof(void **)); + for(u = 0; u < req_count; u++) + under_req_array[u] = ((H5VL_subfiling_t *)req_array[u])->under_object; + + /* Remove the timeout value from the vararg list (it's used in all the calls below) */ + timeout = va_arg(tmp_arguments, uint64_t); + + /* Release requests that have completed */ + if(H5VL_REQUEST_WAITANY == specific_type) { + size_t *idx; /* Pointer to the index of completed request */ + H5ES_status_t *status; /* Pointer to the request's status */ + + /* Retrieve the remaining arguments */ + idx = va_arg(tmp_arguments, size_t *); + assert(*idx <= req_count); + status = va_arg(tmp_arguments, H5ES_status_t *); + + /* Reissue the WAITANY 'request specific' call */ + ret_value = H5VL_subfiling_request_specific_reissue(o->under_object, o->under_vol_id, specific_type, req_count, under_req_array, timeout, + idx, + status); + + /* Release the completed request, if it completed */ + if(ret_value >= 0 && *status != H5ES_STATUS_IN_PROGRESS) { + H5VL_subfiling_t *tmp_o; + + tmp_o = (H5VL_subfiling_t *)req_array[*idx]; + H5VL_subfiling_free_obj(tmp_o); + } /* end if */ + } /* end if */ + else if(H5VL_REQUEST_WAITSOME == specific_type) { + size_t *outcount; /* # of completed requests */ + unsigned *array_of_indices; /* Array of indices for completed requests */ + H5ES_status_t *array_of_statuses; /* Array of statuses for completed requests */ + + /* Retrieve the remaining arguments */ + outcount = va_arg(tmp_arguments, size_t *); + assert(*outcount <= req_count); + array_of_indices = va_arg(tmp_arguments, unsigned *); + array_of_statuses = va_arg(tmp_arguments, H5ES_status_t *); + + /* Reissue the WAITSOME 'request specific' call */ + ret_value = H5VL_subfiling_request_specific_reissue(o->under_object, o->under_vol_id, specific_type, req_count, under_req_array, timeout, outcount, array_of_indices, array_of_statuses); + + /* If any requests completed, release them */ + if(ret_value >= 0 && *outcount > 0) { + unsigned *idx_array; /* Array of indices of completed requests */ + + /* Retrieve the array of completed request indices */ + idx_array = va_arg(tmp_arguments, unsigned *); + + /* Release the completed requests */ + for(u = 0; u < *outcount; u++) { + H5VL_subfiling_t *tmp_o; + + tmp_o = (H5VL_subfiling_t *)req_array[idx_array[u]]; + H5VL_subfiling_free_obj(tmp_o); + } /* end for */ + } /* end if */ + } /* end else-if */ + else { /* H5VL_REQUEST_WAITALL == specific_type */ + H5ES_status_t *array_of_statuses; /* Array of statuses for completed requests */ + + /* Retrieve the remaining arguments */ + array_of_statuses = va_arg(tmp_arguments, H5ES_status_t *); + + /* Reissue the WAITALL 'request specific' call */ + ret_value = H5VL_subfiling_request_specific_reissue(o->under_object, o->under_vol_id, specific_type, req_count, under_req_array, timeout, array_of_statuses); + + /* Release the completed requests */ + if(ret_value >= 0) { + for(u = 0; u < req_count; u++) { + if(array_of_statuses[u] != H5ES_STATUS_IN_PROGRESS) { + H5VL_subfiling_t *tmp_o; + + tmp_o = (H5VL_subfiling_t *)req_array[u]; + H5VL_subfiling_free_obj(tmp_o); + } /* end if */ + } /* end for */ + } /* end if */ + } /* end else */ + + /* Release array of requests for underlying connector */ + free(under_req_array); + } /* end if */ + + /* Finish use of copied vararg list */ + va_end(tmp_arguments); + } /* end if */ + else + assert(0 && "Unknown 'specific' operation"); + + return ret_value; +} /* end H5VL_subfiling_request_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_subfiling_request_optional + * + * Purpose: Perform a connector-specific operation for a request + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_subfiling_request_optional(void *obj, H5VL_request_optional_t opt_type, + va_list arguments) +{ + H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL REQUEST Optional\n"); +#endif + + ret_value = H5VLrequest_optional(o->under_object, o->under_vol_id, opt_type, arguments); + + return ret_value; +} /* end H5VL_subfiling_request_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_subfiling_request_free + * + * Purpose: Releases a request, allowing the operation to complete without + * application tracking + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_subfiling_request_free(void *obj) +{ + H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL REQUEST Free\n"); +#endif + + ret_value = H5VLrequest_free(o->under_object, o->under_vol_id); + + if(ret_value >= 0) + H5VL_subfiling_free_obj(o); + + return ret_value; +} /* end H5VL_subfiling_request_free() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_subfiling_blob_put + * + * Purpose: Handles the blob 'put' callback + * + * Return: SUCCEED / FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_subfiling_blob_put(void *obj, const void *buf, size_t size, + void *blob_id, void *ctx) +{ + H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL BLOB Put\n"); +#endif + + ret_value = H5VLblob_put(o->under_object, o->under_vol_id, buf, size, + blob_id, ctx); + + return ret_value; +} /* end H5VL_subfiling_blob_put() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_subfiling_blob_get + * + * Purpose: Handles the blob 'get' callback + * + * Return: SUCCEED / FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_subfiling_blob_get(void *obj, const void *blob_id, void *buf, + size_t size, void *ctx) +{ + H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL BLOB Get\n"); +#endif + + ret_value = H5VLblob_get(o->under_object, o->under_vol_id, blob_id, buf, + size, ctx); + + return ret_value; +} /* end H5VL_subfiling_blob_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_subfiling_blob_specific + * + * Purpose: Handles the blob 'specific' callback + * + * Return: SUCCEED / FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_subfiling_blob_specific(void *obj, void *blob_id, + H5VL_blob_specific_t specific_type, va_list arguments) +{ + H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL BLOB Specific\n"); +#endif + + ret_value = H5VLblob_specific(o->under_object, o->under_vol_id, blob_id, + specific_type, arguments); + + return ret_value; +} /* end H5VL_subfiling_blob_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_subfiling_blob_optional + * + * Purpose: Handles the blob 'optional' callback + * + * Return: SUCCEED / FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_subfiling_blob_optional(void *obj, void *blob_id, + H5VL_blob_optional_t opt_type, va_list arguments) +{ + H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL BLOB Optional\n"); +#endif + + ret_value = H5VLblob_optional(o->under_object, o->under_vol_id, blob_id, + opt_type, arguments); + + return ret_value; +} /* end H5VL_subfiling_blob_optional() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VL_subfiling_token_cmp + * + * Purpose: Compare two of the connector's object tokens, setting + * *cmp_value, following the same rules as strcmp(). + * + * Return: Success: 0 + * Failure: -1 + * + *--------------------------------------------------------------------------- + */ +static herr_t +H5VL_subfiling_token_cmp(void *obj, const H5O_token_t *token1, + const H5O_token_t *token2, int *cmp_value) +{ + H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL TOKEN Compare\n"); +#endif + + /* Sanity checks */ + assert(obj); + assert(token1); + assert(token2); + assert(cmp_value); + + ret_value = H5VLtoken_cmp(o->under_object, o->under_vol_id, token1, token2, cmp_value); + + return ret_value; +} /* end H5VL_subfiling_token_cmp() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VL_subfiling_token_to_str + * + * Purpose: Serialize the connector's object token into a string. + * + * Return: Success: 0 + * Failure: -1 + * + *--------------------------------------------------------------------------- + */ +static herr_t +H5VL_subfiling_token_to_str(void *obj, H5I_type_t obj_type, + const H5O_token_t *token, char **token_str) +{ + H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL TOKEN To string\n"); +#endif + + /* Sanity checks */ + assert(obj); + assert(token); + assert(token_str); + + ret_value = H5VLtoken_to_str(o->under_object, obj_type, o->under_vol_id, token, token_str); + + return ret_value; +} /* end H5VL_subfiling_token_to_str() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VL_subfiling_token_from_str + * + * Purpose: Deserialize the connector's object token from a string. + * + * Return: Success: 0 + * Failure: -1 + * + *--------------------------------------------------------------------------- + */ +static herr_t +H5VL_subfiling_token_from_str(void *obj, H5I_type_t obj_type, + const char *token_str, H5O_token_t *token) +{ + H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL TOKEN From string\n"); +#endif + + /* Sanity checks */ + assert(obj); + assert(token); + assert(token_str); + + ret_value = H5VLtoken_from_str(o->under_object, obj_type, o->under_vol_id, token_str, token); + + return ret_value; +} /* end H5VL_subfiling_token_from_str() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_subfiling_optional + * + * Purpose: Handles the generic 'optional' callback + * + * Return: SUCCEED / FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_subfiling_optional(void *obj, int op_type, hid_t dxpl_id, void **req, + va_list arguments) +{ + H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_EXT_PASSTHRU_LOGGING + printf("------- SUBFILING VOL generic Optional\n"); +#endif + + ret_value = H5VLoptional(o->under_object, o->under_vol_id, op_type, + dxpl_id, req, arguments); + + return ret_value; +} /* end H5VL_subfiling_optional() */ + diff --git a/test/h5subfiling_vol.h b/test/h5subfiling_vol.h new file mode 100644 index 0000000..246de33 --- /dev/null +++ b/test/h5subfiling_vol.h @@ -0,0 +1,115 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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 COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Purpose: The public header file for the pass-through VOL connector. + */ + +#ifndef _H5subfiling_vol_H +#define _H5subfiling_vol_H + +/* Public headers needed by this file */ +#include "H5VLpublic.h" /* Virtual Object Layer */ +#include "H5PLextern.h" /* External HDF5 plugins */ +#include "H5FDsubfiling.h" /* H5FD subfiling */ + +/* Identifier for the pass-through VOL connector */ +#define H5VL_SUBFILING (H5VL_subfiling_register()) + +/* Characteristics of the pass-through VOL connector */ +#define H5VL_SUBFILING_NAME "subfiling" +#define H5VL_SUBFILING_VALUE ((H5VL_class_value_t)13031) /* VOL connector ID */ +#define H5VL_SUBFILING_VERSION 1 + +/* Pass-through VOL connector info */ +typedef struct H5VL_subfiling_info_t { + hid_t under_vol_id; /* VOL ID for under VOL */ + void *under_vol_info; /* VOL info for under VOL */ +} H5VL_subfiling_info_t; + + +#include +#include "mercury/mercury_thread_mutex.h" + +#define H5_LIST_HEAD_INITIALIZER(name) { NULL } + +#define H5_LIST_HEAD_INIT(struct_head_name, var_name) \ + struct struct_head_name var_name = H5_LIST_HEAD_INITIALIZER(var_name) + +#define H5_LIST_HEAD_DECL(struct_head_name, struct_entry_name) \ + struct struct_head_name { \ + struct struct_entry_name *head; \ + } + +#define H5_LIST_HEAD(struct_entry_name) \ + struct { \ + struct struct_entry_name *head; \ + hg_thread_mutex_t lock; \ + } + +#define H5_LIST_ENTRY(struct_entry_name) \ + struct { \ + struct struct_entry_name *next; \ + struct struct_entry_name **prev; \ + } + +#define H5_LIST_INIT(head_ptr) do { \ + (head_ptr)->head = NULL; \ + hg_thread_mutex_init(&(head_ptr)->lock);\ +} while (/*CONSTCOND*/0) + +#define H5_LIST_IS_EMPTY(head_ptr) \ + ((head_ptr)->head == NULL) + +#define H5_LIST_FIRST(head_ptr) \ + ((head_ptr)->head) + +#define H5_LIST_GET_FIRST(var, head_ptr) \ + (var = (head_ptr)->head) + +#define H5_LIST_NEXT(entry_ptr, entry_field_name) \ + ((entry_ptr)->entry_field_name.next) + +#define H5_LIST_INSERT_HEAD(head_ptr, entry_ptr, entry_field_name) do { \ + if (((entry_ptr)->entry_field_name.next = (head_ptr)->head) != NULL) \ + (head_ptr)->head->entry_field_name.prev = \ + &(entry_ptr)->entry_field_name.next; \ + (head_ptr)->head = (entry_ptr); \ + (entry_ptr)->entry_field_name.prev = &(head_ptr)->head; \ +} while (/*CONSTCOND*/0) + +/* TODO would be nice to not have any condition */ +#define H5_LIST_REMOVE(entry_ptr, entry_field_name) do { \ + if ((entry_ptr)->entry_field_name.next != NULL) \ + (entry_ptr)->entry_field_name.next->entry_field_name.prev = \ + (entry_ptr)->entry_field_name.prev; \ + *(entry_ptr)->entry_field_name.prev = (entry_ptr)->entry_field_name.next; \ +} while (/*CONSTCOND*/0) + +#define H5_LIST_FOREACH(var, head_ptr, entry_field_name) \ + for ((var) = ((head_ptr)->head); \ + (var); \ + (var) = ((var)->entry_field_name.next)) + + +#ifdef __cplusplus +extern "C" { +#endif + +H5_DLL hid_t H5VL_subfiling_register(void); + +#ifdef __cplusplus +} +#endif + +#endif /* _H5subfiling_vol_H */ + diff --git a/test/h5test.c b/test/h5test.c index 9cca100..022bfde 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, November 19, 1998 * * Purpose: Provides support functions for most of the hdf5 tests cases. @@ -2057,23 +2057,23 @@ h5_get_version_string(H5F_libver_t libver) int h5_compare_file_bytes(char *f1name, char *f2name) { - FILE *f1ptr = NULL; /* two file pointers */ - FILE *f2ptr = NULL; - hsize_t f1size = 0; /* size of the files */ - hsize_t f2size = 0; - char f1char = 0; /* one char from each file */ - char f2char = 0; - hsize_t ii = 0; - int ret_value = 0; /* for error handling */ + FILE *f1ptr = NULL; /* two file pointers */ + FILE *f2ptr = NULL; + off_t f1size = 0; /* size of the files */ + off_t f2size = 0; + char f1char = 0; /* one char from each file */ + char f2char = 0; + off_t ii = 0; + int ret_value = 0; /* for error handling */ /* Open files for reading */ - f1ptr = fopen(f1name, "r"); + f1ptr = HDfopen(f1name, "rb"); if (f1ptr == NULL) { HDfprintf(stderr, "Unable to fopen() %s\n", f1name); ret_value = -1; goto done; } - f2ptr = fopen(f2name, "r"); + f2ptr = HDfopen(f2name, "rb"); if (f2ptr == NULL) { HDfprintf(stderr, "Unable to fopen() %s\n", f2name); ret_value = -1; @@ -2081,11 +2081,11 @@ h5_compare_file_bytes(char *f1name, char *f2name) } /* Get the file sizes and verify that they equal */ - fseek(f1ptr , 0 , SEEK_END); - f1size = ftell(f1ptr); + HDfseek(f1ptr , 0 , SEEK_END); + f1size = HDftell(f1ptr); - fseek(f2ptr , 0 , SEEK_END); - f2size = ftell(f2ptr); + HDfseek(f2ptr , 0 , SEEK_END); + f2size = HDftell(f2ptr); if (f1size != f2size) { HDfprintf(stderr, "Files differ in size, %llu vs. %llu\n", f1size, f2size); @@ -2094,11 +2094,17 @@ h5_compare_file_bytes(char *f1name, char *f2name) } /* Compare each byte and fail if a difference is found */ - rewind(f1ptr); - rewind(f2ptr); + HDrewind(f1ptr); + HDrewind(f2ptr); for (ii = 0; ii < f1size; ii++) { - fread(&f1char, 1, 1, f1ptr); - fread(&f2char, 1, 1, f2ptr); + if(HDfread(&f1char, 1, 1, f1ptr) != 1) { + ret_value = -1; + goto done; + } + if(HDfread(&f2char, 1, 1, f2ptr) != 1) { + ret_value = -1; + goto done; + } if (f1char != f2char) { HDfprintf(stderr, "Mismatch @ 0x%llX: 0x%X != 0x%X\n", ii, f1char, f2char); ret_value = -1; @@ -2107,13 +2113,11 @@ h5_compare_file_bytes(char *f1name, char *f2name) } done: - if (f1ptr) { - fclose(f1ptr); - } - if (f2ptr) { - fclose(f2ptr); - } - return(ret_value); + if (f1ptr) + HDfclose(f1ptr); + if (f2ptr) + HDfclose(f2ptr); + return ret_value; } /* end h5_compare_file_bytes() */ /*------------------------------------------------------------------------- @@ -2169,3 +2173,131 @@ const char *H5_get_srcdir(void) return(NULL); } /* end H5_get_srcdir() */ +/*------------------------------------------------------------------------- + * Function: h5_duplicate_file_by_bytes + * + * Purpose: Duplicate a file byte-for-byte at filename/path 'orig' + * to a new (or replaced) file at 'dest'. + * + * Return: Success: 0, completed successfully + * Failure: -1 + * + * Programmer: Jake Smith + * 24 June 2020 + * + *------------------------------------------------------------------------- + */ +int +h5_duplicate_file_by_bytes(const char *orig, const char *dest) +{ + FILE *orig_ptr = NULL; + FILE *dest_ptr = NULL; + hsize_t fsize = 0; + hsize_t read_size = 0; + hsize_t max_buf = 0; + void *dup_buf = NULL; + int ret_value = 0; + + max_buf = 4096 * sizeof(char); + + orig_ptr = HDfopen(orig, "rb"); + if (NULL == orig_ptr) { + ret_value = -1; + goto done; + } + + HDfseek(orig_ptr , 0 , SEEK_END); + fsize = (hsize_t)HDftell(orig_ptr); + HDrewind(orig_ptr); + + dest_ptr = HDfopen(dest, "wb"); + if (NULL == dest_ptr) { + ret_value = -1; + goto done; + } + + read_size = MIN(fsize, max_buf); + dup_buf = HDmalloc(read_size); + if (NULL == dup_buf) { + ret_value = -1; + goto done; + } + + while (read_size > 0) { + if (HDfread(dup_buf, read_size, 1, orig_ptr) != 1) { + ret_value = -1; + goto done; + } + HDfwrite(dup_buf, read_size, 1, dest_ptr); + fsize -= read_size; + read_size = MIN(fsize, max_buf); + } + +done: + if (orig_ptr != NULL) + HDfclose(orig_ptr); + if (dest_ptr != NULL) + HDfclose(dest_ptr); + if (dup_buf != NULL) + HDfree(dup_buf); + return ret_value; +} /* end h5_duplicate_file_by_bytes() */ + +/*------------------------------------------------------------------------- + * Function: h5_check_if_file_locking_enabled + * + * Purpose: Checks if file locking is enabled on this file system. + * + * Return: SUCCEED/FAIL + * are_enabled will be FALSE if file locking is disabled on + * the file system of if there were errors. + * + *------------------------------------------------------------------------- + */ +herr_t +h5_check_if_file_locking_enabled(hbool_t *is_enabled) +{ + const char *filename = "locking_test_file"; + int pmode = O_RDWR | O_CREAT | O_TRUNC; + int fd = -1; + + *is_enabled = TRUE; + + if((fd = HDopen(filename, pmode, H5_POSIX_CREATE_MODE_RW)) < 0) + goto error; + + /* Test HDflock() to see if it works */ + if(HDflock(fd, LOCK_EX | LOCK_NB) < 0) { + if(ENOSYS == errno) { + /* When errno is set to ENOSYS, the file system does not support + * locking, so ignore it. This is most frequently used on + * Lustre. If we also want to check for disabled NFS locks + * we'll need to check for ENOLCK, too. That isn't done by + * default here since that could also represent an actual + * error condition. + */ + errno = 0; + *is_enabled = FALSE; + } + else + goto error; + } + if(HDflock(fd, LOCK_UN) < 0) + goto error; + + if(HDclose(fd) < 0) + goto error; + if(HDremove(filename) < 0) + goto error; + + return SUCCEED; + +error: + *is_enabled = FALSE; + if (fd > -1) { + HDclose(fd); + HDremove(filename); + } + return FAIL; +} /* end h5_check_if_file_locking_enabled() */ + diff --git a/test/h5test.h b/test/h5test.h index b1ddc58..22047e1 100644 --- a/test/h5test.h +++ b/test/h5test.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, November 20, 1998 * * Purpose: Test support stuff. @@ -210,6 +210,8 @@ H5TEST_DLL H5FD_class_t *h5_get_dummy_vfd_class(void); H5TEST_DLL H5VL_class_t *h5_get_dummy_vol_class(void); H5TEST_DLL const char *h5_get_version_string(H5F_libver_t libver); H5TEST_DLL int h5_compare_file_bytes(char *fname1, char *fname2); +H5TEST_DLL int h5_duplicate_file_by_bytes(const char *orig, const char *dest); +H5TEST_DLL herr_t h5_check_if_file_locking_enabled(hbool_t *are_enabled); /* Functions that will replace components of a FAPL */ H5TEST_DLL herr_t h5_get_vfd_fapl(hid_t fapl_id); diff --git a/test/hdfs.c b/test/hdfs.c index ab39da6..0f4969e 100644 --- a/test/hdfs.c +++ b/test/hdfs.c @@ -19,7 +19,7 @@ * * Demonstrates basic use cases and fapl interaction. * - * Programmer: Jacob Smith + * Programmer: Jacob Smith * 2018-04-23 */ @@ -30,7 +30,6 @@ #ifdef H5_HAVE_LIBHDFS #define HDFS_TEST_DEBUG 0 #define HDFS_TEST_MAX_BUF_SIZE 256 -#endif /* H5_HAVE_LIBHDFS */ /***************************************************************************** * @@ -372,11 +371,8 @@ if (strcmp((actual), (expected)) != 0) { \ * OTHER MACROS AND DEFINITIONS * ********************************/ -/* copied from src/hdfs.c - */ -#ifdef H5_HAVE_LIBHDFS +/* copied from src/hdfs.c */ #define MAXADDR (((haddr_t)1<<(8*sizeof(HDoff_t)-1))-1) -#endif /* H5_HAVE_LIBHDFS */ #define HDFS_NAMENODE_NAME_MAX_SIZE 128 @@ -384,12 +380,10 @@ if (strcmp((actual), (expected)) != 0) { \ * FILE-LOCAL GLOBAL VARIABLES * *******************************/ -#ifdef H5_HAVE_LIBHDFS static const char filename_missing[] = "/tmp/missing.txt"; static const char filename_bard[] = "/tmp/t8.shakespeare.txt"; static const char filename_raven[] = "/tmp/Poe_Raven.txt"; static const char filename_example_h5[] = "/tmp/t.h5"; -#endif /* H5_HAVE_LIBHDFS */ static H5FD_hdfs_fapl_t default_fa = { 1, /* fa version */ @@ -399,6 +393,7 @@ static H5FD_hdfs_fapl_t default_fa = { "", /* kerberos path */ 1024, /* buffer size */ }; +#endif /* H5_HAVE_LIBHDFS */ /****************** * TEST FUNCTIONS * @@ -429,6 +424,14 @@ static H5FD_hdfs_fapl_t default_fa = { static int test_fapl_config_validation(void) { +#ifndef H5_HAVE_LIBHDFS + TESTING("HDFS fapl configuration validation"); + SKIPPED(); + puts(" HDFS VFD is not enabled"); + fflush(stdout); + return 0; + +#else /********************* * test-local macros * *********************/ @@ -604,6 +607,7 @@ error: } H5E_END_TRY; } return 1; +#endif /* H5_HAVE_LIBHDFS */ } /* end test_fapl_config_validation() */ @@ -630,6 +634,14 @@ error: static int test_hdfs_fapl(void) { +#ifndef H5_HAVE_LIBHDFS + TESTING("HDFS fapl "); + SKIPPED(); + puts(" HDFS VFD is not enabled"); + fflush(stdout); + return 0; + +#else /************************ * test-local variables * ************************/ @@ -681,6 +693,7 @@ error: } H5E_END_TRY; return 1; +#endif /* H5_HAVE_LIBHDFS */ } /* end test_hdfs_fapl() */ @@ -1723,6 +1736,7 @@ main(void) * commence tests * ******************/ +#ifdef H5_HAVE_LIBHDFS static char hdfs_namenode_name[HDFS_NAMENODE_NAME_MAX_SIZE] = ""; const char *hdfs_namenode_name_env = NULL; @@ -1736,6 +1750,7 @@ main(void) hdfs_namenode_name_env, HDFS_NAMENODE_NAME_MAX_SIZE); } +#endif /* H5_HAVE_LIBHDFS */ h5_reset(); diff --git a/test/hyperslab.c b/test/hyperslab.c index e702023..8168eed 100644 --- a/test/hyperslab.c +++ b/test/hyperslab.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Robb Matzke +/* Programmer: Robb Matzke * Friday, October 10, 1997 * * Purpose: Hyperslab operations are rather complex, so this file diff --git a/test/istore.c b/test/istore.c index c8fe866..e80f260 100644 --- a/test/istore.c +++ b/test/istore.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Robb Matzke +/* Programmer: Robb Matzke * Wednesday, October 15, 1997 * * Purpose: Tests various aspects of indexed raw data storage. diff --git a/test/lheap.c b/test/lheap.c index 5f60dca..dd430a3 100644 --- a/test/lheap.c +++ b/test/lheap.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, November 24, 1998 * * Purpose: Test local heaps used by symbol tables (groups). diff --git a/test/links.c b/test/links.c index 60d3152..cd9f05c 100644 --- a/test/links.c +++ b/test/links.c @@ -9037,15 +9037,15 @@ error: static int external_link_query(hid_t fapl, hbool_t new_format) { - hid_t fid = -1; /* File ID */ - hid_t gid = -1; /* Group IDs */ - const char *file_name; /* Name of the file the external link points to */ - const char *object_name; /* Name of the object the external link points to */ - H5O_info2_t oi; /* Object information */ - H5L_info2_t li; /* Link information */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], /* Names of files to externally link across */ - query_buf[NAME_BUF_SIZE]; /* Buffer to hold query result */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group IDs */ + const char *file_name; /* Name of the file the external link points to */ + const char *object_name; /* Name of the object the external link points to */ + H5O_info2_t oi; /* Object information */ + H5L_info2_t li; /* Link information */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], /* Names of files to externally link across */ + query_buf[NAME_BUF_SIZE]; /* Buffer to hold query result */ if(new_format) TESTING("query aspects of external link (w/new group format)") @@ -18286,7 +18286,6 @@ main(void) nerrors += test_deprec(my_fapl, new_format); #endif /* H5_NO_DEPRECATED_SYMBOLS */ - /* tests for external link */ /* Test external file cache first, so it sees the default efc setting on the fapl */ diff --git a/test/mf.c b/test/mf.c index 7cfc954..8e2f75c 100644 --- a/test/mf.c +++ b/test/mf.c @@ -7696,6 +7696,8 @@ test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl) TEST_ERROR if(fs_persist) { + haddr_t prv_tag = HADDR_UNDEF; + /* Re-open the file */ if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0) TEST_ERROR @@ -7704,6 +7706,9 @@ test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl) if(NULL == (f = (H5F_t *)H5VL_object(fid))) TEST_ERROR + /* Set the freespace tag for the metadata cache */ + H5AC_tag(H5AC__FREESPACE_TAG, &prv_tag); \ + /* Verify that the large generic manager is there */ H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_DRAW, TBLOCK_SIZE5000, (H5F_mem_page_t *)&fs_type); if(!H5F_addr_defined(f->shared->fs_addr[fs_type])) @@ -7754,6 +7759,9 @@ test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl) if(found_addr != gaddr1) TEST_ERROR + /* Reset the previous tag */ + H5AC_tag(prv_tag, NULL); \ + /* Close file */ if(H5Fclose(fid) < 0) TEST_ERROR diff --git a/test/mirror_vfd.c b/test/mirror_vfd.c index 4da742f..35c3f90 100644 --- a/test/mirror_vfd.c +++ b/test/mirror_vfd.c @@ -28,6 +28,8 @@ #ifdef H5_HAVE_MIRROR_VFD +#include "H5FDmirror_priv.h" /* Private header for the mirror VFD */ + /* For future consideration, IP address and port number might be * environment variables? */ diff --git a/test/mount.c b/test/mount.c index 3abe084..4cc02e4 100644 --- a/test/mount.c +++ b/test/mount.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, October 7, 1998 * * Purpose: Tests file mounting. diff --git a/test/mtime.c b/test/mtime.c index 81a20db..8294e80 100644 --- a/test/mtime.c +++ b/test/mtime.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, July 30, 1998 * * Purpose: Determines if the modification time message is working diff --git a/test/ntypes.c b/test/ntypes.c index f1d2449..e371b93 100644 --- a/test/ntypes.c +++ b/test/ntypes.c @@ -2675,7 +2675,7 @@ error: * Return: Success: 0 * Failure: -1 * - * Programmer: pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * September 3, 2004 * * Modifications: diff --git a/test/ohdr.c b/test/ohdr.c index ad76576..e5ba215 100644 --- a/test/ohdr.c +++ b/test/ohdr.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Robb Matzke +/* Programmer: Robb Matzke * Tuesday, November 24, 1998 */ #include "h5test.h" @@ -126,8 +126,12 @@ test_cont(char *filename, hid_t fapl) FAIL_STACK_ERROR if(1 != H5O_link(&oh_locB, 1)) FAIL_STACK_ERROR + if(H5AC_prep_for_file_flush(f) < 0) + FAIL_STACK_ERROR if(H5AC_flush(f) < 0) FAIL_STACK_ERROR + if(H5AC_secure_from_file_flush(f) < 0) + FAIL_STACK_ERROR if(H5O__expunge_chunks_test(&oh_locA) < 0) FAIL_STACK_ERROR @@ -1681,8 +1685,12 @@ main(void) FAIL_STACK_ERROR if(1 != H5O_link(&oh_loc, 1)) FAIL_STACK_ERROR + if(H5AC_prep_for_file_flush(f) < 0) + FAIL_STACK_ERROR if(H5AC_flush(f) < 0) FAIL_STACK_ERROR + if(H5AC_secure_from_file_flush(f) < 0) + FAIL_STACK_ERROR if(H5AC_expunge_entry(f, H5AC_OHDR, oh_loc.addr, H5AC__NO_FLAGS_SET) < 0) FAIL_STACK_ERROR if(NULL == H5O_msg_read(&oh_loc, H5O_MTIME_NEW_ID, &ro)) @@ -1698,8 +1706,12 @@ main(void) time_new = 33333333; if(H5O_msg_write(&oh_loc, H5O_MTIME_NEW_ID, 0, 0, &time_new) < 0) FAIL_STACK_ERROR + if(H5AC_prep_for_file_flush(f) < 0) + FAIL_STACK_ERROR if(H5AC_flush(f) < 0) FAIL_STACK_ERROR + if(H5AC_secure_from_file_flush(f) < 0) + FAIL_STACK_ERROR if(H5AC_expunge_entry(f, H5AC_OHDR, oh_loc.addr, H5AC__NO_FLAGS_SET) < 0) FAIL_STACK_ERROR if(NULL == H5O_msg_read(&oh_loc, H5O_MTIME_NEW_ID, &ro)) @@ -1729,8 +1741,12 @@ main(void) if(H5O_msg_create(&oh_loc, H5O_MTIME_ID, 0, 0, &time_new) < 0) FAIL_STACK_ERROR } /* end for */ + if(H5AC_prep_for_file_flush(f) < 0) + FAIL_STACK_ERROR if(H5AC_flush(f) < 0) FAIL_STACK_ERROR + if(H5AC_secure_from_file_flush(f) < 0) + FAIL_STACK_ERROR if(H5AC_expunge_entry(f, H5AC_OHDR, oh_loc.addr, H5AC__NO_FLAGS_SET) < 0) FAIL_STACK_ERROR @@ -1772,8 +1788,12 @@ main(void) time_new = (i + 1) * 1000 + 10; if(H5O_msg_create(&oh_loc, H5O_MTIME_NEW_ID, 0, 0, &time_new) < 0) FAIL_STACK_ERROR + if(H5AC_prep_for_file_flush(f) < 0) + FAIL_STACK_ERROR if(H5AC_flush(f) < 0) FAIL_STACK_ERROR + if(H5AC_secure_from_file_flush(f) < 0) + FAIL_STACK_ERROR if(H5AC_expunge_entry(f, H5AC_OHDR, oh_loc.addr, H5AC__NO_FLAGS_SET) < 0) FAIL_STACK_ERROR } /* end for */ @@ -1802,8 +1822,12 @@ main(void) time_new = 22222222; if(H5O_msg_create(&oh_loc, H5O_MTIME_NEW_ID, H5O_MSG_FLAG_CONSTANT, 0, &time_new) < 0) FAIL_STACK_ERROR + if(H5AC_prep_for_file_flush(f) < 0) + FAIL_STACK_ERROR if(H5AC_flush(f) < 0) FAIL_STACK_ERROR + if(H5AC_secure_from_file_flush(f) < 0) + FAIL_STACK_ERROR if(H5AC_expunge_entry(f, H5AC_OHDR, oh_loc.addr, H5AC__NO_FLAGS_SET) < 0) FAIL_STACK_ERROR if(NULL == H5O_msg_read(&oh_loc, H5O_MTIME_NEW_ID, &ro)) diff --git a/test/page_buffer.c b/test/page_buffer.c index a508dc9..773b863 100644 --- a/test/page_buffer.c +++ b/test/page_buffer.c @@ -384,7 +384,6 @@ error: * *------------------------------------------------------------------------- */ - static unsigned test_args(hid_t orig_fapl, const char *env_h5_drvr) { diff --git a/test/pool.c b/test/pool.c index 1851d6e..59f9201 100644 --- a/test/pool.c +++ b/test/pool.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol +/* Programmer: Quincey Koziol * Tuesday, May 3, 2005 */ #include "h5test.h" @@ -636,10 +636,10 @@ test_allocate_random(void) /* Initialize random number seed */ curr_time = HDtime(NULL); -#ifdef QAK +#if 0 curr_time=1115412944; HDfprintf(stderr,"curr_time=%lu\n",(unsigned long)curr_time); -#endif /* QAK */ +#endif HDsrandom((unsigned)curr_time); /* Create a memory pool */ diff --git a/test/ros3.c b/test/ros3.c index 73b6ac2..fb7aa2b 100644 --- a/test/ros3.c +++ b/test/ros3.c @@ -20,7 +20,7 @@ * * Demonstrates basic use cases and fapl/dxpl interaction. * - * Programmer: Jacob Smith + * Programmer: Jacob Smith * 2017-10-11 */ diff --git a/test/s3comms.c b/test/s3comms.c index 9453b75..9a7d7d6 100644 --- a/test/s3comms.c +++ b/test/s3comms.c @@ -15,7 +15,7 @@ * * Purpose: Unit tests for the S3 Communications (s3comms) module. * - * Programmer: Jacob Smith + * Programmer: Jacob Smith * 2017-10-11 */ diff --git a/test/set_extent.c b/test/set_extent.c index 171fd05..17bdb1b 100644 --- a/test/set_extent.c +++ b/test/set_extent.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Pedro Vicente + * Programmer: Pedro Vicente * April 12, 2002 * * Purpose: Tests the H5Dset_extent call diff --git a/test/space_overflow.c b/test/space_overflow.c index 15be9ba..82ddb3b 100644 --- a/test/space_overflow.c +++ b/test/space_overflow.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, October 26, 1998 * * Purpose: Create a dataset with a simple data space that has the diff --git a/test/stab.c b/test/stab.c index 215d748..ed4b5a0 100644 --- a/test/stab.c +++ b/test/stab.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, November 24, 1998 */ @@ -171,7 +171,7 @@ test_misc(hid_t fcpl, hid_t fapl, hbool_t new_format) * * Failure: number of errors * - * Programmer: Robb Matzke 2002-03-28 + * Programmer: Robb Matzke 2002-03-28 * * Modifications: *------------------------------------------------------------------------- diff --git a/test/swmr.c b/test/swmr.c index bab91bd..a1bc87d 100644 --- a/test/swmr.c +++ b/test/swmr.c @@ -91,7 +91,7 @@ static int test_file_lock_concur(hid_t fapl); static int test_file_lock_swmr_concur(hid_t fapl); /* Test file lock environment variable */ -static int test_file_lock_env_var(hid_t fapl); +static int test_file_locking(hid_t in_fapl, hbool_t turn_locking_on, hbool_t env_var_override); /* Tests for SWMR VFD flag */ static int test_swmr_vfd_flag(void); @@ -4256,8 +4256,11 @@ test_file_lock_same(hid_t in_fapl) /* Output message about test being performed */ TESTING("File open with different combinations of flags--single process access"); + /* Set locking in the fapl */ if((fapl = H5Pcopy(in_fapl)) < 0) FAIL_STACK_ERROR + if(H5Pset_file_locking(fapl, TRUE, TRUE) < 0) + FAIL_STACK_ERROR /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[1], fapl, filename, sizeof(filename)); @@ -4416,7 +4419,7 @@ test_file_lock_swmr_same(hid_t in_fapl) /* Output message about test being performed */ TESTING("File open with different combinations of flags + SWMR flags--single process access"); - /* Get a copy of the parameter in_fapl */ + /* Set locking in the fapl */ if((fapl = H5Pcopy(in_fapl)) < 0) FAIL_STACK_ERROR @@ -4726,8 +4729,11 @@ test_file_lock_concur(hid_t in_fapl) /* Output message about test being performed */ TESTING("File open with different combinations of flags--concurrent access"); + /* Set locking in the fapl */ if((fapl = H5Pcopy(in_fapl)) < 0) FAIL_STACK_ERROR + if(H5Pset_file_locking(fapl, TRUE, TRUE) < 0) + FAIL_STACK_ERROR /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[1], fapl, filename, sizeof(filename)); @@ -5102,8 +5108,11 @@ test_file_lock_swmr_concur(hid_t in_fapl) /* Output message about test being performed */ TESTING("File open with different combintations of flags + SWMR flags--concurrent access"); + /* Set locking in the fapl */ if((fapl = H5Pcopy(in_fapl)) < 0) FAIL_STACK_ERROR + if(H5Pset_file_locking(fapl, TRUE, TRUE) < 0) + FAIL_STACK_ERROR /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[2], fapl, filename, sizeof(filename)); @@ -5134,7 +5143,7 @@ test_file_lock_swmr_concur(hid_t in_fapl) if(childpid == 0) { /* Child process */ hid_t child_fid; /* File ID */ - int child_notify = 0; + int child_notify = 0; /* Close unused write end for out_pdf */ if(HDclose(out_pdf[1]) < 0) @@ -5155,7 +5164,7 @@ test_file_lock_swmr_concur(hid_t in_fapl) if(child_fid == FAIL) HDexit(EXIT_SUCCESS); - /* Close the pipe */ + /* Close the pipe */ if(HDclose(out_pdf[0]) < 0) HDexit(EXIT_FAILURE); @@ -5205,13 +5214,13 @@ test_file_lock_swmr_concur(hid_t in_fapl) /* Fork child process */ if((childpid = HDfork()) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(childpid == 0) { /* Child process */ hid_t child_fid; /* File ID */ - int child_notify = 0; + int child_notify = 0; - /* Close unused write end for out_pdf */ + /* Close unused write end for out_pdf */ if(HDclose(out_pdf[1]) < 0) HDexit(EXIT_FAILURE); @@ -5230,7 +5239,7 @@ test_file_lock_swmr_concur(hid_t in_fapl) if(child_fid == FAIL) HDexit(EXIT_SUCCESS); - /* Close the pipe */ + /* Close the pipe */ if(HDclose(out_pdf[0]) < 0) HDexit(EXIT_FAILURE); @@ -5243,7 +5252,7 @@ test_file_lock_swmr_concur(hid_t in_fapl) /* Open the test file */ if((fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* Notify child process */ notify = 1; @@ -5256,7 +5265,7 @@ test_file_lock_swmr_concur(hid_t in_fapl) /* Wait for child process to complete */ if(HDwaitpid(childpid, &child_status, child_wait_option) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* Check if child terminated normally */ if(WIFEXITED(child_status)) { @@ -5284,7 +5293,7 @@ test_file_lock_swmr_concur(hid_t in_fapl) if(childpid == 0) { /* Child process */ hid_t child_fid; /* File ID */ - int child_notify = 0; + int child_notify = 0; /* Close unused write end for out_pdf */ if(HDclose(out_pdf[1]) < 0) @@ -5305,7 +5314,7 @@ test_file_lock_swmr_concur(hid_t in_fapl) if(child_fid == FAIL) HDexit(EXIT_SUCCESS); - /* Close the pipe */ + /* Close the pipe */ if(HDclose(out_pdf[0]) < 0) HDexit(EXIT_FAILURE); @@ -5354,11 +5363,11 @@ test_file_lock_swmr_concur(hid_t in_fapl) /* Fork child process */ if((childpid = HDfork()) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(childpid == 0) { /* Child process */ hid_t child_fid; /* File ID */ - int child_notify = 0; + int child_notify = 0; /* Close unused write end for out_pdf */ if(HDclose(out_pdf[1]) < 0) @@ -5379,7 +5388,7 @@ test_file_lock_swmr_concur(hid_t in_fapl) if(child_fid == FAIL) HDexit(EXIT_SUCCESS); - /* Close the pipe */ + /* Close the pipe */ if(HDclose(out_pdf[0]) < 0) HDexit(EXIT_FAILURE); @@ -5392,7 +5401,7 @@ test_file_lock_swmr_concur(hid_t in_fapl) /* Open the test file */ if((fid = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, fapl)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* Notify child process */ notify = 1; @@ -5405,7 +5414,7 @@ test_file_lock_swmr_concur(hid_t in_fapl) /* Wait for child process to complete */ if(HDwaitpid(childpid, &child_status, child_wait_option) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* Check if child terminated normally */ if(WIFEXITED(child_status)) { @@ -5428,11 +5437,11 @@ test_file_lock_swmr_concur(hid_t in_fapl) /* Fork child process */ if((childpid = HDfork()) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(childpid == 0) { /* Child process */ hid_t child_fid; /* File ID */ - int child_notify = 0; + int child_notify = 0; /* Close unused write end for out_pdf */ if(HDclose(out_pdf[1]) < 0) @@ -5456,7 +5465,7 @@ test_file_lock_swmr_concur(hid_t in_fapl) HDexit(EXIT_SUCCESS); } - /* Close the pipe */ + /* Close the pipe */ if(HDclose(out_pdf[0]) < 0) HDexit(EXIT_FAILURE); @@ -5469,7 +5478,7 @@ test_file_lock_swmr_concur(hid_t in_fapl) /* Open the test file */ if((fid = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, fapl)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* Notify child process */ notify = 1; @@ -5482,7 +5491,7 @@ test_file_lock_swmr_concur(hid_t in_fapl) /* Wait for child process to complete */ if(HDwaitpid(childpid, &child_status, child_wait_option) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* Check if child terminated normally */ if(WIFEXITED(child_status)) { @@ -5509,7 +5518,7 @@ test_file_lock_swmr_concur(hid_t in_fapl) if(childpid == 0) { /* Child process */ hid_t child_fid; /* File ID */ - int child_notify = 0; + int child_notify = 0; /* Close unused write end for out_pdf */ if(HDclose(out_pdf[1]) < 0) @@ -5530,7 +5539,7 @@ test_file_lock_swmr_concur(hid_t in_fapl) if(child_fid == FAIL) HDexit(EXIT_SUCCESS); - /* Close the pipe */ + /* Close the pipe */ if(HDclose(out_pdf[0]) < 0) HDexit(EXIT_FAILURE); @@ -5584,7 +5593,7 @@ test_file_lock_swmr_concur(hid_t in_fapl) if(childpid == 0) { /* Child process */ hid_t child_fid; /* File ID */ - int child_notify = 0; + int child_notify = 0; /* Close unused write end for out_pdf */ if(HDclose(out_pdf[1]) < 0) @@ -5598,14 +5607,14 @@ test_file_lock_swmr_concur(hid_t in_fapl) /* Open the test file */ H5E_BEGIN_TRY { - child_fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT); + child_fid = H5Fopen(filename, H5F_ACC_RDWR, fapl); } H5E_END_TRY; /* Should fail */ if(child_fid == FAIL) HDexit(EXIT_SUCCESS); - /* Close the pipe */ + /* Close the pipe */ if(HDclose(out_pdf[0]) < 0) HDexit(EXIT_FAILURE); @@ -5659,7 +5668,7 @@ test_file_lock_swmr_concur(hid_t in_fapl) if(childpid == 0) { /* Child process */ hid_t child_fid; /* File ID */ - int child_notify = 0; + int child_notify = 0; /* Close unused write end for out_pdf */ if(HDclose(out_pdf[1]) < 0) @@ -5734,7 +5743,7 @@ test_file_lock_swmr_concur(hid_t in_fapl) if(childpid == 0) { /* Child process */ hid_t child_fid; /* File ID */ - int child_notify = 0; + int child_notify = 0; /* Close unused write end for out_pdf */ if(HDclose(out_pdf[1]) < 0) @@ -5812,7 +5821,7 @@ test_file_lock_swmr_concur(hid_t in_fapl) if(childpid == 0) { /* Child process */ hid_t child_fid; /* File ID */ - int child_notify = 0; + int child_notify = 0; /* Close unused write end for out_pdf */ if(HDclose(out_pdf[1]) < 0) @@ -5835,7 +5844,7 @@ test_file_lock_swmr_concur(hid_t in_fapl) HDexit(EXIT_SUCCESS); } - /* Close the pipe */ + /* Close the pipe */ if(HDclose(out_pdf[0]) < 0) HDexit(EXIT_FAILURE); @@ -5889,7 +5898,7 @@ test_file_lock_swmr_concur(hid_t in_fapl) if(childpid == 0) { /* Child process */ hid_t child_fid; /* File ID */ - int child_notify = 0; + int child_notify = 0; /* Close unused write end for out_pdf */ if(HDclose(out_pdf[1]) < 0) @@ -5910,7 +5919,7 @@ test_file_lock_swmr_concur(hid_t in_fapl) if(child_fid == FAIL) HDexit(EXIT_SUCCESS); - /* Close the pipe */ + /* Close the pipe */ if(HDclose(out_pdf[0]) < 0) HDexit(EXIT_FAILURE); @@ -5922,7 +5931,7 @@ test_file_lock_swmr_concur(hid_t in_fapl) FAIL_STACK_ERROR /* Open the test file */ - if((fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) + if((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR /* Notify child process */ @@ -5964,7 +5973,7 @@ test_file_lock_swmr_concur(hid_t in_fapl) if(childpid == 0) { /* Child process */ hid_t child_fid; /* File ID */ - int child_notify = 0; + int child_notify = 0; /* Close unused write end for out_pdf */ if(HDclose(out_pdf[1]) < 0) @@ -6046,20 +6055,17 @@ error: } /* end test_file_lock_swmr_concur() */ - - #endif /* !(defined(H5_HAVE_FORK && defined(H5_HAVE_WAITPID)) */ /**************************************************************** ** -** test_file_lock_swmr_concur(): low-level file test routine. -** With the implementation of file locking, this test checks file -** open with different combinations of flags + SWMR flags. -** This is for concurrent access. +** test_file_locking(): +** Tests various combinations of file locking flags and +** and environment variables. ** *****************************************************************/ static int -test_file_lock_env_var(hid_t in_fapl) +test_file_locking(hid_t in_fapl, hbool_t turn_locking_on, hbool_t env_var_override) { #if !(defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID)) SKIPPED(); @@ -6074,18 +6080,40 @@ test_file_lock_env_var(hid_t in_fapl) int child_wait_option=0; /* Options passed to waitpid */ int out_pdf[2]; int notify = 0; + int exit_status = 0; + herr_t ret; + + if (turn_locking_on && env_var_override) + TESTING("File locking: ON w/ env var override") + else if (turn_locking_on && !env_var_override) + TESTING("File locking: ON") + else if (!turn_locking_on && env_var_override) + TESTING("File locking: OFF w/ env var override") + else + TESTING("File locking: OFF") - - TESTING("File locking environment variable"); - - - /* Set the environment variable */ - if(HDsetenv("HDF5_USE_FILE_LOCKING", "FALSE", TRUE) < 0) + /* Copy the incoming fapl */ + if((fapl = H5Pcopy(in_fapl)) < 0) TEST_ERROR - if((fapl = H5Pcopy(in_fapl)) < 0) + /* Set locking in the fapl */ + if(H5Pset_file_locking(fapl, turn_locking_on ? TRUE : FALSE, TRUE) < 0) TEST_ERROR + /* If requested, set the environment variable */ + if (env_var_override) { + if(HDsetenv("HDF5_USE_FILE_LOCKING", turn_locking_on ? "FALSE" : "TRUE", TRUE) < 0) + TEST_ERROR + if(H5F__reparse_file_lock_variable_test() < 0) + TEST_ERROR + } + else { + if(HDsetenv("HDF5_USE_FILE_LOCKING", "", TRUE) < 0) + TEST_ERROR + if(H5F__reparse_file_lock_variable_test() < 0) + TEST_ERROR + } + /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[1], fapl, filename, sizeof(filename)); @@ -6097,10 +6125,8 @@ test_file_lock_env_var(hid_t in_fapl) if(H5Fclose(fid) < 0) TEST_ERROR - /* Open a file for read-only and then read-write. This would - * normally fail due to the file locking scheme but should - * pass when the environment variable is set to disable file - * locking. + /* Open a file for read-only and then read-write. This will fail + * when the locking scheme is turned on. */ /* Create 1 pipe */ @@ -6115,7 +6141,7 @@ test_file_lock_env_var(hid_t in_fapl) /* Child process */ - hid_t child_fid; /* File ID */ + hid_t child_fid = H5I_INVALID_HID; /* File ID */ int child_notify = 0; /* Close unused write end for out_pdf */ @@ -6126,18 +6152,23 @@ test_file_lock_env_var(hid_t in_fapl) while(child_notify != 1) { if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0) HDexit(EXIT_FAILURE); - } /* end while */ + } - /* Open the test file */ - if((child_fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) - TEST_ERROR + /* Open and close the test file */ + H5E_BEGIN_TRY { + child_fid = H5Fopen(filename, H5F_ACC_RDWR, fapl); + ret = H5Fclose(child_fid); + } H5E_END_TRY; /* Close the pipe */ if(HDclose(out_pdf[0]) < 0) HDexit(EXIT_FAILURE); - HDexit(EXIT_SUCCESS); - } /* end if */ + if(H5I_INVALID_HID == child_fid || FAIL == ret) + HDexit(EXIT_FAILURE); + else + HDexit(EXIT_SUCCESS); + } /* end child process work */ /* close unused read end for out_pdf */ if(HDclose(out_pdf[0]) < 0) @@ -6160,15 +6191,28 @@ test_file_lock_env_var(hid_t in_fapl) if(HDwaitpid(childpid, &child_status, child_wait_option) < 0) TEST_ERROR - /* Check if child terminated normally */ - if(WIFEXITED(child_status)) { - /* Check exit status of the child */ - if(WEXITSTATUS(child_status) != 0) - TEST_ERROR - } /* end if */ + /* Check exit status of the child */ + if(WIFEXITED(child_status)) + exit_status = WEXITSTATUS(child_status); else TEST_ERROR + /* The child process should have passed or failed as follows: + * + * locks on: FAIL + * locks off: PASS + * locks on, env var override: PASS + * locks off, env var override: FAIL + */ + if(turn_locking_on && !env_var_override && (0 == exit_status)) + TEST_ERROR + else if(!turn_locking_on && !env_var_override && (0 != exit_status)) + TEST_ERROR + else if(turn_locking_on && env_var_override && (0 != exit_status)) + TEST_ERROR + else if(!turn_locking_on && env_var_override && (0 == exit_status)) + TEST_ERROR + /* Close the file */ if(H5Fclose(fid) < 0) TEST_ERROR @@ -6192,8 +6236,81 @@ error: #endif /* !(defined(H5_HAVE_FORK && defined(H5_HAVE_WAITPID)) */ -} /* end test_file_lock_env_var() */ +} /* end test_file_locking() */ + + +/**************************************************************** +** +** test_different_lock_flags(): +** Tests opening a file multiple times with different lock +** flags. +** +*****************************************************************/ +static int +test_different_lock_flags(hid_t in_fapl) +{ + hid_t fid1 = H5I_INVALID_HID; /* File ID */ + hid_t fid2 = H5I_INVALID_HID; /* File ID */ + hid_t fid3 = H5I_INVALID_HID; /* File ID */ + hid_t fapl_id = H5I_INVALID_HID; /* File access property list */ + char filename[NAME_BUF_SIZE]; /* File name */ + + TESTING("Using different lock flags") + + /* Copy the incoming fapl */ + if((fapl_id = H5Pcopy(in_fapl)) < 0) + TEST_ERROR + + /* Set locking in the fapl */ + if(H5Pset_file_locking(fapl_id, TRUE, TRUE) < 0) + TEST_ERROR + /* Set the filename to use for this test (dependent on fapl) */ + h5_fixname(FILENAME[1], fapl_id, filename, sizeof(filename)); + + /* Create the test file */ + if((fid1 = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) + TEST_ERROR + + /* Open the test file with the same flags (should pass) */ + if((fid2 = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0) + TEST_ERROR + + /* Unset locking in the fapl */ + if(H5Pset_file_locking(fapl_id, FALSE, FALSE) < 0) + TEST_ERROR + + /* Open the test file with different flags (should FAIL) */ + H5E_BEGIN_TRY { + fid3 = H5Fopen(filename, H5F_ACC_RDWR, fapl_id); + } H5E_END_TRY; + if(H5I_INVALID_HID != fid3) + FAIL_PUTS_ERROR("Should not have been able to open a file with different locking flags") + + /* Close the files */ + if(H5Fclose(fid1) < 0) + TEST_ERROR + if(H5Fclose(fid2) < 0) + TEST_ERROR + + /* Close the copied property list */ + if(H5Pclose(fapl_id) < 0) + TEST_ERROR + + PASSED(); + + return 0; + +error: + H5E_BEGIN_TRY { + H5Pclose(fapl_id); + H5Fclose(fid1); + H5Fclose(fid2); + H5Fclose(fid3); + } H5E_END_TRY; + + return -1; +} /* end test_different_lock_flags() */ static int test_swmr_vfd_flag(void) @@ -7019,7 +7136,7 @@ error: H5Fclose(fid3); } H5E_END_TRY; - return -1; + return 1; } /* test_multiple_same() */ @@ -7036,6 +7153,7 @@ main(void) char *driver = NULL; /* VFD string (from env variable) */ char *lock_env_var = NULL; /* file locking env var pointer */ hbool_t use_file_locking; /* read from env var */ + hbool_t file_locking_enabled = FALSE; /* Checks if the file system supports locks */ /* Skip this test if SWMR I/O is not supported for the VFD specified * by the environment variable. @@ -7056,6 +7174,13 @@ main(void) else use_file_locking = TRUE; + /* Check if file locking is enabled on this file system */ + if(use_file_locking) + if(h5_check_if_file_locking_enabled(&file_locking_enabled) < 0) { + HDprintf("Error when determining if file locks are enabled\n"); + return EXIT_FAILURE; + } + /* Set up */ h5_reset(); @@ -7097,7 +7222,7 @@ main(void) nerrors += test_append_flush_dataset_fixed(fapl); nerrors += test_append_flush_dataset_multiple(fapl); - if(use_file_locking) { + if(use_file_locking && file_locking_enabled) { /* * Tests for: * file open flags--single process access @@ -7124,10 +7249,19 @@ main(void) if(NULL == driver || !HDstrcmp(driver, "") || !HDstrcmp(driver, "sec2")) nerrors += test_swmr_vfd_flag(); - /* This test changes the HDF5_USE_FILE_LOCKING environment variable - * so it should be run last. + /* Test multiple opens via different locking flags */ + if (use_file_locking && file_locking_enabled) + nerrors += test_different_lock_flags(fapl); + + /* These tests change the HDF5_USE_FILE_LOCKING environment variable + * so they should be run last. */ - nerrors += test_file_lock_env_var(fapl); + if (use_file_locking && file_locking_enabled) { + nerrors += test_file_locking(fapl, TRUE, TRUE); + nerrors += test_file_locking(fapl, TRUE, FALSE); + nerrors += test_file_locking(fapl, FALSE, TRUE); + nerrors += test_file_locking(fapl, FALSE, FALSE); + } if(nerrors) goto error; diff --git a/test/swmr_addrem_writer.c b/test/swmr_addrem_writer.c index 71e4929..7ad74ed 100644 --- a/test/swmr_addrem_writer.c +++ b/test/swmr_addrem_writer.c @@ -88,26 +88,6 @@ open_skeleton(const char *filename, unsigned verbose) if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) return -1; -#ifdef QAK - /* Increase the initial size of the metadata cache */ - { - H5AC_cache_config_t mdc_config; - - mdc_config.version = H5AC__CURR_CACHE_CONFIG_VERSION; - H5Pget_mdc_config(fapl, &mdc_config); - HDfprintf(stderr, "mdc_config.initial_size = %lu\n", (unsigned long)mdc_config.initial_size); - HDfprintf(stderr, "mdc_config.epoch_length = %lu\n", (unsigned long)mdc_config.epoch_length); - mdc_config.set_initial_size = 1; - mdc_config.initial_size = 16 * 1024 * 1024; - /* mdc_config.epoch_length = 5000; */ - H5Pset_mdc_config(fapl, &mdc_config); - } -#endif /* QAK */ - -#ifdef QAK - H5Pset_fapl_log(fapl, "append.log", H5FD_LOG_ALL, (size_t)(512 * 1024 * 1024)); -#endif /* QAK */ - /* Open the file */ if((fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl)) < 0) return -1; diff --git a/test/swmr_generator.c b/test/swmr_generator.c index f6a4fe2..7fb08df 100644 --- a/test/swmr_generator.c +++ b/test/swmr_generator.c @@ -121,38 +121,10 @@ gen_skeleton(const char *filename, hbool_t verbose, hbool_t swmr_write, if(!HDstrcmp(index_type, "b2")) max_dims[0] = H5S_UNLIMITED; -#ifdef QAK - /* Increase the initial size of the metadata cache */ - { - H5AC_cache_config_t mdc_config; - - mdc_config.version = H5AC__CURR_CACHE_CONFIG_VERSION; - H5Pget_mdc_config(fapl, &mdc_config); - HDfprintf(stderr, "mdc_config.initial_size = %lu\n", (unsigned long)mdc_config.initial_size); - HDfprintf(stderr, "mdc_config.epoch_length = %lu\n", (unsigned long)mdc_config.epoch_length); - mdc_config.set_initial_size = 1; - mdc_config.initial_size = 16 * 1024 * 1024; - /* mdc_config.epoch_length = 5000; */ - H5Pset_mdc_config(fapl, &mdc_config); - } -#endif /* QAK */ - -#ifdef QAK - H5Pset_small_data_block_size(fapl, (hsize_t)(50 * CHUNK_SIZE * DTYPE_SIZE)); -#endif /* QAK */ - -#ifdef QAK - H5Pset_fapl_log(fapl, "append.log", H5FD_LOG_ALL, (size_t)(512 * 1024 * 1024)); -#endif /* QAK */ - /* Create file creation property list */ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) return -1; -#ifdef QAK - H5Pset_link_phase_change(fcpl, 0, 0); -#endif /* QAK */ - /* Emit informational message */ if(verbose) HDfprintf(stderr, "Creating file\n"); diff --git a/test/swmr_remove_writer.c b/test/swmr_remove_writer.c index 2bebab9..504ea8a 100644 --- a/test/swmr_remove_writer.c +++ b/test/swmr_remove_writer.c @@ -90,26 +90,6 @@ open_skeleton(const char *filename, unsigned verbose, unsigned old) return -1; } -#ifdef QAK -/* Increase the initial size of the metadata cache */ - { - H5AC_cache_config_t mdc_config; - - mdc_config.version = H5AC__CURR_CACHE_CONFIG_VERSION; - H5Pget_mdc_config(fapl, &mdc_config); - HDfprintf(stderr, "mdc_config.initial_size = %lu\n", (unsigned long)mdc_config.initial_size); - HDfprintf(stderr, "mdc_config.epoch_length = %lu\n", (unsigned long)mdc_config.epoch_length); - mdc_config.set_initial_size = 1; - mdc_config.initial_size = 16 * 1024 * 1024; - /* mdc_config.epoch_length = 5000; */ - H5Pset_mdc_config(fapl, &mdc_config); - } -#endif /* QAK */ - -#ifdef QAK - H5Pset_fapl_log(fapl, "append.log", H5FD_LOG_ALL, (size_t)(512 * 1024 * 1024)); -#endif /* QAK */ - /* Open the file */ if((fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl)) < 0) return -1; diff --git a/test/swmr_sparse_writer.c b/test/swmr_sparse_writer.c index 5173c71..1892fe2 100644 --- a/test/swmr_sparse_writer.c +++ b/test/swmr_sparse_writer.c @@ -87,26 +87,6 @@ open_skeleton(const char *filename, unsigned verbose) if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) return -1; -#ifdef QAK - /* Increase the initial size of the metadata cache */ - { - H5AC_cache_config_t mdc_config; - - mdc_config.version = H5AC__CURR_CACHE_CONFIG_VERSION; - H5Pget_mdc_config(fapl, &mdc_config); - HDfprintf(stderr, "mdc_config.initial_size = %lu\n", (unsigned long)mdc_config.initial_size); - HDfprintf(stderr,"mdc_config.epoch_length = %lu\n", (unsigned long)mdc_config.epoch_length); - mdc_config.set_initial_size = 1; - mdc_config.initial_size = 16 * 1024 * 1024; - /* mdc_config.epoch_length = 5000; */ - H5Pset_mdc_config(fapl, &mdc_config); - } -#endif /* QAK */ - -#ifdef QAK - H5Pset_fapl_log(fapl, "append.log", H5FD_LOG_ALL, (size_t)(512 * 1024 * 1024)); -#endif /* QAK */ - /* Open the file */ if((fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl)) < 0) return -1; diff --git a/test/swmr_start_write.c b/test/swmr_start_write.c index fc7e7a5..0527229 100644 --- a/test/swmr_start_write.c +++ b/test/swmr_start_write.c @@ -85,16 +85,6 @@ create_file(const char *filename, hbool_t verbose, FILE *verbose_file, if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) return -1; -#ifdef QAK - if(verbose) { - char verbose_name[1024]; - - HDsnprintf(verbose_name, sizeof(verbose_name), "swmr_start_write.log.%u", random_seed); - - H5Pset_fapl_log(fapl, verbose_name, H5FD_LOG_ALL, (size_t)(512 * 1024 * 1024)); - } /* end if */ -#endif /* QAK */ - /* Create file creation property list */ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) return -1; diff --git a/test/swmr_writer.c b/test/swmr_writer.c index d4387aa..656a5b2 100644 --- a/test/swmr_writer.c +++ b/test/swmr_writer.c @@ -90,22 +90,6 @@ open_skeleton(const char *filename, hbool_t verbose, FILE *verbose_file, return -1; } -#ifdef QAK - /* Increase the initial size of the metadata cache */ - { - H5AC_cache_config_t mdc_config; - - mdc_config.version = H5AC__CURR_CACHE_CONFIG_VERSION; - H5Pget_mdc_config(fapl, &mdc_config); - HDfprintf(stderr, "mdc_config.initial_size = %lu\n", (unsigned long)mdc_config.initial_size); - HDfprintf(stderr, "mdc_config.epoch_length = %lu\n", (unsigned long)mdc_config.epoch_length); - mdc_config.set_initial_size = 1; - mdc_config.initial_size = 16 * 1024 * 1024; - /* mdc_config.epoch_length = 5000; */ - H5Pset_mdc_config(fapl, &mdc_config); - } -#endif /* QAK */ - if(use_log_vfd) { char verbose_name[1024]; diff --git a/test/tattr.c b/test/tattr.c index dab03a7..496dd6c 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -542,7 +542,7 @@ test_attr_flush(hid_t fapl) ret=H5Aread(att, H5T_NATIVE_DOUBLE, &rdata); CHECK(ret, FAIL, "H5Awrite"); - if(!H5_DBL_ABS_EQUAL(rdata, 0.0)) + if(!H5_DBL_ABS_EQUAL(rdata, (double)0.0f)) TestErrPrintf("attribute value wrong: rdata=%f, should be %f\n",rdata,(double)0.0F); ret=H5Fflush(fil, H5F_SCOPE_GLOBAL); @@ -551,7 +551,7 @@ test_attr_flush(hid_t fapl) ret=H5Aread(att, H5T_NATIVE_DOUBLE, &rdata); CHECK(ret, FAIL, "H5Awrite"); - if(!H5_DBL_ABS_EQUAL(rdata, 0.0)) + if(!H5_DBL_ABS_EQUAL(rdata, (double)0.0f)) TestErrPrintf("attribute value wrong: rdata=%f, should be %f\n",rdata,(double)0.0F); ret=H5Awrite(att, H5T_NATIVE_DOUBLE, &wdata); @@ -6773,13 +6773,6 @@ attr_iterate2_cb(hid_t loc_id, const char *attr_name, const H5A_info_t *info, char attrname[NAME_BUF_SIZE]; /* Object name */ H5A_info_t my_info; /* Local attribute info */ -#ifdef QAK -HDfprintf(stderr, "attr_name = '%s'\n", attr_name); -if(info) - HDfprintf(stderr, "info->corder = %u\n", (unsigned)info->corder); -HDfprintf(stderr, "op_data->curr = %Hd\n", op_data->curr); -#endif /* QAK */ - /* Increment # of times the callback was called */ op_data->ncalled++; diff --git a/test/tchecksum.c b/test/tchecksum.c index 6e509fb..82dc135 100644 --- a/test/tchecksum.c +++ b/test/tchecksum.c @@ -15,7 +15,7 @@ * * Created: tchecksum.c * Aug 21 2006 - * Quincey Koziol + * Quincey Koziol * * Purpose: Test internal checksum routine(s) * diff --git a/test/testframe.c b/test/testframe.c index 3c2a335..cfb62ec 100644 --- a/test/testframe.c +++ b/test/testframe.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, January 6, 2004 * * Purpose: Provides support functions for the testing framework. diff --git a/test/tfile.c b/test/tfile.c index d6047dc..e7dfcbe 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -3097,7 +3097,6 @@ test_rw_noupdate(void) ** test_userblock_alignment() test, to handle common testing ** ** Programmer: Quincey Koziol -** koziol@hdfgroup.org ** Septmber 10, 2009 ** *****************************************************************/ @@ -3159,7 +3158,6 @@ test_userblock_alignment_helper1(hid_t fcpl, hid_t fapl) ** test_userblock_alignment() test, to handle common testing ** ** Programmer: Quincey Koziol -** koziol@hdfgroup.org ** Septmber 10, 2009 ** *****************************************************************/ @@ -3229,7 +3227,6 @@ test_userblock_alignment_helper2(hid_t fapl, hbool_t open_rw) ** object [allocation] alignment size set interact properly. ** ** Programmer: Quincey Koziol -** koziol@hdfgroup.org ** Septmber 8, 2009 ** *****************************************************************/ diff --git a/test/th5o.c b/test/th5o.c index ab4a8de..4bc2096 100644 --- a/test/th5o.c +++ b/test/th5o.c @@ -243,17 +243,17 @@ test_h5o_close(void) static void test_h5o_open_by_addr(void) { - hid_t fid; /* HDF5 File ID */ - hid_t grp, dset, dtype, dspace; /* Object identifiers */ - H5L_info2_t li; /* Buffer for H5Lget_info */ - haddr_t grp_addr; /* Addresses for objects */ - haddr_t dset_addr; - haddr_t dtype_addr; - hsize_t dims[RANK]; - H5I_type_t id_type; /* Type of IDs returned from H5Oopen */ - H5G_info_t ginfo; /* Group info struct */ - H5T_class_t type_class; /* Class of the datatype */ - herr_t ret; /* Value returned from API calls */ + hid_t fid; /* HDF5 File ID */ + hid_t grp, dset, dtype, dspace; /* Object identifiers */ + H5L_info2_t li; /* Buffer for H5Lget_info2 */ + haddr_t grp_addr; /* Addresses for objects */ + haddr_t dset_addr; + haddr_t dtype_addr; + hsize_t dims[RANK]; + H5I_type_t id_type; /* Type of IDs returned from H5Oopen */ + H5G_info_t ginfo; /* Group info struct */ + H5T_class_t type_class; /* Class of the datatype */ + herr_t ret; /* Value returned from API calls */ /* Create a new HDF5 file */ fid = H5Fcreate(TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); diff --git a/test/thread_id.c b/test/thread_id.c index 24aef80..0c804ed 100644 --- a/test/thread_id.c +++ b/test/thread_id.c @@ -25,6 +25,8 @@ */ #include "testhdf5.h" +#if defined(H5_HAVE_THREADSAFE) && !defined(H5_HAVE_WIN_THREADS) + static void my_errx(int, const char *, ...) H5_ATTR_FORMAT(printf, 2, 3); static void @@ -40,8 +42,6 @@ my_errx(int code, const char *fmt, ...) HDexit(code); } -#if defined(H5_HAVE_THREADSAFE) && !defined(H5_HAVE_WIN_THREADS) - #if defined(H5_HAVE_DARWIN) typedef struct _pthread_barrierattr { diff --git a/test/timer.c b/test/timer.c new file mode 100644 index 0000000..1014e75 --- /dev/null +++ b/test/timer.c @@ -0,0 +1,414 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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: Dana Robinson + * May, 2011 + * + * Purpose: Tests the operation of the platform-independent timers. + */ + +#include "h5test.h" + + + + +/*------------------------------------------------------------------------- + * Function: test_time_formatting + * + * Purpose: Tests time string creation. + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Dana Robinson + * May 2011 + * + *------------------------------------------------------------------------- + */ +static herr_t +test_time_formatting(void) +{ + char *s = NULL; + + TESTING("Time string formats"); + + /* < 0, N/A */ + s = H5_timer_get_time_string(-1.0F); + if(NULL == s || HDstrcmp(s, "N/A") != 0) + TEST_ERROR; + HDfree(s); + + /* 0 0 */ + s = H5_timer_get_time_string(0.0F); + if(NULL == s || HDstrcmp(s, "0.0 s") != 0) + TEST_ERROR; + HDfree(s); + + /* < 1 us nanoseconds */ + s = H5_timer_get_time_string(123.0E-9F); + if(NULL == s || HDstrcmp(s, "123 ns") != 0) + TEST_ERROR; + HDfree(s); + + /* < 1 ms microseconds */ + s = H5_timer_get_time_string(23.456E-6F); + if(NULL == s || HDstrcmp(s, "23.5 us") != 0) + TEST_ERROR; + HDfree(s); + + /* < 1 s milliseconds */ + s = H5_timer_get_time_string(4.56789E-3F); + if(NULL == s || HDstrcmp(s, "4.6 ms") != 0) + TEST_ERROR; + HDfree(s); + + /* < 1 min seconds */ + s = H5_timer_get_time_string(3.14F); + if(NULL == s || HDstrcmp(s, "3.14 s") != 0) + TEST_ERROR; + HDfree(s); + + /* < 1 hr mins, secs */ + s = H5_timer_get_time_string(2521.0F); + if(NULL == s || HDstrcmp(s, "42 m 1 s") != 0) + TEST_ERROR; + HDfree(s); + + /* < 1 d hrs, mins, secs */ + s = H5_timer_get_time_string(9756.0F); + if(NULL == s || HDstrcmp(s, "2 h 42 m 36 s") != 0) + TEST_ERROR; + HDfree(s); + + /* > 1 d days, hrs, mins, secs */ + s = H5_timer_get_time_string(280802.0F); + if(NULL == s || HDstrcmp(s, "3 d 6 h 0 m 2 s") != 0) + TEST_ERROR; + HDfree(s); + + PASSED(); + return 0; + +error: + if(s) + HDfree(s); + return -1; + +} + + +/*------------------------------------------------------------------------- + * Function: test_timer_system_user + * + * Purpose: Tests the ability to get system and user times from the + * timers. + * Some platforms may require special code to get system and + * user times. If we do not support that particular platform + * dependent functionality, this test is skipped. + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Dana Robinson + * May 2011 + * + *------------------------------------------------------------------------- + */ +static herr_t +test_timer_system_user(void) +{ + int i; + char *buf = NULL; + H5_timer_t timer; + H5_timevals_t times; + herr_t err; + + TESTING("system/user times"); + + err = H5_timer_init(&timer); + if(err < 0) + TEST_ERROR; + + err = H5_timer_start(&timer); + if(err < 0) + TEST_ERROR; + + /* The system and user times may not be present on some systems. They + * will be -1.0 if they are not. + */ + if(timer.initial.system < (double)0.0f || timer.initial.user < (double)0.0f) { + SKIPPED(); + printf("NOTE: No suitable way to get system/user times on this platform.\n"); + return 0; + } + + /* Do some fake work */ + for(i=0; i < 1024; i++) { + buf = (char *)HDmalloc(1024 * (size_t)i); + HDfree(buf); + } + + err = H5_timer_stop(&timer); + if(err < 0) + TEST_ERROR; + + err = H5_timer_get_times(timer, ×); + if(err < 0) + TEST_ERROR; + + /* System and user times should be non-negative. */ + if(times.system < (double)0.0f || times.user < (double)0.0f) + TEST_ERROR; + + PASSED(); + return 0; + +error: + return -1; +} + + +/*------------------------------------------------------------------------- + * Function: test_timer_elapsed + * + * Purpose: Tests the ability to get elapsed times from the timers. + * We should always be able to get an elapsed time, + * regardless of the time libraries or platform. + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Dana Robinson + * May 2011 + * + *------------------------------------------------------------------------- + */ +static herr_t +test_timer_elapsed(void) +{ + int i; + char *buf = NULL; + H5_timer_t timer; + H5_timevals_t times; + herr_t err; + + TESTING("elapsed times"); + + err = H5_timer_init(&timer); + if(err < 0) + TEST_ERROR; + + err = H5_timer_start(&timer); + if(err < 0) + TEST_ERROR; + + /* Do some fake work */ + for(i=0; i < 1024; i++) { + buf = (char *)HDmalloc(1024 * (size_t)i); + HDfree(buf); + } + + err = H5_timer_stop(&timer); + if(err < 0) + TEST_ERROR; + + err = H5_timer_get_times(timer, ×); + if(err < 0) + TEST_ERROR; + + /* Elapsed time should be non-negative. */ + if(times.elapsed < (double)0.0f) + TEST_ERROR; + + PASSED(); + return 0; + +error: + return -1; +} + + + +static herr_t +test_timer_functionality(void) +{ + int i; + char *buf = NULL; + H5_timer_t timer; + + H5_timevals_t times; + double prev_etime; + double prev_total_etime; + + herr_t err; + + TESTING("timer functionality"); + + /***************** + * CHECK STARTUP * + *****************/ + + /* Timer should be running after start */ + err = H5_timer_init(&timer); + if(err < 0 || timer.is_running) + TEST_ERROR; + + /* Times should be initialized to zero */ + err = H5_timer_get_times(timer, ×); + if(err < 0 || !H5_DBL_ABS_EQUAL(times.elapsed, (double)0.0f)) + TEST_ERROR; + + err = H5_timer_get_total_times(timer, ×); + if(err < 0 || !H5_DBL_ABS_EQUAL(times.elapsed, (double)0.0f)) + TEST_ERROR; + + + /******************** + * CHECK START/STOP * + ********************/ + + /* Running state should change after start */ + err = H5_timer_start(&timer); + if(err < 0 || !timer.is_running) + TEST_ERROR; + + /* Do some fake work */ + for(i=0; i < 1024; i++) { + buf = (char *)HDmalloc(1024 * (size_t)i); + HDfree(buf); + } + + /* Running state should change after stop */ + err = H5_timer_stop(&timer); + if(err < 0 || timer.is_running) + TEST_ERROR; + + /* Times should be positive and non-negative */ + err = H5_timer_get_times(timer, ×); + if(err < 0 || times.elapsed < (double)0.0f) + TEST_ERROR; + + err = H5_timer_get_total_times(timer, ×); + if(err < 0 || times.elapsed < (double)0.0f) + TEST_ERROR; + + + /********************** + * CHECK INTERRUPTING * + **********************/ + + /* Timer should change stat and refresh to 0s */ + err = H5_timer_init(&timer); + if(err < 0 || timer.is_running) + TEST_ERROR; + + err = H5_timer_get_times(timer, ×); + if(err < 0 || !H5_DBL_ABS_EQUAL(times.elapsed, (double)0.0f)) + TEST_ERROR; + + err = H5_timer_get_total_times(timer, ×); + if(err < 0 || !H5_DBL_ABS_EQUAL(times.elapsed, (double)0.0f)) + TEST_ERROR; + + /* Timer state should flip */ + err = H5_timer_start(&timer); + if(err < 0 || !timer.is_running) + TEST_ERROR; + + /* Do some fake work */ + for(i=0; i < 1024; i++) { + buf = (char *)HDmalloc(1024 * (size_t)i); + HDfree(buf); + } + + /* Times should be non-negative */ + err = H5_timer_get_times(timer, ×); + if(err < 0 || times.elapsed < (double)0.0f) + TEST_ERROR; + prev_etime = times.elapsed; + + err = H5_timer_get_total_times(timer, ×); + if(err < 0 || times.elapsed < (double)0.0f) + TEST_ERROR; + prev_total_etime = times.elapsed; + + /* Do some fake work */ + for(i=0; i < 1024; i++) { + buf = (char *)HDmalloc(1024 * (size_t)i); + HDfree(buf); + } + + /* State should flip on stop */ + err = H5_timer_stop(&timer); + if(err < 0 || timer.is_running) + TEST_ERROR; + + /* Times should be >= than the cached intermediate times */ + err = H5_timer_get_times(timer, ×); + if(err < 0 || times.elapsed < prev_etime) + TEST_ERROR; + + err = H5_timer_get_total_times(timer, ×); + if(err < 0 || times.elapsed < prev_total_etime) + TEST_ERROR; + + + PASSED(); + return 0; + +error: + return -1; +} + + +/*------------------------------------------------------------------------- + * Function: main + * + * Purpose: Tests the basic functionality of the platform-independent + * timers + * + * Return: Success: 0 + * Failure: 1 + * + * Programmer: Dana Robinson + * May, 2011 + * + *------------------------------------------------------------------------- + */ +int +main(void) +{ + int nerrors = 0; + + h5_reset(); + + printf("Testing platform-independent timer functionality.\n"); + + nerrors += test_time_formatting() < 0 ? 1 : 0; + nerrors += test_timer_system_user() < 0 ? 1 : 0; + nerrors += test_timer_elapsed() < 0 ? 1 : 0; + nerrors += test_timer_functionality() < 0 ? 1 : 0; + + if(nerrors) { + printf("***** %d platform-independent timer TEST%s FAILED! *****\n", + nerrors, nerrors > 1 ? "S" : ""); + return 1; + } else { + printf("All platform-independent timer tests passed.\n"); + return 0; + } +} + diff --git a/test/trefer.c b/test/trefer.c index 12651c7..4bf5c17 100644 --- a/test/trefer.c +++ b/test/trefer.c @@ -23,6 +23,8 @@ #define FILE_REF_PARAM "trefer_param.h5" #define FILE_REF_OBJ "trefer_obj.h5" +#define FILE_REF_VL_OBJ "trefer_vl_obj.h5" +#define FILE_REF_CMPND_OBJ "trefer_cmpnd_obj.h5" #define FILE_REF_REG "trefer_reg.h5" #define FILE_REF_REG_1D "trefer_reg_1d.h5" #define FILE_REF_OBJ_DEL "trefer_obj_del.h5" @@ -55,6 +57,15 @@ typedef struct s1_t { float c; } s1_t; +/* Compound datatype with reference */ +typedef struct s2_t { + H5R_ref_t ref0; /* reference */ + H5R_ref_t ref1; /* reference */ + H5R_ref_t ref2; /* reference */ + H5R_ref_t ref3; /* reference */ + unsigned int dim_idx; /* dimension index of the dataset */ +} s2_t; + #define GROUPNAME "/group" #define GROUPNAME2 "group2" #define GROUPNAME3 "group3" @@ -86,12 +97,12 @@ test_reference_params(void) hid_t aapl_id; /* Attribute access property list */ hid_t dapl_id; /* Dataset access property list */ hsize_t dims1[] = {SPACE1_DIM1}; - H5R_ref_t *wbuf, /* buffer to write to disk */ + H5R_ref_t *wbuf, /* buffer to write to disk */ *rbuf, /* buffer read from disk */ *tbuf; /* temp. buffer read from disk */ unsigned *obuf; H5R_type_t type; /* Reference type */ - unsigned int i; /* Counters */ + unsigned int i; /* Counters */ const char *write_comment = "Foo!"; /* Comments for group */ hid_t ret_id; /* Generic hid_t return value */ ssize_t name_size; /* Size of reference name */ @@ -192,124 +203,626 @@ test_reference_params(void) CHECK(ret, FAIL, "H5Gclose"); /* Create a dataset */ - dataset = H5Dcreate2(fid1, "Dataset3", H5T_STD_REF, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - CHECK(ret, H5I_INVALID_HID, "H5Dcreate2"); + dataset = H5Dcreate2(fid1, "Dataset3", H5T_STD_REF, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(ret, H5I_INVALID_HID, "H5Dcreate2"); + + /* Test parameters to H5Rcreate_object */ + ret = H5Rcreate_object(fid1, "/Group1/Dataset1", H5P_DEFAULT, NULL); + VERIFY(ret, FAIL, "H5Rcreate_object ref"); + ret = H5Rcreate_object(H5I_INVALID_HID, "/Group1/Dataset1", H5P_DEFAULT, &wbuf[0]); + VERIFY(ret, FAIL, "H5Rcreate_object loc_id"); + ret = H5Rcreate_object(fid1, NULL, H5P_DEFAULT, &wbuf[0]); + VERIFY(ret, FAIL, "H5Rcreate_object name"); + ret = H5Rcreate_object(fid1, "", H5P_DEFAULT, &wbuf[0]); + VERIFY(ret, FAIL, "H5Rcreate_object null name"); + + /* Test parameters to H5Rcreate_region */ + ret = H5Rcreate_region(fid1, "/Group1/Dataset1", sid1, H5P_DEFAULT, NULL); + VERIFY(ret, FAIL, "H5Rcreate_region ref"); + ret = H5Rcreate_region(H5I_INVALID_HID, "/Group1/Dataset1", sid1, H5P_DEFAULT, &wbuf[0]); + VERIFY(ret, FAIL, "H5Rcreate_region loc_id"); + ret = H5Rcreate_region(fid1, NULL, sid1, H5P_DEFAULT, &wbuf[0]); + VERIFY(ret, FAIL, "H5Rcreate_region name"); + ret = H5Rcreate_region(fid1, "/Group1/Dataset1", H5I_INVALID_HID, H5P_DEFAULT, &wbuf[0]); + VERIFY(ret, FAIL, "H5Rcreate_region dataspace"); + + /* Test parameters to H5Rcreate_attr */ + ret = H5Rcreate_attr(fid1, "/Group1/Dataset2", "Attr", H5P_DEFAULT, NULL); + VERIFY(ret, FAIL, "H5Rcreate_attr ref"); + ret = H5Rcreate_attr(H5I_INVALID_HID, "/Group1/Dataset2", "Attr", H5P_DEFAULT, &wbuf[0]); + VERIFY(ret, FAIL, "H5Rcreate_attr loc_id"); + ret = H5Rcreate_attr(fid1, NULL, "Attr", H5P_DEFAULT, &wbuf[0]); + VERIFY(ret, FAIL, "H5Rcreate_attr name"); + ret = H5Rcreate_attr(fid1, "/Group1/Dataset2", NULL, H5P_DEFAULT, &wbuf[0]); + VERIFY(ret, FAIL, "H5Rcreate_attr attr_name"); + + /* Test parameters to H5Rdestroy */ + ret = H5Rdestroy(NULL); + VERIFY(ret, FAIL, "H5Rdestroy"); + + /* Test parameters to H5Rget_type */ + type = H5Rget_type(NULL); + VERIFY(type, H5R_BADTYPE, "H5Rget_type ref"); + + /* Test parameters to H5Requal */ + ret = H5Requal(NULL, &rbuf[0]); + VERIFY(ret, FAIL, "H5Requal ref1"); + ret = H5Requal(&rbuf[0], NULL); + VERIFY(ret, FAIL, "H5Requal ref2"); + + /* Test parameters to H5Rcopy */ + ret = H5Rcopy(NULL, &wbuf[0]); + VERIFY(ret, FAIL, "H5Rcopy src_ref"); + ret = H5Rcopy(&rbuf[0], NULL); + VERIFY(ret, FAIL, "H5Rcopy dest_ref"); + + /* Test parameters to H5Ropen_object */ + dset2 = H5Ropen_object(&rbuf[0], H5I_INVALID_HID, H5I_INVALID_HID); + VERIFY(dset2, H5I_INVALID_HID, "H5Ropen_object oapl_id"); + dset2 = H5Ropen_object(NULL, H5P_DEFAULT, dapl_id); + VERIFY(dset2, H5I_INVALID_HID, "H5Ropen_object ref"); + + /* Test parameters to H5Ropen_region */ + ret_id = H5Ropen_region(NULL, H5I_INVALID_HID, H5I_INVALID_HID); + VERIFY(ret_id, H5I_INVALID_HID, "H5Ropen_region ref"); + + /* Test parameters to H5Ropen_attr */ + ret_id = H5Ropen_attr(NULL, H5P_DEFAULT, aapl_id); + VERIFY(ret_id, H5I_INVALID_HID, "H5Ropen_attr ref"); + + /* Test parameters to H5Rget_obj_type3 */ + ret = H5Rget_obj_type3(NULL, H5P_DEFAULT, NULL); + VERIFY(ret, FAIL, "H5Rget_obj_type3 ref"); + + /* Test parameters to H5Rget_file_name */ + name_size = H5Rget_file_name(NULL, NULL, 0); + VERIFY(name_size, (-1), "H5Rget_file_name ref"); + + /* Test parameters to H5Rget_obj_name */ + name_size = H5Rget_obj_name(NULL, H5P_DEFAULT, NULL, 0); + VERIFY(name_size, (-1), "H5Rget_obj_name ref"); + + /* Test parameters to H5Rget_attr_name */ + name_size = H5Rget_attr_name(NULL, NULL, 0); + VERIFY(name_size, (-1), "H5Rget_attr_name ref"); + + /* Close disk dataspace */ + ret = H5Sclose(sid1); + CHECK(ret, FAIL, "H5Sclose"); + + /* Close dataset access property list */ + ret = H5Pclose(dapl_id); + CHECK(ret, FAIL, "H5Pclose"); + + /* Close attribute access property list */ + ret = H5Pclose(aapl_id); + CHECK(ret, FAIL, "H5Pclose"); + + /* Close Dataset */ + ret = H5Dclose(dataset); + CHECK(ret, FAIL, "H5Dclose"); + + /* Close file */ + ret = H5Fclose(fid1); + CHECK(ret, FAIL, "H5Fclose"); + + /* Free memory buffers */ + HDfree(wbuf); + HDfree(rbuf); + HDfree(tbuf); + HDfree(obuf); +} /* test_reference_params() */ + +/**************************************************************** +** +** test_reference_obj(): Test basic H5R (reference) object reference code. +** Tests references to various kinds of objects +** +****************************************************************/ +static void +test_reference_obj(void) +{ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset, /* Dataset ID */ + dset2; /* Dereferenced dataset ID */ + hid_t group; /* Group ID */ + hid_t sid1; /* Dataspace ID */ + hid_t tid1; /* Datatype ID */ + hsize_t dims1[] = {SPACE1_DIM1}; + hid_t dapl_id; /* Dataset access property list */ + H5R_ref_t *wbuf, /* buffer to write to disk */ + *rbuf; /* buffer read from disk */ + unsigned *ibuf, *obuf; + unsigned i, j; /* Counters */ + H5O_type_t obj_type; /* Object type */ + herr_t ret; /* Generic return value */ + + /* Output message about test being performed */ + MESSAGE(5, ("Testing Object Reference Functions\n")); + + /* Allocate write & read buffers */ + wbuf = HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1); + rbuf = HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1); + ibuf = HDcalloc(sizeof(unsigned), SPACE1_DIM1); + obuf = HDcalloc(sizeof(unsigned), SPACE1_DIM1); + + for (i = 0; i < SPACE1_DIM1; i++) + obuf[i] = i * 3; + + /* Create file */ + fid1 = H5Fcreate(FILE_REF_OBJ, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + CHECK(fid1, H5I_INVALID_HID, "H5Fcreate"); + + /* Create dataspace for datasets */ + sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL); + CHECK(sid1, H5I_INVALID_HID, "H5Screate_simple"); + + /* Create dataset access property list */ + dapl_id = H5Pcreate(H5P_DATASET_ACCESS); + CHECK(dapl_id, H5I_INVALID_HID, "H5Pcreate"); + + /* Create a group */ + group = H5Gcreate2(fid1, "Group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(group, H5I_INVALID_HID, "H5Gcreate2"); + + /* Create a dataset (inside Group1) */ + dataset = H5Dcreate2(group, "Dataset1", H5T_NATIVE_UINT, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(dataset, H5I_INVALID_HID, "H5Dcreate2"); + + /* Write selection to disk */ + ret = H5Dwrite(dataset, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, obuf); + CHECK(ret, FAIL, "H5Dwrite"); + + /* Close Dataset */ + ret = H5Dclose(dataset); + CHECK(ret, FAIL, "H5Dclose"); + + /* Create another dataset (inside Group1) */ + dataset = H5Dcreate2(group, "Dataset2", H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dcreate2"); + + /* Close Dataset */ + ret = H5Dclose(dataset); + CHECK(ret, FAIL, "H5Dclose"); + + /* Create a datatype to refer to */ + tid1 = H5Tcreate(H5T_COMPOUND, sizeof(s1_t)); + CHECK(tid1, H5I_INVALID_HID, "H5Tcreate"); + + /* Insert fields */ + ret = H5Tinsert(tid1, "a", HOFFSET(s1_t,a), H5T_NATIVE_INT); + CHECK(ret, FAIL, "H5Tinsert"); + + ret = H5Tinsert(tid1, "b", HOFFSET(s1_t,b), H5T_NATIVE_INT); + CHECK(ret, FAIL, "H5Tinsert"); + + ret = H5Tinsert(tid1, "c", HOFFSET(s1_t,c), H5T_NATIVE_FLOAT); + CHECK(ret, FAIL, "H5Tinsert"); + + /* Save datatype for later */ + ret = H5Tcommit2(group, "Datatype1", tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Tcommit2"); + + /* Close datatype */ + ret = H5Tclose(tid1); + CHECK(ret, FAIL, "H5Tclose"); + + /* Close group */ + ret = H5Gclose(group); + CHECK(ret, FAIL, "H5Gclose"); + + /* Create a dataset */ + dataset = H5Dcreate2(fid1, "Dataset3", H5T_STD_REF, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(dataset, H5I_INVALID_HID, "H5Dcreate2"); + + /* Create reference to dataset */ + ret = H5Rcreate_object(fid1, "/Group1/Dataset1", H5P_DEFAULT, &wbuf[0]); + CHECK(ret, FAIL, "H5Rcreate_object"); + ret = H5Rget_obj_type3(&wbuf[0], H5P_DEFAULT, &obj_type); + CHECK(ret, FAIL, "H5Rget_obj_type3"); + VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3"); + + /* Create reference to dataset */ + ret = H5Rcreate_object(fid1, "/Group1/Dataset2", H5P_DEFAULT, &wbuf[1]); + CHECK(ret, FAIL, "H5Rcreate_object"); + ret = H5Rget_obj_type3(&wbuf[1], H5P_DEFAULT, &obj_type); + CHECK(ret, FAIL, "H5Rget_obj_type3"); + VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3"); + + /* Create reference to group */ + ret = H5Rcreate_object(fid1, "/Group1", H5P_DEFAULT, &wbuf[2]); + CHECK(ret, FAIL, "H5Rcreate_object"); + ret = H5Rget_obj_type3(&wbuf[2], H5P_DEFAULT, &obj_type); + CHECK(ret, FAIL, "H5Rget_obj_type3"); + VERIFY(obj_type, H5O_TYPE_GROUP, "H5Rget_obj_type3"); + + /* Create reference to named datatype */ + ret = H5Rcreate_object(fid1, "/Group1/Datatype1", H5P_DEFAULT, &wbuf[3]); + CHECK(ret, FAIL, "H5Rcreate_object"); + ret = H5Rget_obj_type3(&wbuf[3], H5P_DEFAULT, &obj_type); + CHECK(ret, FAIL, "H5Rget_obj_type3"); + VERIFY(obj_type, H5O_TYPE_NAMED_DATATYPE, "H5Rget_obj_type3"); + + /* Write selection to disk */ + ret = H5Dwrite(dataset, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf); + CHECK(ret, FAIL, "H5Dwrite"); + + /* Close disk dataspace */ + ret = H5Sclose(sid1); + CHECK(ret, FAIL, "H5Sclose"); + + /* Close Dataset */ + ret = H5Dclose(dataset); + CHECK(ret, FAIL, "H5Dclose"); + + /* Close file */ + ret = H5Fclose(fid1); + CHECK(ret, FAIL, "H5Fclose"); + + /* Re-open the file */ + fid1 = H5Fopen(FILE_REF_OBJ, H5F_ACC_RDWR, H5P_DEFAULT); + CHECK(fid1, H5I_INVALID_HID, "H5Fopen"); + + /* Open the dataset */ + dataset = H5Dopen2(fid1, "/Dataset3", H5P_DEFAULT); + CHECK(dataset, H5I_INVALID_HID, "H5Dopen2"); + + /* Read selection from disk */ + ret = H5Dread(dataset, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf); + CHECK(ret, FAIL, "H5Dread"); + + /* Open dataset object */ + dset2 = H5Ropen_object(&rbuf[0], H5P_DEFAULT, dapl_id); + CHECK(dset2, H5I_INVALID_HID, "H5Ropen_object"); + + /* Check information in referenced dataset */ + sid1 = H5Dget_space(dset2); + CHECK(sid1, H5I_INVALID_HID, "H5Dget_space"); + + ret = (int)H5Sget_simple_extent_npoints(sid1); + VERIFY(ret, SPACE1_DIM1, "H5Sget_simple_extent_npoints"); + + /* Read from disk */ + ret = H5Dread(dset2, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, ibuf); + CHECK(ret, FAIL, "H5Dread"); + + for(i = 0; i < SPACE1_DIM1; i++) + VERIFY(ibuf[i], i * 3, "Data"); + + /* Close dereferenced Dataset */ + ret = H5Dclose(dset2); + CHECK(ret, FAIL, "H5Dclose"); + + /* Open group object. GAPL isn't supported yet. But it's harmless to pass in */ + group = H5Ropen_object(&rbuf[2], H5P_DEFAULT, H5P_DEFAULT); + CHECK(group, H5I_INVALID_HID, "H5Ropen_object"); + + /* Close group */ + ret = H5Gclose(group); + CHECK(ret, FAIL, "H5Gclose"); + + /* Open datatype object. TAPL isn't supported yet. But it's harmless to pass in */ + tid1 = H5Ropen_object(&rbuf[3], H5P_DEFAULT, H5P_DEFAULT); + CHECK(tid1, H5I_INVALID_HID, "H5Ropen_object"); + + /* Verify correct datatype */ + { + H5T_class_t tclass; + + tclass = H5Tget_class(tid1); + VERIFY(tclass, H5T_COMPOUND, "H5Tget_class"); + + ret= H5Tget_nmembers(tid1); + VERIFY(ret, 3, "H5Tget_nmembers"); + } + + /* Close datatype */ + ret = H5Tclose(tid1); + CHECK(ret, FAIL, "H5Tclose"); + + /* Close Dataset */ + ret = H5Dclose(dataset); + CHECK(ret, FAIL, "H5Dclose"); + + /* Close dataset access property list */ + ret = H5Pclose(dapl_id); + CHECK(ret, FAIL, "H5Pclose"); + + /* Close file */ + ret = H5Fclose(fid1); + CHECK(ret, FAIL, "H5Fclose"); + + /* Destroy references */ + for(j = 0; j < SPACE1_DIM1; j++) { + ret = H5Rdestroy(&wbuf[j]); + CHECK(ret, FAIL, "H5Rdestroy"); + ret = H5Rdestroy(&rbuf[j]); + CHECK(ret, FAIL, "H5Rdestroy"); + } + + /* Free memory buffers */ + HDfree(wbuf); + HDfree(rbuf); + HDfree(ibuf); + HDfree(obuf); +} /* test_reference_obj() */ + +/**************************************************************** +** +** test_reference_vlen_obj(): Test basic H5R (reference) object reference +** within a vlen type. +** Tests references to various kinds of objects +** +****************************************************************/ +static void +test_reference_vlen_obj(void) +{ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset, /* Dataset ID */ + dset2; /* Dereferenced dataset ID */ + hid_t group; /* Group ID */ + hid_t sid1; /* Dataspace ID */ + hid_t tid1; /* Datatype ID */ + hsize_t dims1[] = {SPACE1_DIM1}; + hsize_t vl_dims[] = {1}; + hid_t dapl_id; /* Dataset access property list */ + H5R_ref_t *wbuf, /* buffer to write to disk */ + *rbuf; /* buffer read from disk */ + unsigned *ibuf, *obuf; + unsigned i, j; /* Counters */ + H5O_type_t obj_type; /* Object type */ + herr_t ret; /* Generic return value */ + hvl_t vl_wbuf = {0, NULL}, vl_rbuf = {0, NULL}; + + /* Output message about test being performed */ + MESSAGE(5, ("Testing Object Reference Functions within VLEN type\n")); + + /* Allocate write & read buffers */ + wbuf = HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1); + rbuf = HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1); + ibuf = HDcalloc(sizeof(unsigned), SPACE1_DIM1); + obuf = HDcalloc(sizeof(unsigned), SPACE1_DIM1); + + for (i = 0; i < SPACE1_DIM1; i++) + obuf[i] = i * 3; + + /* Create file */ + fid1 = H5Fcreate(FILE_REF_VL_OBJ, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + CHECK(fid1, H5I_INVALID_HID, "H5Fcreate"); + + /* Create dataspace for datasets */ + sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL); + CHECK(sid1, H5I_INVALID_HID, "H5Screate_simple"); + + /* Create dataset access property list */ + dapl_id = H5Pcreate(H5P_DATASET_ACCESS); + CHECK(dapl_id, H5I_INVALID_HID, "H5Pcreate"); + + /* Create a group */ + group = H5Gcreate2(fid1, "Group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(group, H5I_INVALID_HID, "H5Gcreate2"); + + /* Create a dataset (inside Group1) */ + dataset = H5Dcreate2(group, "Dataset1", H5T_NATIVE_UINT, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(dataset, H5I_INVALID_HID, "H5Dcreate2"); + + /* Write selection to disk */ + ret = H5Dwrite(dataset, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, obuf); + CHECK(ret, FAIL, "H5Dwrite"); + + /* Close Dataset */ + ret = H5Dclose(dataset); + CHECK(ret, FAIL, "H5Dclose"); + + /* Create another dataset (inside Group1) */ + dataset = H5Dcreate2(group, "Dataset2", H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dcreate2"); + + /* Close Dataset */ + ret = H5Dclose(dataset); + CHECK(ret, FAIL, "H5Dclose"); + + /* Close disk dataspace */ + ret = H5Sclose(sid1); + CHECK(ret, FAIL, "H5Sclose"); + + /* Create a datatype to refer to */ + tid1 = H5Tcreate(H5T_COMPOUND, sizeof(s1_t)); + CHECK(tid1, H5I_INVALID_HID, "H5Tcreate"); + + /* Insert fields */ + ret = H5Tinsert(tid1, "a", HOFFSET(s1_t,a), H5T_NATIVE_INT); + CHECK(ret, FAIL, "H5Tinsert"); + + ret = H5Tinsert(tid1, "b", HOFFSET(s1_t,b), H5T_NATIVE_INT); + CHECK(ret, FAIL, "H5Tinsert"); + + ret = H5Tinsert(tid1, "c", HOFFSET(s1_t,c), H5T_NATIVE_FLOAT); + CHECK(ret, FAIL, "H5Tinsert"); + + /* Save datatype for later */ + ret = H5Tcommit2(group, "Datatype1", tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Tcommit2"); + + /* Close datatype */ + ret = H5Tclose(tid1); + CHECK(ret, FAIL, "H5Tclose"); + + /* Close group */ + ret = H5Gclose(group); + CHECK(ret, FAIL, "H5Gclose"); + + /* Create vlen type */ + tid1 = H5Tvlen_create(H5T_STD_REF); + CHECK(tid1, H5I_INVALID_HID, "H5Tvlen_create"); + + /* Create dataspace for datasets */ + sid1 = H5Screate_simple(SPACE1_RANK, vl_dims, NULL); + CHECK(sid1, H5I_INVALID_HID, "H5Screate_simple"); + + /* Create a dataset */ + dataset = H5Dcreate2(fid1, "Dataset3", tid1, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(dataset, H5I_INVALID_HID, "H5Dcreate2"); - /* Test parameters to H5Rcreate_object */ - ret = H5Rcreate_object(fid1, "/Group1/Dataset1", H5P_DEFAULT, NULL); - VERIFY(ret, FAIL, "H5Rcreate_object ref"); - ret = H5Rcreate_object(H5I_INVALID_HID, "/Group1/Dataset1", H5P_DEFAULT, &wbuf[0]); - VERIFY(ret, FAIL, "H5Rcreate_object loc_id"); - ret = H5Rcreate_object(fid1, NULL, H5P_DEFAULT, &wbuf[0]); - VERIFY(ret, FAIL, "H5Rcreate_object name"); - ret = H5Rcreate_object(fid1, "", H5P_DEFAULT, &wbuf[0]); - VERIFY(ret, FAIL, "H5Rcreate_object null name"); + /* Create reference to dataset */ + ret = H5Rcreate_object(fid1, "/Group1/Dataset1", H5P_DEFAULT, &wbuf[0]); + CHECK(ret, FAIL, "H5Rcreate_object"); + ret = H5Rget_obj_type3(&wbuf[0], H5P_DEFAULT, &obj_type); + CHECK(ret, FAIL, "H5Rget_obj_type3"); + VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3"); - /* Test parameters to H5Rcreate_region */ - ret = H5Rcreate_region(fid1, "/Group1/Dataset1", sid1, H5P_DEFAULT, NULL); - VERIFY(ret, FAIL, "H5Rcreate_region ref"); - ret = H5Rcreate_region(H5I_INVALID_HID, "/Group1/Dataset1", sid1, H5P_DEFAULT, &wbuf[0]); - VERIFY(ret, FAIL, "H5Rcreate_region loc_id"); - ret = H5Rcreate_region(fid1, NULL, sid1, H5P_DEFAULT, &wbuf[0]); - VERIFY(ret, FAIL, "H5Rcreate_region name"); - ret = H5Rcreate_region(fid1, "/Group1/Dataset1", H5I_INVALID_HID, H5P_DEFAULT, &wbuf[0]); - VERIFY(ret, FAIL, "H5Rcreate_region dataspace"); + /* Create reference to dataset */ + ret = H5Rcreate_object(fid1, "/Group1/Dataset2", H5P_DEFAULT, &wbuf[1]); + CHECK(ret, FAIL, "H5Rcreate_object"); + ret = H5Rget_obj_type3(&wbuf[1], H5P_DEFAULT, &obj_type); + CHECK(ret, FAIL, "H5Rget_obj_type3"); + VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3"); - /* Test parameters to H5Rcreate_attr */ - ret = H5Rcreate_attr(fid1, "/Group1/Dataset2", "Attr", H5P_DEFAULT, NULL); - VERIFY(ret, FAIL, "H5Rcreate_attr ref"); - ret = H5Rcreate_attr(H5I_INVALID_HID, "/Group1/Dataset2", "Attr", H5P_DEFAULT, &wbuf[0]); - VERIFY(ret, FAIL, "H5Rcreate_attr loc_id"); - ret = H5Rcreate_attr(fid1, NULL, "Attr", H5P_DEFAULT, &wbuf[0]); - VERIFY(ret, FAIL, "H5Rcreate_attr name"); - ret = H5Rcreate_attr(fid1, "/Group1/Dataset2", NULL, H5P_DEFAULT, &wbuf[0]); - VERIFY(ret, FAIL, "H5Rcreate_attr attr_name"); + /* Create reference to group */ + ret = H5Rcreate_object(fid1, "/Group1", H5P_DEFAULT, &wbuf[2]); + CHECK(ret, FAIL, "H5Rcreate_object"); + ret = H5Rget_obj_type3(&wbuf[2], H5P_DEFAULT, &obj_type); + CHECK(ret, FAIL, "H5Rget_obj_type3"); + VERIFY(obj_type, H5O_TYPE_GROUP, "H5Rget_obj_type3"); - /* Test parameters to H5Rdestroy */ - ret = H5Rdestroy(NULL); - VERIFY(ret, FAIL, "H5Rdestroy"); + /* Create reference to named datatype */ + ret = H5Rcreate_object(fid1, "/Group1/Datatype1", H5P_DEFAULT, &wbuf[3]); + CHECK(ret, FAIL, "H5Rcreate_object"); + ret = H5Rget_obj_type3(&wbuf[3], H5P_DEFAULT, &obj_type); + CHECK(ret, FAIL, "H5Rget_obj_type3"); + VERIFY(obj_type, H5O_TYPE_NAMED_DATATYPE, "H5Rget_obj_type3"); - /* Test parameters to H5Rget_type */ - type = H5Rget_type(NULL); - VERIFY(type, H5R_BADTYPE, "H5Rget_type ref"); + /* Store references into vlen */ + vl_wbuf.len = SPACE1_DIM1; + vl_wbuf.p = wbuf; - /* Test parameters to H5Requal */ - ret = H5Requal(NULL, &rbuf[0]); - VERIFY(ret, FAIL, "H5Requal ref1"); - ret = H5Requal(&rbuf[0], NULL); - VERIFY(ret, FAIL, "H5Requal ref2"); + /* Write selection to disk */ + ret = H5Dwrite(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, &vl_wbuf); + CHECK(ret, FAIL, "H5Dwrite"); - /* Test parameters to H5Rcopy */ - ret = H5Rcopy(NULL, &wbuf[0]); - VERIFY(ret, FAIL, "H5Rcopy src_ref"); - ret = H5Rcopy(&rbuf[0], NULL); - VERIFY(ret, FAIL, "H5Rcopy dest_ref"); + /* Close disk dataspace */ + ret = H5Sclose(sid1); + CHECK(ret, FAIL, "H5Sclose"); - /* Test parameters to H5Ropen_object */ - dset2 = H5Ropen_object(&rbuf[0], H5I_INVALID_HID, H5I_INVALID_HID); - VERIFY(dset2, H5I_INVALID_HID, "H5Ropen_object oapl_id"); - dset2 = H5Ropen_object(NULL, H5P_DEFAULT, dapl_id); - VERIFY(dset2, H5I_INVALID_HID, "H5Ropen_object ref"); + /* Close Dataset */ + ret = H5Dclose(dataset); + CHECK(ret, FAIL, "H5Dclose"); - /* Test parameters to H5Ropen_region */ - ret_id = H5Ropen_region(NULL, H5I_INVALID_HID, H5I_INVALID_HID); - VERIFY(ret_id, H5I_INVALID_HID, "H5Ropen_region ref"); + /* Close datatype */ + ret = H5Tclose(tid1); + CHECK(ret, FAIL, "H5Tclose"); - /* Test parameters to H5Ropen_attr */ - ret_id = H5Ropen_attr(NULL, H5P_DEFAULT, aapl_id); - VERIFY(ret_id, H5I_INVALID_HID, "H5Ropen_attr ref"); + /* Close file */ + ret = H5Fclose(fid1); + CHECK(ret, FAIL, "H5Fclose"); - /* Test parameters to H5Rget_obj_type3 */ - ret = H5Rget_obj_type3(NULL, H5P_DEFAULT, NULL); - VERIFY(ret, FAIL, "H5Rget_obj_type3 ref"); + /* Re-open the file */ + fid1 = H5Fopen(FILE_REF_VL_OBJ, H5F_ACC_RDWR, H5P_DEFAULT); + CHECK(fid1, H5I_INVALID_HID, "H5Fopen"); - /* Test parameters to H5Rget_file_name */ - name_size = H5Rget_file_name(NULL, NULL, 0); - VERIFY(name_size, (-1), "H5Rget_file_name ref"); + /* Open the dataset */ + dataset = H5Dopen2(fid1, "/Dataset3", H5P_DEFAULT); + CHECK(dataset, H5I_INVALID_HID, "H5Dopen2"); - /* Test parameters to H5Rget_obj_name */ - name_size = H5Rget_obj_name(NULL, H5P_DEFAULT, NULL, 0); - VERIFY(name_size, (-1), "H5Rget_obj_name ref"); + tid1 = H5Dget_type(dataset); + CHECK(tid1, H5I_INVALID_HID, "H5Dget_type"); - /* Test parameters to H5Rget_attr_name */ - name_size = H5Rget_attr_name(NULL, NULL, 0); - VERIFY(name_size, (-1), "H5Rget_attr_name ref"); + /* Read selection from disk */ + ret = H5Dread(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, &vl_rbuf); + CHECK(ret, FAIL, "H5Dread"); - /* Close disk dataspace */ - ret = H5Sclose(sid1); - CHECK(ret, FAIL, "H5Sclose"); + VERIFY(vl_rbuf.len, SPACE1_DIM1, "H5Dread"); + rbuf = vl_rbuf.p; - /* Close dataset access property list */ - ret = H5Pclose(dapl_id); - CHECK(ret, FAIL, "H5Pclose"); + /* Close datatype */ + ret = H5Tclose(tid1); + CHECK(ret, FAIL, "H5Tclose"); - /* Close attribute access property list */ - ret = H5Pclose(aapl_id); - CHECK(ret, FAIL, "H5Pclose"); + /* Open dataset object */ + dset2 = H5Ropen_object(&rbuf[0], H5P_DEFAULT, dapl_id); + CHECK(dset2, H5I_INVALID_HID, "H5Ropen_object"); + + /* Check information in referenced dataset */ + sid1 = H5Dget_space(dset2); + CHECK(sid1, H5I_INVALID_HID, "H5Dget_space"); + + ret = (int)H5Sget_simple_extent_npoints(sid1); + VERIFY(ret, SPACE1_DIM1, "H5Sget_simple_extent_npoints"); + + /* Read from disk */ + ret = H5Dread(dset2, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, ibuf); + CHECK(ret, FAIL, "H5Dread"); + + for(i = 0; i < SPACE1_DIM1; i++) + VERIFY(ibuf[i], i * 3, "Data"); + + /* Close dereferenced Dataset */ + ret = H5Dclose(dset2); + CHECK(ret, FAIL, "H5Dclose"); + + /* Open group object. GAPL isn't supported yet. But it's harmless to pass in */ + group = H5Ropen_object(&rbuf[2], H5P_DEFAULT, H5P_DEFAULT); + CHECK(group, H5I_INVALID_HID, "H5Ropen_object"); + + /* Close group */ + ret = H5Gclose(group); + CHECK(ret, FAIL, "H5Gclose"); + + /* Open datatype object. TAPL isn't supported yet. But it's harmless to pass in */ + tid1 = H5Ropen_object(&rbuf[3], H5P_DEFAULT, H5P_DEFAULT); + CHECK(tid1, H5I_INVALID_HID, "H5Ropen_object"); + + /* Verify correct datatype */ + { + H5T_class_t tclass; + + tclass = H5Tget_class(tid1); + VERIFY(tclass, H5T_COMPOUND, "H5Tget_class"); + + ret= H5Tget_nmembers(tid1); + VERIFY(ret, 3, "H5Tget_nmembers"); + } + + /* Close datatype */ + ret = H5Tclose(tid1); + CHECK(ret, FAIL, "H5Tclose"); /* Close Dataset */ ret = H5Dclose(dataset); CHECK(ret, FAIL, "H5Dclose"); + /* Close dataset access property list */ + ret = H5Pclose(dapl_id); + CHECK(ret, FAIL, "H5Pclose"); + /* Close file */ ret = H5Fclose(fid1); CHECK(ret, FAIL, "H5Fclose"); + /* Destroy references */ + for(j = 0; j < SPACE1_DIM1; j++) { + ret = H5Rdestroy(&wbuf[j]); + CHECK(ret, FAIL, "H5Rdestroy"); + ret = H5Rdestroy(&rbuf[j]); + CHECK(ret, FAIL, "H5Rdestroy"); + } + /* Free memory buffers */ HDfree(wbuf); HDfree(rbuf); - HDfree(tbuf); + HDfree(ibuf); HDfree(obuf); -} /* test_reference_params() */ +} /* test_reference_vlen_obj() */ /**************************************************************** ** -** test_reference_obj(): Test basic H5R (reference) object reference code. +** test_reference_cmpnd_obj(): Test basic H5R (reference) object reference +** within a compound type. ** Tests references to various kinds of objects ** ****************************************************************/ static void -test_reference_obj(void) +test_reference_cmpnd_obj(void) { hid_t fid1; /* HDF5 File IDs */ hid_t dataset, /* Dataset ID */ @@ -318,6 +831,7 @@ test_reference_obj(void) hid_t sid1; /* Dataspace ID */ hid_t tid1; /* Datatype ID */ hsize_t dims1[] = {SPACE1_DIM1}; + hsize_t cmpnd_dims[] = {1}; hid_t dapl_id; /* Dataset access property list */ H5R_ref_t *wbuf, /* buffer to write to disk */ *rbuf; /* buffer read from disk */ @@ -325,9 +839,10 @@ test_reference_obj(void) unsigned i, j; /* Counters */ H5O_type_t obj_type; /* Object type */ herr_t ret; /* Generic return value */ + s2_t cmpnd_wbuf, cmpnd_rbuf; /* Output message about test being performed */ - MESSAGE(5, ("Testing Object Reference Functions\n")); + MESSAGE(5, ("Testing Object Reference Functions within compound type\n")); /* Allocate write & read buffers */ wbuf = HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1); @@ -339,7 +854,7 @@ test_reference_obj(void) obuf[i] = i * 3; /* Create file */ - fid1 = H5Fcreate(FILE_REF_OBJ, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + fid1 = H5Fcreate(FILE_REF_CMPND_OBJ, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); CHECK(fid1, H5I_INVALID_HID, "H5Fcreate"); /* Create dataspace for datasets */ @@ -374,6 +889,10 @@ test_reference_obj(void) ret = H5Dclose(dataset); CHECK(ret, FAIL, "H5Dclose"); + /* Close disk dataspace */ + ret = H5Sclose(sid1); + CHECK(ret, FAIL, "H5Sclose"); + /* Create a datatype to refer to */ tid1 = H5Tcreate(H5T_COMPOUND, sizeof(s1_t)); CHECK(tid1, H5I_INVALID_HID, "H5Tcreate"); @@ -400,8 +919,32 @@ test_reference_obj(void) ret = H5Gclose(group); CHECK(ret, FAIL, "H5Gclose"); + /* Create compound type */ + tid1 = H5Tcreate(H5T_COMPOUND, sizeof(s2_t)); + CHECK(tid1, H5I_INVALID_HID, "H5Tcreate"); + + /* Insert fields */ + ret = H5Tinsert(tid1, "ref0", HOFFSET(s2_t, ref0), H5T_STD_REF); + CHECK(ret, FAIL, "H5Tinsert"); + + ret = H5Tinsert(tid1, "ref1", HOFFSET(s2_t, ref1), H5T_STD_REF); + CHECK(ret, FAIL, "H5Tinsert"); + + ret = H5Tinsert(tid1, "ref2", HOFFSET(s2_t, ref2), H5T_STD_REF); + CHECK(ret, FAIL, "H5Tinsert"); + + ret = H5Tinsert(tid1, "ref3", HOFFSET(s2_t, ref3), H5T_STD_REF); + CHECK(ret, FAIL, "H5Tinsert"); + + ret = H5Tinsert(tid1, "dim_idx", HOFFSET(s2_t, dim_idx), H5T_NATIVE_INT); + CHECK(ret, FAIL, "H5Tinsert"); + + /* Create dataspace for datasets */ + sid1 = H5Screate_simple(SPACE1_RANK, cmpnd_dims, NULL); + CHECK(sid1, H5I_INVALID_HID, "H5Screate_simple"); + /* Create a dataset */ - dataset = H5Dcreate2(fid1, "Dataset3", H5T_STD_REF, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + dataset = H5Dcreate2(fid1, "Dataset3", tid1, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); CHECK(dataset, H5I_INVALID_HID, "H5Dcreate2"); /* Create reference to dataset */ @@ -432,8 +975,15 @@ test_reference_obj(void) CHECK(ret, FAIL, "H5Rget_obj_type3"); VERIFY(obj_type, H5O_TYPE_NAMED_DATATYPE, "H5Rget_obj_type3"); + /* Store dimensions */ + cmpnd_wbuf.ref0 = wbuf[0]; + cmpnd_wbuf.ref1 = wbuf[1]; + cmpnd_wbuf.ref2 = wbuf[2]; + cmpnd_wbuf.ref3 = wbuf[3]; + cmpnd_wbuf.dim_idx = SPACE1_DIM1; + /* Write selection to disk */ - ret = H5Dwrite(dataset, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf); + ret = H5Dwrite(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, &cmpnd_wbuf); CHECK(ret, FAIL, "H5Dwrite"); /* Close disk dataspace */ @@ -444,22 +994,39 @@ test_reference_obj(void) ret = H5Dclose(dataset); CHECK(ret, FAIL, "H5Dclose"); + /* Close datatype */ + ret = H5Tclose(tid1); + CHECK(ret, FAIL, "H5Tclose"); + /* Close file */ ret = H5Fclose(fid1); CHECK(ret, FAIL, "H5Fclose"); /* Re-open the file */ - fid1 = H5Fopen(FILE_REF_OBJ, H5F_ACC_RDWR, H5P_DEFAULT); + fid1 = H5Fopen(FILE_REF_CMPND_OBJ, H5F_ACC_RDWR, H5P_DEFAULT); CHECK(fid1, H5I_INVALID_HID, "H5Fopen"); /* Open the dataset */ dataset = H5Dopen2(fid1, "/Dataset3", H5P_DEFAULT); CHECK(dataset, H5I_INVALID_HID, "H5Dopen2"); + tid1 = H5Dget_type(dataset); + CHECK(tid1, H5I_INVALID_HID, "H5Dget_type"); + /* Read selection from disk */ - ret = H5Dread(dataset, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf); + ret = H5Dread(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, &cmpnd_rbuf); CHECK(ret, FAIL, "H5Dread"); + VERIFY(cmpnd_rbuf.dim_idx, SPACE1_DIM1, "H5Dread"); + rbuf[0] = cmpnd_rbuf.ref0; + rbuf[1] = cmpnd_rbuf.ref1; + rbuf[2] = cmpnd_rbuf.ref2; + rbuf[3] = cmpnd_rbuf.ref3; + + /* Close datatype */ + ret = H5Tclose(tid1); + CHECK(ret, FAIL, "H5Tclose"); + /* Open dataset object */ dset2 = H5Ropen_object(&rbuf[0], H5P_DEFAULT, dapl_id); CHECK(dset2, H5I_INVALID_HID, "H5Ropen_object"); @@ -525,6 +1092,8 @@ test_reference_obj(void) for(j = 0; j < SPACE1_DIM1; j++) { ret = H5Rdestroy(&wbuf[j]); CHECK(ret, FAIL, "H5Rdestroy"); + } + for(j = 0; j < SPACE1_DIM1; j++) { ret = H5Rdestroy(&rbuf[j]); CHECK(ret, FAIL, "H5Rdestroy"); } @@ -534,7 +1103,7 @@ test_reference_obj(void) HDfree(rbuf); HDfree(ibuf); HDfree(obuf); -} /* test_reference_obj() */ +} /* test_reference_cmpnd_obj() */ /**************************************************************** ** @@ -566,11 +1135,11 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high) hsize_t *coords; /* Coordinate buffer */ hsize_t low[SPACE2_RANK]; /* Selection bounds */ hsize_t high[SPACE2_RANK]; /* Selection bounds */ - H5R_ref_t *wbuf, /* buffer to write to disk */ - *rbuf; /* buffer read from disk */ + H5R_ref_t *wbuf = NULL, /* buffer to write to disk */ + *rbuf = NULL; /* buffer read from disk */ H5R_ref_t nvrbuf[3]={{{{0}}},{{{101}}},{{{255}}}}; /* buffer with non-valid refs */ - uint8_t *dwbuf, /* Buffer for writing numeric data to disk */ - *drbuf; /* Buffer for reading numeric data from disk */ + uint8_t *dwbuf = NULL, /* Buffer for writing numeric data to disk */ + *drbuf = NULL; /* Buffer for reading numeric data from disk */ uint8_t *tu8; /* Temporary pointer to uint8 data */ H5O_type_t obj_type; /* Type of object */ int i, j; /* Counters */ @@ -968,13 +1537,14 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high) CHECK(ret, FAIL, "H5Rdestroy"); } - /* Free memory buffers */ - HDfree(wbuf); - HDfree(rbuf); - HDfree(dwbuf); - HDfree(drbuf); - } + + /* Free memory buffers */ + HDfree(wbuf); + HDfree(rbuf); + HDfree(dwbuf); + HDfree(drbuf); + } /* test_reference_region() */ /**************************************************************** @@ -1007,10 +1577,10 @@ test_reference_region_1D(H5F_libver_t libver_low, H5F_libver_t libver_high) hsize_t *coords; /* Coordinate buffer */ hsize_t low[SPACE3_RANK]; /* Selection bounds */ hsize_t high[SPACE3_RANK]; /* Selection bounds */ - H5R_ref_t *wbuf, /* buffer to write to disk */ - *rbuf; /* buffer read from disk */ - uint8_t *dwbuf, /* Buffer for writing numeric data to disk */ - *drbuf; /* Buffer for reading numeric data from disk */ + H5R_ref_t *wbuf = NULL, /* buffer to write to disk */ + *rbuf = NULL; /* buffer read from disk */ + uint8_t *dwbuf = NULL, /* Buffer for writing numeric data to disk */ + *drbuf = NULL; /* Buffer for reading numeric data from disk */ uint8_t *tu8; /* Temporary pointer to uint8 data */ H5O_type_t obj_type; /* Object type */ int i; /* Counter */ @@ -1307,13 +1877,14 @@ test_reference_region_1D(H5F_libver_t libver_low, H5F_libver_t libver_high) CHECK(ret, FAIL, "H5Rdestroy"); } - /* Free memory buffers */ - HDfree(wbuf); - HDfree(rbuf); - HDfree(dwbuf); - HDfree(drbuf); - } + + /* Free memory buffers */ + HDfree(wbuf); + HDfree(rbuf); + HDfree(dwbuf); + HDfree(drbuf); + } /* test_reference_region_1D() */ /**************************************************************** @@ -2149,10 +2720,10 @@ test_reference_compat_conv(void) hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */ hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */ hsize_t coord1[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */ - hobj_ref_t *wbuf_obj; /* Buffer to write to disk */ - H5R_ref_t *rbuf_obj; /* Buffer read from disk */ - hdset_reg_ref_t *wbuf_reg; /* Buffer to write to disk */ - H5R_ref_t *rbuf_reg; /* Buffer read from disk */ + hobj_ref_t *wbuf_obj = NULL; /* Buffer to write to disk */ + H5R_ref_t *rbuf_obj = NULL; /* Buffer read from disk */ + hdset_reg_ref_t *wbuf_reg = NULL; /* Buffer to write to disk */ + H5R_ref_t *rbuf_reg = NULL; /* Buffer read from disk */ H5O_type_t obj_type; /* Object type */ herr_t ret; /* Generic return value */ unsigned int i; /* Counter */ @@ -2862,6 +3433,8 @@ test_reference(void) test_reference_params(); /* Test for correct parameter checking */ test_reference_obj(); /* Test basic H5R object reference code */ + test_reference_vlen_obj(); /* Test reference within vlen */ + test_reference_cmpnd_obj(); /* Test reference within compound type */ /* Loop through all the combinations of low/high version bounds */ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) { @@ -2907,6 +3480,8 @@ cleanup_reference(void) { HDremove(FILE_REF_PARAM); HDremove(FILE_REF_OBJ); + HDremove(FILE_REF_VL_OBJ); + HDremove(FILE_REF_CMPND_OBJ); HDremove(FILE_REF_REG); HDremove(FILE_REF_REG_1D); HDremove(FILE_REF_OBJ_DEL); diff --git a/test/tselect.c b/test/tselect.c index aa0ab11..c98db5d 100644 --- a/test/tselect.c +++ b/test/tselect.c @@ -15442,14 +15442,14 @@ test_hyper_io_1d(void) /* Get the dataset's dataspace */ sid = H5Dget_space(did); - CHECK(sid, H5I_INVALID_HID, "H5Pcreate"); + CHECK(sid, H5I_INVALID_HID, "H5Dget_space"); ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, offset, stride, count, block); CHECK(ret, FAIL, "H5Sselect_hyperslab"); /* Set up contiguous memory dataspace for the selected elements */ dimsm[0] = count[0]; mid = H5Screate_simple(RANK, dimsm, NULL); - CHECK(mid, H5I_INVALID_HID, "H5Screate"); + CHECK(mid, H5I_INVALID_HID, "H5Screate_simple"); /* Read all the selected 10th elements in the dataset into "rdata" */ ret = H5Dread(did, H5T_NATIVE_INT, mid, sid, H5P_DEFAULT, rdata); @@ -15476,6 +15476,77 @@ test_hyper_io_1d(void) /**************************************************************** ** +** test_h5s_set_extent_none: +** Test to verify the behavior of dataspace code when passed +** a dataspace modified by H5Sset_extent_none(). +** +****************************************************************/ +static void +test_h5s_set_extent_none(void) +{ + hid_t sid = H5I_INVALID_HID; + hid_t dst_sid = H5I_INVALID_HID; + hid_t null_sid = H5I_INVALID_HID; + int rank = 1; + hsize_t current_dims = 123; + H5S_class_t cls; + int out_rank; + hsize_t out_dims; + hsize_t out_maxdims; + hssize_t out_points; + htri_t equal; + herr_t ret; + + /* Specific values here don't matter as we're just going to reset */ + sid = H5Screate_simple(rank, ¤t_dims, NULL); + CHECK(sid, H5I_INVALID_HID, "H5Screate_simple"); + + /* Dataspace class will be H5S_NULL after this. + * In versions prior to 1.10.7 / 1.12.1 this would produce a + * dataspace with the internal H5S_NO_CLASS class. + */ + ret = H5Sset_extent_none(sid); + CHECK(ret, FAIL, "H5Sset_extent_none"); + cls = H5Sget_simple_extent_type(sid); + VERIFY(cls, H5S_NULL, "H5Sget_simple_extent_type"); + + /* Extent getters should generate normal results and not segfault. + */ + out_rank = H5Sget_simple_extent_dims(sid, &out_dims, &out_maxdims); + VERIFY(out_rank, 0, "H5Sget_simple_extent_dims"); + out_rank = H5Sget_simple_extent_ndims(sid); + VERIFY(out_rank, 0, "H5Sget_simple_extent_ndims"); + out_points = H5Sget_simple_extent_npoints(sid); + VERIFY(out_points, 0, "H5Sget_simple_extent_npoints"); + + /* Check that copying the new (non-)extent works. + */ + dst_sid = H5Screate_simple(rank, ¤t_dims, NULL); + CHECK(dst_sid, H5I_INVALID_HID, "H5Screate_simple"); + ret = H5Sextent_copy(dst_sid, sid); + CHECK(ret, FAIL, "H5Sextent_copy"); + + /* Check that H5Sset_extent_none() produces the same extent as + * H5Screate(H5S_NULL). + */ + null_sid = H5Screate(H5S_NULL); + CHECK(null_sid, H5I_INVALID_HID, "H5Screate"); + equal = H5Sextent_equal(sid, null_sid); + VERIFY(equal, TRUE, "H5Sextent_equal"); + + /* Close */ + ret = H5Sclose(sid); + CHECK(ret, FAIL, "H5Sclose"); + ret = H5Sclose(dst_sid); + CHECK(ret, FAIL, "H5Sclose"); + ret = H5Sclose(null_sid); + CHECK(ret, FAIL, "H5Sclose"); + +} /* test_h5s_set_extent_none() */ + + +/**************************************************************** +** ** test_select(): Main H5S selection testing routine. ** ****************************************************************/ @@ -15660,6 +15731,11 @@ test_select(void) /* Test reading of 1-d disjoint file space to 1-d single block memory space */ test_hyper_io_1d(); + /* Test H5Sset_extent_none() functionality after we updated it to set + * the class to H5S_NULL instead of H5S_NO_CLASS. + */ + test_h5s_set_extent_none(); + } /* test_select() */ diff --git a/test/ttsafe.c b/test/ttsafe.c index e6edd9a..2de460b 100644 --- a/test/ttsafe.c +++ b/test/ttsafe.c @@ -111,6 +111,7 @@ int main(int argc, char *argv[]) AddTest("cancel", tts_cancel, cleanup_cancel, "thread cancellation safety test", NULL); #endif /* H5_HAVE_PTHREAD_H */ AddTest("acreate", tts_acreate, cleanup_acreate, "multi-attribute creation", NULL); + AddTest("attr_vlen", tts_attr_vlen, cleanup_attr_vlen, "multi-file-attribute-vlen read", NULL); #else /* H5_HAVE_THREADSAFE */ diff --git a/test/ttsafe.h b/test/ttsafe.h index c29fadc..f1cbe4d 100644 --- a/test/ttsafe.h +++ b/test/ttsafe.h @@ -35,12 +35,14 @@ void tts_dcreate(void); void tts_error(void); void tts_cancel(void); void tts_acreate(void); +void tts_attr_vlen(void); /* Prototypes for the cleanup routines */ void cleanup_dcreate(void); void cleanup_error(void); void cleanup_cancel(void); void cleanup_acreate(void); +void cleanup_attr_vlen(void); #endif /* H5_HAVE_THREADSAFE */ #endif /* TTSAFE_H */ diff --git a/test/ttsafe_attr_vlen.c b/test/ttsafe_attr_vlen.c new file mode 100644 index 0000000..43a5e9a --- /dev/null +++ b/test/ttsafe_attr_vlen.c @@ -0,0 +1,177 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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 COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/******************************************************************** + * + * Testing for thread safety in H5A library operations. + * ------------------------------------------------------------------ + * + * Purpose: Verify that the segmentation fault described in HDFFV-11080 + * is fixed. + * + * This test simulates what the user did to trigger the error: + * --Create an HDF5 file + * --Create an attribute with variable length string datatype + * --Attach the attribute to a group + * --Write data to the attribute + * --Close the file + * --Create NUM_THREADS threads + * --For each thread: + * --Open the test file + * --Open and read the attribute for each opened file + * + * The cause of the problem in this jira issue is due to the file pointer + * that is set in the variable length string datatype for the attribute. + * That file pointer is already closed and therefore needs to be set to + * the current opened file pointer when the attribute is accessed. + * Similar patch up was done before when reading dataset in H5D__read() + * in src/H5Aint.c. + * Hopefully this kind of patch can go away when we resolve the + * shared file pointer issue. + * + ********************************************************************/ + +#include "ttsafe.h" + +#ifdef H5_HAVE_THREADSAFE + +#define FILENAME "ttsafe_attr_vlen.h5" +#define ATTR_NAME "root_attr" +#define NUM_THREADS 32 + +void *tts_attr_vlen_thread(void *); + +void +tts_attr_vlen(void) +{ + H5TS_thread_t threads[NUM_THREADS] = {0}; /* Thread declaration */ + hid_t fid = H5I_INVALID_HID; /* File ID */ + hid_t gid = H5I_INVALID_HID; /* Group ID */ + hid_t atid = H5I_INVALID_HID; /* Datatype ID for attribute */ + hid_t asid = H5I_INVALID_HID; /* Dataspace ID for attribute */ + hid_t aid = H5I_INVALID_HID; /* The attribute ID */ + const char *string_attr = "2.0"; /* The attribute data */ + int ret; /* Return value */ + int i; /* Local index variable */ + + /* Create the HDF5 test file */ + fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + CHECK(fid, H5I_INVALID_HID, "H5Fcreate"); + + /* Create variable length string type for attribute */ + atid = H5Tcopy(H5T_C_S1); + CHECK(atid, H5I_INVALID_HID, "H5Tcopy"); + H5Tset_size(atid, H5T_VARIABLE); + + /* Create dataspace for attribute */ + asid = H5Screate(H5S_SCALAR); + CHECK(asid, H5I_INVALID_HID, "H5Screate"); + + /* Open the root group */ + gid = H5Gopen2(fid, "/", H5P_DEFAULT); + CHECK(gid, H5I_INVALID_HID, "H5Gopen2"); + + /* Attach the attribute to the root group */ + aid = H5Acreate2(gid, ATTR_NAME, atid, asid, H5P_DEFAULT, H5P_DEFAULT); + CHECK(aid, H5I_INVALID_HID, "H5Acreate2"); + + /* Write data to the attribute */ + ret = H5Awrite(aid, atid, &string_attr); + CHECK(ret, H5I_INVALID_HID, "H5Awrite"); + + /* Close IDs */ + ret = H5Sclose(asid); + CHECK(ret, H5I_INVALID_HID, "H5Sclose"); + + ret = H5Aclose(aid); + CHECK(ret, H5I_INVALID_HID, "H5Aclose"); + + ret = H5Gclose(gid); + CHECK(ret, H5I_INVALID_HID, "H5Gclose"); + + ret = H5Fclose(fid); + CHECK(ret, H5I_INVALID_HID, "H5Fclose"); + + ret = H5Tclose(atid); + CHECK(ret, H5I_INVALID_HID, "H5Tclose"); + + /* Start multiple threads and execute tts_attr_vlen_thread() for each thread */ + for(i = 0; i < NUM_THREADS; i++) { + threads[i] = H5TS_create_thread(tts_attr_vlen_thread, NULL, NULL); + } + + /* Wait for the threads to end */ + for(i = 0; i < NUM_THREADS; i++) + H5TS_wait_for_thread(threads[i]); + +} /* end tts_attr_vlen() */ + +/* Start execution for each thread */ +void * +tts_attr_vlen_thread(void H5_ATTR_UNUSED *client_data) +{ + hid_t fid = H5I_INVALID_HID; /* File ID */ + hid_t gid = H5I_INVALID_HID; /* Group ID */ + hid_t aid = H5I_INVALID_HID; /* Attribute ID */ + hid_t atid = H5I_INVALID_HID; /* Datatype ID for the attribute */ + char *string_attr_check; /* The attribute data being read */ + const char *string_attr = "2.0"; /* The expected attribute data */ + herr_t ret; /* Return value */ + + /* Open the test file */ + fid = H5Fopen(FILENAME, H5F_ACC_RDONLY, H5P_DEFAULT); + CHECK(fid, H5I_INVALID_HID, "H5Fopen"); + + /* Open the group */ + gid = H5Gopen2(fid, "/", H5P_DEFAULT); + CHECK(gid, H5I_INVALID_HID, "H5Gopen"); + + /* Open the attribte */ + aid = H5Aopen(gid, "root_attr", H5P_DEFAULT); + CHECK(aid, H5I_INVALID_HID, "H5Aopen"); + + /* Get the attribute datatype */ + atid = H5Aget_type(aid); + CHECK(atid, H5I_INVALID_HID, "H5Aget_type"); + + /* Read the attribute */ + ret = H5Aread(aid, atid, &string_attr_check); + CHECK(ret, FAIL, "H5Aclose"); + + /* Verify the attribute data is as expected */ + VERIFY_STR(string_attr_check, string_attr, "H5Aread"); + + /* Close IDs */ + ret = H5Aclose(aid); + CHECK(ret, FAIL, "H5Aclose"); + + ret = H5Gclose(gid); + CHECK(ret, FAIL, "H5Aclose"); + + ret = H5Fclose(fid); + CHECK(ret, FAIL, "H5Aclose"); + + ret = H5Tclose(atid); + CHECK(ret, FAIL, "H5Aclose"); + + return NULL; +} /* end tts_attr_vlen_thread() */ + +void +cleanup_attr_vlen(void) +{ + HDunlink(FILENAME); +} + +#endif /*H5_HAVE_THREADSAFE*/ + diff --git a/test/unlink.c b/test/unlink.c index 48dd79d..f45d7d7 100644 --- a/test/unlink.c +++ b/test/unlink.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, September 25, 1998 * * Purpose: Test unlinking operations. diff --git a/test/vds.c b/test/vds.c index c4d1391..816acf9 100644 --- a/test/vds.c +++ b/test/vds.c @@ -11,7 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Neil Fortner + * Programmer: Neil Fortner * Monday, February 16, 2015 * * Purpose: Tests datasets with virtual layout. diff --git a/test/vds_env.c b/test/vds_env.c index 3d5b5dd..0d0891f 100644 --- a/test/vds_env.c +++ b/test/vds_env.c @@ -11,7 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Neil Fortner + * Programmer: Neil Fortner * Monday, February 16, 2015 * * Purpose: Tests datasets with virtual layout. diff --git a/test/vds_swmr.h b/test/vds_swmr.h index edb01bc..0a194ff 100644 --- a/test/vds_swmr.h +++ b/test/vds_swmr.h @@ -95,7 +95,5 @@ H5TEST_DLLVAR char VDS_FILE_NAME[NAME_LEN]; /* Dataset names */ H5TEST_DLLVAR char SOURCE_DSET_PATH[NAME_LEN]; H5TEST_DLLVAR char VDS_DSET_NAME[NAME_LEN]; - -/* Fill values */ #endif /* VDS_SWMR_H */ diff --git a/test/vfd.c b/test/vfd.c index bffc937..8b59341 100644 --- a/test/vfd.c +++ b/test/vfd.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Tuesday, Sept 24, 2002 * * Purpose: Tests the basic features of Virtual File Drivers @@ -2258,46 +2258,51 @@ static int compare_splitter_config_info(hid_t fapl_id, H5FD_splitter_vfd_config_t *info) { int ret_value = 0; - H5FD_splitter_vfd_config_t fetched_info; + H5FD_splitter_vfd_config_t *fetched_info = NULL; + + if (NULL == (fetched_info = HDcalloc(1, sizeof(H5FD_splitter_vfd_config_t)))) + SPLITTER_TEST_FAULT("memory allocation for fetched_info struct failed"); - fetched_info.magic = H5FD_SPLITTER_MAGIC; - fetched_info.version = H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION; - fetched_info.rw_fapl_id = H5I_INVALID_HID; - fetched_info.wo_fapl_id = H5I_INVALID_HID; + fetched_info->magic = H5FD_SPLITTER_MAGIC; + fetched_info->version = H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION; + fetched_info->rw_fapl_id = H5I_INVALID_HID; + fetched_info->wo_fapl_id = H5I_INVALID_HID; - if (H5Pget_fapl_splitter(fapl_id, &fetched_info) < 0) { - SPLITTER_TEST_FAULT("can't get splitter info\n"); + if (H5Pget_fapl_splitter(fapl_id, fetched_info) < 0) { + SPLITTER_TEST_FAULT("can't get splitter info"); } if (info->rw_fapl_id == H5P_DEFAULT) { - if (H5Pget_driver(fetched_info.rw_fapl_id) != H5Pget_driver(H5P_FILE_ACCESS_DEFAULT)) { + if (H5Pget_driver(fetched_info->rw_fapl_id) != H5Pget_driver(H5P_FILE_ACCESS_DEFAULT)) { SPLITTER_TEST_FAULT("Read-Write driver mismatch (default)\n"); } } else { - if (H5Pget_driver(fetched_info.rw_fapl_id) != H5Pget_driver(info->rw_fapl_id)) { + if (H5Pget_driver(fetched_info->rw_fapl_id) != H5Pget_driver(info->rw_fapl_id)) { SPLITTER_TEST_FAULT("Read-Write driver mismatch\n"); } } if (info->wo_fapl_id == H5P_DEFAULT) { - if (H5Pget_driver(fetched_info.wo_fapl_id) != H5Pget_driver(H5P_FILE_ACCESS_DEFAULT)) { + if (H5Pget_driver(fetched_info->wo_fapl_id) != H5Pget_driver(H5P_FILE_ACCESS_DEFAULT)) { SPLITTER_TEST_FAULT("Write-Only driver mismatch (default)\n"); } } else { - if (H5Pget_driver(fetched_info.wo_fapl_id) != H5Pget_driver(info->wo_fapl_id)) { + if (H5Pget_driver(fetched_info->wo_fapl_id) != H5Pget_driver(info->wo_fapl_id)) { SPLITTER_TEST_FAULT("Write-Only driver mismatch\n"); } } - if ( (HDstrlen(info->wo_path) != HDstrlen(fetched_info.wo_path)) || - HDstrncmp(info->wo_path, fetched_info.wo_path, H5FD_SPLITTER_PATH_MAX)) + if ( (HDstrlen(info->wo_path) != HDstrlen(fetched_info->wo_path)) || + HDstrncmp(info->wo_path, fetched_info->wo_path, H5FD_SPLITTER_PATH_MAX)) { - HDfprintf(stderr, "MISMATCH: '%s' :: '%s'\n", info->wo_path, fetched_info.wo_path); + HDfprintf(stderr, "MISMATCH: '%s' :: '%s'\n", info->wo_path, fetched_info->wo_path); HEXPRINT(H5FD_SPLITTER_PATH_MAX, info->wo_path); - HEXPRINT(H5FD_SPLITTER_PATH_MAX, fetched_info.wo_path); + HEXPRINT(H5FD_SPLITTER_PATH_MAX, fetched_info->wo_path); SPLITTER_TEST_FAULT("Write-Only file path mismatch\n"); } done: + HDfree(fetched_info); + return ret_value; } /* end compare_splitter_config_info() */ @@ -2331,37 +2336,42 @@ run_splitter_test(const struct splitter_dataset_def *data, hid_t space_id = H5I_INVALID_HID; hid_t fapl_id_out = H5I_INVALID_HID; hid_t fapl_id_cpy = H5I_INVALID_HID; - H5FD_splitter_vfd_config_t vfd_config; - char filename_rw[H5FD_SPLITTER_PATH_MAX + 1]; + H5FD_splitter_vfd_config_t *vfd_config = NULL; + char *filename_rw = NULL; FILE *logfile = NULL; int ret_value = 0; - vfd_config.magic = H5FD_SPLITTER_MAGIC; - vfd_config.version = H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION; - vfd_config.ignore_wo_errs = ignore_wo_errors; - vfd_config.rw_fapl_id = sub_fapl_ids[0]; - vfd_config.wo_fapl_id = sub_fapl_ids[1]; + if (NULL == (vfd_config = HDcalloc(1, sizeof(H5FD_splitter_vfd_config_t)))) + SPLITTER_TEST_FAULT("memory allocation for vfd_config struct failed"); + if (NULL == (filename_rw = HDcalloc(H5FD_SPLITTER_PATH_MAX + 1, sizeof(char)))) + SPLITTER_TEST_FAULT("memory allocation for filename_rw string failed"); + + vfd_config->magic = H5FD_SPLITTER_MAGIC; + vfd_config->version = H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION; + vfd_config->ignore_wo_errs = ignore_wo_errors; + vfd_config->rw_fapl_id = sub_fapl_ids[0]; + vfd_config->wo_fapl_id = sub_fapl_ids[1]; - if (splitter_prepare_file_paths(&vfd_config, filename_rw) < 0) { + if (splitter_prepare_file_paths(vfd_config, filename_rw) < 0) { SPLITTER_TEST_FAULT("can't prepare file paths\n"); } if (provide_logfile_path == FALSE) { - *vfd_config.log_file_path = '\0'; /* reset as empty string */ + vfd_config->log_file_path[0] = '\0'; /* reset as empty string */ } /* Create a new fapl to use the SPLITTER file driver */ if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) == H5I_INVALID_HID) { SPLITTER_TEST_FAULT("can't create FAPL ID\n"); } - if (H5Pset_fapl_splitter(fapl_id, &vfd_config) < 0) { + if (H5Pset_fapl_splitter(fapl_id, vfd_config) < 0) { SPLITTER_TEST_FAULT("can't set splitter FAPL\n"); } if (H5Pget_driver(fapl_id) != H5FD_SPLITTER) { SPLITTER_TEST_FAULT("set FAPL not SPLITTER\n"); } - if (compare_splitter_config_info(fapl_id, &vfd_config) < 0) { + if (compare_splitter_config_info(fapl_id, vfd_config) < 0) { SPLITTER_TEST_FAULT("information mismatch\n"); } @@ -2374,7 +2384,7 @@ run_splitter_test(const struct splitter_dataset_def *data, if (H5I_INVALID_HID == fapl_id_cpy) { SPLITTER_TEST_FAULT("can't copy FAPL\n"); } - if (compare_splitter_config_info(fapl_id_cpy, &vfd_config) < 0) { + if (compare_splitter_config_info(fapl_id_cpy, vfd_config) < 0) { SPLITTER_TEST_FAULT("information mismatch\n"); } if (H5Pclose(fapl_id_cpy) < 0) { @@ -2401,7 +2411,7 @@ run_splitter_test(const struct splitter_dataset_def *data, if (H5Pget_driver(fapl_id_out) != H5FD_SPLITTER) { SPLITTER_TEST_FAULT("wrong file FAPL driver\n"); } - if (compare_splitter_config_info(fapl_id_out, &vfd_config) < 0) { + if (compare_splitter_config_info(fapl_id_out, vfd_config) < 0) { SPLITTER_TEST_FAULT("information mismatch\n"); } if (H5Pclose(fapl_id_out) < 0) { @@ -2439,12 +2449,12 @@ run_splitter_test(const struct splitter_dataset_def *data, } /* Verify that the R/W and W/O files are identical */ - if (h5_compare_file_bytes(filename_rw, vfd_config.wo_path) < 0) { + if (h5_compare_file_bytes(filename_rw, vfd_config->wo_path) < 0) { SPLITTER_TEST_FAULT("files are not byte-for-byte equivalent\n"); } - /* Verify existence of logfile iff appropriate */ - logfile = fopen(vfd_config.log_file_path, "r"); + /* Verify existence of logfile if appropriate */ + logfile = fopen(vfd_config->log_file_path, "r"); if ( (TRUE == provide_logfile_path && NULL == logfile) || (FALSE == provide_logfile_path && NULL != logfile) ) { @@ -2454,19 +2464,22 @@ run_splitter_test(const struct splitter_dataset_def *data, done: if (ret_value < 0) { H5E_BEGIN_TRY { - (void)H5Dclose(dset_id); - (void)H5Sclose(space_id); - (void)H5Pclose(fapl_id_out); - (void)H5Pclose(fapl_id_cpy); - (void)H5Pclose(fapl_id); - (void)H5Fclose(file_id); + H5Dclose(dset_id); + H5Sclose(space_id); + H5Pclose(fapl_id_out); + H5Pclose(fapl_id_cpy); + H5Pclose(fapl_id); + H5Fclose(file_id); } H5E_END_TRY; } - if (logfile != NULL) { + + if (logfile != NULL) fclose(logfile); - } - return ret_value; + HDfree(vfd_config); + HDfree(filename_rw); + + return ret_value; } /* end run_splitter_test() */ @@ -2488,25 +2501,28 @@ done: static int driver_is_splitter_compatible(hid_t fapl_id) { - H5FD_splitter_vfd_config_t vfd_config; + H5FD_splitter_vfd_config_t *vfd_config = NULL; hid_t split_fapl_id = H5I_INVALID_HID; herr_t ret = SUCCEED; int ret_value = 0; - split_fapl_id = H5Pcreate(H5P_FILE_ACCESS); - if (H5I_INVALID_HID == split_fapl_id) { + if (NULL == (vfd_config = HDcalloc(1, sizeof(H5FD_splitter_vfd_config_t)))) { + FAIL_PUTS_ERROR("memory allocation for vfd_config struct failed"); + } + + if(H5I_INVALID_HID == (split_fapl_id = H5Pcreate(H5P_FILE_ACCESS))) { FAIL_PUTS_ERROR("Can't create contained FAPL"); } - vfd_config.magic = H5FD_SPLITTER_MAGIC; - vfd_config.version = H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION; - vfd_config.ignore_wo_errs = FALSE; - vfd_config.rw_fapl_id = H5P_DEFAULT; - vfd_config.wo_fapl_id = fapl_id; - HDstrncpy(vfd_config.wo_path, "nonesuch", H5FD_SPLITTER_PATH_MAX); - *vfd_config.log_file_path = '\0'; + vfd_config->magic = H5FD_SPLITTER_MAGIC; + vfd_config->version = H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION; + vfd_config->ignore_wo_errs = FALSE; + vfd_config->rw_fapl_id = H5P_DEFAULT; + vfd_config->wo_fapl_id = fapl_id; + HDstrncpy(vfd_config->wo_path, "nonesuch", H5FD_SPLITTER_PATH_MAX); + vfd_config->log_file_path[0] = '\0'; H5E_BEGIN_TRY { - ret = H5Pset_fapl_splitter(split_fapl_id, &vfd_config); + ret = H5Pset_fapl_splitter(split_fapl_id, vfd_config); } H5E_END_TRY; if (SUCCEED == ret) { ret_value = -1; @@ -2517,12 +2533,17 @@ driver_is_splitter_compatible(hid_t fapl_id) } split_fapl_id = H5I_INVALID_HID; + HDfree(vfd_config); + return ret_value; error: H5E_BEGIN_TRY { - (void)H5Pclose(split_fapl_id); + H5Pclose(split_fapl_id); } H5E_END_TRY; + + HDfree(vfd_config); + return -1; } /* end driver_is_splitter_compatible() */ @@ -2545,19 +2566,24 @@ splitter_RO_test( const struct splitter_dataset_def *data, hid_t child_fapl_id) { - char filename_rw[H5FD_SPLITTER_PATH_MAX + 1]; - H5FD_splitter_vfd_config_t vfd_config; + char *filename_rw = NULL; + H5FD_splitter_vfd_config_t *vfd_config = NULL; hid_t fapl_id = H5I_INVALID_HID; - int ret_value = 0; hid_t file_id = H5I_INVALID_HID; + int ret_value = 0; - vfd_config.magic = H5FD_SPLITTER_MAGIC; - vfd_config.version = H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION; - vfd_config.ignore_wo_errs = FALSE; - vfd_config.rw_fapl_id = child_fapl_id; - vfd_config.wo_fapl_id = child_fapl_id; + if (NULL == (vfd_config = HDcalloc(1, sizeof(H5FD_splitter_vfd_config_t)))) + SPLITTER_TEST_FAULT("memory allocation for vfd_config struct failed"); + if (NULL == (filename_rw = HDcalloc(H5FD_SPLITTER_PATH_MAX + 1, sizeof(char)))) + SPLITTER_TEST_FAULT("memory allocation for filename_rw string failed"); - if (splitter_prepare_file_paths(&vfd_config, filename_rw) < 0) { + vfd_config->magic = H5FD_SPLITTER_MAGIC; + vfd_config->version = H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION; + vfd_config->ignore_wo_errs = FALSE; + vfd_config->rw_fapl_id = child_fapl_id; + vfd_config->wo_fapl_id = child_fapl_id; + + if (splitter_prepare_file_paths(vfd_config, filename_rw) < 0) { SPLITTER_TEST_FAULT("can't prepare splitter file paths\n"); } @@ -2566,7 +2592,7 @@ splitter_RO_test( if (H5I_INVALID_HID == fapl_id) { SPLITTER_TEST_FAULT("can't create FAPL ID\n"); } - if (H5Pset_fapl_splitter(fapl_id, &vfd_config) < 0) { + if (H5Pset_fapl_splitter(fapl_id, vfd_config) < 0) { SPLITTER_TEST_FAULT("can't set splitter FAPL\n"); } if (H5Pget_driver(fapl_id) != H5FD_SPLITTER) { @@ -2588,7 +2614,7 @@ splitter_RO_test( * Should fail. */ - if (splitter_create_single_file_at(vfd_config.wo_path, vfd_config.wo_fapl_id, data) < 0) { + if (splitter_create_single_file_at(vfd_config->wo_path, vfd_config->wo_fapl_id, data) < 0) { SPLITTER_TEST_FAULT("can't write W/O file\n"); } H5E_BEGIN_TRY { @@ -2597,13 +2623,13 @@ splitter_RO_test( if (file_id >= 0) { SPLITTER_TEST_FAULT("R/O open with extant W/O file unexpectedly successful\n"); } - HDremove(vfd_config.wo_path); + HDremove(vfd_config->wo_path); /* Attempt R/O open when only R/W file exists * Should fail. */ - if (splitter_create_single_file_at(filename_rw, vfd_config.rw_fapl_id, data) < 0) { + if (splitter_create_single_file_at(filename_rw, vfd_config->rw_fapl_id, data) < 0) { SPLITTER_TEST_FAULT("can't create R/W file\n"); } H5E_BEGIN_TRY { @@ -2616,7 +2642,7 @@ splitter_RO_test( /* Attempt R/O open when both R/W and W/O files exist */ - if (splitter_create_single_file_at(vfd_config.wo_path, vfd_config.wo_fapl_id, data) < 0) { + if (splitter_create_single_file_at(vfd_config->wo_path, vfd_config->wo_fapl_id, data) < 0) { SPLITTER_TEST_FAULT("can't create W/O file\n"); } file_id = H5Fopen(filename_rw, H5F_ACC_RDONLY, fapl_id); @@ -2642,10 +2668,14 @@ splitter_RO_test( done: if (ret_value < 0) { H5E_BEGIN_TRY { - (void)H5Pclose(fapl_id); - (void)H5Fclose(file_id); + H5Pclose(fapl_id); + H5Fclose(file_id); } H5E_END_TRY; - } /* end if error */ + } + + HDfree(vfd_config); + HDfree(filename_rw); + return ret_value; } /* end splitter_RO_test() */ @@ -2784,9 +2814,9 @@ splitter_create_single_file_at( done: if (ret_value < 0) { H5E_BEGIN_TRY { - (void)H5Dclose(dset_id); - (void)H5Sclose(space_id); - (void)H5Fclose(file_id); + H5Dclose(dset_id); + H5Sclose(space_id); + H5Fclose(file_id); } H5E_END_TRY; } /* end if error */ return ret_value; @@ -2847,7 +2877,7 @@ splitter_compare_expected_data(hid_t file_id, done: if (ret_value < 0) { H5E_BEGIN_TRY { - (void)H5Dclose(dset_id); + H5Dclose(dset_id); } H5E_END_TRY; } return ret_value; @@ -2880,8 +2910,9 @@ done: static int splitter_tentative_open_test(hid_t child_fapl_id) { - char filename_rw[H5FD_SPLITTER_PATH_MAX + 1]; - H5FD_splitter_vfd_config_t vfd_config; + const char *filename_tmp = "splitter_tmp.h5"; + char *filename_rw = NULL; + H5FD_splitter_vfd_config_t *vfd_config = NULL; hid_t fapl_id = H5I_INVALID_HID; hid_t file_id = H5I_INVALID_HID; int buf[SPLITTER_SIZE][SPLITTER_SIZE]; /* for comparison */ @@ -2891,6 +2922,11 @@ splitter_tentative_open_test(hid_t child_fapl_id) struct splitter_dataset_def data; /* for comparison */ int ret_value = 0; + if (NULL == (vfd_config = HDcalloc(1, sizeof(H5FD_splitter_vfd_config_t)))) + SPLITTER_TEST_FAULT("memory allocation for vfd_config struct failed"); + if (NULL == (filename_rw = HDcalloc(H5FD_SPLITTER_PATH_MAX + 1, sizeof(char)))) + SPLITTER_TEST_FAULT("memory allocation for filename_rw string failed"); + /* pre-fill data buffer to write */ for (i=0; i < SPLITTER_SIZE; i++) { for (j=0; j < SPLITTER_SIZE; j++) { @@ -2905,13 +2941,13 @@ splitter_tentative_open_test(hid_t child_fapl_id) data.n_dims = 2; data.dset_name = SPLITTER_DATASET_NAME; - vfd_config.magic = H5FD_SPLITTER_MAGIC; - vfd_config.version = H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION; - vfd_config.ignore_wo_errs = FALSE; - vfd_config.rw_fapl_id = child_fapl_id; - vfd_config.wo_fapl_id = child_fapl_id; + vfd_config->magic = H5FD_SPLITTER_MAGIC; + vfd_config->version = H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION; + vfd_config->ignore_wo_errs = FALSE; + vfd_config->rw_fapl_id = child_fapl_id; + vfd_config->wo_fapl_id = child_fapl_id; - if (splitter_prepare_file_paths(&vfd_config, filename_rw) < 0) { + if (splitter_prepare_file_paths(vfd_config, filename_rw) < 0) { SPLITTER_TEST_FAULT("can't prepare splitter file paths\n"); } @@ -2919,14 +2955,23 @@ splitter_tentative_open_test(hid_t child_fapl_id) if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) == H5I_INVALID_HID) { SPLITTER_TEST_FAULT("can't create FAPL ID\n"); } - if (H5Pset_fapl_splitter(fapl_id, &vfd_config) < 0) { + if (H5Pset_fapl_splitter(fapl_id, vfd_config) < 0) { SPLITTER_TEST_FAULT("can't set splitter FAPL\n"); } if (H5Pget_driver(fapl_id) != H5FD_SPLITTER) { SPLITTER_TEST_FAULT("set FAPL not SPLITTER\n"); } - /* H5Fopen() with RDWR access. + /* Create instance of file on disk. + * Will be copied verbatim as needed, to avoid issues where differences in + * the creation time would befoul comparisons. + */ + if (splitter_create_single_file_at(filename_tmp, child_fapl_id, &data) < 0) { + SPLITTER_TEST_FAULT("can't write W/O file\n"); + } + + /* + * H5Fopen() with RDWR access. * Neither file exist already * Should fail. */ @@ -2940,17 +2985,18 @@ splitter_tentative_open_test(hid_t child_fapl_id) if (file_exists(filename_rw, child_fapl_id)) { SPLITTER_TEST_FAULT("R/W file unexpectedly created\n"); } - if (file_exists(vfd_config.wo_path, child_fapl_id)) { + if (file_exists(vfd_config->wo_path, child_fapl_id)) { SPLITTER_TEST_FAULT("W/O file unexpectedly created\n"); } - /* H5Fopen() with RDWR access. - * W/O file exists already. + /* + * H5Fopen() with RDWR access. + * Only W/O file present. * Should fail. */ - if (splitter_create_single_file_at(vfd_config.wo_path, child_fapl_id, &data) < 0) { - SPLITTER_TEST_FAULT("can't write W/O file\n"); + if (h5_duplicate_file_by_bytes(filename_tmp, vfd_config->wo_path) < 0) { + SPLITTER_TEST_FAULT("Can't create W/O file copy.\n"); } H5E_BEGIN_TRY { file_id = H5Fopen(filename_rw, H5F_ACC_RDWR, fapl_id); @@ -2961,21 +3007,22 @@ splitter_tentative_open_test(hid_t child_fapl_id) if (file_exists(filename_rw, child_fapl_id)) { SPLITTER_TEST_FAULT("R/W file unexpectedly created\n"); } - if (!file_exists(vfd_config.wo_path, child_fapl_id)) { + if (!file_exists(vfd_config->wo_path, child_fapl_id)) { SPLITTER_TEST_FAULT("W/O file mysteriously disappeared\n"); } - HDremove(vfd_config.wo_path); - if (file_exists(vfd_config.wo_path, child_fapl_id)) { + HDremove(vfd_config->wo_path); + if (file_exists(vfd_config->wo_path, child_fapl_id)) { SPLITTER_TEST_FAULT("failed to remove W/O file\n"); } - /* H5Fopen() with RDWR access. - * R/W file exists already. + /* + * H5Fopen() with RDWR access. + * Only R/W file present. * Should fail. */ - if (splitter_create_single_file_at(filename_rw, child_fapl_id, &data) < 0) { - SPLITTER_TEST_FAULT("can't write R/W file\n"); + if (h5_duplicate_file_by_bytes(filename_tmp, filename_rw) < 0) { + SPLITTER_TEST_FAULT("Can't create R/W file copy.\n"); } H5E_BEGIN_TRY { file_id = H5Fopen(filename_rw, H5F_ACC_RDWR, fapl_id); @@ -2986,16 +3033,17 @@ splitter_tentative_open_test(hid_t child_fapl_id) if (!file_exists(filename_rw, child_fapl_id)) { SPLITTER_TEST_FAULT("R/W file mysteriously disappeared\n"); } - if (file_exists(vfd_config.wo_path, child_fapl_id)) { + if (file_exists(vfd_config->wo_path, child_fapl_id)) { SPLITTER_TEST_FAULT("W/O file unexpectedly created\n"); } - /* H5Fopen() with RDWR access. - * Both files already exist. + /* + * H5Fopen() with RDWR access. + * Both files present. */ - if (splitter_create_single_file_at(vfd_config.wo_path, child_fapl_id, &data) < 0) { - SPLITTER_TEST_FAULT("can't write W/O file\n"); + if (h5_duplicate_file_by_bytes(filename_tmp, vfd_config->wo_path) < 0) { + SPLITTER_TEST_FAULT("Can't create W/O file copy.\n"); } file_id = H5Fopen(filename_rw, H5F_ACC_RDWR, fapl_id); if (file_id == H5I_INVALID_HID) { @@ -3008,15 +3056,13 @@ splitter_tentative_open_test(hid_t child_fapl_id) if (!file_exists(filename_rw, child_fapl_id)) { SPLITTER_TEST_FAULT("R/W file mysteriously disappared\n"); } - if (!file_exists(vfd_config.wo_path, child_fapl_id)) { + if (!file_exists(vfd_config->wo_path, child_fapl_id)) { SPLITTER_TEST_FAULT("W/O file mysteriously disappeared\n"); } - if (h5_compare_file_bytes(filename_rw, vfd_config.wo_path) < 0) { - SPLITTER_TEST_FAULT("files are not byte-for-byte equivalent\n"); - } - /* H5Fcreate() with TRUNC access. - * Both files already exist. + /* + * H5Fcreate() with TRUNC access. + * Both files present. */ file_id = H5Fcreate(filename_rw, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id); @@ -3030,24 +3076,24 @@ splitter_tentative_open_test(hid_t child_fapl_id) if (!file_exists(filename_rw, child_fapl_id)) { SPLITTER_TEST_FAULT("R/W file mysteriously disappared\n"); } - if (!file_exists(vfd_config.wo_path, child_fapl_id)) { + if (!file_exists(vfd_config->wo_path, child_fapl_id)) { SPLITTER_TEST_FAULT("W/O file mysteriously disappeared\n"); } - if (h5_compare_file_bytes(filename_rw, vfd_config.wo_path) < 0) { + if (h5_compare_file_bytes(filename_rw, vfd_config->wo_path) < 0) { SPLITTER_TEST_FAULT("files are not byte-for-byte equivalent\n"); } + HDremove(filename_rw); + HDremove(vfd_config->wo_path); - /* H5Fcreate() with TRUNC access. + /* + * H5Fcreate() with TRUNC access. * R/W already exists. */ - HDremove(filename_rw); - HDremove(vfd_config.wo_path); - if (splitter_create_single_file_at(filename_rw, child_fapl_id, &data) < 0) { - SPLITTER_TEST_FAULT("can't write R/W file\n"); + if (h5_duplicate_file_by_bytes(filename_tmp, filename_rw) < 0) { + SPLITTER_TEST_FAULT("Can't create R/W file copy.\n"); } - - if (file_exists(vfd_config.wo_path, child_fapl_id)) { + if (file_exists(vfd_config->wo_path, child_fapl_id)) { SPLITTER_TEST_FAULT("failed to remove W/O file\n"); } file_id = H5Fcreate(filename_rw, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id); @@ -3061,23 +3107,23 @@ splitter_tentative_open_test(hid_t child_fapl_id) if (!file_exists(filename_rw, child_fapl_id)) { SPLITTER_TEST_FAULT("R/W file mysteriously disappared\n"); } - if (!file_exists(vfd_config.wo_path, child_fapl_id)) { + if (!file_exists(vfd_config->wo_path, child_fapl_id)) { SPLITTER_TEST_FAULT("W/O file mysteriously disappeared\n"); } - if (h5_compare_file_bytes(filename_rw, vfd_config.wo_path) < 0) { + if (h5_compare_file_bytes(filename_rw, vfd_config->wo_path) < 0) { SPLITTER_TEST_FAULT("files are not byte-for-byte equivalent\n"); } + HDremove(filename_rw); + HDremove(vfd_config->wo_path); - /* H5Fcreate() with TRUNC access. - * W/O already exists. + /* + * H5Fcreate() with TRUNC access. + * Only W/O present. */ - HDremove(filename_rw); - HDremove(vfd_config.wo_path); - if (splitter_create_single_file_at(vfd_config.wo_path, child_fapl_id, &data) < 0) { - SPLITTER_TEST_FAULT("can't write R/W file\n"); + if (h5_duplicate_file_by_bytes(filename_tmp, vfd_config->wo_path) < 0) { + SPLITTER_TEST_FAULT("Can't create W/O file copy.\n"); } - if (file_exists(filename_rw, child_fapl_id)) { SPLITTER_TEST_FAULT("failed to remove R/W file\n"); } @@ -3092,16 +3138,19 @@ splitter_tentative_open_test(hid_t child_fapl_id) if (!file_exists(filename_rw, child_fapl_id)) { SPLITTER_TEST_FAULT("R/W file mysteriously disappared\n"); } - if (!file_exists(vfd_config.wo_path, child_fapl_id)) { + if (!file_exists(vfd_config->wo_path, child_fapl_id)) { SPLITTER_TEST_FAULT("W/O file mysteriously disappeared\n"); } - if (h5_compare_file_bytes(filename_rw, vfd_config.wo_path) < 0) { + if (h5_compare_file_bytes(filename_rw, vfd_config->wo_path) < 0) { SPLITTER_TEST_FAULT("files are not byte-for-byte equivalent\n"); } + HDremove(filename_rw); + HDremove(vfd_config->wo_path); /* H5Fcreate with both files absent is tested elsewhere */ - /* Cleanup + /* + * Cleanup */ if (H5Pclose(fapl_id) < 0) { @@ -3111,10 +3160,14 @@ splitter_tentative_open_test(hid_t child_fapl_id) done: if (ret_value < 0) { H5E_BEGIN_TRY { - (void)H5Pclose(fapl_id); - (void)H5Fclose(file_id); + H5Pclose(fapl_id); + H5Fclose(file_id); } H5E_END_TRY; - } /* end if error */ + } + + HDfree(vfd_config); + HDfree(filename_rw); + return ret_value; } /* end splitter_tentative_open_test() */ @@ -3151,7 +3204,7 @@ file_exists(const char *filename, hid_t fapl_id) error: H5E_BEGIN_TRY { - (void)H5Fclose(file_id); + H5Fclose(file_id); } H5E_END_TRY; return ret_value; } /* end file_exists() */ @@ -3225,7 +3278,6 @@ test_splitter(void) TEST_ERROR; } - /* Test file creation, utilizing different child FAPLs (default vs. * specified), logfile, and Write Channel error ignoring behavior. */ @@ -3251,7 +3303,6 @@ test_splitter(void) /* TODO: SWMR open? */ /* Concurrent opens with both drivers using the Splitter */ - if (H5Pclose(child_fapl_id) == FAIL) { TEST_ERROR; } @@ -3260,9 +3311,9 @@ test_splitter(void) return 0; error: - if (child_fapl_id != H5I_INVALID_HID) { - (void)H5Pclose(child_fapl_id); - } + if (child_fapl_id != H5I_INVALID_HID) + H5Pclose(child_fapl_id); + return -1; } /* end test_splitter() */ @@ -4162,8 +4213,7 @@ error: * * Purpose: Tests the basic features of Virtual File Drivers * - * Return: Success: 0 - * Failure: 1 + * Return: EXIT_SUCCESS/EXIT_FAILURE * *------------------------------------------------------------------------- */ @@ -4199,11 +4249,11 @@ main(void) if(nerrors) { HDprintf("***** %d Virtual File Driver TEST%s FAILED! *****\n", nerrors, nerrors > 1 ? "S" : ""); - return 1; - } /* end if */ + return EXIT_FAILURE; + } HDprintf("All Virtual File Driver tests passed.\n"); - return 0; + return EXIT_SUCCESS; } /* end main() */ diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index e297c8f..8324714 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -29,7 +29,7 @@ H5_ATTR_PURE int print_objname (diff_opt_t * opts, hsize_t nfound) { - return ((opts->m_verbose || nfound) && !opts->m_quiet) ? 1 : 0; + return ((opts->mode_verbose || nfound) && !opts->mode_quiet) ? 1 : 0; } /*------------------------------------------------------------------------- @@ -45,7 +45,7 @@ do_print_objname (const char *OBJ, const char *path1, const char *path2, diff_op * displaying any object or symbolic links. This improves * readability of the output. */ - if (opts->m_verbose_level >= 1) + if (opts->mode_verbose_level >= 1) parallel_print("\n"); parallel_print("%-7s: <%s> and <%s>\n", OBJ, path1, path2); } @@ -74,7 +74,7 @@ do_print_attrname (const char *attr, const char *path1, const char *path2) static int print_warn(diff_opt_t *opts) { - return ((opts->m_verbose)) ? 1: 0; + return ((opts->mode_verbose)) ? 1: 0; } @@ -141,7 +141,7 @@ is_valid_options(diff_opt_t *opts) /*----------------------------------------------- * no -q(quiet) with -v (verbose) or -r (report) */ - if(opts->m_quiet && (opts->m_verbose || opts->m_report)) { + if(opts->mode_quiet && (opts->mode_verbose || opts->mode_report)) { parallel_print("Error: -q (quiet mode) cannot be added to verbose or report modes\n"); opts->err_stat = H5DIFF_ERR; H5TOOLS_GOTO_DONE(0); @@ -169,9 +169,9 @@ done: * 0 - not excluded path *------------------------------------------------------------------------*/ static int -is_exclude_path (char * path, h5trav_type_t type, diff_opt_t *opts) +is_exclude_path (char *path, h5trav_type_t type, diff_opt_t *opts) { - struct exclude_path_list * exclude_path_ptr; + struct exclude_path_list *exclude_path_ptr; int ret_cmp; int ret_value = 0; @@ -210,7 +210,7 @@ is_exclude_path (char * path, h5trav_type_t type, diff_opt_t *opts) if (ret_cmp == 0) { /* found matching object */ /* excluded non-group object */ ret_value = 1; - /* remember the type of this maching object. + /* remember the type of this matching object. * if it's group, it can be used for excluding its member * objects in this while() loop */ exclude_path_ptr->obj_type = type; @@ -224,6 +224,71 @@ done: return ret_value; } +/*------------------------------------------------------------------------- + * Function: is_exclude_attr + * + * Purpose: check if 'paths' are part of exclude path list + * + * Return: + * 1 - excluded path + * 0 - not excluded path + *------------------------------------------------------------------------*/ +static int +is_exclude_attr (const char *path, h5trav_type_t type, diff_opt_t *opts) +{ + struct exclude_path_list *exclude_ptr; + int ret_cmp; + int ret_value = 0; + + /* check if exclude attr option is given */ + if (!opts->exclude_attr_path) + H5TOOLS_GOTO_DONE(0); + + /* assign to local exclude list pointer */ + exclude_ptr = opts->exclude_attr; + + /* search objects in exclude list */ + while (NULL != exclude_ptr) { + /* if exclude path is is group, exclude its members as well */ + if (exclude_ptr->obj_type == H5TRAV_TYPE_GROUP) { + ret_cmp = HDstrncmp(exclude_ptr->obj_path, path, + HDstrlen(exclude_ptr->obj_path)); + if (ret_cmp == 0) { /* found matching members */ + size_t len_grp; + + /* check if given path belong to an excluding group, if so + * exclude it as well. + * This verifies if “/grp1/dset1” is only under “/grp1”, but + * not under “/grp1xxx/” group. + */ + len_grp = HDstrlen(exclude_ptr->obj_path); + if (path[len_grp] == '/') { + /* belong to excluded group! */ + ret_value = 1; + break; /* while */ + } + } + } + /* exclude target is not group, just exclude the object */ + else { + ret_cmp = HDstrcmp(exclude_ptr->obj_path, path); + if (ret_cmp == 0) { /* found matching object */ + /* excluded non-group object */ + ret_value = 1; + /* remember the type of this matching object. + * if it's group, it can be used for excluding its member + * objects in this while() loop */ + exclude_ptr->obj_type = type; + break; /* while */ + } + } + exclude_ptr = exclude_ptr->next; + } + +done: + return ret_value; +} + /*------------------------------------------------------------------------- * Function: free_exclude_path_list @@ -243,6 +308,25 @@ free_exclude_path_list(diff_opt_t *opts) } } + +/*------------------------------------------------------------------------- + * Function: free_exclude_attr_list + * + * Purpose: free exclude object attribute list from diff options + *------------------------------------------------------------------------*/ +static void +free_exclude_attr_list(diff_opt_t *opts) +{ + struct exclude_path_list *curr = opts->exclude_attr; + struct exclude_path_list *next; + + while (NULL != curr) { + next = curr->next; + HDfree(curr); + curr = next; + } +} + /*------------------------------------------------------------------------- * Function: build_match_list * @@ -288,6 +372,7 @@ build_match_list (const char *objname1, trav_info_t *info1, const char *objname2 * All the objects belong to given groups are the candidates. * So prepare to compare paths without the group names. */ + H5TOOLS_DEBUG("objname1 = %s objname2 = %s ", objname1, objname2); /* if obj1 is not root */ if (HDstrcmp (objname1,"/") != 0) @@ -572,8 +657,8 @@ h5diff(const char *fname1, const char *fname2, const char *objname1, const char *------------------------------------------------------------------------- */ /* open file 1 */ - if (opts->custom_vol_1) { - if((fapl1_id = h5tools_get_fapl(H5P_DEFAULT, &(opts->vol_info_1), NULL)) < 0 ) { + if (opts->custom_vol[0]) { + if((fapl1_id = h5tools_get_fapl(H5P_DEFAULT, &(opts->vol_info[0]), NULL)) < 0 ) { parallel_print("h5diff: unable to create fapl for input file\n"); H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "unable to create input fapl\n"); } @@ -587,8 +672,8 @@ h5diff(const char *fname1, const char *fname2, const char *objname1, const char /* open file 2 */ - if (opts->custom_vol_2) { - if((fapl2_id = h5tools_get_fapl(H5P_DEFAULT, &(opts->vol_info_2), NULL)) < 0 ) { + if (opts->custom_vol[1]) { + if((fapl2_id = h5tools_get_fapl(H5P_DEFAULT, &(opts->vol_info[1]), NULL)) < 0 ) { parallel_print("h5diff: unable to create fapl for output file\n"); H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "unable to create output fapl\n"); } @@ -627,6 +712,7 @@ h5diff(const char *fname1, const char *fname2, const char *objname1, const char } else obj1fullname = HDstrdup(objname1); + H5TOOLS_DEBUG("obj1fullname = %s", obj1fullname); /* make the given object2 fullpath, start with "/" */ if (HDstrncmp(objname2, "/", 1)) { @@ -644,6 +730,7 @@ h5diff(const char *fname1, const char *fname2, const char *objname1, const char } else obj2fullname = HDstrdup(objname2); + H5TOOLS_DEBUG("obj2fullname = %s", obj2fullname); /*---------------------------------------------------------- * check if obj1 is root, group, single object or symlink @@ -777,12 +864,12 @@ h5diff(const char *fname1, const char *fname2, const char *objname1, const char H5TOOLS_DEBUG("h5diff ... dangling link"); if (opts->no_dangle_links) { /* treat dangling link as error */ - if(opts->m_verbose) + if(opts->mode_verbose) parallel_print("Warning: <%s> is a dangling link.\n", obj1fullname); H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "treat dangling link as error"); } else { - if(opts->m_verbose) + if(opts->mode_verbose) parallel_print("obj1 <%s> is a dangling link.\n", obj1fullname); if (l_ret1 != 0 || l_ret2 != 0) { nfound++; @@ -818,12 +905,12 @@ h5diff(const char *fname1, const char *fname2, const char *objname1, const char H5TOOLS_DEBUG("h5diff ... dangling link"); if (opts->no_dangle_links) { /* treat dangling link as error */ - if(opts->m_verbose) + if(opts->mode_verbose) parallel_print("Warning: <%s> is a dangling link.\n", obj2fullname); H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "treat dangling link as error"); } else { - if(opts->m_verbose) + if(opts->mode_verbose) parallel_print("obj2 <%s> is a dangling link.\n", obj2fullname); if (l_ret1 != 0 || l_ret2 != 0) { nfound++; @@ -857,8 +944,8 @@ h5diff(const char *fname1, const char *fname2, const char *objname1, const char * comparing details of same objects. */ - if(!(opts->m_verbose || opts->m_report)) { - H5TOOLS_DEBUG("h5diff NOT (opts->m_verbose || opts->m_report)"); + if(!(opts->mode_verbose || opts->mode_report)) { + H5TOOLS_DEBUG("h5diff NOT (opts->mode_verbose || opts->mode_report)"); /* if no danglink links */ if (l_ret1 > 0 && l_ret2 > 0) if (h5tools_is_obj_same(file1_id, obj1fullname, file2_id, obj2fullname) != 0) @@ -929,9 +1016,14 @@ h5diff(const char *fname1, const char *fname2, const char *objname1, const char /*------------------------------------------------------ * print the list */ - if(opts->m_verbose) { + if(opts->mode_verbose) { unsigned u; + if(opts->mode_verbose_level > 2) { + parallel_print("file1: %s\n", fname1); + parallel_print("file2: %s\n", fname2); + } + parallel_print("\n"); /* if given objects is group under root */ if (HDstrcmp (obj1fullname,"/") || HDstrcmp (obj2fullname,"/")) @@ -952,6 +1044,7 @@ h5diff(const char *fname1, const char *fname2, const char *objname1, const char nfound = diff_match(file1_id, obj1fullname, info1_lp, file2_id, obj2fullname, info2_lp, match_list, opts); + H5TOOLS_DEBUG("diff_match nfound: %d - errstat:%d", nfound, opts->err_stat); done: opts->err_stat = opts->err_stat | ret_value; @@ -1052,12 +1145,14 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, *------------------------------------------------------------------------- */ + H5TOOLS_DEBUG("exclude_path opts->contents:%d", opts->contents); /* not valid compare used when --exclude-path option is used */ if (!opts->exclude_path) { /* number of different objects */ if (info1->nused != info2->nused) { opts->contents = 0; } + H5TOOLS_DEBUG("opts->exclude_path opts->contents:%d", opts->contents); } /* objects in one file and not the other */ @@ -1066,6 +1161,7 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, opts->contents = 0; break; } + H5TOOLS_DEBUG("table->nobjs[%d] opts->contents:%d", i, opts->contents); } /*------------------------------------------------------------------------- @@ -1138,9 +1234,7 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, opts->cmn_objs = 1; if(!g_Parallel) { H5TOOLS_DEBUG("diff paths - errstat:%d", opts->err_stat); - nfound += diff(file1_id, obj1_fullpath, - file2_id, obj2_fullpath, - opts, &argdata); + nfound += diff(file1_id, obj1_fullpath, file2_id, obj2_fullpath, opts, &argdata); } /* end if */ #ifdef H5_HAVE_PARALLEL else { @@ -1385,6 +1479,8 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, opts->err_stat = opts->err_stat | ret_value; + free_exclude_attr_list (opts); + /* free table */ if (table) trav_table_free(table); @@ -1409,7 +1505,7 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, *------------------------------------------------------------------------- */ hsize_t -diff(hid_t file1_id, const char *path1, hid_t file2_id, const char *path2, diff_opt_t * opts, diff_args_t *argdata) +diff(hid_t file1_id, const char *path1, hid_t file2_id, const char *path2, diff_opt_t *opts, diff_args_t *argdata) { int status = -1; hid_t dset1_id = H5I_INVALID_HID; @@ -1458,7 +1554,7 @@ diff(hid_t file1_id, const char *path1, hid_t file2_id, const char *path2, diff_ if (status == 0) { if (opts->no_dangle_links) { /* dangling link is error */ - if(opts->m_verbose) + if(opts->mode_verbose) parallel_print("Warning: <%s> is a dangling link.\n", path1); H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "dangling link is error"); } @@ -1473,7 +1569,7 @@ diff(hid_t file1_id, const char *path1, hid_t file2_id, const char *path2, diff_ if (status == 0) { if (opts->no_dangle_links) { /* dangling link is error */ - if(opts->m_verbose) + if(opts->mode_verbose) parallel_print("Warning: <%s> is a dangling link.\n", path2); H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "dangling link is error"); } @@ -1499,11 +1595,11 @@ diff(hid_t file1_id, const char *path1, hid_t file2_id, const char *path2, diff_ /* if objects are not the same type */ if (argdata->type[0] != argdata->type[1]) { H5TOOLS_DEBUG("diff objects are not the same"); - if (opts->m_verbose||opts->m_list_not_cmp) { + if (opts->mode_verbose||opts->mode_list_not_cmp) { parallel_print("Not comparable: <%s> is of type %s and <%s> is of type %s\n", - path1, get_type(argdata->type[0]), - path2, get_type(argdata->type[1])); + path1, get_type(argdata->type[0]), path2, get_type(argdata->type[1])); } + opts->not_cmp = 1; /* TODO: will need to update non-comparable is different * opts->contents = 0; @@ -1528,7 +1624,7 @@ diff(hid_t file1_id, const char *path1, hid_t file2_id, const char *path2, diff_ object_type == H5TRAV_TYPE_GROUP); if (opts->follow_links || is_hard_link) { /* print information is only verbose option is used */ - if(opts->m_verbose || opts->m_report) { + if(opts->mode_verbose || opts->mode_report) { switch(object_type) { case H5TRAV_TYPE_DATASET: do_print_objname("dataset", path1, path2, opts); @@ -1557,7 +1653,7 @@ diff(hid_t file1_id, const char *path1, hid_t file2_id, const char *path2, diff_ } /* switch(type)*/ print_found(nfound); - } /* if(opts->m_verbose || opts->m_report) */ + } /* if(opts->mode_verbose || opts->mode_report) */ /* exact same, so comparison is done */ H5TOOLS_GOTO_DONE(H5DIFF_NO_ERR); @@ -1575,15 +1671,16 @@ diff(hid_t file1_id, const char *path1, hid_t file2_id, const char *path2, diff_ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Dopen2 failed"); if((dset2_id = H5Dopen2(file2_id, path2, H5P_DEFAULT)) < 0) H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Dopen2 failed"); + H5TOOLS_DEBUG("paths: %s - %s", path1, path2); /* verbose (-v) and report (-r) mode */ - if(opts->m_verbose || opts->m_report) { + if(opts->mode_verbose || opts->mode_report) { do_print_objname("dataset", path1, path2, opts); H5TOOLS_DEBUG("call diff_dataset 1:%s 2:%s ", path1, path2); nfound = diff_dataset(file1_id, file2_id, path1, path2, opts); print_found(nfound); } /* quiet mode (-q), just count differences */ - else if(opts->m_quiet) { + else if(opts->mode_quiet) { nfound = diff_dataset(file1_id, file2_id, path1, path2, opts); } /* the rest (-c, none, ...) */ @@ -1603,7 +1700,7 @@ diff(hid_t file1_id, const char *path1, hid_t file2_id, const char *path2, diff_ * referenced object *--------------------------------------------------------- */ - if(path1) { + if(path1 && !is_exclude_attr(path1, object_type, opts)) { H5TOOLS_DEBUG( "call diff_attr 1:%s 2:%s ", path1, path2); nfound += diff_attr(dset1_id, dset2_id, path1, path2, opts); } @@ -1635,7 +1732,7 @@ diff(hid_t file1_id, const char *path1, hid_t file2_id, const char *path2, diff_ do_print_objname("datatype", path1, path2, opts); /* always print the number of differences found in verbose mode */ - if(opts->m_verbose) + if(opts->mode_verbose) print_found(nfound); /*----------------------------------------------------------------- @@ -1644,7 +1741,7 @@ diff(hid_t file1_id, const char *path1, hid_t file2_id, const char *path2, diff_ * referenced object *----------------------------------------------------------------- */ - if(path1) { + if(path1 && !is_exclude_attr(path1, object_type, opts)) { H5TOOLS_DEBUG("call diff_attr 1:%s 2:%s ", path1, path2); nfound += diff_attr(type1_id, type2_id, path1, path2, opts); } @@ -1665,7 +1762,7 @@ diff(hid_t file1_id, const char *path1, hid_t file2_id, const char *path2, diff_ do_print_objname("group", path1, path2, opts); /* always print the number of differences found in verbose mode */ - if(opts->m_verbose) + if(opts->mode_verbose) print_found(nfound); if((grp1_id = H5Gopen2(file1_id, path1, H5P_DEFAULT)) < 0) @@ -1679,7 +1776,7 @@ diff(hid_t file1_id, const char *path1, hid_t file2_id, const char *path2, diff_ * referenced object *----------------------------------------------------------------- */ - if(path1) { + if(path1 && !is_exclude_attr(path1, object_type, opts)) { H5TOOLS_DEBUG("call diff_attr 1:%s 2:%s ", path1, path2); nfound += diff_attr(grp1_id, grp2_id, path1, path2, opts); } @@ -1707,7 +1804,7 @@ diff(hid_t file1_id, const char *path1, hid_t file2_id, const char *path2, diff_ do_print_objname("link", path1, path2, opts); /* always print the number of differences found in verbose mode */ - if(opts->m_verbose) + if(opts->mode_verbose) print_found(nfound); } break; @@ -1757,14 +1854,14 @@ diff(hid_t file1_id, const char *path1, hid_t file2_id, const char *path2, diff_ } /* end else */ /* always print the number of differences found in verbose mode */ - if(opts->m_verbose) + if(opts->mode_verbose) print_found(nfound); } break; case H5TRAV_TYPE_UNKNOWN: default: - if(opts->m_verbose) + if(opts->mode_verbose) parallel_print("Comparison not supported: <%s> and <%s> are of type %s\n", path1, path2, get_type(object_type) ); opts->not_cmp = 1; @@ -1786,7 +1883,7 @@ done: } /* path1 is dangling link */ else if (is_dangle_link1) { - if(opts->m_verbose) + if(opts->mode_verbose) parallel_print("obj1 <%s> is a dangling link.\n", path1); nfound++; if(print_objname(opts, nfound)) @@ -1794,7 +1891,7 @@ done: } /* path2 is dangling link */ else if (is_dangle_link2) { - if(opts->m_verbose) + if(opts->mode_verbose) parallel_print("obj2 <%s> is a dangling link.\n", path2); nfound++; if(print_objname(opts, nfound)) diff --git a/tools/lib/h5diff.h b/tools/lib/h5diff.h index 37eb775..f44f653 100644 --- a/tools/lib/h5diff.h +++ b/tools/lib/h5diff.h @@ -18,23 +18,6 @@ #include "h5tools.h" #include "h5trav.h" -/* - * Debug printf macros. The prefix allows output filtering by test scripts. - */ -#ifdef H5DIFF_DEBUG -#define h5difftrace(x) HDfprintf(stderr, "h5diff debug: " x) -#define h5diffdebug2(x1, x2) HDfprintf(stderr, "h5diff debug: " x1, x2) -#define h5diffdebug3(x1, x2, x3) HDfprintf(stderr, "h5diff debug: " x1, x2, x3) -#define h5diffdebug4(x1, x2, x3, x4) HDfprintf(stderr, "h5diff debug: " x1, x2, x3, x4) -#define h5diffdebug5(x1, x2, x3, x4, x5) HDfprintf(stderr, "h5diff debug: " x1, x2, x3, x4, x5) -#else -#define h5difftrace(x) -#define h5diffdebug2(x1, x2) -#define h5diffdebug3(x1, x2, x3) -#define h5diffdebug4(x1, x2, x3, x4) -#define h5diffdebug5(x1, x2, x3, x4, x5) -#endif - #define MAX_FILENAME 1024 /*------------------------------------------------------------------------- @@ -58,6 +41,7 @@ struct exclude_path_list { struct exclude_path_list *next; }; + /* Enumeration value for keeping track of whether an error occurred or differences were found */ typedef enum { H5DIFF_NO_ERR, /* No error occurred */ @@ -66,31 +50,47 @@ typedef enum { } diff_err_t; typedef struct { - int m_quiet; /* quiet mode: no output at all */ - int m_report; /* report mode: print the data */ - int m_verbose; /* verbose mode: print the data, list of objcets, warnings */ - int m_verbose_level; /* control verbose details */ - int d; /* delta, absolute value to compare */ - double delta; /* delta value */ - int p; /* relative error to compare*/ - int use_system_epsilon; /* flag to use system epsilon (1 or 0) */ - double percent; /* relative error value */ - int n; /* count, compare up to count */ - hsize_t count; /* count value */ - hbool_t follow_links; /* follow symbolic links */ - int no_dangle_links; /* return error when find dangling link */ - diff_err_t err_stat; /* an error ocurred (2, error, 1, differences, 0, no error) */ - int cmn_objs; /* do we have common objects */ - int not_cmp; /* are the objects comparable */ - int contents; /* equal contents */ - int do_nans; /* consider Nans while diffing floats */ - int m_list_not_cmp; /* list not comparable messages */ - int exclude_path; /* exclude path to an object */ - struct exclude_path_list * exclude; /* keep exclude path list */ - h5tools_vol_info_t vol_info_1; /* VOL information for input file */ - h5tools_vol_info_t vol_info_2; /* VOL information for output file */ - hbool_t custom_vol_1; /* Using a custom input VOL? */ - hbool_t custom_vol_2; /* Using a custom output VOL? */ + int mode_quiet; /* quiet mode: no output at all */ + int mode_report; /* report mode: print the data */ + int mode_verbose; /* verbose mode: print the data, list of objcets, warnings */ + int mode_verbose_level; /* control verbose details */ + int mode_list_not_cmp; /* list not comparable messages */ + int print_header; /* print header */ + int print_percentage; /* print percentage */ + int print_dims; /* print dimension index */ + int delta_bool; /* delta, absolute value to compare */ + double delta; /* delta value */ + int use_system_epsilon; /* flag to use system epsilon (1 or 0) */ + int percent_bool; /* relative error to compare*/ + double percent; /* relative error value */ + hbool_t follow_links; /* follow symbolic links */ + int no_dangle_links; /* return error when find dangling link */ + int cmn_objs; /* do we have common objects */ + int not_cmp; /* are the objects comparable */ + int contents; /* equal contents */ + int do_nans; /* consider Nans while diffing floats */ + int exclude_path; /* exclude path to an object */ + int exclude_attr_path; /* exclude path to an object */ + struct exclude_path_list *exclude; /* keep exclude path list */ + struct exclude_path_list *exclude_attr; /* keep exclude attribute list */ + int count_bool; /* count, compare up to count */ + hsize_t count; /* count value */ + diff_err_t err_stat; /* an error ocurred (2, error, 1, differences, 0, no error) */ + hsize_t nelmts; /* total number of elements */ + hsize_t hs_nelmts; /* number of elements to read at a time*/ + int rank; /* dimensionality */ + size_t m_size; /* m_size for diff */ + hid_t m_tid; /* m_tid for diff */ + hsize_t dims[H5S_MAX_RANK]; /* dimensions of object */ + hsize_t p_min_idx[H5S_MAX_RANK]; /* min selected index */ + hsize_t p_max_idx[H5S_MAX_RANK]; /* max selected index */ + hsize_t acc[H5S_MAX_RANK]; /* accumulator position */ + hsize_t pos[H5S_MAX_RANK]; /* matrix position */ + hsize_t sm_pos[H5S_MAX_RANK]; /* stripmine position */ + char *obj_name[2]; /* name for object */ + struct subset_t *sset[2]; /* subsetting parameters */ + h5tools_vol_info_t vol_info[2]; /* VOL information for input file, output file */ + hbool_t custom_vol[2]; /* Using a custom input, output VOL? */ } diff_opt_t; @@ -103,18 +103,9 @@ typedef struct { extern "C" { #endif -H5TOOLS_DLL hsize_t h5diff(const char *fname1, - const char *fname2, - const char *objname1, - const char *objname2, - diff_opt_t *opts); +H5TOOLS_DLL hsize_t h5diff(const char *fname1, const char *fname2, const char *objname1, const char *objname2, diff_opt_t *opts); -H5TOOLS_DLL hsize_t diff( hid_t file1_id, - const char *path1, - hid_t file2_id, - const char *path2, - diff_opt_t *opts, - diff_args_t *argdata); +H5TOOLS_DLL hsize_t diff(hid_t file1_id, const char *path1, hid_t file2_id, const char *path2, diff_opt_t *opts, diff_args_t *argdata); #ifdef H5_HAVE_PARALLEL H5TOOLS_DLL void phdiff_dismiss_workers(void); @@ -133,63 +124,29 @@ H5TOOLS_DLL void print_manager_output(void); */ -hsize_t diff_dataset( hid_t file1_id, - hid_t file2_id, - const char *obj1_name, - const char *obj2_name, - diff_opt_t *opts); - -hsize_t diff_datasetid( hid_t dset1_id, - hid_t dset2_id, - const char *obj1_name, - const char *obj2_name, - diff_opt_t *opts); - - -hsize_t diff_match( hid_t file1_id, const char *grp1, trav_info_t *info1, - hid_t file2_id, const char *grp2, trav_info_t *info2, - trav_table_t *table, diff_opt_t *opts ); - -hsize_t diff_array( void *_mem1, - void *_mem2, - hsize_t nelmts, - hsize_t hyper_start, - int rank, - hsize_t *dims, - diff_opt_t *opts, - const char *name1, - const char *name2, - hid_t m_type, - hid_t container1_id, - hid_t container2_id); /* dataset where the reference came from*/ - - -int diff_can_type( hid_t f_type1, /* file data type */ - hid_t f_type2, /* file data type */ - int rank1, - int rank2, - hsize_t *dims1, - hsize_t *dims2, - hsize_t *maxdim1, - hsize_t *maxdim2, - const char *obj1_name, - const char *obj2_name, - diff_opt_t *opts, - int is_compound); - -hsize_t diff_attr_data(hid_t attr1_id, - hid_t attr2_id, - const char *attr1_name, - const char *attr2_name, - const char *path1, - const char *path2, - diff_opt_t *opts); - -hsize_t diff_attr(hid_t loc1_id, - hid_t loc2_id, - const char *path1, - const char *path2, - diff_opt_t *opts); +hsize_t diff_dataset(hid_t file1_id, hid_t file2_id, + const char *obj1_name, const char *obj2_name, diff_opt_t *opts); + +hsize_t diff_datasetid(hid_t dset1_id, hid_t dset2_id, + const char *obj1_name, const char *obj2_name, diff_opt_t *opts); + + +hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, + hid_t file2_id, const char *grp2, trav_info_t *info2, + trav_table_t *table, diff_opt_t *opts); + +hsize_t diff_array(void *_mem1, void *_mem2, + diff_opt_t *opts, hid_t container1_id, hid_t container2_id); + +int diff_can_type(hid_t f_type1, hid_t f_type2, int rank1, int rank2, + hsize_t *dims1, hsize_t *dims2, hsize_t *maxdim1, hsize_t *maxdim2, + diff_opt_t *opts, int is_compound); + +hsize_t diff_attr_data(hid_t attr1_id, hid_t attr2_id, const char *name1, const char *name2, + const char *path1, const char *path2, diff_opt_t *opts); + +hsize_t diff_attr(hid_t loc1_id, hid_t loc2_id, + const char *path1, const char *path2, diff_opt_t *opts); /*------------------------------------------------------------------------- diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index 52bae51..1a4c727 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -132,97 +132,39 @@ typedef struct mcomp_t { * local prototypes *------------------------------------------------------------------------- */ -static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, - hid_t region2_id, diff_opt_t *opts); static hbool_t all_zero(const void *_mem, size_t size); static int ull2float(unsigned long long ull_value, float *f_value); -static hsize_t character_compare(char *mem1, char *mem2, hsize_t i, size_t u, - int rank, hsize_t *dims, hsize_t *acc, hsize_t *pos, - diff_opt_t *opts, const char *obj1, const char *obj2, int *ph); -static hsize_t character_compare_opt(unsigned char *mem1, unsigned char *mem2, - hsize_t i, int rank, hsize_t *dims, hsize_t *acc, hsize_t *pos, - diff_opt_t *opts, const char *obj1, const char *obj2, int *ph); +static hsize_t character_compare(char *mem1, char *mem2, hsize_t elemtno, size_t u, diff_opt_t *opts); +static hsize_t character_compare_opt(unsigned char *mem1, unsigned char *mem2, hsize_t elemtno, diff_opt_t *opts); static hbool_t equal_float(float value, float expected, diff_opt_t *opts); static hbool_t equal_double(double value, double expected, diff_opt_t *opts); #if H5_SIZEOF_LONG_DOUBLE !=0 static hbool_t equal_ldouble(long double value, long double expected, diff_opt_t *opts); #endif + static int print_data(diff_opt_t *opts); -static void print_pos(int *ph, int pp, hsize_t curr_pos, hsize_t *acc, - hsize_t *pos, int rank, hsize_t *dims, const char *obj1, - const char *obj2); -static void print_char_pos(int *ph, int pp, hsize_t curr_pos, size_t u, - hsize_t *acc, hsize_t *pos, int rank, hsize_t *dims, const char *obj1, - const char *obj2); +static void print_pos(diff_opt_t *opts, hsize_t elemtno, size_t u); static void h5diff_print_char(char ch); -static hsize_t diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t idx, - int rank, hsize_t *dims, hsize_t *acc, hsize_t *pos, - diff_opt_t *opts, const char *obj1, const char *obj2, - hid_t container1_id, hid_t container2_id, /*where the reference came from*/ - int *ph, /*print header */ - mcomp_t *members); /*compound members */ -static hsize_t diff_float(unsigned char *mem1, unsigned char *mem2, - hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims, - hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1, - const char *obj2, int *ph); -static hsize_t diff_double(unsigned char *mem1, unsigned char *mem2, - hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims, - hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1, - const char *obj2, int *ph); + +static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t region2_id, diff_opt_t *opts); +static hsize_t diff_datum(void *_mem1, void *_mem2, hsize_t elemtno, diff_opt_t *opts, + hid_t container1_id, hid_t container2_id, mcomp_t *members); +/* element diffs */ +static hsize_t diff_float_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts); +static hsize_t diff_double_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts); #if H5_SIZEOF_LONG_DOUBLE !=0 -static hsize_t diff_ldouble(unsigned char *mem1, - unsigned char *mem2, - hsize_t nelmts, - hsize_t hyper_start, - int rank, - hsize_t *dims, - hsize_t *acc, - hsize_t *pos, - diff_opt_t *opts, - const char *obj1, - const char *obj2, - int *ph); +static hsize_t diff_ldouble_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts); #endif -static hsize_t diff_schar(unsigned char *mem1, unsigned char *mem2, - hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims, - hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1, - const char *obj2, int *ph); -static hsize_t diff_uchar(unsigned char *mem1, unsigned char *mem2, - hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims, - hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1, - const char *obj2, int *ph); -static hsize_t diff_short(unsigned char *mem1, unsigned char *mem2, - hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims, - hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1, - const char *obj2, int *ph); -static hsize_t diff_ushort(unsigned char *mem1, unsigned char *mem2, - hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims, - hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1, - const char *obj2, int *ph); -static hsize_t diff_int(unsigned char *mem1, unsigned char *mem2, - hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims, - hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1, - const char *obj2, int *ph); -static hsize_t diff_uint(unsigned char *mem1, unsigned char *mem2, - hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims, - hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1, - const char *obj2, int *ph); -static hsize_t diff_long(unsigned char *mem1, unsigned char *mem2, - hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims, - hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1, - const char *obj2, int *ph); -static hsize_t diff_ulong(unsigned char *mem1, unsigned char *mem2, - hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims, - hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1, - const char *obj2, int *ph); -static hsize_t diff_llong(unsigned char *mem1, unsigned char *mem2, - hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims, - hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1, - const char *obj2, int *ph); -static hsize_t diff_ullong(unsigned char *mem1, unsigned char *mem2, - hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims, - hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1, - const char *obj2, int *ph); +static hsize_t diff_schar_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts); +static hsize_t diff_uchar_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts); +static hsize_t diff_short_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts); +static hsize_t diff_ushort_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts); +static hsize_t diff_int_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts); +static hsize_t diff_uint_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts); +static hsize_t diff_long_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts); +static hsize_t diff_ulong_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts); +static hsize_t diff_llong_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts); +static hsize_t diff_ullong_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts); /*------------------------------------------------------------------------- * NaN detection @@ -260,26 +202,23 @@ static void close_member_types(mcomp_t *members); *------------------------------------------------------------------------- */ -hsize_t diff_array(void *_mem1, void *_mem2, hsize_t nelmts, hsize_t hyper_start, - int rank, hsize_t *dims, diff_opt_t *opts, const char *name1, const char *name2, - hid_t m_type, hid_t container1_id, hid_t container2_id) +hsize_t +diff_array(void *_mem1, void *_mem2, diff_opt_t *opts, hid_t container1_id, hid_t container2_id) { hsize_t nfound = 0; /* number of differences found */ size_t size; /* size of datum */ unsigned char *mem1 = (unsigned char*) _mem1; unsigned char *mem2 = (unsigned char*) _mem2; - hsize_t acc[32]; /* accumulator position */ - hsize_t pos[32]; /* matrix position */ - int ph = 1; /* print header */ hsize_t i; - int j; mcomp_t members; H5T_class_t type_class; - H5TOOLS_START_DEBUG(" - errstat:%d", opts->err_stat); + H5TOOLS_START_DEBUG(" - rank:%d hs_nelmts:%ld errstat:%d", opts->rank, opts->hs_nelmts, opts->err_stat); + opts->print_header = 1; /* enable print header */ + /* get the size. */ - size = H5Tget_size(m_type); - type_class = H5Tget_class(m_type); + size = H5Tget_size(opts->m_tid); + type_class = H5Tget_class(opts->m_tid); /* Fast comparison first for atomic type by memcmp(). * It is OK not to list non-atomic type here because it will not be caught @@ -289,24 +228,18 @@ hsize_t diff_array(void *_mem1, void *_mem2, hsize_t nelmts, hsize_t hyper_start type_class != H5T_COMPOUND && type_class != H5T_STRING && type_class != H5T_VLEN && - HDmemcmp(mem1, mem2, size*nelmts) == 0) + HDmemcmp(mem1, mem2, size * opts->hs_nelmts) == 0) { + H5TOOLS_ENDDEBUG(":Fast comparison - errstat:%d", opts->err_stat); return 0; - - if (rank > 0) { - acc[rank - 1] = 1; - for (j = (rank - 2); j >= 0; j--) { - acc[j] = acc[j + 1] * dims[j + 1]; - } - for (j = 0; j < rank; j++) - pos[j] = 0; } - H5TOOLS_DEBUG("diff_array type_class:%d", type_class); + H5TOOLS_DEBUG("type_class:%d", type_class); switch (type_class) { case H5T_NO_CLASS: case H5T_TIME: case H5T_NCLASSES: default: + H5TOOLS_DEBUG("type_class:INVALID"); HDassert(0); break; @@ -315,37 +248,142 @@ hsize_t diff_array(void *_mem1, void *_mem2, hsize_t nelmts, hsize_t hyper_start *------------------------------------------------------------------------- */ case H5T_FLOAT: - if (H5Tequal(m_type, H5T_NATIVE_FLOAT)) - nfound = diff_float(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, opts, name1, name2, &ph); - else if (H5Tequal(m_type, H5T_NATIVE_DOUBLE)) - nfound = diff_double(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, opts, name1, name2, &ph); + H5TOOLS_DEBUG("type_class:H5T_FLOAT"); + if (H5Tequal(opts->m_tid, H5T_NATIVE_FLOAT)) { + for (i = 0; i < opts->hs_nelmts; i++) { + nfound += diff_float_element(mem1, mem2, i, opts); + + mem1 += sizeof(float); + mem2 += sizeof(float); + if (opts->count_bool && nfound >= opts->count) + return nfound; + } /* nelmts */ + } + else if (H5Tequal(opts->m_tid, H5T_NATIVE_DOUBLE)){ + for (i = 0; i < opts->hs_nelmts; i++) { + nfound += diff_double_element(mem1, mem2, i, opts); + + mem1 += sizeof(double); + mem2 += sizeof(double); + if (opts->count_bool && nfound >= opts->count) + return nfound; + } /* nelmts */ + } #if H5_SIZEOF_LONG_DOUBLE != 0 - else if (H5Tequal(m_type, H5T_NATIVE_LDOUBLE)) - nfound = diff_ldouble(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, opts, name1, name2, &ph); + else if (H5Tequal(opts->m_tid, H5T_NATIVE_LDOUBLE)) { + for ( i = 0; i < opts->hs_nelmts; i++) { + nfound += diff_ldouble_element(mem1, mem2, i, opts); + + mem1 += sizeof(long double); + mem2 += sizeof(long double); + if (opts->count_bool && nfound >= opts->count) + return nfound; + } /* nelmts */ + } #endif break; case H5T_INTEGER: - if (H5Tequal(m_type, H5T_NATIVE_SCHAR)) - nfound = diff_schar(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, opts, name1, name2, &ph); - else if (H5Tequal(m_type, H5T_NATIVE_UCHAR)) - nfound = diff_uchar(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, opts, name1, name2, &ph); - else if (H5Tequal(m_type, H5T_NATIVE_SHORT)) - nfound = diff_short(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, opts, name1, name2, &ph); - else if (H5Tequal(m_type, H5T_NATIVE_USHORT)) - nfound = diff_ushort(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, opts, name1, name2, &ph); - else if (H5Tequal(m_type, H5T_NATIVE_INT)) - nfound = diff_int(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, opts, name1, name2, &ph); - else if (H5Tequal(m_type, H5T_NATIVE_UINT)) - nfound = diff_uint(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, opts, name1, name2, &ph); - else if (H5Tequal(m_type, H5T_NATIVE_LONG)) - nfound = diff_long(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, opts, name1, name2, &ph); - else if (H5Tequal(m_type, H5T_NATIVE_ULONG)) - nfound = diff_ulong(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, opts, name1, name2, &ph); - else if (H5Tequal(m_type, H5T_NATIVE_LLONG)) - nfound = diff_llong(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, opts, name1, name2, &ph); - else if (H5Tequal(m_type, H5T_NATIVE_ULLONG)) - nfound = diff_ullong(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, opts, name1, name2, &ph); + H5TOOLS_DEBUG("type_class:H5T_INTEGER"); + if (H5Tequal(opts->m_tid, H5T_NATIVE_SCHAR)) { + for (i = 0; i < opts->hs_nelmts; i++) { + nfound += diff_schar_element(mem1, mem2, i, opts); + mem1 += sizeof(char); + mem2 += sizeof(char); + if (opts->count_bool && nfound >= opts->count) + return nfound; + } /* nelmts */ + } + else if (H5Tequal(opts->m_tid, H5T_NATIVE_UCHAR)) { + for (i = 0; i < opts->hs_nelmts; i++) { + nfound += diff_uchar_element(mem1, mem2, i, opts); + + mem1 += sizeof(unsigned char); + mem2 += sizeof(unsigned char); + if (opts->count_bool && nfound >= opts->count) + return nfound; + } /* nelmts */ + } + else if (H5Tequal(opts->m_tid, H5T_NATIVE_SHORT)) { + for (i = 0; i < opts->hs_nelmts; i++) { + nfound += diff_short_element(mem1, mem2, i, opts); + + mem1 += sizeof(short); + mem2 += sizeof(short); + if (opts->count_bool && nfound >= opts->count) + return nfound; + } /* nelmts */ + } + else if (H5Tequal(opts->m_tid, H5T_NATIVE_USHORT)) { + for (i = 0; i < opts->hs_nelmts; i++) { + nfound += diff_ushort_element(mem1, mem2, i, opts); + + mem1 += sizeof(unsigned short); + mem2 += sizeof(unsigned short); + if (opts->count_bool && nfound >= opts->count) + return nfound; + } /* nelmts */ + } + else if (H5Tequal(opts->m_tid, H5T_NATIVE_INT)) { + for (i = 0; i < opts->hs_nelmts; i++) { + nfound += diff_int_element(mem1, mem2, i, opts); + + mem1 += sizeof(int); + mem2 += sizeof(int); + if (opts->count_bool && nfound >= opts->count) + return nfound; + } /* nelmts */ + } + else if (H5Tequal(opts->m_tid, H5T_NATIVE_UINT)) { + for (i = 0; i < opts->hs_nelmts; i++) { + nfound += diff_int_element(mem1, mem2, i, opts); + + mem1 += sizeof(unsigned int); + mem2 += sizeof(unsigned int); + if (opts->count_bool && nfound >= opts->count) + return nfound; + } /* nelmts */ + } + else if (H5Tequal(opts->m_tid, H5T_NATIVE_LONG)) { + for (i = 0; i < opts->hs_nelmts; i++) { + nfound += diff_long_element(mem1, mem2, i, opts); + + mem1 += sizeof(long); + mem2 += sizeof(long); + if (opts->count_bool && nfound >= opts->count) + return nfound; + } /* nelmts */ + } + else if (H5Tequal(opts->m_tid, H5T_NATIVE_ULONG)) { + for (i = 0; i < opts->hs_nelmts; i++) { + nfound += diff_ulong_element(mem1, mem2, i, opts); + + mem1 += sizeof(unsigned long); + mem2 += sizeof(unsigned long); + if (opts->count_bool && nfound >= opts->count) + return nfound; + } /* nelmts */ + } + else if (H5Tequal(opts->m_tid, H5T_NATIVE_LLONG)) { + for (i = 0; i < opts->hs_nelmts; i++) { + nfound += diff_llong_element(mem1, mem2, i, opts); + + mem1 += sizeof(long long); + mem2 += sizeof(long long); + if (opts->count_bool && nfound >= opts->count) + return nfound; + } /* nelmts */ + } + else if (H5Tequal(opts->m_tid, H5T_NATIVE_ULLONG)) { + for (i = 0; i < opts->hs_nelmts; i++) { + nfound += diff_ullong_element(mem1, mem2, i, opts); + + mem1 += sizeof(unsigned long long); + mem2 += sizeof(unsigned long long); + if (opts->count_bool && nfound >= opts->count) + return nfound; + } /* nelmts */ + } break; /*------------------------------------------------------------------------- @@ -360,13 +398,13 @@ hsize_t diff_array(void *_mem1, void *_mem2, hsize_t nelmts, hsize_t hyper_start case H5T_ARRAY: case H5T_VLEN: case H5T_REFERENCE: + H5TOOLS_DEBUG("type_class:OTHER"); HDmemset(&members, 0, sizeof(mcomp_t)); - get_member_types(m_type, &members); - H5TOOLS_DEBUG("call diff_datum nelmts:%d - errstat:%d", nelmts, opts->err_stat); - for (i = 0; i < nelmts; i++) { - nfound += diff_datum(mem1 + i * size, mem2 + i * size, m_type, i, rank, dims, acc, pos, opts, - name1, name2, container1_id, container2_id, &ph, &members); - if (opts->n && nfound >= opts->count) + get_member_types(opts->m_tid, &members); + for (i = 0; i < opts->hs_nelmts; i++) { + H5TOOLS_DEBUG("opts->pos[%ld]:%ld - nelmts:%ld", i, opts->pos[i], opts->hs_nelmts); + nfound += diff_datum(mem1 + i * size, mem2 + i * size, i, opts, container1_id, container2_id, &members); + if (opts->count_bool && nfound >= opts->count) break; } /* i */ close_member_types(&members); @@ -409,12 +447,7 @@ hsize_t diff_array(void *_mem1, void *_mem2, hsize_t nelmts, hsize_t hyper_start *------------------------------------------------------------------------- */ static hsize_t -diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t idx, int rank, - hsize_t *dims, hsize_t *acc, hsize_t *pos, diff_opt_t *opts, - const char *obj1, const char *obj2, - hid_t container1_id, hid_t container2_id, - int *ph, /*print header */ - mcomp_t *members) /*compound members */ +diff_datum(void *_mem1, void *_mem2, hsize_t elemtno, diff_opt_t *opts, hid_t container1_id, hid_t container2_id, mcomp_t *members) { unsigned char *mem1 = (unsigned char*) _mem1; unsigned char *mem2 = (unsigned char*) _mem2; @@ -425,7 +458,6 @@ diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t idx, int rank, size_t offset; unsigned nmembs; unsigned j; - hsize_t nelmts; size_t size = 0; hbool_t iszero1; hbool_t iszero2; @@ -434,10 +466,10 @@ diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t idx, int rank, hbool_t both_zero; diff_err_t ret_value = opts->err_stat; - H5TOOLS_START_DEBUG(" - errstat:%d", opts->err_stat); + H5TOOLS_START_DEBUG("ph:%d elemtno:%d - errstat:%d", opts->print_header, elemtno, opts->err_stat); - type_size = H5Tget_size(m_type); - type_class = H5Tget_class(m_type); + type_size = H5Tget_size(opts->m_tid); + type_class = H5Tget_class(opts->m_tid); /* Fast comparison first for atomic type by memcmp(). * It is OK not to list non-atomic type here because it will not be caught @@ -450,7 +482,7 @@ diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t idx, int rank, HDmemcmp(mem1, mem2, type_size) == 0) H5TOOLS_GOTO_DONE(opts->err_stat); - switch (H5Tget_class(m_type)) { + switch (H5Tget_class(opts->m_tid)) { case H5T_NO_CLASS: case H5T_TIME: case H5T_NCLASSES: @@ -463,18 +495,22 @@ diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t idx, int rank, *------------------------------------------------------------------------- */ case H5T_COMPOUND: - H5TOOLS_DEBUG("diff_datum H5T_COMPOUND"); + H5TOOLS_DEBUG("H5T_COMPOUND"); { - hid_t memb_type = H5I_INVALID_HID; + diff_opt_t cmpd_opts; + + cmpd_opts = *opts; nmembs = members->n; for (j = 0; j < nmembs; j++) { offset = members->offsets[j]; - memb_type = members->ids[j]; + cmpd_opts.m_tid = members->ids[j]; - nfound += diff_datum(mem1 + offset, mem2 + offset, memb_type, idx, - rank, dims, acc, pos, opts, obj1, obj2, container1_id, container2_id, ph, members->m[j]); + nfound += diff_datum(mem1 + offset, mem2 + offset, elemtno, &cmpd_opts, container1_id, container2_id, members->m[j]); } + opts->err_stat = opts->err_stat | cmpd_opts.err_stat; + opts->print_header = cmpd_opts.print_header; + opts->not_cmp = cmpd_opts.not_cmp; } break; @@ -483,7 +519,7 @@ diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t idx, int rank, *------------------------------------------------------------------------- */ case H5T_STRING: - H5TOOLS_DEBUG("diff_datum H5T_STRING"); + H5TOOLS_DEBUG("H5T_STRING"); { char *s = NULL; char *sx = NULL; @@ -492,12 +528,12 @@ diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t idx, int rank, size_t size1; size_t size2; size_t sizex; - size_t size_mtype = H5Tget_size(m_type); - H5T_str_t pad = H5Tget_strpad(m_type); + size_t size_mtype = H5Tget_size(opts->m_tid); + H5T_str_t pad = H5Tget_strpad(opts->m_tid); /* if variable length string */ - if (H5Tis_variable_str(m_type)) { - H5TOOLS_DEBUG("diff_datum H5T_STRING variable"); + if (H5Tis_variable_str(opts->m_tid)) { + H5TOOLS_DEBUG("H5T_STRING variable"); /* Get pointer to first string */ s1 = *(char **)((void *)mem1); if (s1) @@ -513,7 +549,7 @@ diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t idx, int rank, size2 = 0; } else if (H5T_STR_NULLTERM == pad) { - H5TOOLS_DEBUG("diff_datum H5T_STRING null term"); + H5TOOLS_DEBUG("H5T_STRING null term"); /* Get pointer to first string */ s1 = (char*) mem1; if (s1) @@ -550,10 +586,10 @@ diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t idx, int rank, * of length of strings. * For now mimic the previous way. */ - H5TOOLS_DEBUG("diff_datum string size:%d", size1); - H5TOOLS_DEBUG("diff_datum string size:%d", size2); + H5TOOLS_DEBUG("string size:%d", size1); + H5TOOLS_DEBUG("string size:%d", size2); if (size1 != size2) { - H5TOOLS_DEBUG("diff_datum string sizes difference"); + H5TOOLS_DEBUG("string sizes difference"); nfound++; } if (size1 < size2) { @@ -572,15 +608,13 @@ diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t idx, int rank, /* check for NULL pointer for string */ if (s != NULL) { /* try fast compare first */ - if (HDmemcmp(s, sx, size) == 0) { - if (size1 != size2) - if (print_data(opts)) - for (u = size; u < sizex; u++) - character_compare(s + u, sx + u, idx, u, rank, dims, acc, pos, opts, obj1, obj2, ph); + if ((HDmemcmp(s, sx, size) == 0) && (size1 != size2)) { + for (u = size; u < sizex; u++) + character_compare(s + u, sx + u, elemtno, u, opts); } else for (u = 0; u < size; u++) - nfound += character_compare(s + u, sx + u, idx, u, rank, dims, acc, pos, opts, obj1, obj2, ph); + nfound += character_compare(s + u, sx + u, elemtno, u, opts); } /* end check for NULL pointer for string */ } break; @@ -590,10 +624,10 @@ diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t idx, int rank, *------------------------------------------------------------------------- */ case H5T_BITFIELD: - H5TOOLS_DEBUG("diff_datum H5T_BITFIELD"); + H5TOOLS_DEBUG("H5T_BITFIELD"); /* byte-by-byte comparison */ for (u = 0; u < type_size; u++) - nfound += character_compare_opt(mem1 + u, mem2 + u, idx, rank, dims, acc, pos, opts, obj1, obj2, ph); + nfound += character_compare_opt(mem1 + u, mem2 + u, elemtno, opts); break; /*------------------------------------------------------------------------- @@ -601,10 +635,10 @@ diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t idx, int rank, *------------------------------------------------------------------------- */ case H5T_OPAQUE: - H5TOOLS_DEBUG("diff_datum H5T_OPAQUE"); + H5TOOLS_DEBUG("H5T_OPAQUE"); /* byte-by-byte comparison */ for (u = 0; u < type_size; u++) - nfound += character_compare_opt(mem1 + u, mem2 + u, idx, rank, dims, acc, pos, opts, obj1, obj2, ph); + nfound += character_compare_opt(mem1 + u, mem2 + u, elemtno, opts); break; /*------------------------------------------------------------------------- @@ -617,7 +651,7 @@ diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t idx, int rank, * compared, we convert both bit patterns to their corresponding * enumeration constant and do a string comparison */ - H5TOOLS_DEBUG("diff_datum H5T_ENUM"); + H5TOOLS_DEBUG("H5T_ENUM"); { char enum_name1[1024]; char enum_name2[1024]; @@ -629,11 +663,11 @@ diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t idx, int rank, /* If the enum value cannot be converted to a string * it is set to an error string for later output. */ - err1 = H5Tenum_nameof(m_type, mem1, enum_name1, sizeof enum_name1); + err1 = H5Tenum_nameof(opts->m_tid, mem1, enum_name1, sizeof enum_name1); if (err1 < 0) HDsnprintf(enum_name1, sizeof(enum_name1), "**INVALID VALUE**"); - err2 = H5Tenum_nameof(m_type, mem2, enum_name2, sizeof enum_name2); + err2 = H5Tenum_nameof(opts->m_tid, mem2, enum_name2, sizeof enum_name2); if (err2 < 0) HDsnprintf(enum_name2, sizeof(enum_name2), "**INVALID VALUE**"); @@ -644,9 +678,9 @@ diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t idx, int rank, * don't attempt to convert them - just report errors. */ nfound += 1; + opts->print_percentage = 0; + print_pos(opts, elemtno, 0); if (print_data(opts)) { - print_pos(ph, 0, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); parallel_print(S_FORMAT, enum_name1, enum_name2); } } @@ -654,15 +688,15 @@ diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t idx, int rank, /* Both enum values were valid */ if (HDstrcmp(enum_name1, enum_name2) != 0) { nfound = 1; + opts->print_percentage = 0; + print_pos(opts, elemtno, 0); if (print_data(opts)) { - print_pos(ph, 0, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); parallel_print(S_FORMAT, enum_name1, enum_name2); } } else { for (u = 0; u < type_size; u++) - nfound += character_compare_opt(mem1 + u, mem2 + u, idx, rank, dims, acc, pos, opts, obj1, obj2, ph); + nfound += character_compare_opt(mem1 + u, mem2 + u, elemtno, opts); } } /* enable error reporting */ @@ -676,26 +710,32 @@ diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t idx, int rank, */ case H5T_ARRAY: { - hid_t memb_type = H5I_INVALID_HID; hsize_t adims[H5S_MAX_RANK]; int ndims; + diff_opt_t arr_opts; + + H5TOOLS_DEBUG("H5T_ARRAY ph=%d", opts->print_header); - H5TOOLS_DEBUG("diff_datum H5T_ARRAY"); + arr_opts = *opts; + H5TOOLS_DEBUG("Check opts: hs_nelmts:%ld to %ld rank:%d to %ld", opts->hs_nelmts, arr_opts.hs_nelmts, opts->rank, arr_opts.rank); /* get the array's base datatype for each element */ - memb_type = H5Tget_super(m_type); - size = H5Tget_size(memb_type); - ndims = H5Tget_array_ndims(m_type); - H5Tget_array_dims2(m_type, adims); + arr_opts.m_tid = H5Tget_super(opts->m_tid); + size = H5Tget_size(arr_opts.m_tid); + ndims = H5Tget_array_ndims(opts->m_tid); + H5Tget_array_dims2(opts->m_tid, adims); HDassert(ndims >= 1 && ndims <= H5S_MAX_RANK); + H5TOOLS_DEBUG("attr ph=%d", arr_opts.print_header); /* calculate the number of array elements */ - for (u = 0, nelmts = 1; u < (unsigned) ndims; u++) - nelmts *= adims[u]; - for (u = 0; u < nelmts; u++) { - nfound += diff_datum(mem1 + u * size, mem2 + u * size, memb_type, idx, - rank, dims, acc, pos, opts, obj1, obj2, container1_id, container2_id, ph, members); - } - H5Tclose(memb_type); + for (u = 0, arr_opts.hs_nelmts = 1; u < (unsigned) ndims; u++) + arr_opts.hs_nelmts *= adims[u]; + for (u = 0; u < arr_opts.hs_nelmts; u++) { + nfound += diff_datum(mem1 + u * size, mem2 + u * size, elemtno, &arr_opts, container1_id, container2_id, members); + } + opts->err_stat = opts->err_stat | arr_opts.err_stat; + opts->print_header = arr_opts.print_header; + opts->not_cmp = arr_opts.not_cmp; + H5Tclose(arr_opts.m_tid); } break; @@ -704,9 +744,9 @@ diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t idx, int rank, *------------------------------------------------------------------------- */ case H5T_REFERENCE: - H5TOOLS_DEBUG("diff_datum H5T_REFERENCE"); - iszero1 = all_zero(_mem1, H5Tget_size(m_type)); - iszero2 = all_zero(_mem2, H5Tget_size(m_type)); + H5TOOLS_DEBUG("H5T_REFERENCE"); + iszero1 = all_zero(_mem1, H5Tget_size(opts->m_tid)); + iszero2 = all_zero(_mem2, H5Tget_size(opts->m_tid)); if (iszero1 != iszero2) { nfound++; H5TOOLS_GOTO_DONE(opts->err_stat); @@ -714,13 +754,17 @@ diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t idx, int rank, else if (!iszero1 && !iszero2) { hid_t obj1_id = H5I_INVALID_HID; hid_t obj2_id = H5I_INVALID_HID; + diff_opt_t ref_opts; /*------------------------------------------------------------------------- * H5T_STD_REF * Reference *------------------------------------------------------------------------- */ - if (H5Tequal(m_type, H5T_STD_REF)) { + ref_opts = *opts; + ref_opts.obj_name[0] = NULL; + ref_opts.obj_name[1] = NULL; + if (H5Tequal(ref_opts.m_tid, H5T_STD_REF)) { /* if (type_size == H5R_STD_REF_SIZE) */ hid_t region1_id = H5I_INVALID_HID; hid_t region2_id = H5I_INVALID_HID; @@ -730,66 +774,67 @@ diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t idx, int rank, H5O_type_t obj2_type = -1; /* Object type */ H5R_type_t ref_type; /* Reference type */ - H5TOOLS_DEBUG("diff_datum H5T_REFERENCE - H5T_STD_REF"); + H5TOOLS_DEBUG("H5T_REFERENCE - H5T_STD_REF"); ref_type = H5Rget_type(ref1_buf); switch (ref_type) { case H5R_OBJECT1: H5TOOLS_DEBUG("ref_type is H5R_OBJECT1"); - if (H5Rget_obj_type3(ref1_buf, H5P_DEFAULT, &obj1_type) < 0) { - opts->err_stat = H5DIFF_ERR; - H5TOOLS_INFO("H5Rget_obj_type3 object 1 failed"); - } - if (H5Rget_obj_type3(ref2_buf, H5P_DEFAULT, &obj2_type) < 0) { - opts->err_stat = H5DIFF_ERR; - H5TOOLS_INFO("H5Rget_obj_type3 object 2 failed"); - } - - /* check object type */ - if (obj1_type != obj2_type) { - parallel_print("Different object types referenced: <%s> and <%s>", obj1, obj2); - opts->not_cmp = 1; - H5TOOLS_GOTO_DONE(opts->err_stat); - } - - if((obj1_id = H5Ropen_object(ref1_buf, H5P_DEFAULT, H5P_DEFAULT)) < 0) { - opts->err_stat = H5DIFF_ERR; - H5TOOLS_INFO("H5Ropen_object object 1 failed"); - } - if((obj2_id = H5Ropen_object(ref2_buf, H5P_DEFAULT, H5P_DEFAULT)) < 0) { - opts->err_stat = H5DIFF_ERR; - H5TOOLS_INFO("H5Ropen_object object 2 failed"); - } - - switch (obj1_type) { - case H5O_TYPE_DATASET: - nfound = diff_datasetid(obj1_id, obj2_id, NULL, NULL, opts); - break; - - case H5O_TYPE_GROUP: - case H5O_TYPE_NAMED_DATATYPE: - case H5O_TYPE_MAP: - case H5O_TYPE_UNKNOWN: - case H5O_TYPE_NTYPES: - default: - if (opts->m_verbose) - parallel_print("Warning: Comparison not possible of object types referenced: <%s> and <%s>\n", obj1, obj2); - opts->not_cmp = 1; - break; - } /* end switch */ - if(obj1_id >= 0) - if(H5Oclose(obj1_id) < 0) { - opts->err_stat = H5DIFF_ERR; - H5TOOLS_INFO("H5Oclose H5R_OBJECT1 failed"); + if (H5Rget_obj_type3(ref1_buf, H5P_DEFAULT, &obj1_type) >= 0) { + if (H5Rget_obj_type3(ref2_buf, H5P_DEFAULT, &obj2_type) >= 0) { + /* check object type */ + if (obj1_type == obj2_type) { + switch (obj1_type) { + case H5O_TYPE_DATASET: + if((obj1_id = H5Ropen_object(ref1_buf, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { + if((obj2_id = H5Ropen_object(ref2_buf, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { + nfound = diff_datasetid(obj1_id, obj2_id, opts->obj_name[0], opts->obj_name[1], &ref_opts); + if(H5Dclose(obj2_id) < 0) { + ref_opts.err_stat = H5DIFF_ERR; + H5TOOLS_INFO("H5Dclose H5R_OBJECT1 failed"); + } + } + else { + ref_opts.err_stat = H5DIFF_ERR; + H5TOOLS_INFO("H5Ropen_object object 2 failed"); + } + if(H5Dclose(obj1_id) < 0) { + ref_opts.err_stat = H5DIFF_ERR; + H5TOOLS_INFO("H5Dclose H5R_OBJECT1 failed"); + } + } + else { + ref_opts.err_stat = H5DIFF_ERR; + H5TOOLS_INFO("H5Ropen_object object 1 failed"); + } + break; + + case H5O_TYPE_GROUP: + case H5O_TYPE_NAMED_DATATYPE: + case H5O_TYPE_MAP: + case H5O_TYPE_UNKNOWN: + case H5O_TYPE_NTYPES: + default: + if (ref_opts.mode_verbose) + parallel_print("Warning: Comparison not possible of object types referenced: <%s> and <%s>\n", opts->obj_name[0], opts->obj_name[1]); + ref_opts.not_cmp = 1; + break; + } /* end switch */ + } + else { + parallel_print("Different object types referenced: <%s> and <%s>", opts->obj_name[0], opts->obj_name[1]); + ref_opts.not_cmp = 1; + ref_opts.err_stat = H5DIFF_ERR; + } } - if(obj2_id >= 0) - if(H5Oclose(obj2_id) < 0) { - opts->err_stat = H5DIFF_ERR; - H5TOOLS_INFO("H5Oclose H5R_OBJECT1 failed"); + else { + ref_opts.err_stat = H5DIFF_ERR; + H5TOOLS_INFO("H5Rget_obj_type3 object 2 failed"); } - if(H5Rdestroy(ref2_buf) < 0) - H5TOOLS_ERROR(H5DIFF_ERR, "H5Rdestroy H5R_OBJECT1 failed"); - if(H5Rdestroy(ref1_buf) < 0) - H5TOOLS_ERROR(H5DIFF_ERR, "H5Rdestroy H5R_OBJECT1 failed"); + } + else { + ref_opts.err_stat = H5DIFF_ERR; + H5TOOLS_INFO("H5Rget_obj_type3 object 1 failed"); + } break; case H5R_DATASET_REGION1: H5TOOLS_DEBUG("ref_type is H5R_DATASET_REGION1"); @@ -797,149 +842,143 @@ diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t idx, int rank, if((obj2_id = H5Ropen_object(ref2_buf, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { if((region1_id = H5Ropen_region(ref1_buf, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { if((region2_id = H5Ropen_region(ref2_buf, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { - nfound = diff_region(obj1_id, obj2_id, region1_id, region2_id, opts); + nfound = diff_region(obj1_id, obj2_id, region1_id, region2_id, &ref_opts); if(H5Sclose(region2_id) < 0) - H5TOOLS_ERROR(H5DIFF_ERR, "H5Sclose H5R_DATASET_REGION1 failed"); + H5TOOLS_INFO("H5Sclose H5R_DATASET_REGION1 failed"); } if(H5Sclose(region1_id) < 0) - H5TOOLS_ERROR(H5DIFF_ERR, "H5Sclose H5R_DATASET_REGION1 failed"); + H5TOOLS_INFO("H5Sclose H5R_DATASET_REGION1 failed"); } - if(H5Oclose(obj2_id) < 0) - H5TOOLS_ERROR(H5DIFF_ERR, "H5Oclose H5R_DATASET_REGION1 failed"); + if(H5Dclose(obj2_id) < 0) + H5TOOLS_INFO("H5Oclose H5R_DATASET_REGION1 failed"); } else { - H5TOOLS_ERROR(H5DIFF_ERR, "H5Ropen_object H5R_DATASET_REGION1 failed"); + H5TOOLS_INFO("H5Ropen_object H5R_DATASET_REGION1 failed"); } - if(H5Oclose(obj1_id) < 0) - H5TOOLS_ERROR(H5DIFF_ERR, "H5Oclose H5R_DATASET_REGION1 failed"); + if(H5Dclose(obj1_id) < 0) + H5TOOLS_INFO("H5Oclose H5R_DATASET_REGION1 failed"); } else { - H5TOOLS_ERROR(H5DIFF_ERR, "H5Ropen_object H5R_DATASET_REGION1 failed"); + H5TOOLS_INFO("H5Ropen_object H5R_DATASET_REGION1 failed"); } - if(H5Rdestroy(ref2_buf) < 0) - H5TOOLS_ERROR(H5DIFF_ERR, "H5Rdestroy H5R_DATASET_REGION1 failed"); - if(H5Rdestroy(ref1_buf) < 0) - H5TOOLS_ERROR(H5DIFF_ERR, "H5Rdestroy H5R_DATASET_REGION1 failed"); break; case H5R_OBJECT2: H5TOOLS_DEBUG("ref_type is H5R_OBJECT2"); - if (H5Rget_obj_type3(ref1_buf, H5P_DEFAULT, &obj1_type) < 0) { - opts->err_stat = H5DIFF_ERR; - H5TOOLS_INFO("H5Rget_obj_type3 object 1 failed"); - } - if (H5Rget_obj_type3(ref2_buf, H5P_DEFAULT, &obj2_type) < 0) { - opts->err_stat = H5DIFF_ERR; - H5TOOLS_INFO("H5Rget_obj_type3 object 2 failed"); - } - - /* check object type */ - if (obj1_type != obj2_type) { - parallel_print("Different object types referenced: <%s> and <%s>", obj1, obj2); - opts->not_cmp = 1; - H5TOOLS_GOTO_DONE(opts->err_stat); - } - - if((obj1_id = H5Ropen_object(ref1_buf, H5P_DEFAULT, H5P_DEFAULT)) < 0) { - opts->err_stat = H5DIFF_ERR; - H5TOOLS_INFO("H5Ropen_object object 1 failed"); - } - if((obj2_id = H5Ropen_object(ref2_buf, H5P_DEFAULT, H5P_DEFAULT)) < 0) { - opts->err_stat = H5DIFF_ERR; - H5TOOLS_INFO("H5Ropen_object object 2 failed"); - } - - switch (obj1_type) { - case H5O_TYPE_DATASET: - H5TOOLS_DEBUG("ref_type is H5R_OBJECT2 : DATASET"); - nfound = diff_datasetid(obj1_id, obj2_id, NULL, NULL, opts); - break; - - case H5O_TYPE_GROUP: - H5TOOLS_DEBUG("ref_type is H5R_OBJECT2 : GROUP"); - if (opts->m_verbose) - parallel_print("Warning: Comparison not possible of group object types referenced: <%s> and <%s>\n", obj1, obj2); - opts->not_cmp = 1; - break; - - case H5O_TYPE_NAMED_DATATYPE: - H5TOOLS_DEBUG("ref_type is H5R_OBJECT2 : NAMED"); - if (opts->m_verbose) - parallel_print("Warning: Comparison not possible of named datatypes object types referenced: <%s> and <%s>\n", obj1, obj2); - opts->not_cmp = 1; - break; - - case H5O_TYPE_MAP: - case H5O_TYPE_UNKNOWN: - case H5O_TYPE_NTYPES: - default: - if (opts->m_verbose) - parallel_print("Warning: Comparison not possible of object types referenced: <%s> and <%s>\n", obj1, obj2); - opts->not_cmp = 1; - break; - } /* end switch */ - if(obj1_id >= 0) - if(H5Oclose(obj1_id) < 0) { - opts->err_stat = H5DIFF_ERR; - H5TOOLS_INFO("H5Oclose H5R_OBJECT2 failed"); + if (H5Rget_obj_type3(ref1_buf, H5P_DEFAULT, &obj1_type) >= 0) { + if (H5Rget_obj_type3(ref2_buf, H5P_DEFAULT, &obj2_type) >= 0) { + /* check object type */ + if (obj1_type == obj2_type) { + if((obj1_id = H5Ropen_object(ref1_buf, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { + if((obj2_id = H5Ropen_object(ref2_buf, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { + switch (obj1_type) { + case H5O_TYPE_DATASET: + H5TOOLS_DEBUG("ref_type is H5R_OBJECT2 : DATASET"); + nfound = diff_datasetid(obj1_id, obj2_id, opts->obj_name[0], opts->obj_name[1], &ref_opts); + break; + + case H5O_TYPE_GROUP: + H5TOOLS_DEBUG("ref_type is H5R_OBJECT2 : GROUP"); + if (ref_opts.mode_verbose) + parallel_print("Warning: Comparison not possible of group object types referenced: <%s> and <%s>\n", opts->obj_name[0], opts->obj_name[1]); + ref_opts.not_cmp = 1; + break; + + case H5O_TYPE_NAMED_DATATYPE: + H5TOOLS_DEBUG("ref_type is H5R_OBJECT2 : NAMED"); + if (ref_opts.mode_verbose) + parallel_print("Warning: Comparison not possible of named datatypes object types referenced: <%s> and <%s>\n", opts->obj_name[0], opts->obj_name[1]); + ref_opts.not_cmp = 1; + break; + + case H5O_TYPE_MAP: + case H5O_TYPE_UNKNOWN: + case H5O_TYPE_NTYPES: + default: + if (ref_opts.mode_verbose) + parallel_print("Warning: Comparison not possible of object types referenced: <%s> and <%s>\n", opts->obj_name[0], opts->obj_name[1]); + ref_opts.not_cmp = 1; + break; + } /* end switch */ + if(H5Oclose(obj2_id) < 0) { + ref_opts.err_stat = H5DIFF_ERR; + H5TOOLS_INFO("H5Oclose H5R_OBJECT2 failed"); + } + } + else { + ref_opts.err_stat = H5DIFF_ERR; + H5TOOLS_INFO("H5Ropen_object object 2 failed"); + } + if(H5Oclose(obj1_id) < 0) { + ref_opts.err_stat = H5DIFF_ERR; + H5TOOLS_INFO("H5Oclose H5R_OBJECT2 failed"); + } + } + else { + ref_opts.err_stat = H5DIFF_ERR; + H5TOOLS_INFO("H5Ropen_object object 1 failed"); + } + } + else { + parallel_print("Different object types referenced: <%s> and <%s>", opts->obj_name[0], opts->obj_name[1]); + ref_opts.not_cmp = 1; + ref_opts.err_stat = H5DIFF_ERR; + } } - if(obj2_id >= 0) - if(H5Oclose(obj2_id) < 0) { - opts->err_stat = H5DIFF_ERR; - H5TOOLS_INFO("H5Oclose H5R_OBJECT2 failed"); + else { + ref_opts.err_stat = H5DIFF_ERR; + H5TOOLS_INFO("H5Rget_obj_type3 object 2 failed"); } - if(H5Rdestroy(ref2_buf) < 0) - H5TOOLS_ERROR(H5DIFF_ERR, "H5Rdestroy H5R_OBJECT2 failed"); - if(H5Rdestroy(ref1_buf) < 0) - H5TOOLS_ERROR(H5DIFF_ERR, "H5Rdestroy H5R_OBJECT2 failed"); + } + else { + ref_opts.err_stat = H5DIFF_ERR; + H5TOOLS_INFO("H5Rget_obj_type3 object 1 failed"); + } break; case H5R_DATASET_REGION2: H5TOOLS_DEBUG("ref_type is H5R_DATASET_REGION2"); /* if (obj_id < 0) - could mean that no reference was written do not throw failure */ - obj1_id = H5Ropen_object(ref1_buf, H5P_DEFAULT, H5P_DEFAULT); - obj2_id = H5Ropen_object(ref2_buf, H5P_DEFAULT, H5P_DEFAULT); - if((obj1_id < 0) || (obj2_id < 0)) { - H5TOOLS_INFO("H5Ropen_object H5R_DATASET_REGION2 failed"); + if((obj1_id = H5Ropen_object(ref1_buf, H5P_DEFAULT, H5P_DEFAULT)) < 0) { + H5TOOLS_INFO("H5Ropen_object H5R_DATASET_REGION2 object 1 failed"); } else { - H5TOOLS_DEBUG("open_region - H5R_DATASET_REGION2"); - if((region1_id = H5Ropen_region(ref1_buf, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { - if (h5tools_is_zero(ref1_buf, H5Tget_size(H5T_STD_REF))) { - H5TOOLS_DEBUG("NULL H5R_DATASET_REGION2"); - } - else { - if((region2_id = H5Ropen_region(ref2_buf, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { - if (h5tools_is_zero(ref2_buf, H5Tget_size(H5T_STD_REF))) { - H5TOOLS_DEBUG("NULL H5R_DATASET_REGION2"); - } - else { - nfound = diff_region(obj1_id, obj2_id, region1_id, region2_id, opts); - } - if(H5Sclose(region2_id) < 0) - H5TOOLS_ERROR(H5DIFF_ERR, "H5Sclose H5R_DATASET_REGION2 failed"); + if((obj2_id = H5Ropen_object(ref2_buf, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { + H5TOOLS_DEBUG("open_region - H5R_DATASET_REGION2"); + if((region1_id = H5Ropen_region(ref1_buf, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { + if (h5tools_is_zero(ref1_buf, H5Tget_size(H5T_STD_REF))) { + H5TOOLS_DEBUG("NULL H5R_DATASET_REGION2"); } - else - H5TOOLS_ERROR(H5DIFF_ERR, "H5Ropen_region H5R_DATASET_REGION2 failed"); - } /* end else to if (h5tools_is_zero(... */ - if(H5Sclose(region1_id) < 0) - H5TOOLS_ERROR(H5DIFF_ERR, "H5Sclose H5R_DATASET_REGION2 failed"); - } - else - H5TOOLS_ERROR(H5DIFF_ERR, "H5Ropen_region H5R_DATASET_REGION2 failed"); - if (obj1_id >= 0) - if(H5Dclose(obj1_id) < 0) { - opts->err_stat = H5DIFF_ERR; - H5TOOLS_INFO("H5Dclose H5R_DATASET_REGION2 failed"); + else { + if((region2_id = H5Ropen_region(ref2_buf, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { + if (h5tools_is_zero(ref2_buf, H5Tget_size(H5T_STD_REF))) { + H5TOOLS_DEBUG("NULL H5R_DATASET_REGION2"); + } + else { + nfound = diff_region(obj1_id, obj2_id, region1_id, region2_id, &ref_opts); + } + if(H5Sclose(region2_id) < 0) + H5TOOLS_INFO("H5Sclose H5R_DATASET_REGION2 failed"); + } + else + H5TOOLS_INFO("H5Ropen_region H5R_DATASET_REGION2 failed"); + } /* end else to if (h5tools_is_zero(... */ + if(H5Sclose(region1_id) < 0) + H5TOOLS_INFO("H5Sclose H5R_DATASET_REGION2 failed"); } - if (obj2_id >= 0) + else + H5TOOLS_ERROR(H5DIFF_ERR, "H5Ropen_region H5R_DATASET_REGION2 failed"); if(H5Dclose(obj2_id) < 0) { - opts->err_stat = H5DIFF_ERR; + ref_opts.err_stat = H5DIFF_ERR; H5TOOLS_INFO("H5Dclose H5R_DATASET_REGION2 failed"); } - if(H5Rdestroy(ref1_buf) < 0) - H5TOOLS_ERROR(H5DIFF_ERR, "H5Rdestroy H5R_DATASET_REGION2 failed"); - if(H5Rdestroy(ref2_buf) < 0) - H5TOOLS_ERROR(H5DIFF_ERR, "H5Rdestroy H5R_DATASET_REGION2 failed"); + } + else { + H5TOOLS_INFO("H5Ropen_object H5R_DATASET_REGION2 object 2 failed"); + } + if(H5Dclose(obj1_id) < 0) { + ref_opts.err_stat = H5DIFF_ERR; + H5TOOLS_INFO("H5Dclose H5R_DATASET_REGION2 failed"); + } } break; case H5R_ATTR: @@ -948,44 +987,42 @@ diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t idx, int rank, char name2[ATTR_NAME_MAX]; H5TOOLS_DEBUG("ref_type is H5R_ATTR"); - if((obj1_id = H5Ropen_attr(ref1_buf, H5P_DEFAULT, H5P_DEFAULT)) < 0) { - parallel_print("Warning: Cannot open referenced attribute: attribute 1\n"); - H5TOOLS_INFO("H5Ropen_attr object 1 failed"); - } - if((obj2_id = H5Ropen_attr(ref2_buf, H5P_DEFAULT, H5P_DEFAULT)) < 0) { - parallel_print("Warning: Cannot open referenced attribute: attribute 2\n"); - H5TOOLS_INFO("H5Ropen_attr object 2 failed"); - } - - if((obj1_id < 0) || (obj2_id < 0)) { - H5TOOLS_INFO("H5Ropen_attr H5R_ATTR failed"); - } - else { - /* get name */ - if(H5Aget_name(obj1_id, (size_t)ATTR_NAME_MAX, name1) < 0) - H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Aget_name first attribute failed"); - /* get name */ - if(H5Aget_name(obj2_id, (size_t)ATTR_NAME_MAX, name2) < 0) - H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Aget_name second attribute failed"); - - H5TOOLS_DEBUG("H5R_ATTR diff_attr_data - name1=%s, name2=%s", name1, name2); - nfound = diff_attr_data(obj1_id, obj2_id, name1, name2, NULL, NULL, opts); - } + if((obj1_id = H5Ropen_attr(ref1_buf, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { + if((obj2_id = H5Ropen_attr(ref2_buf, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { + /* get name */ + if(H5Aget_name(obj1_id, (size_t)ATTR_NAME_MAX, name1) >= 0) { + /* get name */ + if(H5Aget_name(obj2_id, (size_t)ATTR_NAME_MAX, name2) >= 0) { + H5TOOLS_DEBUG("H5R_ATTR diff_attr_data - name1=%s, name2=%s", name1, name2); + nfound = diff_attr_data(obj1_id, obj2_id, name1, name2, opts->obj_name[0], opts->obj_name[1], &ref_opts); + } + else { + ref_opts.err_stat = H5DIFF_ERR; + H5TOOLS_INFO("H5Aget_name second attribute failed"); + } + } + else { + ref_opts.err_stat = H5DIFF_ERR; + H5TOOLS_INFO("H5Aget_name first attribute failed"); + } - if(obj1_id >= 0) - if(H5Aclose(obj1_id) < 0) { - opts->err_stat = H5DIFF_ERR; - H5TOOLS_INFO("H5Aclose H5R_ATTR failed"); + if(H5Aclose(obj2_id) < 0) { + ref_opts.err_stat = H5DIFF_ERR; + H5TOOLS_INFO("H5Aclose H5R_ATTR failed"); + } + } + else { + parallel_print("Warning: Cannot open referenced attribute2\n"); + H5TOOLS_INFO("H5Ropen_attr object 2 failed"); } - if(obj2_id >= 0) - if(H5Aclose(obj2_id) < 0) { - opts->err_stat = H5DIFF_ERR; + if(H5Aclose(obj1_id) < 0) { H5TOOLS_INFO("H5Aclose H5R_ATTR failed"); } - if(H5Rdestroy(ref2_buf) < 0) - H5TOOLS_ERROR(H5DIFF_ERR, "H5Rdestroy H5R_ATTR failed"); - if(H5Rdestroy(ref1_buf) < 0) - H5TOOLS_ERROR(H5DIFF_ERR, "H5Rdestroy H5R_ATTR failed"); + } + else { + parallel_print("Warning: Cannot open referenced attribute1\n"); + H5TOOLS_INFO("H5Ropen_attr object 1 failed"); + } } break; case H5R_BADTYPE: @@ -993,43 +1030,20 @@ diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t idx, int rank, default: break; } /* end switch */ - H5TOOLS_DEBUG("diff_datum H5T_REFERENCE - H5T_STD_REF complete nfound:%d - errstat:%d", nfound, opts->err_stat); + if(H5Rdestroy(ref2_buf) < 0) + H5TOOLS_INFO("H5Rdestroy H5R_OBJECT1 failed"); + if(H5Rdestroy(ref1_buf) < 0) + H5TOOLS_INFO("H5Rdestroy H5R_OBJECT1 failed"); + H5TOOLS_DEBUG("H5T_REFERENCE - H5T_STD_REF complete nfound:%d - errstat:%d", nfound, ref_opts.err_stat); } /*------------------------------------------------------------------------- * H5T_STD_REF_DSETREG * Dataset region reference *------------------------------------------------------------------------- */ - else if (H5Tequal(m_type, H5T_STD_REF_DSETREG)) { + else if (H5Tequal(ref_opts.m_tid, H5T_STD_REF_DSETREG)) { /* if (type_size == H5R_DSET_REG_REF_BUF_SIZE) */ - hid_t region1_id = H5I_INVALID_HID; - hid_t region2_id = H5I_INVALID_HID; - - H5TOOLS_INFO("H5T_STD_REF_DSETREG reference type"); - - if ((obj1_id = H5Rdereference2(container1_id, H5P_DEFAULT, H5R_DATASET_REGION, _mem1)) < 0) { - opts->err_stat = H5DIFF_ERR; - H5TOOLS_INFO("H5Rdereference2 object 1 failed"); - } - if ((obj2_id = H5Rdereference2(container2_id, H5P_DEFAULT, H5R_DATASET_REGION, _mem2)) < 0) { - opts->err_stat = H5DIFF_ERR; - H5TOOLS_INFO("H5Rdereference2 object 2 failed"); - } - if ((region1_id = H5Rget_region(container1_id, H5R_DATASET_REGION, _mem1)) < 0) { - opts->err_stat = H5DIFF_ERR; - H5TOOLS_INFO("H5Rget_region object 1 failed"); - } - if ((region2_id = H5Rget_region(container2_id, H5R_DATASET_REGION, _mem2)) < 0) { - opts->err_stat = H5DIFF_ERR; - H5TOOLS_INFO("H5Rget_region object 2 failed"); - } - - nfound = diff_region(obj1_id, obj2_id, region1_id, region2_id, opts); - - H5Oclose(obj1_id); - H5Oclose(obj2_id); - H5Sclose(region1_id); - H5Sclose(region2_id); + H5TOOLS_DEBUG("H5T_STD_REF_DSETREG"); }/*dataset reference*/ /*------------------------------------------------------------------------- @@ -1037,52 +1051,15 @@ diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t idx, int rank, * Object references. get the type and OID of the referenced object *------------------------------------------------------------------------- */ - else if (H5Tequal(m_type, H5T_STD_REF_OBJ)) { + else if (H5Tequal(ref_opts.m_tid, H5T_STD_REF_OBJ)) { /* if (type_size == H5R_OBJ_REF_BUF_SIZE) */ - H5O_type_t obj1_type; - H5O_type_t obj2_type; - - H5TOOLS_INFO("H5T_STD_REF_OBJ reference type"); - - if (H5Rget_obj_type2(container1_id, H5R_OBJECT, _mem1, &obj1_type) < 0) { - opts->err_stat = H5DIFF_ERR; - H5TOOLS_INFO("H5Rget_obj_type2 object 1 failed"); - } - if (H5Rget_obj_type2(container2_id, H5R_OBJECT, _mem2, &obj2_type) < 0) { - opts->err_stat = H5DIFF_ERR; - H5TOOLS_INFO("H5Rget_obj_type2 object 2 failed"); - } - - /* check object type */ - if (obj1_type != obj2_type) { - parallel_print("Different object types referenced: <%s> and <%s>", obj1, obj2); - opts->not_cmp = 1; - H5TOOLS_GOTO_DONE(opts->err_stat); - } - - if ((obj1_id = H5Rdereference2(container1_id, H5P_DEFAULT, H5R_OBJECT, _mem1)) < 0) { - opts->err_stat = H5DIFF_ERR; - H5TOOLS_INFO("H5Rdereference2 object 1 failed"); - } - if ((obj2_id = H5Rdereference2(container2_id, H5P_DEFAULT, H5R_OBJECT, _mem2)) < 0) { - opts->err_stat = H5DIFF_ERR; - H5TOOLS_INFO("H5Rdereference2 object 2 failed"); - } - - /* compare */ - if (obj1_type == H5O_TYPE_DATASET) - nfound = diff_datasetid(obj1_id, obj2_id, NULL, NULL, opts); - else { - if (opts->m_verbose) - parallel_print("Warning: Comparison not possible of object types referenced: <%s> and <%s>\n", obj1, obj2); - opts->not_cmp = 1; - } - - H5Oclose(obj1_id); - H5Oclose(obj2_id); + H5TOOLS_DEBUG("H5T_STD_REF_OBJ"); }/*object reference*/ + opts->print_header = ref_opts.print_header; + opts->not_cmp = ref_opts.not_cmp; + opts->err_stat = ref_opts.err_stat | ret_value; }/*is zero*/ - H5TOOLS_DEBUG("diff_datum H5T_REFERENCE complete"); + H5TOOLS_DEBUG("H5T_REFERENCE complete"); break; /*------------------------------------------------------------------------- @@ -1091,21 +1068,26 @@ diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t idx, int rank, */ case H5T_VLEN: { - hid_t memb_type = H5I_INVALID_HID; + diff_opt_t vl_opts; - H5TOOLS_DEBUG("diff_datum H5T_VLEN"); + H5TOOLS_DEBUG("H5T_VLEN"); + + vl_opts = *opts; /* get the VL sequences's base datatype for each element */ - memb_type = H5Tget_super(m_type); - size = H5Tget_size(memb_type); + vl_opts.m_tid = H5Tget_super(opts->m_tid); + size = H5Tget_size(vl_opts.m_tid); /* get the number of sequence elements */ - nelmts = ((hvl_t *)((void *)mem1))->len; + vl_opts.hs_nelmts = ((hvl_t *)((void *)mem1))->len; - for (j = 0; j < nelmts; j++) - nfound += diff_datum(((char *) (((hvl_t *)((void *)mem1))->p)) + j * size, ((char *) (((hvl_t *)((void *)mem2))->p)) + j * size, memb_type, idx, /* Extra (void *) cast to quiet "cast to create alignment" warning - 2019/07/05, QAK */ - rank, dims, acc, pos, opts, obj1, obj2, container1_id, container2_id, ph, members); + for (j = 0; j < vl_opts.hs_nelmts; j++) + nfound += diff_datum(((char *) (((hvl_t *)((void *)mem1))->p)) + j * size, ((char *) (((hvl_t *)((void *)mem2))->p)) + j * size, elemtno, /* Extra (void *) cast to quiet "cast to create alignment" warning - 2019/07/05, QAK */ + &vl_opts, container1_id, container2_id, members); + opts->print_header = vl_opts.print_header; + opts->not_cmp = vl_opts.not_cmp; + opts->err_stat = opts->err_stat | vl_opts.err_stat; - H5Tclose(memb_type); + H5Tclose(vl_opts.m_tid); } break; @@ -1114,81 +1096,16 @@ diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t idx, int rank, *------------------------------------------------------------------------- */ case H5T_INTEGER: - H5TOOLS_DEBUG("diff_datum H5T_INTEGER"); - type_sign = H5Tget_sign(m_type); + H5TOOLS_DEBUG("H5T_INTEGER"); + type_sign = H5Tget_sign(opts->m_tid); /*------------------------------------------------------------------------- * H5T_NATIVE_SCHAR *------------------------------------------------------------------------- */ if (type_size == 1 && type_sign != H5T_SGN_NONE) { - char temp1_char; - char temp2_char; - if(type_size != sizeof(char)) H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not char size"); - HDmemcpy(&temp1_char, mem1, sizeof(char)); - HDmemcpy(&temp2_char, mem2, sizeof(char)); - /* -d and !-p */ - if (opts->d && !opts->p) { - if (ABS(temp1_char-temp2_char) > opts->delta) { - if (print_data(opts)) { - print_pos(ph, 0, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT, temp1_char, temp2_char, ABS(temp1_char - temp2_char)); - } - nfound++; - } - } - /* !-d and -p */ - else if (!opts->d && opts->p) { - PER(temp1_char, temp2_char); - - if (not_comparable && !both_zero) { - if (print_data(opts)) { - print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P_NOTCOMP, temp1_char, temp2_char, ABS(temp1_char - temp2_char)); - } - nfound++; - } - else if (per > opts->percent) { - if (print_data(opts)) { - print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P, temp1_char, temp2_char, ABS(temp1_char - temp2_char), per); - } - nfound++; - } - } - /* -d and -p */ - else if (opts->d && opts->p) { - PER(temp1_char, temp2_char); - - if (not_comparable && !both_zero) { - if (print_data(opts)) { - print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P_NOTCOMP, temp1_char, temp2_char, ABS(temp1_char - temp2_char)); - } - nfound++; - } - else if (per > opts->percent && ABS(temp1_char - temp2_char) > opts->delta) { - if (print_data(opts)) { - print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P, temp1_char, temp2_char, ABS(temp1_char - temp2_char), per); - } - nfound++; - } - } - else if (temp1_char != temp2_char) { - if (print_data(opts)) { - print_pos(ph, 0, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT, temp1_char, temp2_char, ABS(temp1_char - temp2_char)); - } - nfound++; - } + nfound += diff_schar_element(mem1, mem2, elemtno, opts); } /*H5T_NATIVE_SCHAR*/ /*------------------------------------------------------------------------- @@ -1196,75 +1113,9 @@ diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t idx, int rank, *------------------------------------------------------------------------- */ else if (type_size == 1 && type_sign == H5T_SGN_NONE) { - unsigned char temp1_uchar; - unsigned char temp2_uchar; - if(type_size != sizeof(unsigned char)) H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not unsigned char size"); - - HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char)); - HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char)); - /* -d and !-p */ - if (opts->d && !opts->p) { - if (PDIFF(temp1_uchar, temp2_uchar) > opts->delta) { - if (print_data(opts)) { - print_pos(ph, 0, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar)); - } - nfound++; - } - } - /* !-d and -p */ - else if (!opts->d && opts->p) { - PER_UNSIGN(signed char, temp1_uchar, temp2_uchar); - - if (not_comparable && !both_zero) { - if (print_data(opts)) { - print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P_NOTCOMP, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar)); - } - nfound++; - } - else if (per > opts->percent) { - if (print_data(opts)) { - print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar), per); - } - nfound++; - } - } - /* -d and -p */ - else if (opts->d && opts->p) { - PER_UNSIGN(signed char, temp1_uchar, temp2_uchar); - - if (not_comparable && !both_zero) { - if (print_data(opts)) { - print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P_NOTCOMP, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar)); - } - nfound++; - } - else if (per > opts->percent && PDIFF(temp1_uchar, temp2_uchar) > opts->delta) { - if (print_data(opts)) { - print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar), per); - } - nfound++; - } - } - else if (temp1_uchar != temp2_uchar) { - if (print_data(opts)) { - print_pos(ph, 0, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar)); - } - nfound++; - } + nfound += diff_uchar_element(mem1, mem2, elemtno, opts); } /*H5T_NATIVE_UCHAR*/ /*------------------------------------------------------------------------- @@ -1272,75 +1123,9 @@ diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t idx, int rank, *------------------------------------------------------------------------- */ else if (type_size == 2 && type_sign != H5T_SGN_NONE) { - short temp1_short; - short temp2_short; - if(type_size != sizeof(short)) H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not short size"); - - HDmemcpy(&temp1_short, mem1, sizeof(short)); - HDmemcpy(&temp2_short, mem2, sizeof(short)); - /* -d and !-p */ - if (opts->d && !opts->p) { - if (ABS(temp1_short - temp2_short) > opts->delta) { - if (print_data(opts)) { - print_pos(ph, 0, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT, temp1_short, temp2_short, ABS(temp1_short - temp2_short)); - } - nfound++; - } - } - /* !-d and -p */ - else if (!opts->d && opts->p) { - PER(temp1_short, temp2_short); - - if (not_comparable && !both_zero) { - if (print_data(opts)) { - print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P_NOTCOMP, temp1_short, temp2_short, ABS(temp1_short - temp2_short)); - } - nfound++; - } - else if (per > opts->percent) { - if (print_data(opts)) { - print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P, temp1_short, temp2_short, ABS(temp1_short - temp2_short), per); - } - nfound++; - } - } - /* -d and -p */ - else if (opts->d && opts->p) { - PER(temp1_short, temp2_short); - - if (not_comparable && !both_zero) { - if (print_data(opts)) { - print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P_NOTCOMP, temp1_short, temp2_short, ABS(temp1_short - temp2_short)); - } - nfound++; - } - else if (per > opts->percent && ABS(temp1_short - temp2_short) > opts->delta) { - if (print_data(opts)) { - print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P, temp1_short, temp2_short, ABS(temp1_short - temp2_short), per); - } - nfound++; - } - } - else if (temp1_short != temp2_short) { - if (print_data(opts)) { - print_pos(ph, 0, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT, temp1_short, temp2_short, ABS(temp1_short - temp2_short)); - } - nfound++; - } + nfound += diff_short_element(mem1, mem2, elemtno, opts); } /*H5T_NATIVE_SHORT*/ /*------------------------------------------------------------------------- @@ -1348,227 +1133,29 @@ diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t idx, int rank, *------------------------------------------------------------------------- */ else if (type_size == 2 && type_sign == H5T_SGN_NONE) { - unsigned short temp1_ushort; - unsigned short temp2_ushort; - if(type_size != sizeof(unsigned short)) H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not unsigned short size"); + nfound += diff_ushort_element(mem1, mem2, elemtno, opts); + } /*H5T_NATIVE_USHORT*/ - HDmemcpy(&temp1_ushort, mem1, sizeof(unsigned short)); - HDmemcpy(&temp2_ushort, mem2, sizeof(unsigned short)); - /* -d and !-p */ - if (opts->d && !opts->p) { - if (PDIFF(temp1_ushort, temp2_ushort) > opts->delta) { - if (print_data(opts)) { - print_pos(ph, 0, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort)); - } - nfound++; - } - } - /* !-d and -p */ - else if (!opts->d && opts->p) { - PER_UNSIGN(signed short, temp1_ushort, temp2_ushort); - - if (not_comparable && !both_zero) { - if (print_data(opts)) { - print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P_NOTCOMP, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort)); - } - nfound++; - } - else if (per > opts->percent) { - if (print_data(opts)) { - print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort), per); - } - nfound++; - } - } - /* -d and -p */ - else if (opts->d && opts->p) { - PER_UNSIGN(signed short, temp1_ushort, temp2_ushort); - - if (not_comparable && !both_zero) { - if (print_data(opts)) { - print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P_NOTCOMP, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort)); - } - nfound++; - } - else if (per > opts->percent && PDIFF(temp1_ushort, temp2_ushort) > opts->delta) { - if (print_data(opts)) { - print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort), per); - } - nfound++; - } - } - else if (temp1_ushort != temp2_ushort) { - if (print_data(opts)) { - print_pos(ph, 0, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort)); - } - nfound++; - } - } /*H5T_NATIVE_USHORT*/ - - /*------------------------------------------------------------------------- - * H5T_NATIVE_INT - *------------------------------------------------------------------------- - */ - else if (type_size == 4 && type_sign != H5T_SGN_NONE) { - int temp1_int; - int temp2_int; - - if(type_size != sizeof(int)) - H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not int size"); - - HDmemcpy(&temp1_int, mem1, sizeof(int)); - HDmemcpy(&temp2_int, mem2, sizeof(int)); - /* -d and !-p */ - if (opts->d && !opts->p) { - if (ABS(temp1_int-temp2_int) > opts->delta) { - if (print_data(opts)) { - print_pos(ph, 0, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT, temp1_int, temp2_int, ABS(temp1_int - temp2_int)); - } - nfound++; - } - } - /* !-d and -p */ - else if (!opts->d && opts->p) { - PER(temp1_int, temp2_int); - - if (not_comparable && !both_zero) { - if (print_data(opts)) { - print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P_NOTCOMP, temp1_int, temp2_int, ABS(temp1_int - temp2_int)); - } - nfound++; - } - else if (per > opts->percent) { - if (print_data(opts)) { - print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P, temp1_int, temp2_int, ABS(temp1_int - temp2_int), per); - } - nfound++; - } - } - /* -d and -p */ - else if (opts->d && opts->p) { - PER(temp1_int, temp2_int); - - if (not_comparable && !both_zero) { - if (print_data(opts)) { - print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P_NOTCOMP, temp1_int, temp2_int, ABS(temp1_int - temp2_int)); - } - nfound++; - } - else if (per > opts->percent && ABS(temp1_int - temp2_int) > opts->delta) { - if (print_data(opts)) { - print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P, temp1_int, temp2_int, ABS(temp1_int - temp2_int), per); - } - nfound++; - } - } - else if (temp1_int != temp2_int) { - if (print_data(opts)) { - print_pos(ph, 0, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT, temp1_int, temp2_int, ABS(temp1_int - temp2_int)); - } - nfound++; - } - } /*H5T_NATIVE_INT*/ + /*------------------------------------------------------------------------- + * H5T_NATIVE_INT + *------------------------------------------------------------------------- + */ + else if (type_size == 4 && type_sign != H5T_SGN_NONE) { + if(type_size != sizeof(int)) + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not int size"); + nfound += diff_int_element(mem1, mem2, elemtno, opts); + } /*H5T_NATIVE_INT*/ /*------------------------------------------------------------------------- * H5T_NATIVE_UINT *------------------------------------------------------------------------- */ else if (type_size == 4 && type_sign == H5T_SGN_NONE) { - unsigned int temp1_uint; - unsigned int temp2_uint; - if(type_size != sizeof(unsigned int)) H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not unsigned int size"); - - HDmemcpy(&temp1_uint, mem1, sizeof(unsigned int)); - HDmemcpy(&temp2_uint, mem2, sizeof(unsigned int)); - /* -d and !-p */ - if (opts->d && !opts->p) { - if (PDIFF(temp1_uint, temp2_uint) > opts->delta) { - if (print_data(opts)) { - print_pos(ph, 0, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(UI_FORMAT, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint)); - } - nfound++; - } - } - /* !-d and -p */ - else if (!opts->d && opts->p) { - PER_UNSIGN(signed int, temp1_uint, temp2_uint); - - if (not_comparable && !both_zero) { - if (print_data(opts)) { - print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(UI_FORMAT_P_NOTCOMP, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint)); - } - nfound++; - } - else if (per > opts->percent) { - if (print_data(opts)) { - print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(UI_FORMAT_P, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint), per); - } - nfound++; - } - } - /* -d and -p */ - else if (opts->d && opts->p) { - PER_UNSIGN(signed int, temp1_uint, temp2_uint); - - if (not_comparable && !both_zero) { - if (print_data(opts)) { - print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(UI_FORMAT_P_NOTCOMP, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint)); - } - nfound++; - } - else if (per > opts->percent && PDIFF(temp1_uint,temp2_uint) > opts->delta) { - if (print_data(opts)) { - print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(UI_FORMAT_P, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint), per); - } - nfound++; - } - } - else if (temp1_uint != temp2_uint) { - if (print_data(opts)) { - print_pos(ph, 0, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(UI_FORMAT, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint)); - } - nfound++; - } + nfound += diff_uint_element(mem1, mem2, elemtno, opts); } /*H5T_NATIVE_UINT*/ /*------------------------------------------------------------------------- @@ -1576,75 +1163,9 @@ diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t idx, int rank, *------------------------------------------------------------------------- */ else if (type_size == 8 && type_sign != H5T_SGN_NONE) { - long temp1_long; - long temp2_long; - if(type_size != sizeof(long)) H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not long size"); - - HDmemcpy(&temp1_long, mem1, sizeof(long)); - HDmemcpy(&temp2_long, mem2, sizeof(long)); - /* -d and !-p */ - if (opts->d && !opts->p) { - if (ABS(temp1_long-temp2_long) > opts->delta) { - if (print_data(opts)) { - print_pos(ph, 0, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(LI_FORMAT, temp1_long, temp2_long, ABS(temp1_long - temp2_long)); - } - nfound++; - } - } - /* !-d and -p */ - else if (!opts->d && opts->p) { - PER(temp1_long, temp2_long); - - if (not_comparable && !both_zero) { - if (print_data(opts)) { - print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(LI_FORMAT_P_NOTCOMP, temp1_long, temp2_long, ABS(temp1_long - temp2_long)); - } - nfound++; - } - else if (per > opts->percent) { - if (print_data(opts)) { - print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(LI_FORMAT_P, temp1_long, temp2_long, ABS(temp1_long - temp2_long), per); - } - nfound++; - } - } - /* -d and -p */ - else if (opts->d && opts->p) { - PER(temp1_long, temp2_long); - - if (not_comparable && !both_zero) { - if (print_data(opts)) { - print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(LI_FORMAT_P_NOTCOMP, temp1_long, temp2_long, ABS(temp1_long - temp2_long)); - } - nfound++; - } - else if (per > opts->percent && ABS(temp1_long-temp2_long) > opts->delta) { - if (print_data(opts)) { - print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(LI_FORMAT_P, temp1_long, temp2_long, ABS(temp1_long - temp2_long), per); - } - nfound++; - } - } - else if (temp1_long != temp2_long) { - if (print_data(opts)) { - print_pos(ph, 0, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(LI_FORMAT, temp1_long, temp2_long, ABS(temp1_long - temp2_long)); - } - nfound++; - } + nfound += diff_long_element(mem1, mem2, elemtno, opts); } /*H5T_NATIVE_LONG*/ /*------------------------------------------------------------------------- @@ -1652,76 +1173,30 @@ diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t idx, int rank, *------------------------------------------------------------------------- */ else if (type_size == 8 && type_sign == H5T_SGN_NONE) { - unsigned long temp1_ulong; - unsigned long temp2_ulong; - if(type_size != sizeof(unsigned long)) H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not unsigned long size"); + nfound += diff_ulong_element(mem1, mem2, elemtno, opts); + } /*H5T_NATIVE_ULONG*/ - HDmemcpy(&temp1_ulong, mem1, sizeof(unsigned long)); - HDmemcpy(&temp2_ulong, mem2, sizeof(unsigned long)); - /* -d and !-p */ - if (opts->d && !opts->p) { - if (PDIFF(temp1_ulong, temp2_ulong) > opts->delta) { - if (print_data(opts)) { - print_pos(ph, 0, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(ULI_FORMAT, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong)); - } - nfound++; - } - } - /* !-d and -p */ - else if (!opts->d && opts->p) { - PER_UNSIGN(signed long, temp1_ulong, temp2_ulong); - - if (not_comparable && !both_zero) { - if (print_data(opts)) { - print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(ULI_FORMAT_P_NOTCOMP, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong)); - } - nfound++; - } - else if (per > opts->percent) { - if (print_data(opts)) { - print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(ULI_FORMAT_P, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong), per); - } - nfound++; - } - } - /* -d and -p */ - else if (opts->d && opts->p) { - PER_UNSIGN(signed long, temp1_ulong, temp2_ulong); + /*------------------------------------------------------------------------- + * H5T_NATIVE_LLONG + *------------------------------------------------------------------------- + */ + else if (type_size == 16 && type_sign != H5T_SGN_NONE) { + if(type_size != sizeof(long long)) + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not long long size"); + nfound += diff_llong_element(mem1, mem2, elemtno, opts); + } /*H5T_NATIVE_LLONG*/ - if (not_comparable && !both_zero) { - if (print_data(opts)) { - print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(ULI_FORMAT_P_NOTCOMP, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong)); - } - nfound++; - } - else if (per > opts->percent && PDIFF(temp1_ulong,temp2_ulong) > opts->delta) { - if (print_data(opts)) { - print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(ULI_FORMAT_P, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong), per); - } - nfound++; - } - } - else if (temp1_ulong != temp2_ulong) { - if (print_data(opts)) { - print_pos(ph, 0, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(ULI_FORMAT, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong)); - } - nfound++; - } - } /*H5T_NATIVE_ULONG*/ + /*------------------------------------------------------------------------- + * H5T_NATIVE_ULLONG + *------------------------------------------------------------------------- + */ + else if (type_size == 16 && type_sign == H5T_SGN_NONE) { + if(type_size != sizeof(unsigned long long)) + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not unsigned long long size"); + nfound += diff_ullong_element(mem1, mem2, elemtno, opts); + } /*H5T_NATIVE_ULLONG*/ break; /* H5T_INTEGER class */ /*------------------------------------------------------------------------- @@ -1733,319 +1208,21 @@ diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t idx, int rank, * H5T_NATIVE_FLOAT *------------------------------------------------------------------------- */ - H5TOOLS_DEBUG("diff_datum H5T_FLOAT"); + H5TOOLS_DEBUG("H5T_FLOAT"); if (type_size == 4) { - float temp1_float; - float temp2_float; - hbool_t isnan1 = FALSE; - hbool_t isnan2 = FALSE; - if(type_size != sizeof(float)) H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not float size"); - - HDmemcpy(&temp1_float, mem1, sizeof(float)); - HDmemcpy(&temp2_float, mem2, sizeof(float)); - - /* logic for detecting NaNs is different with opts -d, -p and no opts */ - - /*------------------------------------------------------------------------- - * -d and !-p - *------------------------------------------------------------------------- - */ - if (opts->d && !opts->p) { - /*------------------------------------------------------------------------- - * detect NaNs - *------------------------------------------------------------------------- - */ - if (opts->do_nans) { - isnan1 = HDisnan(temp1_float); - isnan2 = HDisnan(temp2_float); - } - - /* both not NaN, do the comparison */ - if (!isnan1 && !isnan2) { - if (ABS(temp1_float-temp2_float) > (float) opts->delta) { - if (print_data(opts)) { - print_pos(ph, 0, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float)); - } - nfound++; - } - } - /* only one is NaN, assume difference */ - else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) { - if (print_data(opts)) { - print_pos(ph, 0, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float)); - } - nfound++; - } - } - /*------------------------------------------------------------------------- - * !-d and -p - *------------------------------------------------------------------------- - */ - else if (!opts->d && opts->p) { - /*------------------------------------------------------------------------- - * detect NaNs - *------------------------------------------------------------------------- - */ - if (opts->do_nans) { - isnan1 = HDisnan(temp1_float); - isnan2 = HDisnan(temp2_float); - } - - /* both not NaN, do the comparison */ - if (!isnan1 && !isnan2) { - PER(temp1_float, temp2_float); - - if (not_comparable && !both_zero) { - if (print_data(opts)) { - print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(F_FORMAT_P_NOTCOMP, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float)); - } - nfound++; - } - else if (per > opts->percent && (double) ABS(temp1_float - temp2_float) > opts->delta) { - if (print_data(opts)) { - print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(F_FORMAT_P, (double) temp1_float, (double) temp2_float, - (double) ABS(temp1_float - temp2_float), (double) ABS(1 - temp2_float / temp1_float)); - } - nfound++; - } - } - /* only one is NaN, assume difference */ - else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) { - if (print_data(opts)) { - print_pos(ph, 0, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float)); - } - nfound++; - } - } - /*------------------------------------------------------------------------- - * -d and -p - *------------------------------------------------------------------------- - */ - else if (opts->d && opts->p) { - /*------------------------------------------------------------------------- - * detect NaNs - *------------------------------------------------------------------------- - */ - if (opts->do_nans) { - isnan1 = HDisnan(temp1_float); - isnan2 = HDisnan(temp2_float); - } - - /* both not NaN, do the comparison */ - if (!isnan1 && !isnan2) { - PER(temp1_float, temp2_float); - - if (not_comparable && !both_zero) { - if (print_data(opts)) { - print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(F_FORMAT_P_NOTCOMP, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float)); - } - nfound++; - } - else if (per > opts->percent) { - if (print_data(opts)) { - print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(F_FORMAT_P, (double) temp1_float, (double) temp2_float, - (double) ABS(temp1_float - temp2_float), (double) ABS(1 - temp2_float / temp1_float)); - } - nfound++; - } - } - /* only one is NaN, assume difference */ - else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) { - if (print_data(opts)) { - print_pos(ph, 0, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float)); - } - nfound++; - } - } - /*------------------------------------------------------------------------- - * no -d and -p - *------------------------------------------------------------------------- - */ - else if (equal_float(temp1_float, temp2_float, opts) == FALSE) { - if (print_data(opts)) { - print_pos(ph, 0, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float)); - } - nfound++; - } - } /*H5T_NATIVE_FLOAT*/ - + nfound += diff_float_element(mem1, mem2, elemtno, opts); + } /*------------------------------------------------------------------------- * H5T_NATIVE_DOUBLE *------------------------------------------------------------------------- */ else if (type_size == 8) { - double temp1_double; - double temp2_double; - hbool_t isnan1 = FALSE; - hbool_t isnan2 = FALSE; - if(type_size != sizeof(double)) H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not double size"); - - HDmemcpy(&temp1_double, mem1, sizeof(double)); - HDmemcpy(&temp2_double, mem2, sizeof(double)); - - /* logic for detecting NaNs is different with opts -d, -p and no opts */ - /*------------------------------------------------------------------------- - * -d and !-p - *------------------------------------------------------------------------- - */ - if (opts->d && !opts->p) { - /*------------------------------------------------------------------------- - * detect NaNs - *------------------------------------------------------------------------- - */ - if (opts->do_nans) { - isnan1 = HDisnan(temp1_double); - isnan2 = HDisnan(temp2_double); - } - - /* both not NaN, do the comparison */ - if (!isnan1 && !isnan2) { - if (ABS(temp1_double-temp2_double) > opts->delta) { - if (print_data(opts)) { - print_pos(ph, 0, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); - } - nfound++; - } - } - /* only one is NaN, assume difference */ - else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) { - if (print_data(opts)) { - print_pos(ph, 0, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); - } - nfound++; - } - } /* opts->d && !opts->p */ - /*------------------------------------------------------------------------- - * !-d and -p - *------------------------------------------------------------------------- - */ - else if (!opts->d && opts->p) { - /*------------------------------------------------------------------------- - * detect NaNs - *------------------------------------------------------------------------- - */ - if (opts->do_nans) { - isnan1 = HDisnan(temp1_double); - isnan2 = HDisnan(temp2_double); - } - - /* both not NaN, do the comparison */ - if (!isnan1 && !isnan2) { - PER(temp1_double, temp2_double); - - if (not_comparable && !both_zero) { - if (print_data(opts)) { - print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(F_FORMAT_P_NOTCOMP, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); - } - nfound++; - } - else if (per > opts->percent) { - if (print_data(opts)) { - print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(F_FORMAT_P, temp1_double, temp2_double, ABS(temp1_double - temp2_double), ABS(1 - temp2_double / temp1_double)); - } - nfound++; - } - } - /* only one is NaN, assume difference */ - else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) { - if (print_data(opts)) { - print_pos(ph, 0, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); - } - nfound++; - } - } - /*------------------------------------------------------------------------- - * -d and -p - *------------------------------------------------------------------------- - */ - else if (opts->d && opts->p) { - /*------------------------------------------------------------------------- - * detect NaNs - *------------------------------------------------------------------------- - */ - if (opts->do_nans) { - isnan1 = HDisnan(temp1_double); - isnan2 = HDisnan(temp2_double); - } - - /* both not NaN, do the comparison */ - if (!isnan1 && !isnan2) { - PER(temp1_double, temp2_double); - - if (not_comparable && !both_zero) { - if (print_data(opts)) { - print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(F_FORMAT_P_NOTCOMP, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); - } - nfound++; - } - else if (per > opts->percent && - ABS(temp1_double-temp2_double) > opts->delta) { - if (print_data(opts)) { - print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(F_FORMAT_P, temp1_double, temp2_double, ABS(temp1_double - temp2_double), ABS(1 - temp2_double / temp1_double)); - } - nfound++; - } - } - /* only one is NaN, assume difference */ - else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) { - if (print_data(opts)) { - print_pos(ph, 0, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); - } - nfound++; - } - } - /*------------------------------------------------------------------------- - * no -d and -p - *------------------------------------------------------------------------- - */ - else if (equal_double(temp1_double, temp2_double, opts) == FALSE) { - if (print_data(opts)) { - print_pos(ph, 0, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); - } - nfound++; - } - } /*H5T_NATIVE_DOUBLE*/ - + nfound += diff_double_element(mem1, mem2, elemtno, opts); + } #if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE /*------------------------------------------------------------------------- @@ -2053,157 +1230,10 @@ diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t idx, int rank, *------------------------------------------------------------------------- */ else if (type_size == H5_SIZEOF_LONG_DOUBLE) { - long double temp1_double; - long double temp2_double; - hbool_t isnan1 = FALSE; - hbool_t isnan2 = FALSE; - if(type_size != sizeof(long double)) { H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not long double size"); } - - HDmemcpy(&temp1_double, mem1, sizeof(long double)); - HDmemcpy(&temp2_double, mem2, sizeof(long double)); - - /* logic for detecting NaNs is different with options -d, -p and no options */ - - /*------------------------------------------------------------------------- - * -d and !-p - *------------------------------------------------------------------------- - */ - if (opts->d && !opts->p) { - /*------------------------------------------------------------------------- - * detect NaNs - *------------------------------------------------------------------------- - */ - if (opts->do_nans) { - isnan1 = HDisnan(temp1_double); - isnan2 = HDisnan(temp2_double); - } - - /* both not NaN, do the comparison */ - if (!isnan1 && !isnan2) { - if (ABS(temp1_double-temp2_double) > opts->delta) { - if (print_data(opts)) { - print_pos(ph, 0, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(LD_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); - } - nfound++; - } - } /* NaN */ - /* only one is NaN, assume difference */ - else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) { - if (print_data(opts)) { - print_pos(ph, 0, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); - } - nfound++; - } - } - /*------------------------------------------------------------------------- - * !-d and -p - *------------------------------------------------------------------------- - */ - else if (!opts->d && opts->p) { - /*------------------------------------------------------------------------- - * detect NaNs - *------------------------------------------------------------------------- - */ - if (opts->do_nans) { - isnan1 = HDisnan(temp1_double); - isnan2 = HDisnan(temp2_double); - } - - /* both not NaN, do the comparison */ - if (!isnan1 && !isnan2) { - PER(temp1_double,temp2_double); - - if (not_comparable && !both_zero) { - if (print_data(opts)) { - print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(LD_FORMAT_P_NOTCOMP, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); - } - nfound++; - } - else if (per > opts->percent) { - if (print_data(opts)) { - print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(LD_FORMAT_P, temp1_double, temp2_double, ABS(temp1_double - temp2_double), ABS(1 - temp2_double / temp1_double)); - } - nfound++; - } - } /* NaN */ - /* only one is NaN, assume difference */ - else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) { - if (print_data(opts)) { - print_pos(ph, 0, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); - } - nfound++; - } - } - /*------------------------------------------------------------------------- - * -d and -p - *------------------------------------------------------------------------- - */ - else if (opts->d && opts->p) { - /*------------------------------------------------------------------------- - * detect NaNs - *------------------------------------------------------------------------- - */ - if (opts->do_nans) { - isnan1 = HDisnan(temp1_double); - isnan2 = HDisnan(temp2_double); - } - - /* both not NaN, do the comparison */ - if (!isnan1 && !isnan2) { - PER(temp1_double,temp2_double); - - if (not_comparable && !both_zero) { - if (print_data(opts)) { - print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(LD_FORMAT_P_NOTCOMP, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); - } - nfound++; - } - else if (per > opts->percent && ABS(temp1_double-temp2_double) > opts->delta) { - if (print_data(opts)) { - print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(LD_FORMAT_P, temp1_double, temp2_double, ABS(temp1_double - temp2_double), ABS(1 - temp2_double / temp1_double)); - } - nfound++; - } - } /* NaN */ - /* only one is NaN, assume difference */ - else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) { - if (print_data(opts)) { - print_pos(ph, 0, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); - } - nfound++; - } - } - /*------------------------------------------------------------------------- - * no -d and -p - *------------------------------------------------------------------------- - */ - else if (equal_ldouble(temp1_double, temp2_double, opts) == FALSE) { - if (print_data(opts)) { - print_pos(ph, 0, idx, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(LD_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); - } - nfound++; - } + nfound += diff_ldouble_element(mem1, mem2, elemtno, opts); } /*H5T_NATIVE_LDOUBLE*/ #endif /* H5_SIZEOF_LONG_DOUBLE */ @@ -2320,8 +1350,8 @@ static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t npoints1 = H5Sget_select_elem_npoints(region1_id); npoints2 = H5Sget_select_elem_npoints(region2_id); } H5E_END_TRY; - H5TOOLS_DEBUG("diff_region blocks: 1=%ld-2=%ld", nblocks1, nblocks2); - H5TOOLS_DEBUG("diff_region points: 1=%ld-2=%ld", npoints1, npoints2); + H5TOOLS_DEBUG("blocks: 1=%ld-2=%ld", nblocks1, nblocks2); + H5TOOLS_DEBUG("points: 1=%ld-2=%ld", npoints1, npoints2); if (nblocks1 != nblocks2 || npoints1 != npoints2 || ndims1 != ndims2) { opts->not_cmp = 1; @@ -2369,7 +1399,7 @@ static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t } /* print differences if found */ - if (nfound_b && opts->m_verbose) { + if (nfound_b && opts->mode_verbose) { H5O_info2_t oi1, oi2; char *obj1_str = NULL, *obj2_str = NULL; @@ -2437,7 +1467,7 @@ static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t } } - if (nfound_p && opts->m_verbose) { + if (nfound_p && opts->mode_verbose) { parallel_print("Region points\n"); for (i = 0; i < npoints1; i++) { hsize_t pt1, pt2; @@ -2497,8 +1527,7 @@ done: *------------------------------------------------------------------------- */ -static hsize_t character_compare(char *mem1, char *mem2, hsize_t i, size_t u, - int rank, hsize_t *dims, hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1, const char *obj2, int *ph) +static hsize_t character_compare(char *mem1, char *mem2, hsize_t elemtno, size_t u, diff_opt_t *opts) { hsize_t nfound = 0; /* differences found */ char temp1_uchar; @@ -2506,12 +1535,14 @@ static hsize_t character_compare(char *mem1, char *mem2, hsize_t i, size_t u, HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char)); HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char)); - H5TOOLS_START_DEBUG(" %d=%d",temp1_uchar,temp2_uchar); + H5TOOLS_START_DEBUG(" %d=%d", temp1_uchar, temp2_uchar); if (temp1_uchar != temp2_uchar) { if (print_data(opts)) { - print_char_pos(ph, 0, i, u, acc, pos, rank, dims, obj1, obj2); - parallel_print(" "); + opts->print_percentage = 0; + opts->print_dims = 1; + print_pos(opts, elemtno, u); + parallel_print(" "); h5diff_print_char(temp1_uchar); parallel_print(" "); h5diff_print_char(temp2_uchar); @@ -2532,1953 +1563,1455 @@ static hsize_t character_compare(char *mem1, char *mem2, hsize_t i, size_t u, *------------------------------------------------------------------------- */ -static hsize_t character_compare_opt(unsigned char *mem1, unsigned char *mem2, - hsize_t i, int rank, hsize_t *dims, hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1, const char *obj2, int *ph) +static hsize_t character_compare_opt(unsigned char *mem1, unsigned char *mem2, hsize_t elemtno, diff_opt_t *opts) { hsize_t nfound = 0; /* differences found */ unsigned char temp1_uchar; unsigned char temp2_uchar; + hbool_t both_zero = FALSE; double per; - hbool_t both_zero; HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char)); HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char)); + H5TOOLS_START_DEBUG(" %d=%d", temp1_uchar, temp2_uchar); /* -d and !-p */ - if (opts->d && !opts->p) { + if (opts->delta_bool && !opts->percent_bool) { if (PDIFF(temp1_uchar,temp2_uchar) > opts->delta) { + opts->print_percentage = 0; + print_pos(opts, elemtno, 0); if (print_data(opts)) { - print_pos(ph, 0, i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); parallel_print(I_FORMAT, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar)); } nfound++; } } /* !-d and -p */ - else if (!opts->d && opts->p) { + else if (!opts->delta_bool && opts->percent_bool) { PER_UNSIGN(signed char, temp1_uchar, temp2_uchar); if (per > opts->percent) { + opts->print_percentage = 1; + print_pos(opts, elemtno, 0); if (print_data(opts)) { - print_pos(ph, 1, i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); parallel_print(I_FORMAT_P, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar), per); } nfound++; } } /* -d and -p */ - else if (opts->d && opts->p) { + else if (opts->delta_bool && opts->percent_bool) { PER_UNSIGN(signed char, temp1_uchar, temp2_uchar); if (per > opts->percent && PDIFF(temp1_uchar,temp2_uchar) > opts->delta) { + opts->print_percentage = 1; + print_pos(opts, elemtno, 0); if (print_data(opts)) { - print_pos(ph, 1, i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); parallel_print(I_FORMAT_P, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar), per); } nfound++; } } else if (temp1_uchar != temp2_uchar) { + opts->print_percentage = 0; + print_pos(opts, elemtno, 0); if (print_data(opts)) { - print_pos(ph, 0, i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); parallel_print(I_FORMAT, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar)); } nfound++; } + H5TOOLS_ENDDEBUG(": %d zero:%d", nfound, both_zero); return nfound; } /*------------------------------------------------------------------------- - * Function: diff_float + * Function: diff_float_element * - * Purpose: diff a H5T_NATIVE_FLOAT type + * Purpose: diff a single H5T_NATIVE_FLOAT type * * Return: number of differences found * *------------------------------------------------------------------------- */ -static hsize_t diff_float(unsigned char *mem1, unsigned char *mem2, - hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims, hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1, - const char *obj2, int *ph) - +static hsize_t diff_float_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts) { hsize_t nfound = 0; /* number of differences found */ float temp1_float; float temp2_float; - hsize_t i; double per; - hbool_t both_zero; + hbool_t both_zero = FALSE; hbool_t isnan1 = FALSE; hbool_t isnan2 = FALSE; + H5TOOLS_START_DEBUG("delta_bool:%d - percent_bool:%d", opts->delta_bool, opts->percent_bool); + + HDmemcpy(&temp1_float, mem1, sizeof(float)); + HDmemcpy(&temp2_float, mem2, sizeof(float)); + + /* logic for detecting NaNs is different with opts -d, -p and no opts */ + /*------------------------------------------------------------------------- * -d and !-p *------------------------------------------------------------------------- */ + if (opts->delta_bool && !opts->percent_bool) { + /*------------------------------------------------------------------------- + * detect NaNs + *------------------------------------------------------------------------- + */ + if (opts->do_nans) { + isnan1 = HDisnan(temp1_float); + isnan2 = HDisnan(temp2_float); + } - if (opts->d && !opts->p) { - for (i = 0; i < nelmts; i++) { - HDmemcpy(&temp1_float, mem1, sizeof(float)); - HDmemcpy(&temp2_float, mem2, sizeof(float)); - - /*------------------------------------------------------------------------- - * detect NaNs - *------------------------------------------------------------------------- - */ - if (opts->do_nans) { - isnan1 = HDisnan(temp1_float); - isnan2 = HDisnan(temp2_float); - } - - /* both not NaN, do the comparison */ - if (!isnan1 && !isnan2) { - if ((double) ABS(temp1_float - temp2_float) > opts->delta) { - if (print_data(opts)) { - print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float)); - } - nfound++; - } - } - /* only one is NaN, assume difference */ - else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) { + /* both not NaN, do the comparison */ + if (!isnan1 && !isnan2) { + if ((double) ABS(temp1_float - temp2_float) > opts->delta) { + opts->print_percentage = 0; + print_pos(opts, elem_idx, 0); if (print_data(opts)) { - print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float)); } nfound++; - } - mem1 += sizeof(float); - mem2 += sizeof(float); - if (opts->n && nfound >= opts->count) - return nfound; - } /* i */ + } + /* only one is NaN, assume difference */ + else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) { + opts->print_percentage = 0; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float)); + } + nfound++; + } } /*------------------------------------------------------------------------- - * !-d and -p - *------------------------------------------------------------------------- - */ - else if (!opts->d && opts->p) { - for (i = 0; i < nelmts; i++) { - HDmemcpy(&temp1_float, mem1, sizeof(float)); - HDmemcpy(&temp2_float, mem2, sizeof(float)); - - /*------------------------------------------------------------------------- - * detect NaNs - *------------------------------------------------------------------------- - */ - if (opts->do_nans) { - isnan1 = HDisnan(temp1_float); - isnan2 = HDisnan(temp2_float); - } - /* both not NaN, do the comparison */ - if ((!isnan1 && !isnan2)) { - PER(temp1_float, temp2_float); + * !-d and -p + *------------------------------------------------------------------------- + */ + else if (!opts->delta_bool && opts->percent_bool) { + /*------------------------------------------------------------------------- + * detect NaNs + *------------------------------------------------------------------------- + */ + if (opts->do_nans) { + isnan1 = HDisnan(temp1_float); + isnan2 = HDisnan(temp2_float); + } + /* both not NaN, do the comparison */ + if ((!isnan1 && !isnan2)) { + PER(temp1_float, temp2_float); - if (not_comparable && !both_zero) { - if (print_data(opts)) { - print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(F_FORMAT_P_NOTCOMP, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float)); - } - nfound++; - } - else if (per > opts->percent) { - if (print_data(opts)) { - print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(F_FORMAT_P, (double) temp1_float, (double) temp2_float, - (double) ABS(temp1_float - temp2_float), (double) ABS(1 - temp2_float / temp1_float)); - } - nfound++; + if (not_comparable && !both_zero) { + opts->print_percentage = 1; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(F_FORMAT_P_NOTCOMP, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float)); } + nfound++; } - /* only one is NaN, assume difference */ - else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) { + else if (per > opts->percent) { + opts->print_percentage = 1; + print_pos(opts, elem_idx, 0); if (print_data(opts)) { - print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float)); + parallel_print(F_FORMAT_P, (double) temp1_float, (double) temp2_float, + (double) ABS(temp1_float - temp2_float), (double) ABS(1 - temp2_float / temp1_float)); } nfound++; - } - mem1 += sizeof(float); - mem2 += sizeof(float); - if (opts->n && nfound >= opts->count) - return nfound; - } /* i */ + } + /* only one is NaN, assume difference */ + else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) { + opts->print_percentage = 0; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float)); + } + nfound++; + } } /*------------------------------------------------------------------------- - * -d and -p - *------------------------------------------------------------------------- - */ - else if (opts->d && opts->p) { - for (i = 0; i < nelmts; i++) { - HDmemcpy(&temp1_float, mem1, sizeof(float)); - HDmemcpy(&temp2_float, mem2, sizeof(float)); - - /*------------------------------------------------------------------------- - * detect NaNs - *------------------------------------------------------------------------- - */ - if (opts->do_nans) { - isnan1 = HDisnan(temp1_float); - isnan2 = HDisnan(temp2_float); - } + * -d and -p + *------------------------------------------------------------------------- + */ + else if (opts->delta_bool && opts->percent_bool) { + /*------------------------------------------------------------------------- + * detect NaNs + *------------------------------------------------------------------------- + */ + if (opts->do_nans) { + isnan1 = HDisnan(temp1_float); + isnan2 = HDisnan(temp2_float); + } - /* both not NaN, do the comparison */ - if (!isnan1 && !isnan2) { - PER(temp1_float, temp2_float); + /* both not NaN, do the comparison */ + if (!isnan1 && !isnan2) { + PER(temp1_float, temp2_float); - if (not_comparable && !both_zero) { - if (print_data(opts)) { - print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(F_FORMAT_P_NOTCOMP, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float)); - } - nfound++; - } - else if (per > opts->percent && (double) ABS(temp1_float - temp2_float) > opts->delta) { - if (print_data(opts)) { - print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(F_FORMAT_P, (double) temp1_float, (double) temp2_float, - (double) ABS(temp1_float - temp2_float), (double) ABS(1 - temp2_float / temp1_float)); - } - nfound++; + if (not_comparable && !both_zero) { + opts->print_percentage = 1; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(F_FORMAT_P_NOTCOMP, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float)); } - + nfound++; } - /* only one is NaN, assume difference */ - else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) { + else if (per > opts->percent && (double) ABS(temp1_float - temp2_float) > opts->delta) { + opts->print_percentage = 1; + print_pos(opts, elem_idx, 0); if (print_data(opts)) { - print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float)); + parallel_print(F_FORMAT_P, (double) temp1_float, (double) temp2_float, + (double) ABS(temp1_float - temp2_float), (double) ABS(1 - temp2_float / temp1_float)); } nfound++; - } - mem1 += sizeof(float); - mem2 += sizeof(float); - if (opts->n && nfound >= opts->count) - return nfound; - } /* i */ + } + /* only one is NaN, assume difference */ + else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) { + opts->print_percentage = 0; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float)); + } + nfound++; + } } - /*------------------------------------------------------------------------- - * no -d and -p - *------------------------------------------------------------------------- - */ + * no -d and -p + *------------------------------------------------------------------------- + */ else { - for (i = 0; i < nelmts; i++) { - HDmemcpy(&temp1_float, mem1, sizeof(float)); - HDmemcpy(&temp2_float, mem2, sizeof(float)); - - if (equal_float(temp1_float, temp2_float, opts) == FALSE) { - if (print_data(opts)) { - print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float)); - } - nfound++; + if (equal_float(temp1_float, temp2_float, opts) == FALSE) { + opts->print_percentage = 0; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float)); } - - mem1 += sizeof(float); - mem2 += sizeof(float); - if (opts->n && nfound >= opts->count) - return nfound; - } /* nelmts */ + nfound++; + } } + H5TOOLS_ENDDEBUG(": %d zero:%d", nfound, both_zero); return nfound; } /*------------------------------------------------------------------------- - * Function: diff_double + * Function: diff_double_element * - * Purpose: diff a H5T_NATIVE_DOUBLE type + * Purpose: diff a single H5T_NATIVE_DOUBLE type * * Return: number of differences found *------------------------------------------------------------------------- */ -static hsize_t diff_double(unsigned char *mem1, unsigned char *mem2, - hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims, - hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1, - const char *obj2, int *ph) - +static hsize_t diff_double_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts) { hsize_t nfound = 0; /* number of differences found */ double temp1_double; double temp2_double; - hsize_t i; double per; - hbool_t both_zero; + hbool_t both_zero = FALSE; hbool_t isnan1 = FALSE; hbool_t isnan2 = FALSE; - /*------------------------------------------------------------------------- - * -d and !-p - *------------------------------------------------------------------------- - */ + H5TOOLS_START_DEBUG("delta_bool:%d - percent_bool:%d", opts->delta_bool, opts->percent_bool); - if (opts->d && !opts->p) { - for (i = 0; i < nelmts; i++) { - HDmemcpy(&temp1_double, mem1, sizeof(double)); - HDmemcpy(&temp2_double, mem2, sizeof(double)); + HDmemcpy(&temp1_double, mem1, sizeof(double)); + HDmemcpy(&temp2_double, mem2, sizeof(double)); - /*------------------------------------------------------------------------- - * detect NaNs - *------------------------------------------------------------------------- - */ - if (opts->do_nans) { - isnan1 = HDisnan(temp1_double); - isnan2 = HDisnan(temp2_double); - } + /*------------------------------------------------------------------------- + * -d and !-p + *------------------------------------------------------------------------- + */ + if (opts->delta_bool && !opts->percent_bool) { + /*------------------------------------------------------------------------- + * detect NaNs + *------------------------------------------------------------------------- + */ + if (opts->do_nans) { + isnan1 = HDisnan(temp1_double); + isnan2 = HDisnan(temp2_double); + } - /* both not NaN, do the comparison */ - if (!isnan1 && !isnan2) { - if (ABS(temp1_double-temp2_double) > opts->delta) { - if (print_data(opts)) { - print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); - } - nfound++; - } - } - /* only one is NaN, assume difference */ - else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) { + /* both not NaN, do the comparison */ + if (!isnan1 && !isnan2) { + if (ABS(temp1_double-temp2_double) > opts->delta) { + opts->print_percentage = 0; + print_pos(opts, elem_idx, 0); if (print_data(opts)) { - print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); } nfound++; - } - mem1 += sizeof(double); - mem2 += sizeof(double); - if (opts->n && nfound >= opts->count) - return nfound; - } /* i */ + } + /* only one is NaN, assume difference */ + else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) { + opts->print_percentage = 0; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); + } + nfound++; + } } /*------------------------------------------------------------------------- - * !-d and -p - *------------------------------------------------------------------------- - */ - else if (!opts->d && opts->p) { - for (i = 0; i < nelmts; i++) { - HDmemcpy(&temp1_double, mem1, sizeof(double)); - HDmemcpy(&temp2_double, mem2, sizeof(double)); - - /*------------------------------------------------------------------------- - * detect NaNs - *------------------------------------------------------------------------- - */ - if (opts->do_nans) { - isnan1 = HDisnan(temp1_double); - isnan2 = HDisnan(temp2_double); - } - /* both not NaN, do the comparison */ - if (!isnan1 && !isnan2) { - PER(temp1_double, temp2_double); + * !-d and -p + *------------------------------------------------------------------------- + */ + else if (!opts->delta_bool && opts->percent_bool) { + /*------------------------------------------------------------------------- + * detect NaNs + *------------------------------------------------------------------------- + */ + if (opts->do_nans) { + isnan1 = HDisnan(temp1_double); + isnan2 = HDisnan(temp2_double); + } + /* both not NaN, do the comparison */ + if (!isnan1 && !isnan2) { + PER(temp1_double, temp2_double); - if (not_comparable && !both_zero) { - if (print_data(opts)) { - print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(F_FORMAT_P_NOTCOMP, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); - } - nfound++; - } - else if (per > opts->percent) { - if (print_data(opts)) { - print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(F_FORMAT_P, temp1_double, temp2_double, - ABS(temp1_double - temp2_double), ABS(1 - temp2_double / temp1_double)); - } - nfound++; + if (not_comparable && !both_zero) { + opts->print_percentage = 1; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(F_FORMAT_P_NOTCOMP, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); } + nfound++; } - /* only one is NaN, assume difference */ - else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) { + else if (per > opts->percent) { + opts->print_percentage = 1; + print_pos(opts, elem_idx, 0); if (print_data(opts)) { - print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); + parallel_print(F_FORMAT_P, temp1_double, temp2_double, + ABS(temp1_double - temp2_double), ABS(1 - temp2_double / temp1_double)); } nfound++; - } - mem1 += sizeof(double); - mem2 += sizeof(double); - if (opts->n && nfound >= opts->count) - return nfound; - } /* i */ + } + /* only one is NaN, assume difference */ + else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) { + opts->print_percentage = 0; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); + } + nfound++; + } } /*------------------------------------------------------------------------- - * -d and -p - *------------------------------------------------------------------------- - */ - else if (opts->d && opts->p) { - - for (i = 0; i < nelmts; i++) { - HDmemcpy(&temp1_double, mem1, sizeof(double)); - HDmemcpy(&temp2_double, mem2, sizeof(double)); - - /*------------------------------------------------------------------------- - * detect NaNs - *------------------------------------------------------------------------- - */ - if (opts->do_nans) { - isnan1 = HDisnan(temp1_double); - isnan2 = HDisnan(temp2_double); - } + * -d and -p + *------------------------------------------------------------------------- + */ + else if (opts->delta_bool && opts->percent_bool) { + /*------------------------------------------------------------------------- + * detect NaNs + *------------------------------------------------------------------------- + */ + if (opts->do_nans) { + isnan1 = HDisnan(temp1_double); + isnan2 = HDisnan(temp2_double); + } - /* both not NaN, do the comparison */ - if (!isnan1 && !isnan2) { - PER(temp1_double, temp2_double); + /* both not NaN, do the comparison */ + if (!isnan1 && !isnan2) { + PER(temp1_double, temp2_double); - if (not_comparable && !both_zero) { - if (print_data(opts)) { - print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(F_FORMAT_P_NOTCOMP, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); - } - nfound++; - } - else if (per > opts->percent && ABS(temp1_double-temp2_double) > opts->delta) { - if (print_data(opts)) { - print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(F_FORMAT_P, temp1_double, temp2_double, - ABS(temp1_double - temp2_double), ABS(1 - temp2_double / temp1_double)); - } - nfound++; + if (not_comparable && !both_zero) { + opts->print_percentage = 1; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(F_FORMAT_P_NOTCOMP, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); } + nfound++; } - /* only one is NaN, assume difference */ - else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) { + else if (per > opts->percent && ABS(temp1_double-temp2_double) > opts->delta) { + opts->print_percentage = 1; + print_pos(opts, elem_idx, 0); if (print_data(opts)) { - print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); + parallel_print(F_FORMAT_P, temp1_double, temp2_double, + ABS(temp1_double - temp2_double), ABS(1 - temp2_double / temp1_double)); } nfound++; } - mem1 += sizeof(double); - mem2 += sizeof(double); - if (opts->n && nfound >= opts->count) - return nfound; - } /* i */ + } + /* only one is NaN, assume difference */ + else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) { + opts->print_percentage = 0; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); + } + nfound++; + } } /*------------------------------------------------------------------------- - * no -d and -p - *------------------------------------------------------------------------- - */ + * no -d and -p + *------------------------------------------------------------------------- + */ else { - for (i = 0; i < nelmts; i++) { - HDmemcpy(&temp1_double, mem1, sizeof(double)); - HDmemcpy(&temp2_double, mem2, sizeof(double)); - - if (equal_double(temp1_double, temp2_double, opts) == FALSE) { - if (print_data(opts)) { - print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); - } - nfound++; + if (equal_double(temp1_double, temp2_double, opts) == FALSE) { + opts->print_percentage = 0; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); } - - mem1 += sizeof(double); - mem2 += sizeof(double); - if (opts->n && nfound >= opts->count) - return nfound; - } /* nelmts */ + nfound++; + } } + H5TOOLS_ENDDEBUG(":%d - errstat:%d", nfound, opts->err_stat); return nfound; } /*------------------------------------------------------------------------- - * Function: diff_ldouble + * Function: diff_ldouble_element * - * Purpose: diff a H5T_NATIVE_LDOUBLE type + * Purpose: diff a single H5T_NATIVE_LDOUBLE type * * Return: number of differences found *------------------------------------------------------------------------- */ #if H5_SIZEOF_LONG_DOUBLE !=0 -static hsize_t diff_ldouble(unsigned char *mem1, - unsigned char *mem2, - hsize_t nelmts, - hsize_t hyper_start, - int rank, - hsize_t *dims, - hsize_t *acc, - hsize_t *pos, - diff_opt_t *opts, - const char *obj1, - const char *obj2, - int *ph) - +static hsize_t diff_ldouble_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts) { hsize_t nfound = 0; /* number of differences found */ long double temp1_double; long double temp2_double; - hsize_t i; double per; - hbool_t both_zero; + hbool_t both_zero = FALSE; hbool_t isnan1 = FALSE; hbool_t isnan2 = FALSE; + H5TOOLS_START_DEBUG("delta_bool:%d - percent_bool:%d", opts->delta_bool, opts->percent_bool); + + HDmemcpy(&temp1_double, mem1, sizeof(long double)); + HDmemcpy(&temp2_double, mem2, sizeof(long double)); + + /* logic for detecting NaNs is different with options -d, -p and no options */ + /*------------------------------------------------------------------------- * -d and !-p *------------------------------------------------------------------------- */ + if (opts->delta_bool && !opts->percent_bool) { + /*------------------------------------------------------------------------- + * detect NaNs + *------------------------------------------------------------------------- + */ + if (opts->do_nans) { + isnan1 = HDisnan(temp1_double); + isnan2 = HDisnan(temp2_double); + } - if (opts->d && !opts->p) { - for ( i = 0; i < nelmts; i++) { - HDmemcpy(&temp1_double, mem1, sizeof(long double)); - HDmemcpy(&temp2_double, mem2, sizeof(long double)); - - /*------------------------------------------------------------------------- - * detect NaNs - *------------------------------------------------------------------------- - */ - if (opts->do_nans) { - isnan1 = HDisnan(temp1_double); - isnan2 = HDisnan(temp2_double); - } - - /* both not NaN, do the comparison */ - if (!isnan1 && !isnan2) { - if (ABS(temp1_double-temp2_double) > opts->delta) { - if (print_data(opts)) { - print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); - } - nfound++; - } - } - /* only one is NaN, assume difference */ - else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) { + /* both not NaN, do the comparison */ + if (!isnan1 && !isnan2) { + if (ABS(temp1_double-temp2_double) > opts->delta) { + opts->print_percentage = 0; + print_pos(opts, elem_idx, 0); if (print_data(opts)) { - print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); + parallel_print(LD_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); } nfound++; - } - mem1 += sizeof(long double); - mem2 += sizeof(long double); - if (opts->n && nfound >= opts->count) - return nfound; - } /* i */ + } /* NaN */ + /* only one is NaN, assume difference */ + else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) { + opts->print_percentage = 0; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); + } + nfound++; + } } - /*------------------------------------------------------------------------- * !-d and -p *------------------------------------------------------------------------- */ - else if (!opts->d && opts->p) { - for (i = 0; i < nelmts; i++) { - HDmemcpy(&temp1_double, mem1, sizeof(long double)); - HDmemcpy(&temp2_double, mem2, sizeof(long double)); + else if (!opts->delta_bool && opts->percent_bool) { + /*------------------------------------------------------------------------- + * detect NaNs + *------------------------------------------------------------------------- + */ + if (opts->do_nans) { + isnan1 = HDisnan(temp1_double); + isnan2 = HDisnan(temp2_double); + } - /*------------------------------------------------------------------------- - * detect NaNs - *------------------------------------------------------------------------- - */ - if (opts->do_nans) { - isnan1 = HDisnan(temp1_double); - isnan2 = HDisnan(temp2_double); - } - /* both not NaN, do the comparison */ - if (!isnan1 && !isnan2) { - PER(temp1_double, temp2_double); + /* both not NaN, do the comparison */ + if (!isnan1 && !isnan2) { + PER(temp1_double,temp2_double); - if (not_comparable && !both_zero) { - if (print_data(opts)) { - print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(F_FORMAT_P_NOTCOMP, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); - } - nfound++; - } - else if (per > opts->percent) { - if (print_data(opts)) { - print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(F_FORMAT_P, temp1_double, temp2_double, - ABS(temp1_double - temp2_double), ABS(1-temp2_double / temp1_double)); - } - nfound++; + if (not_comparable && !both_zero) { + opts->print_percentage = 1; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(LD_FORMAT_P_NOTCOMP, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); } + nfound++; } - /* only one is NaN, assume difference */ - else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) { + else if (per > opts->percent) { + opts->print_percentage = 1; + print_pos(opts, elem_idx, 0); if (print_data(opts)) { - print_pos(ph, 0, hyper_start+i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); + parallel_print(LD_FORMAT_P, temp1_double, temp2_double, ABS(temp1_double - temp2_double), ABS(1 - temp2_double / temp1_double)); } nfound++; } - mem1 += sizeof(long double); - mem2 += sizeof(long double); - if (opts->n && nfound >= opts->count) - return nfound; - } /* i */ + } /* NaN */ + /* only one is NaN, assume difference */ + else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) { + opts->print_percentage = 0; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); + } + nfound++; + } } /*------------------------------------------------------------------------- * -d and -p *------------------------------------------------------------------------- */ - else if (opts->d && opts->p) { - for (i = 0; i < nelmts; i++) { - HDmemcpy(&temp1_double, mem1, sizeof(long double)); - HDmemcpy(&temp2_double, mem2, sizeof(long double)); - - /*------------------------------------------------------------------------- - * detect NaNs - *------------------------------------------------------------------------- - */ - if (opts->do_nans) { - isnan1 = HDisnan(temp1_double); - isnan2 = HDisnan(temp2_double); - } + else if (opts->delta_bool && opts->percent_bool) { + /*------------------------------------------------------------------------- + * detect NaNs + *------------------------------------------------------------------------- + */ + if (opts->do_nans) { + isnan1 = HDisnan(temp1_double); + isnan2 = HDisnan(temp2_double); + } - /* both not NaN, do the comparison */ - if (!isnan1 && !isnan2) { - PER(temp1_double, temp2_double); + /* both not NaN, do the comparison */ + if (!isnan1 && !isnan2) { + PER(temp1_double,temp2_double); - if (not_comparable && !both_zero) { - if (print_data(opts)) { - print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(F_FORMAT_P_NOTCOMP, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); - } - nfound++; - } - else if (per > opts->percent && ABS(temp1_double - temp2_double) > opts->delta) { - if (print_data(opts)) { - print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(F_FORMAT_P, temp1_double, temp2_double, ABS(temp1_double - temp2_double), ABS(1-temp2_double / temp1_double)); - } - nfound++; + if (not_comparable && !both_zero) { + opts->print_percentage = 1; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(LD_FORMAT_P_NOTCOMP, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); } + nfound++; } - /* only one is NaN, assume difference */ - else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) { - if (print_data(opts)) { - print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); + else if (per > opts->percent && ABS(temp1_double-temp2_double) > opts->delta) { + opts->print_percentage = 1; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(LD_FORMAT_P, temp1_double, temp2_double, ABS(temp1_double - temp2_double), ABS(1 - temp2_double / temp1_double)); } nfound++; } - mem1 += sizeof(long double); - mem2 += sizeof(long double); - if (opts->n && nfound >= opts->count) - return nfound; - } /* i */ + } /* NaN */ + /* only one is NaN, assume difference */ + else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) { + opts->print_percentage = 0; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); + } + nfound++; + } } /*------------------------------------------------------------------------- * no -d and -p *------------------------------------------------------------------------- */ - else { - for (i = 0; i < nelmts; i++) { - HDmemcpy(&temp1_double, mem1, sizeof(long double)); - HDmemcpy(&temp2_double, mem2, sizeof(long double)); - - if (equal_ldouble(temp1_double, temp2_double, opts) == FALSE) { - if (print_data(opts)) { - print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); - } - nfound++; - } - mem1 += sizeof(long double); - mem2 += sizeof(long double); - if (opts->n && nfound >= opts->count) - return nfound; - } /* nelmts */ + else if (equal_ldouble(temp1_double, temp2_double, opts) == FALSE) { + opts->print_percentage = 0; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(LD_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); + } + nfound++; } + H5TOOLS_ENDDEBUG(":%d - errstat:%d", nfound, opts->err_stat); + return nfound; } #endif /* H5_SIZEOF_LONG_DOUBLE */ /*------------------------------------------------------------------------- - * Function: diff_schar + * Function: diff_schar_element * - * Purpose: diff a H5T_NATIVE_SCHAR type + * Purpose: diff a single H5T_NATIVE_SCHAR type * * Return: number of differences found *------------------------------------------------------------------------- */ -static hsize_t diff_schar(unsigned char *mem1, unsigned char *mem2, - hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims, - hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1, - const char *obj2, int *ph) - +static hsize_t diff_schar_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts) { hsize_t nfound = 0; /* number of differences found */ char temp1_char; char temp2_char; - hsize_t i; double per; - hbool_t both_zero; + hbool_t both_zero = FALSE; - /* -d and !-p */ - if (opts->d && !opts->p) { - for (i = 0; i < nelmts; i++) { - HDmemcpy(&temp1_char, mem1, sizeof(char)); - HDmemcpy(&temp2_char, mem2, sizeof(char)); + H5TOOLS_START_DEBUG("delta_bool:%d - percent_bool:%d", opts->delta_bool, opts->percent_bool); + HDmemcpy(&temp1_char, mem1, sizeof(char)); + HDmemcpy(&temp2_char, mem2, sizeof(char)); - if (ABS(temp1_char-temp2_char) > opts->delta) { - if (print_data(opts)) { - print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT, temp1_char, temp2_char, ABS(temp1_char - temp2_char)); - } - nfound++; + /* -d and !-p */ + if (opts->delta_bool && !opts->percent_bool) { + if (ABS(temp1_char-temp2_char) > opts->delta) { + opts->print_percentage = 0; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(I_FORMAT, temp1_char, temp2_char, ABS(temp1_char - temp2_char)); } - mem1 += sizeof(char); - mem2 += sizeof(char); - if (opts->n && nfound >= opts->count) - return nfound; + nfound++; } } /* !-d and -p */ - else if (!opts->d && opts->p) { - for (i = 0; i < nelmts; i++) { - HDmemcpy(&temp1_char, mem1, sizeof(char)); - HDmemcpy(&temp2_char, mem2, sizeof(char)); + else if (!opts->delta_bool && opts->percent_bool) { + PER(temp1_char, temp2_char); - PER(temp1_char, temp2_char); - - if (not_comparable && !both_zero) { - if (print_data(opts)) { - print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P_NOTCOMP, temp1_char, temp2_char, ABS(temp1_char - temp2_char)); - } - nfound++; + if (not_comparable && !both_zero) { + opts->print_percentage = 1; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(I_FORMAT_P_NOTCOMP, temp1_char, temp2_char, ABS(temp1_char - temp2_char)); } - else if (per > opts->percent) { - if (print_data(opts)) { - print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P, temp1_char, temp2_char, ABS(temp1_char - temp2_char), per); - } - nfound++; + nfound++; + } + else if (per > opts->percent) { + opts->print_percentage = 1; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(I_FORMAT_P, temp1_char, temp2_char, ABS(temp1_char - temp2_char), per); } - mem1 += sizeof(char); - mem2 += sizeof(char); - if (opts->n && nfound >= opts->count) - return nfound; + nfound++; } } /* -d and -p */ - else if (opts->d && opts->p) { - for (i = 0; i < nelmts; i++) { - HDmemcpy(&temp1_char, mem1, sizeof(char)); - HDmemcpy(&temp2_char, mem2, sizeof(char)); - - PER(temp1_char, temp2_char); + else if (opts->delta_bool && opts->percent_bool) { + PER(temp1_char, temp2_char); - if (not_comparable && !both_zero) { - if (print_data(opts)) { - print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P_NOTCOMP, temp1_char, temp2_char, ABS(temp1_char - temp2_char)); - } - nfound++; + if (not_comparable && !both_zero) { + opts->print_percentage = 1; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(I_FORMAT_P_NOTCOMP, temp1_char, temp2_char, ABS(temp1_char - temp2_char)); } - else if (per > opts->percent && ABS(temp1_char-temp2_char) > opts->delta) { - if (print_data(opts)) { - print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P, temp1_char, temp2_char, ABS(temp1_char - temp2_char), per); - } - nfound++; + nfound++; + } + else if (per > opts->percent && ABS(temp1_char - temp2_char) > opts->delta) { + opts->print_percentage = 1; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(I_FORMAT_P, temp1_char, temp2_char, ABS(temp1_char - temp2_char), per); } - mem1 += sizeof(char); - mem2 += sizeof(char); - if (opts->n && nfound >= opts->count) - return nfound; + nfound++; } } - else { - for (i = 0; i < nelmts; i++) { - HDmemcpy(&temp1_char, mem1, sizeof(char)); - HDmemcpy(&temp2_char, mem2, sizeof(char)); - - if (temp1_char != temp2_char) { - if (print_data(opts)) { - print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT, temp1_char, temp2_char, ABS(temp1_char - temp2_char)); - } - nfound++; - } - - mem1 += sizeof(char); - mem2 += sizeof(char); - if (opts->n && nfound >= opts->count) - return nfound; - } /* nelmts */ + else if (temp1_char != temp2_char) { + opts->print_percentage = 0; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(I_FORMAT, temp1_char, temp2_char, ABS(temp1_char - temp2_char)); + } + nfound++; } + H5TOOLS_ENDDEBUG(":%d - errstat:%d", nfound, opts->err_stat); + return nfound; } /*------------------------------------------------------------------------- - * Function: diff_uchar + * Function: diff_uchar_element * - * Purpose: diff a H5T_NATIVE_UCHAR type + * Purpose: diff a single H5T_NATIVE_UCHAR type * * Return: number of differences found *------------------------------------------------------------------------- */ -static hsize_t diff_uchar(unsigned char *mem1, unsigned char *mem2, - hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims, - hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1, - const char *obj2, int *ph) +static hsize_t diff_uchar_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts) { hsize_t nfound = 0; /* number of differences found */ unsigned char temp1_uchar; unsigned char temp2_uchar; - hsize_t i; double per; - hbool_t both_zero; + hbool_t both_zero = FALSE; - /* -d and !-p */ - if (opts->d && !opts->p) { - for (i = 0; i < nelmts; i++) { - HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char)); - HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char)); + H5TOOLS_START_DEBUG("delta_bool:%d - percent_bool:%d", opts->delta_bool, opts->percent_bool); - if (PDIFF(temp1_uchar,temp2_uchar) > opts->delta) { - if (print_data(opts)) { - print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar)); - } - nfound++; + HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char)); + HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char)); + /* -d and !-p */ + if (opts->delta_bool && !opts->percent_bool) { + if (PDIFF(temp1_uchar, temp2_uchar) > opts->delta) { + opts->print_percentage = 0; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(I_FORMAT, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar)); } - mem1 += sizeof(unsigned char); - mem2 += sizeof(unsigned char); - if (opts->n && nfound >= opts->count) - return nfound; + nfound++; } } /* !-d and -p */ - else if (!opts->d && opts->p) { - for (i = 0; i < nelmts; i++) { - HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char)); - HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char)); - - PER_UNSIGN(signed char, temp1_uchar, temp2_uchar); + else if (!opts->delta_bool && opts->percent_bool) { + PER_UNSIGN(signed char, temp1_uchar, temp2_uchar); - if (not_comparable && !both_zero) { - if (print_data(opts)) { - print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P_NOTCOMP, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar)); - } - nfound++; + if (not_comparable && !both_zero) { + opts->print_percentage = 1; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(I_FORMAT_P_NOTCOMP, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar)); } - else if (per > opts->percent) { - if (print_data(opts)) { - print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar), per); - } - nfound++; + nfound++; + } + else if (per > opts->percent) { + opts->print_percentage = 1; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(I_FORMAT_P, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar), per); } - mem1 += sizeof(unsigned char); - mem2 += sizeof(unsigned char); - if (opts->n && nfound >= opts->count) - return nfound; + nfound++; } } /* -d and -p */ - else if (opts->d && opts->p) { - for (i = 0; i < nelmts; i++) { - HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char)); - HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char)); - - PER_UNSIGN(signed char, temp1_uchar, temp2_uchar); + else if (opts->delta_bool && opts->percent_bool) { + PER_UNSIGN(signed char, temp1_uchar, temp2_uchar); - if (not_comparable && !both_zero) { - if (print_data(opts)) { - print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P_NOTCOMP, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar)); - } - nfound++; + if (not_comparable && !both_zero) { + opts->print_percentage = 1; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(I_FORMAT_P_NOTCOMP, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar)); } - else if (per > opts->percent && PDIFF(temp1_uchar,temp2_uchar) > opts->delta) { - if (print_data(opts)) { - print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar), per); - } - nfound++; + nfound++; + } + else if (per > opts->percent && PDIFF(temp1_uchar, temp2_uchar) > opts->delta) { + opts->print_percentage = 1; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(I_FORMAT_P, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar), per); } - mem1 += sizeof(unsigned char); - mem2 += sizeof(unsigned char); - if (opts->n && nfound >= opts->count) - return nfound; + nfound++; } } - else { - for (i = 0; i < nelmts; i++) { - HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char)); - HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char)); - - if (temp1_uchar != temp2_uchar) { - if (print_data(opts)) { - print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar)); - } - nfound++; - } - - mem1 += sizeof(unsigned char); - mem2 += sizeof(unsigned char); - if (opts->n && nfound >= opts->count) - return nfound; - } /* nelmts */ + else if (temp1_uchar != temp2_uchar) { + opts->print_percentage = 0; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(I_FORMAT, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar)); + } + nfound++; } + H5TOOLS_ENDDEBUG(":%d - errstat:%d", nfound, opts->err_stat); + return nfound; } /*------------------------------------------------------------------------- - * Function: diff_short + * Function: diff_short_element * * Purpose: diff a H5T_NATIVE_SHORT type * * Return: number of differences found *------------------------------------------------------------------------- */ -static hsize_t diff_short(unsigned char *mem1, unsigned char *mem2, - hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims, - hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1, - const char *obj2, int *ph) +static hsize_t diff_short_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts) { hsize_t nfound = 0; /* number of differences found */ short temp1_short; short temp2_short; - hsize_t i; double per; - hbool_t both_zero; + hbool_t both_zero = FALSE; - /* -d and !-p */ - if (opts->d && !opts->p) { - for (i = 0; i < nelmts; i++) { - HDmemcpy(&temp1_short, mem1, sizeof(short)); - HDmemcpy(&temp2_short, mem2, sizeof(short)); + H5TOOLS_START_DEBUG("delta_bool:%d - percent_bool:%d", opts->delta_bool, opts->percent_bool); - if (ABS(temp1_short-temp2_short) > opts->delta) { - if (print_data(opts)) { - print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT, temp1_short, temp2_short, ABS(temp1_short - temp2_short)); - } - nfound++; + HDmemcpy(&temp1_short, mem1, sizeof(short)); + HDmemcpy(&temp2_short, mem2, sizeof(short)); + /* -d and !-p */ + if (opts->delta_bool && !opts->percent_bool) { + if (ABS(temp1_short - temp2_short) > opts->delta) { + opts->print_percentage = 0; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(I_FORMAT, temp1_short, temp2_short, ABS(temp1_short - temp2_short)); } - mem1 += sizeof(short); - mem2 += sizeof(short); - if (opts->n && nfound >= opts->count) - return nfound; + nfound++; } } /* !-d and -p */ - else if (!opts->d && opts->p) { - for (i = 0; i < nelmts; i++) { - HDmemcpy(&temp1_short, mem1, sizeof(short)); - HDmemcpy(&temp2_short, mem2, sizeof(short)); - - PER(temp1_short, temp2_short); + else if (!opts->delta_bool && opts->percent_bool) { + PER(temp1_short, temp2_short); - if (not_comparable && !both_zero) { - if (print_data(opts)) { - print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P_NOTCOMP, temp1_short, temp2_short, ABS(temp1_short - temp2_short)); - } - nfound++; + if (not_comparable && !both_zero) { + opts->print_percentage = 1; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(I_FORMAT_P_NOTCOMP, temp1_short, temp2_short, ABS(temp1_short - temp2_short)); } - else if (per > opts->percent) { - if (print_data(opts)) { - print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P, temp1_short, temp2_short, ABS(temp1_short - temp2_short), per); - } - nfound++; + nfound++; + } + else if (per > opts->percent) { + opts->print_percentage = 1; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(I_FORMAT_P, temp1_short, temp2_short, ABS(temp1_short - temp2_short), per); } - mem1 += sizeof(short); - mem2 += sizeof(short); - if (opts->n && nfound >= opts->count) - return nfound; + nfound++; } } /* -d and -p */ - else if (opts->d && opts->p) { - for (i = 0; i < nelmts; i++) { - HDmemcpy(&temp1_short, mem1, sizeof(short)); - HDmemcpy(&temp2_short, mem2, sizeof(short)); + else if (opts->delta_bool && opts->percent_bool) { + PER(temp1_short, temp2_short); - PER(temp1_short, temp2_short); - - if (not_comparable && !both_zero) { - if (print_data(opts)) { - print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P_NOTCOMP, temp1_short, temp2_short, ABS(temp1_short - temp2_short)); - } - nfound++; + if (not_comparable && !both_zero) { + opts->print_percentage = 1; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(I_FORMAT_P_NOTCOMP, temp1_short, temp2_short, ABS(temp1_short - temp2_short)); } - else if (per > opts->percent && ABS(temp1_short-temp2_short) > opts->delta) { - if (print_data(opts)) { - print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P, temp1_short, temp2_short, ABS(temp1_short - temp2_short), per); - } - nfound++; + nfound++; + } + else if (per > opts->percent && ABS(temp1_short - temp2_short) > opts->delta) { + opts->print_percentage = 1; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(I_FORMAT_P, temp1_short, temp2_short, ABS(temp1_short - temp2_short), per); } - mem1 += sizeof(short); - mem2 += sizeof(short); - if (opts->n && nfound >= opts->count) - return nfound; + nfound++; } } - else { - for (i = 0; i < nelmts; i++) { - HDmemcpy(&temp1_short, mem1, sizeof(short)); - HDmemcpy(&temp2_short, mem2, sizeof(short)); - - if (temp1_short != temp2_short) { - if (print_data(opts)) { - print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT, temp1_short, temp2_short, ABS(temp1_short - temp2_short)); - } - nfound++; - } - - mem1 += sizeof(short); - mem2 += sizeof(short); - if (opts->n && nfound >= opts->count) - return nfound; - } /* nelmts */ + else if (temp1_short != temp2_short) { + opts->print_percentage = 0; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(I_FORMAT, temp1_short, temp2_short, ABS(temp1_short - temp2_short)); + } + nfound++; } + H5TOOLS_ENDDEBUG(":%d - errstat:%d", nfound, opts->err_stat); + return nfound; } /*------------------------------------------------------------------------- - * Function: diff_ushort + * Function: diff_ushort_element * - * Purpose: diff a H5T_NATIVE_USHORT type + * Purpose: diff a single H5T_NATIVE_USHORT type * * Return: number of differences found *------------------------------------------------------------------------- */ -static hsize_t diff_ushort(unsigned char *mem1, unsigned char *mem2, - hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims, - hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1, - const char *obj2, int *ph) - +static hsize_t diff_ushort_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts) { hsize_t nfound = 0; /* number of differences found */ unsigned short temp1_ushort; unsigned short temp2_ushort; - hsize_t i; double per; - hbool_t both_zero; + hbool_t both_zero = FALSE; - /* -d and !-p */ - if (opts->d && !opts->p) { - for (i = 0; i < nelmts; i++) { - HDmemcpy(&temp1_ushort, mem1, sizeof(unsigned short)); - HDmemcpy(&temp2_ushort, mem2, sizeof(unsigned short)); + H5TOOLS_START_DEBUG("delta_bool:%d - percent_bool:%d", opts->delta_bool, opts->percent_bool); - if (PDIFF(temp1_ushort,temp2_ushort) > opts->delta) { - if (print_data(opts)) { - print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort)); - } - nfound++; + HDmemcpy(&temp1_ushort, mem1, sizeof(unsigned short)); + HDmemcpy(&temp2_ushort, mem2, sizeof(unsigned short)); + /* -d and !-p */ + if (opts->delta_bool && !opts->percent_bool) { + if (PDIFF(temp1_ushort, temp2_ushort) > opts->delta) { + opts->print_percentage = 0; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(I_FORMAT, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort)); } - mem1 += sizeof(unsigned short); - mem2 += sizeof(unsigned short); - if (opts->n && nfound >= opts->count) - return nfound; + nfound++; } } /* !-d and -p */ - else if (!opts->d && opts->p) { - for (i = 0; i < nelmts; i++) { - HDmemcpy(&temp1_ushort, mem1, sizeof(unsigned short)); - HDmemcpy(&temp2_ushort, mem2, sizeof(unsigned short)); - - PER_UNSIGN(signed short, temp1_ushort, temp2_ushort); + else if (!opts->delta_bool && opts->percent_bool) { + PER_UNSIGN(signed short, temp1_ushort, temp2_ushort); - if (not_comparable && !both_zero) { - if (print_data(opts)) { - print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P_NOTCOMP, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort)); - } - nfound++; + if (not_comparable && !both_zero) { + opts->print_percentage = 1; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(I_FORMAT_P_NOTCOMP, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort)); } - else if (per > opts->percent) { - if (print_data(opts)) { - print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort), per); - } - nfound++; + nfound++; + } + else if (per > opts->percent) { + opts->print_percentage = 1; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(I_FORMAT_P, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort), per); } - mem1 += sizeof(unsigned short); - mem2 += sizeof(unsigned short); - if (opts->n && nfound >= opts->count) - return nfound; + nfound++; } } /* -d and -p */ - else if (opts->d && opts->p) { - for (i = 0; i < nelmts; i++) { - HDmemcpy(&temp1_ushort, mem1, sizeof(unsigned short)); - HDmemcpy(&temp2_ushort, mem2, sizeof(unsigned short)); + else if (opts->delta_bool && opts->percent_bool) { + PER_UNSIGN(signed short, temp1_ushort, temp2_ushort); - PER_UNSIGN(signed short, temp1_ushort, temp2_ushort); - - if (not_comparable && !both_zero) { - if (print_data(opts)) { - print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P_NOTCOMP, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort)); - } - nfound++; + if (not_comparable && !both_zero) { + opts->print_percentage = 1; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(I_FORMAT_P_NOTCOMP, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort)); } - else if (per > opts->percent && PDIFF(temp1_ushort,temp2_ushort) > opts->delta) { - if (print_data(opts)) { - print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort), per); - } - nfound++; + nfound++; + } + else if (per > opts->percent && PDIFF(temp1_ushort, temp2_ushort) > opts->delta) { + opts->print_percentage = 1; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(I_FORMAT_P, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort), per); } - mem1 += sizeof(unsigned short); - mem2 += sizeof(unsigned short); - if (opts->n && nfound >= opts->count) - return nfound; + nfound++; } } - else { - for (i = 0; i < nelmts; i++) { - HDmemcpy(&temp1_ushort, mem1, sizeof(unsigned short)); - HDmemcpy(&temp2_ushort, mem2, sizeof(unsigned short)); - - if (temp1_ushort != temp2_ushort) { - if (print_data(opts)) { - print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort)); - } - nfound++; - } - - mem1 += sizeof(unsigned short); - mem2 += sizeof(unsigned short); - if (opts->n && nfound >= opts->count) - return nfound; - } /* nelmts */ + else if (temp1_ushort != temp2_ushort) { + opts->print_percentage = 0; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(I_FORMAT, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort)); + } + nfound++; } + H5TOOLS_ENDDEBUG(":%d - errstat:%d", nfound, opts->err_stat); + return nfound; } /*------------------------------------------------------------------------- - * Function: diff_int + * Function: diff_int_element * - * Purpose: diff a H5T_NATIVE_INT type + * Purpose: diff a single H5T_NATIVE_INT type * * Return: number of differences found *------------------------------------------------------------------------- */ -static hsize_t diff_int(unsigned char *mem1, unsigned char *mem2, - hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims, - hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1, - const char *obj2, int *ph) +static hsize_t diff_int_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts) { hsize_t nfound = 0; /* number of differences found */ int temp1_int; int temp2_int; - hsize_t i; double per; - hbool_t both_zero; + hbool_t both_zero = FALSE; - /* -d and !-p */ - if (opts->d && !opts->p) { - for (i = 0; i < nelmts; i++) { - HDmemcpy(&temp1_int, mem1, sizeof(int)); - HDmemcpy(&temp2_int, mem2, sizeof(int)); + H5TOOLS_START_DEBUG("delta_bool:%d - percent_bool:%d", opts->delta_bool, opts->percent_bool); - if (ABS(temp1_int-temp2_int) > opts->delta) { - if (print_data(opts)) { - print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT, temp1_int, temp2_int, ABS(temp1_int - temp2_int)); - } - nfound++; + HDmemcpy(&temp1_int, mem1, sizeof(int)); + HDmemcpy(&temp2_int, mem2, sizeof(int)); + /* -d and !-p */ + if (opts->delta_bool && !opts->percent_bool) { + if (ABS(temp1_int-temp2_int) > opts->delta) { + opts->print_percentage = 0; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(I_FORMAT, temp1_int, temp2_int, ABS(temp1_int - temp2_int)); } - mem1 += sizeof(int); - mem2 += sizeof(int); - if (opts->n && nfound >= opts->count) - return nfound; + nfound++; } } /* !-d and -p */ - else if (!opts->d && opts->p) { - for (i = 0; i < nelmts; i++) { - HDmemcpy(&temp1_int, mem1, sizeof(int)); - HDmemcpy(&temp2_int, mem2, sizeof(int)); + else if (!opts->delta_bool && opts->percent_bool) { + PER(temp1_int, temp2_int); - PER(temp1_int, temp2_int); - - if (not_comparable && !both_zero) { - if (print_data(opts)) { - print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P_NOTCOMP, temp1_int, temp2_int, ABS(temp1_int - temp2_int)); - } - nfound++; + if (not_comparable && !both_zero) { + opts->print_percentage = 1; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(I_FORMAT_P_NOTCOMP, temp1_int, temp2_int, ABS(temp1_int - temp2_int)); } - else if (per > opts->percent) { - if (print_data(opts)) { - print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P, temp1_int, temp2_int, ABS(temp1_int - temp2_int), per); - } - nfound++; + nfound++; + } + else if (per > opts->percent) { + opts->print_percentage = 1; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(I_FORMAT_P, temp1_int, temp2_int, ABS(temp1_int - temp2_int), per); } - mem1 += sizeof(int); - mem2 += sizeof(int); - if (opts->n && nfound >= opts->count) - return nfound; + nfound++; } } /* -d and -p */ - else if (opts->d && opts->p) { - for (i = 0; i < nelmts; i++) { - HDmemcpy(&temp1_int, mem1, sizeof(int)); - HDmemcpy(&temp2_int, mem2, sizeof(int)); - - PER(temp1_int, temp2_int); + else if (opts->delta_bool && opts->percent_bool) { + PER(temp1_int, temp2_int); - if (not_comparable && !both_zero) { - if (print_data(opts)) { - print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P_NOTCOMP, temp1_int, temp2_int, ABS(temp1_int - temp2_int)); - } - nfound++; + if (not_comparable && !both_zero) { + opts->print_percentage = 1; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(I_FORMAT_P_NOTCOMP, temp1_int, temp2_int, ABS(temp1_int - temp2_int)); } - else if (per > opts->percent && ABS(temp1_int-temp2_int) > opts->delta) { - if (print_data(opts)) { - print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P, temp1_int, temp2_int, ABS(temp1_int - temp2_int), per); - } - nfound++; + nfound++; + } + else if (per > opts->percent && ABS(temp1_int - temp2_int) > opts->delta) { + opts->print_percentage = 1; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(I_FORMAT_P, temp1_int, temp2_int, ABS(temp1_int - temp2_int), per); } - mem1 += sizeof(int); - mem2 += sizeof(int); - if (opts->n && nfound >= opts->count) - return nfound; + nfound++; } } - else { - for (i = 0; i < nelmts; i++) { - HDmemcpy(&temp1_int, mem1, sizeof(int)); - HDmemcpy(&temp2_int, mem2, sizeof(int)); - - if (temp1_int != temp2_int) { - if (print_data(opts)) { - print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT, temp1_int, temp2_int, ABS(temp1_int - temp2_int)); - } - nfound++; - } + else if (temp1_int != temp2_int) { + opts->print_percentage = 0; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(I_FORMAT, temp1_int, temp2_int, ABS(temp1_int - temp2_int)); + } + nfound++; + } - mem1 += sizeof(int); - mem2 += sizeof(int); - if (opts->n && nfound >= opts->count) - return nfound; - } /* nelmts */ + H5TOOLS_ENDDEBUG(":%d - errstat:%d", nfound, opts->err_stat); - } return nfound; } /*------------------------------------------------------------------------- - * Function: diff_uint + * Function: diff_uint_element * - * Purpose: diff a H5T_NATIVE_UINT type + * Purpose: diff a single H5T_NATIVE_UINT type * * Return: number of differences found *------------------------------------------------------------------------- */ -static hsize_t diff_uint(unsigned char *mem1, unsigned char *mem2, - hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims, - hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1, - const char *obj2, int *ph) +static hsize_t diff_uint_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts) { hsize_t nfound = 0; /* number of differences found */ unsigned int temp1_uint; unsigned int temp2_uint; - hsize_t i; double per; - hbool_t both_zero; - - /* -d and !-p */ - if (opts->d && !opts->p) { - for (i = 0; i < nelmts; i++) { - HDmemcpy(&temp1_uint, mem1, sizeof(unsigned int)); - HDmemcpy(&temp2_uint, mem2, sizeof(unsigned int)); - - if (PDIFF(temp1_uint,temp2_uint) > opts->delta) { - if (print_data(opts)) { - print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint)); - } - nfound++; + hbool_t both_zero = FALSE; + + H5TOOLS_START_DEBUG("delta_bool:%d - percent_bool:%d", opts->delta_bool, opts->percent_bool); + + HDmemcpy(&temp1_uint, mem1, sizeof(unsigned int)); + HDmemcpy(&temp2_uint, mem2, sizeof(unsigned int)); + /* -d and !-p */ + if (opts->delta_bool && !opts->percent_bool) { + if (PDIFF(temp1_uint, temp2_uint) > opts->delta) { + opts->print_percentage = 0; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(UI_FORMAT, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint)); } - mem1 += sizeof(unsigned int); - mem2 += sizeof(unsigned int); - if (opts->n && nfound >= opts->count) - return nfound; + nfound++; } } /* !-d and -p */ - else if (!opts->d && opts->p) { - for (i = 0; i < nelmts; i++) { - HDmemcpy(&temp1_uint, mem1, sizeof(unsigned int)); - HDmemcpy(&temp2_uint, mem2, sizeof(unsigned int)); - - PER_UNSIGN(signed int, temp1_uint, temp2_uint); + else if (!opts->delta_bool && opts->percent_bool) { + PER_UNSIGN(signed int, temp1_uint, temp2_uint); - if (not_comparable && !both_zero) { - if (print_data(opts)) { - print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P_NOTCOMP, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint)); - } - nfound++; + if (not_comparable && !both_zero) { + opts->print_percentage = 1; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(UI_FORMAT_P_NOTCOMP, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint)); } - else if (per > opts->percent) { - if (print_data(opts)) { - print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint), per); - } - nfound++; + nfound++; + } + else if (per > opts->percent) { + opts->print_percentage = 1; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(UI_FORMAT_P, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint), per); } - mem1 += sizeof(unsigned int); - mem2 += sizeof(unsigned int); - if (opts->n && nfound >= opts->count) - return nfound; + nfound++; } } /* -d and -p */ - else if (opts->d && opts->p) { - for (i = 0; i < nelmts; i++) { - HDmemcpy(&temp1_uint, mem1, sizeof(unsigned int)); - HDmemcpy(&temp2_uint, mem2, sizeof(unsigned int)); + else if (opts->delta_bool && opts->percent_bool) { + PER_UNSIGN(signed int, temp1_uint, temp2_uint); - PER_UNSIGN(signed int, temp1_uint, temp2_uint); - - if (not_comparable && !both_zero) { - if (print_data(opts)) { - print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P_NOTCOMP, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint)); - } - nfound++; + if (not_comparable && !both_zero) { + opts->print_percentage = 1; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(UI_FORMAT_P_NOTCOMP, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint)); } - else if (per > opts->percent - && PDIFF(temp1_uint,temp2_uint) > opts->delta) { - if (print_data(opts)) { - print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint), per); - } - nfound++; + nfound++; + } + else if (per > opts->percent && PDIFF(temp1_uint,temp2_uint) > opts->delta) { + opts->print_percentage = 1; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(UI_FORMAT_P, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint), per); } - mem1 += sizeof(unsigned int); - mem2 += sizeof(unsigned int); - if (opts->n && nfound >= opts->count) - return nfound; + nfound++; } } - else { - for (i = 0; i < nelmts; i++) { - HDmemcpy(&temp1_uint, mem1, sizeof(unsigned int)); - HDmemcpy(&temp2_uint, mem2, sizeof(unsigned int)); - - if (temp1_uint != temp2_uint) { - if (print_data(opts)) { - print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint)); - } - nfound++; - } - - mem1 += sizeof(unsigned int); - mem2 += sizeof(unsigned int); - if (opts->n && nfound >= opts->count) - return nfound; - } /* nelmts */ + else if (temp1_uint != temp2_uint) { + opts->print_percentage = 0; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(UI_FORMAT, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint)); + } + nfound++; } + H5TOOLS_ENDDEBUG(":%d - errstat:%d", nfound, opts->err_stat); + return nfound; } /*------------------------------------------------------------------------- - * Function: diff_long + * Function: diff_long_element * - * Purpose: diff a H5T_NATIVE_LONG type + * Purpose: diff a single H5T_NATIVE_LONG type * * Return: number of differences found *------------------------------------------------------------------------- */ -static hsize_t diff_long(unsigned char *mem1, unsigned char *mem2, - hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims, - hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1, - const char *obj2, int *ph) +static hsize_t diff_long_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts) { hsize_t nfound = 0; /* number of differences found */ long temp1_long; long temp2_long; - hsize_t i; double per; - hbool_t both_zero; + hbool_t both_zero = FALSE; - /* -d and !-p */ - if (opts->d && !opts->p) { - for (i = 0; i < nelmts; i++) { - for (i = 0; i < nelmts; i++) { - HDmemcpy(&temp1_long, mem1, sizeof(long)); - HDmemcpy(&temp2_long, mem2, sizeof(long)); + H5TOOLS_START_DEBUG("delta_bool:%d - percent_bool:%d", opts->delta_bool, opts->percent_bool); - if (ABS(temp1_long-temp2_long) > opts->delta) { - if (print_data(opts)) { - print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(LI_FORMAT, temp1_long, temp2_long, ABS(temp1_long - temp2_long)); - } - nfound++; - } - mem1 += sizeof(long); - mem2 += sizeof(long); - if (opts->n && nfound >= opts->count) - return nfound; + HDmemcpy(&temp1_long, mem1, sizeof(long)); + HDmemcpy(&temp2_long, mem2, sizeof(long)); + /* -d and !-p */ + if (opts->delta_bool && !opts->percent_bool) { + if (ABS(temp1_long-temp2_long) > opts->delta) { + opts->print_percentage = 0; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(LI_FORMAT, temp1_long, temp2_long, ABS(temp1_long - temp2_long)); } + nfound++; } } /* !-d and -p */ - else if (!opts->d && opts->p) { - for (i = 0; i < nelmts; i++) { - HDmemcpy(&temp1_long, mem1, sizeof(long)); - HDmemcpy(&temp2_long, mem2, sizeof(long)); - - PER(temp1_long, temp2_long); + else if (!opts->delta_bool && opts->percent_bool) { + PER(temp1_long, temp2_long); - if (not_comparable && !both_zero) { - if (print_data(opts)) { - print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(LI_FORMAT_P_NOTCOMP, temp1_long, temp2_long, ABS(temp1_long - temp2_long)); - } - nfound++; + if (not_comparable && !both_zero) { + opts->print_percentage = 1; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(LI_FORMAT_P_NOTCOMP, temp1_long, temp2_long, ABS(temp1_long - temp2_long)); } - else if (per > opts->percent) { - if (print_data(opts)) { - print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(LI_FORMAT_P, temp1_long, temp2_long, ABS(temp1_long - temp2_long), per); - } - nfound++; + nfound++; + } + else if (per > opts->percent) { + opts->print_percentage = 1; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(LI_FORMAT_P, temp1_long, temp2_long, ABS(temp1_long - temp2_long), per); } - mem1 += sizeof(long); - mem2 += sizeof(long); - if (opts->n && nfound >= opts->count) - return nfound; + nfound++; } } /* -d and -p */ - else if (opts->d && opts->p) { - for (i = 0; i < nelmts; i++) { - HDmemcpy(&temp1_long, mem1, sizeof(long)); - HDmemcpy(&temp2_long, mem2, sizeof(long)); + else if (opts->delta_bool && opts->percent_bool) { + PER(temp1_long, temp2_long); - PER(temp1_long, temp2_long); - - if (not_comparable && !both_zero) { - if (print_data(opts)) { - print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(LI_FORMAT_P_NOTCOMP, temp1_long, temp2_long, ABS(temp1_long - temp2_long)); - } - nfound++; + if (not_comparable && !both_zero) { + opts->print_percentage = 1; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(LI_FORMAT_P_NOTCOMP, temp1_long, temp2_long, ABS(temp1_long - temp2_long)); } - else if (per > opts->percent && ABS(temp1_long-temp2_long) > opts->delta) { - if (print_data(opts)) { - print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(LI_FORMAT_P, temp1_long, temp2_long, ABS(temp1_long - temp2_long), per); - } - nfound++; + nfound++; + } + else if (per > opts->percent && ABS(temp1_long-temp2_long) > opts->delta) { + opts->print_percentage = 1; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(LI_FORMAT_P, temp1_long, temp2_long, ABS(temp1_long - temp2_long), per); } - mem1 += sizeof(long); - mem2 += sizeof(long); - if (opts->n && nfound >= opts->count) - return nfound; + nfound++; } } - else { - for (i = 0; i < nelmts; i++) { - HDmemcpy(&temp1_long, mem1, sizeof(long)); - HDmemcpy(&temp2_long, mem2, sizeof(long)); - - if (temp1_long != temp2_long) { - if (print_data(opts)) { - print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(LI_FORMAT, temp1_long, temp2_long, ABS(temp1_long - temp2_long)); - } - nfound++; - } - - mem1 += sizeof(long); - mem2 += sizeof(long); - if (opts->n && nfound >= opts->count) - return nfound; - } /* nelmts */ + else if (temp1_long != temp2_long) { + opts->print_percentage = 0; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(LI_FORMAT, temp1_long, temp2_long, ABS(temp1_long - temp2_long)); + } + nfound++; } + H5TOOLS_ENDDEBUG(":%d - errstat:%d", nfound, opts->err_stat); + return nfound; } /*------------------------------------------------------------------------- - * Function: diff_ulong + * Function: diff_ulong_element * - * Purpose: diff a H5T_NATIVE_ULONG type + * Purpose: diff a single H5T_NATIVE_ULONG type * * Return: number of differences found *------------------------------------------------------------------------- */ -static hsize_t diff_ulong(unsigned char *mem1, unsigned char *mem2, - hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims, - hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1, - const char *obj2, int *ph) +static hsize_t diff_ulong_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts) { hsize_t nfound = 0; /* number of differences found */ unsigned long temp1_ulong; unsigned long temp2_ulong; - hsize_t i; double per; - hbool_t both_zero; + hbool_t both_zero = FALSE; - /* -d and !-p */ - if (opts->d && !opts->p) { - for (i = 0; i < nelmts; i++) { - for (i = 0; i < nelmts; i++) { - HDmemcpy(&temp1_ulong, mem1, sizeof(unsigned long)); - HDmemcpy(&temp2_ulong, mem2, sizeof(unsigned long)); + H5TOOLS_START_DEBUG("delta_bool:%d - percent_bool:%d", opts->delta_bool, opts->percent_bool); - if (PDIFF(temp1_ulong,temp2_ulong) > opts->delta) { - if (print_data(opts)) { - print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(LI_FORMAT, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong)); - } - nfound++; - } - mem1 += sizeof(unsigned long); - mem2 += sizeof(unsigned long); - if (opts->n && nfound >= opts->count) - return nfound; + HDmemcpy(&temp1_ulong, mem1, sizeof(unsigned long)); + HDmemcpy(&temp2_ulong, mem2, sizeof(unsigned long)); + /* -d and !-p */ + if (opts->delta_bool && !opts->percent_bool) { + if (PDIFF(temp1_ulong, temp2_ulong) > opts->delta) { + opts->print_percentage = 0; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(ULI_FORMAT, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong)); } + nfound++; } } /* !-d and -p */ - else if (!opts->d && opts->p) { - for (i = 0; i < nelmts; i++) { - HDmemcpy(&temp1_ulong, mem1, sizeof(unsigned long)); - HDmemcpy(&temp2_ulong, mem2, sizeof(unsigned long)); - - PER_UNSIGN(signed long, temp1_ulong, temp2_ulong); + else if (!opts->delta_bool && opts->percent_bool) { + PER_UNSIGN(signed long, temp1_ulong, temp2_ulong); - if (not_comparable && !both_zero) { - if (print_data(opts)) { - print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(ULI_FORMAT_P_NOTCOMP, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong)); - } - nfound++; + if (not_comparable && !both_zero) { + opts->print_percentage = 1; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(ULI_FORMAT_P_NOTCOMP, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong)); } - else if (per > opts->percent) { - if (print_data(opts)) { - print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(LI_FORMAT_P, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong), per); - } - nfound++; + nfound++; + } + else if (per > opts->percent) { + opts->print_percentage = 1; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(ULI_FORMAT_P, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong), per); } - mem1 += sizeof(unsigned long); - mem2 += sizeof(unsigned long); - if (opts->n && nfound >= opts->count) - return nfound; + nfound++; } } /* -d and -p */ - else if (opts->d && opts->p) { - for (i = 0; i < nelmts; i++) { - HDmemcpy(&temp1_ulong, mem1, sizeof(unsigned long)); - HDmemcpy(&temp2_ulong, mem2, sizeof(unsigned long)); + else if (opts->delta_bool && opts->percent_bool) { + PER_UNSIGN(signed long, temp1_ulong, temp2_ulong); - PER_UNSIGN(signed long, temp1_ulong, temp2_ulong); - - if (not_comparable && !both_zero) { - if (print_data(opts)) { - print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(ULI_FORMAT_P_NOTCOMP, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong)); - } - nfound++; + if (not_comparable && !both_zero) { + opts->print_percentage = 1; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(ULI_FORMAT_P_NOTCOMP, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong)); } - else if (per > opts->percent - && PDIFF(temp1_ulong,temp2_ulong) > opts->delta) { - if (print_data(opts)) { - print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(LI_FORMAT_P, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong), per); - } - nfound++; + nfound++; + } + else if (per > opts->percent && PDIFF(temp1_ulong,temp2_ulong) > opts->delta) { + opts->print_percentage = 1; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(ULI_FORMAT_P, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong), per); } - mem1 += sizeof(unsigned long); - mem2 += sizeof(unsigned long); - if (opts->n && nfound >= opts->count) - return nfound; + nfound++; } } - else { - for (i = 0; i < nelmts; i++) { - HDmemcpy(&temp1_ulong, mem1, sizeof(unsigned long)); - HDmemcpy(&temp2_ulong, mem2, sizeof(unsigned long)); - - if (temp1_ulong != temp2_ulong) { - if (print_data(opts)) { - print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(LI_FORMAT, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong)); - } - nfound++; - } - - mem1 += sizeof(unsigned long); - mem2 += sizeof(unsigned long); - if (opts->n && nfound >= opts->count) - return nfound; - } /* nelmts */ + else if (temp1_ulong != temp2_ulong) { + opts->print_percentage = 0; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(ULI_FORMAT, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong)); + } + nfound++; } + H5TOOLS_ENDDEBUG(":%d - errstat:%d", nfound, opts->err_stat); + return nfound; } /*------------------------------------------------------------------------- - * Function: diff_llong + * Function: diff_llong_element * - * Purpose: diff a H5T_NATIVE_LLONG type + * Purpose: diff a single H5T_NATIVE_LLONG type * * Return: number of differences found *------------------------------------------------------------------------- */ -static hsize_t diff_llong(unsigned char *mem1, unsigned char *mem2, - hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims, - hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1, - const char *obj2, int *ph) +static hsize_t diff_llong_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts) { hsize_t nfound = 0; /* number of differences found */ long long temp1_llong; long long temp2_llong; - hsize_t i; double per; - hbool_t both_zero; + hbool_t both_zero = FALSE; - /* -d and !-p */ - if (opts->d && !opts->p) { - for (i = 0; i < nelmts; i++) { - HDmemcpy(&temp1_llong, mem1, sizeof(long long)); - HDmemcpy(&temp2_llong, mem2, sizeof(long long)); + H5TOOLS_START_DEBUG("delta_bool:%d - percent_bool:%d", opts->delta_bool, opts->percent_bool); - if (ABS( temp1_llong-temp2_llong) > opts->delta) { - if (print_data(opts)) { - print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(LLI_FORMAT, temp1_llong, temp2_llong, ABS(temp1_llong - temp2_llong)); - } - nfound++; + HDmemcpy(&temp1_llong, mem1, sizeof(long long)); + HDmemcpy(&temp2_llong, mem2, sizeof(long long)); + + /* -d and !-p */ + if (opts->delta_bool && !opts->percent_bool) { + if (ABS( temp1_llong-temp2_llong) > opts->delta) { + opts->print_percentage = 0; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(LLI_FORMAT, temp1_llong, temp2_llong, ABS(temp1_llong - temp2_llong)); } - mem1 += sizeof(long long); - mem2 += sizeof(long long); - if (opts->n && nfound >= opts->count) - return nfound; + nfound++; } } /* !-d and -p */ - else if (!opts->d && opts->p) { - for (i = 0; i < nelmts; i++) { - HDmemcpy(&temp1_llong, mem1, sizeof(long long)); - HDmemcpy(&temp2_llong, mem2, sizeof(long long)); - - PER(temp1_llong, temp2_llong); + else if (!opts->delta_bool && opts->percent_bool) { + PER(temp1_llong, temp2_llong); - if (not_comparable && !both_zero) { - if (print_data(opts)) { - print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); + if (not_comparable && !both_zero) { + opts->print_percentage = 1; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { parallel_print(LLI_FORMAT_P_NOTCOMP, temp1_llong, temp2_llong, ABS(temp1_llong - temp2_llong)); } nfound++; } else if (per > opts->percent) { + opts->print_percentage = 1; + print_pos(opts, elem_idx, 0); if (print_data(opts)) { - print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); parallel_print(LLI_FORMAT_P, temp1_llong, temp2_llong, ABS(temp1_llong - temp2_llong),per); } nfound++; } - mem1 += sizeof(long long); - mem2 += sizeof(long long); - if (opts->n && nfound >= opts->count) - return nfound; - } } /* -d and -p */ - else if (opts->d && opts->p) { - for (i = 0; i < nelmts; i++) { - HDmemcpy(&temp1_llong, mem1, sizeof(long long)); - HDmemcpy(&temp2_llong, mem2, sizeof(long long)); + else if (opts->delta_bool && opts->percent_bool) { + PER(temp1_llong, temp2_llong); - PER(temp1_llong, temp2_llong); - - if (not_comparable && !both_zero) { - if (print_data(opts)) { - print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(LLI_FORMAT_P_NOTCOMP, temp1_llong, temp2_llong, ABS(temp1_llong - temp2_llong)); - } - nfound++; + if (not_comparable && !both_zero) { + opts->print_percentage = 1; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(LLI_FORMAT_P_NOTCOMP, temp1_llong, temp2_llong, ABS(temp1_llong - temp2_llong)); } - else if (per > opts->percent - && ABS(temp1_llong-temp2_llong) > opts->delta) { - if (print_data(opts)) { - print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(LLI_FORMAT_P, temp1_llong, temp2_llong, ABS(temp1_llong - temp2_llong),per); - } - nfound++; + nfound++; + } + else if (per > opts->percent && ABS(temp1_llong-temp2_llong) > opts->delta) { + opts->print_percentage = 1; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(LLI_FORMAT_P, temp1_llong, temp2_llong, ABS(temp1_llong - temp2_llong),per); } - mem1 += sizeof(long long); - mem2 += sizeof(long long); - if (opts->n && nfound >= opts->count) - return nfound; + nfound++; } } else { - for (i = 0; i < nelmts; i++) { - HDmemcpy(&temp1_llong, mem1, sizeof(long long)); - HDmemcpy(&temp2_llong, mem2, sizeof(long long)); - - if (temp1_llong != temp2_llong) { - if (print_data(opts)) { - print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(LLI_FORMAT, temp1_llong, temp2_llong, ABS(temp1_llong - temp2_llong)); - } - nfound++; + if (temp1_llong != temp2_llong) { + opts->print_percentage = 0; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(LLI_FORMAT, temp1_llong, temp2_llong, ABS(temp1_llong - temp2_llong)); } - - mem1 += sizeof(long long); - mem2 += sizeof(long long); - if (opts->n && nfound >= opts->count) - return nfound; - } /* nelmts */ + nfound++; + } } + H5TOOLS_ENDDEBUG(":%d - errstat:%d", nfound, opts->err_stat); + return nfound; } /*------------------------------------------------------------------------- - * Function: diff_ullong + * Function: diff_ullong_element * - * Purpose: diff a H5T_NATIVE_ULLONG type + * Purpose: diff a single H5T_NATIVE_ULLONG type * * Return: number of differences found *------------------------------------------------------------------------- */ -static hsize_t diff_ullong(unsigned char *mem1, unsigned char *mem2, - hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims, hsize_t *acc, - hsize_t *pos, diff_opt_t *opts, const char *obj1, const char *obj2, int *ph) - +static hsize_t diff_ullong_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts) { hsize_t nfound = 0; /* number of differences found */ unsigned long long temp1_ullong; unsigned long long temp2_ullong; - hsize_t i; float f1, f2; double per; - hbool_t both_zero; + hbool_t both_zero = FALSE; - /* -d and !-p */ - if (opts->d && !opts->p) { - for (i = 0; i < nelmts; i++) { - HDmemcpy(&temp1_ullong, mem1, sizeof(unsigned long long)); - HDmemcpy(&temp2_ullong, mem2, sizeof(unsigned long long)); + H5TOOLS_START_DEBUG("delta_bool:%d - percent_bool:%d", opts->delta_bool, opts->percent_bool); - if (PDIFF(temp1_ullong,temp2_ullong) > (unsigned long long) opts->delta) { - if (print_data(opts)) { - print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(ULLI_FORMAT,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong)); - } - nfound++; + HDmemcpy(&temp1_ullong, mem1, sizeof(unsigned long long)); + HDmemcpy(&temp2_ullong, mem2, sizeof(unsigned long long)); + + /* -d and !-p */ + if (opts->delta_bool && !opts->percent_bool) { + if (PDIFF(temp1_ullong,temp2_ullong) > (unsigned long long) opts->delta) { + opts->print_percentage = 0; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(ULLI_FORMAT, temp1_ullong, temp2_ullong, PDIFF(temp1_ullong, temp2_ullong)); } - mem1 += sizeof(unsigned long long); - mem2 += sizeof(unsigned long long); - if (opts->n && nfound >= opts->count) - return nfound; + nfound++; } } /* !-d and -p */ - else if (!opts->d && opts->p) { - for (i = 0; i < nelmts; i++) { - HDmemcpy(&temp1_ullong, mem1, sizeof(unsigned long long)); - HDmemcpy(&temp2_ullong, mem2, sizeof(unsigned long long)); - - ull2float(temp1_ullong, &f1); - ull2float(temp2_ullong, &f2); - PER(f1, f2); - - if (not_comparable && !both_zero) { - if (print_data(opts)) { - print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(ULLI_FORMAT_P_NOTCOMP,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong)); - } - nfound++; + else if (!opts->delta_bool && opts->percent_bool) { + ull2float(temp1_ullong, &f1); + ull2float(temp2_ullong, &f2); + PER(f1, f2); + + if (not_comparable && !both_zero) { + opts->print_percentage = 1; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(ULLI_FORMAT_P_NOTCOMP, temp1_ullong, temp2_ullong, PDIFF(temp1_ullong, temp2_ullong)); } - else if (per > opts->percent) { - if (print_data(opts)) { - print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(ULLI_FORMAT_P,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong),per); - } - nfound++; + nfound++; + } + else if (per > opts->percent) { + opts->print_percentage = 1; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(ULLI_FORMAT_P, temp1_ullong, temp2_ullong, PDIFF(temp1_ullong,temp2_ullong), per); } - mem1 += sizeof(unsigned long long); - mem2 += sizeof(unsigned long long); - if (opts->n && nfound >= opts->count) - return nfound; + nfound++; } } /* -d and -p */ - else if (opts->d && opts->p) { - for (i = 0; i < nelmts; i++) { - HDmemcpy(&temp1_ullong, mem1, sizeof(unsigned long long)); - HDmemcpy(&temp2_ullong, mem2, sizeof(unsigned long long)); - - ull2float(temp1_ullong, &f1); - ull2float(temp2_ullong, &f2); - PER(f1, f2); - - if (not_comparable && !both_zero) { - if (print_data(opts)) { - print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(ULLI_FORMAT_P_NOTCOMP,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong)); - } - nfound++; + else if (opts->delta_bool && opts->percent_bool) { + ull2float(temp1_ullong, &f1); + ull2float(temp2_ullong, &f2); + PER(f1, f2); + + if (not_comparable && !both_zero) { + opts->print_percentage = 1; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(ULLI_FORMAT_P_NOTCOMP, temp1_ullong, temp2_ullong, PDIFF(temp1_ullong, temp2_ullong)); } - else if (per > opts->percent - && PDIFF(temp1_ullong,temp2_ullong) > (unsigned long long) opts->delta) { - if (print_data(opts)) { - print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(ULLI_FORMAT_P,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong),per); - } - nfound++; + nfound++; + } + else if (per > opts->percent && PDIFF(temp1_ullong,temp2_ullong) > (unsigned long long) opts->delta) { + opts->print_percentage = 1; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(ULLI_FORMAT_P, temp1_ullong, temp2_ullong, PDIFF(temp1_ullong, temp2_ullong), per); } - mem1 += sizeof(unsigned long long); - mem2 += sizeof(unsigned long long); - if (opts->n && nfound >= opts->count) - return nfound; + nfound++; } } else { - for (i = 0; i < nelmts; i++) { - HDmemcpy(&temp1_ullong, mem1, sizeof(unsigned long long)); - HDmemcpy(&temp2_ullong, mem2, sizeof(unsigned long long)); - - if (temp1_ullong != temp2_ullong) { - if (print_data(opts)) { - print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2); - parallel_print(SPACES); - parallel_print(ULLI_FORMAT,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong)); - } - nfound++; + if (temp1_ullong != temp2_ullong) { + opts->print_percentage = 0; + print_pos(opts, elem_idx, 0); + if (print_data(opts)) { + parallel_print(ULLI_FORMAT, temp1_ullong, temp2_ullong, PDIFF(temp1_ullong, temp2_ullong)); } - - mem1 += sizeof(unsigned long long); - mem2 += sizeof(unsigned long long); - if (opts->n && nfound >= opts->count) - return nfound; - } /* nelmts */ + nfound++; + } } + H5TOOLS_ENDDEBUG(": %d zero:%d", nfound, both_zero); return nfound; } @@ -4681,7 +3214,7 @@ static hbool_t equal_float(float value, float expected, diff_opt_t *opts) { static int print_data(diff_opt_t *opts) { - return ((opts->m_report || opts->m_verbose) && !opts->m_quiet) ? 1 : 0; + return ((opts->mode_report || opts->mode_verbose) && !opts->mode_quiet) ? 1 : 0; } /*------------------------------------------------------------------------- @@ -4691,25 +3224,24 @@ int print_data(diff_opt_t *opts) *------------------------------------------------------------------------- */ static -void print_header(int pp, /* print percentage */ - int rank, hsize_t *dims, const char *obj1, const char *obj2) +void print_header(diff_opt_t *opts) { /* print header */ parallel_print("%-16s", "size:"); - print_dimensions(rank, dims); + print_dimensions(opts->rank, opts->dims); parallel_print("%-11s", ""); - print_dimensions(rank, dims); + print_dimensions(opts->rank, opts->dims); parallel_print("\n"); - if (pp) { + if (opts->print_percentage) { parallel_print("%-15s %-15s %-15s %-15s %-15s\n", "position", - (obj1 != NULL) ? obj1 : " ", (obj2 != NULL) ? obj2 : " ", "difference", "relative"); + opts->obj_name[0], opts->obj_name[1], "difference", "relative"); parallel_print( "------------------------------------------------------------------------\n"); } else { parallel_print("%-15s %-15s %-15s %-20s\n", "position", - (obj1 != NULL) ? obj1 : " ", (obj2 != NULL) ? obj2 : " ", "difference"); + opts->obj_name[0], opts->obj_name[1], "difference"); parallel_print( "------------------------------------------------------------\n"); } @@ -4722,77 +3254,94 @@ void print_header(int pp, /* print percentage */ *------------------------------------------------------------------------- */ static -void print_pos(int *ph, /* print header */ - int pp, /* print percentage */ - hsize_t curr_pos, hsize_t *acc, hsize_t *pos, int rank, hsize_t *dims, - const char *obj1, const char *obj2) +void print_pos(diff_opt_t *opts, hsize_t idx, size_t u) { - int i; - - /* print header */ - if (*ph == 1) { - *ph = 0; - - print_header(pp, rank, dims, obj1, obj2); - } /* end print header */ - - for (i = 0; i < rank; i++) { - pos[i] = curr_pos / acc[i]; - curr_pos -= acc[i] * pos[i]; - } - HDassert(curr_pos == 0); + int i,j; + + H5TOOLS_START_DEBUG(" -- idx:%ld", idx); + + if (print_data(opts)) { + /* print header */ + if (opts->print_header == 1) { + opts->print_header = 0; + + print_header(opts); + } /* end print header */ + + H5TOOLS_DEBUG("rank=%d", opts->rank); + if(opts->rank > 0) { + hsize_t curr_pos = idx; + + parallel_print("[ "); + H5TOOLS_DEBUG("do calc_acc_pos[%ld] nelmts:%d - errstat:%d", i, opts->hs_nelmts, opts->err_stat); + + if (opts->sset[0] != NULL) { + /* Subsetting is used - calculate total position */ + hsize_t elmnt_cnt = 1; + hsize_t dim_cnt = 0; /* previous dim size */ + hsize_t str_cnt = 0; /* previous dim stride */ + hsize_t curr_idx = idx; /* calculated running position */ + hsize_t str_idx = 0; + hsize_t blk_idx = 0; + hsize_t cnt_idx = 0; + hsize_t hs_idx = 0; + j = opts->rank-1; + do { + cnt_idx = opts->sset[0]->count.data[j]; /* Count value for current dim */ + H5TOOLS_DEBUG("... sset loop:%d with curr_pos:%ld (curr_idx:%ld) - count:%ld", j, curr_pos, curr_idx, cnt_idx); + blk_idx = opts->sset[0]->block.data[j]; /* Block value for current dim */ + H5TOOLS_DEBUG("... sset loop:%d with curr_pos:%ld (curr_idx:%ld) - block:%ld", j, curr_pos, curr_idx, blk_idx); + hs_idx = cnt_idx * blk_idx; /* hyperslab area value for current dim */ + H5TOOLS_DEBUG("... sset loop:%d with curr_pos:%ld (curr_idx:%ld) - hs:%ld", j, curr_pos, curr_idx, hs_idx); + str_idx = opts->sset[0]->stride.data[j]; /* Stride value for current dim */ + H5TOOLS_DEBUG("... sset loop:%d with curr_pos:%ld (curr_idx:%ld) - stride:%ld", j, curr_pos, curr_idx, str_idx); + elmnt_cnt *= opts->dims[j]; /* Total number of elements in dimension */ + H5TOOLS_DEBUG("... sset loop:%d with elmnt_cnt:%ld", j, elmnt_cnt); + if (str_idx > blk_idx) + curr_idx += dim_cnt * (str_idx - blk_idx); /* */ + else if (curr_idx >= hs_idx) + curr_idx += dim_cnt * str_cnt; + H5TOOLS_DEBUG("... sset loop:%d with idx:%ld (curr_idx:%ld) - stride:%ld", j, idx, curr_idx, str_idx); + dim_cnt = elmnt_cnt; /* */ + if (str_idx > blk_idx) + str_cnt = str_idx - blk_idx; /* */ + else + str_cnt = str_idx; /* */ + H5TOOLS_DEBUG("... sset loop:%d with dim_cnt:%ld - str_cnt:%ld", j, dim_cnt, str_cnt); + j--; + } while (curr_idx >= elmnt_cnt && j >= 0); + curr_pos = curr_idx; /* New current position */ + H5TOOLS_DEBUG("pos loop:%d,%d with elmnt_cnt:%ld - curr_pos:%ld", i, j, elmnt_cnt, curr_pos); + } /* if (opts->sset[0] != NULL) */ + /* + * Calculate the number of elements represented by a unit change in a + * certain index position. + */ + calc_acc_pos((unsigned)opts->rank, curr_pos, opts->acc, opts->pos); - if (rank > 0) { - parallel_print("[ "); - for (i = 0; i < rank; i++) { - parallel_print(HSIZE_T_FORMAT, (unsigned long long)pos[i]); - parallel_print(" "); + for (i = 0; i < opts->rank; i++) { + H5TOOLS_DEBUG("pos loop:%d with opts->pos=%ld opts->sm_pos=%ld", i, opts->pos[i], opts->sm_pos[i]); + opts->pos[i] += (unsigned long) opts->sm_pos[i]; + H5TOOLS_DEBUG("pos loop:%d with opts->pos=%ld", i, opts->pos[i]); + parallel_print(HSIZE_T_FORMAT, (unsigned long long)opts->pos[i]); + parallel_print(" "); + } + parallel_print("]"); } - parallel_print("]"); - } - else - parallel_print(" "); -} - -/*------------------------------------------------------------------------- - * Function: print_char_pos - * - * Purpose: print character position in string - *------------------------------------------------------------------------- - */ -static -void print_char_pos(int *ph, /* print header */ - int pp, /* print percentage */ - hsize_t curr_pos, size_t u, hsize_t *acc, hsize_t *pos, int rank, hsize_t *dims, - const char *obj1, const char *obj2) -{ - int i; - - /* print header */ - if (*ph == 1) { - *ph = 0; - - print_header(pp, rank, dims, obj1, obj2); - } /* end print header */ - - for (i = 0; i < rank; i++) { - pos[i] = curr_pos / acc[i]; - curr_pos -= acc[i] * pos[i]; - } - HDassert(curr_pos == 0); - - parallel_print("[ "); - if (rank > 0) { - for (i = 0; i < rank; i++) { - parallel_print(HSIZE_T_FORMAT, (unsigned long long)pos[i]); - parallel_print(" "); + else { + if (opts->print_dims) { + parallel_print("[ "); + parallel_print("%zu", u); + parallel_print("]"); + opts->print_dims = 0; + } + else + parallel_print(" "); } - + parallel_print(SPACES); } - else - parallel_print("%zu", u); - parallel_print("]"); + H5TOOLS_ENDDEBUG(""); } /*------------------------------------------------------------------------- diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c index 5ad29fc..48663e2 100644 --- a/tools/lib/h5diff_attr.c +++ b/tools/lib/h5diff_attr.c @@ -137,7 +137,7 @@ static void table_attr_mark_exist(unsigned *exist, char *name, table_attrs_t *ta * Parameter: * table_out [OUT] : return the list *------------------------------------------------------------------------*/ -static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t ** table_out, diff_opt_t *opts) +static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t ** table_out, diff_opt_t *opts) { table_attrs_t *table_lp = NULL; H5O_info2_t oinfo1, oinfo2; /* Object info */ @@ -171,8 +171,8 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t * build the list */ while(curr1 < oinfo1.num_attrs && curr2 < oinfo2.num_attrs) { - H5TOOLS_DEBUG("build_match_list_attrs 1: %ld - %ld", curr1, oinfo1.num_attrs); - H5TOOLS_DEBUG("build_match_list_attrs 2: %ld - %ld", curr2, oinfo2.num_attrs); + H5TOOLS_DEBUG("list_attrs 1: %ld - %ld", curr1, oinfo1.num_attrs); + H5TOOLS_DEBUG("list_attrs 2: %ld - %ld", curr2, oinfo2.num_attrs); /*------------------ * open attribute1 */ @@ -226,7 +226,7 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t infile[0] = 1; infile[1] = 0; while(curr1 < oinfo1.num_attrs) { - H5TOOLS_DEBUG("build_match_list_attrs 1: %ld - %ld", curr1, oinfo1.num_attrs); + H5TOOLS_DEBUG("list_attrs 1: %ld - %ld", curr1, oinfo1.num_attrs); /*------------------ * open attribute1 */ @@ -235,7 +235,7 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t /* get name */ if(H5Aget_name(attr1_id, (size_t)ATTR_NAME_MAX, name1) < 0) H5TOOLS_GOTO_ERROR(FAIL, "H5Aget_name first attribute failed"); - H5TOOLS_DEBUG("build_match_list_attrs #1 name - %s", name1); + H5TOOLS_DEBUG("list_attrs 1 name - %s", name1); table_attr_mark_exist(infile, name1, table_lp); table_lp->nattrs_only1++; @@ -250,7 +250,7 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t infile[0] = 0; infile[1] = 1; while(curr2 < oinfo2.num_attrs) { - H5TOOLS_DEBUG("build_match_list_attrs 2: %ld - %ld", curr2, oinfo2.num_attrs); + H5TOOLS_DEBUG("list_attrs 2: %ld - %ld", curr2, oinfo2.num_attrs); /*------------------ * open attribute2 */ if((attr2_id = H5Aopen_by_idx(loc2_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)curr2, H5P_DEFAULT, H5P_DEFAULT)) < 0) @@ -258,7 +258,7 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t /* get name */ if(H5Aget_name(attr2_id, (size_t)ATTR_NAME_MAX, name2) < 0) H5TOOLS_GOTO_ERROR(FAIL, "H5Aget_name second attribute failed"); - H5TOOLS_DEBUG("build_match_list_attrs #2 name - %s", name2); + H5TOOLS_DEBUG("list_attrs 2 name - %s", name2); table_attr_mark_exist(infile, name2, table_lp); table_lp->nattrs_only2++; @@ -272,7 +272,7 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t /*------------------------------------------------------ * print the list */ - if(opts->m_verbose_level == 2) { + if(opts->mode_verbose_level == 2) { /* if '-v2' is detected */ parallel_print(" obj1 obj2\n"); parallel_print(" --------------------------------------\n"); @@ -284,7 +284,7 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t } /* end for */ } - if(opts->m_verbose_level >= 1) + if(opts->mode_verbose_level >= 1) parallel_print("Attributes status: %d common, %d only in obj1, %d only in obj2\n", table_lp->nattrs - table_lp->nattrs_only1 - table_lp->nattrs_only2, table_lp->nattrs_only1, table_lp->nattrs_only2); @@ -313,7 +313,8 @@ done: *------------------------------------------------------------------------- */ -hsize_t diff_attr_data(hid_t attr1_id, hid_t attr2_id, const char *name1, const char *name2, const char *path1, const char *path2, diff_opt_t *opts) +hsize_t diff_attr_data(hid_t attr1_id, hid_t attr2_id, + const char *name1, const char *name2, const char *path1, const char *path2, diff_opt_t *opts) { hid_t space1_id = H5I_INVALID_HID; /* space ID */ hid_t space2_id = H5I_INVALID_HID; /* space ID */ @@ -327,19 +328,15 @@ hsize_t diff_attr_data(hid_t attr1_id, hid_t attr2_id, const char *name1, const void *buf2 = NULL; /* data buffer */ hbool_t buf1hasdata = FALSE; /* buffer has data */ hbool_t buf2hasdata = FALSE; /* buffer has data */ - hsize_t nelmts1; /* number of elements in dataset */ int rank1; /* rank of dataset */ int rank2; /* rank of dataset */ hsize_t dims1[H5S_MAX_RANK]; /* dimensions of dataset */ hsize_t dims2[H5S_MAX_RANK]; /* dimensions of dataset */ - char np1[512]; - char np2[512]; hsize_t nfound = 0; - int j; + size_t sz; diff_err_t ret_value = opts->err_stat; H5TOOLS_START_DEBUG(" - errstat:%d", opts->err_stat); - /* get the datatypes */ if((ftype1_id = H5Aget_type(attr1_id)) < 0) H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Aget_type first attribute failed"); @@ -383,11 +380,33 @@ hsize_t diff_attr_data(hid_t attr1_id, hid_t attr2_id, const char *name1, const * check for comparable TYPE and SPACE *---------------------------------------------------------------------- */ - H5TOOLS_DEBUG("diff_attr_data check for comparable TYPE and SPACE"); + H5TOOLS_DEBUG("Check for comparable TYPE and SPACE"); + + H5TOOLS_DEBUG("attr_names: %s - %s", name1, name2); + if (name1) { + sz = HDstrlen(name1); + H5TOOLS_DEBUG("attr1_name: %s - %d", name1, sz); + if (sz > 0) { + opts->obj_name[0] = (char *)HDmalloc(sz + 1); + HDstrncpy(opts->obj_name[0], name1, sz + 1); + } + } + if (name2) { + sz = HDstrlen(name2); + H5TOOLS_DEBUG("attr2_name: %s - %d", name2, sz); + if (sz > 0) { + opts->obj_name[1] = (char *)HDmalloc(sz + 1); + HDstrncpy(opts->obj_name[1], name2, sz + 1); + } + } + H5TOOLS_DEBUG("attr_names: %s - %s", opts->obj_name[0], opts->obj_name[1]); /* pass dims1 and dims2 for maxdims as well since attribute's maxdims * are always same */ - if(diff_can_type(ftype1_id, ftype2_id, rank1, rank2, dims1, dims2, dims1, dims2, name1, name2, opts, 0) == 1) { + if(diff_can_type(ftype1_id, ftype2_id, rank1, rank2, dims1, dims2, dims1, dims2, opts, 0) == 1) { + + int j; + /*----------------------------------------------------------------- * "upgrade" the smaller memory size *------------------------------------------------------------------ @@ -395,17 +414,26 @@ hsize_t diff_attr_data(hid_t attr1_id, hid_t attr2_id, const char *name1, const if(FAIL == match_up_memsize(ftype1_id, ftype2_id, &mtype1_id, &mtype2_id, &msize1, &msize2)) H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "match_up_memsize failed"); - H5TOOLS_DEBUG("diff_attr_data read"); + H5TOOLS_DEBUG("initialize read"); /*--------------------------------------------------------------------- - * read + * initialize diff_opt_t structure for dimensions *---------------------------------------------------------------------- */ - nelmts1 = 1; - for(j = 0; j < rank1; j++) - nelmts1 *= dims1[j]; + opts->nelmts = 1; + for(j = 0; j < rank1; j++) { + opts->dims[j] = dims1[j]; + opts->nelmts *= dims1[j]; + } + opts->rank = rank1; + init_acc_pos((unsigned)opts->rank, opts->dims, opts->acc, opts->pos, opts->p_min_idx); - buf1 = (void *)HDcalloc((size_t)(nelmts1), msize1); - buf2 = (void *)HDcalloc((size_t)(nelmts1), msize2); + /*--------------------------------------------------------------------- + * read + *---------------------------------------------------------------------- + */ + buf1 = (void *)HDcalloc((size_t)(opts->nelmts), msize1); + buf2 = (void *)HDcalloc((size_t)(opts->nelmts), msize2); + H5TOOLS_DEBUG("attr buffer size %ld * %ld", opts->nelmts, msize1); if(buf1 == NULL || buf2 == NULL) { parallel_print("cannot read into memory\n"); H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "buffer allocation failed"); @@ -416,6 +444,7 @@ hsize_t diff_attr_data(hid_t attr1_id, hid_t attr2_id, const char *name1, const } else buf1hasdata = TRUE; + H5TOOLS_DEBUG("attr H5Aread 1"); if(H5Aread(attr2_id, mtype2_id, buf2) < 0) { parallel_print("Failed reading attribute2 %s\n", name2); @@ -423,49 +452,80 @@ hsize_t diff_attr_data(hid_t attr1_id, hid_t attr2_id, const char *name1, const } else buf2hasdata = TRUE; + H5TOOLS_DEBUG("attr H5Aread 2"); /* format output string */ - HDsnprintf(np1, sizeof(np1), "%s of <%s>", name1, path1); - HDsnprintf(np2, sizeof(np1), "%s of <%s>", name2, path2); + if (opts->obj_name[0] != NULL) + HDfree(opts->obj_name[0]); + opts->obj_name[0] = NULL; + if (opts->obj_name[1] != NULL) + HDfree(opts->obj_name[1]); + opts->obj_name[1] = NULL; + + H5TOOLS_DEBUG("attr_names: %s - %s : %s - %s", name1, name2, path1, path2); + if (name1) { + sz = HDstrlen(name1) + HDstrlen(path1) + 7; + H5TOOLS_DEBUG("attr1_name: %s - %d", name1, sz); + opts->obj_name[0] = (char *)HDcalloc(sz + 1, sizeof(char)); + HDsnprintf(opts->obj_name[0], sz, "%s of <%s>", name1, path1); + opts->obj_name[0][sz] = '\0'; + } + if (name2) { + sz = HDstrlen(name2) + HDstrlen(path2) + 7; + H5TOOLS_DEBUG("attr2_name: %s - %d", name2, sz); + opts->obj_name[1] = (char *)HDcalloc(sz + 1, sizeof(char)); + HDsnprintf(opts->obj_name[1], sz, "%s of <%s>", name2, path2); + opts->obj_name[1][sz] = '\0'; + } /*--------------------------------------------------------------------- * array compare *---------------------------------------------------------------------- */ - H5TOOLS_DEBUG("diff_attr_data array compare %s - %s", name1, name1); + H5TOOLS_DEBUG("array compare %s - %s", opts->obj_name[0], opts->obj_name[1]); + + opts->hs_nelmts = opts->nelmts; + opts->m_tid = mtype1_id; + + /* initialize the current stripmine position; this is necessary to print the array indices */ + for (j = 0; j < opts->rank; j++) + opts->sm_pos[j] = (hsize_t)0; /* always print name */ /* verbose (-v) and report (-r) mode */ - if(opts->m_verbose || opts->m_report) { - do_print_attrname("attribute", np1, np2); + if(opts->mode_verbose || opts->mode_report) { + do_print_attrname("attribute", opts->obj_name[0], opts->obj_name[1]); - nfound = diff_array(buf1, buf2, nelmts1, (hsize_t) 0, rank1, - dims1, opts, np1, np2, mtype1_id, attr1_id, attr2_id); + nfound = diff_array(buf1, buf2, opts, attr1_id, attr2_id); print_found(nfound); } /* quiet mode (-q), just count differences */ - else if(opts->m_quiet) { - nfound = diff_array(buf1, buf2, nelmts1, (hsize_t) 0, rank1, - dims1, opts, np1, np2, mtype1_id, attr1_id, attr2_id); + else if(opts->mode_quiet) { + nfound = diff_array(buf1, buf2, opts, attr1_id, attr2_id); } /* the rest (-c, none, ...) */ else { - nfound = diff_array(buf1, buf2, nelmts1, (hsize_t) 0, rank1, - dims1, opts, np1, np2, mtype1_id, attr1_id, attr2_id); + nfound = diff_array(buf1, buf2, opts, attr1_id, attr2_id); /* print info if compatible and difference found */ if (nfound) { - do_print_attrname("attribute", np1, np2); + do_print_attrname("attribute", opts->obj_name[0], opts->obj_name[1]); print_found(nfound); } /* end if */ } /* end else */ } - H5TOOLS_DEBUG("diff_attr_data check for comparable TYPE and SPACE complete nfound:%d - errstat:%d", nfound, opts->err_stat); + H5TOOLS_DEBUG("check for comparable TYPE and SPACE complete nfound:%d - errstat:%d", nfound, opts->err_stat); /*---------------------------------------------------------------------- * close *---------------------------------------------------------------------- */ + if (opts->obj_name[0] != NULL) + HDfree(opts->obj_name[0]); + opts->obj_name[0] = NULL; + if (opts->obj_name[1] != NULL) + HDfree(opts->obj_name[1]); + opts->obj_name[1] = NULL; /* Free buf1 and buf2, check both VLEN-data VLEN-string to reclaim any * VLEN memory first */ @@ -543,28 +603,32 @@ hsize_t diff_attr(hid_t loc1_id, hid_t loc2_id, const char *path1, const char *p unsigned u; /* Local index variable */ hsize_t nfound = 0; hsize_t nfound_total = 0; + diff_opt_t attr_opts; diff_err_t ret_value = opts->err_stat; H5TOOLS_START_DEBUG(" - errstat:%d", opts->err_stat); + attr_opts = *opts; + attr_opts.obj_name[0] = NULL; + attr_opts.obj_name[1] = NULL; - if(build_match_list_attrs(loc1_id, loc2_id, &match_list_attrs, opts) < 0) { + if(build_match_list_attrs(loc1_id, loc2_id, &match_list_attrs, &attr_opts) < 0) { H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "build_match_list_attrs failed"); } - H5TOOLS_DEBUG("build_match_list_attrs - errstat:%d", opts->err_stat); + H5TOOLS_DEBUG("check match_list_attrs - opts->contents:%d - errstat:%d", attr_opts.contents, attr_opts.err_stat); /* if detect any unique extra attr */ if(match_list_attrs->nattrs_only1 || match_list_attrs->nattrs_only2) { - H5TOOLS_DEBUG("diff_attr attributes only in one file"); + H5TOOLS_DEBUG("attributes only in one file"); /* exit will be 1 */ - opts->contents = 0; + attr_opts.contents = 0; } - H5TOOLS_DEBUG("match_list_attrs info - errstat:%d", opts->err_stat); + H5TOOLS_DEBUG("match_list_attrs info - opts->contents:%d", attr_opts.contents); for(u = 0; u < (unsigned)match_list_attrs->nattrs; u++) { - H5TOOLS_DEBUG("match_list_attrs loop[%d] - errstat:%d", u, opts->err_stat); + H5TOOLS_DEBUG("match_list_attrs loop[%d] - errstat:%d", u, attr_opts.err_stat); if((match_list_attrs->attrs[u].exist[0]) && (match_list_attrs->attrs[u].exist[1])) { name1 = name2 = match_list_attrs->attrs[u].name; - H5TOOLS_DEBUG("diff_attr name - %s", name1); + H5TOOLS_DEBUG("name - %s", name1); /*-------------- * attribute 1 */ @@ -576,8 +640,8 @@ hsize_t diff_attr(hid_t loc1_id, hid_t loc2_id, const char *path1, const char *p if((attr2_id = H5Aopen(loc2_id, name2, H5P_DEFAULT)) < 0) H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Aopen second attribute failed"); - H5TOOLS_DEBUG("diff_attr got attributes"); - nfound = diff_attr_data(attr1_id, attr2_id, name1, name2, path1, path2, opts); + H5TOOLS_DEBUG("got attributes"); + nfound = diff_attr_data(attr1_id, attr2_id, name1, name2, path1, path2, &attr_opts); if(H5Aclose(attr1_id) < 0) H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Aget_type first attribute failed"); if(H5Aclose(attr2_id) < 0) @@ -588,7 +652,10 @@ hsize_t diff_attr(hid_t loc1_id, hid_t loc2_id, const char *path1, const char *p } /* u */ done: - opts->err_stat = opts->err_stat | ret_value; + opts->print_header = attr_opts.print_header; + opts->contents = attr_opts.contents; + opts->not_cmp = attr_opts.not_cmp; + opts->err_stat = attr_opts.err_stat | ret_value; H5E_BEGIN_TRY { table_attrs_free(match_list_attrs); diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c index cea20a8..944440e 100644 --- a/tools/lib/h5diff_dset.c +++ b/tools/lib/h5diff_dset.c @@ -27,7 +27,8 @@ * Return: Number of differences found *------------------------------------------------------------------------- */ -hsize_t diff_dataset(hid_t file1_id, hid_t file2_id, const char *obj1_name, const char *obj2_name, diff_opt_t *opts) +hsize_t +diff_dataset(hid_t file1_id, hid_t file2_id, const char *obj1_name, const char *obj2_name, diff_opt_t *opts) { int status = -1; hid_t did1 = H5I_INVALID_HID; @@ -35,9 +36,15 @@ hsize_t diff_dataset(hid_t file1_id, hid_t file2_id, const char *obj1_name, cons hid_t dcpl1 = H5I_INVALID_HID; hid_t dcpl2 = H5I_INVALID_HID; hsize_t nfound = 0; + diff_opt_t diff_opts; diff_err_t ret_value = opts->err_stat; H5TOOLS_START_DEBUG(" - errstat:%d", opts->err_stat); + diff_opts = *opts; + diff_opts.obj_name[0] = NULL; + diff_opts.obj_name[1] = NULL; + + H5TOOLS_DEBUG("obj_names: %s - %s", obj1_name, obj2_name); /*------------------------------------------------------------------------- * open the handles *------------------------------------------------------------------------- @@ -64,20 +71,22 @@ hsize_t diff_dataset(hid_t file1_id, hid_t file2_id, const char *obj1_name, cons * 2) the internal filters might be turned off *------------------------------------------------------------------------- */ - H5TOOLS_DEBUG("diff_dataset h5tools_canreadf then diff_datasetid"); - if ((status = h5tools_canreadf((opts->m_verbose ? obj1_name : NULL), dcpl1) == 1) && - (status = h5tools_canreadf((opts->m_verbose ? obj2_name : NULL), dcpl2) == 1)) - nfound = diff_datasetid(did1, did2, obj1_name, obj2_name, opts); + H5TOOLS_DEBUG("h5tools_canreadf then diff_datasetid"); + if ((status = h5tools_canreadf((opts->mode_verbose ? obj1_name : NULL), dcpl1) == 1) && + (status = h5tools_canreadf((opts->mode_verbose ? obj2_name : NULL), dcpl2) == 1)) + nfound = diff_datasetid(did1, did2, obj1_name, obj2_name, &diff_opts); else if (status < 0) { H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "h5tools_canreadf failed"); } else { ret_value = 1; - opts->not_cmp = 1; + diff_opts.not_cmp = 1; } done: - opts->err_stat = opts->err_stat | ret_value; + opts->print_header = diff_opts.print_header; + opts->not_cmp = diff_opts.not_cmp; + opts->err_stat = diff_opts.err_stat | ret_value; /* disable error reporting */ H5E_BEGIN_TRY { @@ -143,36 +152,31 @@ done: * *------------------------------------------------------------------------- */ -hsize_t diff_datasetid(hid_t did1, hid_t did2, const char *obj1_name, const char *obj2_name, diff_opt_t *opts) +hsize_t +diff_datasetid(hid_t did1, hid_t did2, const char *obj1_name, const char *obj2_name, diff_opt_t *opts) { hid_t sid1 = H5I_INVALID_HID; hid_t sid2 = H5I_INVALID_HID; hid_t f_tid1 = H5I_INVALID_HID; hid_t f_tid2 = H5I_INVALID_HID; - hid_t dam_tid = H5I_INVALID_HID; /* m_tid for diff_array function */ hid_t m_tid1 = H5I_INVALID_HID; hid_t m_tid2 = H5I_INVALID_HID; hid_t dcpl1 = H5I_INVALID_HID; hid_t dcpl2 = H5I_INVALID_HID; H5D_layout_t stl1 = -1; H5D_layout_t stl2 = -1; - size_t dam_size; /* m_size for diff_array function */ size_t m_size1; size_t m_size2; H5T_sign_t sign1; H5T_sign_t sign2; int rank1; int rank2; - hsize_t danelmts; /* nelmts for diff_array function */ hsize_t nelmts1; hsize_t nelmts2; - hsize_t *dadims; /* dims for diff_array function */ hsize_t dims1[H5S_MAX_RANK]; hsize_t dims2[H5S_MAX_RANK]; hsize_t maxdim1[H5S_MAX_RANK]; hsize_t maxdim2[H5S_MAX_RANK]; - const char *name1 = NULL; /* relative names */ - const char *name2 = NULL; hsize_t storage_size1; hsize_t storage_size2; hsize_t nfound = 0; /* number of differences found */ @@ -181,9 +185,10 @@ hsize_t diff_datasetid(hid_t did1, hid_t did2, const char *obj1_name, const char void *buf2 = NULL; void *sm_buf1 = NULL; void *sm_buf2 = NULL; - hid_t sm_space = H5I_INVALID_HID; /*stripmine data space */ + hid_t sm_space1 = H5I_INVALID_HID; /*stripmine data space */ + hid_t sm_space2 = H5I_INVALID_HID; /*stripmine data space */ size_t need; /* bytes needed for malloc */ - int i; + int i, j; unsigned int vl_data1 = 0; /*contains VL datatypes */ unsigned int vl_data2 = 0; /*contains VL datatypes */ diff_err_t ret_value = opts->err_stat; @@ -233,13 +238,15 @@ hsize_t diff_datasetid(hid_t did1, hid_t did2, const char *obj1_name, const char */ if((dcpl1 = H5Dget_create_plist(did1)) < 0) H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Dget_create_plist failed"); - if((dcpl2 = H5Dget_create_plist(did2)) < 0) - H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Dget_create_plist failed"); - if((stl1 = H5Pget_layout(dcpl1)) < 0) H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Pget_layout failed"); + H5Pclose(dcpl1); + + if((dcpl2 = H5Dget_create_plist(did2)) < 0) + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Dget_create_plist failed"); if((stl2 = H5Pget_layout(dcpl2)) < 0) H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Pget_layout failed"); + H5Pclose(dcpl2); /*------------------------------------------------------------------------- * check for empty datasets @@ -253,27 +260,46 @@ hsize_t diff_datasetid(hid_t did1, hid_t did2, const char *obj1_name, const char if(storage_size1 == 0 || storage_size2 == 0) { if(stl1 == H5D_VIRTUAL || stl2 == H5D_VIRTUAL) { - if((opts->m_verbose||opts->m_list_not_cmp) && obj1_name && obj2_name) + if((opts->mode_verbose||opts->mode_list_not_cmp) && obj1_name && obj2_name) parallel_print("Warning: <%s> or <%s> is a virtual dataset\n", obj1_name, obj2_name); } else { - if((opts->m_verbose || opts->m_list_not_cmp) && obj1_name && obj2_name) + if((opts->mode_verbose || opts->mode_list_not_cmp) && obj1_name && obj2_name) parallel_print("Not comparable: <%s> or <%s> is an empty dataset\n", obj1_name, obj2_name); can_compare = 0; opts->not_cmp = 1; } } + H5TOOLS_DEBUG("obj_names: %s - %s", obj1_name, obj2_name); + opts->obj_name[0] = NULL; + if (obj1_name) { + j = (int)HDstrlen(obj1_name); + H5TOOLS_DEBUG("obj1_name: %s - %d", obj1_name, j); + if (j > 0) { + opts->obj_name[0] = (char *)HDmalloc((size_t)j + 1); + HDstrncpy(opts->obj_name[0], obj1_name, (size_t)j + 1); + } + } + + + opts->obj_name[1] = NULL; + if (obj2_name) { + j = (int)HDstrlen(obj2_name); + H5TOOLS_DEBUG("obj2_name: %s - %d", obj2_name, j); + if (j > 0) { + opts->obj_name[1] = (char *)HDmalloc((size_t)j + 1); + HDstrncpy(opts->obj_name[1], obj2_name, (size_t)j + 1); + } + } + /*------------------------------------------------------------------------- * check for comparable TYPE and SPACE *------------------------------------------------------------------------- */ - if (diff_can_type(f_tid1, f_tid2, rank1, rank2, - dims1, dims2, maxdim1, maxdim2, - obj1_name, obj2_name, - opts, 0) != 1) + if (diff_can_type(f_tid1, f_tid2, rank1, rank2, dims1, dims2, maxdim1, maxdim2, opts, 0) != 1) can_compare = 0; - H5TOOLS_DEBUG("diff_can_type - errstat:%d", opts->err_stat); + H5TOOLS_DEBUG("diff_can_type returned errstat:%d", opts->err_stat); /*------------------------------------------------------------------------- * memory type and sizes @@ -312,7 +338,7 @@ hsize_t diff_datasetid(hid_t did1, hid_t did2, const char *obj1_name, const char sign2 = H5Tget_sign(m_tid2); if(sign1 != sign2) { H5TOOLS_DEBUG("sign1 != sign2"); - if((opts->m_verbose || opts->m_list_not_cmp) && obj1_name && obj2_name) { + if((opts->mode_verbose || opts->mode_list_not_cmp) && obj1_name && obj2_name) { parallel_print("Not comparable: <%s> has sign %s ", obj1_name, get_sign(sign1)); parallel_print("and <%s> has sign %s\n", obj2_name, get_sign(sign2)); } @@ -360,41 +386,56 @@ hsize_t diff_datasetid(hid_t did1, hid_t did2, const char *obj1_name, const char *------------------------------------------------------------------ */ H5TOOLS_DEBUG("NOT H5T_ARRAY, upgrade the smaller memory size?"); - if (FAIL == match_up_memsize (f_tid1, f_tid2, - &m_tid1, &m_tid2, - &m_size1, &m_size2)) + if (FAIL == match_up_memsize (f_tid1, f_tid2, &m_tid1, &m_tid2, &m_size1, &m_size2)) H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "match_up_memsize failed"); H5TOOLS_DEBUG("m_size: %ld - %ld", m_size1, m_size2); - dadims = dims1; - dam_size = m_size1; - dam_tid = m_tid1; - danelmts = nelmts1; + opts->rank = rank1; + for(i = 0; i < rank1; i++) + opts->dims[i] = dims1[i]; + opts->m_size = m_size1; + opts->m_tid = m_tid1; + opts->nelmts = nelmts1; need = (size_t)(nelmts1 * m_size1); /* bytes needed */ } else { H5TOOLS_DEBUG("Array dims: %d - %d", dims1[0], dims2[0]); /* Compare the smallest array, but create the largest buffer */ if(m_size1 <= m_size2) { - dadims = dims1; - dam_size = m_size1; - dam_tid = m_tid1; - danelmts = nelmts1; + opts->rank = rank1; + for(i = 0; i < rank1; i++) + opts->dims[i] = dims1[i]; + opts->m_size = m_size1; + opts->m_tid = m_tid1; + opts->nelmts = nelmts1; need = (size_t)(nelmts2 * m_size2); /* bytes needed */ } else { - dadims = dims2; - dam_size = m_size2; - dam_tid = m_tid2; - danelmts = nelmts2; + opts->rank = rank2; + for(i = 0; i < rank2; i++) + opts->dims[i] = dims2[i]; + opts->m_size = m_size2; + opts->m_tid = m_tid2; + opts->nelmts = nelmts2; need = (size_t)(nelmts1 * m_size1); /* bytes needed */ } } + opts->hs_nelmts = opts->nelmts; + H5TOOLS_DEBUG("need: %ld", need); /* print names */ + H5TOOLS_DEBUG("obj_names: %s - %s", obj1_name, obj2_name); + + if (opts->obj_name[0] != NULL) + HDfree(opts->obj_name[0]); + opts->obj_name[0] = NULL; + if (opts->obj_name[1] != NULL) + HDfree(opts->obj_name[1]); + opts->obj_name[1] = NULL; + if(obj1_name) - name1 = diff_basename(obj1_name); + opts->obj_name[0] = HDstrdup(diff_basename(obj1_name)); if(obj2_name) - name2 = diff_basename(obj2_name); - H5TOOLS_DEBUG("obj_names: %s - %s", name1, name2); + opts->obj_name[1] = HDstrdup(diff_basename(obj2_name)); + H5TOOLS_DEBUG("obj_names: %s - %s", opts->obj_name[0], opts->obj_name[1]); H5TOOLS_DEBUG("read/compare"); @@ -407,7 +448,14 @@ hsize_t diff_datasetid(hid_t did1, hid_t did2, const char *obj1_name, const char buf2 = HDmalloc(need); } /* end if */ - if(buf1 != NULL && buf2 != NULL) { + /* Assume entire data space to be printed */ + init_acc_pos((unsigned)opts->rank, opts->dims, opts->acc, opts->pos, opts->p_min_idx); + + for(i = 0; i < opts->rank; i++) { + opts->p_max_idx[i] = opts->dims[i]; + } + + if(buf1 != NULL && buf2 != NULL && opts->sset[0] == NULL && opts->sset[1] == NULL) { H5TOOLS_DEBUG("buf1 != NULL && buf2 != NULL"); H5TOOLS_DEBUG("H5Dread did1"); if(H5Dread(did1, m_tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf1) < 0) @@ -416,10 +464,13 @@ hsize_t diff_datasetid(hid_t did1, hid_t did2, const char *obj1_name, const char if(H5Dread(did2, m_tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2) < 0) H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Dread failed"); + /* initialize the current stripmine position; this is necessary to print the array indices */ + for (j = 0; j < opts->rank; j++) + opts->sm_pos[j] = (hsize_t)0; + /* array diff */ - nfound = diff_array(buf1, buf2, danelmts, (hsize_t)0, rank1, dadims, - opts, name1, name2, dam_tid, did1, did2); - H5TOOLS_DEBUG("diff_array nfound:%d - errstat:%d", nfound, opts->err_stat); + nfound = diff_array(buf1, buf2, opts, did1, did2); + H5TOOLS_DEBUG("diff_array ret nfound:%d - errstat:%d", nfound, opts->err_stat); /* reclaim any VL memory, if necessary */ H5TOOLS_DEBUG("check vl_data1:%d", vl_data1); @@ -438,111 +489,369 @@ hsize_t diff_datasetid(hid_t did1, hid_t did2, const char *obj1_name, const char } } /* end if */ else { /* possibly not enough memory, read/compare by hyperslabs */ - size_t p_type_nbytes = dam_size; /*size of memory type */ - hsize_t p_nelmts = danelmts; /*total selected elmts */ - hsize_t elmtno; /*counter */ - int carry; /*counter carry value */ + hsize_t elmtno; /* counter */ + int carry; /* counter carry value */ /* stripmine info */ - hsize_t sm_size[H5S_MAX_RANK]; /*stripmine size */ - hsize_t sm_nbytes; /*bytes per stripmine */ - hsize_t sm_nelmts; /*elements per stripmine*/ + hsize_t sm_size[H5S_MAX_RANK]; /* stripmine size */ + hsize_t sm_block[H5S_MAX_RANK]; /* stripmine block size */ + hsize_t sm_nbytes; /* bytes per stripmine */ + hsize_t sm_nelmts1; /* elements per stripmine */ + hsize_t sm_nelmts2; /* elements per stripmine */ + hssize_t ssm_nelmts; /* elements temp */ /* hyperslab info */ - hsize_t hs_offset[H5S_MAX_RANK]; /*starting offset */ - hsize_t hs_size[H5S_MAX_RANK]; /*size this pass */ - hsize_t hs_nelmts; /*elements in request */ - hsize_t zero[8]; /*vector of zeros */ + hsize_t hs_offset1[H5S_MAX_RANK]; /* starting offset */ + hsize_t hs_count1[H5S_MAX_RANK]; /* number of blocks */ + hsize_t hs_block1[H5S_MAX_RANK]; /* size of blocks */ + hsize_t hs_stride1[H5S_MAX_RANK]; /* stride */ + hsize_t hs_size1[H5S_MAX_RANK]; /* size this pass */ + hsize_t hs_offset2[H5S_MAX_RANK]; /* starting offset */ + hsize_t hs_count2[H5S_MAX_RANK]; /* number of blocks */ + hsize_t hs_block2[H5S_MAX_RANK]; /* size of blocks */ + hsize_t hs_stride2[H5S_MAX_RANK]; /* stride */ + hsize_t hs_size2[H5S_MAX_RANK]; /* size this pass */ + hsize_t hs_nelmts1 = 0; /* elements in request */ + hsize_t hs_nelmts2 = 0; /* elements in request */ + hsize_t zero[8]; /* vector of zeros */ + hsize_t low[H5S_MAX_RANK]; /* low bound of hyperslab */ + hsize_t high[H5S_MAX_RANK]; /* higher bound of hyperslab */ + + H5TOOLS_DEBUG("reclaim any VL memory and free unused buffers"); + if(buf1 != NULL) { + /* reclaim any VL memory, if necessary */ + if(vl_data1) + H5Treclaim(m_tid1, sid1, H5P_DEFAULT, buf1); + HDfree(buf1); + buf1 = NULL; + } + if(buf2 != NULL) { + /* reclaim any VL memory, if necessary */ + if(vl_data2) + H5Treclaim(m_tid2, sid2, H5P_DEFAULT, buf2); + HDfree(buf2); + buf2 = NULL; + } + + /* the stripmine loop */ + HDmemset(hs_offset1, 0, sizeof hs_offset1); + HDmemset(hs_stride1, 0, sizeof hs_stride1); + HDmemset(hs_count1, 0, sizeof hs_count1); + HDmemset(hs_block1, 0, sizeof hs_block1); + HDmemset(hs_size1, 0, sizeof hs_size1); + HDmemset(hs_offset2, 0, sizeof hs_offset2); + HDmemset(hs_stride2, 0, sizeof hs_stride2); + HDmemset(hs_count2, 0, sizeof hs_count2); + HDmemset(hs_block2, 0, sizeof hs_block2); + HDmemset(hs_size2, 0, sizeof hs_size2); + HDmemset(zero, 0, sizeof zero); + + /* if subsetting was requested - initialize the subsetting variables */ + H5TOOLS_DEBUG("compare by hyperslabs: opts->nelmts=%ld - opts->m_size=%ld", opts->nelmts, opts->m_size); + if (opts->sset[0] != NULL) { + H5TOOLS_DEBUG("opts->sset[0] != NULL"); + + /* Check for valid settings - default if not specified */ + if(!opts->sset[0]->start.data || !opts->sset[0]->stride.data || !opts->sset[0]->count.data || !opts->sset[0]->block.data) { + /* they didn't specify a ``stride'' or ``block''. default to 1 in all + * dimensions */ + if(!opts->sset[0]->start.data) { + /* default to (0, 0, ...) for the start coord */ + opts->sset[0]->start.data = (hsize_t *)HDcalloc((size_t)rank1, sizeof(hsize_t)); + opts->sset[0]->start.len = (unsigned)rank1; + } + + if(!opts->sset[0]->stride.data) { + opts->sset[0]->stride.data = (hsize_t *)HDcalloc((size_t)rank1, sizeof(hsize_t)); + opts->sset[0]->stride.len = (unsigned)rank1; + for (i = 0; i < rank1; i++) + opts->sset[0]->stride.data[i] = 1; + } + + if(!opts->sset[0]->count.data) { + opts->sset[0]->count.data = (hsize_t *)HDcalloc((size_t)rank1, sizeof(hsize_t)); + opts->sset[0]->count.len = (unsigned)rank1; + for (i = 0; i < rank1; i++) + opts->sset[0]->count.data[i] = 1; + } + + if(!opts->sset[0]->block.data) { + opts->sset[0]->block.data = (hsize_t *)HDcalloc((size_t)rank1, sizeof(hsize_t)); + opts->sset[0]->block.len = (unsigned)rank1; + for (i = 0; i < rank1; i++) + opts->sset[0]->block.data[i] = 1; + } + + /*------------------------------------------------------------------------- + * check for block overlap + *------------------------------------------------------------------------- + */ + for(i = 0; i < rank1; i++) { + if(opts->sset[0]->count.data[i] > 1) { + if(opts->sset[0]->stride.data[i] < opts->sset[0]->block.data[i]) { + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "wrong subset selection[0]; blocks overlap"); + } /* end if */ + } /* end if */ + } /* end for */ + } + + /* Reset the total number of elements to the subset from the command */ + opts->nelmts = 1; + for (i = 0; i < rank1; i++) { + hs_offset1[i] = opts->sset[0]->start.data[i]; + hs_stride1[i] = opts->sset[0]->stride.data[i]; + hs_count1[i] = opts->sset[0]->count.data[i]; + hs_block1[i] = opts->sset[0]->block.data[i]; + opts->nelmts *= hs_count1[i] * hs_block1[i]; + hs_size1[i] = 0; + H5TOOLS_DEBUG("[%d]hs_offset1:%ld, hs_stride1:%ld, hs_count1:%ld, hs_block1:%ld", i, hs_offset1[i], hs_stride1[i], hs_count1[i], hs_block1[i]); + } + } + if (opts->sset[1] != NULL) { + H5TOOLS_DEBUG("opts->sset[1] != NULL"); + + /* Check for valid settings - default if not specified */ + if(!opts->sset[1]->start.data || !opts->sset[1]->stride.data || !opts->sset[1]->count.data || !opts->sset[1]->block.data) { + /* they didn't specify a ``stride'' or ``block''. default to 1 in all + * dimensions */ + if(!opts->sset[1]->start.data) { + /* default to (0, 0, ...) for the start coord */ + opts->sset[1]->start.data = (hsize_t *)HDcalloc((size_t)rank2, sizeof(hsize_t)); + opts->sset[1]->start.len = (unsigned)rank2; + } + + if(!opts->sset[1]->stride.data) { + opts->sset[1]->stride.data = (hsize_t *)HDcalloc((size_t)rank2, sizeof(hsize_t)); + opts->sset[1]->stride.len = (unsigned)rank2; + for (i = 0; i < rank2; i++) + opts->sset[1]->stride.data[i] = 1; + } + + if(!opts->sset[1]->count.data) { + opts->sset[1]->count.data = (hsize_t *)HDcalloc((size_t)rank2, sizeof(hsize_t)); + opts->sset[1]->count.len = (unsigned)rank2; + for (i = 0; i < rank2; i++) + opts->sset[1]->count.data[i] = 1; + } + + if(!opts->sset[1]->block.data) { + opts->sset[1]->block.data = (hsize_t *)HDcalloc((size_t)rank2, sizeof(hsize_t)); + opts->sset[1]->block.len = (unsigned)rank2; + for (i = 0; i < rank2; i++) + opts->sset[1]->block.data[i] = 1; + } + + /*------------------------------------------------------------------------- + * check for block overlap + *------------------------------------------------------------------------- + */ + for(i = 0; i < rank2; i++) { + if(opts->sset[1]->count.data[i] > 1) { + if(opts->sset[1]->stride.data[i] < opts->sset[1]->block.data[i]) { + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "wrong subset selection[1]; blocks overlap"); + } /* end if */ + } /* end if */ + } /* end for */ + } + + for (i = 0; i < rank2; i++) { + hs_offset2[i] = opts->sset[1]->start.data[i]; + hs_stride2[i] = opts->sset[1]->stride.data[i]; + hs_count2[i] = opts->sset[1]->count.data[i]; + hs_block2[i] = opts->sset[1]->block.data[i]; + hs_size2[i] = 0; + H5TOOLS_DEBUG("[%d]hs_offset2:%ld, hs_stride2:%ld, hs_count2:%ld, hs_block2:%ld", i, hs_offset2[i], hs_stride2[i], hs_count2[i], hs_block2[i]); + } + } /* * determine the strip mine size and allocate a buffer. The strip mine is * a hyperslab whose size is manageable. */ - sm_nbytes = p_type_nbytes; - - for(i = rank1; i > 0; --i) { - hsize_t size = H5TOOLS_BUFSIZE / sm_nbytes; - - if(size == 0) /* datum size > H5TOOLS_BUFSIZE */ - size = 1; - sm_size[i - 1] = MIN(dadims[i - 1], size); - sm_nbytes *= sm_size[i - 1]; - H5TOOLS_DEBUG("sm_nbytes: %ld", sm_nbytes); - } /* end for */ - - /* malloc return code should be verified. - * If fail, need to handle the error. - * This else branch should be recoded as a separate function. - * Note that there are many "goto error" within this branch - * that fails to address freeing other objects created here. - * E.g., sm_space. - */ - if((sm_buf1 = HDmalloc((size_t)sm_nbytes)) == NULL) - H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "HDmalloc failed"); - if((sm_buf2 = HDmalloc((size_t)sm_nbytes)) == NULL) - H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "HDmalloc failed"); + sm_nbytes = opts->m_size; + if(opts->rank > 0) { + for (i = opts->rank; i > 0; --i) { + hsize_t size = H5TOOLS_BUFSIZE / sm_nbytes; + if (size == 0) /* datum size > H5TOOLS_BUFSIZE */ + size = 1; + H5TOOLS_DEBUG("opts->dims[%d]: %ld - size: %ld", i - 1, opts->dims[i - 1], size); + if (opts->sset[1] != NULL) { + sm_size[i - 1] = MIN(hs_block1[i - 1] * hs_count1[i - 1], size); + sm_block[i - 1] = MIN(hs_block1[i - 1], sm_size[i - 1]); + } + else { + sm_size[i - 1] = MIN(opts->dims[i - 1], size); + sm_block[i - 1] = sm_size[i - 1]; + } + H5TOOLS_DEBUG("sm_size[%d]: %ld - sm_block:%ld", i - 1, sm_size[i - 1], sm_block[i - 1]); + sm_nbytes *= sm_size[i - 1]; + H5TOOLS_DEBUG("sm_nbytes: %ld", sm_nbytes); + } + } - sm_nelmts = sm_nbytes / p_type_nbytes; - sm_space = H5Screate_simple(1, &sm_nelmts, NULL); + H5TOOLS_DEBUG("opts->nelmts: %ld", opts->nelmts); + for(elmtno = 0; elmtno < opts->nelmts; elmtno += opts->hs_nelmts) { + H5TOOLS_DEBUG("elmtno: %ld - hs_nelmts1: %ld", elmtno, hs_nelmts1); - /* the stripmine loop */ - HDmemset(hs_offset, 0, sizeof hs_offset); - HDmemset(zero, 0, sizeof zero); + if(NULL == (sm_buf1 = (unsigned char *)HDmalloc((size_t) sm_nbytes))) + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Could not allocate buffer for strip-mine"); + if(NULL == (sm_buf2 = (unsigned char *)HDmalloc((size_t) sm_nbytes))) + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Could not allocate buffer for strip-mine"); - for(elmtno = 0; elmtno < p_nelmts; elmtno += hs_nelmts) { /* calculate the hyperslab size */ - if(rank1 > 0) { - for(i = 0, hs_nelmts = 1; i < rank1; i++) { - hs_size[i] = MIN(dadims[i] - hs_offset[i], sm_size[i]); - hs_nelmts *= hs_size[i]; - } /* end for */ - if(H5Sselect_hyperslab(sid1, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL) < 0) - H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Sselect_hyperslab failed"); - if(H5Sselect_hyperslab(sid2, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL) < 0) + /* initialize subset */ + if(opts->rank > 0) { + if (opts->sset[0] != NULL) { + H5TOOLS_DEBUG("sset1 has data"); + /* calculate the potential number of elements */ + for(i = 0; i < rank1; i++) { + H5TOOLS_DEBUG("[%d]opts->dims: %ld - hs_offset1: %ld - sm_block: %ld", i, opts->dims[i], hs_offset1[i], sm_block[i]); + hs_size1[i] = MIN(opts->dims[i] - hs_offset1[i], sm_block[i]); + H5TOOLS_DEBUG("hs_size1[%d]: %ld", i, hs_size1[i]); + } + if(H5Sselect_hyperslab(sid1, H5S_SELECT_SET, hs_offset1, hs_stride1, hs_count1, hs_size1) < 0) + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Sselect_hyperslab sid1 failed"); + } + else { + for(i = 0, hs_nelmts1 = 1; i < rank1; i++) { + H5TOOLS_DEBUG("[%d]opts->dims: %ld - hs_offset1: %ld - sm_block: %ld", i, opts->dims[i], hs_offset1[i], sm_block[i]); + hs_size1[i] = MIN(opts->dims[i] - hs_offset1[i], sm_block[i]); + H5TOOLS_DEBUG("hs_size1[%d]: %ld", i, hs_size1[i]); + hs_nelmts1 *= hs_size1[i]; + H5TOOLS_DEBUG("hs_nelmts1:%ld *= hs_size1[%d]: %ld", hs_nelmts1, i, hs_size1[i]); + } + if(H5Sselect_hyperslab(sid1, H5S_SELECT_SET, hs_offset1, NULL, hs_size1, NULL) < 0) + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Sselect_hyperslab sid1 failed"); + } + + if((ssm_nelmts = H5Sget_select_npoints(sid1)) < 0) + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Sget_select_npoints failed"); + sm_nelmts1 = (hsize_t)ssm_nelmts; + H5TOOLS_DEBUG("sm_nelmts1: %ld", sm_nelmts1); + hs_nelmts1 = sm_nelmts1; + + if((sm_space1 = H5Screate_simple(1, &sm_nelmts1, NULL)) < 0) + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Screate_simple failed"); + + if(H5Sselect_hyperslab(sm_space1, H5S_SELECT_SET, zero, NULL, &sm_nelmts1, NULL) < 0) H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Sselect_hyperslab failed"); - if(H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, zero, NULL, &hs_nelmts, NULL) < 0) + + if (opts->sset[1] != NULL) { + H5TOOLS_DEBUG("sset2 has data"); + for(i = 0; i < rank2; i++) { + H5TOOLS_DEBUG("[%d]opts->dims: %ld - hs_offset2: %ld - sm_block: %ld", i, opts->dims[i], hs_offset2[i], sm_block[i]); + hs_size2[i] = MIN(opts->dims[i] - hs_offset2[i], sm_block[i]); + H5TOOLS_DEBUG("hs_size2[%d]: %ld", i, hs_size2[i]); + } + if(H5Sselect_hyperslab(sid2, H5S_SELECT_SET, hs_offset2, hs_stride2, hs_count2, hs_size2) < 0) + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Sselect_hyperslab sid2 failed"); + } + else { + for(i = 0, hs_nelmts2 = 1; i < rank2; i++) { + H5TOOLS_DEBUG("[%d]opts->dims: %ld - hs_offset2: %ld - sm_block: %ld", i, opts->dims[i], hs_offset2[i], sm_block[i]); + hs_size2[i] = MIN(opts->dims[i] - hs_offset2[i], sm_block[i]); + H5TOOLS_DEBUG("hs_size2[%d]: %ld", i, hs_size2[i]); + hs_nelmts2 *= hs_size2[i]; + H5TOOLS_DEBUG("hs_nelmts2:%ld *= hs_size2[%d]: %ld", hs_nelmts2, i, hs_size2[i]); + } + if(H5Sselect_hyperslab(sid2, H5S_SELECT_SET, hs_offset2, NULL, hs_size2, NULL) < 0) + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Sselect_hyperslab sid2 failed"); + } + + if((ssm_nelmts = H5Sget_select_npoints(sid2)) < 0) + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Sget_select_npoints failed"); + sm_nelmts2 = (hsize_t)ssm_nelmts; + H5TOOLS_DEBUG("sm_nelmts2: %ld", sm_nelmts2); + hs_nelmts2 = sm_nelmts2; + + if((sm_space2 = H5Screate_simple(1, &sm_nelmts2, NULL)) < 0) + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Screate_simple failed"); + + if(H5Sselect_hyperslab(sm_space2, H5S_SELECT_SET, zero, NULL, &sm_nelmts2, NULL) < 0) H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Sselect_hyperslab failed"); - } /* end if */ + } else - hs_nelmts = 1; + hs_nelmts1 = 1; + opts->hs_nelmts = hs_nelmts1; + H5TOOLS_DEBUG("hs_nelmts: %ld", opts->hs_nelmts); - if(H5Dread(did1, m_tid1, sm_space, sid1, H5P_DEFAULT, sm_buf1) < 0) + /* read the data */ + if(H5Dread(did1, m_tid1, sm_space1, sid1, H5P_DEFAULT, sm_buf1) < 0) H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Dread failed"); - if(H5Dread(did2, m_tid2, sm_space, sid2, H5P_DEFAULT, sm_buf2) < 0) + if(H5Dread(did2, m_tid2, sm_space2, sid2, H5P_DEFAULT, sm_buf2) < 0) H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Dread failed"); + /* print array indices. get the lower bound of the hyperslab and calculate + the element position at the start of hyperslab */ + if(H5Sget_select_bounds(sid1, low, high) < 0) + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Sget_select_bounds failed"); + /* initialize the current stripmine position; this is necessary to print the array indices */ + for (j = 0; j < opts->rank; j++) + opts->sm_pos[j] = low[j]; + + /* Assume entire data space to be printed */ + init_acc_pos((unsigned)opts->rank, opts->dims, opts->acc, opts->pos, opts->p_min_idx); + /* get array differences. in the case of hyperslab read, increment the number of differences found in each hyperslab and pass the position at the beginning for printing */ - nfound += diff_array(sm_buf1, sm_buf2, hs_nelmts, elmtno, rank1, - dadims, opts, name1, name2, dam_tid, did1, did2); - - /* reclaim any VL memory, if necessary */ - if(vl_data1) - H5Treclaim(m_tid1, sm_space, H5P_DEFAULT, sm_buf1); - if(vl_data2) - H5Treclaim(m_tid2, sm_space, H5P_DEFAULT, sm_buf2); + nfound += diff_array(sm_buf1, sm_buf2, opts, did1, did2); + + if(sm_buf1 != NULL) { + /* reclaim any VL memory, if necessary */ + if(vl_data1) + H5Treclaim(m_tid1, sm_space1, H5P_DEFAULT, sm_buf1); + HDfree(sm_buf1); + sm_buf1 = NULL; + } + if(sm_buf2 != NULL) { + /* reclaim any VL memory, if necessary */ + if(vl_data2) + H5Treclaim(m_tid2, sm_space2, H5P_DEFAULT, sm_buf2); + HDfree(sm_buf2); + sm_buf2 = NULL; + } + + H5Sclose(sm_space1); + H5Sclose(sm_space2); /* calculate the next hyperslab offset */ - for(i = rank1, carry = 1; i > 0 && carry; --i) { - hs_offset[i - 1] += hs_size[i - 1]; - if(hs_offset[i - 1] == dadims[i - 1]) - hs_offset[i - 1] = 0; + for(i = opts->rank, carry = 1; i > 0 && carry; --i) { + if (opts->sset[0] != NULL) { + H5TOOLS_DEBUG("[%d]hs_size1:%ld - hs_block1:%ld - hs_stride1:%ld", i-1, hs_size1[i-1], hs_block1[i - 1], hs_stride1[i - 1]); + if(hs_size1[i - 1] >= hs_block1[i - 1]) { + hs_offset1[i - 1] += hs_size1[i - 1]; + } + else { + hs_offset1[i - 1] += hs_stride1[i - 1]; + } + } + else + hs_offset1[i - 1] += hs_size1[i - 1]; + H5TOOLS_DEBUG("[%d]hs_offset1:%ld - opts->dims:%ld", i-1, hs_offset1[i-1], opts->dims[i - 1]); + if(hs_offset1[i - 1] >= opts->dims[i - 1]) + hs_offset1[i - 1] = 0; else carry = 0; - } /* i */ - } /* elmtno */ - if(sm_buf1 != NULL) { - HDfree(sm_buf1); - sm_buf1 = NULL; - } - if(sm_buf2 != NULL) { - HDfree(sm_buf2); - sm_buf2 = NULL; - } - - H5Sclose(sm_space); + H5TOOLS_DEBUG("[%d]hs_offset1:%ld", i-1, hs_offset1[i-1]); + if (opts->sset[1] != NULL) { + H5TOOLS_DEBUG("[%d]hs_size2:%ld - hs_block2:%ld - hs_stride2:%ld", i-1, hs_size2[i-1], hs_block2[i - 1], hs_stride2[i - 1]); + if(hs_size2[i - 1] >= hs_block2[i - 1]) { + hs_offset2[i - 1] += hs_size2[i - 1]; + } + else { + hs_offset2[i - 1] += hs_stride2[i - 1]; + } + } + else + hs_offset2[i - 1] += hs_size2[i - 1]; + H5TOOLS_DEBUG("[%d]hs_offset2:%ld - opts->dims:%ld", i-1, hs_offset2[i-1], opts->dims[i - 1]); + if(hs_offset2[i - 1] >= opts->dims[i - 1]) + hs_offset2[i - 1] = 0; + H5TOOLS_DEBUG("[%d]hs_offset2:%ld", i-1, hs_offset2[i-1]); + } + } /* elmtno for loop */ } /* hyperslab read */ - H5TOOLS_DEBUG("can_compare complete"); + H5TOOLS_DEBUG("can compare complete"); } /*can_compare*/ @@ -550,12 +859,20 @@ hsize_t diff_datasetid(hid_t did1, hid_t did2, const char *obj1_name, const char * close *------------------------------------------------------------------------- */ - H5TOOLS_DEBUG("reclaim any VL memory - errstat:%d", opts->err_stat); done: opts->err_stat = opts->err_stat | ret_value; + H5TOOLS_DEBUG("free names - errstat:%d", opts->err_stat); /* free */ + if (opts->obj_name[0] != NULL) + HDfree(opts->obj_name[0]); + opts->obj_name[0] = NULL; + if (opts->obj_name[1] != NULL) + HDfree(opts->obj_name[1]); + opts->obj_name[1] = NULL; + + H5TOOLS_DEBUG("reclaim any VL memory"); if(buf1 != NULL) { /* reclaim any VL memory, if necessary */ if(vl_data1) @@ -570,26 +887,31 @@ done: HDfree(buf2); buf2 = NULL; } + H5TOOLS_DEBUG("reclaim any stripmine VL memory"); if(sm_buf1 != NULL) { /* reclaim any VL memory, if necessary */ if(vl_data1) - H5Treclaim(m_tid1, sm_space, H5P_DEFAULT, sm_buf1); + H5Treclaim(m_tid1, sm_space1, H5P_DEFAULT, sm_buf1); HDfree(sm_buf1); sm_buf1 = NULL; } if(sm_buf2 != NULL) { /* reclaim any VL memory, if necessary */ if(vl_data2) - H5Treclaim(m_tid2, sm_space, H5P_DEFAULT, sm_buf2); + H5Treclaim(m_tid2, sm_space2, H5P_DEFAULT, sm_buf2); HDfree(sm_buf2); sm_buf2 = NULL; } + H5TOOLS_DEBUG("close ids"); /* disable error reporting */ H5E_BEGIN_TRY { H5Sclose(sid1); H5Sclose(sid2); - H5Sclose(sm_space); + H5Sclose(sm_space1); + H5Sclose(sm_space2); + H5Pclose(dcpl1); + H5Pclose(dcpl2); H5Tclose(f_tid1); H5Tclose(f_tid2); H5Tclose(m_tid1); @@ -613,10 +935,9 @@ done: *------------------------------------------------------------------------- */ -int diff_can_type(hid_t f_tid1, hid_t f_tid2, int rank1, int rank2, - hsize_t *dims1, hsize_t *dims2, hsize_t *maxdim1, hsize_t *maxdim2, - const char *obj1_name, const char *obj2_name, - diff_opt_t *opts, int is_compound) +int +diff_can_type(hid_t f_tid1, hid_t f_tid2, int rank1, int rank2, hsize_t *dims1, hsize_t *dims2, + hsize_t *maxdim1, hsize_t *maxdim2, diff_opt_t *opts, int is_compound) { H5T_class_t tclass1; H5T_class_t tclass2; @@ -635,19 +956,21 @@ int diff_can_type(hid_t f_tid1, hid_t f_tid2, int rank1, int rank2, if((tclass2 = H5Tget_class(f_tid2)) < 0) H5TOOLS_GOTO_ERROR(FAIL, "H5Tget_class second object failed"); + H5TOOLS_DEBUG("obj_names: %s - %s", opts->obj_name[0], opts->obj_name[1]); if(tclass1 != tclass2) { - if((opts->m_verbose || opts->m_list_not_cmp) && obj1_name && obj2_name) { + if((opts->mode_verbose || opts->mode_list_not_cmp) && opts->obj_name[0] && opts->obj_name[1]) { if(is_compound) { parallel_print("Not comparable: <%s> has a class %s and <%s> has a class %s\n", - obj1_name, get_class(tclass1), - obj2_name, get_class(tclass2)); + opts->obj_name[0], get_class(tclass1), + opts->obj_name[1], get_class(tclass2)); } else { parallel_print("Not comparable: <%s> is of class %s and <%s> is of class %s\n", - obj1_name, get_class(tclass1), - obj2_name, get_class(tclass2)); + opts->obj_name[0], get_class(tclass1), + opts->obj_name[1], get_class(tclass2)); } } + opts->not_cmp = 1; H5TOOLS_GOTO_DONE(0); } @@ -658,10 +981,11 @@ int diff_can_type(hid_t f_tid1, hid_t f_tid2, int rank1, int rank2, */ switch (tclass1) { case H5T_TIME: - if((opts->m_verbose || opts->m_list_not_cmp) && obj1_name && obj2_name) { + if((opts->mode_verbose || opts->mode_list_not_cmp) && opts->obj_name[0] && opts->obj_name[1]) { parallel_print("Not comparable: <%s> and <%s> are of class %s\n", - obj1_name, obj2_name, get_class(tclass2)); + opts->obj_name[0], opts->obj_name[1], get_class(tclass2)); } /* end if */ + opts->not_cmp = 1; H5TOOLS_GOTO_DONE(0); break; @@ -679,7 +1003,7 @@ int diff_can_type(hid_t f_tid1, hid_t f_tid2, int rank1, int rank2, case H5T_NO_CLASS: case H5T_NCLASSES: default: - H5TOOLS_DEBUG("diff_can_type class - %s", get_class(tclass1)); + H5TOOLS_DEBUG("class - %s", get_class(tclass1)); break; } /* end switch */ @@ -687,15 +1011,15 @@ int diff_can_type(hid_t f_tid1, hid_t f_tid2, int rank1, int rank2, * check for equal file datatype; warning only *------------------------------------------------------------------------- */ - if((H5Tequal(f_tid1, f_tid2) == 0) && (opts->m_verbose) && obj1_name && obj2_name) { + if((H5Tequal(f_tid1, f_tid2) == 0) && (opts->mode_verbose) && opts->obj_name[0] && opts->obj_name[1]) { H5T_class_t cl = H5Tget_class(f_tid1); parallel_print("Warning: different storage datatype\n"); if(cl == H5T_INTEGER || cl == H5T_FLOAT) { - parallel_print("<%s> has file datatype ", obj1_name); + parallel_print("<%s> has file datatype ", opts->obj_name[0]); print_type(f_tid1); parallel_print("\n"); - parallel_print("<%s> has file datatype ", obj2_name); + parallel_print("<%s> has file datatype ", opts->obj_name[1]); print_type(f_tid2); parallel_print("\n"); } @@ -706,18 +1030,19 @@ int diff_can_type(hid_t f_tid1, hid_t f_tid2, int rank1, int rank2, *------------------------------------------------------------------------- */ if(rank1 != rank2) { - if((opts->m_verbose || opts->m_list_not_cmp) && obj1_name && obj2_name) { - parallel_print("Not comparable: <%s> has rank %d, dimensions ", obj1_name, rank1); + if((opts->mode_verbose || opts->mode_list_not_cmp) && opts->obj_name[0] && opts->obj_name[1]) { + parallel_print("Not comparable: <%s> has rank %d, dimensions ", opts->obj_name[0], rank1); print_dimensions(rank1, dims1); parallel_print(", max dimensions "); print_dimensions(rank1, maxdim1); parallel_print("\n" ); - parallel_print("and <%s> has rank %d, dimensions ", obj2_name, rank2); + parallel_print("and <%s> has rank %d, dimensions ", opts->obj_name[1], rank2); print_dimensions(rank2, dims2); parallel_print(", max dimensions "); print_dimensions(rank2, maxdim2); parallel_print("\n"); } + opts->not_cmp = 1; H5TOOLS_GOTO_DONE(0); } @@ -740,20 +1065,21 @@ int diff_can_type(hid_t f_tid1, hid_t f_tid2, int rank1, int rank2, *------------------------------------------------------------------------- */ if(dim_diff == 1) { - if((opts->m_verbose || opts->m_list_not_cmp) && obj1_name && obj2_name) { - parallel_print("Not comparable: <%s> has rank %d, dimensions ", obj1_name, rank1); + if((opts->mode_verbose || opts->mode_list_not_cmp) && opts->obj_name[0] && opts->obj_name[1]) { + parallel_print("Not comparable: <%s> has rank %d, dimensions ", opts->obj_name[0], rank1); print_dimensions(rank1, dims1); if(maxdim1 && maxdim2) { parallel_print(", max dimensions "); print_dimensions(rank1, maxdim1); parallel_print("\n" ); - parallel_print("and <%s> has rank %d, dimensions ", obj2_name, rank2); + parallel_print("and <%s> has rank %d, dimensions ", opts->obj_name[1], rank2); print_dimensions(rank2, dims2); parallel_print(", max dimensions "); print_dimensions(rank2, maxdim2); parallel_print("\n"); } } + opts->not_cmp = 1; H5TOOLS_GOTO_DONE(0); } @@ -762,13 +1088,13 @@ int diff_can_type(hid_t f_tid1, hid_t f_tid2, int rank1, int rank2, * maximum dimensions; just give a warning *------------------------------------------------------------------------- */ - if(maxdim1 && maxdim2 && maxdim_diff == 1 && obj1_name) { - if(opts->m_verbose) { + if(maxdim1 && maxdim2 && maxdim_diff == 1 && opts->obj_name[0]) { + if(opts->mode_verbose) { parallel_print( "Warning: different maximum dimensions\n"); - parallel_print("<%s> has max dimensions ", obj1_name); + parallel_print("<%s> has max dimensions ", opts->obj_name[0]); print_dimensions(rank1, maxdim1); parallel_print("\n"); - parallel_print("<%s> has max dimensions ", obj2_name); + parallel_print("<%s> has max dimensions ", opts->obj_name[1]); print_dimensions(rank2, maxdim2); parallel_print("\n"); } @@ -777,16 +1103,17 @@ int diff_can_type(hid_t f_tid1, hid_t f_tid2, int rank1, int rank2, if(tclass1 == H5T_STRING) { htri_t vstrtype1 = -1; htri_t vstrtype2 = -1; - H5TOOLS_DEBUG("diff_can_type end - H5T_STRING"); + H5TOOLS_DEBUG(" - H5T_STRING"); vstrtype1 = H5Tis_variable_str(f_tid1); vstrtype2 = H5Tis_variable_str(f_tid2); /* no compare if either one but not both are variable string type */ if (vstrtype1 != vstrtype2) { - if((opts->m_verbose || opts->m_list_not_cmp) && obj1_name && obj2_name) + if((opts->mode_verbose || opts->mode_list_not_cmp) && opts->obj_name[0] && opts->obj_name[1]) parallel_print("Not comparable: <%s> or <%s> is of mixed string type\n", - obj1_name, obj2_name); + opts->obj_name[0], opts->obj_name[1]); + opts->not_cmp = 1; H5TOOLS_GOTO_DONE(0); } @@ -798,17 +1125,18 @@ int diff_can_type(hid_t f_tid1, hid_t f_tid2, int rank1, int rank2, int j; hid_t memb_type1 = H5I_INVALID_HID; hid_t memb_type2 = H5I_INVALID_HID; - H5TOOLS_DEBUG("diff_can_type end - H5T_COMPOUND"); + H5TOOLS_DEBUG(" - H5T_COMPOUND"); nmembs1 = H5Tget_nmembers(f_tid1); nmembs2 = H5Tget_nmembers(f_tid2); if(nmembs1 != nmembs2) { - if((opts->m_verbose || opts->m_list_not_cmp) && obj1_name && obj2_name) { - parallel_print("Not comparable: <%s> has %d members ", obj1_name, nmembs1); - parallel_print("<%s> has %d members ", obj2_name, nmembs2); + if((opts->mode_verbose || opts->mode_list_not_cmp) && opts->obj_name[0] && opts->obj_name[1]) { + parallel_print("Not comparable: <%s> has %d members ", opts->obj_name[0], nmembs1); + parallel_print("<%s> has %d members ", opts->obj_name[1], nmembs2); parallel_print("\n"); } + opts->not_cmp = 1; H5TOOLS_GOTO_DONE(0); } @@ -817,9 +1145,7 @@ int diff_can_type(hid_t f_tid1, hid_t f_tid2, int rank1, int rank2, memb_type1 = H5Tget_member_type(f_tid1, (unsigned)j); memb_type2 = H5Tget_member_type(f_tid2, (unsigned)j); - if (diff_can_type(memb_type1, memb_type2, rank1, rank2, - dims1, dims2, maxdim1, maxdim2, obj1_name, obj2_name, - opts, 1) != 1) { + if (diff_can_type(memb_type1, memb_type2, rank1, rank2, dims1, dims2, maxdim1, maxdim2, opts, 1) != 1) { opts->not_cmp = 1; H5Tclose(memb_type1); H5Tclose(memb_type2); @@ -838,19 +1164,17 @@ done: } +#if defined (H5DIFF_DEBUG_UNUSED) +/* this function is not currently used, but could be useful */ /*------------------------------------------------------------------------- * Function: print_sizes * * Purpose: Print datatype sizes *------------------------------------------------------------------------- */ -#if defined (H5DIFF_DEBUG) -void print_sizes( const char *obj1, - const char *obj2, - hid_t f_tid1, - hid_t f_tid2, - hid_t m_tid1, - hid_t m_tid2 ) +void print_sizes( const char *obj1, const char *obj2, hid_t f_tid1, hid_t f_tid2, hid_t m_tid1, hid_t m_tid2); + +void print_sizes( const char *obj1, const char *obj2, hid_t f_tid1, hid_t f_tid2, hid_t m_tid1, hid_t m_tid2) { size_t f_size1, f_size2; /* size of type in file */ size_t m_size1, m_size2; /* size of type in memory */ diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index cc51e2c..55c69a7 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -29,28 +29,37 @@ int H5tools_INDENT_g = 0; /* global variables */ +H5E_auto2_t lib_func; +H5E_auto2_t tools_func; +void *lib_edata; +void *tools_edata; + hid_t H5tools_ERR_STACK_g = H5I_INVALID_HID; hid_t H5tools_ERR_CLS_g = H5I_INVALID_HID; hid_t H5E_tools_g = H5I_INVALID_HID; hid_t H5E_tools_min_id_g = H5I_INVALID_HID; hid_t H5E_tools_min_info_id_g = H5I_INVALID_HID; hid_t H5E_tools_min_dbg_id_g = H5I_INVALID_HID; -int compound_data; + FILE *rawattrstream = NULL; /* should initialize to stdout but gcc moans about it */ FILE *rawdatastream = NULL; /* should initialize to stdout but gcc moans about it */ FILE *rawinstream = NULL; /* should initialize to stdin but gcc moans about it */ FILE *rawoutstream = NULL; /* should initialize to stdout but gcc moans about it */ FILE *rawerrorstream = NULL; /* should initialize to stderr but gcc moans about it */ + int bin_output; /* binary output */ int bin_form = 0; /* binary form, default NATIVE */ int region_output; /* region output */ int oid_output; /* oid output */ int data_output; /* data output */ int attr_data_output; /* attribute data output */ +int compound_data; + unsigned packed_bits_num; /* number of packed bits to display */ unsigned packed_data_offset; /* offset of packed bits to display */ unsigned packed_data_length; /* length of packed bits to display */ unsigned long long packed_data_mask; /* mask in which packed bits to display */ + int enable_error_stack = 0; /* re-enable error stack; disable=0 enable=1 */ /* sort parameters */ @@ -103,6 +112,10 @@ const char *drivernames[] = { void h5tools_init(void) { + /* Disable error reporting */ + H5Eget_auto2(H5E_DEFAULT, &lib_func, &lib_edata); + H5Eset_auto2(H5E_DEFAULT, NULL, NULL); + if (!h5tools_init_g) { H5TOOLS_INIT_ERROR(); @@ -121,6 +134,29 @@ h5tools_init(void) h5tools_init_g++; } + + /* Disable tools error reporting */ + H5Eget_auto2(H5tools_ERR_STACK_g, &tools_func, &tools_edata); + H5Eset_auto2(H5tools_ERR_STACK_g, NULL, NULL); +} + +/*------------------------------------------------------------------------- + * Function: h5tools_error_report + * + * Purpose: Enable error stack reporting after command line is parsed. + * + * Return: None + *------------------------------------------------------------------------- + */ +void +h5tools_error_report(void) +{ + if (h5tools_init_g) { + if (enable_error_stack > 0) { + H5Eset_auto2(H5E_DEFAULT, lib_func, lib_edata); + H5Eset_auto2(H5tools_ERR_STACK_g, tools_func, tools_edata); + } + } } /*------------------------------------------------------------------------- @@ -137,16 +173,11 @@ h5tools_init(void) void h5tools_close(void) { - H5E_auto2_t tools_func; - void *tools_edata; - if (h5tools_init_g) { /* special case where only data is output to stdout */ if ((rawoutstream == NULL) && rawdatastream && (rawdatastream == stdout)) HDfprintf(rawdatastream, "\n"); - H5Eget_auto2(H5tools_ERR_STACK_g, &tools_func, &tools_edata); - if (tools_func) H5Eprint2(H5tools_ERR_STACK_g, rawerrorstream); @@ -184,6 +215,10 @@ h5tools_close(void) /* Clean up the reference path table, if it's been used */ term_ref_path_table(); + /* Restore error stacks from init */ + H5Eset_auto2(H5tools_ERR_STACK_g, tools_func, tools_edata); + H5Eset_auto2(H5E_DEFAULT, lib_func, lib_edata); + H5TOOLS_CLOSE_ERROR(); /* Shut down the library */ @@ -1090,8 +1125,8 @@ done: *------------------------------------------------------------------------- */ void -h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info, - h5tools_context_t *ctx, hsize_t elmtno, int secnum) +h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, + hsize_t elmtno, int secnum) { h5tools_str_t prefix; h5tools_str_t str; /*temporary for indentation */ @@ -1119,7 +1154,7 @@ h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info, H5TOOLS_DEBUG("after CR elmtno=%ld, ctx->ndims=%d", elmtno, ctx->ndims); /* Calculate new prefix */ - h5tools_str_prefix(&prefix, info, elmtno, ctx->ndims, ctx); + h5tools_str_prefix(&prefix, info, elmtno, ctx); H5TOOLS_DEBUG("prefix=%s - str=%s", prefix.s, str.s); /* Write new prefix to output */ @@ -1186,8 +1221,8 @@ h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info, *------------------------------------------------------------------------- */ void -h5tools_region_simple_prefix(FILE *stream, const h5tool_format_t *info, - h5tools_context_t *ctx, hsize_t elmtno, hsize_t *ptdata, int secnum) +h5tools_region_simple_prefix(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, + hsize_t elmtno, hsize_t *ptdata, int secnum) { h5tools_str_t prefix; h5tools_str_t str; /*temporary for indentation */ @@ -1211,7 +1246,7 @@ h5tools_region_simple_prefix(FILE *stream, const h5tool_format_t *info, } /* Calculate new prefix */ - h5tools_str_region_prefix(&prefix, info, elmtno, ptdata, ctx->ndims, ctx->p_max_idx, ctx); + h5tools_str_region_prefix(&prefix, info, elmtno, ptdata, ctx); /* Write new prefix to output */ if (ctx->indent_level > 0) @@ -1284,9 +1319,8 @@ h5tools_region_simple_prefix(FILE *stream, const h5tool_format_t *info, *------------------------------------------------------------------------- */ hbool_t -h5tools_render_element(FILE *stream, const h5tool_format_t *info, - h5tools_context_t *ctx, h5tools_str_t *buffer, hsize_t *curr_pos, - size_t ncols, hsize_t local_elmt_counter, hsize_t elmt_counter) +h5tools_render_element(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, + h5tools_str_t *buffer, hsize_t *curr_pos, size_t ncols, hsize_t local_elmt_counter, hsize_t elmt_counter) { hbool_t dimension_break = TRUE; char *s = NULL; @@ -1455,9 +1489,8 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info, *------------------------------------------------------------------------- */ hbool_t -h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, - h5tools_context_t *ctx, h5tools_str_t *buffer, hsize_t *curr_pos, - size_t ncols, hsize_t *ptdata, hsize_t local_elmt_counter, hsize_t elmt_counter) +h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, + h5tools_str_t *buffer, hsize_t *curr_pos, size_t ncols, hsize_t *ptdata, hsize_t local_elmt_counter, hsize_t elmt_counter) { hbool_t dimension_break = TRUE; char *s = NULL; @@ -1474,8 +1507,10 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, * If the element would split on multiple lines if printed at our * current location... */ - if (info->line_multi_new == 1 && (ctx->cur_column + h5tools_count_ncols(s) + - HDstrlen(OPT(info->elmt_suf2, " ")) + HDstrlen(OPT(info->line_suf, ""))) > ncols) { + if (info->line_multi_new == 1 && + (ctx->cur_column + h5tools_count_ncols(s) + + HDstrlen(OPT(info->elmt_suf2, " ")) + + HDstrlen(OPT(info->line_suf, ""))) > ncols) { if (ctx->prev_multiline) { /* * ... and the previous element also occupied more than one @@ -1484,7 +1519,8 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, ctx->need_prefix = TRUE; } else if ((ctx->prev_prefix_len + h5tools_count_ncols(s) + - HDstrlen(OPT(info->elmt_suf2, " ")) + HDstrlen(OPT(info->line_suf, ""))) <= ncols) { + HDstrlen(OPT(info->elmt_suf2, " ")) + + HDstrlen(OPT(info->line_suf, ""))) <= ncols) { /* * ...but *could* fit on one line otherwise, then we * should end the current line and start this element on its @@ -1515,7 +1551,9 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, * beginning of the line. */ if (info->line_multi_new == 1 && ctx->prev_multiline && - (ctx->cur_column + h5tools_count_ncols(s) + HDstrlen(OPT(info->elmt_suf2, " ")) + HDstrlen(OPT(info->line_suf, ""))) > ncols) + (ctx->cur_column + h5tools_count_ncols(s) + + HDstrlen(OPT(info->elmt_suf2, " ")) + + HDstrlen(OPT(info->line_suf, ""))) > ncols) ctx->need_prefix = TRUE; /* @@ -1543,7 +1581,9 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, * this check to happen for the first line */ if ((!info->skip_first || local_elmt_counter) && - (ctx->cur_column + HDstrlen(section) + HDstrlen(OPT(info->elmt_suf2, " ")) + HDstrlen(OPT(info->line_suf, ""))) > ncols) + (ctx->cur_column + HDstrlen(section) + + HDstrlen(OPT(info->elmt_suf2, " ")) + + HDstrlen(OPT(info->line_suf, ""))) > ncols) ctx->need_prefix = 1; /* @@ -1589,27 +1629,65 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, *------------------------------------------------------------------------- */ void -init_acc_pos(h5tools_context_t *ctx, hsize_t *dims) +init_acc_pos(unsigned ndims, hsize_t *dims, hsize_t *acc, hsize_t *pos, hsize_t *p_min_idx) { int i; unsigned j; H5TOOLS_START_DEBUG(""); - if(ctx->ndims > 0) { - ctx->acc[ctx->ndims - 1] = 1; - for (i = ((int)ctx->ndims - 2); i >= 0; i--) { - ctx->acc[i] = ctx->acc[i + 1] * dims[i + 1]; - H5TOOLS_DEBUG("ctx->acc[%d]=%ld", i, ctx->acc[i]); + for (i = 0; (unsigned)i < ndims; i++) + p_min_idx[i] = 0; + + if(ndims > 0) { + acc[ndims - 1] = 1; + for (i = ((int)ndims - 2); i >= 0; i--) { + acc[i] = acc[i + 1] * dims[i + 1]; + H5TOOLS_DEBUG("acc[%d]=%ld", i, acc[i]); } - for (j = 0; j < ctx->ndims; j++) - ctx->pos[j] = 0; + for (j = 0; j < ndims; j++) + pos[j] = 0; } H5TOOLS_ENDDEBUG(""); } /*------------------------------------------------------------------------- + * Function: calc_acc_pos + * + * Purpose: Calculate the number of elements represented by a unit change + * in a certain index position. + * + * Return: void + *------------------------------------------------------------------------- + */ +hsize_t +calc_acc_pos(unsigned ndims, hsize_t elmtno, hsize_t *acc, hsize_t *pos) +{ + int i; + hsize_t curr_pos = elmtno; + + H5TOOLS_START_DEBUG(""); + + if(ndims > 0) { + for(i = 0; i < (int)ndims; i++) { + if(curr_pos > 0) { + H5TOOLS_DEBUG("curr_pos=%ld - ctx->acc[%d]=%ld", curr_pos, i, acc[i]); + pos[i] = curr_pos / acc[i]; + curr_pos -= acc[i] * pos[i]; + } + else + pos[i] = 0; + H5TOOLS_DEBUG("curr_pos=%ld - pos[%d]=%ld - acc[%d]=%ld", curr_pos, i, pos[i], i, acc[i]); + } + } + + H5TOOLS_ENDDEBUG(""); + + return curr_pos; +} + +/*------------------------------------------------------------------------- * Function: render_bin_output * * Purpose: Write one element of memory buffer to a binary file stream diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h index 2b6fffb..7d3f40a 100644 --- a/tools/lib/h5tools.h +++ b/tools/lib/h5tools.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, July 23, 1998 * * Purpose: Support functions for the various tools. @@ -570,9 +570,6 @@ typedef struct h5tools_vfd_info_t { const char *name; } h5tools_vfd_info_t; -H5TOOLS_DLLVAR const char *volnames[]; -H5TOOLS_DLLVAR const char *drivernames[]; - /* This enum should match the entries in the above 'volnames' * since they are indices into the 'volnames' array. */ typedef enum { @@ -603,14 +600,22 @@ typedef enum { #include "h5tools_str.h" -H5TOOLS_DLLVAR h5tool_format_t h5tools_dataformat; -H5TOOLS_DLLVAR const h5tools_dump_header_t h5tools_standardformat; -H5TOOLS_DLLVAR const h5tools_dump_header_t* h5tools_dump_header_format; #ifdef __cplusplus extern "C" { #endif +H5TOOLS_DLLVAR const char *volnames[]; +H5TOOLS_DLLVAR const char *drivernames[]; + +H5TOOLS_DLLVAR h5tool_format_t h5tools_dataformat; +H5TOOLS_DLLVAR const h5tools_dump_header_t h5tools_standardformat; +H5TOOLS_DLLVAR const h5tools_dump_header_t* h5tools_dump_header_format; +H5TOOLS_DLLVAR H5E_auto2_t lib_func; +H5TOOLS_DLLVAR H5E_auto2_t tools_func; +H5TOOLS_DLLVAR void *lib_edata; +H5TOOLS_DLLVAR void *tools_edata; + H5TOOLS_DLLVAR unsigned packed_bits_num; /* number of packed bits to display */ H5TOOLS_DLLVAR unsigned packed_data_offset; /* offset of packed bits to display */ H5TOOLS_DLLVAR unsigned packed_data_length; /* length of packed bits to display */ @@ -644,14 +649,17 @@ H5TOOLS_DLLVAR int enable_error_stack; /* re-enable error stack; disable=0 e /* Definitions of useful routines */ H5TOOLS_DLL void h5tools_init(void); H5TOOLS_DLL void h5tools_close(void); + +H5TOOLS_DLL void h5tools_error_report(void); H5TOOLS_DLL int h5tools_set_data_output_file(const char *fname, int is_bin); H5TOOLS_DLL int h5tools_set_attr_output_file(const char *fname, int is_bin); H5TOOLS_DLL int h5tools_set_input_file(const char *fname, int is_bin); H5TOOLS_DLL int h5tools_set_output_file(const char *fname, int is_bin); H5TOOLS_DLL int h5tools_set_error_file(const char *fname, int is_bin); -H5TOOLS_DLL hid_t h5tools_get_fapl(hid_t prev_fapl_id, h5tools_vol_info_t *vol_info, - h5tools_vfd_info_t *vfd_info); -H5TOOLS_DLL herr_t h5tools_get_vfd_name(hid_t fapl_id, char *drivername, size_t drivername_size); + +H5TOOLS_DLL hid_t h5tools_get_fapl(hid_t prev_fapl_id, h5tools_vol_info_t *vol_info, h5tools_vfd_info_t *vfd_info); +H5TOOLS_DLL herr_t h5tools_get_vfd_name(hid_t fapl_id, + char *drivername, size_t drivername_size); H5TOOLS_DLL hid_t h5tools_fopen(const char *fname, unsigned flags, hid_t fapl, hbool_t use_specific_driver, char *drivername, size_t drivername_size); H5TOOLS_DLL hid_t h5tools_get_little_endian_type(hid_t type); @@ -659,36 +667,29 @@ H5TOOLS_DLL hid_t h5tools_get_big_endian_type(hid_t type); H5TOOLS_DLL htri_t h5tools_detect_vlen(hid_t tid); H5TOOLS_DLL htri_t h5tools_detect_vlen_str(hid_t tid); H5TOOLS_DLL hbool_t h5tools_is_obj_same(hid_t loc_id1, const char *name1, hid_t loc_id2, const char *name2); -H5TOOLS_DLL void init_acc_pos(h5tools_context_t *ctx, hsize_t *dims); +H5TOOLS_DLL void init_acc_pos(unsigned ndims, hsize_t *dims, hsize_t *acc, hsize_t *pos, hsize_t *p_min_idx); +H5TOOLS_DLL hsize_t calc_acc_pos(unsigned ndims, hsize_t elemtno, hsize_t *acc, hsize_t *pos); H5TOOLS_DLL hbool_t h5tools_is_zero(const void *_mem, size_t size); H5TOOLS_DLL int h5tools_canreadf(const char* name, hid_t dcpl_id); H5TOOLS_DLL int h5tools_can_encode(H5Z_filter_t filtn); -H5TOOLS_DLL void h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info, - h5tools_context_t *ctx, hsize_t elmtno, int secnum); -H5TOOLS_DLL void h5tools_region_simple_prefix(FILE *stream, const h5tool_format_t *info, - h5tools_context_t *ctx, hsize_t elmtno, hsize_t *ptdata, int secnum); +H5TOOLS_DLL void h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, + hsize_t elmtno, int secnum); +H5TOOLS_DLL void h5tools_region_simple_prefix(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, + hsize_t elmtno, hsize_t *ptdata, int secnum); H5TOOLS_DLL int render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t nelmts); -H5TOOLS_DLL int render_bin_output_region_data_blocks(hid_t region_id, FILE *stream, - hid_t container, unsigned ndims, hid_t type_id, hsize_t nblocks, hsize_t *ptdata); -H5TOOLS_DLL hbool_t render_bin_output_region_blocks(hid_t region_space, hid_t region_id, - FILE *stream, hid_t container); -H5TOOLS_DLL int render_bin_output_region_data_points(hid_t region_space, hid_t region_id, - FILE* stream, hid_t container, unsigned ndims, hid_t type_id, hsize_t npoints); -H5TOOLS_DLL hbool_t render_bin_output_region_points(hid_t region_space, hid_t region_id, - FILE *stream, hid_t container); - -H5TOOLS_DLL hbool_t h5tools_render_element(FILE *stream, const h5tool_format_t *info, - h5tools_context_t *ctx, h5tools_str_t *buffer, hsize_t *curr_pos, - size_t ncols, hsize_t local_elmt_counter, hsize_t elmt_counter); -H5TOOLS_DLL hbool_t h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, - h5tools_context_t *ctx, /*in,out*/ - h5tools_str_t *buffer, /*string into which to render */ - hsize_t *curr_pos, /*total data element position*/ - size_t ncols, hsize_t *ptdata, - hsize_t local_elmt_counter, /*element counter*/ - hsize_t elmt_counter); +H5TOOLS_DLL int render_bin_output_region_data_blocks(hid_t region_id, FILE *stream, hid_t container, + unsigned ndims, hid_t type_id, hsize_t nblocks, hsize_t *ptdata); +H5TOOLS_DLL hbool_t render_bin_output_region_blocks(hid_t region_space, hid_t region_id, FILE *stream, hid_t container); +H5TOOLS_DLL int render_bin_output_region_data_points(hid_t region_space, hid_t region_id, FILE* stream, hid_t container, + unsigned ndims, hid_t type_id, hsize_t npoints); +H5TOOLS_DLL hbool_t render_bin_output_region_points(hid_t region_space, hid_t region_id, FILE *stream, hid_t container); + +H5TOOLS_DLL hbool_t h5tools_render_element(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, h5tools_str_t *buffer, + hsize_t *curr_pos, size_t ncols, hsize_t local_elmt_counter, hsize_t elmt_counter); +H5TOOLS_DLL hbool_t h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, h5tools_str_t *buffer, + hsize_t *curr_pos, size_t ncols, hsize_t *ptdata, hsize_t local_elmt_counter, hsize_t elmt_counter); #ifdef __cplusplus } diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c index b59ae93..b1be577 100644 --- a/tools/lib/h5tools_dump.c +++ b/tools/lib/h5tools_dump.c @@ -253,9 +253,8 @@ h5tools_dump_init(void) *------------------------------------------------------------------------- */ int -h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t container, - h5tools_context_t *ctx, /* in,out */ - unsigned flags, hsize_t nelmts, hid_t type, void *_mem) +h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, /* in,out */ + hid_t container, unsigned flags, hsize_t nelmts, hid_t type, void *_mem) { unsigned char *mem = (unsigned char*) _mem; hsize_t i; /* element counter */ @@ -568,9 +567,11 @@ h5tools_print_region_data_blocks(hid_t region_id, FILE *stream, const h5tool_for ctx.indent_level++; if(H5Sget_simple_extent_dims(mem_space, total_size, NULL) >= 0) { /* assume entire data space to be printed */ + init_acc_pos(ctx.ndims, total_size, ctx.acc, ctx.pos, ctx.p_min_idx); + + /* reset data space to be printed */ for (indx = 0; indx < (unsigned)ctx.ndims; indx++) ctx.p_min_idx[indx] = start[indx]; - init_acc_pos(&ctx, total_size); /* print the data */ region_flags = START_OF_DATA; @@ -939,9 +940,7 @@ h5tools_print_region_data_points(hid_t region_space, hid_t region_id, if(H5Sget_simple_extent_dims(mem_space, total_size, NULL) >= 0) { /* assume entire data space to be printed */ - for (indx = 0; indx < ctx.ndims; indx++) - ctx.p_min_idx[indx] = 0; - init_acc_pos(&ctx, total_size); + init_acc_pos(ctx.ndims, total_size, ctx.acc, ctx.pos, ctx.p_min_idx); /* print the data */ region_flags = START_OF_DATA; @@ -1253,7 +1252,6 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c size_t j; /* counters */ hsize_t zero[1] = {0}; /* vector of zeros */ unsigned int flags; /* buffer extent flags */ - hsize_t elmtno; /* elemnt index */ hsize_t low[H5S_MAX_RANK]; /* low bound of hyperslab */ hsize_t high[H5S_MAX_RANK]; /* higher bound of hyperslab */ size_t p_type_nbytes; /* size of memory type */ @@ -1274,9 +1272,6 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c if ((size_t) ctx->ndims > NELMTS(sm_size)) H5TOOLS_THROW(FAIL, "ndims and sm_size comparision failed"); - if (ctx->ndims > 0) - init_acc_pos(ctx, total_size); - size_row_block = ctx->sset->block.data[row_dim]; /* Check if we have VL data in the dataset's datatype */ @@ -1347,27 +1342,25 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c for (i = 0; i < ctx->ndims; i++) ctx->p_max_idx[i] = ctx->p_min_idx[i] + MIN(total_size[i], sm_size[i]); - /* print array indices. get the lower bound of the hyperslab and calulate - the element position at the start of hyperslab */ + /* print array indices. get the lower bound of the hyperslab and calculate + the element position at the start of hyperslab */ if(H5Sget_select_bounds(f_space, low, high) < 0) H5TOOLS_THROW(FAIL, "H5Sget_select_bounds failed"); - elmtno = 0; + /* initialize the current stripmine position; this is necessary to print the array indices */ + ctx->sm_pos = 0; for (i = 0; i < (size_t) ctx->ndims - 1; i++) { hsize_t offset = 1; /* accumulation of the previous dimensions */ for (j = i + 1; j < (size_t) ctx->ndims; j++) offset *= total_size[j]; - elmtno += low[i] * offset; + ctx->sm_pos += low[i] * offset; } - elmtno += low[ctx->ndims - 1]; + ctx->sm_pos += low[ctx->ndims - 1]; - /* initialize the current stripmine position; this is necessary to print the array - indices */ - ctx->sm_pos = elmtno; ctx->need_prefix = TRUE; - if(h5tools_dump_simple_data(stream, info, dset, ctx, flags, sm_nelmts, p_type, sm_buf) < 0) + if(h5tools_dump_simple_data(stream, info, ctx, dset, flags, sm_nelmts, p_type, sm_buf) < 0) H5TOOLS_THROW(FAIL, "h5tools_dump_simple_data failed"); /* Reclaim any VL memory, if necessary */ @@ -1571,9 +1564,8 @@ static herr_t h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, hid_t dset, hid_t p_type) { int sndims; - hid_t f_space = H5I_INVALID_HID; /* file data space */ - size_t i; /* counters */ - hsize_t total_size[H5S_MAX_RANK];/* total size of dataset*/ + hid_t f_space = H5I_INVALID_HID; /* file data space */ + hsize_t total_size[H5S_MAX_RANK]; /* total size of dataset*/ hbool_t past_catch = FALSE; herr_t ret_value = SUCCEED; @@ -1586,12 +1578,10 @@ h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_co ctx->ndims = (unsigned)sndims; /* assume entire data space to be printed */ - if (ctx->ndims > 0) - for (i = 0; i < (size_t) ctx->ndims; i++) - ctx->p_min_idx[i] = 0; - if(H5Sget_simple_extent_dims(f_space, total_size, NULL) < 0) H5TOOLS_THROW(FAIL, "H5Sget_simple_extent_dims failed"); + init_acc_pos(ctx->ndims, total_size, ctx->acc, ctx->pos, ctx->p_min_idx); + ctx->size_last_dim = total_size[ctx->ndims - 1]; /* Set the compound datatype field list for display */ @@ -1623,38 +1613,37 @@ CATCH *------------------------------------------------------------------------- */ static int -h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, - hid_t dset, hid_t p_type) +h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, hid_t dset, hid_t p_type) { - hid_t f_space = H5I_INVALID_HID; /* file data space */ - hsize_t elmtno; /* counter */ - size_t i; /* counter */ - int sndims; /* rank of dataspace */ - int carry; /* counter carry value */ - hsize_t zero[8]; /* vector of zeros */ - unsigned int flags; /* buffer extent flags */ - hsize_t total_size[H5S_MAX_RANK]; /* total size of dataset*/ - hbool_t past_catch = FALSE; + hid_t f_space = H5I_INVALID_HID; /* file data space */ + hsize_t elmtno; /* counter */ + size_t i = 0; /* counter */ + int sndims; /* rank of dataspace */ + int carry; /* counter carry value */ + hsize_t zero[8]; /* vector of zeros */ + unsigned int flags; /* buffer extent flags */ + hsize_t total_size[H5S_MAX_RANK]; /* total size of dataset*/ + hbool_t past_catch = FALSE; /* Print info */ - size_t p_type_nbytes; /* size of memory type */ - hsize_t p_nelmts; /* total selected elmts */ + size_t p_type_nbytes; /* size of memory type */ + hsize_t p_nelmts; /* total selected elmts */ /* Stripmine info */ - hsize_t sm_size[H5S_MAX_RANK]; /* stripmine size */ - hsize_t sm_nbytes; /* bytes per stripmine */ - hsize_t sm_nelmts; /* elements per stripmine*/ - unsigned char *sm_buf = NULL; /* buffer for raw data */ - hid_t sm_space = H5I_INVALID_HID; /* stripmine data space */ + hsize_t sm_size[H5S_MAX_RANK]; /* stripmine size */ + hsize_t sm_nbytes; /* bytes per stripmine */ + hsize_t sm_nelmts; /* elements per stripmine*/ + unsigned char *sm_buf = NULL; /* buffer for raw data */ + hid_t sm_space = H5I_INVALID_HID; /* stripmine data space */ /* Hyperslab info */ - hsize_t hs_offset[H5S_MAX_RANK]; /* starting offset */ - hsize_t hs_size[H5S_MAX_RANK]; /* size this pass */ - hsize_t hs_nelmts; /* elements in request */ + hsize_t hs_offset[H5S_MAX_RANK]; /* starting offset */ + hsize_t hs_size[H5S_MAX_RANK]; /* size this pass */ + hsize_t hs_nelmts; /* elements in request */ /* VL data special information */ - unsigned int vl_data = 0; /* contains VL datatypes */ - int ret_value = 0; + unsigned int vl_data = 0; /* contains VL datatypes */ + int ret_value = 0; H5TOOLS_START_DEBUG(""); if (H5I_INVALID_HID == (f_space = H5Dget_space(dset))) @@ -1670,11 +1659,8 @@ h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, h5tools_cont H5TOOLS_GOTO_ERROR((-1), "ctx->ndims > NELMTS(sm_size) failed"); /* Assume entire data space to be printed */ - if (ctx->ndims > 0) - for (i = 0; i < (size_t)ctx->ndims; i++) - ctx->p_min_idx[i] = 0; - H5Sget_simple_extent_dims(f_space, total_size, NULL); + init_acc_pos(ctx->ndims, total_size, ctx->acc, ctx->pos, ctx->p_min_idx); /* calculate the number of elements we're going to print */ p_nelmts = 1; @@ -1720,8 +1706,6 @@ h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, h5tools_cont sm_space = H5Screate_simple(1, &sm_nelmts, NULL); H5TOOLS_DEBUG("sm_nelmts size:%ld", sm_nelmts); - if (ctx->ndims > 0) - init_acc_pos(ctx, total_size); H5TOOLS_DEBUG("ctx->ndims:%d", ctx->ndims); /* The stripmine loop */ @@ -1762,7 +1746,7 @@ h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, h5tools_cont indices */ ctx->sm_pos = elmtno; - if(h5tools_dump_simple_data(stream, info, dset, ctx, flags, hs_nelmts, p_type, sm_buf) < 0) + if(h5tools_dump_simple_data(stream, info, ctx, dset, flags, hs_nelmts, p_type, sm_buf) < 0) H5TOOLS_ERROR((-1), "h5tools_dump_simple_data failed"); /* Reclaim any VL memory, if necessary */ @@ -1841,11 +1825,8 @@ h5tools_dump_simple_mem(FILE *stream, const h5tool_format_t *info, h5tools_conte H5TOOLS_THROW((-1), "ctx->ndims > NELMTS(ctx->p_min_idx) failed"); /* Assume entire data space to be printed */ - if (ctx->ndims > 0) - for (i = 0; i < (size_t)ctx->ndims; i++) - ctx->p_min_idx[i] = 0; - H5Sget_simple_extent_dims(f_space, total_size, NULL); + init_acc_pos(ctx->ndims, total_size, ctx->acc, ctx->pos, ctx->p_min_idx); /* calculate the number of elements we're going to print */ p_nelmts = 1; @@ -1868,14 +1849,12 @@ h5tools_dump_simple_mem(FILE *stream, const h5tool_format_t *info, h5tools_conte alloc_size = p_nelmts * H5Tget_size(p_type); HDassert(alloc_size == (hsize_t)((size_t)alloc_size)); /*check for overflow*/ if (NULL != (buf = (unsigned char *)HDmalloc((size_t)alloc_size))) { - if (ctx->ndims > 0) - init_acc_pos(ctx, total_size); H5TOOLS_DEBUG("ctx->ndims:%d", ctx->ndims); H5TOOLS_DEBUG("Read the data"); /* Read the data */ if (H5Aread(attr_id, p_type, buf) >= 0) { - if(h5tools_dump_simple_data(stream, info, attr_id, ctx, START_OF_DATA | END_OF_DATA, p_nelmts, p_type, buf) < 0) + if(h5tools_dump_simple_data(stream, info, ctx, attr_id, START_OF_DATA | END_OF_DATA, p_nelmts, p_type, buf) < 0) H5TOOLS_ERROR((-1), "h5tools_dump_simple_data failed"); /* Reclaim any VL memory, if necessary */ @@ -3987,6 +3966,226 @@ h5tools_dump_subsetting_header(FILE *stream, const h5tool_format_t *info, h5tool } /*------------------------------------------------------------------------- + * Function: dump_reference + * + * Purpose: Dump reference data + * + * Return: void + *------------------------------------------------------------------------- + */ +void +h5tools_dump_reference(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, hid_t container, H5R_ref_t *ref_buf, int ndims) +{ + hid_t new_obj_id = H5I_INVALID_HID; + hid_t new_obj_sid = H5I_INVALID_HID; + hsize_t elmt_counter = 0; /*counts the # elements printed. */ + size_t ncols = 80; /* available output width */ + int i; + hsize_t curr_pos = 0; /* total data element position */ + h5tools_str_t buffer; /* string into which to render */ + h5tools_context_t datactx; /* print context */ + + H5TOOLS_START_DEBUG(""); + + datactx = *ctx; /* print context */ + /* Assume entire data space to be printed */ + datactx.need_prefix = TRUE; + + HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + for(i = 0; i < ndims; i++, datactx.cur_elmt++, elmt_counter++) { + H5O_type_t obj_type = -1; /* Object type */ + H5R_type_t ref_type; /* Reference type */ + + H5TOOLS_DEBUG("reference loop:%d with curr_pos=%ld", i, curr_pos); + + datactx.need_prefix = TRUE; + h5tools_str_reset(&buffer); + H5TOOLS_DEBUG("reference loop - h5tools_str_sprint with H5T_STD_REF:%d", i); + h5tools_str_sprint(&buffer, info, container, H5T_STD_REF, &ref_buf[i], &datactx); + h5tools_render_element(stream, info, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)i, (hsize_t)ndims); + + ref_type = H5Rget_type((const H5R_ref_t *)&ref_buf[i]); + switch (ref_type) { + case H5R_OBJECT1: + H5TOOLS_DEBUG("ref_type is H5R_OBJECT1"); + if (H5Rget_obj_type3(&ref_buf[i], H5P_DEFAULT, &obj_type) >= 0) { + switch (obj_type) { + case H5O_TYPE_DATASET: + if((new_obj_id = H5Ropen_object(&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) >= 0) { + datactx.indent_level++; + h5tools_dump_data(stream, info, &datactx, new_obj_id, TRUE); + //h5tools_dump_dset(stream, info, &datactx, new_obj_id); + datactx.indent_level--; + if(H5Dclose(new_obj_id) < 0) + H5TOOLS_INFO("H5Dclose H5R_OBJECT1:H5O_TYPE_DATASET failed"); + } + else + H5TOOLS_INFO("H5Ropen_object H5R_OBJECT1:H5O_TYPE_DATASET failed"); + break; + + case H5O_TYPE_GROUP: + case H5O_TYPE_NAMED_DATATYPE: + case H5O_TYPE_MAP: + case H5O_TYPE_UNKNOWN: + case H5O_TYPE_NTYPES: + default: + break; + } /* end switch */ + } + else + H5TOOLS_INFO("H5Rget_obj_type3 H5R_OBJECT1 failed"); + break; + case H5R_DATASET_REGION1: + H5TOOLS_DEBUG("ref_type is H5R_DATASET_REGION1"); + if((new_obj_id = H5Ropen_object(&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) >= 0) { + datactx.indent_level++; + h5tools_dump_data(stream, info, &datactx, new_obj_id, TRUE); + //h5tools_dump_dset(stream, info, &datactx, new_obj_id); + datactx.indent_level--; + if(H5Dclose(new_obj_id) < 0) + H5TOOLS_INFO("H5Dclose H5R_DATASET_REGION1 failed"); + } + else + H5TOOLS_INFO("H5Ropen_object H5R_DATASET_REGION1 failed"); + break; + case H5R_OBJECT2: + H5TOOLS_DEBUG("ref_type is H5R_OBJECT2"); + if (H5Rget_obj_type3(&ref_buf[i], H5P_DEFAULT, &obj_type) >= 0) { + switch (obj_type) { + case H5O_TYPE_GROUP: + break; + + case H5O_TYPE_DATASET: + if((new_obj_id = H5Ropen_object(&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) >= 0) { + datactx.indent_level++; + h5tools_dump_data(stream, info, &datactx, new_obj_id, TRUE); + //h5tools_dump_dset(stream, info, &datactx, new_obj_id); + datactx.indent_level--; + if(H5Oclose(new_obj_id) < 0) + H5TOOLS_INFO("H5Oclose H5R_OBJECT2 failed"); + } + else + H5TOOLS_INFO("H5Ropen_object H5R_OBJECT2 failed"); + break; + + case H5O_TYPE_NAMED_DATATYPE: + break; + + case H5O_TYPE_MAP: + case H5O_TYPE_UNKNOWN: + case H5O_TYPE_NTYPES: + default: + break; + } /* end switch */ + } + else + H5TOOLS_INFO("H5Rget_obj_type3 H5R_OBJECT2 failed"); + break; + case H5R_DATASET_REGION2: + H5TOOLS_DEBUG("ref_type is H5R_DATASET_REGION2"); + + if (info->line_ncols > 0) + ncols = info->line_ncols; + + /* if (new_obj_id < 0) - could mean that no reference was written do not throw failure */ + if((new_obj_id = H5Ropen_object(&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) < 0) + H5TOOLS_INFO("H5Ropen_object H5R_DATASET_REGION2 failed"); + else { + if((new_obj_sid = H5Ropen_region(&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) >= 0) { + if (h5tools_is_zero(&ref_buf[i], H5Tget_size(H5T_STD_REF))) { + H5TOOLS_DEBUG("NULL H5R_DATASET_REGION2"); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, " {"); + h5tools_render_element(stream, info, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); + + datactx.need_prefix = TRUE; + datactx.indent_level++; + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "NULL"); + h5tools_render_element(stream, info, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); + datactx.indent_level--; + datactx.need_prefix = TRUE; + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "}"); + h5tools_render_element(stream, info, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); + } + else { + H5S_sel_type region_type; + + region_type = H5Sget_select_type(new_obj_sid); + if(region_type == H5S_SEL_POINTS) { + /* Print point information */ + H5TOOLS_DEBUG("H5S_SEL_POINTS H5R_DATASET_REGION2"); + h5tools_dump_region_data_points(new_obj_sid, new_obj_id, stream, info, &datactx, + &buffer, &curr_pos, ncols, (hsize_t)i, elmt_counter); + } + else if(region_type == H5S_SEL_HYPERSLABS) { + /* Print block information */ + H5TOOLS_DEBUG("H5S_SEL_HYPERSLABS H5R_DATASET_REGION2"); + h5tools_dump_region_data_blocks(new_obj_sid, new_obj_id, stream, info, &datactx, + &buffer, &curr_pos, ncols, (hsize_t)i, elmt_counter); + } + else + H5TOOLS_INFO("invalid region type"); + } /* end else to if (h5tools_is_zero(... */ + if(H5Sclose(new_obj_sid) < 0) + H5TOOLS_INFO("H5Sclose H5R_DATASET_REGION2 failed"); + } + else + H5TOOLS_INFO("H5Ropen_region H5R_DATASET_REGION2 failed"); + if(H5Dclose(new_obj_id) < 0) + H5TOOLS_INFO("H5Dclose H5R_DATASET_REGION2 failed"); + } + break; + case H5R_ATTR: + H5TOOLS_DEBUG("ref_type is H5R_ATTR"); + if((new_obj_id = H5Ropen_attr(&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) >= 0) { + h5tools_dump_region_attribute(new_obj_id, stream, info, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); + if(H5Aclose(new_obj_id) < 0) + H5TOOLS_INFO("H5Aclose H5R_ATTR failed"); + } + else { + H5TOOLS_DEBUG("NULL H5R_ATTR"); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, " {"); + h5tools_render_element(stream, info, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); + + datactx.need_prefix = TRUE; + datactx.indent_level++; + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "NULL"); + h5tools_render_element(stream, info, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); + datactx.indent_level--; + datactx.need_prefix = TRUE; + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "}"); + h5tools_render_element(stream, info, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); + + H5TOOLS_INFO("H5Ropen_attr H5R_ATTR failed"); + } + break; + case H5R_BADTYPE: + case H5R_MAXTYPE: + default: + break; + } /* end switch */ + + if(H5Rdestroy(&ref_buf[i]) < 0) + H5TOOLS_INFO("H5Rdestroy failed"); + + H5TOOLS_DEBUG("finished reference loop:%d",i); + } /* end for(i = 0; i < ndims; i++, ctx->cur_elmt++, elmt_counter++) */ + + h5tools_str_close(&buffer); + + H5TOOLS_ENDDEBUG(""); +} + +/*------------------------------------------------------------------------- * Function: dump_data * * Purpose: Dump attribute, obj_data is FALSE, or dataset data, obj_data is TRUE @@ -3999,13 +4198,9 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t * { H5S_class_t space_type; int ndims; - size_t i; hid_t space = H5I_INVALID_HID; hid_t f_type = H5I_INVALID_HID; - hid_t new_obj_id = H5I_INVALID_HID; - hid_t new_obj_sid = H5I_INVALID_HID; hsize_t total_size[H5S_MAX_RANK]; - hsize_t elmt_counter = 0; /*counts the # elements printed. */ int status = -1; h5tools_context_t datactx; /* print context */ h5tools_str_t buffer; /* string into which to render */ @@ -4070,13 +4265,9 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t * H5TOOLS_DEBUG("ndims=%d - datactx.ndims=%d", ndims, datactx.ndims); /* Assume entire data space to be printed */ - if (datactx.ndims > 0) - for (i = 0; i < (size_t)datactx.ndims; i++) - datactx.p_min_idx[i] = 0; - H5Sget_simple_extent_dims(space, total_size, NULL); - if (datactx.ndims > 0) - init_acc_pos(&datactx, total_size); + init_acc_pos(datactx.ndims, total_size, datactx.acc, datactx.pos, datactx.p_min_idx); + datactx.need_prefix = TRUE; if (NULL != (ref_buf = (H5R_ref_t *)HDcalloc(MAX(sizeof(unsigned), sizeof(H5R_ref_t)), (size_t)ndims))) { @@ -4094,197 +4285,7 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t * H5TOOLS_GOTO_DONE_NO_RET(); } } - for (i = 0; i < (size_t)ndims; i++, datactx.cur_elmt++, elmt_counter++) { - H5O_type_t obj_type = -1; /* Object type */ - H5R_type_t ref_type; /* Reference type */ - - H5TOOLS_DEBUG("reference loop:%d with curr_pos=%ld", i, curr_pos); - - datactx.need_prefix = TRUE; - h5tools_str_reset(&buffer); - H5TOOLS_DEBUG("reference loop - h5tools_str_sprint with H5T_STD_REF:%d", i); - h5tools_str_sprint(&buffer, &outputformat, obj_id, H5T_STD_REF, &ref_buf[i], &datactx); - h5tools_render_element(stream, &outputformat, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)i, (hsize_t)ndims); - - ref_type = H5Rget_type((const H5R_ref_t *)&ref_buf[i]); - switch (ref_type) { - case H5R_OBJECT1: - H5TOOLS_DEBUG("ref_type is H5R_OBJECT1"); - if (H5Rget_obj_type3(&ref_buf[i], H5P_DEFAULT, &obj_type) >= 0) { - switch (obj_type) { - case H5O_TYPE_DATASET: - if((new_obj_id = H5Ropen_object(&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) >= 0) { - datactx.indent_level++; - h5tools_dump_data(stream, &outputformat, &datactx, new_obj_id, TRUE); - datactx.indent_level--; - if(H5Dclose(new_obj_id) < 0) - H5TOOLS_INFO("H5Dclose H5R_OBJECT1:H5O_TYPE_DATASET failed"); - } - else - H5TOOLS_INFO("H5Ropen_object H5R_OBJECT1:H5O_TYPE_DATASET failed"); - break; - - case H5O_TYPE_GROUP: - case H5O_TYPE_NAMED_DATATYPE: - case H5O_TYPE_MAP: - case H5O_TYPE_UNKNOWN: - case H5O_TYPE_NTYPES: - default: - break; - } /* end switch */ - } - else - H5TOOLS_INFO("H5Rget_obj_type3 H5R_OBJECT1 failed"); - break; - case H5R_DATASET_REGION1: - H5TOOLS_DEBUG("ref_type is H5R_DATASET_REGION1"); - if((new_obj_id = H5Ropen_object(&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) >= 0) { - datactx.indent_level++; - h5tools_dump_data(stream, &outputformat, &datactx, new_obj_id, TRUE); - datactx.indent_level--; - if(H5Dclose(new_obj_id) < 0) - H5TOOLS_INFO("H5Dclose H5R_DATASET_REGION1 failed"); - } - else - H5TOOLS_INFO("H5Ropen_object H5R_DATASET_REGION1 failed"); - break; - case H5R_OBJECT2: - H5TOOLS_DEBUG("ref_type is H5R_OBJECT2"); - if (H5Rget_obj_type3(&ref_buf[i], H5P_DEFAULT, &obj_type) >= 0) { - switch (obj_type) { - case H5O_TYPE_GROUP: - break; - - case H5O_TYPE_DATASET: - if((new_obj_id = H5Ropen_object(&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) >= 0) { - datactx.indent_level++; - h5tools_dump_data(stream, &outputformat, &datactx, new_obj_id, TRUE); - datactx.indent_level--; - if(H5Oclose(new_obj_id) < 0) - H5TOOLS_INFO("H5Oclose H5R_OBJECT2 failed"); - } - else - H5TOOLS_INFO("H5Ropen_object H5R_OBJECT2 failed"); - break; - - case H5O_TYPE_NAMED_DATATYPE: - break; - - case H5O_TYPE_MAP: - case H5O_TYPE_UNKNOWN: - case H5O_TYPE_NTYPES: - default: - break; - } /* end switch */ - } - else - H5TOOLS_INFO("H5Rget_obj_type3 H5R_OBJECT2 failed"); - break; - case H5R_DATASET_REGION2: - H5TOOLS_DEBUG("ref_type is H5R_DATASET_REGION2"); - - if (outputformat.line_ncols > 0) - ncols = outputformat.line_ncols; - - /* if (new_obj_id < 0) - could mean that no reference was written do not throw failure */ - if((new_obj_id = H5Ropen_object(&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) < 0) - H5TOOLS_INFO("H5Ropen_object H5R_DATASET_REGION2 failed"); - else { - if((new_obj_sid = H5Ropen_region(&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) >= 0) { - if (h5tools_is_zero(&ref_buf[i], H5Tget_size(H5T_STD_REF))) { - H5TOOLS_DEBUG("NULL H5R_DATASET_REGION2"); - - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, " {"); - h5tools_render_element(stream, &outputformat, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); - - datactx.indent_level++; - datactx.need_prefix = TRUE; - - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "NULL"); - h5tools_render_element(stream, &outputformat, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); - - datactx.indent_level--; - datactx.need_prefix = TRUE; - - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "}"); - h5tools_render_element(stream, &outputformat, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); - } - else { - H5S_sel_type region_type; - - region_type = H5Sget_select_type(new_obj_sid); - if(region_type == H5S_SEL_POINTS) { - /* Print point information */ - H5TOOLS_DEBUG("H5S_SEL_POINTS H5R_DATASET_REGION2"); - h5tools_dump_region_data_points(new_obj_sid, new_obj_id, stream, &outputformat, &datactx, - &buffer, &curr_pos, ncols, i, elmt_counter); - } - else if(region_type == H5S_SEL_HYPERSLABS) { - /* Print block information */ - H5TOOLS_DEBUG("H5S_SEL_HYPERSLABS H5R_DATASET_REGION2"); - h5tools_dump_region_data_blocks(new_obj_sid, new_obj_id, stream, &outputformat, &datactx, - &buffer, &curr_pos, ncols, i, elmt_counter); - } - else - H5TOOLS_INFO("invalid region type"); - } /* end else to if (h5tools_is_zero(... */ - if(H5Sclose(new_obj_sid) < 0) - H5TOOLS_INFO("H5Sclose H5R_DATASET_REGION2 failed"); - } - else - H5TOOLS_INFO("H5Ropen_region H5R_DATASET_REGION2 failed"); - if(H5Dclose(new_obj_id) < 0) - H5TOOLS_INFO("H5Dclose H5R_DATASET_REGION2 failed"); - } - break; - case H5R_ATTR: - H5TOOLS_DEBUG("ref_type is H5R_ATTR"); - if((new_obj_id = H5Ropen_attr(&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) >= 0) { - h5tools_dump_region_attribute(new_obj_id, stream, &outputformat, &datactx, - &buffer, &curr_pos, ncols, i, elmt_counter); - if(H5Aclose(new_obj_id) < 0) - H5TOOLS_INFO("H5Aclose H5R_ATTR failed"); - } - else { - H5TOOLS_DEBUG("NULL H5R_ATTR"); - - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, " {"); - h5tools_render_element(stream, &outputformat, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); - - datactx.indent_level++; - datactx.need_prefix = TRUE; - - datactx.indent_level++; - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "NULL"); - h5tools_render_element(stream, &outputformat, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); - datactx.indent_level--; - - datactx.indent_level--; - datactx.need_prefix = TRUE; - - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "}"); - h5tools_render_element(stream, &outputformat, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); - - H5TOOLS_INFO("H5Ropen_attr H5R_ATTR failed"); - } - break; - case H5R_BADTYPE: - case H5R_MAXTYPE: - default: - break; - } /* end switch */ - - if(H5Rdestroy(&ref_buf[i]) < 0) - H5TOOLS_INFO("H5Rdestroy failed"); - - H5TOOLS_DEBUG("finished reference loop:%d",i); - } /* end for(i = 0; i < ndims; i++, datactx->cur_elmt++, elmt_counter++) */ + h5tools_dump_reference(stream, &outputformat, &datactx, obj_id, ref_buf, ndims); HDfree(ref_buf); } ctx->indent_level--; diff --git a/tools/lib/h5tools_dump.h b/tools/lib/h5tools_dump.h index 2cd0bc1..add2e46 100644 --- a/tools/lib/h5tools_dump.h +++ b/tools/lib/h5tools_dump.h @@ -36,63 +36,53 @@ H5TOOLS_DLLVAR table_t *h5dump_type_table; /*type table reference for datatype /* Definitions of useful routines */ H5TOOLS_DLL void h5tools_dump_init(void); -H5TOOLS_DLL int h5tools_dump_dset(FILE *stream, const h5tool_format_t *info, - h5tools_context_t *ctx/*in,out*/, hid_t dset); -H5TOOLS_DLL int h5tools_dump_mem(FILE *stream, const h5tool_format_t *info, - h5tools_context_t *ctx/*in,out*/, hid_t obj_id); -H5TOOLS_DLL int h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t container, - h5tools_context_t *ctx/*in,out*/, unsigned flags, - hsize_t nelmts, hid_t type, void *_mem); -H5TOOLS_DLL void h5tools_dump_datatype(FILE *stream, const h5tool_format_t *info, - h5tools_context_t *ctx/*in,out*/, hid_t type); -H5TOOLS_DLL void h5tools_dump_dataspace(FILE *stream, const h5tool_format_t *info, - h5tools_context_t *ctx/*in,out*/, hid_t space); -H5TOOLS_DLL void h5tools_dump_attribute(FILE *stream, const h5tool_format_t *info, - h5tools_context_t *ctx/*in,out*/, const char *attr_name, hid_t attr_id); -H5TOOLS_DLL void h5tools_dump_oid(FILE *stream, const h5tool_format_t *info, - h5tools_context_t *ctx/*in,out*/, hid_t oid); -H5TOOLS_DLL void h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, - h5tools_context_t *ctx/*in,out*/, hid_t dcpl, hid_t type_id, hid_t obj_id); -H5TOOLS_DLL void h5tools_dump_comment(FILE *stream, const h5tool_format_t *info, - h5tools_context_t *ctx/*in,out*/, hid_t obj_id); -H5TOOLS_DLL void h5tools_dump_data(FILE *stream, const h5tool_format_t *info, - h5tools_context_t *ctx, hid_t obj_id, int obj_data); +H5TOOLS_DLL int h5tools_dump_dset(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/, + hid_t dset); +H5TOOLS_DLL int h5tools_dump_mem(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/, + hid_t obj_id); +H5TOOLS_DLL int h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/, + hid_t container, unsigned flags, hsize_t nelmts, hid_t type, void *_mem); +H5TOOLS_DLL void h5tools_dump_datatype(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/, + hid_t type); +H5TOOLS_DLL void h5tools_dump_dataspace(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/, + hid_t space); +H5TOOLS_DLL void h5tools_dump_attribute(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/, + const char *attr_name, hid_t attr_id); +H5TOOLS_DLL void h5tools_dump_oid(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/, + hid_t oid); +H5TOOLS_DLL void h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/, + hid_t dcpl, hid_t type_id, hid_t obj_id); +H5TOOLS_DLL void h5tools_dump_comment(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/, + hid_t obj_id); +H5TOOLS_DLL void h5tools_dump_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, + hid_t obj_id, int obj_data); +H5TOOLS_DLL void h5tools_dump_reference(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, + hid_t container, H5R_ref_t *ref_buf, int ndims); H5TOOLS_DLL hbool_t h5tools_dump_region_attribute(hid_t region_id, - FILE *stream, const h5tool_format_t *info, - h5tools_context_t *ctx/*in,out*/, - h5tools_str_t *buffer/*string into which to render */, - hsize_t *curr_pos/*total data element position*/, - size_t ncols, hsize_t region_elmt_counter/*element counter*/, - hsize_t elmt_counter); + FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/, + h5tools_str_t *buffer, hsize_t *curr_pos, size_t ncols, hsize_t region_elmt_counter, hsize_t elmt_counter); H5TOOLS_DLL hbool_t h5tools_dump_region_data_points(hid_t region_space, hid_t region_id, - FILE *stream, const h5tool_format_t *info, - h5tools_context_t *ctx/*in,out*/, - h5tools_str_t *buffer/*string into which to render */, - hsize_t *curr_pos/*total data element position*/, - size_t ncols, hsize_t region_elmt_counter/*element counter*/, - hsize_t elmt_counter); + FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/, + h5tools_str_t *buffer, hsize_t *curr_pos, size_t ncols, hsize_t region_elmt_counter, hsize_t elmt_counter); H5TOOLS_DLL hbool_t h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id, - FILE *stream, const h5tool_format_t *info, - h5tools_context_t *ctx/*in,out*/, - h5tools_str_t *buffer/*string into which to render */, - hsize_t *curr_pos/*total data element position*/, - size_t ncols, hsize_t region_elmt_counter/*element counter*/, - hsize_t elmt_counter); + FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/, + h5tools_str_t *buffer, hsize_t *curr_pos, size_t ncols, hsize_t region_elmt_counter, hsize_t elmt_counter); -H5TOOLS_DLL int h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer/*in,out*/, - const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/, +H5TOOLS_DLL int h5tools_print_datatype(FILE *stream, + h5tools_str_t *buffer/*in,out*/, const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/, hid_t type, int object_search); H5TOOLS_DLL int h5tools_print_dataspace(h5tools_str_t *buffer/*in,out*/, hid_t space); -H5TOOLS_DLL int h5tools_print_enum(FILE *stream, h5tools_str_t *buffer/*in,out*/, - const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/, +H5TOOLS_DLL int h5tools_print_enum(FILE *stream, + h5tools_str_t *buffer/*in,out*/, const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/, hid_t type); -H5TOOLS_DLL void h5tools_print_fill_value(h5tools_str_t *buffer/*in,out*/, - const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/, +H5TOOLS_DLL void h5tools_print_fill_value( + h5tools_str_t *buffer/*in,out*/, const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/, hid_t dcpl, hid_t type_id, hid_t obj_id); H5TOOLS_DLL void h5tools_print_packed_bits(h5tools_str_t *buffer/*in,out*/, hid_t type); + #ifdef __cplusplus } #endif diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c index 5c777a9..1c573a7 100644 --- a/tools/lib/h5tools_str.c +++ b/tools/lib/h5tools_str.c @@ -278,47 +278,28 @@ h5tools_str_fmt(h5tools_str_t *str/*in,out*/, size_t start, const char *fmt) * Purpose: Renders the line prefix value into string STR. * * Return: Success: Pointer to the prefix. - * * Failure: NULL - * - * Programmer: Robb Matzke - * Thursday, July 23, 1998 *------------------------------------------------------------------------- */ char * -h5tools_str_prefix(h5tools_str_t *str/*in,out*/, const h5tool_format_t *info, - hsize_t elmtno, unsigned ndims, h5tools_context_t *ctx) +h5tools_str_prefix(h5tools_str_t *str/*in,out*/, const h5tool_format_t *info, hsize_t elmtno, + h5tools_context_t *ctx) { size_t i = 0; - hsize_t curr_pos = elmtno; H5TOOLS_START_DEBUG(""); H5TOOLS_DEBUG("elmtno=%ld, ctx->ndims=%d", elmtno, ctx->ndims); h5tools_str_reset(str); - H5TOOLS_DEBUG("ndims=%d", ndims); - if(ndims > 0) { - /* - * Calculate the number of elements represented by a unit change in a - * certain index position. - */ - for(i = 0; i < (size_t) ndims; i++) { - H5TOOLS_DEBUG("curr_pos=%ld - ctx->acc[%d]=%ld", curr_pos, i, ctx->acc[i]); - ctx->pos[i] = curr_pos / ctx->acc[i]; - curr_pos -= ctx->acc[i] * ctx->pos[i]; - H5TOOLS_DEBUG("curr_pos=%ld - ctx->pos[%d]=%ld - ctx->acc[%d]=%ld", curr_pos, i, ctx->pos[i], i, ctx->acc[i]); - } - HDassert(curr_pos == 0); - + calc_acc_pos(ctx->ndims, elmtno, ctx->acc, ctx->pos); + if(ctx->ndims > 0) { /* Print the index values */ - for(i = 0; i < (size_t) ndims; i++) { + for(i = 0; i < (size_t) ctx->ndims; i++) { if (i) h5tools_str_append(str, "%s", OPT(info->idx_sep, ",")); - h5tools_str_append(str, OPT(info->idx_n_fmt, HSIZE_T_FORMAT), - (hsize_t) ctx->pos[i]); - + h5tools_str_append(str, OPT(info->idx_n_fmt, HSIZE_T_FORMAT), (hsize_t) ctx->pos[i]); } } else /* Scalar */ @@ -338,52 +319,35 @@ h5tools_str_prefix(h5tools_str_t *str/*in,out*/, const h5tool_format_t *info, * * Return: Success: Pointer to the prefix. * Failure: NULL - * - * In/Out: - * h5tools_context_t *ctx - * h5tools_str_t *str *------------------------------------------------------------------------- */ char * -h5tools_str_region_prefix(h5tools_str_t *str, const h5tool_format_t *info, - hsize_t elmtno, hsize_t *ptdata, unsigned ndims, hsize_t max_idx[], - h5tools_context_t *ctx) +h5tools_str_region_prefix(h5tools_str_t *str/*in,out*/, const h5tool_format_t *info, hsize_t elmtno, + hsize_t *ptdata, h5tools_context_t *ctx) { size_t i = 0; - hsize_t curr_pos = elmtno; - hsize_t p_prod[H5S_MAX_RANK]; - - h5tools_str_reset(str); - if(ndims > 0) { - /* - * Calculate the number of elements represented by a unit change in a - * certain index position. - */ - for(i = ndims - 1, p_prod[ndims - 1] = 1; i > 0; --i) - p_prod[i - 1] = (max_idx[i]) * p_prod[i]; + H5TOOLS_START_DEBUG(""); - for(i = 0; i < (size_t) ndims; i++) { - if(curr_pos > 0) { - ctx->pos[i] = curr_pos / p_prod[i]; - curr_pos -= p_prod[i] * ctx->pos[i]; - } - else - ctx->pos[i] = 0; - ctx->pos[i] += (unsigned long) ptdata[ctx->sm_pos+i]; - } + H5TOOLS_DEBUG("elmtno=%ld, ctx->ndims=%d", elmtno, ctx->ndims); + h5tools_str_reset(str); + calc_acc_pos(ctx->ndims, elmtno, ctx->acc, ctx->pos); + if(ctx->ndims > 0) { /* Print the index values */ - for(i = 0; i < (size_t) ndims; i++) { - if(i) + for(i = 0; i < (size_t) ctx->ndims; i++) { + ctx->pos[i] += (unsigned long) ptdata[ctx->sm_pos+i]; + if (i) h5tools_str_append(str, "%s", OPT(info->idx_sep, ",")); h5tools_str_append(str, OPT(info->idx_n_fmt, HSIZE_T_FORMAT), (hsize_t) ctx->pos[i]); - } - } /* if (ndims > 0) */ + } else /* Scalar */ - h5tools_str_append(str, OPT(info->idx_n_fmt, HSIZE_T_FORMAT), (hsize_t) 0); + h5tools_str_append(str, OPT(info->idx_n_fmt, HSIZE_T_FORMAT), (hsize_t)0); + H5TOOLS_DEBUG("str=%s", str->s); + + H5TOOLS_ENDDEBUG(""); /* Add prefix and suffix to the index */ return h5tools_str_fmt(str, (size_t)0, OPT(info->idx_fmt, "%s: ")); @@ -708,6 +672,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai if(info->raw) { size_t i; + H5TOOLS_DEBUG("info->raw"); if(1 == nsize) h5tools_str_append(str, OPT(info->fmt_raw, "0x%02x"), ucp_vp[0]); else @@ -718,8 +683,11 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai } } else { - if((type_class = H5Tget_class(type)) < 0) + H5TOOLS_DEBUG("H5Tget_class(type)"); + if((type_class = H5Tget_class(type)) < 0) { + H5TOOLS_ENDDEBUG(" with %s", "NULL"); return NULL; + } switch (type_class) { case H5T_FLOAT: H5TOOLS_DEBUG("H5T_FLOAT"); diff --git a/tools/lib/h5tools_str.h b/tools/lib/h5tools_str.h index 02bfe40..65446ee 100644 --- a/tools/lib/h5tools_str.h +++ b/tools/lib/h5tools_str.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Bill Wendling + * Programmer: Bill Wendling * Monday, 19. February 2001 */ #ifndef H5TOOLS_STR_H__ @@ -31,13 +31,12 @@ H5TOOLS_DLL char *h5tools_str_reset(h5tools_str_t *str); H5TOOLS_DLL char *h5tools_str_trunc(h5tools_str_t *str, size_t size); H5TOOLS_DLL char *h5tools_str_fmt(h5tools_str_t *str, size_t start, const char *fmt); H5TOOLS_DLL char *h5tools_str_prefix(h5tools_str_t *str, const h5tool_format_t *info, - hsize_t elmtno, unsigned ndims, h5tools_context_t *ctx); + hsize_t elmtno, h5tools_context_t *ctx); /* * new functions needed to display region reference data */ H5TOOLS_DLL char *h5tools_str_region_prefix(h5tools_str_t *str, const h5tool_format_t *info, - hsize_t elmtno, hsize_t *ptdata, unsigned ndims, - hsize_t max_idx[], h5tools_context_t *ctx); + hsize_t elmtno, hsize_t *ptdata, h5tools_context_t *ctx); H5TOOLS_DLL void h5tools_str_dump_space_slabs(h5tools_str_t *, hid_t, const h5tool_format_t *, h5tools_context_t *ctx); H5TOOLS_DLL void h5tools_str_dump_space_blocks(h5tools_str_t *, hid_t, const h5tool_format_t *); H5TOOLS_DLL void h5tools_str_dump_space_points(h5tools_str_t *, hid_t, const h5tool_format_t *); diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c index 2d53030..63b3041 100644 --- a/tools/lib/h5tools_utils.c +++ b/tools/lib/h5tools_utils.c @@ -902,7 +902,7 @@ tmpfile(void) * link_info->trg_path must be freed out of this function *-------------------------------------------------------------------------*/ int -H5tools_get_symlink_info(hid_t file_id, const char * linkpath, h5tool_link_info_t *link_info, hbool_t get_obj_type) +H5tools_get_symlink_info(hid_t file_id, const char *linkpath, h5tool_link_info_t *link_info, hbool_t get_obj_type) { htri_t l_ret; H5O_info2_t trg_oinfo; diff --git a/tools/lib/h5tools_utils.h b/tools/lib/h5tools_utils.h index a05f883..2cd2eae 100644 --- a/tools/lib/h5tools_utils.h +++ b/tools/lib/h5tools_utils.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Bill Wendling + * Programmer: Bill Wendling * Tuesday, 6. March 2001 * * Purpose: Support functions for the various tools. diff --git a/tools/lib/io_timer.c b/tools/lib/io_timer.c index 472824b..5c0c31d 100644 --- a/tools/lib/io_timer.c +++ b/tools/lib/io_timer.c @@ -23,7 +23,6 @@ */ #include "H5private.h" -#include "hdf5.h" #include "io_timer.h" diff --git a/tools/libtest/h5tools_test_utils.c b/tools/libtest/h5tools_test_utils.c index 12360a7..244fd43 100644 --- a/tools/libtest/h5tools_test_utils.c +++ b/tools/libtest/h5tools_test_utils.c @@ -1003,6 +1003,7 @@ test_set_configured_fapl(void) hid_t fapl_id = H5I_INVALID_HID; other_fa_t wrong_fa = {0x432, 0xf82, 0x9093}; +#ifdef H5_HAVE_ROS3_VFD H5FD_ros3_fapl_t ros3_anon_fa = {1, FALSE, "", "", ""}; H5FD_ros3_fapl_t ros3_auth_fa = { 1, /* fapl version */ @@ -1011,6 +1012,8 @@ test_set_configured_fapl(void) "12345677890abcdef", /* simulate access key ID */ "oiwnerwe9u0234nJw0-aoj+dsf", /* simulate secret key */ }; +#endif /* H5_HAVE_ROS3_VFD */ +#ifdef H5_HAVE_LIBHDFS H5FD_hdfs_fapl_t hdfs_fa = { 1, /* fapl version */ "", /* namenode name */ @@ -1019,6 +1022,7 @@ test_set_configured_fapl(void) "", /* user name */ 2048, /* stream buffer size */ }; +#endif /* H5_HAVE_LIBHDFS */ unsigned n_cases = 7; /* number of common testcases */ testcase cases[] = { { "(common) should fail: no fapl id", diff --git a/tools/src/h5copy/h5copy.c b/tools/src/h5copy/h5copy.c index 8805d08..a6e4d4e 100644 --- a/tools/src/h5copy/h5copy.c +++ b/tools/src/h5copy/h5copy.c @@ -207,17 +207,13 @@ static int parse_flag(const char* s_flag, unsigned *flag) int main (int argc, const char *argv[]) { - H5E_auto2_t func; - H5E_auto2_t tools_func; - void *edata; - void *tools_edata; hid_t fid_src = H5I_INVALID_HID; hid_t fid_dst = H5I_INVALID_HID; unsigned flag = 0; unsigned verbose = 0; unsigned parents = 0; - hid_t ocpl_id = (-1); /* Object copy property list */ - hid_t lcpl_id = (-1); /* Link creation property list */ + hid_t ocpl_id = H5I_INVALID_HID; /* Object copy property list */ + hid_t lcpl_id = H5I_INVALID_HID; /* Link creation property list */ int opt; int li_ret; h5tool_link_info_t linkinfo; @@ -226,17 +222,9 @@ main (int argc, const char *argv[]) h5tools_setprogname(PROGRAMNAME); h5tools_setstatus(EXIT_SUCCESS); - /* Disable error reporting */ - H5Eget_auto2(H5E_DEFAULT, &func, &edata); - H5Eset_auto2(H5E_DEFAULT, NULL, NULL); - /* Initialize h5tools lib */ h5tools_init(); - /* Disable tools error reporting */ - H5Eget_auto2(H5tools_ERR_STACK_g, &tools_func, &tools_edata); - H5Eset_auto2(H5tools_ERR_STACK_g, NULL, NULL); - /* init linkinfo struct */ HDmemset(&linkinfo, 0, sizeof(h5tool_link_info_t)); @@ -330,10 +318,8 @@ main (int argc, const char *argv[]) leave(EXIT_FAILURE); } - if (enable_error_stack > 0) { - H5Eset_auto2(H5E_DEFAULT, func, edata); - H5Eset_auto2(H5tools_ERR_STACK_g, tools_func, tools_edata); - } + /* enable error reporting if command line option */ + h5tools_error_report(); /*------------------------------------------------------------------------- * open output file diff --git a/tools/src/h5diff/h5diff_common.c b/tools/src/h5diff/h5diff_common.c index e0e6f8c..8ed2d37 100644 --- a/tools/src/h5diff/h5diff_common.c +++ b/tools/src/h5diff/h5diff_common.c @@ -25,7 +25,7 @@ static int check_d_input(const char*); * Command-line options: The user can specify short or long-named * parameters. */ -static const char *s_opts = "hVrv:qn:d:p:NcelxE:S"; +static const char *s_opts = "hVrv:qn:d:p:NcelxE:A:S"; static struct long_options l_opts[] = { { "help", no_arg, 'h' }, { "version", no_arg, 'V' }, @@ -41,6 +41,7 @@ static struct long_options l_opts[] = { { "follow-symlinks", no_arg, 'l' }, { "no-dangling-links", no_arg, 'x' }, { "exclude-path", require_arg, 'E' }, + { "exclude-attribute", require_arg, 'A' }, { "enable-error-stack", no_arg, 'S' }, { "vol-value-1", require_arg, '1' }, { "vol-name-1", require_arg, '2' }, @@ -55,7 +56,6 @@ static struct long_options l_opts[] = { * Function: check_options * * Purpose: parse command line input - * *------------------------------------------------------------------------- */ static void check_options(diff_opt_t* opts) @@ -67,7 +67,7 @@ static void check_options(diff_opt_t* opts) /* check between -d , -p, --use-system-epsilon. * These options are mutually exclusive. */ - if ((opts->d + opts->p + opts->use_system_epsilon) > 1) { + if ((opts->delta_bool + opts->percent_bool + opts->use_system_epsilon) > 1) { HDprintf("%s error: -d, -p and --use-system-epsilon options are mutually-exclusive;\n", PROGRAMNAME); HDprintf("use no more than one.\n"); HDprintf("Try '-h' or '--help' option for more information or see the %s entry in the 'HDF5 Reference Manual'.\n", PROGRAMNAME); @@ -75,27 +75,139 @@ static void check_options(diff_opt_t* opts) } } +#if TRILABS-227 +/*------------------------------------------------------------------------- + * Function: parse_hsize_list + * + * Purpose: Parse a list of comma or space separated integers and return + * them in a list. The string being passed into this function + * should be at the start of the list you want to parse. You are + * responsible for freeing the array returned from here. + * + * Lists in the so-called "terse" syntax are separated by + * semicolons (;). The lists themselves can be separated by + * either commas (,) or white spaces. + * + * Return: + *------------------------------------------------------------------------- + */ +static void +parse_hsize_list(const char *h_list, subset_d *d) +{ + hsize_t *p_list; + const char *ptr; + unsigned int size_count = 0; + unsigned int i = 0; + unsigned int last_digit = 0; + + if (!h_list || !*h_list || *h_list == ';') + return; + + H5TOOLS_START_DEBUG(" - h_list:%s", h_list); + /* count how many integers do we have */ + for (ptr = h_list; ptr && *ptr && *ptr != ';' && *ptr != ']'; ptr++) + if (HDisdigit(*ptr)) { + if (!last_digit) + /* the last read character wasn't a digit */ + size_count++; + + last_digit = 1; + } + else + last_digit = 0; + + if (size_count == 0) { + /* there aren't any integers to read */ + H5TOOLS_ENDDEBUG("No integers to read"); + return; + } + H5TOOLS_DEBUG("Number integers to read=%ld", size_count); + + /* allocate an array for the integers in the list */ + if((p_list = (hsize_t *)HDcalloc(size_count, sizeof(hsize_t))) == NULL) + H5TOOLS_INFO("Unable to allocate space for subset data"); + + for (ptr = h_list; i < size_count && ptr && *ptr && *ptr != ';' && *ptr != ']'; ptr++) + if(HDisdigit(*ptr)) { + /* we should have an integer now */ + p_list[i++] = (hsize_t)HDstrtoull(ptr, NULL, 0); + + while (HDisdigit(*ptr)) + /* scroll to end of integer */ + ptr++; + } + d->data = p_list; + d->len = size_count; + H5TOOLS_ENDDEBUG(""); +} + +/*------------------------------------------------------------------------- + * Function: parse_subset_params + * + * Purpose: Parse the so-called "terse" syntax for specifying subsetting parameters. + * + * Return: Success: struct subset_t object + * Failure: NULL + *------------------------------------------------------------------------- + */ +static struct subset_t * +parse_subset_params(const char *dset) +{ + struct subset_t *s = NULL; + char *brace; + + H5TOOLS_START_DEBUG(" - dset:%s", dset); + if ((brace = HDstrrchr(dset, '[')) != NULL) { + *brace++ = '\0'; + + s = (struct subset_t *)HDcalloc(1, sizeof(struct subset_t)); + parse_hsize_list(brace, &s->start); + + while (*brace && *brace != ';') + brace++; + + if (*brace) + brace++; + + parse_hsize_list(brace, &s->stride); + + while (*brace && *brace != ';') + brace++; + + if (*brace) + brace++; + + parse_hsize_list(brace, &s->count); + + while (*brace && *brace != ';') + brace++; + + if (*brace) + brace++; + + parse_hsize_list(brace, &s->block); + } + H5TOOLS_ENDDEBUG(""); + + return s; +} +#endif /*------------------------------------------------------------------------- * Function: parse_command_line * * Purpose: parse command line input - * *------------------------------------------------------------------------- */ -void parse_command_line(int argc, - const char* argv[], - const char** fname1, - const char** fname2, - const char** objname1, - const char** objname2, - diff_opt_t* opts) +void parse_command_line(int argc, const char* argv[], const char** fname1, const char** fname2, const char** objname1, const char** objname2, diff_opt_t* opts) { int i; int opt; struct exclude_path_list *exclude_head, *exclude_prev, *exclude_node; + struct exclude_path_list *exclude_attr_head, *exclude_attr_prev, *exclude_attr_node; + H5TOOLS_START_DEBUG(""); /* process the command-line */ HDmemset(opts, 0, sizeof (diff_opt_t)); @@ -106,15 +218,18 @@ void parse_command_line(int argc, opts->do_nans = 1; /* not Listing objects that are not comparable */ - opts->m_list_not_cmp = 0; + opts->mode_list_not_cmp = 0; /* initially no not-comparable. */ /**this is bad in mixing option with results**/ - opts->not_cmp=0; + opts->not_cmp = 0; /* init for exclude-path option */ exclude_head = NULL; + /* init for exclude-attribute option */ + exclude_attr_head = NULL; + /* parse command line options */ while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) { switch ((char)opt) { @@ -134,7 +249,7 @@ void parse_command_line(int argc, break; case 'v': - opts->m_verbose = 1; + opts->mode_verbose = 1; /* This for loop is for handling style like * -v, -v1, --verbose, --verbose=1. */ @@ -144,11 +259,11 @@ void parse_command_line(int argc, */ if (!strcmp (argv[i], "-v")) { /* no arg */ opt_ind--; - opts->m_verbose_level = 0; + opts->mode_verbose_level = 0; break; } else if (!strncmp (argv[i], "-v", (size_t)2)) { - opts->m_verbose_level = atoi(&argv[i][2]); + opts->mode_verbose_level = atoi(&argv[i][2]); break; } @@ -156,11 +271,11 @@ void parse_command_line(int argc, * long opt */ if (!strcmp (argv[i], "--verbose")) { /* no arg */ - opts->m_verbose_level = 0; + opts->mode_verbose_level = 0; break; } - else if ( !strncmp (argv[i], "--verbose", (size_t)9) && argv[i][9]=='=') { - opts->m_verbose_level = atoi(&argv[i][10]); + else if (!strncmp (argv[i], "--verbose", (size_t)9) && argv[i][9]=='=') { + opts->mode_verbose_level = atoi(&argv[i][10]); break; } } @@ -168,11 +283,11 @@ void parse_command_line(int argc, case 'q': /* use quiet mode; supress the message "0 differences found" */ - opts->m_quiet = 1; + opts->mode_quiet = 1; break; case 'r': - opts->m_report = 1; + opts->mode_report = 1; break; case 'l': @@ -214,23 +329,47 @@ void parse_command_line(int argc, } break; + case 'A': + opts->exclude_attr_path = 1; + + /* create linked list of excluding objects */ + if( (exclude_attr_node = (struct exclude_path_list*) HDmalloc(sizeof(struct exclude_path_list))) == NULL) { + HDprintf("Error: lack of memory!\n"); + h5diff_exit(EXIT_FAILURE); + } + + /* init */ + exclude_attr_node->obj_path = opt_arg; + exclude_attr_node->obj_type = H5TRAV_TYPE_UNKNOWN; + exclude_attr_prev = exclude_attr_head; + + if (NULL == exclude_attr_head) { + exclude_attr_head = exclude_attr_node; + exclude_attr_head->next = NULL; + } + else { + while(NULL != exclude_attr_prev->next) + exclude_attr_prev = exclude_attr_prev->next; + + exclude_attr_node->next = NULL; + exclude_attr_prev->next = exclude_attr_node; + } + break; + case 'd': - opts->d = 1; + opts->delta_bool = 1; - if (check_d_input(opt_arg) == - 1) { + if (check_d_input(opt_arg) == -1) { HDprintf("<-d %s> is not a valid option\n", opt_arg); usage(); h5diff_exit(EXIT_FAILURE); } opts->delta = HDatof(opt_arg); - - /* -d 0 is the same as default */ - if (H5_DBL_ABS_EQUAL(opts->delta, (double)0.0F)) - opts->d=0; + /* do not check against default, the DBL_EPSILON is being replaced by user */ break; case 'p': - opts->p = 1; + opts->percent_bool = 1; if (check_p_input(opt_arg) == -1) { HDprintf("<-p %s> is not a valid option\n", opt_arg); usage(); @@ -240,12 +379,12 @@ void parse_command_line(int argc, /* -p 0 is the same as default */ if (H5_DBL_ABS_EQUAL(opts->percent, (double)0.0F)) - opts->p = 0; + opts->percent_bool = 0; break; case 'n': - opts->n = 1; - if ( check_n_input(opt_arg) == -1) { + opts->count_bool = 1; + if (check_n_input(opt_arg) == -1) { HDprintf("<-n %s> is not a valid option\n", opt_arg); usage(); h5diff_exit(EXIT_FAILURE); @@ -258,7 +397,7 @@ void parse_command_line(int argc, break; case 'c': - opts->m_list_not_cmp = 1; + opts->mode_list_not_cmp = 1; break; case 'e': @@ -266,35 +405,35 @@ void parse_command_line(int argc, break; case '1': - opts->vol_info_1.type = VOL_BY_VALUE; - opts->vol_info_1.u.value = (H5VL_class_value_t)HDatoi(opt_arg); - opts->custom_vol_1 = TRUE; + opts->vol_info[0].type = VOL_BY_VALUE; + opts->vol_info[0].u.value = (H5VL_class_value_t)HDatoi(opt_arg); + opts->custom_vol[0] = TRUE; break; case '2': - opts->vol_info_1.type = VOL_BY_NAME; - opts->vol_info_1.u.name = opt_arg; - opts->custom_vol_1 = TRUE; + opts->vol_info[0].type = VOL_BY_NAME; + opts->vol_info[0].u.name = opt_arg; + opts->custom_vol[0] = TRUE; break; case '3': - opts->vol_info_1.info_string = opt_arg; + opts->vol_info[0].info_string = opt_arg; break; case '4': - opts->vol_info_2.type = VOL_BY_VALUE; - opts->vol_info_2.u.value = (H5VL_class_value_t)HDatoi(opt_arg); - opts->custom_vol_2 = TRUE; + opts->vol_info[1].type = VOL_BY_VALUE; + opts->vol_info[1].u.value = (H5VL_class_value_t)HDatoi(opt_arg); + opts->custom_vol[1] = TRUE; break; case '5': - opts->vol_info_2.type = VOL_BY_NAME; - opts->vol_info_2.u.name = opt_arg; - opts->custom_vol_2 = TRUE; + opts->vol_info[1].type = VOL_BY_NAME; + opts->vol_info[1].u.name = opt_arg; + opts->custom_vol[1] = TRUE; break; case '6': - opts->vol_info_2.info_string = opt_arg; + opts->vol_info[1].info_string = opt_arg; break; } } @@ -306,30 +445,49 @@ void parse_command_line(int argc, if (opts->exclude_path) opts->exclude = exclude_head; + /* if exclude-attribute option is used, keep the exclude attr list */ + if (opts->exclude_attr_path) + opts->exclude_attr = exclude_attr_head; + /* check for file names to be processed */ - if (argc <= opt_ind || argv[ opt_ind + 1 ] == NULL) { + if (argc <= opt_ind || argv[opt_ind + 1] == NULL) { error_msg("missing file names\n"); usage(); h5diff_exit(EXIT_FAILURE); } - *fname1 = argv[ opt_ind ]; - *fname2 = argv[ opt_ind + 1 ]; - *objname1 = argv[ opt_ind + 2 ]; + *fname1 = argv[opt_ind]; + *fname2 = argv[opt_ind + 1]; + *objname1 = argv[opt_ind + 2]; + H5TOOLS_DEBUG("file1 = %s", *fname1); + H5TOOLS_DEBUG("file2 = %s", *fname2); if (*objname1 == NULL) { *objname2 = NULL; + H5TOOLS_ENDDEBUG("No obj names"); return; } + H5TOOLS_DEBUG("objname1 = %s", *objname1); - if (argv[ opt_ind + 3 ] != NULL) { - *objname2 = argv[ opt_ind + 3 ]; + if (argv[opt_ind + 3] != NULL) { + *objname2 = argv[opt_ind + 3]; } else { *objname2 = *objname1; } + H5TOOLS_DEBUG("objname2 = %s", *objname2); + + /* + * TRILABS-227 is complete except for an issue with printing indices + * the following calls will enable subsetting + */ +#if TRILABS-227 + opts->sset[0] = parse_subset_params(*objname1); + opts->sset[1] = parse_subset_params(*objname2); +#endif + H5TOOLS_ENDDEBUG(""); } @@ -337,26 +495,25 @@ void parse_command_line(int argc, * Function: print_info * * Purpose: print several information messages after h5diff call - * *------------------------------------------------------------------------- */ void print_info(diff_opt_t* opts) { - if (opts->m_quiet || opts->err_stat) + if (opts->mode_quiet || opts->err_stat) return; if (opts->cmn_objs == 0) { HDprintf("No common objects found. Files are not comparable.\n"); - if (!opts->m_verbose) + if (!opts->mode_verbose) HDprintf("Use -v for a list of objects.\n"); } if (opts->not_cmp == 1) { - if (opts->m_list_not_cmp == 0) { + if (opts->mode_list_not_cmp == 0) { HDprintf("--------------------------------\n"); HDprintf("Some objects are not comparable\n"); HDprintf("--------------------------------\n"); - if (opts->m_verbose) + if (opts->mode_verbose) HDprintf("Use -c for a list of objects without details of differences.\n"); else HDprintf("Use -c for a list of objects.\n"); @@ -370,19 +527,10 @@ void print_info(diff_opt_t* opts) * Purpose: check for valid input * * Return: 1 for ok, -1 for fail - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Date: May 9, 2003 - * - * Comments: - * - * Modifications: - * *------------------------------------------------------------------------- */ H5_ATTR_PURE static int -check_n_input( const char *str ) +check_n_input(const char *str) { unsigned i; char c; @@ -406,24 +554,17 @@ check_n_input( const char *str ) * Purpose: check for a valid p option input * * Return: 1 for ok, -1 for fail - * - * Date: May 9, 2003 - * - * Comments: - * - * Modifications: - * *------------------------------------------------------------------------- */ static int -check_p_input( const char *str ) +check_p_input(const char *str) { double x; /* - the atof return value on a hexadecimal input is different - on some systems; we do a character check for this - */ + * the atof return value on a hexadecimal input is different + * on some systems; we do a character check for this + */ if (HDstrlen(str) > 2 && str[0] == '0' && str[1] == 'x') return -1; @@ -440,24 +581,17 @@ check_p_input( const char *str ) * Purpose: check for a valid d option input * * Return: 1 for ok, -1 for fail - * - * Date: November 11, 2007 - * - * Comments: - * - * Modifications: - * *------------------------------------------------------------------------- */ static int -check_d_input( const char *str ) +check_d_input(const char *str) { double x; /* - the atof return value on a hexadecimal input is different - on some systems; we do a character check for this - */ + * the atof return value on a hexadecimal input is different + * on some systems; we do a character check for this + */ if (HDstrlen(str) > 2 && str[0] == '0' && str[1] == 'x') return -1; @@ -474,7 +608,6 @@ check_d_input( const char *str ) * Purpose: print a usage message * * Return: void - * *------------------------------------------------------------------------- */ @@ -499,10 +632,9 @@ void usage(void) PRINTVALSTREAM(rawoutstream, " Verbose mode with level. Print differences and list of objects.\n"); PRINTVALSTREAM(rawoutstream, " Level of detail depends on value of N:\n"); PRINTVALSTREAM(rawoutstream, " 0 : Identical to '-v' or '--verbose'.\n"); - PRINTVALSTREAM(rawoutstream, " 1 : All level 0 information plus one-line attribute\n"); - PRINTVALSTREAM(rawoutstream, " status summary.\n"); - PRINTVALSTREAM(rawoutstream, " 2 : All level 1 information plus extended attribute\n"); - PRINTVALSTREAM(rawoutstream, " status report.\n"); + PRINTVALSTREAM(rawoutstream, " 1 : All level 0 information plus one-line attribute status summary.\n"); + PRINTVALSTREAM(rawoutstream, " 2 : All level 1 information plus extended attribute status report.\n"); + PRINTVALSTREAM(rawoutstream, " 3 : All level 2 information plus file names.\n"); PRINTVALSTREAM(rawoutstream, " -q, --quiet\n"); PRINTVALSTREAM(rawoutstream, " Quiet mode. Do not produce output.\n"); PRINTVALSTREAM(rawoutstream, " --enable-error-stack\n"); @@ -591,7 +723,14 @@ void usage(void) PRINTVALSTREAM(rawoutstream, " excluded.\n"); PRINTVALSTREAM(rawoutstream, " This option can be used repeatedly to exclude multiple paths.\n"); PRINTVALSTREAM(rawoutstream, "\n"); - + PRINTVALSTREAM(rawoutstream, " --exclude-attribute \"path/to/object/with/attribute\"\n"); + PRINTVALSTREAM(rawoutstream, " Exclude attributes on the specified path to an object when comparing files or groups.\n"); + PRINTVALSTREAM(rawoutstream, "\n"); + PRINTVALSTREAM(rawoutstream, " If there are multiple paths to an object, only the specified path(s)\n"); + PRINTVALSTREAM(rawoutstream, " will be excluded; the comparison will include any path not explicitly\n"); + PRINTVALSTREAM(rawoutstream, " excluded.\n"); + PRINTVALSTREAM(rawoutstream, " This option can be used repeatedly to exclude multiple paths.\n"); + PRINTVALSTREAM(rawoutstream, "\n"); PRINTVALSTREAM(rawoutstream, " Modes of output:\n"); PRINTVALSTREAM(rawoutstream, " Default mode: print the number of differences found and where they occured\n"); PRINTVALSTREAM(rawoutstream, " -r Report mode: print the above plus the differences\n"); @@ -622,7 +761,22 @@ void usage(void) PRINTVALSTREAM(rawoutstream, " (The option --follow-symlinks overrides the default behavior when\n"); PRINTVALSTREAM(rawoutstream, " symbolic links are compared.).\n"); PRINTVALSTREAM(rawoutstream, "\n"); - + /* + * TRILABS-227 is complete except for an issue with printing indices + * the following will be needed for subsetting + PRINTVALSTREAM(rawoutstream, " Subsetting options:\n"); + PRINTVALSTREAM(rawoutstream, " Subsetting is available by using the fcompact form of subsetting, as follows:\n"); + PRINTVALSTREAM(rawoutstream, " obj1 /foo/mydataset[START;STRIDE;COUNT;BLOCK]\n"); + PRINTVALSTREAM(rawoutstream, " It is not required to use all parameters, but until the last parameter value used,\n"); + PRINTVALSTREAM(rawoutstream, " all of the semicolons (;) are required, even when a parameter value is not specified. Example:\n"); + PRINTVALSTREAM(rawoutstream, " obj1 /foo/mydataset[START;;COUNT;BLOCK]\n"); + PRINTVALSTREAM(rawoutstream, " obj1 /foo/mydataset[START]\n"); + PRINTVALSTREAM(rawoutstream, " The STRIDE, COUNT, and BLOCK parameters are optional and will default to 1 in\n"); + PRINTVALSTREAM(rawoutstream, " each dimension. START is optional and will default to 0 in each dimension.\n"); + PRINTVALSTREAM(rawoutstream, " Each of START, STRIDE, COUNT, and BLOCK must be a comma-separated list of integers with\n"); + PRINTVALSTREAM(rawoutstream, " one integer for each dimension of the dataset.\n"); + PRINTVALSTREAM(rawoutstream, "\n"); +*/ PRINTVALSTREAM(rawoutstream, " Exit code:\n"); PRINTVALSTREAM(rawoutstream, " 0 if no differences, 1 if differences found, 2 if error\n"); PRINTVALSTREAM(rawoutstream, "\n"); diff --git a/tools/src/h5diff/h5diff_main.c b/tools/src/h5diff/h5diff_main.c index c5a0cbf..e14447d 100644 --- a/tools/src/h5diff/h5diff_main.c +++ b/tools/src/h5diff/h5diff_main.c @@ -26,7 +26,7 @@ * Return: An exit status of 0 means no differences were found, 1 means some * differences were found. * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: May 9, 2003 * @@ -69,10 +69,7 @@ int main(int argc, const char *argv[]) { int ret; - H5E_auto2_t func; - H5E_auto2_t tools_func; - void *edata; - void *tools_edata; + int i; const char *fname1 = NULL; const char *fname2 = NULL; const char *objname1 = NULL; @@ -83,27 +80,17 @@ int main(int argc, const char *argv[]) h5tools_setprogname(PROGRAMNAME); h5tools_setstatus(EXIT_SUCCESS); - /* Disable error reporting */ - H5Eget_auto2(H5E_DEFAULT, &func, &edata); - H5Eset_auto2(H5E_DEFAULT, NULL, NULL); - /* Initialize h5tools lib */ h5tools_init(); - /* Disable tools error reporting */ - H5Eget_auto2(H5tools_ERR_STACK_g, &tools_func, &tools_edata); - H5Eset_auto2(H5tools_ERR_STACK_g, NULL, NULL); - /*------------------------------------------------------------------------- * process the command-line *------------------------------------------------------------------------- */ parse_command_line(argc, argv, &fname1, &fname2, &objname1, &objname2, &opts); - if (enable_error_stack > 0) { - H5Eset_auto2(H5E_DEFAULT, func, edata); - H5Eset_auto2(H5tools_ERR_STACK_g, tools_func, tools_edata); - } + /* enable error reporting if command line option */ + h5tools_error_report(); /*------------------------------------------------------------------------- * do the diff @@ -130,6 +117,23 @@ int main(int argc, const char *argv[]) if (opts.err_stat) ret = 2; + /* free any buffers */ + for (i = 0; i < 2; i++) { + if (opts.sset[i]) { + if(opts.sset[i]->start.data) + HDfree(opts.sset[i]->start.data); + if(opts.sset[i]->stride.data) + HDfree(opts.sset[i]->stride.data); + if(opts.sset[i]->count.data) + HDfree(opts.sset[i]->count.data); + if(opts.sset[i]->block.data) + HDfree(opts.sset[i]->block.data); + + HDfree(opts.sset[i]); + opts.sset[i]=NULL; + } + } + h5diff_exit(ret); } diff --git a/tools/src/h5diff/ph5diff_main.c b/tools/src/h5diff/ph5diff_main.c index c473c8b..2336378 100644 --- a/tools/src/h5diff/ph5diff_main.c +++ b/tools/src/h5diff/ph5diff_main.c @@ -31,7 +31,7 @@ static void ph5diff_worker(int ); * Return: An exit status of 0 means no differences were found, 1 means some * differences were found. * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: May 9, 2003 * diff --git a/tools/src/h5dump/h5dump.c b/tools/src/h5dump/h5dump.c index dfaff17..2b21b1c 100644 --- a/tools/src/h5dump/h5dump.c +++ b/tools/src/h5dump/h5dump.c @@ -655,12 +655,12 @@ parse_hsize_list(const char *h_list, subset_d *d) *------------------------------------------------------------------------- */ static struct subset_t * -parse_subset_params(char *dset) +parse_subset_params(const char *dset) { struct subset_t *s = NULL; char *brace; - if (!disable_compact_subset && ((brace = HDstrrchr(dset, '[')) != NULL)) { + if (!dump_opts.disable_compact_subset && ((brace = HDstrrchr(dset, '[')) != NULL)) { *brace++ = '\0'; s = (struct subset_t *)HDcalloc(1, sizeof(struct subset_t)); @@ -891,50 +891,50 @@ parse_command_line(int argc, const char *argv[]) parse_start: switch ((char)opt) { case 'R': - display_region = TRUE; + dump_opts.display_region = TRUE; region_output = TRUE; break; case 'B': - display_bb = TRUE; + dump_opts.display_bb = TRUE; last_was_dset = FALSE; break; case 'n': - display_fi = TRUE; + dump_opts.display_fi = TRUE; last_was_dset = FALSE; if (opt_arg != NULL) h5trav_set_verbose(HDatoi(opt_arg)); break; case 'p': - display_dcpl = TRUE; + dump_opts.display_dcpl = TRUE; break; case 'y': - display_ai = FALSE; + dump_opts.display_ai = FALSE; break; case 'e': - display_escape = TRUE; + dump_opts.display_escape = TRUE; break; case 'H': - display_data = FALSE; - display_attr_data = FALSE; + dump_opts.display_data = FALSE; + dump_opts.display_attr_data = FALSE; last_was_dset = FALSE; break; case 'A': if (opt_arg != NULL) { if(0 == HDatoi(opt_arg)) - include_attrs = FALSE; + dump_opts.include_attrs = FALSE; } else { - display_data = FALSE; - display_attr_data = TRUE; + dump_opts.display_data = FALSE; + dump_opts.display_attr_data = TRUE; last_was_dset = FALSE; } break; case 'i': - display_oid = TRUE; + dump_opts.display_oid = TRUE; last_was_dset = FALSE; break; case 'r': - display_char = TRUE; + dump_opts.display_char = TRUE; break; case 'V': print_version(h5tools_getprogname()); @@ -955,7 +955,7 @@ parse_start: } break; case 'N': - display_all = 0; + dump_opts.display_all = 0; for (i = 0; i < argc; i++) if (!hand[i].func) { @@ -967,7 +967,7 @@ parse_start: last_was_dset = FALSE; break; case 'a': - display_all = 0; + dump_opts.display_all = 0; for (i = 0; i < argc; i++) if (!hand[i].func) { @@ -979,7 +979,7 @@ parse_start: last_was_dset = FALSE; break; case 'd': - display_all = 0; + dump_opts.display_all = 0; for (i = 0; i < argc; i++) if (!hand[i].func) { @@ -996,7 +996,7 @@ parse_start: driver_name_g = opt_arg; break; case 'g': - display_all = 0; + dump_opts.display_all = 0; for (i = 0; i < argc; i++) if (!hand[i].func) { @@ -1008,7 +1008,7 @@ parse_start: last_was_dset = FALSE; break; case 'l': - display_all = 0; + dump_opts.display_all = 0; for (i = 0; i < argc; i++) if (!hand[i].func) { @@ -1020,7 +1020,7 @@ parse_start: last_was_dset = FALSE; break; case 't': - display_all = 0; + dump_opts.display_all = 0; for (i = 0; i < argc; i++) if (!hand[i].func) { @@ -1047,13 +1047,13 @@ parse_start: } } else { - if(display_attr_data && !display_data) { + if(dump_opts.display_attr_data && !dump_opts.display_data) { if (h5tools_set_attr_output_file(opt_arg, 0) < 0) { usage(h5tools_getprogname()); goto error; } } - if(display_data || display_all) { + if(dump_opts.display_data || dump_opts.display_all) { if (h5tools_set_data_output_file(opt_arg, 0) < 0) { usage(h5tools_getprogname()); goto error; @@ -1061,7 +1061,7 @@ parse_start: } } - usingdasho = TRUE; + dump_opts.usingdasho = TRUE; last_was_dset = FALSE; outfname_g = opt_arg; break; @@ -1111,14 +1111,14 @@ parse_start: usage(h5tools_getprogname()); goto error; } - display_packed_bits = TRUE; + dump_opts.display_packed_bits = TRUE; break; case 'v': - display_vds_first = TRUE; + dump_opts.display_vds_first = TRUE; break; case 'G': - vds_gap_size = HDatoi(opt_arg); - if (vds_gap_size < 0) { + dump_opts.vds_gap_size = HDatoi(opt_arg); + if (dump_opts.vds_gap_size < 0) { usage(h5tools_getprogname()); goto error; } @@ -1255,7 +1255,7 @@ end_collect: enable_error_stack = 1; break; case 'C': - disable_compact_subset = TRUE; + dump_opts.disable_compact_subset = TRUE; break; case 'h': usage(h5tools_getprogname()); @@ -1357,14 +1357,10 @@ main(int argc, const char *argv[]) hid_t fid = H5I_INVALID_HID; hid_t gid = H5I_INVALID_HID; hid_t fapl_id = H5P_DEFAULT; - H5E_auto2_t func; - H5E_auto2_t tools_func; H5O_info2_t oi; struct handler_t *hand = NULL; int i; unsigned u; - void *edata; - void *tools_edata; char *fname = NULL; h5tools_setprogname(PROGRAMNAME); @@ -1373,17 +1369,9 @@ main(int argc, const char *argv[]) dump_function_table = &ddl_function_table; dump_indent = 0; - /* Disable error reporting */ - H5Eget_auto2(H5E_DEFAULT, &func, &edata); - H5Eset_auto2(H5E_DEFAULT, NULL, NULL); - /* Initialize h5tools lib */ h5tools_init(); - /* Disable tools error reporting */ - H5Eget_auto2(H5tools_ERR_STACK_g, &tools_func, &tools_edata); - H5Eset_auto2(H5tools_ERR_STACK_g, NULL, NULL); - if((hand = parse_command_line(argc, argv))==NULL) { goto done; } @@ -1394,34 +1382,29 @@ main(int argc, const char *argv[]) goto done; } - if (enable_error_stack > 0) { - H5Eset_auto2(H5E_DEFAULT, func, edata); - H5Eset_auto2(H5tools_ERR_STACK_g, tools_func, tools_edata); - } - /* Check for conflicting options */ if (doxml_g) { - if (!display_all) { + if (!dump_opts.display_all) { error_msg("option \"%s\" not available for XML\n", "to display selected objects"); h5tools_setstatus(EXIT_FAILURE); goto done; } - else if (display_bb) { + else if (dump_opts.display_bb) { error_msg("option \"%s\" not available for XML\n", "--boot-block"); h5tools_setstatus(EXIT_FAILURE); goto done; } - else if (display_oid == 1) { + else if (dump_opts.display_oid == 1) { error_msg("option \"%s\" not available for XML\n", "--object-ids"); h5tools_setstatus(EXIT_FAILURE); goto done; } - else if (display_char == TRUE) { + else if (dump_opts.display_char == TRUE) { error_msg("option \"%s\" not available for XML\n", "--string"); h5tools_setstatus(EXIT_FAILURE); goto done; } - else if (usingdasho) { + else if (dump_opts.usingdasho) { error_msg("option \"%s\" not available for XML\n", "--output"); h5tools_setstatus(EXIT_FAILURE); goto done; @@ -1439,6 +1422,10 @@ main(int argc, const char *argv[]) h5tools_setstatus(EXIT_FAILURE); goto done; } + + /* enable error reporting if command line option */ + h5tools_error_report(); + /* Initialize indexing options */ h5trav_set_index(sort_by, sort_order); @@ -1584,7 +1571,7 @@ main(int argc, const char *argv[]) } if (!doxml_g) { - if (display_fi) { + if (dump_opts.display_fi) { PRINTVALSTREAM(rawoutstream, "\n"); dump_fcontents(fid); end_obj(h5tools_dump_header_format->fileend,h5tools_dump_header_format->fileblockend); @@ -1592,11 +1579,11 @@ main(int argc, const char *argv[]) goto done; } - if (display_bb) + if (dump_opts.display_bb) dump_fcpl(fid); } - if(display_all) { + if(dump_opts.display_all) { if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) { error_msg("unable to open root group\n"); h5tools_setstatus(EXIT_FAILURE); @@ -1661,9 +1648,6 @@ main(int argc, const char *argv[]) /* To Do: clean up XML table */ - H5Eset_auto2(H5E_DEFAULT, func, edata); - H5Eset_auto2(H5tools_ERR_STACK_g, tools_func, tools_edata); - leave(h5tools_getstatus()); done: @@ -1693,9 +1677,6 @@ done: /* To Do: clean up XML table */ - H5Eset_auto2(H5E_DEFAULT, func, edata); - H5Eset_auto2(H5tools_ERR_STACK_g, tools_func, tools_edata); - leave(h5tools_getstatus()); } /* main */ diff --git a/tools/src/h5dump/h5dump.h b/tools/src/h5dump/h5dump.h index ca1fef6..548af09 100644 --- a/tools/src/h5dump/h5dump.h +++ b/tools/src/h5dump/h5dump.h @@ -52,8 +52,8 @@ typedef struct h5dump_table_list_t { h5dump_table_list_t table_list = {0, 0, NULL}; table_t *group_table = NULL, *dset_table = NULL, *type_table = NULL; -unsigned dump_indent = 0; /*how far in to indent the line */ +unsigned dump_indent = 0; /* how far in to indent the line */ int unamedtype = 0; /* shared datatype with no name */ hbool_t hit_elink = FALSE; /* whether we have traversed an external link */ size_t prefix_len = 1024; @@ -61,23 +61,26 @@ char *prefix = NULL; const char *fp_format = NULL; /* things to display or which are set via command line parameters */ -int display_all = TRUE; -int display_oid = FALSE; -int display_data = TRUE; -int display_attr_data = TRUE; -int display_char = FALSE; /*print 1-byte numbers as ASCII */ -int usingdasho = FALSE; -int display_bb = FALSE; /*superblock */ -int display_dcpl = FALSE; /*dcpl */ -int display_fi = FALSE; /*file index */ -int display_ai = TRUE; /*array index */ -int display_escape = FALSE; /*escape non printable characters */ -int display_region = FALSE; /*print region reference data */ -int disable_compact_subset= FALSE; /* disable compact form of subset notation */ -int display_packed_bits = FALSE; /*print 1-8 byte numbers as packed bits*/ -int include_attrs = TRUE; /* Display attributes */ -int display_vds_first = FALSE; /* vds display to all by default*/ -int vds_gap_size = 0; /* vds skip missing files default is none */ +typedef struct { + int display_all; + int display_oid; + int display_data; + int display_attr_data; + int display_char; /* print 1-byte numbers as ASCII */ + int usingdasho; + int display_bb; /* superblock */ + int display_dcpl; /* dcpl */ + int display_fi; /* file index */ + int display_ai; /* array index */ + int display_escape; /* escape non printable characters */ + int display_region; /* print region reference data */ + int disable_compact_subset; /* disable compact form of subset notation */ + int display_packed_bits; /* print 1-8 byte numbers as packed bits */ + int include_attrs; /* Display attributes */ + int display_vds_first; /* vds display to all by default */ + int vds_gap_size; /* vds skip missing files default is none */ +} dump_opt_t; +dump_opt_t dump_opts = {TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, 0}; #define PACKED_BITS_MAX 8 /* Maximum number of packed-bits to display */ #define PACKED_BITS_SIZE_MAX (8*sizeof(long long)) /* Maximum bits size of integer types of packed-bits */ diff --git a/tools/src/h5dump/h5dump_ddl.c b/tools/src/h5dump/h5dump_ddl.c index 1df205c..b50ce52 100644 --- a/tools/src/h5dump/h5dump_ddl.c +++ b/tools/src/h5dump/h5dump_ddl.c @@ -103,13 +103,13 @@ dump_attr_cb(hid_t oid, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED * HDmemset(&ctx, 0, sizeof(ctx)); ctx.indent_level = dump_indent / COL; ctx.cur_column = dump_indent; - ctx.display_index = display_ai; - ctx.display_char = display_char; + ctx.display_index = dump_opts.display_ai; + ctx.display_char = dump_opts.display_char; attr_id = H5Aopen(oid, attr_name, H5P_DEFAULT); - oid_output = display_oid; - data_output = display_data; - attr_data_output = display_attr_data; + oid_output = dump_opts.display_oid; + data_output = dump_opts.display_data; + attr_data_output = dump_opts.display_attr_data; string_dataformat = *outputformat; @@ -125,7 +125,7 @@ dump_attr_cb(hid_t oid, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED * else string_dataformat.line_ncols = h5tools_nCols; - string_dataformat.do_escape = display_escape; + string_dataformat.do_escape = dump_opts.display_escape; outputformat = &string_dataformat; h5dump_type_table = type_table; @@ -185,7 +185,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info2_t *linfo, void H5_ATT else string_dataformat.line_ncols = h5tools_nCols; - string_dataformat.do_escape = display_escape; + string_dataformat.do_escape = dump_opts.display_escape; outputformat = &string_dataformat; /* Build the object's path name */ @@ -242,16 +242,16 @@ dump_all_cb(hid_t group, const char *name, const H5L_info2_t *linfo, void H5_ATT break; case H5O_TYPE_DATASET: - if(display_data) { + if(dump_opts.display_data) { if ((dapl_id = H5Pcreate(H5P_DATASET_ACCESS)) < 0) { error_msg("error in creating default access property list ID\n"); } - if (display_vds_first) { + if (dump_opts.display_vds_first) { if(H5Pset_virtual_view(dapl_id, H5D_VDS_FIRST_MISSING) < 0) error_msg("error in setting access property list ID, virtual_view\n"); } - if (vds_gap_size > 0) { - if(H5Pset_virtual_printf_gap(dapl_id, (hsize_t)vds_gap_size) < 0) + if (dump_opts.vds_gap_size > 0) { + if(H5Pset_virtual_printf_gap(dapl_id, (hsize_t)dump_opts.vds_gap_size) < 0) error_msg("error in setting access property list ID, virtual_printf_gap\n"); } } @@ -565,7 +565,7 @@ attr_iteration(hid_t gid, unsigned attr_crt_order_flags) { /* attribute iteration: if there is a request to do H5_INDEX_CRT_ORDER and tracking order is set in the group for attributes, then, sort by creation order, otherwise by name */ - if(include_attrs) { + if(dump_opts.include_attrs) { if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) { if(H5Aiterate2(gid, sort_by, sort_order, NULL, dump_attr_cb, NULL) < 0) { error_msg("error getting attribute information\n"); @@ -642,7 +642,7 @@ dump_named_datatype(hid_t tid, const char *name) else string_dataformat.line_ncols = h5tools_nCols; - string_dataformat.do_escape = display_escape; + string_dataformat.do_escape = dump_opts.display_escape; outputformat = &string_dataformat; if ((tcpl_id = H5Tget_create_plist(tid)) < 0) { @@ -795,7 +795,7 @@ dump_group(hid_t gid, const char *name) else string_dataformat.line_ncols = h5tools_nCols; - string_dataformat.do_escape = display_escape; + string_dataformat.do_escape = dump_opts.display_escape; outputformat = &string_dataformat; ctx.need_prefix = TRUE; @@ -831,7 +831,7 @@ dump_group(hid_t gid, const char *name) } } /* end if */ - if(display_oid) + if(dump_opts.display_oid) h5tools_dump_oid(rawoutstream, outputformat, &ctx, gid); h5tools_dump_comment(rawoutstream, outputformat, &ctx, gid); @@ -926,7 +926,7 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset) else string_dataformat.line_ncols = h5tools_nCols; - string_dataformat.do_escape = display_escape; + string_dataformat.do_escape = dump_opts.display_escape; outputformat = &string_dataformat; if ((dcpl_id = H5Dget_create_plist(did)) < 0) { @@ -967,11 +967,11 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset) h5tools_dump_dataspace(rawoutstream, outputformat, &ctx, space); H5Sclose(space); - if(display_oid) { + if(dump_opts.display_oid) { h5tools_dump_oid(rawoutstream, outputformat, &ctx, did); } - if(display_dcpl) { + if(dump_opts.display_dcpl) { h5dump_type_table = type_table; h5tools_dump_dcpl(rawoutstream, outputformat, &ctx, dcpl_id, type, did); h5dump_type_table = NULL; @@ -979,16 +979,16 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset) H5Pclose(dcpl_id); ctx.sset = sset; - ctx.display_index = display_ai; - ctx.display_char = display_char; - if(display_data) { + ctx.display_index = dump_opts.display_ai; + ctx.display_char = dump_opts.display_char; + if(dump_opts.display_data) { unsigned data_loop = 1; unsigned u; - if(display_packed_bits) + if(dump_opts.display_packed_bits) data_loop = packed_bits_num; for(u = 0; u < data_loop; u++) { - if(display_packed_bits) { + if(dump_opts.display_packed_bits) { ctx.need_prefix = TRUE; h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ @@ -1091,7 +1091,7 @@ dump_data(hid_t obj_id, int obj_data, struct subset_t *sset, int display_index) else string_dataformat.line_ncols = h5tools_nCols; - string_dataformat.do_escape = display_escape; + string_dataformat.do_escape = dump_opts.display_escape; outputformat = &string_dataformat; HDmemset(&ctx, 0, sizeof(ctx)); @@ -1099,7 +1099,7 @@ dump_data(hid_t obj_id, int obj_data, struct subset_t *sset, int display_index) ctx.cur_column = dump_indent; ctx.sset = sset; ctx.display_index = display_index; - ctx.display_char = display_char; + ctx.display_char = dump_opts.display_char; if(obj_data == DATASET_DATA) print_dataset = TRUE; @@ -1527,8 +1527,8 @@ handle_attributes(hid_t fid, const char *attr, void H5_ATTR_UNUSED *data, int H5 HDmemset(&ctx, 0, sizeof(ctx)); ctx.indent_level = dump_indent / COL; ctx.cur_column = dump_indent; - ctx.display_index = display_ai; - ctx.display_char = display_char; + ctx.display_index = dump_opts.display_ai; + ctx.display_char = dump_opts.display_char; string_dataformat = *outputformat; @@ -1544,7 +1544,7 @@ handle_attributes(hid_t fid, const char *attr, void H5_ATTR_UNUSED *data, int H5 else string_dataformat.line_ncols = h5tools_nCols; - string_dataformat.do_escape = display_escape; + string_dataformat.do_escape = dump_opts.display_escape; outputformat = &string_dataformat; attr_name = h5tools_str_replace(attr + j + 1, "\\/", "/"); @@ -1583,9 +1583,9 @@ handle_attributes(hid_t fid, const char *attr, void H5_ATTR_UNUSED *data, int H5 } /* end if */ attr_id = H5Aopen(oid, attr_name, H5P_DEFAULT); - oid_output = display_oid; - data_output = display_data; - attr_data_output = display_attr_data; + oid_output = dump_opts.display_oid; + data_output = dump_opts.display_data; + attr_data_output = dump_opts.display_attr_data; h5dump_type_table = type_table; h5tools_dump_attribute(rawoutstream, outputformat, &ctx, attr_name, attr_id); @@ -1637,16 +1637,16 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *dis struct subset_t *sset = (struct subset_t *)data; const char *real_name = display_name ? display_name : dset; - if(display_data) { + if(dump_opts.display_data) { if ((dapl_id = H5Pcreate(H5P_DATASET_ACCESS)) < 0) { error_msg("error in creating default access property list ID\n"); } - if (display_vds_first) { + if (dump_opts.display_vds_first) { if(H5Pset_virtual_view(dapl_id, H5D_VDS_FIRST_MISSING) < 0) error_msg("error in setting access property list ID, virtual_view\n"); } - if (vds_gap_size > 0) { - if(H5Pset_virtual_printf_gap(dapl_id, (hsize_t)vds_gap_size) < 0) + if (dump_opts.vds_gap_size > 0) { + if(H5Pset_virtual_printf_gap(dapl_id, (hsize_t)dump_opts.vds_gap_size) < 0) error_msg("error in setting access property list ID, virtual_printf_gap\n"); } } diff --git a/tools/src/h5dump/h5dump_extern.h b/tools/src/h5dump/h5dump_extern.h index 00d3bd2..c615621 100644 --- a/tools/src/h5dump/h5dump_extern.h +++ b/tools/src/h5dump/h5dump_extern.h @@ -50,32 +50,35 @@ typedef struct h5dump_table_list_t { extern h5dump_table_list_t table_list; extern table_t *group_table, *dset_table, *type_table; -extern unsigned dump_indent; /*how far in to indent the line */ -extern int unamedtype; /* shared datatype with no name */ -extern hbool_t hit_elink; /* whether we have traversed an external link */ +extern unsigned dump_indent; /* how far in to indent the line */ +extern int unamedtype; /* shared datatype with no name */ +extern hbool_t hit_elink; /* whether we have traversed an external link */ extern size_t prefix_len; extern char *prefix; extern const char *fp_format; /* things to display or which are set via command line parameters */ -extern int display_all; -extern int display_oid; -extern int display_data; -extern int display_attr_data; -extern int display_char; /*print 1-byte numbers as ASCII */ -extern int usingdasho; -extern int display_bb; /*superblock */ -extern int display_dcpl; /*dcpl */ -extern int display_fi; /*file index */ -extern int display_ai; /*array index */ -extern int display_escape; /*escape non printable characters */ -extern int display_region; /*print region reference data */ -extern int disable_compact_subset; /* disable compact form of subset notation */ -extern int display_packed_bits; /*print 1-8 byte numbers as packed bits*/ -extern int include_attrs; /* Display attributes */ -extern int display_vds_first; /* vds display to first missing */ -extern int vds_gap_size; /* vds skip missing files */ +typedef struct { + int display_all; + int display_oid; + int display_data; + int display_attr_data; + int display_char; /* print 1-byte numbers as ASCII */ + int usingdasho; + int display_bb; /* superblock */ + int display_dcpl; /* dcpl */ + int display_fi; /* file index */ + int display_ai; /* array index */ + int display_escape; /* escape non printable characters */ + int display_region; /* print region reference data */ + int disable_compact_subset; /* disable compact form of subset notation */ + int display_packed_bits; /* print 1-8 byte numbers as packed bits */ + int include_attrs; /* Display attributes */ + int display_vds_first; /* vds display to all by default */ + int vds_gap_size; /* vds skip missing files default is none */ +} dump_opt_t; +extern dump_opt_t dump_opts; #define PACKED_BITS_MAX 8 /* Maximum number of packed-bits to display */ #define PACKED_BITS_SIZE_MAX 8*sizeof(long long) /* Maximum bits size of integer types of packed-bits */ diff --git a/tools/src/h5dump/h5dump_xml.c b/tools/src/h5dump/h5dump_xml.c index 95aff48..bb47f77 100644 --- a/tools/src/h5dump/h5dump_xml.c +++ b/tools/src/h5dump/h5dump_xml.c @@ -162,7 +162,7 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info2_t *linfo, void H5 else string_dataformat.line_ncols = h5tools_nCols; - string_dataformat.do_escape = display_escape; + string_dataformat.do_escape = dump_opts.display_escape; outputformat = &string_dataformat; /* Build the object's path name */ @@ -888,7 +888,7 @@ xml_print_datatype(hid_t type, unsigned in_group) else string_dataformat.line_ncols = h5tools_nCols; - string_dataformat.do_escape = display_escape; + string_dataformat.do_escape = dump_opts.display_escape; outputformat = &string_dataformat; if(!in_group && H5Tcommitted(type) > 0) { @@ -1538,7 +1538,7 @@ xml_dump_datatype(hid_t type) else string_dataformat.line_ncols = h5tools_nCols; - string_dataformat.do_escape = display_escape; + string_dataformat.do_escape = dump_opts.display_escape; outputformat = &string_dataformat; ctx.indent_level++; @@ -1669,7 +1669,7 @@ xml_dump_dataspace(hid_t space) else string_dataformat.line_ncols = h5tools_nCols; - string_dataformat.do_escape = display_escape; + string_dataformat.do_escape = dump_opts.display_escape; outputformat = &string_dataformat; ctx.indent_level++; @@ -1992,7 +1992,7 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED else string_dataformat.line_ncols = h5tools_nCols; - string_dataformat.do_escape = display_escape; + string_dataformat.do_escape = dump_opts.display_escape; outputformat = &string_dataformat; ctx.need_prefix = TRUE; @@ -2014,7 +2014,7 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED ctx.indent_level++; dump_indent += COL; - if (display_attr_data && space_type != H5S_NULL) { + if (dump_opts.display_attr_data && space_type != H5S_NULL) { switch (H5Tget_class(type)) { case H5T_INTEGER: case H5T_FLOAT: @@ -2293,7 +2293,7 @@ xml_dump_named_datatype(hid_t type, const char *name) else string_dataformat.line_ncols = h5tools_nCols; - string_dataformat.do_escape = display_escape; + string_dataformat.do_escape = dump_opts.display_escape; outputformat = &string_dataformat; dtxid = (char *)HDmalloc((size_t)100); @@ -2506,7 +2506,7 @@ xml_dump_group(hid_t gid, const char *name) else string_dataformat.line_ncols = h5tools_nCols; - string_dataformat.do_escape = display_escape; + string_dataformat.do_escape = dump_opts.display_escape; outputformat = &string_dataformat; if(HDstrcmp(name, "/") == 0) { @@ -2889,7 +2889,7 @@ xml_print_refs(hid_t did, int source) else string_dataformat.line_ncols = h5tools_nCols; - string_dataformat.do_escape = display_escape; + string_dataformat.do_escape = dump_opts.display_escape; outputformat = &string_dataformat; for (i = 0; i < (hsize_t)ssiz; i++) { @@ -3039,7 +3039,7 @@ xml_print_strs(hid_t did, int source) else string_dataformat.line_ncols = h5tools_nCols; - string_dataformat.do_escape = display_escape; + string_dataformat.do_escape = dump_opts.display_escape; outputformat = &string_dataformat; for (i = 0; i < (hsize_t)ssiz; i++) { @@ -3151,7 +3151,7 @@ check_filters(hid_t dcpl) else string_dataformat.line_ncols = h5tools_nCols; - string_dataformat.do_escape = display_escape; + string_dataformat.do_escape = dump_opts.display_escape; outputformat = &string_dataformat; nfilt = H5Pget_nfilters(dcpl); @@ -3287,7 +3287,7 @@ xml_dump_fill_value(hid_t dcpl, hid_t type) else string_dataformat.line_ncols = h5tools_nCols; - string_dataformat.do_escape = display_escape; + string_dataformat.do_escape = dump_opts.display_escape; outputformat = &string_dataformat; ctx.indent_level++; @@ -3627,7 +3627,7 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss else string_dataformat.line_ncols = h5tools_nCols; - string_dataformat.do_escape = display_escape; + string_dataformat.do_escape = dump_opts.display_escape; outputformat = &string_dataformat; xml_name_to_XID(did, tmp, rstr, 100, 1); @@ -3916,7 +3916,7 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss dump_indent -= COL; tempi = H5Dget_storage_size(did); - if (display_data && (tempi > 0)) { + if (dump_opts.display_data && (tempi > 0)) { switch (H5Tget_class(type)) { case H5T_INTEGER: case H5T_FLOAT: @@ -4172,7 +4172,7 @@ xml_print_enum(hid_t type) else string_dataformat.line_ncols = h5tools_nCols; - string_dataformat.do_escape = display_escape; + string_dataformat.do_escape = dump_opts.display_escape; outputformat = &string_dataformat; nmembs = (unsigned)H5Tget_nmembers(type); diff --git a/tools/src/h5format_convert/h5format_convert.c b/tools/src/h5format_convert/h5format_convert.c index 2c4cf41..e60097b 100644 --- a/tools/src/h5format_convert/h5format_convert.c +++ b/tools/src/h5format_convert/h5format_convert.c @@ -109,7 +109,7 @@ static void usage(const char *prog) * Purpose: parse command line input * * Return: Success: 0 - * Failure: 1 + * Failure: 1 * *------------------------------------------------------------------------- */ @@ -127,47 +127,47 @@ 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 'h': - usage(h5tools_getprogname()); - h5tools_setstatus(EXIT_SUCCESS); - goto error; - - case 'V': - print_version(h5tools_getprogname()); - h5tools_setstatus(EXIT_SUCCESS); - goto error; - - case 'v': - verbose_g = TRUE; - break; - - case 'd': /* -d dname */ - if(opt_arg != NULL && *opt_arg) - dname_g = HDstrdup(opt_arg); - if(dname_g == NULL) { - h5tools_setstatus(EXIT_FAILURE); - error_msg("No dataset name\n", opt_arg); - usage(h5tools_getprogname()); - goto error; - } - dset_g = TRUE; - break; - - case 'n': /* -n */ - noop_g = TRUE; - break; - - case 'E': - enable_error_stack = 1; - break; - - default: - h5tools_setstatus(EXIT_FAILURE); - usage(h5tools_getprogname()); - goto error; - break; - } /* switch */ + switch((char) opt) { + case 'h': + usage(h5tools_getprogname()); + h5tools_setstatus(EXIT_SUCCESS); + goto error; + + case 'V': + print_version(h5tools_getprogname()); + h5tools_setstatus(EXIT_SUCCESS); + goto error; + + case 'v': + verbose_g = TRUE; + break; + + case 'd': /* -d dname */ + if(opt_arg != NULL && *opt_arg) + dname_g = HDstrdup(opt_arg); + if(dname_g == NULL) { + h5tools_setstatus(EXIT_FAILURE); + error_msg("No dataset name\n", opt_arg); + usage(h5tools_getprogname()); + goto error; + } + dset_g = TRUE; + break; + + case 'n': /* -n */ + noop_g = TRUE; + break; + + case 'E': + enable_error_stack = 1; + break; + + default: + h5tools_setstatus(EXIT_FAILURE); + usage(h5tools_getprogname()); + goto error; + break; + } /* switch */ } /* while */ if (argc <= opt_ind) { @@ -207,17 +207,17 @@ leave(int ret) * Function: convert() * * Purpose: To downgrade a dataset's indexing type or layout version: - * For chunked: - * Downgrade the chunk indexing type to version 1 B-tree - * If type is already version 1 B-tree, no further action - * For compact/contiguous: - * Downgrade the layout version from 4 to 3 - * If version is already <= 3, no further action - * For virtual: - * No further action + * For chunked: + * Downgrade the chunk indexing type to version 1 B-tree + * If type is already version 1 B-tree, no further action + * For compact/contiguous: + * Downgrade the layout version from 4 to 3 + * If version is already <= 3, no further action + * For virtual: + * No further action * * Return: Success: 0 - * Failure: 1 + * Failure: 1 * *------------------------------------------------------------------------- */ @@ -312,7 +312,7 @@ convert(hid_t fid, const char *dname) } if(verbose_g) - HDfprintf(stdout, "Converting the dataset...\n"); + HDfprintf(stdout, "Converting the dataset...\n"); /* Downgrade the dataset */ if(H5Dformat_convert(did) < 0) { @@ -377,7 +377,7 @@ convert_dsets_cb(const char *path, const H5O_info2_t *oi, const char *already_vi if(verbose_g) HDfprintf(stdout, "Going to process dataset:%s...\n", path); if(convert(fid, path) < 0) - goto error; + goto error; } /* end if */ } /* end if */ @@ -392,57 +392,56 @@ error: * Function: main * * Purpose: To convert the chunk indexing type of a dataset in a file to - * version 1 B-tree. + * version 1 B-tree. * * Return: Success: 0 - * Failure: 1 + * Failure: 1 * *------------------------------------------------------------------------- */ int main(int argc, const char *argv[]) { - H5E_auto2_t func; - void *edata; hid_t fid = H5I_INVALID_HID; h5tools_setprogname(PROGRAMNAME); h5tools_setstatus(EXIT_SUCCESS); - /* Disable error reporting */ - H5Eget_auto2(H5E_DEFAULT, &func, &edata); - H5Eset_auto2(H5E_DEFAULT, NULL, NULL); - /* Initialize h5tools lib */ h5tools_init(); /* Parse command line options */ if(parse_command_line(argc, argv) < 0) - goto done; + goto done; else if(verbose_g) - HDfprintf(stdout, "Process command line options\n"); + HDfprintf(stdout, "Process command line options\n"); if(noop_g && verbose_g) - HDfprintf(stdout, "It is noop...\n"); + HDfprintf(stdout, "It is noop...\n"); + + /* enable error reporting if command line option */ + h5tools_error_report(); /* Open the HDF5 file */ if((fid = h5tools_fopen(fname_g, H5F_ACC_RDWR, H5P_DEFAULT, FALSE, NULL, 0)) < 0) { - error_msg("unable to open file \"%s\"\n", fname_g); - h5tools_setstatus(EXIT_FAILURE); - goto done; - } else if(verbose_g) - HDfprintf(stdout, "Open the file %s\n", fname_g); + error_msg("unable to open file \"%s\"\n", fname_g); + h5tools_setstatus(EXIT_FAILURE); + goto done; + } + else if(verbose_g) + HDfprintf(stdout, "Open the file %s\n", fname_g); if(dset_g) { /* Convert a specified dataset in the file */ - if(verbose_g) - HDfprintf(stdout, "Going to process dataset: %s...\n", dname_g); - if(convert(fid, dname_g) < 0) - goto done; - } else { /* Convert all datasets in the file */ - if(verbose_g) - HDfprintf(stdout, "Processing all datasets in the file...\n"); - if(h5trav_visit(fid, "/", TRUE, TRUE, convert_dsets_cb, NULL, &fid, H5O_INFO_BASIC) < 0) - goto done; + if(verbose_g) + HDfprintf(stdout, "Going to process dataset: %s...\n", dname_g); + if(convert(fid, dname_g) < 0) + goto done; + } + else { /* Convert all datasets in the file */ + if(verbose_g) + HDfprintf(stdout, "Processing all datasets in the file...\n"); + if(h5trav_visit(fid, "/", TRUE, TRUE, convert_dsets_cb, NULL, &fid, H5O_INFO_BASIC) < 0) + goto done; } /* end else */ if(verbose_g) { @@ -464,19 +463,20 @@ main(int argc, const char *argv[]) done: /* Close the file */ if(fid >= 0) { - if(H5Fclose(fid) < 0) { - error_msg("unable to close file \"%s\"\n", fname_g); - h5tools_setstatus(EXIT_FAILURE); - } else if(verbose_g) - HDfprintf(stdout, "Close the file\n"); + if(H5Fclose(fid) < 0) { + error_msg("unable to close file \"%s\"\n", fname_g); + h5tools_setstatus(EXIT_FAILURE); + } + else if(verbose_g) { + HDfprintf(stdout, "Close the file\n"); + } } /* end if */ if(fname_g) - HDfree(fname_g); + HDfree(fname_g); if(dname_g) - HDfree(dname_g); + HDfree(dname_g); - H5Eset_auto2(H5E_DEFAULT, func, edata); leave(h5tools_getstatus()); } /* end main() */ diff --git a/tools/src/h5import/h5import.c b/tools/src/h5import/h5import.c index b11fe7f..4221eec 100644 --- a/tools/src/h5import/h5import.c +++ b/tools/src/h5import/h5import.c @@ -941,7 +941,7 @@ static int readFloatData(FILE *strm, struct Input *in) * * Return: 0, ok, -1 no * - * Programmer: Pedro Vicente, pvn@hdfgroup.org + * Programmer: Pedro Vicente * * Date: July, 26, 2007 * @@ -3735,8 +3735,8 @@ static int getExternalFilename(struct Input *in, FILE *strm) return (-1); } - in->externFilename = (char *) HDmalloc ((size_t) (HDstrlen(temp)) * sizeof(char)); - (void) HDstrcpy(in->externFilename, temp); + in->externFilename = (char *) HDmalloc ((size_t) (HDstrlen(temp) + 1) * sizeof(char)); + (void) HDstrncpy(in->externFilename, temp, HDstrlen(temp) + 1); return (0); } diff --git a/tools/src/h5jam/h5jam.c b/tools/src/h5jam/h5jam.c index 009e527..8b61112 100644 --- a/tools/src/h5jam/h5jam.c +++ b/tools/src/h5jam/h5jam.c @@ -120,13 +120,6 @@ usage (const char *prog) static void leave(int ret) { - if (ub_file) - HDfree (ub_file); - if (input_file) - HDfree (input_file); - if (output_file) - HDfree (output_file); - h5tools_close(); HDexit(ret); @@ -195,8 +188,6 @@ main (int argc, const char *argv[]) int ufid = -1; int h5fid = -1; int ofid = -1; - void *edata; - H5E_auto2_t func; hid_t ifile = H5I_INVALID_HID; hid_t plist = H5I_INVALID_HID; herr_t status; @@ -214,20 +205,20 @@ main (int argc, const char *argv[]) h5tools_setprogname(PROGRAMNAME); h5tools_setstatus(EXIT_SUCCESS); - /* Disable error reporting */ - H5Eget_auto2(H5E_DEFAULT, &func, &edata); - H5Eset_auto2(H5E_DEFAULT, NULL, NULL); - /* Initialize h5tools lib */ h5tools_init(); parse_command_line(argc, argv); + /* enable error reporting if command line option */ + h5tools_error_report(); + if (ub_file == NULL) { /* no user block */ error_msg("missing argument for -u .\n"); help_ref_msg(stderr); - leave (EXIT_FAILURE); + h5tools_setstatus(EXIT_FAILURE); + goto done; } testval = H5Fis_accessible(ub_file, H5P_DEFAULT); @@ -235,13 +226,15 @@ main (int argc, const char *argv[]) if (testval > 0) { error_msg("-u cannot be HDF5 file, but it appears to be an HDF5 file.\n"); help_ref_msg(stderr); - leave (EXIT_FAILURE); + h5tools_setstatus(EXIT_FAILURE); + goto done; } if (input_file == NULL) { error_msg("missing argument for -i .\n"); help_ref_msg(stderr); - leave (EXIT_FAILURE); + h5tools_setstatus(EXIT_FAILURE); + goto done; } testval = H5Fis_accessible(input_file, H5P_DEFAULT); @@ -249,45 +242,49 @@ main (int argc, const char *argv[]) if (testval <= 0) { error_msg("Input HDF5 file \"%s\" is not HDF5 format.\n", input_file); help_ref_msg(stderr); - leave (EXIT_FAILURE); + h5tools_setstatus(EXIT_FAILURE); + goto done; } ifile = H5Fopen(input_file, H5F_ACC_RDONLY, H5P_DEFAULT); if (ifile < 0) { error_msg("Can't open input HDF5 file \"%s\"\n", input_file); - leave (EXIT_FAILURE); + h5tools_setstatus(EXIT_FAILURE); + goto done; } plist = H5Fget_create_plist(ifile); if (plist < 0) { error_msg("Can't get file creation plist for file \"%s\"\n", input_file); - H5Fclose(ifile); - leave (EXIT_FAILURE); + h5tools_setstatus(EXIT_FAILURE); + goto done; } status = H5Pget_userblock(plist, &usize); if (status < 0) { error_msg("Can't get user block for file \"%s\"\n", input_file); - H5Pclose(plist); - H5Fclose(ifile); - leave (EXIT_FAILURE); + h5tools_setstatus(EXIT_FAILURE); + goto done; } H5Pclose(plist); + plist = H5I_INVALID_HID; H5Fclose(ifile); + ifile = H5I_INVALID_HID; ufid = HDopen(ub_file, O_RDONLY); if(ufid < 0) { error_msg("unable to open user block file \"%s\"\n", ub_file); - leave (EXIT_FAILURE); + h5tools_setstatus(EXIT_FAILURE); + goto done; } res = HDfstat(ufid, &sbuf); if(res < 0) { error_msg("Can't stat file \"%s\"\n", ub_file); - HDclose (ufid); - leave (EXIT_FAILURE); + h5tools_setstatus(EXIT_FAILURE); + goto done; } fsize = (off_t)sbuf.st_size; @@ -295,16 +292,15 @@ main (int argc, const char *argv[]) h5fid = HDopen(input_file, O_RDONLY); if(h5fid < 0) { error_msg("unable to open HDF5 file for read \"%s\"\n", input_file); - HDclose (ufid); - leave (EXIT_FAILURE); + h5tools_setstatus(EXIT_FAILURE); + goto done; } res = HDfstat(h5fid, &sbuf2); if(res < 0) { error_msg("Can't stat file \"%s\"\n", input_file); - HDclose (h5fid); - HDclose (ufid); - leave (EXIT_FAILURE); + h5tools_setstatus(EXIT_FAILURE); + goto done; } h5fsize = (hsize_t)sbuf2.st_size; @@ -314,9 +310,8 @@ main (int argc, const char *argv[]) if (ofid < 0) { error_msg("unable to open output file \"%s\"\n", output_file); - HDclose (h5fid); - HDclose (ufid); - leave (EXIT_FAILURE); + h5tools_setstatus(EXIT_FAILURE); + goto done; } } else { @@ -324,9 +319,8 @@ main (int argc, const char *argv[]) if (ofid < 0) { error_msg("unable to create output file \"%s\"\n", output_file); - HDclose (h5fid); - HDclose (ufid); - leave (EXIT_FAILURE); + h5tools_setstatus(EXIT_FAILURE); + goto done; } } @@ -365,12 +359,11 @@ main (int argc, const char *argv[]) /* pad the ub */ if(write_pad(ofid, where, &where) < 0) { error_msg("Can't pad file \"%s\"\n", output_file); - HDclose (h5fid); - HDclose (ufid); - HDclose (ofid); - leave (EXIT_FAILURE); + h5tools_setstatus(EXIT_FAILURE); + goto done; } /* end if */ +done: if(ub_file) HDfree(ub_file); if(input_file) @@ -378,6 +371,11 @@ main (int argc, const char *argv[]) if(output_file) HDfree(output_file); + if(plist >= 0) + H5Pclose(plist); + if(ifile >= 0) + H5Fclose(ifile); + if(ufid >= 0) HDclose(ufid); if(h5fid >= 0) @@ -385,7 +383,7 @@ main (int argc, const char *argv[]) if(ofid >= 0) HDclose(ofid); - return h5tools_getstatus(); + leave(h5tools_getstatus()); } /*------------------------------------------------------------------------- diff --git a/tools/src/h5jam/h5unjam.c b/tools/src/h5jam/h5unjam.c index 203522b..b48e2c1 100644 --- a/tools/src/h5jam/h5unjam.c +++ b/tools/src/h5jam/h5unjam.c @@ -185,6 +185,13 @@ done: return EXIT_FAILURE; } +static void +leave(int ret) +{ + h5tools_close(); + HDexit(ret); +} + /*------------------------------------------------------------------------- * Function: main * @@ -197,8 +204,6 @@ done: int main(int argc, const char *argv[]) { - void *edata; - H5E_auto2_t func; hid_t ifile = H5I_INVALID_HID; hid_t plist = H5I_INVALID_HID; off_t fsize; @@ -211,16 +216,15 @@ main(int argc, const char *argv[]) h5tools_setprogname(PROGRAMNAME); h5tools_setstatus(EXIT_SUCCESS); - /* Disable error reporting */ - H5Eget_auto2(H5E_DEFAULT, &func, &edata); - H5Eset_auto2(H5E_DEFAULT, NULL, NULL); - /* Initialize h5tools lib */ h5tools_init(); if(EXIT_FAILURE == parse_command_line(argc, argv)) goto done; + /* enable error reporting if command line option */ + h5tools_error_report(); + if (input_file == NULL) { /* no user block */ error_msg("missing argument for HDF5 file input.\n"); @@ -319,9 +323,7 @@ done: HDfree(ub_file); } - h5tools_close(); - - return h5tools_getstatus(); + leave(h5tools_getstatus()); } /*------------------------------------------------------------------------- diff --git a/tools/src/h5ls/h5ls.c b/tools/src/h5ls/h5ls.c index 765ab63..8cf9b3c 100644 --- a/tools/src/h5ls/h5ls.c +++ b/tools/src/h5ls/h5ls.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, March 23, 1998 */ @@ -1298,230 +1298,6 @@ print_type(h5tools_str_t *buffer, hid_t type, int ind) h5tools_str_append(buffer,"%lu-byte class-%u unknown", (unsigned long)H5Tget_size(type), (unsigned)data_class); } -/* - * - */ -static void -dump_reference(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, hid_t container, H5R_ref_t *ref_buf, int ndims) -{ - hid_t new_obj_id = H5I_INVALID_HID; - hid_t new_obj_sid = H5I_INVALID_HID; - hsize_t elmt_counter = 0; /*counts the # elements printed. */ - size_t ncols = 80; /* available output width */ - int i; - hsize_t curr_pos = 0; /* total data element position */ - h5tools_str_t buffer; /* string into which to render */ - h5tools_context_t datactx; /* print context */ - - H5TOOLS_START_DEBUG(""); - - datactx = *ctx; /* print context */ - /* Assume entire data space to be printed */ - if (datactx.ndims > 0) - for (i = 0; (unsigned)i < datactx.ndims; i++) - datactx.p_min_idx[i] = 0; - datactx.need_prefix = TRUE; - - HDmemset(&buffer, 0, sizeof(h5tools_str_t)); - for(i = 0; i < ndims; i++, datactx.cur_elmt++, elmt_counter++) { - H5O_type_t obj_type = -1; /* Object type */ - H5R_type_t ref_type; /* Reference type */ - - H5TOOLS_DEBUG("reference loop:%d with curr_pos=%ld", i, curr_pos); - - datactx.need_prefix = TRUE; - h5tools_str_reset(&buffer); - H5TOOLS_DEBUG("reference loop - h5tools_str_sprint with H5T_STD_REF:%d", i); - h5tools_str_sprint(&buffer, info, container, H5T_STD_REF, &ref_buf[i], &datactx); - h5tools_render_element(stream, info, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)i, (hsize_t)ndims); - - ref_type = H5Rget_type((const H5R_ref_t *)&ref_buf[i]); - switch (ref_type) { - case H5R_OBJECT1: - H5TOOLS_DEBUG("ref_type is H5R_OBJECT1"); - if (H5Rget_obj_type3(&ref_buf[i], H5P_DEFAULT, &obj_type) >= 0) { - switch (obj_type) { - case H5O_TYPE_DATASET: - if((new_obj_id = H5Ropen_object(&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) >= 0) { - datactx.indent_level++; - h5tools_dump_dset(stream, info, &datactx, new_obj_id); - datactx.indent_level--; - if(H5Dclose(new_obj_id) < 0) - H5TOOLS_INFO("H5Dclose H5R_OBJECT1:H5O_TYPE_DATASET failed"); - if(H5Rdestroy(&ref_buf[i]) < 0) - H5TOOLS_INFO("H5Rdestroy H5R_OBJECT1:H5O_TYPE_DATASET failed"); - } - else - H5TOOLS_INFO("H5Ropen_object H5R_OBJECT1:H5O_TYPE_DATASET failed"); - break; - - case H5O_TYPE_GROUP: - case H5O_TYPE_NAMED_DATATYPE: - case H5O_TYPE_MAP: - case H5O_TYPE_UNKNOWN: - case H5O_TYPE_NTYPES: - default: - break; - } /* end switch */ - } - else - H5TOOLS_INFO("H5Rget_obj_type3 H5R_OBJECT1 failed"); - break; - case H5R_DATASET_REGION1: - H5TOOLS_DEBUG("ref_type is H5R_DATASET_REGION1"); - if((new_obj_id = H5Ropen_object(&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) >= 0) { - datactx.indent_level++; - h5tools_dump_dset(stream, info, &datactx, new_obj_id); - datactx.indent_level--; - if(H5Dclose(new_obj_id) < 0) - H5TOOLS_INFO("H5Dclose H5R_DATASET_REGION1 failed"); - if(H5Rdestroy(&ref_buf[i]) < 0) - H5TOOLS_INFO("H5Rdestroy H5R_DATASET_REGION1 failed"); - } - else - H5TOOLS_INFO("H5Ropen_object H5R_DATASET_REGION1 failed"); - break; - case H5R_OBJECT2: - H5TOOLS_DEBUG("ref_type is H5R_OBJECT2"); - if (H5Rget_obj_type3(&ref_buf[i], H5P_DEFAULT, &obj_type) >= 0) { - switch (obj_type) { - case H5O_TYPE_GROUP: - break; - - case H5O_TYPE_DATASET: - if((new_obj_id = H5Ropen_object(&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) >= 0) { - datactx.indent_level++; - h5tools_dump_dset(stream, info, &datactx, new_obj_id); - datactx.indent_level--; - if(H5Oclose(new_obj_id) < 0) - H5TOOLS_INFO("H5Oclose H5R_OBJECT2 failed"); - if(H5Rdestroy(&ref_buf[i]) < 0) - H5TOOLS_INFO("H5Rdestroy H5R_OBJECT2 failed"); - } - else - H5TOOLS_INFO("H5Ropen_object H5R_OBJECT2 failed"); - break; - - case H5O_TYPE_NAMED_DATATYPE: - break; - - case H5O_TYPE_MAP: - case H5O_TYPE_UNKNOWN: - case H5O_TYPE_NTYPES: - default: - break; - } /* end switch */ - } - else - H5TOOLS_INFO("H5Rget_obj_type3 H5R_OBJECT2 failed"); - break; - case H5R_DATASET_REGION2: - H5TOOLS_DEBUG("ref_type is H5R_DATASET_REGION2"); - - if (info->line_ncols > 0) - ncols = info->line_ncols; - - /* if (new_obj_id < 0) - could mean that no reference was written do not throw failure */ - if((new_obj_id = H5Ropen_object(&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) < 0) - H5TOOLS_INFO("H5Ropen_object H5R_DATASET_REGION2 failed"); - else { - if((new_obj_sid = H5Ropen_region(&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) >= 0) { - if (h5tools_is_zero(&ref_buf[i], H5Tget_size(H5T_STD_REF))) { - H5TOOLS_DEBUG("NULL H5R_DATASET_REGION2"); - - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, " {"); - h5tools_render_element(stream, info, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); - - datactx.need_prefix = TRUE; - datactx.indent_level++; - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "NULL"); - h5tools_render_element(stream, info, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); - datactx.indent_level--; - datactx.need_prefix = TRUE; - - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "}"); - h5tools_render_element(stream, info, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); - } - else { - H5S_sel_type region_type; - - region_type = H5Sget_select_type(new_obj_sid); - if(region_type == H5S_SEL_POINTS) { - /* Print point information */ - H5TOOLS_DEBUG("H5S_SEL_POINTS H5R_DATASET_REGION2"); - h5tools_dump_region_data_points(new_obj_sid, new_obj_id, stream, info, &datactx, - &buffer, &curr_pos, ncols, (hsize_t)i, elmt_counter); - } - else if(region_type == H5S_SEL_HYPERSLABS) { - /* Print block information */ - H5TOOLS_DEBUG("H5S_SEL_HYPERSLABS H5R_DATASET_REGION2"); - h5tools_dump_region_data_blocks(new_obj_sid, new_obj_id, stream, info, &datactx, - &buffer, &curr_pos, ncols, (hsize_t)i, elmt_counter); - } - else - H5TOOLS_INFO("invalid region type"); - } /* end else to if (h5tools_is_zero(... */ - if(H5Sclose(new_obj_sid) < 0) - H5TOOLS_INFO("H5Sclose H5R_DATASET_REGION2 failed"); - } - else - H5TOOLS_INFO("H5Ropen_region H5R_DATASET_REGION2 failed"); - if(H5Dclose(new_obj_id) < 0) - H5TOOLS_INFO("H5Dclose H5R_DATASET_REGION2 failed"); - if(H5Rdestroy(&ref_buf[i]) < 0) - H5TOOLS_INFO("H5Rdestroy H5R_DATASET_REGION2 failed"); - } - break; - case H5R_ATTR: - H5TOOLS_DEBUG("ref_type is H5R_ATTR"); - if((new_obj_id = H5Ropen_attr(&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) >= 0) { - h5tools_dump_region_attribute(new_obj_id, stream, info, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); - if(H5Aclose(new_obj_id) < 0) - H5TOOLS_INFO("H5Aclose H5R_ATTR failed"); - if(H5Rdestroy(&ref_buf[i]) < 0) - H5TOOLS_INFO("H5Rdestroy H5R_ATTR failed"); - } - else { - H5TOOLS_DEBUG("NULL H5R_ATTR"); - - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, " {"); - h5tools_render_element(stream, info, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); - - datactx.need_prefix = TRUE; - datactx.indent_level++; - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "NULL"); - h5tools_render_element(stream, info, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); - datactx.indent_level--; - datactx.need_prefix = TRUE; - - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "}"); - h5tools_render_element(stream, info, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); - - H5TOOLS_INFO("H5Ropen_attr H5R_ATTR failed"); - } - break; - case H5R_BADTYPE: - case H5R_MAXTYPE: - default: - break; - } /* end switch */ - - H5TOOLS_DEBUG("finished reference loop:%d",i); - } /* end for(i = 0; i < ndims; i++, ctx->cur_elmt++, elmt_counter++) */ - - h5tools_str_close(&buffer); - - PRINTVALSTREAM(stream, "\n"); - - H5TOOLS_ENDDEBUG(""); -} - /*------------------------------------------------------------------------- * Function: dump_dataset_values * @@ -1537,7 +1313,6 @@ dump_dataset_values(hid_t dset) hid_t space = H5I_INVALID_HID; hsize_t total_size[H5S_MAX_RANK]; int ndims; - size_t i; char string_prefix[64]; static char fmt_double[16]; static char fmt_float[16]; @@ -1653,13 +1428,9 @@ dump_dataset_values(hid_t dset) H5TOOLS_DEBUG("ndims=%d - ctx.ndims=%d", ndims, ctx.ndims); /* Assume entire data space to be printed */ - if (ctx.ndims > 0) - for (i = 0; i < (size_t)ctx.ndims; i++) - ctx.p_min_idx[i] = 0; - H5Sget_simple_extent_dims(space, total_size, NULL); - if (ctx.ndims > 0) - init_acc_pos(&ctx, total_size); + init_acc_pos(ctx.ndims, total_size, ctx.acc, ctx.pos, ctx.p_min_idx); + ctx.need_prefix = TRUE; if (NULL != (ref_buf = (H5R_ref_t *)HDcalloc(MAX(sizeof(unsigned), sizeof(H5R_ref_t)), (size_t)ndims))) { @@ -1669,7 +1440,9 @@ dump_dataset_values(hid_t dset) H5TOOLS_INFO("H5Dread reference failed"); H5TOOLS_GOTO_DONE_NO_RET(); } - dump_reference(rawoutstream, info, &ctx, dset, ref_buf, ndims); + h5tools_dump_reference(rawoutstream, info, &ctx, dset, ref_buf, ndims); + + PRINTVALSTREAM(rawoutstream, "\n"); HDfree(ref_buf); } } @@ -1707,7 +1480,6 @@ dump_attribute_values(hid_t attr) hid_t space = H5I_INVALID_HID; hsize_t total_size[H5S_MAX_RANK]; int ndims; - size_t i; char string_prefix[64]; static char fmt_double[16]; static char fmt_float[16]; @@ -1824,13 +1596,9 @@ dump_attribute_values(hid_t attr) H5TOOLS_DEBUG("ndims=%d - ctx.ndims=%d", ndims, ctx.ndims); /* Assume entire data space to be printed */ - if (ctx.ndims > 0) - for (i = 0; i < (size_t)ctx.ndims; i++) - ctx.p_min_idx[i] = 0; - H5Sget_simple_extent_dims(space, total_size, NULL); - if (ctx.ndims > 0) - init_acc_pos(&ctx, total_size); + init_acc_pos(ctx.ndims, total_size, ctx.acc, ctx.pos, ctx.p_min_idx); + ctx.need_prefix = TRUE; if (NULL != (ref_buf = (H5R_ref_t *)HDcalloc(MAX(sizeof(unsigned), sizeof(H5R_ref_t)), (size_t)ndims))) { @@ -1841,7 +1609,9 @@ dump_attribute_values(hid_t attr) H5TOOLS_GOTO_DONE_NO_RET(); } ctx.indent_level++; - dump_reference(rawoutstream, info, &ctx, attr, ref_buf, ndims); + h5tools_dump_reference(rawoutstream, info, &ctx, attr, ref_buf, ndims); + + PRINTVALSTREAM(rawoutstream, "\n"); ctx.indent_level--; HDfree(ref_buf); } @@ -2856,10 +2626,6 @@ main(int argc, const char *argv[]) const char *preferred_driver = NULL; int err_exit = 0; hid_t fapl_id = H5P_DEFAULT; - H5E_auto2_t func; - H5E_auto2_t tools_func; - void *edata; - void *tools_edata; hbool_t custom_vol_fapl = FALSE; h5tools_vol_info_t vol_info; @@ -2889,17 +2655,9 @@ main(int argc, const char *argv[]) h5tools_setprogname(PROGRAMNAME); h5tools_setstatus(EXIT_SUCCESS); - /* Disable error reporting */ - H5Eget_auto2(H5E_DEFAULT, &func, &edata); - H5Eset_auto2(H5E_DEFAULT, NULL, NULL); - /* Initialize h5tools lib */ h5tools_init(); - /* Disable tools error reporting */ - H5Eget_auto2(H5tools_ERR_STACK_g, &tools_func, &tools_edata); - H5Eset_auto2(H5tools_ERR_STACK_g, NULL, NULL); - /* Initialize fapl info struct */ HDmemset(&vol_info, 0, sizeof(h5tools_vol_info_t)); @@ -3158,6 +2916,9 @@ main(int argc, const char *argv[]) } } /* end for */ + /* enable error reporting if command line option */ + h5tools_error_report(); + /* If no arguments remain then print a usage message (instead of doing * absolutely nothing ;-) */ if (argno >= argc) { @@ -3208,11 +2969,6 @@ main(int argc, const char *argv[]) } } - if (enable_error_stack > 0) { - H5Eset_auto2(H5E_DEFAULT, func, edata); - H5Eset_auto2(H5tools_ERR_STACK_g, tools_func, tools_edata); - } - /* Each remaining argument is an hdf5 file followed by an optional slash * and object name. * @@ -3271,7 +3027,6 @@ main(int argc, const char *argv[]) x = oname; if (NULL == (oname = HDstrdup(oname))) { HDfprintf(rawerrorstream, "memory allocation failed\n"); - H5Eset_auto2(H5E_DEFAULT, func, edata); leave(EXIT_FAILURE); } *x = '\0'; @@ -3316,7 +3071,6 @@ main(int argc, const char *argv[]) h5tools_str_reset(&buffer); print_obj_name(&buffer, &iter, oname, "**NOT FOUND**"); h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0); - H5Eset_auto2(H5E_DEFAULT, func, edata); leave(EXIT_FAILURE); } /* end if */ } /* end if */ @@ -3326,7 +3080,6 @@ main(int argc, const char *argv[]) /* Open the object and display it's information */ if (li.type == H5L_TYPE_HARD) { if (visit_obj(file_id, oname, &iter) < 0) { - H5Eset_auto2(H5E_DEFAULT, func, edata); leave(EXIT_FAILURE); } } /* end if(li.type == H5L_TYPE_HARD) */ @@ -3357,12 +3110,10 @@ main(int argc, const char *argv[]) if (fapl_id != H5P_DEFAULT) { if (0 < H5Pclose(fapl_id)) { HDfprintf(rawerrorstream, "Error: Unable to set close fapl entry\n\n"); - H5Eset_auto2(H5E_DEFAULT, func, edata); leave(EXIT_FAILURE); } } - H5Eset_auto2(H5E_DEFAULT, func, edata); if (err_exit) leave(EXIT_FAILURE); else diff --git a/tools/src/h5repack/h5repack.h b/tools/src/h5repack/h5repack.h index caa1166..b124fdb 100644 --- a/tools/src/h5repack/h5repack.h +++ b/tools/src/h5repack/h5repack.h @@ -101,25 +101,27 @@ typedef struct { /* all the above, ready to go to the hrepack call */ typedef struct { - pack_opttbl_t *op_tbl; /*table with all -c and -f options */ - int all_layout; /*apply the layout to all objects */ - int all_filter; /*apply the filter to all objects */ + pack_opttbl_t *op_tbl; /* table with all -c and -f options */ + int all_layout; /* apply the layout to all objects */ + int all_filter; /* apply the filter to all objects */ filter_info_t filter_g[H5_REPACK_MAX_NFILTERS]; /*global filter array for the ALL case */ - int n_filter_g; /*number of global filters */ - chunk_info_t chunk_g; /*global chunk INFO for the ALL case */ - H5D_layout_t layout_g; /*global layout information for the ALL case */ - int verbose; /*verbose mode */ - hsize_t min_comp; /*minimum size to compress, in bytes */ - int use_native; /*use a native type in write */ - hbool_t latest; /*pack file with the latest file format */ - H5F_libver_t low_bound; /* The file's low bound as in H5Fset_libver_bounds() */ - H5F_libver_t high_bound; /* The file's high bound as in H5Fset_libver_bounds() */ - hid_t fin_fapl; /* FAPL to use for opening the input file */ - hid_t fout_fapl; /* FAPL to use for opening/creating the output file */ - int grp_compact; /* Set the maximum number of links to store as header messages in the group */ - int grp_indexed; /* Set the minimum number of links to store in the indexed format */ - int msg_size[8]; /* Minimum size of shared messages: dataspace, - datatype, fill value, filter pipleline, attribute */ + int n_filter_g; /* number of global filters */ + chunk_info_t chunk_g; /* global chunk INFO for the ALL case */ + H5D_layout_t layout_g; /* global layout information for the ALL case */ + int verbose; /* verbose mode */ + hbool_t merge; /* Merge external file. */ + hbool_t prune; /* Don't follow external file. */ + hsize_t min_comp; /* minimum size to compress, in bytes */ + int use_native; /* use a native type in write */ + hbool_t latest; /* pack file with the latest file format */ + H5F_libver_t low_bound; /* The file's low bound as in H5Fset_libver_bounds() */ + H5F_libver_t high_bound; /* The file's high bound as in H5Fset_libver_bounds() */ + hid_t fin_fapl; /* FAPL to use for opening the input file */ + hid_t fout_fapl; /* FAPL to use for opening/creating the output file */ + int grp_compact; /* Set the maximum number of links to store as header messages in the group */ + int grp_indexed; /* Set the minimum number of links to store in the indexed format */ + int msg_size[8]; /* Minimum size of shared messages: dataspace, + datatype, fill value, filter pipleline, attribute */ const char *ublock_filename; /* user block file name */ hsize_t ublock_size; /* user block size */ hsize_t meta_block_size; /* metadata aggregation block size (for H5Pset_meta_block_size) */ diff --git a/tools/src/h5repack/h5repack_copy.c b/tools/src/h5repack/h5repack_copy.c index b1d6ab4..8f3496f 100644 --- a/tools/src/h5repack/h5repack_copy.c +++ b/tools/src/h5repack/h5repack_copy.c @@ -594,6 +594,8 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, hid_t f_space_id = H5I_INVALID_HID; /* file space ID */ hid_t ftype_id = H5I_INVALID_HID; /* file type ID */ hid_t wtype_id = H5I_INVALID_HID; /* read/write type ID */ + hid_t ocpl_id = H5I_INVALID_HID; /* property to pass copy options */ + hid_t lcpl_id = H5I_INVALID_HID; /* link creation property list */ named_dt_t *named_dt_head = NULL; /* Pointer to the stack of named datatypes copied */ size_t msize; /* size of type */ hsize_t nelmts; /* number of elements in dataset */ @@ -610,6 +612,7 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, int req_filter; /* there was a request for a filter */ int req_obj_layout = 0; /* request layout to current object */ unsigned crt_order_flags; /* group creation order flag */ + h5tool_link_info_t linkinfo; unsigned i; unsigned u; int ifil; @@ -619,6 +622,9 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, hsize_t size_dset; int ret_value = 0; + /* init linkinfo struct */ + HDmemset(&linkinfo, 0, sizeof(h5tool_link_info_t)); + /*------------------------------------------------------------------------- * copy the supplied object list *------------------------------------------------------------------------- @@ -1137,26 +1143,25 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, *------------------------------------------------------------------------- */ else { - hid_t pid = H5I_INVALID_HID; - /* create property to pass copy options */ - if ((pid = H5Pcreate(H5P_OBJECT_COPY)) < 0) + if ((ocpl_id = H5Pcreate(H5P_OBJECT_COPY)) < 0) H5TOOLS_GOTO_ERROR((-1), "H5Pcreate failed"); /* set options for object copy */ - if (H5Pset_copy_object(pid, H5O_COPY_WITHOUT_ATTR_FLAG) < 0) + if (H5Pset_copy_object(ocpl_id, H5O_COPY_WITHOUT_ATTR_FLAG) < 0) H5TOOLS_GOTO_ERROR((-1), "H5Pset_copy_object failed"); if (H5Ocopy(fidin, /* Source file or group identifier */ travt->objs[i].name, /* Name of the source object to be copied */ fidout, /* Destination file or group identifier */ travt->objs[i].name, /* Name of the destination object */ - pid, /* Properties which apply to the copy */ + ocpl_id, /* Properties which apply to the copy */ H5P_DEFAULT) < 0) /* Properties which apply to the new hard link */ H5TOOLS_GOTO_ERROR((-1), "H5Ocopy failed"); - if (H5Pclose(pid) < 0) + if (H5Pclose(ocpl_id) < 0) H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed"); + ocpl_id = H5I_INVALID_HID; /*------------------------------------------------------------------------- * Copy attrs manually @@ -1228,11 +1233,61 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, if (options->verbose) HDprintf(FORMAT_OBJ, "link", travt->objs[i].name); - if (H5Lcopy(fidin, travt->objs[i].name, fidout, travt->objs[i].name, H5P_DEFAULT, H5P_DEFAULT) < 0) - H5TOOLS_GOTO_ERROR((-1), "H5Lcopy failed"); + /* Check -X option. */ + if (options->merge) { + if (H5tools_get_symlink_info(fidin, travt->objs[i].name, &linkinfo, 1) == 0) { + /* dangling link */ + if (options->prune) { + HDprintf("Pruned %s.\n", travt->objs[i].name); + } + else { + if (H5Lcopy(fidin, travt->objs[i].name, fidout, travt->objs[i].name, H5P_DEFAULT, H5P_DEFAULT) < 0) + H5TOOLS_GOTO_ERROR((-1), "H5Lcopy failed"); + } + } + else { + /* valid link */ + /* create property to pass copy options */ + if ((ocpl_id = H5Pcreate(H5P_OBJECT_COPY)) < 0) + H5TOOLS_GOTO_ERROR((-1), "H5Pcreate create property failed"); - if (options->verbose) - HDprintf(FORMAT_OBJ, "link", travt->objs[i].name); + /* set options for object copy */ + if (H5Pset_copy_object(ocpl_id, H5O_COPY_EXPAND_EXT_LINK_FLAG) < 0) + H5TOOLS_GOTO_ERROR((-1), "H5Pset_copy_object failed"); + + /* Create link creation property list */ + if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) { + H5TOOLS_GOTO_ERROR((-1), "H5Pcreate link creation property failed"); + } + + /* Set flag for intermediate group creation */ + if (H5Pset_create_intermediate_group(lcpl_id, TRUE) < 0) + H5TOOLS_GOTO_ERROR((-1), "H5Pset_create_intermediate_group failed"); + + if (H5Ocopy(fidin, travt->objs[i].name, fidout, travt->objs[i].name, ocpl_id, lcpl_id) < 0) + H5TOOLS_GOTO_ERROR((-1), "H5Ocopy failed"); + + if (H5Pclose(lcpl_id) < 0) + H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed"); + + if (H5Pclose(ocpl_id) < 0) + H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed"); + } + + /* free link info path */ + if (linkinfo.trg_path) + HDfree(linkinfo.trg_path); + linkinfo.trg_path = NULL; + } /* options->merge */ + else { + if (options->prune) { + HDprintf("Pruned %s.\n", travt->objs[i].name); + } + else { + if (H5Lcopy(fidin, travt->objs[i].name, fidout, travt->objs[i].name, H5P_DEFAULT, H5P_DEFAULT) < 0) + H5TOOLS_GOTO_ERROR((-1), "H5Lcopy failed"); + } + } break; default: @@ -1249,15 +1304,22 @@ done: if (named_datatype_free(&named_dt_head, 0) < 0) H5TOOLS_ERROR((-1), "named_datatype_free failed"); } - else + else { H5E_BEGIN_TRY { named_datatype_free(&named_dt_head, 1); } H5E_END_TRY; + } + + /* free link info path */ + if (linkinfo.trg_path) + HDfree(linkinfo.trg_path); H5E_BEGIN_TRY { H5Gclose(grp_in); H5Gclose(grp_out); + H5Pclose(lcpl_id); + H5Pclose(ocpl_id); H5Pclose(dcpl_in); H5Pclose(gcpl_in); H5Pclose(gcpl_out); diff --git a/tools/src/h5repack/h5repack_main.c b/tools/src/h5repack/h5repack_main.c index f7822ca..cf0c611 100644 --- a/tools/src/h5repack/h5repack_main.c +++ b/tools/src/h5repack/h5repack_main.c @@ -32,36 +32,38 @@ 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:nLj:k:c:d:s:u:b:M:t:a:i:o:S:P:T:G:q:z:E"; +static const char *s_opts = "a:b:c:d:e:f:hi:j:k:l:m:no:q:s:t:u:vz:EG:LM:P:S:T:VXW1:2:3:4:5:6:"; static struct long_options l_opts[] = { - { "help", no_arg, 'h' }, - { "version", no_arg, 'V' }, - { "verbose", no_arg, 'v' }, + { "alignment", require_arg, 'a' }, + { "block", require_arg, 'b' }, + { "compact", require_arg, 'c' }, + { "indexed", require_arg, 'd' }, + { "file", require_arg, 'e' }, { "filter", require_arg, 'f' }, + { "help", no_arg, 'h' }, + { "infile", require_arg, 'i' }, /* for backward compability */ + { "low", require_arg, 'j' }, + { "high", require_arg, 'k' }, { "layout", require_arg, 'l' }, { "minimum", require_arg, 'm' }, - { "file", require_arg, 'e' }, { "native", no_arg, 'n' }, - { "latest", no_arg, 'L' }, - { "low", require_arg, 'j' }, - { "high", require_arg, 'k' }, - { "compact", require_arg, 'c' }, - { "indexed", require_arg, 'd' }, + { "outfile", require_arg, 'o' }, /* for backward compability */ + { "sort_by", require_arg, 'q' }, { "ssize", require_arg, 's' }, + { "threshold", require_arg, 't' }, { "ublock", require_arg, 'u' }, - { "block", require_arg, 'b' }, + { "verbose", no_arg, 'v' }, + { "sort_order", require_arg, 'z' }, + { "enable-error-stack", no_arg, 'E' }, + { "fs_pagesize", require_arg, 'G' }, + { "latest", no_arg, 'L' }, { "metadata_block_size", require_arg, 'M' }, - { "threshold", require_arg, 't' }, - { "alignment", require_arg, 'a' }, - { "infile", require_arg, 'i' }, /* for backward compability */ - { "outfile", require_arg, 'o' }, /* for backward compability */ - { "fs_strategy", require_arg, 'S' }, { "fs_persist", require_arg, 'P' }, + { "fs_strategy", require_arg, 'S' }, { "fs_threshold", require_arg, 'T' }, - { "fs_pagesize", require_arg, 'G' }, - { "sort_by", require_arg, 'q' }, - { "sort_order", require_arg, 'z' }, - { "enable-error-stack", no_arg, 'E' }, + { "version", no_arg, 'V' }, + { "merge", no_arg, 'X' }, + { "prune", no_arg, 'W' }, { "src-vol-value", require_arg, '1' }, { "src-vol-name", require_arg, '2' }, { "src-vol-info", require_arg, '3' }, @@ -113,6 +115,9 @@ static void usage(const char *prog) { PRINTVALSTREAM(rawoutstream, " --high=BOUND The high bound for library release versions to use\n"); PRINTVALSTREAM(rawoutstream, " when creating objects in the file\n"); PRINTVALSTREAM(rawoutstream, " (default is H5F_LIBVER_LATEST)\n"); + PRINTVALSTREAM(rawoutstream, " --merge Follow external soft link recursively and merge data\n"); + PRINTVALSTREAM(rawoutstream, " --prune Do not follow external soft links and remove link\n"); + PRINTVALSTREAM(rawoutstream, " --merge --prune Follow external link, merge data and remove dangling link\n"); PRINTVALSTREAM(rawoutstream, " -c L1, --compact=L1 Maximum number of links in header messages\n"); PRINTVALSTREAM(rawoutstream, " -d L2, --indexed=L2 Minimum number of links in the indexed format\n"); PRINTVALSTREAM(rawoutstream, " -s S[:F], --ssize=S[:F] Shared object header message minimum size\n"); @@ -545,6 +550,14 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options) options->high_bound = bound; break; + case 'X': + options->merge = TRUE; + break; + + case 'W': + options->prune = TRUE; + break; + case 'c': options->grp_compact = HDatoi( opt_arg ); if (options->grp_compact > 0) @@ -804,10 +817,6 @@ done: int main(int argc, const char **argv) { pack_opt_t options; /*the global options */ - H5E_auto2_t func; - H5E_auto2_t tools_func; - void *edata; - void *tools_edata; int parse_ret; HDmemset(&options, 0, sizeof(pack_opt_t)); @@ -818,14 +827,6 @@ int main(int argc, const char **argv) h5tools_setprogname(PROGRAMNAME); h5tools_setstatus(EXIT_SUCCESS); - /* Disable error reporting */ - H5Eget_auto2(H5E_DEFAULT, &func, &edata); - H5Eset_auto2(H5E_DEFAULT, NULL, NULL); - - /* Disable tools error reporting */ - H5Eget_auto2(H5tools_ERR_STACK_g, &tools_func, &tools_edata); - H5Eset_auto2(H5tools_ERR_STACK_g, NULL, NULL); - /* update hyperslab buffer size from H5TOOLS_BUFSIZE env if exist */ if (h5tools_getenv_update_hyperslab_bufsize() < 0) { HDprintf("Error occurred while retrieving H5TOOLS_BUFSIZE value\n"); @@ -855,10 +856,8 @@ int main(int argc, const char **argv) goto done; } - if (enable_error_stack > 0) { - H5Eset_auto2(H5E_DEFAULT, func, edata); - H5Eset_auto2(H5tools_ERR_STACK_g, tools_func, tools_edata); - } + /* enable error reporting if command line option */ + h5tools_error_report(); /* pack it */ if (h5repack(infile, outfile, &options) < 0) { diff --git a/tools/src/h5repack/h5repack_parse.c b/tools/src/h5repack/h5repack_parse.c index 95cacc1..50ccd7a 100644 --- a/tools/src/h5repack/h5repack_parse.c +++ b/tools/src/h5repack/h5repack_parse.c @@ -478,7 +478,7 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, * Example: * "AA,B,CDE:CHUNK=10X10" * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: December 30, 2003 * diff --git a/tools/src/h5repack/h5repack_refs.c b/tools/src/h5repack/h5repack_refs.c index 2685823..5baabb6 100644 --- a/tools/src/h5repack/h5repack_refs.c +++ b/tools/src/h5repack/h5repack_refs.c @@ -537,7 +537,6 @@ static int copy_refs_attr(hid_t loc_in, KY 2020-02-07 */ is_ref_comp = (ref_comp_field_n > 0); - } diff --git a/tools/src/h5stat/h5stat.c b/tools/src/h5stat/h5stat.c index fb3d50d7..ec4b5ab 100644 --- a/tools/src/h5stat/h5stat.c +++ b/tools/src/h5stat/h5stat.c @@ -1786,32 +1786,23 @@ main(int argc, const char *argv[]) iter_t iter; const char *fname = NULL; hid_t fid = H5I_INVALID_HID; - H5E_auto2_t func; - H5E_auto2_t tools_func; - void *edata; - void *tools_edata; struct handler_t *hand = NULL; hid_t fapl_id = H5P_DEFAULT; h5tools_setprogname(PROGRAMNAME); h5tools_setstatus(EXIT_SUCCESS); - /* Disable error reporting */ - H5Eget_auto2(H5E_DEFAULT, &func, &edata); - H5Eset_auto2(H5E_DEFAULT, NULL, NULL); - /* Initialize h5tools lib */ h5tools_init(); - /* Disable tools error reporting */ - H5Eget_auto2(H5tools_ERR_STACK_g, &tools_func, &tools_edata); - H5Eset_auto2(H5tools_ERR_STACK_g, NULL, NULL); - HDmemset(&iter, 0, sizeof(iter)); if(parse_command_line(argc, argv, &hand) < 0) goto done; + /* enable error reporting if command line option */ + h5tools_error_report(); + if (drivername) { h5tools_vfd_info_t vfd_info; @@ -1843,11 +1834,6 @@ main(int argc, const char *argv[]) fname = argv[opt_ind]; - if(enable_error_stack > 0) { - H5Eset_auto2(H5E_DEFAULT, func, edata); - H5Eset_auto2(H5tools_ERR_STACK_g, tools_func, tools_edata); - } - /* Check for filename given */ if(fname) { hid_t fcpl; @@ -1952,8 +1938,6 @@ done: h5tools_setstatus(EXIT_FAILURE); } /* end if */ - H5Eset_auto2(H5E_DEFAULT, func, edata); - leave(h5tools_getstatus()); } /* end main() */ diff --git a/tools/src/misc/h5clear.c b/tools/src/misc/h5clear.c index f95d1bc..96cbf9c 100644 --- a/tools/src/misc/h5clear.c +++ b/tools/src/misc/h5clear.c @@ -266,14 +266,9 @@ main (int argc, const char *argv[]) h5tools_setprogname(PROGRAMNAME); h5tools_setstatus(EXIT_SUCCESS); - /* Disable the HDF5 library's error reporting */ - H5Eset_auto2(H5E_DEFAULT, NULL, NULL); - /* initialize h5tools lib */ h5tools_init(); - H5Eset_auto2(H5tools_ERR_STACK_g, NULL, NULL); - /* Parse command line options */ if(parse_command_line(argc, argv) < 0) goto done; @@ -281,6 +276,9 @@ main (int argc, const char *argv[]) if(fname_g == NULL) goto done; + /* enable error reporting if command line option */ + h5tools_error_report(); + /* Print usage/exit if not using at least one of the options */ if(!clear_status_flags && !remove_cache_image && !increment_eoa_eof && !print_filesize) { @@ -387,7 +385,6 @@ main (int argc, const char *argv[]) warn_msg("No cache image in the file\n"); } - h5tools_setstatus(EXIT_SUCCESS); done: diff --git a/tools/src/misc/h5debug.c b/tools/src/misc/h5debug.c index e9a783b..7242ed3 100644 --- a/tools/src/misc/h5debug.c +++ b/tools/src/misc/h5debug.c @@ -15,7 +15,7 @@ * * Created: debug.c * Jul 18 1997 - * Robb Matzke + * Robb Matzke * * Purpose: Debugs an existing HDF5 file at a low level. * @@ -237,7 +237,6 @@ get_H5FA_class(const uint8_t *sig) * Failure: exit (non-zero) * * Programmer: Robb Matzke - * matzke@llnl.gov * Jul 18 1997 * *------------------------------------------------------------------------- diff --git a/tools/src/misc/h5mkgrp.c b/tools/src/misc/h5mkgrp.c index cbd6e6d..ad3b7b8 100644 --- a/tools/src/misc/h5mkgrp.c +++ b/tools/src/misc/h5mkgrp.c @@ -268,9 +268,6 @@ main(int argc, const char *argv[]) h5tools_setprogname(PROGRAMNAME); h5tools_setstatus(EXIT_SUCCESS); - /* Disable the HDF5 library's error reporting */ - H5Eset_auto2(H5E_DEFAULT, NULL, NULL); - /* Initialize h5tools lib */ h5tools_init(); @@ -289,6 +286,9 @@ main(int argc, const char *argv[]) leave(EXIT_FAILURE); } + /* enable error reporting if command line option */ + h5tools_error_report(); + /* Check for creating groups with new format version */ if(params_g.latest) { /* Set the "use the latest version of the format" bounds */ diff --git a/tools/src/misc/h5repart.c b/tools/src/misc/h5repart.c index d516fa0..371cf2c 100644 --- a/tools/src/misc/h5repart.c +++ b/tools/src/misc/h5repart.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, May 13, 1998 * * Purpose: Repartitions a file family. This program can be used to diff --git a/tools/test/h5copy/testh5copy.sh.in b/tools/test/h5copy/testh5copy.sh.in index 2440ca4..ebbcb6c 100644 --- a/tools/test/h5copy/testh5copy.sh.in +++ b/tools/test/h5copy/testh5copy.sh.in @@ -13,7 +13,7 @@ # # Tests for the h5copy tool # -# Pedro Vicente Nunes (pvn@hdfgroup.org), Albert Cheng (acheng@hdfgroup.org) +# Pedro Vicente Nunes, Albert Cheng # Thursday, July 20, 2006 # @@ -200,6 +200,7 @@ TOOLTEST() fi runh5diff=no fi + if [ "$3" = -o ]; then outputfile=$4 else @@ -219,6 +220,7 @@ TOOLTEST() $RUNSERIAL $H5COPY_BIN $@ ) > $actualout 2> $actualerr RET=$? + if [ $RET != 0 ]; then echo "*FAILED*" echo "failed result is:" @@ -268,6 +270,7 @@ TOOLTEST_PREFILL() $RUNSERIAL $H5COPY_BIN -i $inputfile -o $outputfile -v -s $grp_name -d $grp_name2 ) > $actualout 2> $actualerr RET=$? + if [ $RET != 0 ]; then echo "*FAILED*" echo "failed result is:" @@ -282,6 +285,7 @@ TOOLTEST_PREFILL() $RUNSERIAL $H5COPY_BIN -i $inputfile -o $outputfile -v -s $obj_name -d $obj_name2 ) > $actualout 2> $actualerr RET=$? + if [ $RET != 0 ]; then echo "*FAILED*" echo "failed result is:" @@ -313,6 +317,7 @@ TOOLTEST_SAME() else runh5diff=no fi + if [ "$3" = -o ]; then outputfile=$4 else @@ -330,6 +335,7 @@ TOOLTEST_SAME() $RUNSERIAL $H5COPY_BIN -i $inputfile -o $outputfile -v -s $grp_name -d $grp_name ) > $actualout 2> $actualerr RET=$? + if [ $RET != 0 ]; then echo "*FAILED*" echo "failed result is:" @@ -344,6 +350,7 @@ TOOLTEST_SAME() $RUNSERIAL $H5COPY_BIN -i $outputfile -o $outputfile -v -s $grp_name -d $grp_name2 ) > $actualout 2> $actualerr RET=$? + if [ $RET != 0 ]; then echo "*FAILED*" echo "failed result is:" @@ -406,6 +413,7 @@ TOOLTEST_FAIL() if [ "$1" = -i ]; then inputfile=$2 fi + if [ "$3" = -o ]; then outputfile=$4 fi @@ -417,8 +425,8 @@ TOOLTEST_FAIL() #echo "#############################" $RUNSERIAL $H5COPY_BIN $@ ) > $actualout 2> $actualerr - RET=$? + # save actualout and actualerr in case they are needed later. cp $actualout $actualout_sav STDOUT_FILTER $actualout diff --git a/tools/test/h5diff/CMakeTests.cmake b/tools/test/h5diff/CMakeTests.cmake index 3d9c6f5..4e8e8d1 100644 --- a/tools/test/h5diff/CMakeTests.cmake +++ b/tools/test/h5diff/CMakeTests.cmake @@ -66,8 +66,10 @@ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/non_comparables2.h5 ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/tudfilter.h5 ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/tudfilter2.h5 - ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/diff_strings1.h5 - ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/diff_strings2.h5 + ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_strings1.h5 + ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_strings2.h5 + ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_eps1.h5 + ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_eps2.h5 # tools/testfiles/vds ${HDF5_TOOLS_DIR}/testfiles/vds/1_a.h5 ${HDF5_TOOLS_DIR}/testfiles/vds/1_b.h5 @@ -291,6 +293,7 @@ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_80.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_800.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_801.txt + ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_830.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_90.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_8625.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_8639.txt @@ -302,6 +305,7 @@ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_v2.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_v3.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_vlstr.txt + ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_eps.txt ) set (LIST_WIN_TEST_FILES @@ -338,9 +342,10 @@ # Overwrite system dependent files (Windows) and not VS2015 # set (COPY_WINDOWS_FILES false) - if (MINGW) - set (COPY_WINDOWS_FILES true) - endif () + # MinGW tests may depend on host system + #if (MINGW) + # set (COPY_WINDOWS_FILES true) + #endif () if (WIN32 AND MSVC_VERSION LESS 1900) set (COPY_WINDOWS_FILES true) endif () @@ -539,8 +544,11 @@ set (ATTR_VERBOSE_LEVEL_FILE1 h5diff_attr_v_level1.h5) set (ATTR_VERBOSE_LEVEL_FILE2 h5diff_attr_v_level2.h5) # strings - set (STRINGS1 diff_strings1.h5) - set (STRINGS2 diff_strings2.h5) + set (STRINGS1 h5diff_strings1.h5) + set (STRINGS2 h5diff_strings2.h5) + # epsilon + set (EPS1 h5diff_eps1.h5) + set (EPS2 h5diff_eps2.h5) # VDS tests set (FILEV1 1_vds.h5) @@ -912,6 +920,8 @@ h5diff_800.out.err h5diff_801.out h5diff_801.out.err + h5diff_830.out + h5diff_830.out.err h5diff_8625.out h5diff_8625.out.err h5diff_8639.out @@ -926,6 +936,8 @@ h5diff_v3.out.err h5diff_vlstr.out h5diff_vlstr.out.err + h5diff_eps.out + h5diff_eps.out.err ) set_tests_properties (H5DIFF-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") if (last_test) @@ -1107,6 +1119,9 @@ ADD_H5_TEST (h5diff_609 0 -d 200 ${FILE1} ${FILE2} g1/dset3 g1/dset4) # 6.10: number smaller than smallest difference ADD_H5_TEST (h5diff_610 1 -d 1 ${FILE1} ${FILE2} g1/dset3 g1/dset4) +# eps: number smaller than epsilon +ADD_H5_TEST (h5diff_eps 0 -v3 -d 1e-16 ${EPS1} ${EPS2}) + # ############################################################################## # # -p # ############################################################################## @@ -1492,9 +1507,9 @@ ADD_H5_TEST (h5diff_484 0 -v --exclude-path "/dset3" ${EXCLUDE_FILE1_1} ${EXCLUD # Only one file contains unique objs. Common objs are same. # (HDFFV-7837) # -ADD_H5_TEST (h5diff_485 0 -v --exclude-path "/group1" h5diff_exclude3-1.h5 h5diff_exclude3-2.h5) -ADD_H5_TEST (h5diff_486 0 -v --exclude-path "/group1" h5diff_exclude3-2.h5 h5diff_exclude3-1.h5) -ADD_H5_TEST (h5diff_487 1 -v --exclude-path "/group1/dset" h5diff_exclude3-1.h5 h5diff_exclude3-2.h5) +ADD_H5_TEST (h5diff_485 0 -v --exclude-path "/group1" ${EXCLUDE_FILE3_1} ${EXCLUDE_FILE3_2}) +ADD_H5_TEST (h5diff_486 0 -v --exclude-path "/group1" ${EXCLUDE_FILE3_2} ${EXCLUDE_FILE3_1}) +ADD_H5_TEST (h5diff_487 1 -v --exclude-path "/group1/dset" ${EXCLUDE_FILE3_1} ${EXCLUDE_FILE3_2}) # ############################################################################## # # diff various multiple vlen and fixed strings in a compound type dataset @@ -1528,12 +1543,15 @@ ADD_H5_TEST (h5diff_646 1 -v --use-system-epsilon -p 0.05 ${FILE1} ${FILE2} /g1/ # ############################################################################## # # Test array variances # ############################################################################## -# -# Test with -d , -p and --use-system-epsilon. ADD_H5_TEST (h5diff_800 1 -v ${FILE7} ${FILE8} /g1/array /g1/array) ADD_H5_TEST (h5diff_801 1 -v ${FILE7} ${FILE8A} /g1/array /g1/array) # ############################################################################## +# # dataset subsets +# ############################################################################## +#TRILABS-227 ADD_H5_TEST (h5diff_830 1 --enable-error-stack -v ${FILE7} ${FILE8} /g1/array3D[0,0,0;2,2,1;2,2,2;] /g1/array3D[0,0,0;2,2,1;2,2,2;]) + +# ############################################################################## # # VDS tests # ############################################################################## ADD_H5_TEST (h5diff_v1 0 -v ${FILEV1} ${FILEV2}) diff --git a/tools/test/h5diff/h5diff_plugin.sh.in b/tools/test/h5diff/h5diff_plugin.sh.in index 341cba5..ffc43da 100644 --- a/tools/test/h5diff/h5diff_plugin.sh.in +++ b/tools/test/h5diff/h5diff_plugin.sh.in @@ -135,24 +135,24 @@ CLEAN_TESTFILES_AND_TESTDIR() # -h print help page while [ $# -gt 0 ]; do case "$1" in - -p) # reset the tool name and bin to run ph5diff tests - TESTNAME=ph5diff - H5DIFF=../../src/h5diff/ph5diff # The tool name - H5DIFF_BIN=`pwd`/$H5DIFF # The path of the tool binary - pmode=yes - shift - ;; + -p) # reset the tool name and bin to run ph5diff tests + TESTNAME=ph5diff + H5DIFF=../../src/h5diff/ph5diff # The tool name + H5DIFF_BIN=`pwd`/$H5DIFF # The path of the tool binary + pmode=yes + shift + ;; -h) # print help page - echo "$0 [-p] [-h]" - echo " -p run ph5diff tests" - echo " -h print help page" - shift - exit 0 - ;; + echo "$0 [-p] [-h]" + echo " -p run ph5diff tests" + echo " -h print help page" + shift + exit 0 + ;; *) # unknown option echo "$0: Unknown option ($1)" - exit 1 - ;; + exit 1 + ;; esac done @@ -218,19 +218,21 @@ TOOLTEST() { # Run test. TESTING $H5DIFF $@ ( - #echo "#############################" - #echo "Expected output for '$H5DIFF $@'" - #echo "#############################" - cd $TESTDIR - eval $ENVCMD $RUNCMD $H5DIFF_BIN "$@" + #echo "#############################" + #echo "Expected output for '$H5DIFF $@'" + #echo "#############################" + cd $TESTDIR + eval $ENVCMD $RUNCMD $H5DIFF_BIN "$@" ) >$actual 2>$actual_err EXIT_CODE=$? + # save actual and actual_err in case they are needed later. cp $actual $actual_sav STDOUT_FILTER $actual cp $actual_err $actual_err_sav STDERR_FILTER $actual_err cat $actual_err >> $actual + # don't add exit code check in pmode, as it causes failure. (exit code # is from mpirun not tool) # if any problem occurs relate to an exit code, it will be caught in @@ -260,27 +262,29 @@ TOOLTEST() { actual_sorted=actual_sorted sort $expect -o $expect_sorted sort $actual -o $actual_sorted + # remove "EXIT CODE:" line from expect file. test for exit code # is done by serial mode. grep -v "EXIT CODE:" $expect_sorted > $expect_sorted.noexit mv $expect_sorted.noexit $expect_sorted - if $CMP $expect_sorted $actual_sorted; then - echo " PASSED" - else - echo "*FAILED*" - nerrors="`expr $nerrors + 1`" - if test yes = "$verbose"; then - echo "====Expected result ($expect_sorted) differs from actual result ($actual_sorted)" - $DIFF $expect_sorted $actual_sorted |sed 's/^/ /' - echo "====The actual output ($actual_sav)" - sed 's/^/ /' < $actual_sav - echo "====The actual stderr ($actual_err_sav)" - sed 's/^/ /' < $actual_err_sav - echo "====End of actual stderr ($actual_err_sav)" - echo "" + + if $CMP $expect_sorted $actual_sorted; then + echo " PASSED" + else + echo "*FAILED*" + nerrors="`expr $nerrors + 1`" + if test yes = "$verbose"; then + echo "====Expected result ($expect_sorted) differs from actual result ($actual_sorted)" + $DIFF $expect_sorted $actual_sorted |sed 's/^/ /' + echo "====The actual output ($actual_sav)" + sed 's/^/ /' < $actual_sav + echo "====The actual stderr ($actual_err_sav)" + sed 's/^/ /' < $actual_err_sav + echo "====End of actual stderr ($actual_err_sav)" + echo "" + fi fi fi - fi # Clean up output file if test -z "$HDF5_NOCLEANUP"; then @@ -306,18 +310,20 @@ TOOLTEST_ERR() { # Run test. TESTING $H5DIFF $@ ( - #echo "#############################" - #echo "Expected output for '$H5DIFF $@'" - #echo "#############################" - cd $TESTDIR - eval $ENVCMD $RUNCMD $H5DIFF_BIN "$@" + #echo "#############################" + #echo "Expected output for '$H5DIFF $@'" + #echo "#############################" + cd $TESTDIR + eval $ENVCMD $RUNCMD $H5DIFF_BIN "$@" ) >$actual 2>$actual_err EXIT_CODE=$? + # save actual and actual_err in case they are needed later. cp $actual $actual_sav STDOUT_FILTER $actual cp $actual_err $actual_err_sav STDERR_FILTER $actual_err + # don't add exit code check in pmode, as it causes failure. (exit code # is from mpirun not tool) # if any problem occurs relate to an exit code, it will be caught in @@ -348,23 +354,24 @@ TOOLTEST_ERR() { sort $expect_err -o $expect_sorted sort $actual_err -o $actual_sorted mv $expect_sorted.noexit $expect_sorted - if $CMP $expect_sorted $actual_sorted; then - echo " PASSED" - else - echo "*FAILED*" - nerrors="`expr $nerrors + 1`" - if test yes = "$verbose"; then - echo "====Expected result ($expect_sorted) differs from actual result ($actual_sorted)" - $DIFF $expect_sorted $actual_sorted |sed 's/^/ /' - echo "====The actual output ($actual_sav)" - sed 's/^/ /' < $actual_sav - echo "====The actual stderr ($actual_err_sav)" - sed 's/^/ /' < $actual_err_sav - echo "====End of actual stderr ($actual_err_sav)" - echo "" + + if $CMP $expect_sorted $actual_sorted; then + echo " PASSED" + else + echo "*FAILED*" + nerrors="`expr $nerrors + 1`" + if test yes = "$verbose"; then + echo "====Expected result ($expect_sorted) differs from actual result ($actual_sorted)" + $DIFF $expect_sorted $actual_sorted |sed 's/^/ /' + echo "====The actual output ($actual_sav)" + sed 's/^/ /' < $actual_sav + echo "====The actual stderr ($actual_err_sav)" + sed 's/^/ /' < $actual_err_sav + echo "====End of actual stderr ($actual_err_sav)" + echo "" + fi fi fi - fi # Clean up output file if test -z "$HDF5_NOCLEANUP"; then diff --git a/tools/test/h5diff/h5diffgentest.c b/tools/test/h5diff/h5diffgentest.c index 1d5354f..173a5ce 100644 --- a/tools/test/h5diff/h5diffgentest.c +++ b/tools/test/h5diff/h5diffgentest.c @@ -31,7 +31,7 @@ size_t H5TOOLS_MALLOCSIZE = (128 * 1024 * 1024); * * Purpose: generate files for h5diff testing * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: November 12, 2003 * @@ -94,8 +94,11 @@ size_t H5TOOLS_MALLOCSIZE = (128 * 1024 * 1024); #define NON_COMPARBLES1 "non_comparables1.h5" #define NON_COMPARBLES2 "non_comparables2.h5" /* string dataset and attribute */ -#define DIFF_STRINGS1 "diff_strings1.h5" -#define DIFF_STRINGS2 "diff_strings2.h5" +#define DIFF_STRINGS1 "h5diff_strings1.h5" +#define DIFF_STRINGS2 "h5diff_strings2.h5" +/* double dataset and epsilon */ +#define DIFF_EPS1 "h5diff_eps1.h5" +#define DIFF_EPS2 "h5diff_eps2.h5" #define UIMAX 4294967295u /*Maximum value for a variable of type unsigned int */ #define STR_SIZE 3 @@ -110,7 +113,7 @@ size_t H5TOOLS_MALLOCSIZE = (128 * 1024 * 1024); /* Error macros */ #define AT() HDprintf("ERROR at %s:%d in %s()...\n", __FILE__, __LINE__, FUNC); -#define PROGRAM_ERROR {AT(); goto error;} +#define PROGRAM_ERROR do {AT(); goto error;} while(0) /* A UD link traversal function. Shouldn't actually be called. */ static hid_t @@ -172,6 +175,7 @@ static void test_comps_vlen_arry(const char *fname, const char *dset, static void test_data_nocomparables(const char *fname, int diff); static void test_objs_nocomparables(const char *fname1, const char *fname2); static void test_objs_strings(const char *fname, const char *fname2); +static void test_double_epsilon(const char *fname1, const char *fname2); /* called by test_attributes() and test_datasets() */ static void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make_diffs); @@ -288,6 +292,9 @@ int main(void) /* string dataset and attribute. HDFFV-10028 */ test_objs_strings(DIFF_STRINGS1, DIFF_STRINGS2); + /* double dataset and epsilion. HDFFV-10897 */ + test_double_epsilon(DIFF_EPS1, DIFF_EPS2); + return EXIT_SUCCESS; } @@ -4928,73 +4935,73 @@ test_objs_nocomparables(const char *fname1, const char *fname2) *------------------------------------------------------------------------*/ /* file1 */ if((fid1 = H5Fopen(fname1, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) - PROGRAM_ERROR + PROGRAM_ERROR; /* file2 */ if((fid2 = H5Fopen(fname2, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) - PROGRAM_ERROR + PROGRAM_ERROR; /*----------------------------------------------------------------------- * in file1 : add member objects *------------------------------------------------------------------------*/ /* parent group */ if((topgid1 = H5Gcreate2(fid1, "diffobjtypes", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - PROGRAM_ERROR + PROGRAM_ERROR; /* dataset */ if(write_dset(topgid1, 1, dims, "obj1", H5T_NATIVE_INT, data1) < 0) - PROGRAM_ERROR + PROGRAM_ERROR; /* group */ if((gid1 = H5Gcreate2(topgid1, "obj2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - PROGRAM_ERROR + PROGRAM_ERROR; /* committed type */ if((tid1 = H5Tcopy(H5T_NATIVE_INT)) < 0) - PROGRAM_ERROR + PROGRAM_ERROR; if(H5Tcommit2(topgid1, "obj3", tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) - PROGRAM_ERROR + PROGRAM_ERROR; /*----------------------------------------------------------------------- * in file2 : add member objects *------------------------------------------------------------------------*/ /* parent group */ if((topgid2 = H5Gcreate2(fid2, "diffobjtypes", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - PROGRAM_ERROR + PROGRAM_ERROR; /* group */ if((gid2 = H5Gcreate2(topgid2, "obj1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - PROGRAM_ERROR + PROGRAM_ERROR; /* committed type */ if((tid2 = H5Tcopy(H5T_NATIVE_INT)) < 0) - PROGRAM_ERROR + PROGRAM_ERROR; if(H5Tcommit2(topgid2, "obj2", tid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) - PROGRAM_ERROR + PROGRAM_ERROR; /* dataset */ if(write_dset(topgid2, 1, dims, "obj3", H5T_NATIVE_INT, data2) < 0) - PROGRAM_ERROR + PROGRAM_ERROR; /*----------------------------------------------------------------------- * Close IDs *-----------------------------------------------------------------------*/ if(H5Fclose(fid1) < 0) - PROGRAM_ERROR + PROGRAM_ERROR; if(H5Fclose(fid2) < 0) - PROGRAM_ERROR + PROGRAM_ERROR; if(H5Gclose(topgid1) < 0) - PROGRAM_ERROR + PROGRAM_ERROR; if(H5Gclose(topgid2) < 0) - PROGRAM_ERROR + PROGRAM_ERROR; if(H5Gclose(gid1) < 0) - PROGRAM_ERROR + PROGRAM_ERROR; if(H5Gclose(gid2) < 0) - PROGRAM_ERROR + PROGRAM_ERROR; if(H5Tclose(tid1) < 0) - PROGRAM_ERROR + PROGRAM_ERROR; if(H5Tclose(tid2) < 0) - PROGRAM_ERROR + PROGRAM_ERROR; return; @@ -8018,6 +8025,59 @@ out: return -1; } +/* + * Function: test_double_epsilion + * + * Purpose: Create test files to compare data with epsilion + */ +static +void test_double_epsilon(const char *fname1, const char *fname2) +{ + hid_t fid1 = H5I_INVALID_HID, fid2 = H5I_INVALID_HID; + hsize_t dims1[2] = { 4, 7 }; + double wdata[4][7]; + int i, j; + + /*------------------------------------------------------------------------- + * create two files + *------------------------------------------------------------------------- + */ + if ((fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + PROGRAM_ERROR; + if ((fid2 = H5Fcreate(fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + PROGRAM_ERROR; + + /* + * Initialize data. + */ + for (i=0; i<4; i++) + for (j=0; j<7; j++) + wdata[i][j] = 0.0; + + /* dataset */ + if(write_dset(fid1, 2, dims1, "dataset", H5T_IEEE_F64LE, wdata) < 0) + PROGRAM_ERROR; + + /* + * Initialize data. + */ + for (i=0; i<4; i++) + for (j=0; j<7; j++) + wdata[i][j] = (double)1.e-19; + + /* dataset */ + if(write_dset(fid2, 2, dims1, "dataset", H5T_IEEE_F64LE, wdata) < 0) + PROGRAM_ERROR; + +error: + H5E_BEGIN_TRY { + H5Fclose(fid1); + H5Fclose(fid2); + } H5E_END_TRY; + + return; +} + /*------------------------------------------------------------------------- * Function: write_attr * @@ -8073,22 +8133,22 @@ write_dset(hid_t loc_id, int rank, hsize_t *dims, const char *name, hid_t tid, v /* create a space */ if((sid = H5Screate_simple(rank, dims, NULL)) < 0) - PROGRAM_ERROR + PROGRAM_ERROR; /* create the dataset */ if((did = H5Dcreate2(loc_id, name, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - PROGRAM_ERROR + PROGRAM_ERROR; /* write */ if(buf) if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) - PROGRAM_ERROR + PROGRAM_ERROR; /* close */ if(H5Dclose(did) < 0) - PROGRAM_ERROR + PROGRAM_ERROR; if(H5Sclose(sid) < 0) - PROGRAM_ERROR + PROGRAM_ERROR; return SUCCEED; diff --git a/tools/test/h5diff/testfiles/diff_strings1.h5 b/tools/test/h5diff/testfiles/diff_strings1.h5 deleted file mode 100644 index 0f8b380..0000000 Binary files a/tools/test/h5diff/testfiles/diff_strings1.h5 and /dev/null differ diff --git a/tools/test/h5diff/testfiles/diff_strings2.h5 b/tools/test/h5diff/testfiles/diff_strings2.h5 deleted file mode 100644 index e8520ae..0000000 Binary files a/tools/test/h5diff/testfiles/diff_strings2.h5 and /dev/null differ diff --git a/tools/test/h5diff/testfiles/h5diff_10.txt b/tools/test/h5diff/testfiles/h5diff_10.txt index 0a2fd12..b5ff01a 100644 --- a/tools/test/h5diff/testfiles/h5diff_10.txt +++ b/tools/test/h5diff/testfiles/h5diff_10.txt @@ -17,10 +17,9 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] Verbose mode with level. Print differences and list of objects. Level of detail depends on value of N: 0 : Identical to '-v' or '--verbose'. - 1 : All level 0 information plus one-line attribute - status summary. - 2 : All level 1 information plus extended attribute - status report. + 1 : All level 0 information plus one-line attribute status summary. + 2 : All level 1 information plus extended attribute status report. + 3 : All level 2 information plus file names. -q, --quiet Quiet mode. Do not produce output. --enable-error-stack @@ -109,6 +108,14 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] excluded. This option can be used repeatedly to exclude multiple paths. + --exclude-attribute "path/to/object/with/attribute" + Exclude attributes on the specified path to an object when comparing files or groups. + + If there are multiple paths to an object, only the specified path(s) + will be excluded; the comparison will include any path not explicitly + excluded. + This option can be used repeatedly to exclude multiple paths. + Modes of output: Default mode: print the number of differences found and where they occured -r Report mode: print the above plus the differences diff --git a/tools/test/h5diff/testfiles/h5diff_58_ref.txt b/tools/test/h5diff/testfiles/h5diff_58_ref.txt index 6fa2299..48a4b33 100644 --- a/tools/test/h5diff/testfiles/h5diff_58_ref.txt +++ b/tools/test/h5diff/testfiles/h5diff_58_ref.txt @@ -1,32 +1,32 @@ dataset: and size: [2] [2] -position difference +position reference2D reference2D difference ------------------------------------------------------------ [ 0 ] 1 0 1 [ 1 ] 2 0 2 size: [2] [2] -position difference +position reference2D reference2D difference ------------------------------------------------------------ [ 0 ] 1 0 1 [ 1 ] 2 0 2 size: [2] [2] -position difference +position reference2D reference2D difference ------------------------------------------------------------ [ 0 ] 1 0 1 [ 1 ] 2 0 2 size: [2] [2] -position difference +position reference2D reference2D difference ------------------------------------------------------------ [ 0 ] 1 0 1 [ 1 ] 2 0 2 size: [2] [2] -position difference +position reference2D reference2D difference ------------------------------------------------------------ [ 0 ] 1 0 1 [ 1 ] 2 0 2 size: [2] [2] -position difference +position reference2D reference2D difference ------------------------------------------------------------ [ 0 ] 1 0 1 [ 1 ] 2 0 2 diff --git a/tools/test/h5diff/testfiles/h5diff_600.txt b/tools/test/h5diff/testfiles/h5diff_600.txt index 55b8da7..f52d8cc 100644 --- a/tools/test/h5diff/testfiles/h5diff_600.txt +++ b/tools/test/h5diff/testfiles/h5diff_600.txt @@ -17,10 +17,9 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] Verbose mode with level. Print differences and list of objects. Level of detail depends on value of N: 0 : Identical to '-v' or '--verbose'. - 1 : All level 0 information plus one-line attribute - status summary. - 2 : All level 1 information plus extended attribute - status report. + 1 : All level 0 information plus one-line attribute status summary. + 2 : All level 1 information plus extended attribute status report. + 3 : All level 2 information plus file names. -q, --quiet Quiet mode. Do not produce output. --enable-error-stack @@ -109,6 +108,14 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] excluded. This option can be used repeatedly to exclude multiple paths. + --exclude-attribute "path/to/object/with/attribute" + Exclude attributes on the specified path to an object when comparing files or groups. + + If there are multiple paths to an object, only the specified path(s) + will be excluded; the comparison will include any path not explicitly + excluded. + This option can be used repeatedly to exclude multiple paths. + Modes of output: Default mode: print the number of differences found and where they occured -r Report mode: print the above plus the differences diff --git a/tools/test/h5diff/testfiles/h5diff_603.txt b/tools/test/h5diff/testfiles/h5diff_603.txt index 36cd0ef..84111b3 100644 --- a/tools/test/h5diff/testfiles/h5diff_603.txt +++ b/tools/test/h5diff/testfiles/h5diff_603.txt @@ -18,10 +18,9 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] Verbose mode with level. Print differences and list of objects. Level of detail depends on value of N: 0 : Identical to '-v' or '--verbose'. - 1 : All level 0 information plus one-line attribute - status summary. - 2 : All level 1 information plus extended attribute - status report. + 1 : All level 0 information plus one-line attribute status summary. + 2 : All level 1 information plus extended attribute status report. + 3 : All level 2 information plus file names. -q, --quiet Quiet mode. Do not produce output. --enable-error-stack @@ -110,6 +109,14 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] excluded. This option can be used repeatedly to exclude multiple paths. + --exclude-attribute "path/to/object/with/attribute" + Exclude attributes on the specified path to an object when comparing files or groups. + + If there are multiple paths to an object, only the specified path(s) + will be excluded; the comparison will include any path not explicitly + excluded. + This option can be used repeatedly to exclude multiple paths. + Modes of output: Default mode: print the number of differences found and where they occured -r Report mode: print the above plus the differences diff --git a/tools/test/h5diff/testfiles/h5diff_606.txt b/tools/test/h5diff/testfiles/h5diff_606.txt index c2e9ac1..d915d36 100644 --- a/tools/test/h5diff/testfiles/h5diff_606.txt +++ b/tools/test/h5diff/testfiles/h5diff_606.txt @@ -18,10 +18,9 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] Verbose mode with level. Print differences and list of objects. Level of detail depends on value of N: 0 : Identical to '-v' or '--verbose'. - 1 : All level 0 information plus one-line attribute - status summary. - 2 : All level 1 information plus extended attribute - status report. + 1 : All level 0 information plus one-line attribute status summary. + 2 : All level 1 information plus extended attribute status report. + 3 : All level 2 information plus file names. -q, --quiet Quiet mode. Do not produce output. --enable-error-stack @@ -110,6 +109,14 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] excluded. This option can be used repeatedly to exclude multiple paths. + --exclude-attribute "path/to/object/with/attribute" + Exclude attributes on the specified path to an object when comparing files or groups. + + If there are multiple paths to an object, only the specified path(s) + will be excluded; the comparison will include any path not explicitly + excluded. + This option can be used repeatedly to exclude multiple paths. + Modes of output: Default mode: print the number of differences found and where they occured -r Report mode: print the above plus the differences diff --git a/tools/test/h5diff/testfiles/h5diff_612.txt b/tools/test/h5diff/testfiles/h5diff_612.txt index 2e09432..1ef8cdf 100644 --- a/tools/test/h5diff/testfiles/h5diff_612.txt +++ b/tools/test/h5diff/testfiles/h5diff_612.txt @@ -18,10 +18,9 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] Verbose mode with level. Print differences and list of objects. Level of detail depends on value of N: 0 : Identical to '-v' or '--verbose'. - 1 : All level 0 information plus one-line attribute - status summary. - 2 : All level 1 information plus extended attribute - status report. + 1 : All level 0 information plus one-line attribute status summary. + 2 : All level 1 information plus extended attribute status report. + 3 : All level 2 information plus file names. -q, --quiet Quiet mode. Do not produce output. --enable-error-stack @@ -110,6 +109,14 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] excluded. This option can be used repeatedly to exclude multiple paths. + --exclude-attribute "path/to/object/with/attribute" + Exclude attributes on the specified path to an object when comparing files or groups. + + If there are multiple paths to an object, only the specified path(s) + will be excluded; the comparison will include any path not explicitly + excluded. + This option can be used repeatedly to exclude multiple paths. + Modes of output: Default mode: print the number of differences found and where they occured -r Report mode: print the above plus the differences diff --git a/tools/test/h5diff/testfiles/h5diff_615.txt b/tools/test/h5diff/testfiles/h5diff_615.txt index a07de54..881362e 100644 --- a/tools/test/h5diff/testfiles/h5diff_615.txt +++ b/tools/test/h5diff/testfiles/h5diff_615.txt @@ -18,10 +18,9 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] Verbose mode with level. Print differences and list of objects. Level of detail depends on value of N: 0 : Identical to '-v' or '--verbose'. - 1 : All level 0 information plus one-line attribute - status summary. - 2 : All level 1 information plus extended attribute - status report. + 1 : All level 0 information plus one-line attribute status summary. + 2 : All level 1 information plus extended attribute status report. + 3 : All level 2 information plus file names. -q, --quiet Quiet mode. Do not produce output. --enable-error-stack @@ -110,6 +109,14 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] excluded. This option can be used repeatedly to exclude multiple paths. + --exclude-attribute "path/to/object/with/attribute" + Exclude attributes on the specified path to an object when comparing files or groups. + + If there are multiple paths to an object, only the specified path(s) + will be excluded; the comparison will include any path not explicitly + excluded. + This option can be used repeatedly to exclude multiple paths. + Modes of output: Default mode: print the number of differences found and where they occured -r Report mode: print the above plus the differences diff --git a/tools/test/h5diff/testfiles/h5diff_621.txt b/tools/test/h5diff/testfiles/h5diff_621.txt index 5f44dd7..ba39a99 100644 --- a/tools/test/h5diff/testfiles/h5diff_621.txt +++ b/tools/test/h5diff/testfiles/h5diff_621.txt @@ -18,10 +18,9 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] Verbose mode with level. Print differences and list of objects. Level of detail depends on value of N: 0 : Identical to '-v' or '--verbose'. - 1 : All level 0 information plus one-line attribute - status summary. - 2 : All level 1 information plus extended attribute - status report. + 1 : All level 0 information plus one-line attribute status summary. + 2 : All level 1 information plus extended attribute status report. + 3 : All level 2 information plus file names. -q, --quiet Quiet mode. Do not produce output. --enable-error-stack @@ -110,6 +109,14 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] excluded. This option can be used repeatedly to exclude multiple paths. + --exclude-attribute "path/to/object/with/attribute" + Exclude attributes on the specified path to an object when comparing files or groups. + + If there are multiple paths to an object, only the specified path(s) + will be excluded; the comparison will include any path not explicitly + excluded. + This option can be used repeatedly to exclude multiple paths. + Modes of output: Default mode: print the number of differences found and where they occured -r Report mode: print the above plus the differences diff --git a/tools/test/h5diff/testfiles/h5diff_622.txt b/tools/test/h5diff/testfiles/h5diff_622.txt index 2e28a42..70421fc 100644 --- a/tools/test/h5diff/testfiles/h5diff_622.txt +++ b/tools/test/h5diff/testfiles/h5diff_622.txt @@ -18,10 +18,9 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] Verbose mode with level. Print differences and list of objects. Level of detail depends on value of N: 0 : Identical to '-v' or '--verbose'. - 1 : All level 0 information plus one-line attribute - status summary. - 2 : All level 1 information plus extended attribute - status report. + 1 : All level 0 information plus one-line attribute status summary. + 2 : All level 1 information plus extended attribute status report. + 3 : All level 2 information plus file names. -q, --quiet Quiet mode. Do not produce output. --enable-error-stack @@ -110,6 +109,14 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] excluded. This option can be used repeatedly to exclude multiple paths. + --exclude-attribute "path/to/object/with/attribute" + Exclude attributes on the specified path to an object when comparing files or groups. + + If there are multiple paths to an object, only the specified path(s) + will be excluded; the comparison will include any path not explicitly + excluded. + This option can be used repeatedly to exclude multiple paths. + Modes of output: Default mode: print the number of differences found and where they occured -r Report mode: print the above plus the differences diff --git a/tools/test/h5diff/testfiles/h5diff_623.txt b/tools/test/h5diff/testfiles/h5diff_623.txt index 21cb90a..0d74268 100644 --- a/tools/test/h5diff/testfiles/h5diff_623.txt +++ b/tools/test/h5diff/testfiles/h5diff_623.txt @@ -18,10 +18,9 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] Verbose mode with level. Print differences and list of objects. Level of detail depends on value of N: 0 : Identical to '-v' or '--verbose'. - 1 : All level 0 information plus one-line attribute - status summary. - 2 : All level 1 information plus extended attribute - status report. + 1 : All level 0 information plus one-line attribute status summary. + 2 : All level 1 information plus extended attribute status report. + 3 : All level 2 information plus file names. -q, --quiet Quiet mode. Do not produce output. --enable-error-stack @@ -110,6 +109,14 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] excluded. This option can be used repeatedly to exclude multiple paths. + --exclude-attribute "path/to/object/with/attribute" + Exclude attributes on the specified path to an object when comparing files or groups. + + If there are multiple paths to an object, only the specified path(s) + will be excluded; the comparison will include any path not explicitly + excluded. + This option can be used repeatedly to exclude multiple paths. + Modes of output: Default mode: print the number of differences found and where they occured -r Report mode: print the above plus the differences diff --git a/tools/test/h5diff/testfiles/h5diff_624.txt b/tools/test/h5diff/testfiles/h5diff_624.txt index 92c98d9..cb8b8b4 100644 --- a/tools/test/h5diff/testfiles/h5diff_624.txt +++ b/tools/test/h5diff/testfiles/h5diff_624.txt @@ -18,10 +18,9 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] Verbose mode with level. Print differences and list of objects. Level of detail depends on value of N: 0 : Identical to '-v' or '--verbose'. - 1 : All level 0 information plus one-line attribute - status summary. - 2 : All level 1 information plus extended attribute - status report. + 1 : All level 0 information plus one-line attribute status summary. + 2 : All level 1 information plus extended attribute status report. + 3 : All level 2 information plus file names. -q, --quiet Quiet mode. Do not produce output. --enable-error-stack @@ -110,6 +109,14 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] excluded. This option can be used repeatedly to exclude multiple paths. + --exclude-attribute "path/to/object/with/attribute" + Exclude attributes on the specified path to an object when comparing files or groups. + + If there are multiple paths to an object, only the specified path(s) + will be excluded; the comparison will include any path not explicitly + excluded. + This option can be used repeatedly to exclude multiple paths. + Modes of output: Default mode: print the number of differences found and where they occured -r Report mode: print the above plus the differences diff --git a/tools/test/h5diff/testfiles/h5diff_70.txt b/tools/test/h5diff/testfiles/h5diff_70.txt index efa34ea..b0b8bf6 100644 --- a/tools/test/h5diff/testfiles/h5diff_70.txt +++ b/tools/test/h5diff/testfiles/h5diff_70.txt @@ -1183,10 +1183,42 @@ position opaque3D of opaque3D of difference [ 3 2 1 ] 24 0 24 24 differences found attribute: > and > +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset 0 differences found attribute: > and > +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset 0 differences found attribute: > and > +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset 0 differences found attribute: > and > size: [2] [2] diff --git a/tools/test/h5diff/testfiles/h5diff_700.txt b/tools/test/h5diff/testfiles/h5diff_700.txt index 851a407..6cf9893 100644 --- a/tools/test/h5diff/testfiles/h5diff_700.txt +++ b/tools/test/h5diff/testfiles/h5diff_700.txt @@ -1187,10 +1187,42 @@ position opaque3D of opaque3D of difference [ 3 2 1 ] 24 0 24 24 differences found attribute: > and > +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset 0 differences found attribute: > and > +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset 0 differences found attribute: > and > +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset 0 differences found attribute: > and > size: [2] [2] diff --git a/tools/test/h5diff/testfiles/h5diff_701.txt b/tools/test/h5diff/testfiles/h5diff_701.txt index 33f1a0f..4187754 100644 --- a/tools/test/h5diff/testfiles/h5diff_701.txt +++ b/tools/test/h5diff/testfiles/h5diff_701.txt @@ -1254,10 +1254,42 @@ position opaque3D of opaque3D of difference [ 3 2 1 ] 24 0 24 24 differences found attribute: > and > +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset 0 differences found attribute: > and > +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset 0 differences found attribute: > and > +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset 0 differences found attribute: > and > size: [2] [2] diff --git a/tools/test/h5diff/testfiles/h5diff_702.txt b/tools/test/h5diff/testfiles/h5diff_702.txt index 851a407..6cf9893 100644 --- a/tools/test/h5diff/testfiles/h5diff_702.txt +++ b/tools/test/h5diff/testfiles/h5diff_702.txt @@ -1187,10 +1187,42 @@ position opaque3D of opaque3D of difference [ 3 2 1 ] 24 0 24 24 differences found attribute: > and > +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset 0 differences found attribute: > and > +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset 0 differences found attribute: > and > +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset 0 differences found attribute: > and > size: [2] [2] diff --git a/tools/test/h5diff/testfiles/h5diff_703.txt b/tools/test/h5diff/testfiles/h5diff_703.txt index 33f1a0f..4187754 100644 --- a/tools/test/h5diff/testfiles/h5diff_703.txt +++ b/tools/test/h5diff/testfiles/h5diff_703.txt @@ -1254,10 +1254,42 @@ position opaque3D of opaque3D of difference [ 3 2 1 ] 24 0 24 24 differences found attribute: > and > +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset 0 differences found attribute: > and > +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset 0 differences found attribute: > and > +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset +Not comparable: > or > is an empty dataset 0 differences found attribute: > and > size: [2] [2] diff --git a/tools/test/h5diff/testfiles/h5diff_80.txt b/tools/test/h5diff/testfiles/h5diff_80.txt index b223eed..11dccd8 100644 --- a/tools/test/h5diff/testfiles/h5diff_80.txt +++ b/tools/test/h5diff/testfiles/h5diff_80.txt @@ -528,166 +528,166 @@ position opaque3D opaque3D difference 24 differences found dataset: and size: [2] [2] -position difference +position reference reference difference ------------------------------------------------------------ [ 0 ] 1 0 1 [ 1 ] 2 0 2 size: [2] [2] -position difference +position reference reference difference ------------------------------------------------------------ [ 0 ] 1 0 1 [ 1 ] 2 0 2 4 differences found dataset: and size: [2] [2] -position difference +position reference2D reference2D difference ------------------------------------------------------------ [ 0 ] 1 0 1 [ 1 ] 2 0 2 size: [2] [2] -position difference +position reference2D reference2D difference ------------------------------------------------------------ [ 0 ] 1 0 1 [ 1 ] 2 0 2 size: [2] [2] -position difference +position reference2D reference2D difference ------------------------------------------------------------ [ 0 ] 1 0 1 [ 1 ] 2 0 2 size: [2] [2] -position difference +position reference2D reference2D difference ------------------------------------------------------------ [ 0 ] 1 0 1 [ 1 ] 2 0 2 size: [2] [2] -position difference +position reference2D reference2D difference ------------------------------------------------------------ [ 0 ] 1 0 1 [ 1 ] 2 0 2 size: [2] [2] -position difference +position reference2D reference2D difference ------------------------------------------------------------ [ 0 ] 1 0 1 [ 1 ] 2 0 2 12 differences found dataset: and size: [2] [2] -position difference +position reference3D reference3D difference ------------------------------------------------------------ [ 0 ] 1 0 1 [ 1 ] 2 0 2 size: [2] [2] -position difference +position reference3D reference3D difference ------------------------------------------------------------ [ 0 ] 1 0 1 [ 1 ] 2 0 2 size: [2] [2] -position difference +position reference3D reference3D difference ------------------------------------------------------------ [ 0 ] 1 0 1 [ 1 ] 2 0 2 size: [2] [2] -position difference +position reference3D reference3D difference ------------------------------------------------------------ [ 0 ] 1 0 1 [ 1 ] 2 0 2 size: [2] [2] -position difference +position reference3D reference3D difference ------------------------------------------------------------ [ 0 ] 1 0 1 [ 1 ] 2 0 2 size: [2] [2] -position difference +position reference3D reference3D difference ------------------------------------------------------------ [ 0 ] 1 0 1 [ 1 ] 2 0 2 size: [2] [2] -position difference +position reference3D reference3D difference ------------------------------------------------------------ [ 0 ] 1 0 1 [ 1 ] 2 0 2 size: [2] [2] -position difference +position reference3D reference3D difference ------------------------------------------------------------ [ 0 ] 1 0 1 [ 1 ] 2 0 2 size: [2] [2] -position difference +position reference3D reference3D difference ------------------------------------------------------------ [ 0 ] 1 0 1 [ 1 ] 2 0 2 size: [2] [2] -position difference +position reference3D reference3D difference ------------------------------------------------------------ [ 0 ] 1 0 1 [ 1 ] 2 0 2 size: [2] [2] -position difference +position reference3D reference3D difference ------------------------------------------------------------ [ 0 ] 1 0 1 [ 1 ] 2 0 2 size: [2] [2] -position difference +position reference3D reference3D difference ------------------------------------------------------------ [ 0 ] 1 0 1 [ 1 ] 2 0 2 size: [2] [2] -position difference +position reference3D reference3D difference ------------------------------------------------------------ [ 0 ] 1 0 1 [ 1 ] 2 0 2 size: [2] [2] -position difference +position reference3D reference3D difference ------------------------------------------------------------ [ 0 ] 1 0 1 [ 1 ] 2 0 2 size: [2] [2] -position difference +position reference3D reference3D difference ------------------------------------------------------------ [ 0 ] 1 0 1 [ 1 ] 2 0 2 size: [2] [2] -position difference +position reference3D reference3D difference ------------------------------------------------------------ [ 0 ] 1 0 1 [ 1 ] 2 0 2 size: [2] [2] -position difference +position reference3D reference3D difference ------------------------------------------------------------ [ 0 ] 1 0 1 [ 1 ] 2 0 2 size: [2] [2] -position difference +position reference3D reference3D difference ------------------------------------------------------------ [ 0 ] 1 0 1 [ 1 ] 2 0 2 size: [2] [2] -position difference +position reference3D reference3D difference ------------------------------------------------------------ [ 0 ] 1 0 1 [ 1 ] 2 0 2 size: [2] [2] -position difference +position reference3D reference3D difference ------------------------------------------------------------ [ 0 ] 1 0 1 [ 1 ] 2 0 2 size: [2] [2] -position difference +position reference3D reference3D difference ------------------------------------------------------------ [ 0 ] 1 0 1 [ 1 ] 2 0 2 size: [2] [2] -position difference +position reference3D reference3D difference ------------------------------------------------------------ [ 0 ] 1 0 1 [ 1 ] 2 0 2 size: [2] [2] -position difference +position reference3D reference3D difference ------------------------------------------------------------ [ 0 ] 1 0 1 [ 1 ] 2 0 2 size: [2] [2] -position difference +position reference3D reference3D difference ------------------------------------------------------------ [ 0 ] 1 0 1 [ 1 ] 2 0 2 diff --git a/tools/test/h5diff/testfiles/h5diff_830.txt b/tools/test/h5diff/testfiles/h5diff_830.txt new file mode 100644 index 0000000..8f00d8b --- /dev/null +++ b/tools/test/h5diff/testfiles/h5diff_830.txt @@ -0,0 +1,30 @@ +dataset: and +size: [4x3x2] [4x3x2] +position array3D array3D difference +------------------------------------------------------------ +[ 0 0 0 ] 1 0 1 +[ 0 0 0 ] 2 0 2 +[ 0 0 0 ] 3 0 3 +[ 0 0 1 ] 4 0 4 +[ 0 0 1 ] 5 0 5 +[ 0 0 1 ] 6 0 6 +[ 0 2 0 ] 13 0 13 +[ 0 2 0 ] 14 0 14 +[ 0 2 0 ] 15 0 15 +[ 0 2 1 ] 16 0 16 +[ 0 2 1 ] 17 0 17 +[ 0 2 1 ] 18 0 18 +[ 2 0 0 ] 37 0 37 +[ 2 0 0 ] 38 0 38 +[ 2 0 0 ] 39 0 39 +[ 2 0 1 ] 40 0 40 +[ 2 0 1 ] 41 0 41 +[ 2 0 1 ] 42 0 42 +[ 2 2 0 ] 49 0 49 +[ 2 2 0 ] 50 0 50 +[ 2 2 0 ] 51 0 51 +[ 2 2 1 ] 52 0 52 +[ 2 2 1 ] 53 0 53 +[ 2 2 1 ] 54 0 54 +24 differences found +EXIT CODE: 1 diff --git a/tools/test/h5diff/testfiles/h5diff_eps.txt b/tools/test/h5diff/testfiles/h5diff_eps.txt new file mode 100644 index 0000000..3a71366 --- /dev/null +++ b/tools/test/h5diff/testfiles/h5diff_eps.txt @@ -0,0 +1,17 @@ +file1: h5diff_eps1.h5 +file2: h5diff_eps2.h5 + +file1 file2 +--------------------------------------- + x x / + x x /DS1 + + +group : and +0 differences found +Attributes status: 0 common, 0 only in obj1, 0 only in obj2 + +dataset: and +0 differences found +Attributes status: 0 common, 0 only in obj1, 0 only in obj2 +EXIT CODE: 0 diff --git a/tools/test/h5diff/testfiles/h5diff_eps1.h5 b/tools/test/h5diff/testfiles/h5diff_eps1.h5 new file mode 100644 index 0000000..2803a1d Binary files /dev/null and b/tools/test/h5diff/testfiles/h5diff_eps1.h5 differ diff --git a/tools/test/h5diff/testfiles/h5diff_eps2.h5 b/tools/test/h5diff/testfiles/h5diff_eps2.h5 new file mode 100644 index 0000000..4acf27a Binary files /dev/null and b/tools/test/h5diff/testfiles/h5diff_eps2.h5 differ diff --git a/tools/test/h5diff/testfiles/h5diff_reg.txt b/tools/test/h5diff/testfiles/h5diff_reg.txt index d4f5415..ecb6275 100644 --- a/tools/test/h5diff/testfiles/h5diff_reg.txt +++ b/tools/test/h5diff/testfiles/h5diff_reg.txt @@ -1,12 +1,11 @@ dataset: and -attribute: > and > +attribute: > and > 0 differences found -Warning: Cannot open referenced attribute: attribute 1 -Warning: Cannot open referenced attribute: attribute 2 -attribute: > and > +Warning: Cannot open referenced attribute1 +attribute: > and > 0 differences found -attribute: > and > +attribute: > and > 0 differences found 0 differences found obj1 obj2 diff --git a/tools/test/h5diff/testfiles/h5diff_strings1.h5 b/tools/test/h5diff/testfiles/h5diff_strings1.h5 new file mode 100644 index 0000000..0f8b380 Binary files /dev/null and b/tools/test/h5diff/testfiles/h5diff_strings1.h5 differ diff --git a/tools/test/h5diff/testfiles/h5diff_strings2.h5 b/tools/test/h5diff/testfiles/h5diff_strings2.h5 new file mode 100644 index 0000000..e8520ae Binary files /dev/null and b/tools/test/h5diff/testfiles/h5diff_strings2.h5 differ diff --git a/tools/test/h5diff/testh5diff.sh.in b/tools/test/h5diff/testh5diff.sh.in index 2d490a8..587c340 100644 --- a/tools/test/h5diff/testh5diff.sh.in +++ b/tools/test/h5diff/testh5diff.sh.in @@ -85,6 +85,7 @@ $SRC_H5DIFF_TESTFILES/h5diff_attr2.h5 $SRC_H5DIFF_TESTFILES/h5diff_attr3.h5 $SRC_H5DIFF_TESTFILES/h5diff_dset1.h5 $SRC_H5DIFF_TESTFILES/h5diff_dset2.h5 +$SRC_H5DIFF_TESTFILES/h5diff_dset3.h5 $SRC_H5DIFF_TESTFILES/h5diff_hyper1.h5 $SRC_H5DIFF_TESTFILES/h5diff_hyper2.h5 $SRC_H5DIFF_TESTFILES/h5diff_empty.h5 @@ -119,8 +120,10 @@ $SRC_H5DIFF_TESTFILES/h5diff_attr_v_level2.h5 $SRC_H5DIFF_TESTFILES/h5diff_enum_invalid_values.h5 $SRC_H5DIFF_TESTFILES/non_comparables1.h5 $SRC_H5DIFF_TESTFILES/non_comparables2.h5 -$SRC_H5DIFF_TESTFILES/diff_strings1.h5 -$SRC_H5DIFF_TESTFILES/diff_strings2.h5 +$SRC_H5DIFF_TESTFILES/h5diff_strings1.h5 +$SRC_H5DIFF_TESTFILES/h5diff_strings2.h5 +$SRC_H5DIFF_TESTFILES/h5diff_eps1.h5 +$SRC_H5DIFF_TESTFILES/h5diff_eps2.h5 $SRC_TOOLS_TESTFILES/tvlstr.h5 " @@ -349,6 +352,9 @@ $SRC_H5DIFF_TESTFILES/h5diff_708.txt $SRC_H5DIFF_TESTFILES/h5diff_709.txt $SRC_H5DIFF_TESTFILES/h5diff_710.txt $SRC_H5DIFF_TESTFILES/h5diff_80.txt +$SRC_H5DIFF_TESTFILES/h5diff_800.txt +$SRC_H5DIFF_TESTFILES/h5diff_801.txt +$SRC_H5DIFF_TESTFILES/h5diff_830.txt $SRC_H5DIFF_TESTFILES/h5diff_90.txt $SRC_H5DIFF_TESTFILES/h5diff_8625.txt $SRC_H5DIFF_TESTFILES/h5diff_8639.txt @@ -357,6 +363,7 @@ $SRC_H5DIFF_TESTFILES/h5diff_v1.txt $SRC_H5DIFF_TESTFILES/h5diff_v2.txt $SRC_H5DIFF_TESTFILES/h5diff_v3.txt $SRC_H5DIFF_TESTFILES/h5diff_vlstr.txt +$SRC_H5DIFF_TESTFILES/h5diff_eps.txt " # @@ -494,18 +501,20 @@ TOOLTEST() { # Run test. TESTING $H5DIFF $@ ( - #echo "#############################" - #echo "Expected output for '$H5DIFF $@'" - #echo "#############################" - cd $TESTDIR - eval $RUNCMD $H5DIFF_BIN "$@" + #echo "#############################" + #echo "Expected output for '$H5DIFF $@'" + #echo "#############################" + cd $TESTDIR + eval $RUNCMD $H5DIFF_BIN "$@" ) >$actual 2>$actual_err EXIT_CODE=$? + # save actual and actual_err in case they are needed later. cp $actual $actual_sav STDOUT_FILTER $actual cp $actual_err $actual_err_sav STDERR_FILTER $actual_err + # don't add exit code check in pmode, as it causes failure. (exit code # is from mpirun not tool) # if any problem occurs relate to an exit code, it will be caught in @@ -539,23 +548,24 @@ TOOLTEST() { # is done by serial mode. grep -v "EXIT CODE:" $expect_sorted > $expect_sorted.noexit mv $expect_sorted.noexit $expect_sorted - if $CMP $expect_sorted $actual_sorted; then - echo " PASSED" - else - echo "*FAILED*" - nerrors="`expr $nerrors + 1`" - if test yes = "$verbose"; then - echo "====Expected result ($expect_sorted) differs from actual result ($actual_sorted)" - $DIFF $expect_sorted $actual_sorted |sed 's/^/ /' - echo "====The actual output ($actual_sav)" - sed 's/^/ /' < $actual_sav - echo "====The actual stderr ($actual_err_sav)" - sed 's/^/ /' < $actual_err_sav - echo "====End of actual stderr ($actual_err_sav)" - echo "" + + if $CMP $expect_sorted $actual_sorted; then + echo " PASSED" + else + echo "*FAILED*" + nerrors="`expr $nerrors + 1`" + if test yes = "$verbose"; then + echo "====Expected result ($expect_sorted) differs from actual result ($actual_sorted)" + $DIFF $expect_sorted $actual_sorted |sed 's/^/ /' + echo "====The actual output ($actual_sav)" + sed 's/^/ /' < $actual_sav + echo "====The actual stderr ($actual_err_sav)" + sed 's/^/ /' < $actual_err_sav + echo "====End of actual stderr ($actual_err_sav)" + echo "" + fi fi fi - fi # Clean up output file if test -z "$HDF5_NOCLEANUP"; then @@ -717,10 +727,10 @@ TOOLTEST h5diff_59.txt -v h5diff_dtypes.h5 h5diff_dtypes.h5 dset11a dset11b # Strings # ( HDFFV-10128 ) -TOOLTEST h5diff_60.txt -v diff_strings1.h5 diff_strings2.h5 string1 string1 -TOOLTEST h5diff_61.txt -v diff_strings1.h5 diff_strings2.h5 string2 string2 -TOOLTEST h5diff_62.txt -v diff_strings1.h5 diff_strings2.h5 string3 string3 -TOOLTEST h5diff_63.txt -v diff_strings1.h5 diff_strings2.h5 string4 string4 +TOOLTEST h5diff_60.txt -v h5diff_strings1.h5 h5diff_strings2.h5 string1 string1 +TOOLTEST h5diff_61.txt -v h5diff_strings1.h5 h5diff_strings2.h5 string2 string2 +TOOLTEST h5diff_62.txt -v h5diff_strings1.h5 h5diff_strings2.h5 string3 string3 +TOOLTEST h5diff_63.txt -v h5diff_strings1.h5 h5diff_strings2.h5 string4 string4 # ############################################################################## # # Error messages @@ -763,6 +773,9 @@ TOOLTEST h5diff_609.txt -d 200 h5diff_basic1.h5 h5diff_basic2.h5 g1/dset3 g1/dse # 6.10: number smaller than smallest difference TOOLTEST h5diff_610.txt -d 1 h5diff_basic1.h5 h5diff_basic2.h5 g1/dset3 g1/dset4 +# eps: number smaller than epsilon +TOOLTEST h5diff_eps.txt -v3 -d 1e-16 h5diff_eps1.h5 h5diff_eps2.h5 + # ############################################################################## # # -p @@ -1184,6 +1197,17 @@ TOOLTEST h5diff_645.txt -v -p 0.05 --use-system-epsilon h5diff_basic1.h5 h5diff_ TOOLTEST h5diff_646.txt -v --use-system-epsilon -p 0.05 h5diff_basic1.h5 h5diff_basic2.h5 /g1/dset3 /g1/dset4 # ############################################################################## +# # Test array variances +# ############################################################################## +TOOLTEST h5diff_800.txt -v h5diff_dset1.h5 h5diff_dset2.h5 /g1/array /g1/array +TOOLTEST h5diff_801.txt -v h5diff_dset1.h5 h5diff_dset3.h5 /g1/array /g1/array + +# ############################################################################## +# # dataset subsets +# ############################################################################## +#TRILABS-227 TOOLTEST h5diff_830.txt --enable-error-stack -v h5diff_dset1.h5 h5diff_dset2.h5 /g1/array3D[0,0,0;2,2,1;2,2,2;] /g1/array3D[0,0,0;2,2,1;2,2,2;] + +# ############################################################################## # VDS tests # ############################################################################## TOOLTEST h5diff_v1.txt -v 1_vds.h5 2_vds.h5 diff --git a/tools/test/h5dump/h5dump_plugin.sh.in b/tools/test/h5dump/h5dump_plugin.sh.in index 6a00a16..d940ab3 100644 --- a/tools/test/h5dump/h5dump_plugin.sh.in +++ b/tools/test/h5dump/h5dump_plugin.sh.in @@ -181,8 +181,8 @@ TOOLTEST() { # Run test. TESTING $H5DUMP $@ ( - cd $TESTDIR - $ENVCMD $RUNSERIAL $H5DUMP_BIN "$@" + cd $TESTDIR + $ENVCMD $RUNSERIAL $H5DUMP_BIN "$@" ) >$actual 2>$actual_err # save actual and actual_err in case they are needed later. @@ -192,24 +192,24 @@ TOOLTEST() { STDERR_FILTER $actual_err cat $actual_err >> $actual - if [ ! -f $expect ]; then - # Create the expect file if it doesn't yet exist. - echo " CREATED" - cp $actual $expect - echo " Expected result (*.ddl) missing" - nerrors="`expr $nerrors + 1`" + if [ ! -f $expect ]; then + # Create the expect file if it doesn't yet exist. + echo " CREATED" + cp $actual $expect + echo " Expected result (*.ddl) missing" + nerrors="`expr $nerrors + 1`" elif $CMP $expect $actual > /dev/null 2>&1 ; then - echo " PASSED" + echo " PASSED" else - echo "*FAILED*" - echo " Expected result (*.ddl) differs from actual result (*.out)" - nerrors="`expr $nerrors + 1`" - test yes = "$verbose" && $DIFF $caseless $expect $actual |sed 's/^/ /' + echo "*FAILED*" + echo " Expected result (*.ddl) differs from actual result (*.out)" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF $caseless $expect $actual |sed 's/^/ /' fi # Clean up output file if test -z "$HDF5_NOCLEANUP"; then - rm -f $actual $actual_err $actual_sav $actual_err_sav $actual_ext + rm -f $actual $actual_err $actual_sav $actual_err_sav $actual_ext fi } diff --git a/tools/test/h5dump/h5dumpgentest.c b/tools/test/h5dump/h5dumpgentest.c index 731e233..3bb6604 100644 --- a/tools/test/h5dump/h5dumpgentest.c +++ b/tools/test/h5dump/h5dumpgentest.c @@ -3964,7 +3964,7 @@ static void gent_char(void) * * Return: void * - * Programmer: pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: May 28, 2003 * @@ -4404,7 +4404,7 @@ static void write_attr_in(hid_t loc_id, * * Return: void * - * Programmer: pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: May 28, 2003 * @@ -4854,7 +4854,7 @@ static void write_dset_in(hid_t loc_id, * * Return: void * - * Programmer: pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: May 19, 2003 * @@ -4923,7 +4923,7 @@ static void gent_attr_all(void) * * Purpose: utility function to write an attribute * - * Programmer: pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: May 19, 2003 * @@ -4962,7 +4962,7 @@ int write_attr(hid_t loc_id, int rank, hsize_t *dims, const char *attr_name, * * Return: * - * Programmer: pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: May 27, 2003 * diff --git a/tools/test/h5dump/testh5dump.sh.in b/tools/test/h5dump/testh5dump.sh.in index 53c8927..b69346e 100644 --- a/tools/test/h5dump/testh5dump.sh.in +++ b/tools/test/h5dump/testh5dump.sh.in @@ -465,14 +465,14 @@ TESTING() { TOOLTEST() { # check if caseless compare and diff requested if [ "$1" = ignorecase ]; then - caseless="-i" - # replace cmp with diff which runs much longer. - xCMP="$DIFF -i" - shift + caseless="-i" + # replace cmp with diff which runs much longer. + xCMP="$DIFF -i" + shift else - caseless="" - # stick with faster cmp if ignorecase is not requested. - xCMP="$CMP" + caseless="" + # stick with faster cmp if ignorecase is not requested. + xCMP="$CMP" fi expect="$TESTDIR/$1" @@ -485,8 +485,8 @@ TOOLTEST() { # Run test. TESTING $DUMPER $@ ( - cd $TESTDIR - $RUNSERIAL $DUMPER_BIN "$@" + cd $TESTDIR + $RUNSERIAL $DUMPER_BIN "$@" ) >$actual 2>$actual_err # save actual and actual_err in case they are needed later. @@ -495,24 +495,24 @@ TOOLTEST() { cp $actual_err $actual_err_sav STDERR_FILTER $actual_err - if [ ! -f $expect ]; then - # Create the expect file if it doesn't yet exist. - echo " CREATED" - cp $actual $expect - echo " Expected result (*.ddl) missing" - nerrors="`expr $nerrors + 1`" + if [ ! -f $expect ]; then + # Create the expect file if it doesn't yet exist. + echo " CREATED" + cp $actual $expect + echo " Expected result (*.ddl) missing" + nerrors="`expr $nerrors + 1`" elif $xCMP $expect $actual > /dev/null 2>&1 ; then - echo " PASSED" + echo " PASSED" else - echo "*FAILED*" - echo " Expected result (*.ddl) differs from actual result (*.out)" - nerrors="`expr $nerrors + 1`" - test yes = "$verbose" && $DIFF $caseless $expect $actual |sed 's/^/ /' + echo "*FAILED*" + echo " Expected result (*.ddl) differs from actual result (*.out)" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF $caseless $expect $actual |sed 's/^/ /' fi # Clean up output file if test -z "$HDF5_NOCLEANUP"; then - rm -f $actual $actual_err $actual_sav $actual_err_sav $actual_ext + rm -f $actual $actual_err $actual_sav $actual_err_sav $actual_ext fi } @@ -534,41 +534,41 @@ TOOLTEST2() { # Run test. TESTING $DUMPER $@ ( - cd $TESTDIR - $RUNSERIAL $DUMPER_BIN "$@" + cd $TESTDIR + $RUNSERIAL $DUMPER_BIN "$@" ) >$actual 2>$actual_err if [ ! -f $expect ]; then - # Create the expect file if it doesn't yet exist. - echo " CREATED" - cp $actual $expect - echo " Expected result (*.ddl) missing" - nerrors="`expr $nerrors + 1`" - elif $CMP $expect $actual; then - if [ ! -f $expectdata ]; then - # Create the expect data file if it doesn't yet exist. + # Create the expect file if it doesn't yet exist. echo " CREATED" - cp $actualdata $expectdata - echo " Expected data (*.exp) missing" + cp $actual $expect + echo " Expected result (*.ddl) missing" nerrors="`expr $nerrors + 1`" - elif $CMP $expectdata $actualdata; then - echo " PASSED" - else + elif $CMP $expect $actual; then + if [ ! -f $expectdata ]; then + # Create the expect data file if it doesn't yet exist. + echo " CREATED" + cp $actualdata $expectdata + echo " Expected data (*.exp) missing" + nerrors="`expr $nerrors + 1`" + elif $CMP $expectdata $actualdata; then + echo " PASSED" + else + echo "*FAILED*" + echo " Expected datafile (*.exp) differs from actual datafile (*.txt)" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF $expectdata $actualdata |sed 's/^/ /' + fi + else echo "*FAILED*" - echo " Expected datafile (*.exp) differs from actual datafile (*.txt)" + echo " Expected result (*.ddl) differs from actual result (*.out)" nerrors="`expr $nerrors + 1`" - test yes = "$verbose" && $DIFF $expectdata $actualdata |sed 's/^/ /' - fi - else - echo "*FAILED*" - echo " Expected result (*.ddl) differs from actual result (*.out)" - nerrors="`expr $nerrors + 1`" - test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /' + test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /' fi # Clean up output file if test -z "$HDF5_NOCLEANUP"; then - rm -f $actual $actualdata $actual_err + rm -f $actual $actualdata $actual_err fi } @@ -592,56 +592,55 @@ TOOLTEST2A() { # Run test. TESTING $DUMPER $@ ( - cd $TESTDIR - $RUNSERIAL $DUMPER_BIN "$@" + cd $TESTDIR + $RUNSERIAL $DUMPER_BIN "$@" ) >$actual 2>$actual_err if [ ! -f $expect ]; then - # Create the expect file if it doesn't yet exist. - echo " CREATED" - cp $actual $expect - echo " Expected result (*.ddl) missing" - nerrors="`expr $nerrors + 1`" - elif $CMP $expect $actual; then - if [ ! -f $expectdata ]; then - # Create the expect data file if it doesn't yet exist. + # Create the expect file if it doesn't yet exist. echo " CREATED" - cp $actualdata $expectdata - echo " Expected data (*.exp) missing" + cp $actual $expect + echo " Expected result (*.ddl) missing" nerrors="`expr $nerrors + 1`" - elif $DIFF $expectdata $actualdata; then - if [ ! -f $expectmeta ]; then - # Create the expect meta file if it doesn't yet exist. - echo " CREATED" - cp $actualmeta $expectmeta - echo " Expected metafile (*.ddl) missing" - nerrors="`expr $nerrors + 1`" - elif $CMP $expectmeta $actualmeta; then - echo " PASSED" + elif $CMP $expect $actual; then + if [ ! -f $expectdata ]; then + # Create the expect data file if it doesn't yet exist. + echo " CREATED" + cp $actualdata $expectdata + echo " Expected data (*.exp) missing" + nerrors="`expr $nerrors + 1`" + elif $DIFF $expectdata $actualdata; then + if [ ! -f $expectmeta ]; then + # Create the expect meta file if it doesn't yet exist. + echo " CREATED" + cp $actualmeta $expectmeta + echo " Expected metafile (*.ddl) missing" + nerrors="`expr $nerrors + 1`" + elif $CMP $expectmeta $actualmeta; then + echo " PASSED" + else + echo "*FAILED*" + echo " Expected metafile (*.ddl) differs from actual metafile (*.txt)" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF $expectmeta $actualmeta |sed 's/^/ /' + fi else - echo "*FAILED*" - echo " Expected metafile (*.ddl) differs from actual metafile (*.txt)" - nerrors="`expr $nerrors + 1`" - test yes = "$verbose" && $DIFF $expectmeta $actualmeta |sed 's/^/ /' + echo "*FAILED*" + echo " Expected datafile (*.exp) differs from actual datafile (*.txt)" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF $expectdata $actualdata |sed 's/^/ /' fi - else + else echo "*FAILED*" - echo " Expected datafile (*.exp) differs from actual datafile (*.txt)" + echo " Expected result (*.ddl) differs from actual result (*.out)" nerrors="`expr $nerrors + 1`" - test yes = "$verbose" && $DIFF $expectdata $actualdata |sed 's/^/ /' - fi - else - echo "*FAILED*" - echo " Expected result (*.ddl) differs from actual result (*.out)" - nerrors="`expr $nerrors + 1`" - test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /' + test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /' fi # Clean up output file if test -z "$HDF5_NOCLEANUP"; then - rm -f $actual $actualdata $actual_err $actualmeta + rm -f $actual $actualdata $actual_err $actualmeta fi - } # same as TOOLTEST2 but only compares the generated data file to the expected data file @@ -658,28 +657,28 @@ TOOLTEST2B() { # Run test. TESTING $DUMPER $@ ( - cd $TESTDIR - $RUNSERIAL $DUMPER_BIN "$@" + cd $TESTDIR + $RUNSERIAL $DUMPER_BIN "$@" ) >$actual 2>$actual_err if [ ! -f $expectdata ]; then - # Create the expect data file if it doesn't yet exist. - echo " CREATED" - cp $actualdata $expectdata - echo " Expected data (*.exp) missing" - nerrors="`expr $nerrors + 1`" + # Create the expect data file if it doesn't yet exist. + echo " CREATED" + cp $actualdata $expectdata + echo " Expected data (*.exp) missing" + nerrors="`expr $nerrors + 1`" elif $CMP $expectdata $actualdata; then - echo " PASSED" + echo " PASSED" else - echo "*FAILED*" - echo " Expected datafile (*.exp) differs from actual datafile (*.txt)" - nerrors="`expr $nerrors + 1`" - test yes = "$verbose" && $DIFF $expectdata $actualdata |sed 's/^/ /' + echo "*FAILED*" + echo " Expected datafile (*.exp) differs from actual datafile (*.txt)" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF $expectdata $actualdata |sed 's/^/ /' fi # Clean up output file if test -z "$HDF5_NOCLEANUP"; then - rm -f $actual $actualdata $actual_err + rm -f $actual $actualdata $actual_err fi } @@ -699,8 +698,8 @@ TOOLTEST3() { # Run test. TESTING $DUMPER $@ ( - cd $TESTDIR - $RUNSERIAL $DUMPER_BIN "$@" + cd $TESTDIR + $RUNSERIAL $DUMPER_BIN "$@" ) >$actual 2>$actual_err # save actual and actual_err in case they are needed later. @@ -719,23 +718,23 @@ TOOLTEST3() { $actual_err > $actual_ext if [ ! -f $expect ]; then - # Create the expect file if it doesn't yet exist. - echo " CREATED" - cp $actual $expect - echo " Expected result (*.ddl) missing" - nerrors="`expr $nerrors + 1`" + # Create the expect file if it doesn't yet exist. + echo " CREATED" + cp $actual $expect + echo " Expected result (*.ddl) missing" + nerrors="`expr $nerrors + 1`" elif $CMP $expect $actual; then - echo " PASSED" + echo " PASSED" else - echo "*FAILED*" - echo " Expected result (*.ddl) differs from actual result (*.out)" - nerrors="`expr $nerrors + 1`" - test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /' + echo "*FAILED*" + echo " Expected result (*.ddl) differs from actual result (*.out)" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /' fi # Clean up output file if test -z "$HDF5_NOCLEANUP"; then - rm -f $actual $actual_err $actual_sav $actual_err_sav + rm -f $actual $actual_err $actual_sav $actual_err_sav fi } @@ -757,8 +756,8 @@ TOOLTEST4() { # Run test. TESTING $DUMPER $@ ( - cd $TESTDIR - $ENVCMD $RUNSERIAL $DUMPER_BIN "$@" + cd $TESTDIR + $ENVCMD $RUNSERIAL $DUMPER_BIN "$@" ) >$actual 2>$actual_err # save actual and actual_err in case they are needed later. @@ -777,30 +776,30 @@ TOOLTEST4() { $actual_err > $actual_ext if [ ! -f $expect ]; then - # Create the expect file if it doesn't yet exist. - echo " CREATED" - cp $actual $expect - echo " Expected result (*.ddl) missing" - nerrors="`expr $nerrors + 1`" + # Create the expect file if it doesn't yet exist. + echo " CREATED" + cp $actual $expect + echo " Expected result (*.ddl) missing" + nerrors="`expr $nerrors + 1`" elif $CMP $expect $actual; then - if $CMP $expect_err $actual_ext; then - echo " PASSED" - else - echo "*FAILED*" - echo " Expected result (*.err) differs from actual result (*.oerr)" - nerrors="`expr $nerrors + 1`" - test yes = "$verbose" && $DIFF $expect_err $actual_ext |sed 's/^/ /' - fi + if $CMP $expect_err $actual_ext; then + echo " PASSED" + else + echo "*FAILED*" + echo " Expected result (*.err) differs from actual result (*.oerr)" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF $expect_err $actual_ext |sed 's/^/ /' + fi else - echo "*FAILED*" - echo " Expected result (*.ddl) differs from actual result (*.out)" - nerrors="`expr $nerrors + 1`" - test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /' + echo "*FAILED*" + echo " Expected result (*.ddl) differs from actual result (*.out)" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /' fi # Clean up output file if test -z "$HDF5_NOCLEANUP"; then - rm -f $actual $actual_err $actual_sav $actual_err_sav + rm -f $actual $actual_err $actual_sav $actual_err_sav fi } @@ -822,8 +821,8 @@ TOOLTEST5() { # Run test. TESTING $DUMPER $@ ( - cd $TESTDIR - $ENVCMD $RUNSERIAL $DUMPER_BIN "$@" + cd $TESTDIR + $ENVCMD $RUNSERIAL $DUMPER_BIN "$@" ) >$actual 2>$actual_err # save actual and actual_err in case they are needed later. @@ -842,33 +841,33 @@ TOOLTEST5() { $actual_err > $actual_ext if [ ! -f $expect ]; then - # Create the expect file if it doesn't yet exist. - echo " CREATED" - cp $actual $expect - echo " Expected result (*.ddl) missing" - nerrors="`expr $nerrors + 1`" + # Create the expect file if it doesn't yet exist. + echo " CREATED" + cp $actual $expect + echo " Expected result (*.ddl) missing" + nerrors="`expr $nerrors + 1`" elif $CMP $expect $actual; then - if $CMP $expect_err $actual_ext; then - echo " PASSED" - else - echo "*FAILED*" - echo " Expected result (*.err) differs from actual result (*.oerr)" - nerrors="`expr $nerrors + 1`" - test yes = "$verbose" && $DIFF $expect_err $actual_ext |sed 's/^/ /' - fi + if $CMP $expect_err $actual_ext; then + echo " PASSED" + else + echo "*FAILED*" + echo " Expected result (*.err) differs from actual result (*.oerr)" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF $expect_err $actual_ext |sed 's/^/ /' + fi else - echo "*FAILED*" - echo " Expected result (*.ddl) differs from actual result (*.out)" - nerrors="`expr $nerrors + 1`" - test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /' + echo "*FAILED*" + echo " Expected result (*.ddl) differs from actual result (*.out)" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /' fi # Clean up output file if test -z "$HDF5_NOCLEANUP"; then - rm -f $actual $actual_err $actual_sav $actual_err_sav + rm -f $actual $actual_err $actual_sav $actual_err_sav fi - } + # ADD_HELP_TEST TOOLTEST_HELP() { @@ -880,27 +879,27 @@ TOOLTEST_HELP() { # Run test. TESTING $DUMPER $@ ( - cd $TESTDIR - $RUNSERIAL $DUMPER_BIN "$@" + cd $TESTDIR + $RUNSERIAL $DUMPER_BIN "$@" ) >$actual 2>$actual_err if [ ! -f $expectdata ]; then - # Create the expect data file if it doesn't yet exist. - echo " CREATED" - cp $actual $expect-CREATED - echo " Expected output (*.txt) missing" - nerrors="`expr $nerrors + 1`" + # Create the expect data file if it doesn't yet exist. + echo " CREATED" + cp $actual $expect-CREATED + echo " Expected output (*.txt) missing" + nerrors="`expr $nerrors + 1`" elif $CMP $expect $actual; then - echo " PASSED" + echo " PASSED" else - echo "*FAILED*" - echo " Expected output (*.txt) differs from actual output (*.out)" - nerrors="`expr $nerrors + 1`" + echo "*FAILED*" + echo " Expected output (*.txt) differs from actual output (*.out)" + nerrors="`expr $nerrors + 1`" fi # Clean up output file if test -z "$HDF5_NOCLEANUP"; then - rm -f $actual $actual_err + rm -f $actual $actual_err fi } @@ -920,14 +919,16 @@ GREPTEST() # Run test. TESTING $DUMPER -p $@ ( - cd $TESTDIR - $ENVCMD $RUNSERIAL $DUMPER_BIN -p "$@" + cd $TESTDIR + $ENVCMD $RUNSERIAL $DUMPER_BIN -p "$@" ) >$actual 2>$actual_err + if [ "$txttype" = "ERRTXT" ]; then $GREP "$expectdata" $actual_err > /dev/null else $GREP "$expectdata" $actual > /dev/null fi + if [ $? -eq 0 ]; then echo " PASSED" else @@ -937,7 +938,7 @@ GREPTEST() # Clean up output file if test -z "$HDF5_NOCLEANUP"; then - rm -f $actual $actual_err + rm -f $actual $actual_err fi } @@ -956,14 +957,16 @@ GREPTEST2() # Run test. TESTING $DUMPER -p $@ ( - cd $TESTDIR - $ENVCMD $RUNSERIAL $DUMPER_BIN -p "$@" + cd $TESTDIR + $ENVCMD $RUNSERIAL $DUMPER_BIN -p "$@" ) >$actual 2>$actual_err + if [ "$txttype" = "ERRTXT" ]; then $GREP "$expectdata" $actual_err > /dev/null else $GREP "$expectdata" $actual > /dev/null fi + if [ $? -eq 0 ]; then echo " PASSED" else @@ -973,21 +976,21 @@ GREPTEST2() # Clean up output file if test -z "$HDF5_NOCLEANUP"; then - rm -f $actual $actual_err + rm -f $actual $actual_err fi } # Print a "SKIP" message SKIP() { - TESTING $DUMPER $@ + TESTING $DUMPER $@ echo " -SKIP-" } # Print a line-line message left justified in a field of 70 characters # PRINT_H5DIFF() { - SPACES=" " - echo " Running h5diff $* $SPACES" | cut -c1-70 | tr -d '\012' + SPACES=" " + echo " Running h5diff $* $SPACES" | cut -c1-70 | tr -d '\012' } @@ -997,10 +1000,11 @@ DIFFTEST() { PRINT_H5DIFF $@ ( - cd $TESTDIR - $RUNSERIAL $H5DIFF_BIN "$@" -q + cd $TESTDIR + $RUNSERIAL $H5DIFF_BIN "$@" -q ) RET=$? + if [ $RET != 0 ] ; then echo "*FAILED*" nerrors="`expr $nerrors + 1`" @@ -1014,8 +1018,8 @@ DIFFTEST() # beginning with the word "Verifying". # PRINT_H5IMPORT() { - SPACES=" " - echo " Running h5import $* $SPACES" | cut -c1-70 | tr -d '\012' + SPACES=" " + echo " Running h5import $* $SPACES" | cut -c1-70 | tr -d '\012' } # Call the h5import tool @@ -1025,15 +1029,16 @@ IMPORTTEST() # remove the output hdf5 file if it exists hdf5_file="$TESTDIR/$5" if [ -f $hdf5_file ]; then - rm -f $hdf5_file + rm -f $hdf5_file fi PRINT_H5IMPORT $@ ( - cd $TESTDIR - $RUNSERIAL $H5IMPORT_BIN "$@" + cd $TESTDIR + $RUNSERIAL $H5IMPORT_BIN "$@" ) RET=$? + if [ $RET != 0 ] ; then echo "*FAILED*" nerrors="`expr $nerrors + 1`" @@ -1138,9 +1143,9 @@ TOOLTEST tcomp-4.ddl --enable-error-stack tcompound_complex.h5 TOOLTEST tcompound_complex2.ddl --enable-error-stack tcompound_complex2.h5 # tests for bitfields and opaque data types if test $WORDS_BIGENDIAN != "yes"; then -TOOLTEST tbitnopaque_le.ddl --enable-error-stack tbitnopaque.h5 + TOOLTEST tbitnopaque_le.ddl --enable-error-stack tbitnopaque.h5 else -TOOLTEST tbitnopaque_be.ddl --enable-error-stack tbitnopaque.h5 + TOOLTEST tbitnopaque_be.ddl --enable-error-stack tbitnopaque.h5 fi #test for the nested compound type @@ -1318,12 +1323,12 @@ TOOLTEST tallfilters.ddl --enable-error-stack -H -p -d all tfilters.h5 TOOLTEST tuserfilter.ddl --enable-error-stack -H -p -d myfilter tfilters.h5 if test $USE_FILTER_DEFLATE = "yes" ; then - # data read internal filters - TOOLTEST treadintfilter.ddl --enable-error-stack -d deflate -d shuffle -d fletcher32 -d nbit -d scaleoffset tfilters.h5 - if test $USE_FILTER_SZIP = "yes"; then - # data read - TOOLTEST treadfilter.ddl --enable-error-stack -d all -d szip tfilters.h5 - fi + # data read internal filters + TOOLTEST treadintfilter.ddl --enable-error-stack -d deflate -d shuffle -d fletcher32 -d nbit -d scaleoffset tfilters.h5 + if test $USE_FILTER_SZIP = "yes"; then + # data read + TOOLTEST treadfilter.ddl --enable-error-stack -d all -d szip tfilters.h5 + fi fi # test for displaying objects with very long names @@ -1380,9 +1385,9 @@ TOOLTEST tbin4.ddl --enable-error-stack -d double -b FILE -o out4.bin tbin # Clean up binary output files if test -z "$HDF5_NOCLEANUP"; then - rm -f out[1-4].bin - rm -f out1.h5 - rm -f out3.h5 + rm -f out[1-4].bin + rm -f out1.h5 + rm -f out3.h5 fi # test for dataset region references @@ -1394,7 +1399,7 @@ TOOLTEST2 tbinregR.exp --enable-error-stack -d /Dataset1 -s 0 -R -y -o tbinregR. # Clean up text output files if test -z "$HDF5_NOCLEANUP"; then - rm -f tbinregR.txt + rm -f tbinregR.txt fi # tests for group creation order diff --git a/tools/test/h5dump/testh5dumppbits.sh.in b/tools/test/h5dump/testh5dumppbits.sh.in index febce2c..ff0659a 100644 --- a/tools/test/h5dump/testh5dumppbits.sh.in +++ b/tools/test/h5dump/testh5dumppbits.sh.in @@ -236,26 +236,25 @@ TOOLTEST() { cp $actual_err $actual_err_sav STDERR_FILTER $actual_err - if [ ! -f $expect ]; then - # Create the expect file if it doesn't yet exist. - echo " CREATED" - cp $actual $expect - echo " Expected result (*.ddl) missing" - nerrors="`expr $nerrors + 1`" + if [ ! -f $expect ]; then + # Create the expect file if it doesn't yet exist. + echo " CREATED" + cp $actual $expect + echo " Expected result (*.ddl) missing" + nerrors="`expr $nerrors + 1`" elif $CMP $expect $actual; then - echo " PASSED" + echo " PASSED" else - echo "*FAILED*" - echo " Expected result (*.ddl) differs from actual result (*.out)" - nerrors="`expr $nerrors + 1`" - test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /' + echo "*FAILED*" + echo " Expected result (*.ddl) differs from actual result (*.out)" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /' fi # Clean up output file if test -z "$HDF5_NOCLEANUP"; then - rm -f $actual $actual_err $actual_sav $actual_err_sav $actual_ext + rm -f $actual $actual_err $actual_sav $actual_err_sav $actual_ext fi - } @@ -274,36 +273,36 @@ TOOLTEST2() { # Run test. TESTING $DUMPER $@ ( - cd $TESTDIR - $RUNSERIAL $DUMPER_BIN "$@" + cd $TESTDIR + $RUNSERIAL $DUMPER_BIN "$@" ) >$actual 2>$actual_err if [ ! -f $expect ]; then - # Create the expect file if it doesn't yet exist. - echo " CREATED" - cp $actual $expect - echo " Expected result (*.ddl) missing" - nerrors="`expr $nerrors + 1`" - elif $CMP $expect $actual; then - if [ ! -f $expectdata ]; then - # Create the expect data file if it doesn't yet exist. + # Create the expect file if it doesn't yet exist. echo " CREATED" - cp $actualdata $expectdata - echo " Expected data (*.exp) missing" + cp $actual $expect + echo " Expected result (*.ddl) missing" nerrors="`expr $nerrors + 1`" - elif $CMP $expectdata $actualdata; then - echo " PASSED" - else + elif $CMP $expect $actual; then + if [ ! -f $expectdata ]; then + # Create the expect data file if it doesn't yet exist. + echo " CREATED" + cp $actualdata $expectdata + echo " Expected data (*.exp) missing" + nerrors="`expr $nerrors + 1`" + elif $CMP $expectdata $actualdata; then + echo " PASSED" + else + echo "*FAILED*" + echo " Expected datafile (*.exp) differs from actual datafile (*.txt)" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF $expectdata $actualdata |sed 's/^/ /' + fi + else echo "*FAILED*" - echo " Expected datafile (*.exp) differs from actual datafile (*.txt)" + echo " Expected result (*.ddl) differs from actual result (*.out)" nerrors="`expr $nerrors + 1`" - test yes = "$verbose" && $DIFF $expectdata $actualdata |sed 's/^/ /' - fi - else - echo "*FAILED*" - echo " Expected result (*.ddl) differs from actual result (*.out)" - nerrors="`expr $nerrors + 1`" - test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /' + test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /' fi # Clean up output file @@ -328,8 +327,8 @@ TOOLTEST3() { # Run test. TESTING $DUMPER $@ ( - cd $TESTDIR - $RUNSERIAL $DUMPER_BIN "$@" + cd $TESTDIR + $RUNSERIAL $DUMPER_BIN "$@" ) >$actual 2>$actual_err # save actual and actual_err in case they are needed later. @@ -348,23 +347,23 @@ TOOLTEST3() { $actual_err > $actual_ext if [ ! -f $expect ]; then - # Create the expect file if it doesn't yet exist. - echo " CREATED" - cp $actual $expect - echo " Expected result (*.ddl) missing" - nerrors="`expr $nerrors + 1`" + # Create the expect file if it doesn't yet exist. + echo " CREATED" + cp $actual $expect + echo " Expected result (*.ddl) missing" + nerrors="`expr $nerrors + 1`" elif $CMP $expect $actual; then - echo " PASSED" + echo " PASSED" else - echo "*FAILED*" - echo " Expected result (*.ddl) differs from actual result (*.out)" - nerrors="`expr $nerrors + 1`" - test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /' + echo "*FAILED*" + echo " Expected result (*.ddl) differs from actual result (*.out)" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /' fi # Clean up output file if test -z "$HDF5_NOCLEANUP"; then - rm -f $actual $actual_err $actual_sav $actual_err_sav + rm -f $actual $actual_err $actual_sav $actual_err_sav fi } @@ -385,8 +384,8 @@ TOOLTEST4() { # Run test. TESTING $DUMPER $@ ( - cd $TESTDIR - $RUNSERIAL $DUMPER_BIN "$@" + cd $TESTDIR + $RUNSERIAL $DUMPER_BIN "$@" ) >$actual 2>$actual_err # save actual and actual_err in case they are needed later. @@ -405,30 +404,30 @@ TOOLTEST4() { $actual_err > $actual_ext if [ ! -f $expect ]; then - # Create the expect file if it doesn't yet exist. - echo " CREATED" - cp $actual $expect - echo " Expected result (*.ddl) missing" - nerrors="`expr $nerrors + 1`" + # Create the expect file if it doesn't yet exist. + echo " CREATED" + cp $actual $expect + echo " Expected result (*.ddl) missing" + nerrors="`expr $nerrors + 1`" elif $CMP $expect $actual; then - if $CMP $expect_err $actual_ext; then - echo " PASSED" - else - echo "*FAILED*" - echo " Expected result (*.err) differs from actual result (*.oerr)" - nerrors="`expr $nerrors + 1`" - test yes = "$verbose" && $DIFF $expect_err $actual_ext |sed 's/^/ /' - fi + if $CMP $expect_err $actual_ext; then + echo " PASSED" + else + echo "*FAILED*" + echo " Expected result (*.err) differs from actual result (*.oerr)" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF $expect_err $actual_ext |sed 's/^/ /' + fi else - echo "*FAILED*" - echo " Expected result (*.ddl) differs from actual result (*.out)" - nerrors="`expr $nerrors + 1`" - test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /' + echo "*FAILED*" + echo " Expected result (*.ddl) differs from actual result (*.out)" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /' fi # Clean up output file if test -z "$HDF5_NOCLEANUP"; then - rm -f $actual $actual_err $actual_sav $actual_err_sav + rm -f $actual $actual_err $actual_sav $actual_err_sav fi } @@ -442,8 +441,8 @@ SKIP() { # Print a line-line message left justified in a field of 70 characters # PRINT_H5DIFF() { - SPACES=" " - echo " Running h5diff $* $SPACES" | cut -c1-70 | tr -d '\012' + SPACES=" " + echo " Running h5diff $* $SPACES" | cut -c1-70 | tr -d '\012' } @@ -453,10 +452,11 @@ DIFFTEST() { PRINT_H5DIFF $@ ( - cd $TESTDIR - $RUNSERIAL $H5DIFF_BIN "$@" -q + cd $TESTDIR + $RUNSERIAL $H5DIFF_BIN "$@" -q ) RET=$? + if [ $RET != 0 ] ; then echo "*FAILED*" nerrors="`expr $nerrors + 1`" @@ -470,8 +470,8 @@ DIFFTEST() # beginning with the word "Verifying". # PRINT_H5IMPORT() { - SPACES=" " - echo " Running h5import $* $SPACES" | cut -c1-70 | tr -d '\012' + SPACES=" " + echo " Running h5import $* $SPACES" | cut -c1-70 | tr -d '\012' } # Call the h5import tool @@ -481,22 +481,22 @@ IMPORTTEST() # remove the output hdf5 file if it exists hdf5_file="$TESTDIR/$5" if [ -f $hdf5_file ]; then - rm -f $hdf5_file + rm -f $hdf5_file fi PRINT_H5IMPORT $@ ( - cd $TESTDIR - $RUNSERIAL $H5IMPORT_BIN "$@" + cd $TESTDIR + $RUNSERIAL $H5IMPORT_BIN "$@" ) RET=$? + if [ $RET != 0 ] ; then echo "*FAILED*" nerrors="`expr $nerrors + 1`" else echo " PASSED" fi - } diff --git a/tools/test/h5dump/testh5dumpvds.sh.in b/tools/test/h5dump/testh5dumpvds.sh.in index f89234e..29ff238 100644 --- a/tools/test/h5dump/testh5dumpvds.sh.in +++ b/tools/test/h5dump/testh5dumpvds.sh.in @@ -205,8 +205,8 @@ TOOLTEST() { # Run test. TESTING $DUMPER $@ ( - cd $TESTDIR - $RUNSERIAL $DUMPER_BIN "$@" + cd $TESTDIR + $RUNSERIAL $DUMPER_BIN "$@" ) >$actual 2>$actual_err # save actual and actual_err in case they are needed later. @@ -216,26 +216,25 @@ TOOLTEST() { STDERR_FILTER $actual_err cat $actual_err >> $actual - if [ ! -f $expect ]; then - # Create the expect file if it doesn't yet exist. - echo " CREATED" - cp $actual $expect - echo " Expected result (*.ddl) missing" - nerrors="`expr $nerrors + 1`" + if [ ! -f $expect ]; then + # Create the expect file if it doesn't yet exist. + echo " CREATED" + cp $actual $expect + echo " Expected result (*.ddl) missing" + nerrors="`expr $nerrors + 1`" elif $CMP $expect $actual; then - echo " PASSED" + echo " PASSED" else - echo "*FAILED*" - echo " Expected result (*.ddl) differs from actual result (*.out)" - nerrors="`expr $nerrors + 1`" - test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /' + echo "*FAILED*" + echo " Expected result (*.ddl) differs from actual result (*.out)" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /' fi # Clean up output file if test -z "$HDF5_NOCLEANUP"; then - rm -f $actual $actual_err $actual_sav $actual_err_sav $actual_ext + rm -f $actual $actual_err $actual_sav $actual_err_sav $actual_ext fi - } @@ -254,42 +253,42 @@ TOOLTEST2() { # Run test. TESTING $DUMPER $@ ( - cd $TESTDIR - $RUNSERIAL $DUMPER_BIN "$@" + cd $TESTDIR + $RUNSERIAL $DUMPER_BIN "$@" ) >$actual 2>$actual_err cat $actual_err >> $actual if [ ! -f $expect ]; then - # Create the expect file if it doesn't yet exist. - echo " CREATED" - cp $actual $expect - echo " Expected result (*.ddl) missing" - nerrors="`expr $nerrors + 1`" - elif $CMP $expect $actual; then - if [ ! -f $expectdata ]; then - # Create the expect data file if it doesn't yet exist. + # Create the expect file if it doesn't yet exist. echo " CREATED" - cp $actualdata $expectdata - echo " Expected data (*.exp) missing" + cp $actual $expect + echo " Expected result (*.ddl) missing" nerrors="`expr $nerrors + 1`" - elif $CMP $expectdata $actualdata; then - echo " PASSED" - else + elif $CMP $expect $actual; then + if [ ! -f $expectdata ]; then + # Create the expect data file if it doesn't yet exist. + echo " CREATED" + cp $actualdata $expectdata + echo " Expected data (*.exp) missing" + nerrors="`expr $nerrors + 1`" + elif $CMP $expectdata $actualdata; then + echo " PASSED" + else + echo "*FAILED*" + echo " Expected datafile (*.exp) differs from actual datafile (*.txt)" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF $expectdata $actualdata |sed 's/^/ /' + fi + else echo "*FAILED*" - echo " Expected datafile (*.exp) differs from actual datafile (*.txt)" + echo " Expected result (*.ddl) differs from actual result (*.out)" nerrors="`expr $nerrors + 1`" - test yes = "$verbose" && $DIFF $expectdata $actualdata |sed 's/^/ /' - fi - else - echo "*FAILED*" - echo " Expected result (*.ddl) differs from actual result (*.out)" - nerrors="`expr $nerrors + 1`" - test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /' + test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /' fi # Clean up output file if test -z "$HDF5_NOCLEANUP"; then - rm -f $actual $actualdata $actual_err + rm -f $actual $actualdata $actual_err fi } @@ -309,8 +308,8 @@ TOOLTEST3() { # Run test. TESTING $DUMPER $@ ( - cd $TESTDIR - $RUNSERIAL $DUMPER_BIN "$@" + cd $TESTDIR + $RUNSERIAL $DUMPER_BIN "$@" ) >$actual 2>$actual_err # save actual and actual_err in case they are needed later. @@ -326,27 +325,27 @@ TOOLTEST3() { -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ -e 's/H5Eget_auto[1-2]*/H5Eget_auto(1 or 2)/' \ -e 's/H5Eset_auto[1-2]*/H5Eset_auto(1 or 2)/' \ - $actual_err > $actual_ext + $actual_err > $actual_ext cat $actual_ext >> $actual if [ ! -f $expect ]; then - # Create the expect file if it doesn't yet exist. - echo " CREATED" - cp $actual $expect - echo " Expected result (*.ddl) missing" - nerrors="`expr $nerrors + 1`" + # Create the expect file if it doesn't yet exist. + echo " CREATED" + cp $actual $expect + echo " Expected result (*.ddl) missing" + nerrors="`expr $nerrors + 1`" elif $CMP $expect $actual; then - echo " PASSED" + echo " PASSED" else - echo "*FAILED*" - echo " Expected result (*.ddl) differs from actual result (*.out)" - nerrors="`expr $nerrors + 1`" - test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /' + echo "*FAILED*" + echo " Expected result (*.ddl) differs from actual result (*.out)" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /' fi # Clean up output file if test -z "$HDF5_NOCLEANUP"; then - rm -f $actual $actual_err $actual_sav $actual_err_sav + rm -f $actual $actual_err $actual_sav $actual_err_sav fi } @@ -367,8 +366,8 @@ TOOLTEST4() { # Run test. TESTING $DUMPER $@ ( - cd $TESTDIR - $RUNSERIAL $DUMPER_BIN "$@" + cd $TESTDIR + $RUNSERIAL $DUMPER_BIN "$@" ) >$actual 2>$actual_err # save actual and actual_err in case they are needed later. @@ -384,47 +383,46 @@ TOOLTEST4() { -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ -e 's/H5Eget_auto[1-2]*/H5Eget_auto(1 or 2)/' \ -e 's/H5Eset_auto[1-2]*/H5Eset_auto(1 or 2)/' \ - $actual_err > $actual_ext + $actual_err > $actual_ext #cat $actual_ext >> $actual if [ ! -f $expect ]; then - # Create the expect file if it doesn't yet exist. - echo " CREATED" - cp $actual $expect + # Create the expect file if it doesn't yet exist. + echo " CREATED" + cp $actual $expect elif $CMP $expect $actual; then - if $CMP $expect_err $actual_ext; then - echo " PASSED" - else - echo "*FAILED*" - echo " Expected result (*.err) differs from actual result (*.oerr)" - nerrors="`expr $nerrors + 1`" - test yes = "$verbose" && $DIFF $expect_err $actual_ext |sed 's/^/ /' - fi + if $CMP $expect_err $actual_ext; then + echo " PASSED" + else + echo "*FAILED*" + echo " Expected result (*.err) differs from actual result (*.oerr)" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF $expect_err $actual_ext |sed 's/^/ /' + fi else - echo "*FAILED*" - echo " Expected result (*.ddl) differs from actual result (*.out)" - nerrors="`expr $nerrors + 1`" - test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /' + echo "*FAILED*" + echo " Expected result (*.ddl) differs from actual result (*.out)" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /' fi # Clean up output file if test -z "$HDF5_NOCLEANUP"; then - rm -f $actual $actual_err $actual_sav $actual_err_sav + rm -f $actual $actual_err $actual_sav $actual_err_sav fi - } # Print a "SKIP" message SKIP() { - TESTING $DUMPER $@ + TESTING $DUMPER $@ echo " -SKIP-" } # Print a line-line message left justified in a field of 70 characters # PRINT_H5DIFF() { - SPACES=" " - echo " Running h5diff $* $SPACES" | cut -c1-70 | tr -d '\012' + SPACES=" " + echo " Running h5diff $* $SPACES" | cut -c1-70 | tr -d '\012' } @@ -434,25 +432,25 @@ DIFFTEST() { PRINT_H5DIFF $@ ( - cd $TESTDIR - $RUNSERIAL $H5DIFF_BIN "$@" -q + cd $TESTDIR + $RUNSERIAL $H5DIFF_BIN "$@" -q ) RET=$? + if [ $RET != 0 ] ; then echo "*FAILED*" nerrors="`expr $nerrors + 1`" else echo " PASSED" fi - } # Print a line-line message left justified in a field of 70 characters # beginning with the word "Verifying". # PRINT_H5IMPORT() { - SPACES=" " - echo " Running h5import $* $SPACES" | cut -c1-70 | tr -d '\012' + SPACES=" " + echo " Running h5import $* $SPACES" | cut -c1-70 | tr -d '\012' } # Call the h5import tool @@ -462,22 +460,22 @@ IMPORTTEST() # remove the output hdf5 file if it exists hdf5_file="$TESTDIR/$5" if [ -f $hdf5_file ]; then - rm -f $hdf5_file + rm -f $hdf5_file fi PRINT_H5IMPORT $@ ( - cd $TESTDIR - $RUNSERIAL $H5IMPORT_BIN "$@" + cd $TESTDIR + $RUNSERIAL $H5IMPORT_BIN "$@" ) RET=$? + if [ $RET != 0 ] ; then echo "*FAILED*" nerrors="`expr $nerrors + 1`" else echo " PASSED" fi - } @@ -491,7 +489,7 @@ COPY_TESTFILES_TO_TESTDIR ####### test for dataset vds ###### - # Data read +# Data read if test $USE_FILTER_DEFLATE = "yes" ; then TOOLTEST tvds-1.ddl --enable-error-stack 1_vds.h5 TOOLTEST tvds-2.ddl --enable-error-stack 2_vds.h5 @@ -504,7 +502,7 @@ if test $USE_FILTER_DEFLATE = "yes" ; then TOOLTEST vds-gap2.ddl --vds-gap-size=2 --enable-error-stack vds-eiger.h5 fi - # Layout read +# Layout read if test $USE_FILTER_DEFLATE = "yes" ; then TOOLTEST tvds_layout-1.ddl -p --enable-error-stack 1_vds.h5 TOOLTEST tvds_layout-2.ddl -p --enable-error-stack 2_vds.h5 diff --git a/tools/test/h5dump/testh5dumpxml.sh.in b/tools/test/h5dump/testh5dumpxml.sh.in index f7af300..52a13c2 100644 --- a/tools/test/h5dump/testh5dumpxml.sh.in +++ b/tools/test/h5dump/testh5dumpxml.sh.in @@ -262,36 +262,35 @@ TOOLTEST() { # Run test. TESTING $DUMPER $@ ( - cd $TESTDIR - $RUNSERIAL $DUMPER_BIN "$@" + cd $TESTDIR + $RUNSERIAL $DUMPER_BIN "$@" ) >$actual 2>$actual_err - if [ ! -f $expect ]; then - # Create the expect file if it doesn't yet exist. - echo " CREATED" - cp $actual $expect - echo " Expected result (*.xml) missing" - nerrors="`expr $nerrors + 1`" + # Create the expect file if it doesn't yet exist. + echo " CREATED" + cp $actual $expect + echo " Expected result (*.xml) missing" + nerrors="`expr $nerrors + 1`" elif $CMP $expect $actual; then - echo " PASSED" + echo " PASSED" else - echo "*FAILED*" - echo " Expected result (*.xml) differs from actual result (*.out)" - nerrors="`expr $nerrors + 1`" - test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /' + echo "*FAILED*" + echo " Expected result (*.xml) differs from actual result (*.out)" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /' fi # Clean up output file if test -z "$HDF5_NOCLEANUP"; then - rm -f $actual $actual_err + rm -f $actual $actual_err fi } # Print a "SKIP" message SKIP() { - TESTING $DUMPER $@ - echo " -SKIP-" + TESTING $DUMPER $@ + echo " -SKIP-" } diff --git a/tools/test/h5format_convert/testfiles/h5fc_v_err.ddl.err b/tools/test/h5format_convert/testfiles/h5fc_v_err.ddl.err index d85a999..e72892d 100644 --- a/tools/test/h5format_convert/testfiles/h5fc_v_err.ddl.err +++ b/tools/test/h5format_convert/testfiles/h5fc_v_err.ddl.err @@ -1,8 +1 @@ h5format_convert error: unable to downgrade dataset "/DSET_ERR" -H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs): - #000: (file name) line (number) in h5trav_visit(): traverse failed - major: Failure in tools library - minor: error in function - #001: (file name) line (number) in traverse(): H5Lvisit_by_name failed - major: Failure in tools library - minor: error in function diff --git a/tools/test/h5format_convert/testh5fc.sh.in b/tools/test/h5format_convert/testh5fc.sh.in index d780a3d..2cdd445 100644 --- a/tools/test/h5format_convert/testh5fc.sh.in +++ b/tools/test/h5format_convert/testh5fc.sh.in @@ -483,7 +483,7 @@ TOOLTEST_OUT h5fc_v_n_all.ddl h5fc_non_v3.h5 -v -n # # # h5format_convert -v h5fc_err_level.h5 (error encountered in converting the dataset) -TOOLTEST_MASK_OUT h5fc_v_err.ddl h5fc_err_level.h5 -v --enable-error-stack +TOOLTEST_MASK_OUT h5fc_v_err.ddl h5fc_err_level.h5 -v # # # diff --git a/tools/test/h5jam/tellub.c b/tools/test/h5jam/tellub.c index 559c677..453444d 100644 --- a/tools/test/h5jam/tellub.c +++ b/tools/test/h5jam/tellub.c @@ -70,11 +70,12 @@ parse_command_line (int argc, const char *argv[]) switch ((char) opt) { case 'h': usage (h5tools_getprogname()); - HDexit(EXIT_SUCCESS); + h5tools_setstatus(EXIT_SUCCESS); + break; case '?': default: usage (h5tools_getprogname()); - HDexit(EXIT_FAILURE); + h5tools_setstatus(EXIT_FAILURE); } } @@ -82,10 +83,17 @@ parse_command_line (int argc, const char *argv[]) if (argc <= opt_ind) { error_msg("missing file name\n"); usage (h5tools_getprogname()); - HDexit(EXIT_FAILURE); + h5tools_setstatus(EXIT_FAILURE); } } /* end parse_command_line() */ +static void +leave(int ret) +{ + h5tools_close(); + HDexit(ret); +} + /*------------------------------------------------------------------------- * Function: main * @@ -98,9 +106,7 @@ int main (int argc, const char *argv[]) { char *ifname; - void *edata; - H5E_auto2_t func; - hid_t ifile; + hid_t ifile = H5I_INVALID_HID; hsize_t usize; htri_t testval; herr_t status; @@ -112,16 +118,16 @@ main (int argc, const char *argv[]) /* Initialize h5tools lib */ h5tools_init(); - /* Disable error reporting */ - H5Eget_auto2(H5E_DEFAULT, &func, &edata); - H5Eset_auto2(H5E_DEFAULT, NULL, NULL); - parse_command_line(argc, argv); + /* enable error reporting if command line option */ + h5tools_error_report(); + if(argc <= (opt_ind)) { error_msg("missing file name\n"); usage (h5tools_getprogname()); - return EXIT_FAILURE; + h5tools_setstatus(EXIT_FAILURE); + goto done; } ifname = HDstrdup(argv[opt_ind]); @@ -130,33 +136,39 @@ main (int argc, const char *argv[]) if(testval <= 0) { error_msg("Input HDF5 file is not HDF \"%s\"\n", ifname); - return EXIT_FAILURE; + h5tools_setstatus(EXIT_FAILURE); + goto done; } ifile = H5Fopen(ifname, H5F_ACC_RDONLY, H5P_DEFAULT); if(ifile < 0) { error_msg("Can't open input HDF5 file \"%s\"\n", ifname); - return EXIT_FAILURE; + h5tools_setstatus(EXIT_FAILURE); + goto done; } plist = H5Fget_create_plist(ifile); if(plist < 0) { error_msg("Can't get file creation plist for file \"%s\"\n", ifname); - return EXIT_FAILURE; + h5tools_setstatus(EXIT_FAILURE); + goto done; } status = H5Pget_userblock(plist, &usize); if(status < 0) { error_msg("Can't get user block for file \"%s\"\n", ifname); - return EXIT_FAILURE; + h5tools_setstatus(EXIT_FAILURE); + goto done; } HDprintf("%ld\n", (long) usize); +done: H5Pclose (plist); - H5Fclose (ifile); + if(ifile >= 0) + H5Fclose (ifile); - return EXIT_SUCCESS; + leave(h5tools_getstatus()); } /* end main() */ diff --git a/tools/test/h5ls/h5ls_plugin.sh.in b/tools/test/h5ls/h5ls_plugin.sh.in index c89269d..28370e6 100644 --- a/tools/test/h5ls/h5ls_plugin.sh.in +++ b/tools/test/h5ls/h5ls_plugin.sh.in @@ -139,8 +139,8 @@ CLEAN_TESTFILES_AND_TESTDIR() # Print a $* message left justified in a field of 70 characters # MESSAGE() { - SPACES=" " - echo "$* $SPACES" | cut -c1-70 | tr -d '\012' + SPACES=" " + echo "$* $SPACES" | cut -c1-70 | tr -d '\012' } # Print a line-line message left justified in a field of 70 characters @@ -206,7 +206,7 @@ TOOLTEST() { echo "" fi elif [ ! -f $expect ]; then - # Create the expect file if it doesn't yet exist. + # Create the expect file if it doesn't yet exist. echo " CREATED" cp $actual $expect echo " Expected result (*.ls) missing" diff --git a/tools/test/h5repack/CMakeTests.cmake b/tools/test/h5repack/CMakeTests.cmake index 4823d07..af73b75 100644 --- a/tools/test/h5repack/CMakeTests.cmake +++ b/tools/test/h5repack/CMakeTests.cmake @@ -72,6 +72,14 @@ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_paged_persist.h5 # h5diff/testfile ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_attr1.h5 + # tools/testfiles for external links + ${HDF5_TOOLS_DIR}/testfiles/tsoftlinks.h5 + ${HDF5_TOOLS_DIR}/testfiles/textlinkfar.h5 + ${HDF5_TOOLS_DIR}/testfiles/textlinksrc.h5 + ${HDF5_TOOLS_DIR}/testfiles/textlinktar.h5 + ${HDF5_TOOLS_DIR}/testfiles/textlink.h5 + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5copy_extlinks_src.h5 + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5copy_extlinks_trg.h5 # tools/testfiles ${HDF5_TOOLS_DIR}/testfiles/tfamily00000.h5 ${HDF5_TOOLS_DIR}/testfiles/tfamily00001.h5 @@ -128,6 +136,13 @@ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/plugin_version_test.h5repack_layout.h5 ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/plugin_zero.h5repack_layout.h5 ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/plugin_none.h5repack_layout.UD.h5 + # tools/testfiles for external links + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/tsoftlinks-merge.tsoftlinks.h5 + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/textlinkfar-merge.textlinkfar.h5 + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/textlinksrc-merge.textlinksrc.h5 + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/textlinktar-merge.textlinktar.h5 + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/textlink-merge.textlink.h5 + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5copy_extlinks_src-merge.h5copy_extlinks_src.h5 ) set (LIST_DDL_TEST_FILES @@ -154,6 +169,25 @@ # refs ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/attrregion.tattrreg.h5 ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/dataregion.tdatareg.h5 + # tools/testfiles for external links + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/textlinkfar-base.textlinkfar.h5 + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/textlinksrc-base.textlinksrc.h5 + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/textlinktar-base.textlinktar.h5 + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/textlink-base.textlink.h5 + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/tsoftlinks-base.tsoftlinks.h5 + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5copy_extlinks_src-base.h5copy_extlinks_src.h5 + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/textlinkfar-prune.textlinkfar.h5 + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/textlinksrc-prune.textlinksrc.h5 + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/textlinktar-prune.textlinktar.h5 + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/textlink-prune.textlink.h5 + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/tsoftlinks-prune.tsoftlinks.h5 + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5copy_extlinks_src-prune.h5copy_extlinks_src.h5 + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/textlinkfar-mergeprune.textlinkfar.h5 + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/textlinksrc-mergeprune.textlinksrc.h5 + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/textlinktar-mergeprune.textlinktar.h5 + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/textlink-mergeprune.textlink.h5 + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/tsoftlinks-mergeprune.tsoftlinks.h5 + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5copy_extlinks_src-mergeprune.h5copy_extlinks_src.h5 ) foreach (h5_file ${LIST_HDF5_TEST_FILES}) @@ -276,7 +310,7 @@ endif () endmacro () - macro (ADD_H5_CMP_TEST testname testfilter testtype resultcode resultfile) + macro (ADD_H5_FILTER_TEST testname testfilter testtype resultcode resultfile) if ("${testtype}" STREQUAL "SKIP") if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( @@ -410,6 +444,48 @@ endif () endmacro () + macro (ADD_H5_DIFF_TEST testname testtype resultcode testfile) + if ("${testtype}" STREQUAL "SKIP") + if (NOT HDF5_ENABLE_USING_MEMCHECKER) + add_test ( + NAME H5REPACK_DIFF-${testname} + COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}" + ) + set_property(TEST H5REPACK_DIFF-${testname} PROPERTY DISABLED) + endif () + else () + add_test ( + NAME H5REPACK_DIFF-${testname}-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove testfiles/out-${testname}.${testfile} + ) + set_tests_properties (H5REPACK_DIFF-${testname}-clear-objects PROPERTIES + FIXTURES_REQUIRED clear_h5repack + ) + add_test ( + NAME H5REPACK_DIFF-${testname} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ --enable-error-stack ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} + ) + set_tests_properties (H5REPACK_DIFF-${testname} PROPERTIES + DEPENDS H5REPACK_DIFF-${testname}-clear-objects + ) + add_test ( + NAME H5REPACK_DIFF-${testname}_DFF + COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=-v;--enable-error-stack;${testfile};out-${testname}.${testfile}" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" + -D "TEST_OUTPUT=out-${testname}.${testfile}.out" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_REFERENCE=${testname}.${testfile}.tst" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + set_tests_properties (H5REPACK_DIFF-${testname}_DFF PROPERTIES + DEPENDS H5REPACK_DIFF-${testname} + ) + endif () + endmacro () + macro (ADD_H5_STAT_TEST testname testtype resultcode statarg resultfile) if ("${testtype}" STREQUAL "SKIP") if (NOT HDF5_ENABLE_USING_MEMCHECKER) @@ -1148,7 +1224,7 @@ if (NOT USE_FILTER_DEFLATE) set (TESTTYPE "SKIP") endif () - ADD_H5_CMP_TEST (gzip_verbose_filters "O?...ing file[^\n]+\n" ${TESTTYPE} 0 ${arg}) + ADD_H5_FILTER_TEST (gzip_verbose_filters "O?...ing file[^\n]+\n" ${TESTTYPE} 0 ${arg}) ########################################################### # the following tests assume the input files have filters @@ -1540,6 +1616,44 @@ ADD_H5_EXTERNAL_TEST (ext_int32le_3d "TEST" int32le_3d -l CONTI) ADD_H5_EXTERNAL_TEST (ext_uint8be "TEST" uint8be -l CONTI) ############################################################################## +### E X T E R N A L L I N K T E S T S +############################################################################## +### HDFFV-11128 needs fixed to enable the following test +#ADD_H5_DMP_TEST (h5copy_extlinks_src-base "TEST" 0 h5copy_extlinks_src.h5 --enable-error-stack) +ADD_H5_DMP_TEST (tsoftlinks-base "TEST" 0 tsoftlinks.h5 --enable-error-stack) +ADD_H5_DMP_TEST (textlink-base "TEST" 0 textlink.h5 --enable-error-stack) +ADD_H5_DMP_TEST (textlinkfar-base "TEST" 0 textlinkfar.h5 --enable-error-stack) +ADD_H5_DMP_TEST (textlinksrc-base "TEST" 0 textlinksrc.h5 --enable-error-stack) +ADD_H5_DMP_TEST (textlinktar-base "TEST" 0 textlinktar.h5 --enable-error-stack) + +ADD_H5_DIFF_TEST (h5copy_extlinks_src-merge "TEST" 0 h5copy_extlinks_src.h5 --merge) +ADD_H5_DIFF_TEST (tsoftlinks-merge "TEST" 1 tsoftlinks.h5 --merge) +ADD_H5_DIFF_TEST (textlink-merge "TEST" 0 textlink.h5 --merge) +### HDFFV-11128 needs fixed to enable the following test +#ADD_H5_DIFF_TEST (textlinkfar-merge "TEST" 1 textlinkfar.h5 --merge) +### HDFFV-11128 needs fixed to enable the following test +#ADD_H5_DIFF_TEST (textlinksrc-merge "TEST" 1 textlinksrc.h5 --merge) +### HDFFV-11128 needs fixed to enable the following test +#ADD_H5_DIFF_TEST (textlinktar-merge "TEST" 1 textlinktar.h5 --merge) + +ADD_H5_DMP_TEST (h5copy_extlinks_src-prune "TEST" 0 h5copy_extlinks_src.h5 --prune --enable-error-stack) +ADD_H5_DMP_TEST (tsoftlinks-prune "TEST" 0 tsoftlinks.h5 --prune --enable-error-stack) +ADD_H5_DMP_TEST (textlink-prune "TEST" 0 textlink.h5 --prune --enable-error-stack) +ADD_H5_DMP_TEST (textlinkfar-prune "TEST" 0 textlinkfar.h5 --prune --enable-error-stack) +ADD_H5_DMP_TEST (textlinksrc-prune "TEST" 0 textlinksrc.h5 --prune --enable-error-stack) +ADD_H5_DMP_TEST (textlinktar-prune "TEST" 0 textlinktar.h5 --prune --enable-error-stack) + +ADD_H5_DMP_TEST (h5copy_extlinks_src-mergeprune "TEST" 0 h5copy_extlinks_src.h5 --merge --prune --enable-error-stack) +ADD_H5_DMP_TEST (tsoftlinks-mergeprune "TEST" 0 tsoftlinks.h5 --merge --prune --enable-error-stack) +ADD_H5_DMP_TEST (textlink-mergeprune "TEST" 0 textlink.h5 --merge --prune --enable-error-stack) +### HDFFV-11128 needs fixed to enable the following test +#ADD_H5_DMP_TEST (textlinkfar-mergeprune "TEST" 0 textlinkfar.h5 --merge --prune --enable-error-stack) +### HDFFV-11128 needs fixed to enable the following test +#ADD_H5_DMP_TEST (textlinksrc-mergeprune "TEST" 0 textlinksrc.h5 --merge --prune --enable-error-stack) +### HDFFV-11128 needs fixed to enable the following test +#ADD_H5_DMP_TEST (textlinktar-mergeprune "TEST" 0 textlinktar.h5 --merge --prune --enable-error-stack) + +############################################################################## ### P L U G I N T E S T S ############################################################################## if (BUILD_SHARED_LIBS) diff --git a/tools/test/h5repack/h5repack.sh.in b/tools/test/h5repack/h5repack.sh.in index ad6fef8..18e6d86 100644 --- a/tools/test/h5repack/h5repack.sh.in +++ b/tools/test/h5repack/h5repack.sh.in @@ -92,10 +92,18 @@ $SRC_H5REPACK_TESTFILES/h5repack_attr_refs.h5 $SRC_H5REPACK_TESTFILES/h5repack_deflate.h5 $SRC_H5REPACK_TESTFILES/h5repack_early.h5 $SRC_H5REPACK_TESTFILES/h5repack_ext.h5 +$SRC_H5REPACK_TESTFILES/h5repack_f32le.h5 +$SRC_H5REPACK_TESTFILES/h5repack_f32le_ex.h5 $SRC_H5REPACK_TESTFILES/h5repack_fill.h5 $SRC_H5REPACK_TESTFILES/h5repack_filters.h5 $SRC_H5REPACK_TESTFILES/h5repack_fletcher.h5 $SRC_H5REPACK_TESTFILES/h5repack_hlink.h5 +$SRC_H5REPACK_TESTFILES/h5repack_int32le_1d.h5 +$SRC_H5REPACK_TESTFILES/h5repack_int32le_1d_ex.h5 +$SRC_H5REPACK_TESTFILES/h5repack_int32le_2d.h5 +$SRC_H5REPACK_TESTFILES/h5repack_int32le_2d_ex.h5 +$SRC_H5REPACK_TESTFILES/h5repack_int32le_3d.h5 +$SRC_H5REPACK_TESTFILES/h5repack_int32le_3d_ex.h5 $SRC_H5REPACK_TESTFILES/h5repack_layout.h5 $SRC_H5REPACK_TESTFILES/h5repack_layouto.h5 $SRC_H5REPACK_TESTFILES/h5repack_layout2.h5 @@ -109,23 +117,26 @@ $SRC_H5REPACK_TESTFILES/h5repack_refs.h5 $SRC_H5REPACK_TESTFILES/h5repack_shuffle.h5 $SRC_H5REPACK_TESTFILES/h5repack_soffset.h5 $SRC_H5REPACK_TESTFILES/h5repack_szip.h5 +$SRC_H5REPACK_TESTFILES/h5repack_uint8be.h5 +$SRC_H5REPACK_TESTFILES/h5repack_uint8be_ex.h5 +########fsm#files######## $SRC_H5REPACK_TESTFILES/h5repack_aggr.h5 $SRC_H5REPACK_TESTFILES/h5repack_fsm_aggr_nopersist.h5 $SRC_H5REPACK_TESTFILES/h5repack_fsm_aggr_persist.h5 $SRC_H5REPACK_TESTFILES/h5repack_none.h5 $SRC_H5REPACK_TESTFILES/h5repack_paged_nopersist.h5 $SRC_H5REPACK_TESTFILES/h5repack_paged_persist.h5 -$SRC_H5REPACK_TESTFILES/h5repack_f32le.h5 -$SRC_H5REPACK_TESTFILES/h5repack_f32le_ex.h5 -$SRC_H5REPACK_TESTFILES/h5repack_int32le_1d.h5 -$SRC_H5REPACK_TESTFILES/h5repack_int32le_1d_ex.h5 -$SRC_H5REPACK_TESTFILES/h5repack_int32le_2d.h5 -$SRC_H5REPACK_TESTFILES/h5repack_int32le_2d_ex.h5 -$SRC_H5REPACK_TESTFILES/h5repack_int32le_3d.h5 -$SRC_H5REPACK_TESTFILES/h5repack_int32le_3d_ex.h5 -$SRC_H5REPACK_TESTFILES/h5repack_uint8be.h5 -$SRC_H5REPACK_TESTFILES/h5repack_uint8be_ex.h5 +########h5diff/testfile######## $SRC_H5DIFF_TESTFILES/h5diff_attr1.h5 +########tools/testfiles#for#external#links######## +$SRC_TOOLS_TESTFILES/tsoftlinks.h5 +$SRC_TOOLS_TESTFILES/textlinkfar.h5 +$SRC_TOOLS_TESTFILES/textlinksrc.h5 +$SRC_TOOLS_TESTFILES/textlinktar.h5 +$SRC_TOOLS_TESTFILES/textlink.h5 +$SRC_H5REPACK_TESTFILES/h5copy_extlinks_src.h5 +$SRC_H5REPACK_TESTFILES/h5copy_extlinks_trg.h5 +########tools/testfiles######## $SRC_TOOLS_TESTFILES/tfamily00000.h5 $SRC_TOOLS_TESTFILES/tfamily00001.h5 $SRC_TOOLS_TESTFILES/tfamily00002.h5 @@ -138,6 +149,8 @@ $SRC_TOOLS_TESTFILES/tfamily00008.h5 $SRC_TOOLS_TESTFILES/tfamily00009.h5 $SRC_TOOLS_TESTFILES/tfamily00010.h5 $SRC_TOOLS_TESTFILES/tordergr.h5 +########reference#conversion#files######## +########tools/testfiles/vds######## $SRC_TOOLS_TESTFILES/vds/1_a.h5 $SRC_TOOLS_TESTFILES/vds/1_b.h5 $SRC_TOOLS_TESTFILES/vds/1_c.h5 @@ -168,33 +181,73 @@ $SRC_H5REPACK_TESTFILES/h5repack-help.txt $SRC_H5REPACK_TESTFILES/h5repack_ext.bin $SRC_H5REPACK_TESTFILES/ublock.bin $SRC_H5REPACK_TESTFILES/h5repack.info -$SRC_H5REPACK_TESTFILES/crtorder.tordergr.h5.ddl -$SRC_H5REPACK_TESTFILES/deflate_limit.h5repack_layout.h5.ddl +########dat#files######## $SRC_H5REPACK_TESTFILES/h5repack_f32le_ex-0.dat $SRC_H5REPACK_TESTFILES/h5repack_int32le_1d_ex-0.dat $SRC_H5REPACK_TESTFILES/h5repack_int32le_1d_ex-1.dat $SRC_H5REPACK_TESTFILES/h5repack_int32le_2d_ex-0.dat $SRC_H5REPACK_TESTFILES/h5repack_int32le_3d_ex-0.dat -$SRC_H5REPACK_TESTFILES/h5repack_layout.h5.ddl -$SRC_H5REPACK_TESTFILES/h5repack_filters.h5-gzip_verbose_filters.tst -$SRC_H5REPACK_TESTFILES/h5repack_layout.h5-dset2_chunk_20x10-errstk.tst -$SRC_H5REPACK_TESTFILES/h5repack_layout.h5-plugin_test.ddl $SRC_H5REPACK_TESTFILES/h5repack_uint8be_ex-0.dat $SRC_H5REPACK_TESTFILES/h5repack_uint8be_ex-1.dat $SRC_H5REPACK_TESTFILES/h5repack_uint8be_ex-2.dat $SRC_H5REPACK_TESTFILES/h5repack_uint8be_ex-3.dat -$SRC_H5REPACK_TESTFILES/plugin_test.h5repack_layout.h5.tst -$SRC_H5REPACK_TESTFILES/1_vds.h5-vds_dset_chunk20x10x5-v.ddl -$SRC_H5REPACK_TESTFILES/2_vds.h5-vds_chunk3x6x9-v.ddl -$SRC_H5REPACK_TESTFILES/3_1_vds.h5-vds_chunk2x5x8-v.ddl -$SRC_H5REPACK_TESTFILES/4_vds.h5-vds_compa-v.ddl -$SRC_H5REPACK_TESTFILES/4_vds.h5-vds_conti-v.ddl +############### +$SRC_H5REPACK_TESTFILES/crtorder.tordergr.h5.ddl +$SRC_H5REPACK_TESTFILES/deflate_limit.h5repack_layout.h5.ddl +$SRC_H5REPACK_TESTFILES/h5repack_layout.h5.ddl +$SRC_H5REPACK_TESTFILES/h5repack_layout.h5-plugin_test.ddl +########fsm#files######## $SRC_H5REPACK_TESTFILES/SP.h5repack_fsm_aggr_nopersist.h5.ddl $SRC_H5REPACK_TESTFILES/S.h5repack_fsm_aggr_persist.h5.ddl $SRC_H5REPACK_TESTFILES/STG.h5repack_none.h5.ddl $SRC_H5REPACK_TESTFILES/GS.h5repack_paged_nopersist.h5.ddl $SRC_H5REPACK_TESTFILES/SP.h5repack_paged_persist.h5.ddl $SRC_H5REPACK_TESTFILES/SPT.h5repack_aggr.h5.ddl +########vds#files######## +$SRC_H5REPACK_TESTFILES/1_vds.h5-vds_dset_chunk20x10x5-v.ddl +$SRC_H5REPACK_TESTFILES/2_vds.h5-vds_chunk3x6x9-v.ddl +$SRC_H5REPACK_TESTFILES/3_1_vds.h5-vds_chunk2x5x8-v.ddl +$SRC_H5REPACK_TESTFILES/4_vds.h5-vds_compa-v.ddl +$SRC_H5REPACK_TESTFILES/4_vds.h5-vds_conti-v.ddl +########refs#files######## +$SRC_H5REPACK_TESTFILES/attrregion.tattrreg.h5.ddl +$SRC_H5REPACK_TESTFILES/dataregion.tdatareg.h5.ddl +########external#links#files######## +$SRC_H5REPACK_TESTFILES/textlinkfar-base.textlinkfar.h5.ddl +$SRC_H5REPACK_TESTFILES/textlinksrc-base.textlinksrc.h5.ddl +$SRC_H5REPACK_TESTFILES/textlinktar-base.textlinktar.h5.ddl +$SRC_H5REPACK_TESTFILES/textlink-base.textlink.h5.ddl +$SRC_H5REPACK_TESTFILES/tsoftlinks-base.tsoftlinks.h5.ddl +$SRC_H5REPACK_TESTFILES/h5copy_extlinks_src-base.h5copy_extlinks_src.h5.ddl +$SRC_H5REPACK_TESTFILES/textlinkfar-merge.textlinkfar.h5.tst +$SRC_H5REPACK_TESTFILES/textlinksrc-merge.textlinksrc.h5.tst +$SRC_H5REPACK_TESTFILES/textlinktar-merge.textlinktar.h5.tst +$SRC_H5REPACK_TESTFILES/textlink-merge.textlink.h5.tst +$SRC_H5REPACK_TESTFILES/tsoftlinks-merge.tsoftlinks.h5.tst +$SRC_H5REPACK_TESTFILES/h5copy_extlinks_src-merge.h5copy_extlinks_src.h5.tst +$SRC_H5REPACK_TESTFILES/textlinkfar-prune.textlinkfar.h5.ddl +$SRC_H5REPACK_TESTFILES/textlinksrc-prune.textlinksrc.h5.ddl +$SRC_H5REPACK_TESTFILES/textlinktar-prune.textlinktar.h5.ddl +$SRC_H5REPACK_TESTFILES/textlink-prune.textlink.h5.ddl +$SRC_H5REPACK_TESTFILES/tsoftlinks-prune.tsoftlinks.h5.ddl +$SRC_H5REPACK_TESTFILES/h5copy_extlinks_src-prune.h5copy_extlinks_src.h5.ddl +$SRC_H5REPACK_TESTFILES/textlinkfar-mergeprune.textlinkfar.h5.ddl +$SRC_H5REPACK_TESTFILES/textlinksrc-mergeprune.textlinksrc.h5.ddl +$SRC_H5REPACK_TESTFILES/textlinktar-mergeprune.textlinktar.h5.ddl +$SRC_H5REPACK_TESTFILES/textlink-mergeprune.textlink.h5.ddl +$SRC_H5REPACK_TESTFILES/tsoftlinks-mergeprune.tsoftlinks.h5.ddl +$SRC_H5REPACK_TESTFILES/h5copy_extlinks_src-mergeprune.h5copy_extlinks_src.h5.ddl +########tst#files######## +$SRC_H5REPACK_TESTFILES/h5repack_filters.h5-gzip_verbose_filters.tst +$SRC_H5REPACK_TESTFILES/h5repack_layout.h5-dset2_chunk_20x10-errstk.tst +$SRC_H5REPACK_TESTFILES/plugin_test.h5repack_layout.h5.tst +########external#links#tst#files######## +$SRC_H5REPACK_TESTFILES/tsoftlinks-merge.tsoftlinks.h5.tst +$SRC_H5REPACK_TESTFILES/textlinkfar-merge.textlinkfar.h5.tst +$SRC_H5REPACK_TESTFILES/textlinksrc-merge.textlinksrc.h5.tst +$SRC_H5REPACK_TESTFILES/textlinktar-merge.textlinktar.h5.tst +$SRC_H5REPACK_TESTFILES/textlink-merge.textlink.h5.tst +$SRC_H5REPACK_TESTFILES/h5copy_extlinks_src-merge.h5copy_extlinks_src.h5.tst " # @@ -271,6 +324,12 @@ SKIP() { echo " -SKIP-" } +############################################################################## +############################################################################## +### T H E T E S T S M A C R O S ### +############################################################################## +############################################################################## + # Call the h5diff tool # DIFFTEST() @@ -620,6 +679,7 @@ VERIFY_INVALIDBOUNDS() # ----------------------------------------------------------------------------- # Expect h5diff to fail +# Use only by VERIFY_EXTERNAL_CONSOLIDATION # ----------------------------------------------------------------------------- DIFFFAIL() { @@ -805,6 +865,121 @@ TOOLTESTV() rm -f $outfile } +# This is same as TOOLTESTV() with comparing display output +# with actual filename swapped +# +TOOLTESTSV() +{ + expect="$TESTDIR/$1.$2.tst" + actual="$TESTDIR/`basename $2 .ddl`.out" + actual_err="$TESTDIR/`basename $2 .ddl`.err" + + infile=$2 + outfile=out-$1.$2 + shift + shift + + # Run test. + TESTING $H5REPACK $@ + ( + cd $TESTDIR + $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile + ) >$actual 2>$actual_err + RET=$? + if [ $RET != 0 ] ; then + echo "*FAILED*" + nerrors="`expr $nerrors + 1`" + else + echo " PASSED" + VERIFY h5diff equal $@ + ( + cd $TESTDIR + $RUNSERIAL $H5DIFF_BIN -v $infile $outfile + ) >$actual 2>$actual_err + RET=$? + if [ $RET != 0 ] ; then + echo "*FAILED*" + nerrors="`expr $nerrors + 1`" + else + echo " PASSED" + fi + fi + + # display output compare + STDOUT_FILTER $actual + cat $actual_err >> $actual + + VERIFY output from $H5REPACK $@ + if cmp -s $expect $actual; then + echo " PASSED" + else + echo "*FAILED*" + echo " Expected result (*.tst) differs from actual result (*.out)" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && diff -c $expect $actual |sed 's/^/ /' + fi + + rm -f $actual $actual_err + rm -f $outfile +} + +# This is same as TOOLTESTSV() but expects a diff fail +# +TOOLFAILSV() +{ + expect="$TESTDIR/$1.$2.tst" + actual="$TESTDIR/`basename $2 .ddl`.out" + actual_err="$TESTDIR/`basename $2 .ddl`.err" + + infile=$2 + outfile=out-$1.$2 + shift + shift + + # Run test. + TESTING $H5REPACK $@ + ( + cd $TESTDIR + $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile + ) >$actual 2>$actual_err + RET=$? + if [ $RET != 0 ] ; then + echo "*FAILED*" + nerrors="`expr $nerrors + 1`" + else + echo " PASSED" + VERIFY h5diff unequal $@ + ( + cd $TESTDIR + $RUNSERIAL $H5DIFF_BIN -v $infile $outfile + ) >$actual 2>$actual_err + RET=$? + if [ $RET == 0 ] ; then + echo "*FAILED*" + nerrors="`expr $nerrors + 1`" + else + echo " PASSED" + fi + fi + + # display output compare + STDOUT_FILTER $actual + cat $actual_err >> $actual + + VERIFY output from $H5REPACK $@ + if cmp -s $expect $actual; then + echo " PASSED" + else + echo "*FAILED*" + echo " Expected result (*.tst) differs from actual result (*.out)" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && diff -c $expect $actual |sed 's/^/ /' + fi + + rm -f $actual $actual_err + rm -f $outfile +} + # same as TOOLTESTV but filters error stack output and compares to an error file # Extract file name, line number, version and thread IDs because they may be different # ADD_H5ERR_MASK_TEST @@ -1356,44 +1531,28 @@ TOOLTEST_STAT SPT $arg # layout options (these files have no filters) ######################################################### VERIFY_LAYOUT_DSET dset2_chunk_20x10 h5repack_layout.h5 dset2 CHUNKED --layout dset2:CHUNK=20x10 - VERIFY_LAYOUT_ALL chunk_20x10 h5repack_layout.h5 CHUNKED -l CHUNK=20x10 - VERIFY_LAYOUT_DSET dset2_conti h5repack_layout.h5 dset2 CONTIGUOUS -l dset2:CONTI - VERIFY_LAYOUT_ALL conti h5repack_layout.h5 CONTIGUOUS -l CONTI - VERIFY_LAYOUT_DSET dset2_compa h5repack_layout.h5 dset2 COMPACT -l dset2:COMPA - VERIFY_LAYOUT_ALL compa h5repack_layout.h5 COMPACT -l COMPA - TOOLTESTM dset2_chunk_20x10-errstk h5repack_layout.h5 --layout=dset2:CHUNK=20x10x5 --enable-error-stack ################################################################ # layout conversions (file has no filters) ############################################################### - VERIFY_LAYOUT_DSET dset_compa_conti h5repack_layout.h5 dset_compact CONTIGUOUS -l dset_compact:CONTI - VERIFY_LAYOUT_DSET dset_compa_chunk h5repack_layout.h5 dset_compact CHUNKED -l dset_compact:CHUNK=2x5 - VERIFY_LAYOUT_DSET dset_compa_compa h5repack_layout.h5 dset_compact COMPACT -l dset_compact:COMPA - VERIFY_LAYOUT_DSET dset_conti_compa h5repack_layout.h5 dset_contiguous COMPACT -l dset_contiguous:COMPA - VERIFY_LAYOUT_DSET dset_conti_chunk h5repack_layout.h5 dset_contiguous CHUNKED -l dset_contiguous:CHUNK=3x6 - VERIFY_LAYOUT_DSET dset_conti_conti h5repack_layout.h5 dset_contiguous CONTIGUOUS -l dset_contiguous:CONTI - VERIFY_LAYOUT_DSET chunk_compa h5repack_layout.h5 dset_chunk COMPACT -l dset_chunk:COMPA - VERIFY_LAYOUT_DSET chunk_conti h5repack_layout.h5 dset_chunk CONTIGUOUS -l dset_chunk:CONTI - VERIFY_LAYOUT_DSET chunk_18x13 h5repack_layout.h5 dset_chunk CHUNKED -l dset_chunk:CHUNK=18x13 # test convert small size dataset ( < 1k) to compact layout without -m VERIFY_LAYOUT_DSET contig_small_compa h5repack_layout2.h5 contig_small COMPACT -l contig_small:COMPA - VERIFY_LAYOUT_DSET contig_small_fixed_compa h5repack_layout2.h5 chunked_small_fixed COMPACT -l chunked_small_fixed:COMPA #--------------------------------------------------------------------------- @@ -1421,6 +1580,7 @@ VERIFY_LAYOUT_DSET chunk2compa h5repack_layout3.h5 chunk_unlimit1 CHUNK -l chunk # chunk dim is bigger than dataset dim. ( dset size < 64k ) VERIFY_LAYOUT_DSET error1 h5repack_layout3.h5 chunk_unlimit1 H5S_UNLIMITED -f chunk_unlimit1:NONE # chunk dim is bigger than dataset dim. ( dset size > 64k ) + VERIFY_LAYOUT_DSET error2 h5repack_layout3.h5 chunk_unlimit2 H5S_UNLIMITED -f chunk_unlimit2:NONE # chunk dims are smaller than dataset dims. ( dset size < 64k ) @@ -1435,7 +1595,6 @@ TOOLTEST error4 h5repack_layout3.h5 -f NONE # (dset size < 64K) and with unlimited max dims on a condition as follow. # (HDFFV-8214) #-------------------------------------------------------------------------- - # chunk dim is bigger than dataset dim. should succeed. VERIFY_LAYOUT_DSET ckdim_biger h5repack_layout3.h5 chunk_unlimit2 CONTI -l chunk_unlimit2:CONTI # chunk dim is smaller than dataset dim. should succeed. @@ -1466,7 +1625,6 @@ else fi # several global filters - arg="h5repack_layout.h5 --filter GZIP=1 --filter SHUF" if test $USE_FILTER_DEFLATE != "yes" ; then SKIP $arg @@ -1562,9 +1720,15 @@ else VERIFY_LAYOUT_VDS vds_conti 4_vds.h5 vds_dset CONTIGUOUS -l vds_dset:CONTI fi -######################################################### -# Testing version bounds -######################################################### +################################################################ +# reference new api conversions +############################################################### +#TOOLTEST_DUMP attrregion tattrreg.h5 +#TOOLTEST_DUMP dataregion tdatareg.h5 + +############################################################################## +### V E R S I O N B O U N D S T E S T S +############################################################################## # -j 0 -k 2, superblock will be 0 VERIFY_SUPERBLOCK 0 2 0 h5repack_layout.h5 -j 0 -k 2 h5repack_layout.h5 # -j 1 -k 2, superblock will be 2 @@ -1574,11 +1738,49 @@ VERIFY_SUPERBLOCK 2 2 3 h5repack_layout.h5 -j 2 -k 2 h5repack_layout.h5 # -j 0 -k 1, file cannot be opened VERIFY_INVALIDBOUNDS 0 1 bounds_latest_latest.h5 -######################################## -# Testing external storage -######################################## +############################################################################## +### E X T E R N A L S T O R A G E T E S T S +############################################################################## VERIFY_EXTERNAL_CONSOLIDATION -l CONTI +############################################################################## +### E X T E R N A L L I N K T E S T S +############################################################################## +### HDFFV-11128 needs fixed to enable the following test +#TOOLTEST_DUMP h5copy_extlinks_src-base h5copy_extlinks_src.h5 --enable-error-stack +TOOLTEST_DUMP tsoftlinks-base tsoftlinks.h5 --enable-error-stack +TOOLTEST_DUMP textlink-base textlink.h5 --enable-error-stack +TOOLTEST_DUMP textlinkfar-base textlinkfar.h5 --enable-error-stack +TOOLTEST_DUMP textlinksrc-base textlinksrc.h5 --enable-error-stack +TOOLTEST_DUMP textlinktar-base textlinktar.h5 --enable-error-stack + +TOOLTESTSV h5copy_extlinks_src-merge h5copy_extlinks_src.h5 --merge +TOOLFAILSV tsoftlinks-merge tsoftlinks.h5 --merge +TOOLTESTSV textlink-merge textlink.h5 --merge +### HDFFV-11128 needs fixed to enable the following test +#TOOLFAILSV textlinkfar-merge textlinkfar.h5 --merge +### HDFFV-11128 needs fixed to enable the following test +#TOOLFAILSV textlinksrc-merge textlinksrc.h5 --merge +### HDFFV-11128 needs fixed to enable the following test +#TOOLFAILSV textlinktar-merge textlinktar.h5 --merge + +TOOLTEST_DUMP h5copy_extlinks_src-prune h5copy_extlinks_src.h5 --prune --enable-error-stack +TOOLTEST_DUMP tsoftlinks-prune tsoftlinks.h5 --prune --enable-error-stack +TOOLTEST_DUMP textlink-prune textlink.h5 --prune --enable-error-stack +TOOLTEST_DUMP textlinkfar-prune textlinkfar.h5 --prune --enable-error-stack +TOOLTEST_DUMP textlinksrc-prune textlinksrc.h5 --prune --enable-error-stack +TOOLTEST_DUMP textlinktar-prune textlinktar.h5 --prune --enable-error-stack + +TOOLTEST_DUMP h5copy_extlinks_src-mergeprune h5copy_extlinks_src.h5 --merge --prune --enable-error-stack +TOOLTEST_DUMP tsoftlinks-mergeprune tsoftlinks.h5 --merge --prune --enable-error-stack +TOOLTEST_DUMP textlink-mergeprune textlink.h5 --merge --prune --enable-error-stack +### HDFFV-11128 needs fixed to enable the following test +#TOOLTEST_DUMP textlinkfar-mergeprune textlinkfar.h5 --merge --prune --enable-error-stack +### HDFFV-11128 needs fixed to enable the following test +#TOOLTEST_DUMP textlinksrc-mergeprune textlinksrc.h5 --merge --prune --enable-error-stack +### HDFFV-11128 needs fixed to enable the following test +#TOOLTEST_DUMP textlinktar-mergeprune textlinktar.h5 --merge --prune --enable-error-stack + # Clean up temporary files/directories CLEAN_TESTFILES_AND_TESTDIR diff --git a/tools/test/h5repack/h5repacktst.c b/tools/test/h5repack/h5repacktst.c index ab0dbb7..2666e95 100644 --- a/tools/test/h5repack/h5repacktst.c +++ b/tools/test/h5repack/h5repacktst.c @@ -3872,7 +3872,7 @@ out: * * Purpose: write datasets in LOC_ID * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: November 12, 2003 * @@ -4736,7 +4736,7 @@ out: * * Purpose: write attributes in LOC_ID (dataset, group, named datatype) * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: November 12, 2003 * @@ -5927,7 +5927,7 @@ out: * * Purpose: utility function to create and write a dataset in LOC_ID * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: November 12, 2003 * @@ -5963,7 +5963,7 @@ out: * * Purpose: utility function to create and write a dataset in LOC_ID * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: November 12, 2003 * @@ -6011,7 +6011,7 @@ out: * * Purpose: utility function to write an attribute in LOC_ID * -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu +* Programmer: Pedro Vicente * * Date: November 12, 2003 * diff --git a/tools/test/h5repack/testfiles/h5copy_extlinks_src-base.h5copy_extlinks_src.h5.ddl b/tools/test/h5repack/testfiles/h5copy_extlinks_src-base.h5copy_extlinks_src.h5.ddl new file mode 100644 index 0000000..ad8a320 --- /dev/null +++ b/tools/test/h5repack/testfiles/h5copy_extlinks_src-base.h5copy_extlinks_src.h5.ddl @@ -0,0 +1,28 @@ +HDF5 "out-h5copy_extlinks_src-mergeprune.h5copy_extlinks_src.h5" { +GROUP "/" { + GROUP "group_ext" { + DATATYPE "extlink_datatype" H5T_STD_I32LE; + DATASET "extlink_dset" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 6 ) / ( 6 ) } + STORAGE_LAYOUT { + CONTIGUOUS + SIZE 24 + OFFSET 2200 + } + FILTERS { + NONE + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE H5D_FILL_VALUE_DEFAULT + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_LATE + } + } + GROUP "extlink_grp" { + } + } +} +} diff --git a/tools/test/h5repack/testfiles/h5copy_extlinks_src-merge.h5copy_extlinks_src.h5.tst b/tools/test/h5repack/testfiles/h5copy_extlinks_src-merge.h5copy_extlinks_src.h5.tst new file mode 100644 index 0000000..52f215d --- /dev/null +++ b/tools/test/h5repack/testfiles/h5copy_extlinks_src-merge.h5copy_extlinks_src.h5.tst @@ -0,0 +1,26 @@ + +file1 file2 +--------------------------------------- + x x / + x x /group_ext + x x /group_ext/extlink_datatype + x x /group_ext/extlink_dset + x x /group_ext/extlink_grp + x x /group_ext/extlink_notyet1 + x x /group_ext/extlink_notyet2 + +group : and +0 differences found +group : and +0 differences found +Not comparable: is of type H5G_UDLINK and is of type H5G_TYPE +Not comparable: is of type H5G_UDLINK and is of type H5G_DATASET +Not comparable: is of type H5G_UDLINK and is of type H5G_GROUP +external link: and +0 differences found +external link: and +0 differences found +-------------------------------- +Some objects are not comparable +-------------------------------- +Use -c for a list of objects without details of differences. diff --git a/tools/test/h5repack/testfiles/h5copy_extlinks_src-mergeprune.h5copy_extlinks_src.h5.ddl b/tools/test/h5repack/testfiles/h5copy_extlinks_src-mergeprune.h5copy_extlinks_src.h5.ddl new file mode 100644 index 0000000..ad8a320 --- /dev/null +++ b/tools/test/h5repack/testfiles/h5copy_extlinks_src-mergeprune.h5copy_extlinks_src.h5.ddl @@ -0,0 +1,28 @@ +HDF5 "out-h5copy_extlinks_src-mergeprune.h5copy_extlinks_src.h5" { +GROUP "/" { + GROUP "group_ext" { + DATATYPE "extlink_datatype" H5T_STD_I32LE; + DATASET "extlink_dset" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 6 ) / ( 6 ) } + STORAGE_LAYOUT { + CONTIGUOUS + SIZE 24 + OFFSET 2200 + } + FILTERS { + NONE + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE H5D_FILL_VALUE_DEFAULT + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_LATE + } + } + GROUP "extlink_grp" { + } + } +} +} diff --git a/tools/test/h5repack/testfiles/h5copy_extlinks_src-prune.h5copy_extlinks_src.h5.ddl b/tools/test/h5repack/testfiles/h5copy_extlinks_src-prune.h5copy_extlinks_src.h5.ddl new file mode 100644 index 0000000..b7d7bca --- /dev/null +++ b/tools/test/h5repack/testfiles/h5copy_extlinks_src-prune.h5copy_extlinks_src.h5.ddl @@ -0,0 +1,6 @@ +HDF5 "out-h5copy_extlinks_src-prune.h5copy_extlinks_src.h5" { +GROUP "/" { + GROUP "group_ext" { + } +} +} diff --git a/tools/test/h5repack/testfiles/h5copy_extlinks_src.h5 b/tools/test/h5repack/testfiles/h5copy_extlinks_src.h5 new file mode 100644 index 0000000..7b8621e Binary files /dev/null and b/tools/test/h5repack/testfiles/h5copy_extlinks_src.h5 differ diff --git a/tools/test/h5repack/testfiles/h5copy_extlinks_trg.h5 b/tools/test/h5repack/testfiles/h5copy_extlinks_trg.h5 new file mode 100644 index 0000000..3a0242d Binary files /dev/null and b/tools/test/h5repack/testfiles/h5copy_extlinks_trg.h5 differ diff --git a/tools/test/h5repack/testfiles/h5repack-help.txt b/tools/test/h5repack/testfiles/h5repack-help.txt index 00fae24..e12838d 100644 --- a/tools/test/h5repack/testfiles/h5repack-help.txt +++ b/tools/test/h5repack/testfiles/h5repack-help.txt @@ -29,6 +29,9 @@ usage: h5repack [OPTIONS] file1 file2 --high=BOUND The high bound for library release versions to use when creating objects in the file (default is H5F_LIBVER_LATEST) + --merge Follow external soft link recursively and merge data + --prune Do not follow external soft links and remove link + --merge --prune Follow external link, merge data and remove dangling link -c L1, --compact=L1 Maximum number of links in header messages -d L2, --indexed=L2 Minimum number of links in the indexed format -s S[:F], --ssize=S[:F] Shared object header message minimum size diff --git a/tools/test/h5repack/testfiles/textlink-base.textlink.h5.ddl b/tools/test/h5repack/testfiles/textlink-base.textlink.h5.ddl new file mode 100644 index 0000000..b87a17d --- /dev/null +++ b/tools/test/h5repack/testfiles/textlink-base.textlink.h5.ddl @@ -0,0 +1,12 @@ +HDF5 "out-textlink-base.textlink.h5" { +GROUP "/" { + EXTERNAL_LINK "extlink1" { + TARGETFILE "filename" + TARGETPATH "objname" + } + EXTERNAL_LINK "extlink2" { + TARGETFILE "anotherfile" + TARGETPATH "anotherobj" + } +} +} diff --git a/tools/test/h5repack/testfiles/textlink-merge.textlink.h5.tst b/tools/test/h5repack/testfiles/textlink-merge.textlink.h5.tst new file mode 100644 index 0000000..a7ff71d --- /dev/null +++ b/tools/test/h5repack/testfiles/textlink-merge.textlink.h5.tst @@ -0,0 +1,13 @@ + +file1 file2 +--------------------------------------- + x x / + x x /extlink1 + x x /extlink2 + +group : and +0 differences found +external link: and +0 differences found +external link: and +0 differences found diff --git a/tools/test/h5repack/testfiles/textlink-mergeprune.textlink.h5.ddl b/tools/test/h5repack/testfiles/textlink-mergeprune.textlink.h5.ddl new file mode 100644 index 0000000..7206ae9 --- /dev/null +++ b/tools/test/h5repack/testfiles/textlink-mergeprune.textlink.h5.ddl @@ -0,0 +1,4 @@ +HDF5 "out-textlink-mergeprune.textlink.h5" { +GROUP "/" { +} +} diff --git a/tools/test/h5repack/testfiles/textlink-prune.textlink.h5.ddl b/tools/test/h5repack/testfiles/textlink-prune.textlink.h5.ddl new file mode 100644 index 0000000..83db344 --- /dev/null +++ b/tools/test/h5repack/testfiles/textlink-prune.textlink.h5.ddl @@ -0,0 +1,4 @@ +HDF5 "out-textlink-prune.textlink.h5" { +GROUP "/" { +} +} diff --git a/tools/test/h5repack/testfiles/textlinkfar-base.textlinkfar.h5.ddl b/tools/test/h5repack/testfiles/textlinkfar-base.textlinkfar.h5.ddl new file mode 100644 index 0000000..a5eb497 --- /dev/null +++ b/tools/test/h5repack/testfiles/textlinkfar-base.textlinkfar.h5.ddl @@ -0,0 +1,116 @@ +HDF5 "out-textlinkfar-base.textlinkfar.h5" { +GROUP "/" { + EXTERNAL_LINK "src_file" { + TARGETFILE "textlinksrc.h5" + TARGETPATH "/" + GROUP "/" { + EXTERNAL_LINK "ext2soft_link1" { + TARGETFILE "tsoftlinks.h5" + TARGETPATH "/soft_dset1" + DATASET "/soft_dset1" { + DATATYPE H5T_STD_I32BE + DATASPACE SIMPLE { ( 4, 2 ) / ( 4, 2 ) } + STORAGE_LAYOUT { + CONTIGUOUS + SIZE 32 + OFFSET 2848 + } + FILTERS { + NONE + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE H5D_FILL_VALUE_DEFAULT + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_LATE + } + } + } + EXTERNAL_LINK "ext2softdangle_link1" { + TARGETFILE "tsoftlinks.h5" + TARGETPATH "/soft_dangle" + } + EXTERNAL_LINK "ext_link1" { + TARGETFILE "textlinktar.h5" + TARGETPATH "group" + GROUP "group" { + DATASET "dset" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 6 ) / ( 6 ) } + STORAGE_LAYOUT { + CONTIGUOUS + SIZE 24 + OFFSET 3136 + } + FILTERS { + NONE + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE H5D_FILL_VALUE_DEFAULT + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_LATE + } + } + EXTERNAL_LINK "elink_t1" { + TARGETFILE "textlinksrc.h5" + TARGETPATH "/" + GROUP "/" { + HARDLINK "/" + } + } + EXTERNAL_LINK "elink_t2" { + TARGETFILE "textlinksrc.h5" + TARGETPATH "/ext_link4" + } + GROUP "subgroup" { + GROUP "link_to_group" { + HARDLINK "/group" + } + } + } + } + EXTERNAL_LINK "ext_link2" { + TARGETFILE "textlinktar.h5" + TARGETPATH "dset" + DATASET "dset" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 6 ) / ( 6 ) } + STORAGE_LAYOUT { + CONTIGUOUS + SIZE 24 + OFFSET 3160 + } + FILTERS { + NONE + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE H5D_FILL_VALUE_DEFAULT + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_LATE + } + } + } + EXTERNAL_LINK "ext_link3" { + TARGETFILE "textlinktar.h5" + TARGETPATH "type" + DATATYPE "type" H5T_STD_I32LE; + } + EXTERNAL_LINK "ext_link4" { + TARGETFILE "textlinktar.h5" + TARGETPATH "group/elink_t2" + } + EXTERNAL_LINK "ext_link5" { + TARGETFILE "textlinktar.h5" + TARGETPATH "empty_group" + GROUP "empty_group" { + } + } + } + } +} +} diff --git a/tools/test/h5repack/testfiles/textlinkfar-merge.textlinkfar.h5.tst b/tools/test/h5repack/testfiles/textlinkfar-merge.textlinkfar.h5.tst new file mode 100644 index 0000000..6673d39 --- /dev/null +++ b/tools/test/h5repack/testfiles/textlinkfar-merge.textlinkfar.h5.tst @@ -0,0 +1,20 @@ + +file1 file2 +--------------------------------------- + x x / + x x /src_file + x /src_file/ext2soft_link1 + x /src_file/ext2softdangle_link1 + x /src_file/ext_link1 + x /src_file/ext_link2 + x /src_file/ext_link3 + x /src_file/ext_link4 + x /src_file/ext_link5 + +group : and +0 differences found +Not comparable: is of type H5G_UDLINK and is of type H5G_GROUP +-------------------------------- +Some objects are not comparable +-------------------------------- +Use -c for a list of objects without details of differences. diff --git a/tools/test/h5repack/testfiles/textlinkfar-mergeprune.textlinkfar.h5.ddl b/tools/test/h5repack/testfiles/textlinkfar-mergeprune.textlinkfar.h5.ddl new file mode 100644 index 0000000..7ba3308 --- /dev/null +++ b/tools/test/h5repack/testfiles/textlinkfar-mergeprune.textlinkfar.h5.ddl @@ -0,0 +1,152 @@ +HDF5 "out-textlinkfar-mergeprune.textlinkfar.h5" { +GROUP "/" { + GROUP "src_file" { + EXTERNAL_LINK "ext2soft_link1" { + TARGETFILE "tsoftlinks.h5" + TARGETPATH "/soft_dset1" + DATASET "/soft_dset1" { + DATATYPE H5T_STD_I32BE + DATASPACE SIMPLE { ( 4, 2 ) / ( 4, 2 ) } + STORAGE_LAYOUT { + CONTIGUOUS + SIZE 32 + OFFSET 2848 + } + FILTERS { + NONE + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE H5D_FILL_VALUE_DEFAULT + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_LATE + } + } + } + EXTERNAL_LINK "ext2softdangle_link1" { + TARGETFILE "tsoftlinks.h5" + TARGETPATH "/soft_dangle" + } + EXTERNAL_LINK "ext_link1" { + TARGETFILE "textlinktar.h5" + TARGETPATH "group" + GROUP "group" { + DATASET "dset" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 6 ) / ( 6 ) } + STORAGE_LAYOUT { + CONTIGUOUS + SIZE 24 + OFFSET 3136 + } + FILTERS { + NONE + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE H5D_FILL_VALUE_DEFAULT + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_LATE + } + } + EXTERNAL_LINK "elink_t1" { + TARGETFILE "textlinksrc.h5" + TARGETPATH "/" + GROUP "/" { + EXTERNAL_LINK "ext2soft_link1" { + TARGETFILE "tsoftlinks.h5" + TARGETPATH "/soft_dset1" + DATASET "/soft_dset1" { + HARDLINK "/dset1" + } + } + EXTERNAL_LINK "ext2softdangle_link1" { + TARGETFILE "tsoftlinks.h5" + TARGETPATH "/soft_dangle" + } + EXTERNAL_LINK "ext_link1" { + TARGETFILE "textlinktar.h5" + TARGETPATH "group" + GROUP "group" { + HARDLINK "/group" + } + } + EXTERNAL_LINK "ext_link2" { + TARGETFILE "textlinktar.h5" + TARGETPATH "dset" + DATASET "dset" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 6 ) / ( 6 ) } + STORAGE_LAYOUT { + CONTIGUOUS + SIZE 24 + OFFSET 3160 + } + FILTERS { + NONE + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE H5D_FILL_VALUE_DEFAULT + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_LATE + } + } + } + EXTERNAL_LINK "ext_link3" { + TARGETFILE "textlinktar.h5" + TARGETPATH "type" + DATATYPE "type" H5T_STD_I32LE; + } + EXTERNAL_LINK "ext_link4" { + TARGETFILE "textlinktar.h5" + TARGETPATH "group/elink_t2" + } + EXTERNAL_LINK "ext_link5" { + TARGETFILE "textlinktar.h5" + TARGETPATH "empty_group" + GROUP "empty_group" { + } + } + } + } + EXTERNAL_LINK "elink_t2" { + TARGETFILE "textlinksrc.h5" + TARGETPATH "/ext_link4" + } + GROUP "subgroup" { + GROUP "link_to_group" { + HARDLINK "/group" + } + } + } + } + EXTERNAL_LINK "ext_link2" { + TARGETFILE "textlinktar.h5" + TARGETPATH "dset" + DATASET "dset" { + HARDLINK "/dset" + } + } + EXTERNAL_LINK "ext_link3" { + TARGETFILE "textlinktar.h5" + TARGETPATH "type" + DATATYPE "type" HARDLINK "/type" + } + EXTERNAL_LINK "ext_link4" { + TARGETFILE "textlinktar.h5" + TARGETPATH "group/elink_t2" + } + EXTERNAL_LINK "ext_link5" { + TARGETFILE "textlinktar.h5" + TARGETPATH "empty_group" + GROUP "empty_group" { + HARDLINK "/empty_group" + } + } + } +} +} diff --git a/tools/test/h5repack/testfiles/textlinkfar-prune.textlinkfar.h5.ddl b/tools/test/h5repack/testfiles/textlinkfar-prune.textlinkfar.h5.ddl new file mode 100644 index 0000000..30f8f1b --- /dev/null +++ b/tools/test/h5repack/testfiles/textlinkfar-prune.textlinkfar.h5.ddl @@ -0,0 +1,4 @@ +HDF5 "out-textlinkfar-prune.textlinkfar.h5" { +GROUP "/" { +} +} diff --git a/tools/test/h5repack/testfiles/textlinksrc-base.textlinksrc.h5.ddl b/tools/test/h5repack/testfiles/textlinksrc-base.textlinksrc.h5.ddl new file mode 100644 index 0000000..9a9a9aa --- /dev/null +++ b/tools/test/h5repack/testfiles/textlinksrc-base.textlinksrc.h5.ddl @@ -0,0 +1,150 @@ +HDF5 "out-textlinksrc-base.textlinksrc.h5" { +GROUP "/" { + EXTERNAL_LINK "ext2soft_link1" { + TARGETFILE "tsoftlinks.h5" + TARGETPATH "/soft_dset1" + DATASET "/soft_dset1" { + DATATYPE H5T_STD_I32BE + DATASPACE SIMPLE { ( 4, 2 ) / ( 4, 2 ) } + STORAGE_LAYOUT { + CONTIGUOUS + SIZE 32 + OFFSET 2848 + } + FILTERS { + NONE + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE H5D_FILL_VALUE_DEFAULT + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_LATE + } + } + } + EXTERNAL_LINK "ext2softdangle_link1" { + TARGETFILE "tsoftlinks.h5" + TARGETPATH "/soft_dangle" + } + EXTERNAL_LINK "ext_link1" { + TARGETFILE "textlinktar.h5" + TARGETPATH "group" + GROUP "group" { + DATASET "dset" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 6 ) / ( 6 ) } + STORAGE_LAYOUT { + CONTIGUOUS + SIZE 24 + OFFSET 3136 + } + FILTERS { + NONE + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE H5D_FILL_VALUE_DEFAULT + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_LATE + } + } + EXTERNAL_LINK "elink_t1" { + TARGETFILE "textlinksrc.h5" + TARGETPATH "/" + GROUP "/" { + EXTERNAL_LINK "ext2soft_link1" { + TARGETFILE "tsoftlinks.h5" + TARGETPATH "/soft_dset1" + DATASET "/soft_dset1" { + HARDLINK "/dset1" + } + } + EXTERNAL_LINK "ext2softdangle_link1" { + TARGETFILE "tsoftlinks.h5" + TARGETPATH "/soft_dangle" + } + EXTERNAL_LINK "ext_link1" { + TARGETFILE "textlinktar.h5" + TARGETPATH "group" + GROUP "group" { + HARDLINK "/group" + } + } + EXTERNAL_LINK "ext_link2" { + TARGETFILE "textlinktar.h5" + TARGETPATH "dset" + DATASET "dset" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 6 ) / ( 6 ) } + STORAGE_LAYOUT { + CONTIGUOUS + SIZE 24 + OFFSET 3160 + } + FILTERS { + NONE + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE H5D_FILL_VALUE_DEFAULT + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_LATE + } + } + } + EXTERNAL_LINK "ext_link3" { + TARGETFILE "textlinktar.h5" + TARGETPATH "type" + DATATYPE "type" H5T_STD_I32LE; + } + EXTERNAL_LINK "ext_link4" { + TARGETFILE "textlinktar.h5" + TARGETPATH "group/elink_t2" + } + EXTERNAL_LINK "ext_link5" { + TARGETFILE "textlinktar.h5" + TARGETPATH "empty_group" + GROUP "empty_group" { + } + } + } + } + EXTERNAL_LINK "elink_t2" { + TARGETFILE "textlinksrc.h5" + TARGETPATH "/ext_link4" + } + GROUP "subgroup" { + GROUP "link_to_group" { + HARDLINK "/group" + } + } + } + } + EXTERNAL_LINK "ext_link2" { + TARGETFILE "textlinktar.h5" + TARGETPATH "dset" + DATASET "dset" { + HARDLINK "/dset" + } + } + EXTERNAL_LINK "ext_link3" { + TARGETFILE "textlinktar.h5" + TARGETPATH "type" + DATATYPE "type" HARDLINK "/type" + } + EXTERNAL_LINK "ext_link4" { + TARGETFILE "textlinktar.h5" + TARGETPATH "group/elink_t2" + } + EXTERNAL_LINK "ext_link5" { + TARGETFILE "textlinktar.h5" + TARGETPATH "empty_group" + GROUP "empty_group" { + HARDLINK "/empty_group" + } + } +} +} diff --git a/tools/test/h5repack/testfiles/textlinksrc-merge.textlinksrc.h5.tst b/tools/test/h5repack/testfiles/textlinksrc-merge.textlinksrc.h5.tst new file mode 100644 index 0000000..d5a5902 --- /dev/null +++ b/tools/test/h5repack/testfiles/textlinksrc-merge.textlinksrc.h5.tst @@ -0,0 +1,32 @@ + +file1 file2 +--------------------------------------- + x x / + x x /ext2soft_link1 + x x /ext2softdangle_link1 + x x /ext_link1 + x /ext_link1/dset + x /ext_link1/elink_t1 + x /ext_link1/elink_t2 + x /ext_link1/subgroup + x /ext_link1/subgroup/link_to_group + x x /ext_link2 + x x /ext_link3 + x x /ext_link4 + x x /ext_link5 + +group : and +0 differences found +Not comparable: is of type H5G_UDLINK and is of type H5G_DATASET +external link: and +0 differences found +Not comparable: is of type H5G_UDLINK and is of type H5G_GROUP +Not comparable: is of type H5G_UDLINK and is of type H5G_DATASET +Not comparable: is of type H5G_UDLINK and is of type H5G_TYPE +external link: and +0 differences found +Not comparable: is of type H5G_UDLINK and is of type H5G_GROUP +-------------------------------- +Some objects are not comparable +-------------------------------- +Use -c for a list of objects without details of differences. diff --git a/tools/test/h5repack/testfiles/textlinksrc-mergeprune.textlinksrc.h5.ddl b/tools/test/h5repack/testfiles/textlinksrc-mergeprune.textlinksrc.h5.ddl new file mode 100644 index 0000000..5b3c740 --- /dev/null +++ b/tools/test/h5repack/testfiles/textlinksrc-mergeprune.textlinksrc.h5.ddl @@ -0,0 +1,187 @@ +HDF5 "out-textlinksrc-mergeprune.textlinksrc.h5" { +GROUP "/" { + DATASET "ext2soft_link1" { + DATATYPE H5T_STD_I32BE + DATASPACE SIMPLE { ( 4, 2 ) / ( 4, 2 ) } + STORAGE_LAYOUT { + CONTIGUOUS + SIZE 32 + OFFSET 2048 + } + FILTERS { + NONE + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE H5D_FILL_VALUE_DEFAULT + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_LATE + } + } + GROUP "ext_link1" { + DATASET "dset" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 6 ) / ( 6 ) } + STORAGE_LAYOUT { + CONTIGUOUS + SIZE 24 + OFFSET 2080 + } + FILTERS { + NONE + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE H5D_FILL_VALUE_DEFAULT + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_LATE + } + } + EXTERNAL_LINK "elink_t1" { + TARGETFILE "textlinksrc.h5" + TARGETPATH "/" + GROUP "/" { + EXTERNAL_LINK "ext2soft_link1" { + TARGETFILE "tsoftlinks.h5" + TARGETPATH "/soft_dset1" + DATASET "/soft_dset1" { + DATATYPE H5T_STD_I32BE + DATASPACE SIMPLE { ( 4, 2 ) / ( 4, 2 ) } + STORAGE_LAYOUT { + CONTIGUOUS + SIZE 32 + OFFSET 2848 + } + FILTERS { + NONE + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE H5D_FILL_VALUE_DEFAULT + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_LATE + } + } + } + EXTERNAL_LINK "ext2softdangle_link1" { + TARGETFILE "tsoftlinks.h5" + TARGETPATH "/soft_dangle" + } + EXTERNAL_LINK "ext_link1" { + TARGETFILE "textlinktar.h5" + TARGETPATH "group" + GROUP "group" { + DATASET "dset" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 6 ) / ( 6 ) } + STORAGE_LAYOUT { + CONTIGUOUS + SIZE 24 + OFFSET 3136 + } + FILTERS { + NONE + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE H5D_FILL_VALUE_DEFAULT + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_LATE + } + } + EXTERNAL_LINK "elink_t1" { + TARGETFILE "textlinksrc.h5" + TARGETPATH "/" + GROUP "/" { + HARDLINK "/" + } + } + EXTERNAL_LINK "elink_t2" { + TARGETFILE "textlinksrc.h5" + TARGETPATH "/ext_link4" + } + GROUP "subgroup" { + GROUP "link_to_group" { + HARDLINK "/group" + } + } + } + } + EXTERNAL_LINK "ext_link2" { + TARGETFILE "textlinktar.h5" + TARGETPATH "dset" + DATASET "dset" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 6 ) / ( 6 ) } + STORAGE_LAYOUT { + CONTIGUOUS + SIZE 24 + OFFSET 3160 + } + FILTERS { + NONE + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE H5D_FILL_VALUE_DEFAULT + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_LATE + } + } + } + EXTERNAL_LINK "ext_link3" { + TARGETFILE "textlinktar.h5" + TARGETPATH "type" + DATATYPE "type" H5T_STD_I32LE; + } + EXTERNAL_LINK "ext_link4" { + TARGETFILE "textlinktar.h5" + TARGETPATH "group/elink_t2" + } + EXTERNAL_LINK "ext_link5" { + TARGETFILE "textlinktar.h5" + TARGETPATH "empty_group" + GROUP "empty_group" { + } + } + } + } + EXTERNAL_LINK "elink_t2" { + TARGETFILE "textlinksrc.h5" + TARGETPATH "/ext_link4" + } + GROUP "subgroup" { + GROUP "link_to_group" { + HARDLINK "/ext_link1" + } + } + } + DATASET "ext_link2" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 6 ) / ( 6 ) } + STORAGE_LAYOUT { + CONTIGUOUS + SIZE 24 + OFFSET 2104 + } + FILTERS { + NONE + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE H5D_FILL_VALUE_DEFAULT + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_LATE + } + } + DATATYPE "ext_link3" H5T_STD_I32LE; + GROUP "ext_link5" { + } +} +} diff --git a/tools/test/h5repack/testfiles/textlinksrc-prune.textlinksrc.h5.ddl b/tools/test/h5repack/testfiles/textlinksrc-prune.textlinksrc.h5.ddl new file mode 100644 index 0000000..65d35ef --- /dev/null +++ b/tools/test/h5repack/testfiles/textlinksrc-prune.textlinksrc.h5.ddl @@ -0,0 +1,4 @@ +HDF5 "out-textlinksrc-prune.textlinksrc.h5" { +GROUP "/" { +} +} diff --git a/tools/test/h5repack/testfiles/textlinktar-base.textlinktar.h5.ddl b/tools/test/h5repack/testfiles/textlinktar-base.textlinktar.h5.ddl new file mode 100644 index 0000000..3f02ff2 --- /dev/null +++ b/tools/test/h5repack/testfiles/textlinktar-base.textlinktar.h5.ddl @@ -0,0 +1,168 @@ +HDF5 "out-textlinktar-base.textlinktar.h5" { +GROUP "/" { + DATASET "dset" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 6 ) / ( 6 ) } + STORAGE_LAYOUT { + CONTIGUOUS + SIZE 24 + OFFSET 2048 + } + FILTERS { + NONE + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE H5D_FILL_VALUE_DEFAULT + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_LATE + } + } + GROUP "empty_group" { + } + GROUP "group" { + DATASET "dset" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 6 ) / ( 6 ) } + STORAGE_LAYOUT { + CONTIGUOUS + SIZE 24 + OFFSET 2072 + } + FILTERS { + NONE + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE H5D_FILL_VALUE_DEFAULT + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_LATE + } + } + EXTERNAL_LINK "elink_t1" { + TARGETFILE "textlinksrc.h5" + TARGETPATH "/" + GROUP "/" { + EXTERNAL_LINK "ext2soft_link1" { + TARGETFILE "tsoftlinks.h5" + TARGETPATH "/soft_dset1" + DATASET "/soft_dset1" { + DATATYPE H5T_STD_I32BE + DATASPACE SIMPLE { ( 4, 2 ) / ( 4, 2 ) } + STORAGE_LAYOUT { + CONTIGUOUS + SIZE 32 + OFFSET 2848 + } + FILTERS { + NONE + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE H5D_FILL_VALUE_DEFAULT + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_LATE + } + } + } + EXTERNAL_LINK "ext2softdangle_link1" { + TARGETFILE "tsoftlinks.h5" + TARGETPATH "/soft_dangle" + } + EXTERNAL_LINK "ext_link1" { + TARGETFILE "textlinktar.h5" + TARGETPATH "group" + GROUP "group" { + DATASET "dset" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 6 ) / ( 6 ) } + STORAGE_LAYOUT { + CONTIGUOUS + SIZE 24 + OFFSET 3136 + } + FILTERS { + NONE + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE H5D_FILL_VALUE_DEFAULT + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_LATE + } + } + EXTERNAL_LINK "elink_t1" { + TARGETFILE "textlinksrc.h5" + TARGETPATH "/" + GROUP "/" { + HARDLINK "/" + } + } + EXTERNAL_LINK "elink_t2" { + TARGETFILE "textlinksrc.h5" + TARGETPATH "/ext_link4" + } + GROUP "subgroup" { + GROUP "link_to_group" { + HARDLINK "/group" + } + } + } + } + EXTERNAL_LINK "ext_link2" { + TARGETFILE "textlinktar.h5" + TARGETPATH "dset" + DATASET "dset" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 6 ) / ( 6 ) } + STORAGE_LAYOUT { + CONTIGUOUS + SIZE 24 + OFFSET 3160 + } + FILTERS { + NONE + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE H5D_FILL_VALUE_DEFAULT + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_LATE + } + } + } + EXTERNAL_LINK "ext_link3" { + TARGETFILE "textlinktar.h5" + TARGETPATH "type" + DATATYPE "type" H5T_STD_I32LE; + } + EXTERNAL_LINK "ext_link4" { + TARGETFILE "textlinktar.h5" + TARGETPATH "group/elink_t2" + } + EXTERNAL_LINK "ext_link5" { + TARGETFILE "textlinktar.h5" + TARGETPATH "empty_group" + GROUP "empty_group" { + } + } + } + } + EXTERNAL_LINK "elink_t2" { + TARGETFILE "textlinksrc.h5" + TARGETPATH "/ext_link4" + } + GROUP "subgroup" { + GROUP "link_to_group" { + HARDLINK "/group" + } + } + } + DATATYPE "type" H5T_STD_I32LE; +} +} diff --git a/tools/test/h5repack/testfiles/textlinktar-merge.textlinktar.h5.tst b/tools/test/h5repack/testfiles/textlinktar-merge.textlinktar.h5.tst new file mode 100644 index 0000000..ccf4f7b --- /dev/null +++ b/tools/test/h5repack/testfiles/textlinktar-merge.textlinktar.h5.tst @@ -0,0 +1,44 @@ + +file1 file2 +--------------------------------------- + x x / + x x /dset + x x /empty_group + x x /group + x x /group/dset + x x /group/elink_t1 + x /group/elink_t1/ext2soft_link1 + x /group/elink_t1/ext2softdangle_link1 + x /group/elink_t1/ext_link1 + x /group/elink_t1/ext_link2 + x /group/elink_t1/ext_link3 + x /group/elink_t1/ext_link4 + x /group/elink_t1/ext_link5 + x x /group/elink_t2 + x x /group/subgroup + x x /group/subgroup/link_to_group + x x /type + +group : and +0 differences found +dataset: and +0 differences found +group : and +0 differences found +group : and +0 differences found +dataset: and +0 differences found +Not comparable: is of type H5G_UDLINK and is of type H5G_GROUP +external link: and +0 differences found +group : and +0 differences found +group : and +0 differences found +datatype: and +0 differences found +-------------------------------- +Some objects are not comparable +-------------------------------- +Use -c for a list of objects without details of differences. diff --git a/tools/test/h5repack/testfiles/textlinktar-mergeprune.textlinktar.h5.ddl b/tools/test/h5repack/testfiles/textlinktar-mergeprune.textlinktar.h5.ddl new file mode 100644 index 0000000..c52e34d --- /dev/null +++ b/tools/test/h5repack/testfiles/textlinktar-mergeprune.textlinktar.h5.ddl @@ -0,0 +1,200 @@ +HDF5 "out-textlinktar-mergeprune.textlinktar.h5" { +GROUP "/" { + DATASET "dset" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 6 ) / ( 6 ) } + STORAGE_LAYOUT { + CONTIGUOUS + SIZE 24 + OFFSET 2048 + } + FILTERS { + NONE + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE H5D_FILL_VALUE_DEFAULT + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_LATE + } + } + GROUP "empty_group" { + } + GROUP "group" { + DATASET "dset" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 6 ) / ( 6 ) } + STORAGE_LAYOUT { + CONTIGUOUS + SIZE 24 + OFFSET 2072 + } + FILTERS { + NONE + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE H5D_FILL_VALUE_DEFAULT + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_LATE + } + } + GROUP "elink_t1" { + EXTERNAL_LINK "ext2soft_link1" { + TARGETFILE "tsoftlinks.h5" + TARGETPATH "/soft_dset1" + DATASET "/soft_dset1" { + DATATYPE H5T_STD_I32BE + DATASPACE SIMPLE { ( 4, 2 ) / ( 4, 2 ) } + STORAGE_LAYOUT { + CONTIGUOUS + SIZE 32 + OFFSET 2848 + } + FILTERS { + NONE + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE H5D_FILL_VALUE_DEFAULT + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_LATE + } + } + } + EXTERNAL_LINK "ext2softdangle_link1" { + TARGETFILE "tsoftlinks.h5" + TARGETPATH "/soft_dangle" + } + EXTERNAL_LINK "ext_link1" { + TARGETFILE "textlinktar.h5" + TARGETPATH "group" + GROUP "group" { + DATASET "dset" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 6 ) / ( 6 ) } + STORAGE_LAYOUT { + CONTIGUOUS + SIZE 24 + OFFSET 3136 + } + FILTERS { + NONE + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE H5D_FILL_VALUE_DEFAULT + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_LATE + } + } + EXTERNAL_LINK "elink_t1" { + TARGETFILE "textlinksrc.h5" + TARGETPATH "/" + GROUP "/" { + EXTERNAL_LINK "ext2soft_link1" { + TARGETFILE "tsoftlinks.h5" + TARGETPATH "/soft_dset1" + DATASET "/soft_dset1" { + HARDLINK "/dset1" + } + } + EXTERNAL_LINK "ext2softdangle_link1" { + TARGETFILE "tsoftlinks.h5" + TARGETPATH "/soft_dangle" + } + EXTERNAL_LINK "ext_link1" { + TARGETFILE "textlinktar.h5" + TARGETPATH "group" + GROUP "group" { + HARDLINK "/group" + } + } + EXTERNAL_LINK "ext_link2" { + TARGETFILE "textlinktar.h5" + TARGETPATH "dset" + DATASET "dset" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 6 ) / ( 6 ) } + STORAGE_LAYOUT { + CONTIGUOUS + SIZE 24 + OFFSET 3160 + } + FILTERS { + NONE + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE H5D_FILL_VALUE_DEFAULT + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_LATE + } + } + } + EXTERNAL_LINK "ext_link3" { + TARGETFILE "textlinktar.h5" + TARGETPATH "type" + DATATYPE "type" H5T_STD_I32LE; + } + EXTERNAL_LINK "ext_link4" { + TARGETFILE "textlinktar.h5" + TARGETPATH "group/elink_t2" + } + EXTERNAL_LINK "ext_link5" { + TARGETFILE "textlinktar.h5" + TARGETPATH "empty_group" + GROUP "empty_group" { + } + } + } + } + EXTERNAL_LINK "elink_t2" { + TARGETFILE "textlinksrc.h5" + TARGETPATH "/ext_link4" + } + GROUP "subgroup" { + GROUP "link_to_group" { + HARDLINK "/group" + } + } + } + } + EXTERNAL_LINK "ext_link2" { + TARGETFILE "textlinktar.h5" + TARGETPATH "dset" + DATASET "dset" { + HARDLINK "/dset" + } + } + EXTERNAL_LINK "ext_link3" { + TARGETFILE "textlinktar.h5" + TARGETPATH "type" + DATATYPE "type" HARDLINK "/type" + } + EXTERNAL_LINK "ext_link4" { + TARGETFILE "textlinktar.h5" + TARGETPATH "group/elink_t2" + } + EXTERNAL_LINK "ext_link5" { + TARGETFILE "textlinktar.h5" + TARGETPATH "empty_group" + GROUP "empty_group" { + HARDLINK "/empty_group" + } + } + } + GROUP "subgroup" { + GROUP "link_to_group" { + HARDLINK "/group" + } + } + } + DATATYPE "type" H5T_STD_I32LE; +} +} diff --git a/tools/test/h5repack/testfiles/textlinktar-prune.textlinktar.h5.ddl b/tools/test/h5repack/testfiles/textlinktar-prune.textlinktar.h5.ddl new file mode 100644 index 0000000..6787784 --- /dev/null +++ b/tools/test/h5repack/testfiles/textlinktar-prune.textlinktar.h5.ddl @@ -0,0 +1,52 @@ +HDF5 "out-textlinktar-prune.textlinktar.h5" { +GROUP "/" { + DATASET "dset" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 6 ) / ( 6 ) } + STORAGE_LAYOUT { + CONTIGUOUS + SIZE 24 + OFFSET 2048 + } + FILTERS { + NONE + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE H5D_FILL_VALUE_DEFAULT + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_LATE + } + } + GROUP "empty_group" { + } + GROUP "group" { + DATASET "dset" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 6 ) / ( 6 ) } + STORAGE_LAYOUT { + CONTIGUOUS + SIZE 24 + OFFSET 2072 + } + FILTERS { + NONE + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE H5D_FILL_VALUE_DEFAULT + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_LATE + } + } + GROUP "subgroup" { + GROUP "link_to_group" { + HARDLINK "/group" + } + } + } + DATATYPE "type" H5T_STD_I32LE; +} +} diff --git a/tools/test/h5repack/testfiles/tsoftlinks-base.tsoftlinks.h5.ddl b/tools/test/h5repack/testfiles/tsoftlinks-base.tsoftlinks.h5.ddl new file mode 100644 index 0000000..b0cd32d --- /dev/null +++ b/tools/test/h5repack/testfiles/tsoftlinks-base.tsoftlinks.h5.ddl @@ -0,0 +1,77 @@ +HDF5 "out-tsoftlinks-base.tsoftlinks.h5" { +GROUP "/" { + DATASET "dset1" { + DATATYPE H5T_STD_I32BE + DATASPACE SIMPLE { ( 4, 2 ) / ( 4, 2 ) } + STORAGE_LAYOUT { + CONTIGUOUS + SIZE 32 + OFFSET 2048 + } + FILTERS { + NONE + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE H5D_FILL_VALUE_DEFAULT + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_LATE + } + } + DATASET "dset2" { + DATATYPE H5T_STD_I32BE + DATASPACE SIMPLE { ( 4, 2 ) / ( 4, 2 ) } + STORAGE_LAYOUT { + CONTIGUOUS + SIZE 32 + OFFSET 2080 + } + FILTERS { + NONE + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE H5D_FILL_VALUE_DEFAULT + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_LATE + } + } + DATATYPE "dtype" H5T_STD_I32BE; + GROUP "group1" { + SOFTLINK "soft_dangle" { + LINKTARGET "not_yet" + } + SOFTLINK "soft_dset1" { + LINKTARGET "/dset1" + } + SOFTLINK "soft_dset2" { + LINKTARGET "/dset2" + } + SOFTLINK "soft_dtype" { + LINKTARGET "/dtype" + } + SOFTLINK "soft_empty_grp" { + LINKTARGET "/group_empty" + } + } + GROUP "group_empty" { + } + SOFTLINK "soft_dangle" { + LINKTARGET "not_yet" + } + SOFTLINK "soft_dset1" { + LINKTARGET "/dset1" + } + SOFTLINK "soft_dtype" { + LINKTARGET "/dtype" + } + SOFTLINK "soft_empty_grp" { + LINKTARGET "/group_empty" + } + SOFTLINK "soft_group1" { + LINKTARGET "/group1" + } +} +} diff --git a/tools/test/h5repack/testfiles/tsoftlinks-merge.tsoftlinks.h5.tst b/tools/test/h5repack/testfiles/tsoftlinks-merge.tsoftlinks.h5.tst new file mode 100644 index 0000000..27c33d7 --- /dev/null +++ b/tools/test/h5repack/testfiles/tsoftlinks-merge.tsoftlinks.h5.tst @@ -0,0 +1,53 @@ + +file1 file2 +--------------------------------------- + x x / + x x /dset1 + x x /dset2 + x x /dtype + x x /group1 + x x /group1/soft_dangle + x x /group1/soft_dset1 + x x /group1/soft_dset2 + x x /group1/soft_dtype + x x /group1/soft_empty_grp + x x /group_empty + x x /soft_dangle + x x /soft_dset1 + x x /soft_dtype + x x /soft_empty_grp + x x /soft_group1 + x /soft_group1/soft_dangle + x /soft_group1/soft_dset1 + x /soft_group1/soft_dset2 + x /soft_group1/soft_dtype + x /soft_group1/soft_empty_grp + +group : and +0 differences found +dataset: and +0 differences found +dataset: and +0 differences found +datatype: and +0 differences found +group : and +0 differences found +link : and +0 differences found +Not comparable: is of type H5G_LINK and is of type H5G_DATASET +Not comparable: is of type H5G_LINK and is of type H5G_DATASET +Not comparable: is of type H5G_LINK and is of type H5G_TYPE +Not comparable: is of type H5G_LINK and is of type H5G_GROUP +group : and +0 differences found +link : and +0 differences found +Not comparable: is of type H5G_LINK and is of type H5G_DATASET +Not comparable: is of type H5G_LINK and is of type H5G_TYPE +Not comparable: is of type H5G_LINK and is of type H5G_GROUP +Not comparable: is of type H5G_LINK and is of type H5G_GROUP +-------------------------------- +Some objects are not comparable +-------------------------------- +Use -c for a list of objects without details of differences. diff --git a/tools/test/h5repack/testfiles/tsoftlinks-mergeprune.tsoftlinks.h5.ddl b/tools/test/h5repack/testfiles/tsoftlinks-mergeprune.tsoftlinks.h5.ddl new file mode 100644 index 0000000..fa4e12d --- /dev/null +++ b/tools/test/h5repack/testfiles/tsoftlinks-mergeprune.tsoftlinks.h5.ddl @@ -0,0 +1,127 @@ +HDF5 "out-tsoftlinks-mergeprune.tsoftlinks.h5" { +GROUP "/" { + DATASET "dset1" { + DATATYPE H5T_STD_I32BE + DATASPACE SIMPLE { ( 4, 2 ) / ( 4, 2 ) } + STORAGE_LAYOUT { + CONTIGUOUS + SIZE 32 + OFFSET 2048 + } + FILTERS { + NONE + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE H5D_FILL_VALUE_DEFAULT + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_LATE + } + } + DATASET "dset2" { + DATATYPE H5T_STD_I32BE + DATASPACE SIMPLE { ( 4, 2 ) / ( 4, 2 ) } + STORAGE_LAYOUT { + CONTIGUOUS + SIZE 32 + OFFSET 2080 + } + FILTERS { + NONE + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE H5D_FILL_VALUE_DEFAULT + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_LATE + } + } + DATATYPE "dtype" H5T_STD_I32BE; + GROUP "group1" { + DATASET "soft_dset1" { + DATATYPE H5T_STD_I32BE + DATASPACE SIMPLE { ( 4, 2 ) / ( 4, 2 ) } + STORAGE_LAYOUT { + CONTIGUOUS + SIZE 32 + OFFSET 2112 + } + FILTERS { + NONE + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE H5D_FILL_VALUE_DEFAULT + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_LATE + } + } + DATASET "soft_dset2" { + DATATYPE H5T_STD_I32BE + DATASPACE SIMPLE { ( 4, 2 ) / ( 4, 2 ) } + STORAGE_LAYOUT { + CONTIGUOUS + SIZE 32 + OFFSET 2144 + } + FILTERS { + NONE + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE H5D_FILL_VALUE_DEFAULT + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_LATE + } + } + DATATYPE "soft_dtype" H5T_STD_I32BE; + GROUP "soft_empty_grp" { + } + } + GROUP "group_empty" { + } + DATASET "soft_dset1" { + DATATYPE H5T_STD_I32BE + DATASPACE SIMPLE { ( 4, 2 ) / ( 4, 2 ) } + STORAGE_LAYOUT { + CONTIGUOUS + SIZE 32 + OFFSET 2176 + } + FILTERS { + NONE + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE H5D_FILL_VALUE_DEFAULT + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_LATE + } + } + DATATYPE "soft_dtype" H5T_STD_I32BE; + GROUP "soft_empty_grp" { + } + GROUP "soft_group1" { + SOFTLINK "soft_dangle" { + LINKTARGET "not_yet" + } + SOFTLINK "soft_dset1" { + LINKTARGET "/dset1" + } + SOFTLINK "soft_dset2" { + LINKTARGET "/dset2" + } + SOFTLINK "soft_dtype" { + LINKTARGET "/dtype" + } + SOFTLINK "soft_empty_grp" { + LINKTARGET "/group_empty" + } + } +} +} diff --git a/tools/test/h5repack/testfiles/tsoftlinks-prune.tsoftlinks.h5.ddl b/tools/test/h5repack/testfiles/tsoftlinks-prune.tsoftlinks.h5.ddl new file mode 100644 index 0000000..de58ef2 --- /dev/null +++ b/tools/test/h5repack/testfiles/tsoftlinks-prune.tsoftlinks.h5.ddl @@ -0,0 +1,47 @@ +HDF5 "out-tsoftlinks-prune.tsoftlinks.h5" { +GROUP "/" { + DATASET "dset1" { + DATATYPE H5T_STD_I32BE + DATASPACE SIMPLE { ( 4, 2 ) / ( 4, 2 ) } + STORAGE_LAYOUT { + CONTIGUOUS + SIZE 32 + OFFSET 2048 + } + FILTERS { + NONE + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE H5D_FILL_VALUE_DEFAULT + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_LATE + } + } + DATASET "dset2" { + DATATYPE H5T_STD_I32BE + DATASPACE SIMPLE { ( 4, 2 ) / ( 4, 2 ) } + STORAGE_LAYOUT { + CONTIGUOUS + SIZE 32 + OFFSET 2080 + } + FILTERS { + NONE + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE H5D_FILL_VALUE_DEFAULT + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_LATE + } + } + DATATYPE "dtype" H5T_STD_I32BE; + GROUP "group1" { + } + GROUP "group_empty" { + } +} +} diff --git a/tools/test/misc/h5perf_gentest.c b/tools/test/misc/h5perf_gentest.c index f50e5fb..511a9e2 100644 --- a/tools/test/misc/h5perf_gentest.c +++ b/tools/test/misc/h5perf_gentest.c @@ -14,7 +14,7 @@ creates a large number of attributes, groups, and datasets by specifying -a, -g, -d options respectively. Using "-h" option to see details. - Programmer: Peter Cao , Jan. 2013 + Programmer: Peter Cao, Jan. 2013 ****************************************************************************/ #include "hdf5.h" @@ -128,7 +128,7 @@ int main (int argc, char *argv[]) Return: Non-negative on success/Negative on failure - Programmer: Peter Cao , Jan. 2013 + Programmer: Peter Cao, Jan. 2013 ****************************************************************************/ herr_t create_perf_test_file(const char *fname, int ngrps, int ndsets, int nattrs, hsize_t nrows, hsize_t dim0, hsize_t chunk, int vlen, diff --git a/tools/test/misc/h5repart_gentest.c b/tools/test/misc/h5repart_gentest.c index bd94104..520069f 100644 --- a/tools/test/misc/h5repart_gentest.c +++ b/tools/test/misc/h5repart_gentest.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Raymond Lu + * Programmer: Raymond Lu * June 1, 2005 * * Purpose: Generate a family file of 1024 bytes for each member diff --git a/tools/test/misc/testfiles/h5mkgrp_version.txt.in b/tools/test/misc/testfiles/h5mkgrp_version.txt.in index 75c13a5..37dbabd 100644 --- a/tools/test/misc/testfiles/h5mkgrp_version.txt.in +++ b/tools/test/misc/testfiles/h5mkgrp_version.txt.in @@ -1 +1 @@ -h5mkgrp: Version @HDF5_PACKAGE_VERSION_STRING@ +h5mkgrp: Version @HDF5_RELEASE_VERSION_STRING@ diff --git a/tools/test/misc/testh5mkgrp.sh.in b/tools/test/misc/testh5mkgrp.sh.in index 3ad1f71..7dc8155 100644 --- a/tools/test/misc/testh5mkgrp.sh.in +++ b/tools/test/misc/testh5mkgrp.sh.in @@ -13,7 +13,7 @@ # # Tests for the h5mkgrp tool # -# Quincey Koziol (koziol@hdfgroup.org) +# Quincey Koziol # Tuesday, February 13, 2007 # @@ -150,10 +150,11 @@ TOOLTEST() { TESTING $H5MKGRP $@ ( - cd $TESTDIR - $RUNSERIAL $H5MKGRP_BIN $@ + cd $TESTDIR + $RUNSERIAL $H5MKGRP_BIN $@ ) > output.out RET=$? + if [ $RET != 0 ]; then echo "*FAILED*" echo "failed result is:" @@ -164,7 +165,7 @@ TOOLTEST() # Clean up output file if test -z "$HDF5_NOCLEANUP"; then - rm -f output.out + rm -f output.out fi fi } @@ -181,8 +182,8 @@ H5LSTEST() # any unexpected output from that stream too. VERIFY_H5LS $@ ( - cd $TESTDIR - $RUNSERIAL $H5LS_BIN $H5LS_ARGS $@ + cd $TESTDIR + $RUNSERIAL $H5LS_BIN $H5LS_ARGS $@ ) 2>&1 |sed 's/Modified:.*/Modified: XXXX-XX-XX XX:XX:XX XXX/' >$actual # save actual in case it is needed later. @@ -190,25 +191,25 @@ H5LSTEST() STDOUT_FILTER $actual STDERR_FILTER $actual - if [ ! -f $expect ]; then - # Create the expect file if it doesn't yet exist. - echo " CREATED" - cp $actual $expect - echo " Expected result (*.ls) missing" - nerrors="`expr $nerrors + 1`" - elif $CMP $expect $actual; then - echo " PASSED" - else - echo "*FAILED*" - echo " Expected result (*.ls) differs from actual result (*.out)" - nerrors="`expr $nerrors + 1`" - test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /' - fi - - # Clean up output file - if test -z "$HDF5_NOCLEANUP"; then - rm -f $actual $actual_sav - fi + if [ ! -f $expect ]; then + # Create the expect file if it doesn't yet exist. + echo " CREATED" + cp $actual $expect + echo " Expected result (*.ls) missing" + nerrors="`expr $nerrors + 1`" + elif $CMP $expect $actual; then + echo " PASSED" + else + echo "*FAILED*" + echo " Expected result (*.ls) differs from actual result (*.out)" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /' + fi + + # Clean up output file + if test -z "$HDF5_NOCLEANUP"; then + rm -f $actual $actual_sav + fi } # Single run of tool @@ -258,30 +259,30 @@ CMPTEST() # any unexpected output from that stream too. TESTING $H5MKGRP $@ ( - cd $TESTDIR - $RUNSERIAL $H5MKGRP_BIN $@ + cd $TESTDIR + $RUNSERIAL $H5MKGRP_BIN $@ ) >$actual 2>$actual_err cat $actual_err >> $actual - if [ ! -f $expect ]; then - # Create the expect file if it doesn't yet exist. - echo " CREATED" - cp $actual $expect - echo " Expected result (*.txt) missing" - nerrors="`expr $nerrors + 1`" - elif $CMP $expect $actual; then - echo " PASSED" - else - echo "*FAILED*" - echo " Expected result (*.txt) differs from actual result (*.out)" - nerrors="`expr $nerrors + 1`" - test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /' - fi - - # Clean up output file - if test -z "$HDF5_NOCLEANUP"; then - rm -f $actual $actual_err - fi + if [ ! -f $expect ]; then + # Create the expect file if it doesn't yet exist. + echo " CREATED" + cp $actual $expect + echo " Expected result (*.txt) missing" + nerrors="`expr $nerrors + 1`" + elif $CMP $expect $actual; then + echo " PASSED" + else + echo "*FAILED*" + echo " Expected result (*.txt) differs from actual result (*.out)" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /' + fi + + # Clean up output file + if test -z "$HDF5_NOCLEANUP"; then + rm -f $actual $actual_err + fi } ############################################################################## diff --git a/tools/test/perform/CMakeLists.txt b/tools/test/perform/CMakeLists.txt index 6780c06..3c45e85 100644 --- a/tools/test/perform/CMakeLists.txt +++ b/tools/test/perform/CMakeLists.txt @@ -78,7 +78,7 @@ set (chunk_cache_SOURCES ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/chunk_cache.c ) add_executable (chunk_cache ${chunk_cache_SOURCES}) -target_include_directories (chunk_cache PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +target_include_directories (chunk_cache PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (chunk_cache STATIC) target_link_libraries (chunk_cache PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) diff --git a/tools/test/perform/chunk.c b/tools/test/perform/chunk.c index 3603c9b..bd16e1d 100644 --- a/tools/test/perform/chunk.c +++ b/tools/test/perform/chunk.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, May 14, 1998 * * Purpose: Checks the effect of various I/O request sizes and raw data diff --git a/tools/test/perform/chunk_cache.c b/tools/test/perform/chunk_cache.c index e594e34..d7c56af 100644 --- a/tools/test/perform/chunk_cache.c +++ b/tools/test/perform/chunk_cache.c @@ -19,6 +19,7 @@ */ #include "hdf5.h" #include "H5private.h" +#include "h5test.h" #define FILENAME "chunk_cache_perf.h5" @@ -79,18 +80,6 @@ counter (unsigned H5_ATTR_UNUSED flags, size_t H5_ATTR_UNUSED cd_nelmts, } /*---------------------------------------------------------------------------*/ -static double retrieve_time(void) -{ -#ifdef H5_HAVE_GETTIMEOFDAY - struct timeval t; - HDgettimeofday(&t, NULL); - return ((double)t.tv_sec + (double)t.tv_usec / 1000000); -#else - return 0.0; -#endif -} - -/*---------------------------------------------------------------------------*/ static void cleanup (void) { @@ -110,8 +99,7 @@ static int create_dset1(hid_t file) hid_t dcpl = H5I_INVALID_HID; hsize_t dims[RANK] = {DSET1_DIM1, DSET1_DIM2}; hsize_t chunk_dims[RANK] = {CHUNK1_DIM1, CHUNK1_DIM2}; - int data[DSET1_DIM1][DSET1_DIM2]; /* data for writing */ - int i, j; + int **data; /* data for writing */ /* Create the data space. */ if((dataspace = H5Screate_simple (RANK, dims, NULL)) < 0) @@ -135,9 +123,10 @@ static int create_dset1(hid_t file) H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) goto error; - for (i = 0; i < DSET1_DIM1; i++) - for (j = 0; j < DSET1_DIM2; j++) - data[i][j] = i+j; + /* Create & fill array */ + H5TEST_ALLOCATE_2D_ARRAY(data, int, DSET1_DIM1, DSET1_DIM2); + H5TEST_FILL_2D_ARRAY(data, int, DSET1_DIM1, DSET1_DIM2); + /* Write data to dataset */ if(H5Dwrite (dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, @@ -171,17 +160,16 @@ static int create_dset2(hid_t file) hid_t dcpl = H5I_INVALID_HID; hsize_t dims[RANK] = {DSET2_DIM1, DSET2_DIM2}; hsize_t chunk_dims[RANK] = {CHUNK2_DIM1, CHUNK2_DIM2}; - int data[DSET2_DIM1][DSET2_DIM2]; /* data for writing */ - int i, j; + int **data; /* data for writing */ /* Create the data space. */ - if((dataspace = H5Screate_simple (RANK, dims, NULL)) < 0) + if((dataspace = H5Screate_simple(RANK, dims, NULL)) < 0) goto error; /* Modify dataset creation properties, i.e. enable chunking */ - if((dcpl = H5Pcreate (H5P_DATASET_CREATE)) < 0) + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; - if(H5Pset_chunk (dcpl, RANK, chunk_dims) < 0) + if(H5Pset_chunk(dcpl, RANK, chunk_dims) < 0) goto error; /* Set the dummy filter simply for counting the number of bytes being read into the memory */ @@ -191,35 +179,35 @@ static int create_dset2(hid_t file) goto error; /* Create a new dataset within the file using chunk creation properties. */ - if((dataset = H5Dcreate2 (file, DSET2_NAME, H5T_NATIVE_INT, dataspace, + if((dataset = H5Dcreate2(file, DSET2_NAME, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) goto error; - for (i = 0; i < DSET2_DIM1; i++) - for (j = 0; j < DSET2_DIM2; j++) - data[i][j] = i+j; + /* Create & fill array */ + H5TEST_ALLOCATE_2D_ARRAY(data, int, DSET2_DIM1, DSET2_DIM2); + H5TEST_FILL_2D_ARRAY(data, int, DSET2_DIM1, DSET2_DIM2); /* Write data to dataset */ - if(H5Dwrite (dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, - H5P_DEFAULT, data) < 0) + if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0) goto error; /* Close resources */ - H5Dclose (dataset); - H5Pclose (dcpl); - H5Sclose (dataspace); + H5Dclose(dataset); + H5Pclose(dcpl); + H5Sclose(dataspace); return 0; error: H5E_BEGIN_TRY { - H5Dclose (dataset); - H5Pclose (dcpl); - H5Sclose (dataspace); + H5Dclose(dataset); + H5Pclose(dcpl); + H5Sclose(dataspace); } H5E_END_TRY; return 1; } + /*--------------------------------------------------------------------------- * Check the performance of the chunk cache when partial chunks exist * along the dataset dimensions. @@ -253,7 +241,7 @@ static int check_partial_chunks_perf(hid_t file) nbytes_global = 0; - start_t = retrieve_time(); + start_t = H5_get_time(); /* Read the data row by row */ for(i = 0; i < DSET1_DIM1; i++) { @@ -267,13 +255,12 @@ static int check_partial_chunks_perf(hid_t file) goto error; } - end_t = retrieve_time(); + end_t = H5_get_time(); -#ifdef H5_HAVE_GETTIMEOFDAY - printf("1. Partial chunks: total read time is %lf; number of bytes being read from file is %lu\n", (end_t -start_t), nbytes_global); -#else - printf("1. Partial chunks: no total read time because gettimeofday() is not available; number of bytes being read from file is %lu\n", nbytes_global); -#endif + if((end_t - start_t) > (double)0.0f) + printf("1. Partial chunks: total read time is %lf; number of bytes being read from file is %lu\n", (end_t -start_t), nbytes_global); + else + printf("1. Partial chunks: no total read time because timer is not available; number of bytes being read from file is %lu\n", nbytes_global); H5Dclose (dataset); H5Sclose (filespace); @@ -328,7 +315,7 @@ static int check_hash_value_perf(hid_t file) nbytes_global = 0; - start_t = retrieve_time(); + start_t = H5_get_time(); /* Read the data column by column */ for(i = 0; i < DSET2_DIM2; i++) { @@ -342,13 +329,12 @@ static int check_hash_value_perf(hid_t file) goto error; } - end_t = retrieve_time(); + end_t = H5_get_time(); -#ifdef H5_HAVE_GETTIMEOFDAY - printf("2. Hash value: total read time is %lf; number of bytes being read from file is %lu\n", (end_t -start_t), nbytes_global); -#else - printf("2. Hash value: no total read time because gettimeofday() is not available; number of bytes being read from file is %lu\n", nbytes_global); -#endif + if((end_t - start_t) > (double)0.0f) + printf("2. Hash value: total read time is %lf; number of bytes being read from file is %lu\n", (end_t -start_t), nbytes_global); + else + printf("2. Hash value: no total read time because timer is not available; number of bytes being read from file is %lu\n", nbytes_global); H5Dclose (dataset); H5Sclose (filespace); diff --git a/tools/test/perform/iopipe.c b/tools/test/perform/iopipe.c index bf4728d..bb74a1b 100644 --- a/tools/test/perform/iopipe.c +++ b/tools/test/perform/iopipe.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, March 12, 1998 */ @@ -21,10 +21,6 @@ #include "H5private.h" -#ifdef H5_HAVE_SYS_TIMEB -#include -#endif - #define RAW_FILE_NAME "iopipe.raw" #define HDF5_FILE_NAME "iopipe.h5" @@ -56,25 +52,18 @@ * Programmer: Robb Matzke * Thursday, March 12, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ -#ifdef H5_HAVE_GETRUSAGE static void -print_stats (const char *prefix, +print_stats(const char *prefix, +#ifdef H5_HAVE_GETRUSAGE struct rusage *r_start, struct rusage *r_stop, - struct timeval *t_start, struct timeval *t_stop, - size_t nbytes) -#else /* H5_HAVE_GETRUSAGE */ -static void -print_stats (const char *prefix, - struct timeval *r_start, struct timeval *r_stop, - struct timeval *t_start, struct timeval *t_stop, - size_t nbytes) #endif /* H5_HAVE_GETRUSAGE */ + double t_start, double t_stop, + size_t nbytes) { - double e_time, bw; + double e_time; + char bw[16]; #ifdef H5_HAVE_GETRUSAGE double u_time, s_time; @@ -88,27 +77,16 @@ print_stats (const char *prefix, ((double)(r_start->ru_stime.tv_sec)+ (double)(r_start->ru_stime.tv_usec)/(double)1000000.0F); #endif -#ifndef H5_HAVE_SYS_TIMEB - e_time = ((double)(t_stop->tv_sec)+ - (double)(t_stop->tv_usec)/(double)1000000.0F) - - ((double)(t_start->tv_sec)+ - (double)(t_start->tv_usec)/(double)1000000.0F); -#else - e_time = ((double)(t_stop->tv_sec)+ - (double)(t_stop->tv_usec)/(double)1000.0F) - - ((double)(t_start->tv_sec)+ - (double)(t_start->tv_usec)/(double)1000.0F); -#endif - bw = (double)nbytes / e_time; + e_time = t_stop - t_start; + H5_bandwidth(bw, (double)nbytes, e_time); #ifdef H5_HAVE_GETRUSAGE - printf (HEADING "%1.2fuser %1.2fsystem %1.2felapsed %1.2fMB/s\n", - prefix, u_time, s_time, e_time, bw/(1024*1024)); + HDprintf(HEADING "%1.2fuser %1.2fsystem %1.2felapsed %s\n", + prefix, u_time, s_time, e_time, bw); #else - printf (HEADING "%1.2felapsed %1.2fMB/s\n", - prefix, e_time, bw/(1024*1024)); + HDprintf(HEADING "%1.2felapsed %s\n", + prefix, e_time, bw); #endif - } @@ -122,12 +100,10 @@ print_stats (const char *prefix, * Programmer: Robb Matzke * Thursday, March 12, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ static void -synchronize (void) +synchronize(void) { #ifdef H5_HAVE_SYSTEM #if defined(H5_HAVE_WIN32_API) && ! defined(__CYGWIN__) @@ -157,24 +133,20 @@ synchronize (void) * Programmer: Robb Matzke * Thursday, March 12, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ int -main (void) +main(void) { - static hsize_t size[2] = {REQUEST_SIZE_X, REQUEST_SIZE_Y}; - static unsigned nread = NREAD_REQUESTS, nwrite = NWRITE_REQUESTS; + hsize_t size[2] = {REQUEST_SIZE_X, REQUEST_SIZE_Y}; + unsigned nread = NREAD_REQUESTS, nwrite = NWRITE_REQUESTS; unsigned char *the_data = NULL; hid_t file, dset, file_space = H5I_INVALID_HID; #ifdef H5_HAVE_GETRUSAGE struct rusage r_start, r_stop; -#else - struct timeval r_start, r_stop; #endif - struct timeval t_start, t_stop; + double t_start, t_stop; int fd; unsigned u; herr_t H5_ATTR_NDEBUG_UNUSED status; @@ -184,322 +156,221 @@ main (void) hsize_t count[2]; -#ifdef H5_HAVE_SYS_TIMEB - struct _timeb *tbstart = malloc(sizeof(struct _timeb)); - struct _timeb *tbstop = malloc(sizeof(struct _timeb)); -#endif /* * The extra cast in the following statement is a bug workaround for the * Win32 version 5.0 compiler. * 1998-11-06 ptl */ - printf ("I/O request size is %1.1fMB\n", - (double)(hssize_t)(size[0]*size[1])/(double)1024.0F*(double)1024); + HDprintf("I/O request size is %1.1fMB\n", + (double)(hssize_t)(size[0] * size[1]) / (double)1024.0F * (double)1024); /* Open the files */ - file = H5Fcreate (HDF5_FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - HDassert (file>=0); - fd = HDopen (RAW_FILE_NAME, O_RDWR|O_CREAT|O_TRUNC, 0666); - HDassert (fd>=0); + file = H5Fcreate(HDF5_FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + HDassert(file >= 0); + fd = HDopen(RAW_FILE_NAME, O_RDWR|O_CREAT|O_TRUNC, 0666); + HDassert(fd >= 0); /* Create the dataset */ - file_space = H5Screate_simple (2, size, size); + file_space = H5Screate_simple(2, size, size); HDassert(file_space >= 0); dset = H5Dcreate2(file, "dset", H5T_NATIVE_UCHAR, file_space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); HDassert(dset >= 0); - the_data = (unsigned char *)malloc((size_t)(size[0] * size[1])); + the_data = (unsigned char *)HDmalloc((size_t)(size[0] * size[1])); /* initial fill for lazy malloc */ HDmemset(the_data, 0xAA, (size_t)(size[0] * size[1])); + /* Fill raw */ - synchronize (); + synchronize(); #ifdef H5_HAVE_GETRUSAGE HDgetrusage(RUSAGE_SELF, &r_start); #endif -#ifdef H5_HAVE_GETTIMEOFDAY - HDgettimeofday(&t_start, NULL); -#else -#ifdef H5_HAVE_SYS_TIMEB - _ftime(tbstart); -#endif -#endif - HDfprintf (stderr, HEADING, "fill raw"); + t_start = H5_get_time(); + HDfprintf(stderr, HEADING, "fill raw"); for(u = 0; u < nwrite; u++) { - putc (PROGRESS, stderr); - HDfflush(stderr); - HDmemset(the_data, 0xAA, (size_t)(size[0]*size[1])); + HDputc(PROGRESS, stderr); + HDfflush(stderr); + HDmemset(the_data, 0xAA, (size_t)(size[0] * size[1])); } #ifdef H5_HAVE_GETRUSAGE HDgetrusage(RUSAGE_SELF, &r_stop); #endif -#ifdef H5_HAVE_GETTIMEOFDAY - HDgettimeofday(&t_stop, NULL); -#else -#ifdef H5_HAVE_SYS_TIMEB - _ftime(tbstop); - t_start.tv_sec = tbstart->time; - t_start.tv_usec = tbstart->millitm; - t_stop.tv_sec = tbstop->time; - t_stop.tv_usec = tbstop->millitm; -#endif -#endif - putc ('\n', stderr); - print_stats ("fill raw", - &r_start, &r_stop, &t_start, &t_stop, - (size_t)(nread*size[0]*size[1])); + t_stop = H5_get_time(); + HDputc('\n', stderr); + print_stats("fill raw", +#ifdef H5_HAVE_GETRUSAGE + &r_start, &r_stop, +#endif /* H5_HAVE_GETRUSAGE */ + t_start, t_stop, (size_t)(nread * size[0] * size[1])); /* Fill hdf5 */ - synchronize (); + synchronize(); #ifdef H5_HAVE_GETRUSAGE HDgetrusage(RUSAGE_SELF, &r_start); #endif -#ifdef H5_HAVE_GETTIMEOFDAY - HDgettimeofday(&t_start, NULL); -#else -#ifdef H5_HAVE_SYS_TIMEB - _ftime(tbstart); -#endif -#endif - HDfprintf (stderr, HEADING, "fill hdf5"); + t_start = H5_get_time(); + HDfprintf(stderr, HEADING, "fill hdf5"); for(u = 0; u < nread; u++) { - putc (PROGRESS, stderr); - HDfflush(stderr); - status = H5Dread (dset, H5T_NATIVE_UCHAR, file_space, file_space, - H5P_DEFAULT, the_data); - HDassert (status>=0); + HDputc(PROGRESS, stderr); + HDfflush(stderr); + status = H5Dread(dset, H5T_NATIVE_UCHAR, file_space, file_space, + H5P_DEFAULT, the_data); + HDassert(status >= 0); } #ifdef H5_HAVE_GETRUSAGE HDgetrusage(RUSAGE_SELF, &r_stop); #endif -#ifdef H5_HAVE_GETTIMEOFDAY - HDgettimeofday(&t_stop, NULL); -#else -#ifdef H5_HAVE_SYS_TIMEB - _ftime(tbstop); - t_start.tv_sec = tbstart->time; - t_start.tv_usec = tbstart->millitm; - t_stop.tv_sec = tbstop->time; - t_stop.tv_usec = tbstop->millitm; -#endif -#endif - putc ('\n', stderr); - print_stats ("fill hdf5", - &r_start, &r_stop, &t_start, &t_stop, - (size_t)(nread*size[0]*size[1])); + t_stop = H5_get_time(); + HDputc('\n', stderr); + print_stats("fill hdf5", +#ifdef H5_HAVE_GETRUSAGE + &r_start, &r_stop, +#endif /* H5_HAVE_GETRUSAGE */ + t_start, t_stop, (size_t)(nread * size[0] * size[1])); /* Write the raw dataset */ - synchronize (); + synchronize(); #ifdef H5_HAVE_GETRUSAGE HDgetrusage(RUSAGE_SELF, &r_start); #endif -#ifdef H5_HAVE_GETTIMEOFDAY - HDgettimeofday(&t_start, NULL); -#else -#ifdef H5_HAVE_SYS_TIMEB - _ftime(tbstart); -#endif -#endif - HDfprintf (stderr, HEADING, "out raw"); + t_start = H5_get_time(); + HDfprintf(stderr, HEADING, "out raw"); for(u = 0; u < nwrite; u++) { - putc (PROGRESS, stderr); - HDfflush(stderr); - offset = HDlseek (fd, (off_t)0, SEEK_SET); - HDassert (0==offset); - n = HDwrite (fd, the_data, (size_t)(size[0]*size[1])); - HDassert (n>=0 && (size_t)n==size[0]*size[1]); + HDputc(PROGRESS, stderr); + HDfflush(stderr); + offset = HDlseek(fd, (off_t)0, SEEK_SET); + HDassert(0 == offset); + n = HDwrite(fd, the_data, (size_t)(size[0] * size[1])); + HDassert(n >= 0 && (size_t)n == (size[0] * size[1])); } #ifdef H5_HAVE_GETRUSAGE HDgetrusage(RUSAGE_SELF, &r_stop); #endif -#ifdef H5_HAVE_GETTIMEOFDAY - HDgettimeofday(&t_stop, NULL); -#else -#ifdef H5_HAVE_SYS_TIMEB - _ftime(tbstop); - t_start.tv_sec = tbstart->time; - t_start.tv_usec = tbstart->millitm; - t_stop.tv_sec = tbstop->time; - t_stop.tv_usec = tbstop->millitm; -#endif -#endif - putc ('\n', stderr); - print_stats ("out raw", - &r_start, &r_stop, &t_start, &t_stop, - (size_t)(nread*size[0]*size[1])); + t_stop = H5_get_time(); + HDputc('\n', stderr); + print_stats("out raw", +#ifdef H5_HAVE_GETRUSAGE + &r_start, &r_stop, +#endif /* H5_HAVE_GETRUSAGE */ + t_start, t_stop, (size_t)(nread * size[0] * size[1])); /* Write the hdf5 dataset */ - synchronize (); + synchronize(); #ifdef H5_HAVE_GETRUSAGE HDgetrusage(RUSAGE_SELF, &r_start); #endif -#ifdef H5_HAVE_GETTIMEOFDAY - HDgettimeofday(&t_start, NULL); -#else -#ifdef H5_HAVE_SYS_TIMEB - _ftime(tbstart); -#endif -#endif - HDfprintf (stderr, HEADING, "out hdf5"); + t_start = H5_get_time(); + HDfprintf(stderr, HEADING, "out hdf5"); for(u = 0; u < nwrite; u++) { - putc (PROGRESS, stderr); - HDfflush(stderr); - status = H5Dwrite (dset, H5T_NATIVE_UCHAR, H5S_ALL, H5S_ALL, - H5P_DEFAULT, the_data); - HDassert (status>=0); + HDputc(PROGRESS, stderr); + HDfflush(stderr); + status = H5Dwrite(dset, H5T_NATIVE_UCHAR, H5S_ALL, H5S_ALL, + H5P_DEFAULT, the_data); + HDassert(status >= 0); } #ifdef H5_HAVE_GETRUSAGE HDgetrusage(RUSAGE_SELF, &r_stop); #endif -#ifdef H5_HAVE_GETTIMEOFDAY - HDgettimeofday(&t_stop, NULL); -#else -#ifdef H5_HAVE_SYS_TIMEB - _ftime(tbstop); - t_start.tv_sec = tbstart->time; - t_start.tv_usec = tbstart->millitm; - t_stop.tv_sec = tbstop->time; - t_stop.tv_usec = tbstop->millitm; -#endif -#endif - putc ('\n', stderr); - print_stats ("out hdf5", - &r_start, &r_stop, &t_start, &t_stop, - (size_t)(nread*size[0]*size[1])); + t_stop = H5_get_time(); + HDputc('\n', stderr); + print_stats("out hdf5", +#ifdef H5_HAVE_GETRUSAGE + &r_start, &r_stop, +#endif /* H5_HAVE_GETRUSAGE */ + t_start, t_stop, (size_t)(nread * size[0] * size[1])); /* Read the raw dataset */ - synchronize (); + synchronize(); #ifdef H5_HAVE_GETRUSAGE HDgetrusage(RUSAGE_SELF, &r_start); #endif -#ifdef H5_HAVE_GETTIMEOFDAY - HDgettimeofday(&t_start, NULL); -#else -#ifdef H5_HAVE_SYS_TIMEB - _ftime(tbstart); -#endif -#endif - HDfprintf (stderr, HEADING, "in raw"); + t_start = H5_get_time(); + HDfprintf(stderr, HEADING, "in raw"); for(u = 0; u < nread; u++) { - putc (PROGRESS, stderr); - HDfflush(stderr); - offset = HDlseek (fd, (off_t)0, SEEK_SET); - HDassert (0==offset); - n = HDread (fd, the_data, (size_t)(size[0]*size[1])); - HDassert (n>=0 && (size_t)n==size[0]*size[1]); + HDputc(PROGRESS, stderr); + HDfflush(stderr); + offset = HDlseek(fd, (off_t)0, SEEK_SET); + HDassert(0 == offset); + n = HDread(fd, the_data, (size_t)(size[0] * size[1])); + HDassert(n >= 0 && (size_t)n == (size[0] * size[1])); } #ifdef H5_HAVE_GETRUSAGE HDgetrusage(RUSAGE_SELF, &r_stop); #endif -#ifdef H5_HAVE_GETTIMEOFDAY - HDgettimeofday(&t_stop, NULL); -#else -#ifdef H5_HAVE_SYS_TIMEB - _ftime(tbstop); - t_start.tv_sec = tbstart->time; - t_start.tv_usec = tbstart->millitm; - t_stop.tv_sec = tbstop->time; - t_stop.tv_usec = tbstop->millitm; -#endif -#endif - putc ('\n', stderr); - print_stats ("in raw", - &r_start, &r_stop, &t_start, &t_stop, - (size_t)(nread*size[0]*size[1])); + t_stop = H5_get_time(); + HDputc('\n', stderr); + print_stats("in raw", +#ifdef H5_HAVE_GETRUSAGE + &r_start, &r_stop, +#endif /* H5_HAVE_GETRUSAGE */ + t_start, t_stop, (size_t)(nread * size[0] * size[1])); /* Read the hdf5 dataset */ - synchronize (); + synchronize(); #ifdef H5_HAVE_GETRUSAGE HDgetrusage(RUSAGE_SELF, &r_start); #endif -#ifdef H5_HAVE_GETTIMEOFDAY - HDgettimeofday(&t_start, NULL); -#else -#ifdef H5_HAVE_SYS_TIMEB - _ftime(tbstart); -#endif -#endif - HDfprintf (stderr, HEADING, "in hdf5"); + t_start = H5_get_time(); + HDfprintf(stderr, HEADING, "in hdf5"); for(u = 0; u < nread; u++) { - putc (PROGRESS, stderr); - HDfflush(stderr); - status = H5Dread (dset, H5T_NATIVE_UCHAR, file_space, file_space, - H5P_DEFAULT, the_data); - HDassert (status>=0); + HDputc(PROGRESS, stderr); + HDfflush(stderr); + status = H5Dread(dset, H5T_NATIVE_UCHAR, file_space, file_space, + H5P_DEFAULT, the_data); + HDassert(status >= 0); } #ifdef H5_HAVE_GETRUSAGE HDgetrusage(RUSAGE_SELF, &r_stop); #endif -#ifdef H5_HAVE_GETTIMEOFDAY - HDgettimeofday(&t_stop, NULL); -#else -#ifdef H5_HAVE_SYS_TIMEB - _ftime(tbstop); - t_start.tv_sec = tbstart->time; - t_start.tv_usec = tbstart->millitm; - t_stop.tv_sec = tbstop->time; - t_stop.tv_usec = tbstop->millitm; -#endif -#endif - putc ('\n', stderr); - print_stats ("in hdf5", - &r_start, &r_stop, &t_start, &t_stop, - (size_t)(nread*size[0]*size[1])); + t_stop = H5_get_time(); + HDputc('\n', stderr); + print_stats("in hdf5", +#ifdef H5_HAVE_GETRUSAGE + &r_start, &r_stop, +#endif /* H5_HAVE_GETRUSAGE */ + t_start, t_stop, (size_t)(nread * size[0] * size[1])); /* Read hyperslab */ - HDassert (size[0]>20 && size[1]>20); + HDassert(size[0] > 20 && size[1] > 20); start[0] = start[1] = 10; - count[0] = count[1] = size[0]-20; - status = H5Sselect_hyperslab (file_space, H5S_SELECT_SET, start, NULL, count, NULL); - HDassert (status>=0); - synchronize (); + count[0] = count[1] = size[0] - 20; + status = H5Sselect_hyperslab(file_space, H5S_SELECT_SET, start, NULL, count, NULL); + HDassert(status >= 0); + synchronize(); #ifdef H5_HAVE_GETRUSAGE HDgetrusage(RUSAGE_SELF, &r_start); #endif -#ifdef H5_HAVE_GETTIMEOFDAY - HDgettimeofday(&t_start, NULL); -#else -#ifdef H5_HAVE_SYS_TIMEB - _ftime(tbstart); -#endif -#endif - HDfprintf (stderr, HEADING, "in hdf5 partial"); + t_start = H5_get_time(); + HDfprintf(stderr, HEADING, "in hdf5 partial"); for(u = 0; u < nread; u++) { - putc (PROGRESS, stderr); - HDfflush(stderr); - status = H5Dread (dset, H5T_NATIVE_UCHAR, file_space, file_space, - H5P_DEFAULT, the_data); - HDassert (status>=0); + HDputc(PROGRESS, stderr); + HDfflush(stderr); + status = H5Dread(dset, H5T_NATIVE_UCHAR, file_space, file_space, + H5P_DEFAULT, the_data); + HDassert(status >= 0); } #ifdef H5_HAVE_GETRUSAGE HDgetrusage(RUSAGE_SELF, &r_stop); #endif -#ifdef H5_HAVE_GETTIMEOFDAY - HDgettimeofday(&t_stop, NULL); -#else -#ifdef H5_HAVE_SYS_TIMEB - _ftime(tbstop); - t_start.tv_sec = tbstart->time; - t_start.tv_usec = tbstart->millitm; - t_stop.tv_sec = tbstop->time; - t_stop.tv_usec = tbstop->millitm; -#endif -#endif - putc('\n', stderr); + t_stop = H5_get_time(); + HDputc('\n', stderr); print_stats("in hdf5 partial", - &r_start, &r_stop, &t_start, &t_stop, - (size_t)(nread*count[0]*count[1])); - - +#ifdef H5_HAVE_GETRUSAGE + &r_start, &r_stop, +#endif /* H5_HAVE_GETRUSAGE */ + t_start, t_stop, (size_t)(nread * size[0] * size[1])); /* Close everything */ HDclose(fd); + H5Dclose(dset); H5Sclose(file_space); H5Fclose(file); - free(the_data); + + HDfree(the_data); return 0; } diff --git a/tools/test/perform/overhead.c b/tools/test/perform/overhead.c index 58558a5..bb3aff5 100644 --- a/tools/test/perform/overhead.c +++ b/tools/test/perform/overhead.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, September 28, 1998 * * Purpose: Creates a chunked dataset and measures the storage overhead. diff --git a/tools/test/perform/perf_meta.c b/tools/test/perform/perf_meta.c index b56f074..77248cc 100644 --- a/tools/test/perform/perf_meta.c +++ b/tools/test/perform/perf_meta.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Friday, Oct 3, 2004 * * Purpose: Tests performance of metadata diff --git a/tools/testfiles/trefer_attrR.ddl b/tools/testfiles/trefer_attrR.ddl index e64c8e6..118e7bf 100644 --- a/tools/testfiles/trefer_attrR.ddl +++ b/tools/testfiles/trefer_attrR.ddl @@ -12,16 +12,16 @@ GROUP "/" { } } ATTRIBUTE "trefer_attr.h5/Group1/Dataset2/Attr1" { - NULL + NULL } - ATTRIBUTE "trefer_attr.h5/Group1/Attr2" { + ATTRIBUTE "trefer_attr.h5/Group1/Attr2" { DATATYPE H5T_STD_U32LE DATASPACE SIMPLE { ( 4 ) / ( 4 ) } DATA { (0): 1, 4, 7, 10 } } - ATTRIBUTE "trefer_attr.h5/Group1/Datatype1/Attr3" { + ATTRIBUTE "trefer_attr.h5/Group1/Datatype1/Attr3" { DATATYPE H5T_STD_U32LE DATASPACE SIMPLE { ( 4 ) / ( 4 ) } DATA { diff --git a/tools/testfiles/trefer_extR.ddl b/tools/testfiles/trefer_extR.ddl index 3d4647d..a96e5fd 100644 --- a/tools/testfiles/trefer_extR.ddl +++ b/tools/testfiles/trefer_extR.ddl @@ -12,16 +12,16 @@ GROUP "/" { } } ATTRIBUTE "trefer_ext1.h5/Group1/Dataset2/Attr1" { - NULL + NULL } - ATTRIBUTE "trefer_ext1.h5/Group1/Attr2" { + ATTRIBUTE "trefer_ext1.h5/Group1/Attr2" { DATATYPE H5T_STD_U32LE DATASPACE SIMPLE { ( 4 ) / ( 4 ) } DATA { (0): 1, 4, 7, 10 } } - ATTRIBUTE "trefer_ext1.h5/Group1/Datatype1/Attr3" { + ATTRIBUTE "trefer_ext1.h5/Group1/Datatype1/Attr3" { DATATYPE H5T_STD_U32LE DATASPACE SIMPLE { ( 4 ) / ( 4 ) } DATA { diff --git a/utils/mirror_vfd/CMakeLists.txt b/utils/mirror_vfd/CMakeLists.txt index 1926352..6137e82 100644 --- a/utils/mirror_vfd/CMakeLists.txt +++ b/utils/mirror_vfd/CMakeLists.txt @@ -13,10 +13,10 @@ add_executable (mirror_server ${mirror_server_SOURCES}) target_include_directories (mirror_server PRIVATE "${HDF5_UITLS_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (mirror_server STATIC) - target_link_libraries (mirror_server PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) + target_link_libraries (mirror_server PRIVATE ${HDF5_LIB_TARGET}) else () TARGET_C_PROPERTIES (mirror_server SHARED) - target_link_libraries (mirror_server PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + target_link_libraries (mirror_server PRIVATE ${HDF5_LIBSH_TARGET}) endif () set_target_properties (mirror_server PROPERTIES FOLDER utils) set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};mirror_server") @@ -31,10 +31,10 @@ add_executable (mirror_server_stop ${mirror_server_stop_SOURCES}) target_include_directories (mirror_server_stop PRIVATE "${HDF5_UITLS_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (mirror_server_stop STATIC) - target_link_libraries (mirror_server_stop PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) + target_link_libraries (mirror_server_stop PRIVATE ${HDF5_LIB_TARGET}) else () TARGET_C_PROPERTIES (mirror_server_stop SHARED) - target_link_libraries (mirror_server_stop PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + target_link_libraries (mirror_server_stop PRIVATE ${HDF5_LIBSH_TARGET}) endif () set_target_properties (mirror_server_stop PROPERTIES FOLDER utils) set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};mirror_server_stop") diff --git a/utils/mirror_vfd/mirror_remote.h b/utils/mirror_vfd/mirror_remote.h index 9132d51..67e95a5 100644 --- a/utils/mirror_vfd/mirror_remote.h +++ b/utils/mirror_vfd/mirror_remote.h @@ -20,6 +20,8 @@ #ifdef H5_HAVE_MIRROR_VFD +#include "H5FDmirror_priv.h" /* Private header for the mirror VFD */ + #define V_NONE 0 #define V_ERR 1 #define V_WARN 2 -- cgit v0.12